Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| eb26ca7ae1 | |||
| c47810c33b | |||
| 8ee6e3848e | |||
| 7ae44a055b | |||
| a3a3cafbc8 |
199
.clang-format
199
.clang-format
@ -1,199 +0,0 @@
|
||||
# Commented out parameters are those with the same value as base LLVM style.
|
||||
# We can uncomment them if we want to change their value, or enforce the
|
||||
# chosen value in case the base style changes (last sync: Clang 14.0).
|
||||
---
|
||||
### General config, applies to all languages ###
|
||||
BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: DontAlign
|
||||
# AlignArrayOfStructures: None
|
||||
# AlignConsecutiveMacros: None
|
||||
# AlignConsecutiveAssignments: None
|
||||
# AlignConsecutiveBitFields: None
|
||||
# AlignConsecutiveDeclarations: None
|
||||
# AlignEscapedNewlines: Right
|
||||
AlignOperands: DontAlign
|
||||
AlignTrailingComments: false
|
||||
# AllowAllArgumentsOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
# AllowShortEnumsOnASingleLine: true
|
||||
# AllowShortBlocksOnASingleLine: Never
|
||||
# AllowShortCaseLabelsOnASingleLine: false
|
||||
# AllowShortFunctionsOnASingleLine: All
|
||||
# AllowShortLambdasOnASingleLine: All
|
||||
# AllowShortIfStatementsOnASingleLine: Never
|
||||
# AllowShortLoopsOnASingleLine: false
|
||||
# AlwaysBreakAfterDefinitionReturnType: None
|
||||
# AlwaysBreakAfterReturnType: None
|
||||
# AlwaysBreakBeforeMultilineStrings: false
|
||||
# AlwaysBreakTemplateDeclarations: MultiLine
|
||||
# AttributeMacros:
|
||||
# - __capability
|
||||
# BinPackArguments: true
|
||||
# BinPackParameters: true
|
||||
# BraceWrapping:
|
||||
# AfterCaseLabel: false
|
||||
# AfterClass: false
|
||||
# AfterControlStatement: Never
|
||||
# AfterEnum: false
|
||||
# AfterFunction: false
|
||||
# AfterNamespace: false
|
||||
# AfterObjCDeclaration: false
|
||||
# AfterStruct: false
|
||||
# AfterUnion: false
|
||||
# AfterExternBlock: false
|
||||
# BeforeCatch: false
|
||||
# BeforeElse: false
|
||||
# BeforeLambdaBody: false
|
||||
# BeforeWhile: false
|
||||
# IndentBraces: false
|
||||
# SplitEmptyFunction: true
|
||||
# SplitEmptyRecord: true
|
||||
# SplitEmptyNamespace: true
|
||||
# BreakBeforeBinaryOperators: None
|
||||
# BreakBeforeConceptDeclarations: true
|
||||
# BreakBeforeBraces: Attach
|
||||
# BreakBeforeInheritanceComma: false
|
||||
# BreakInheritanceList: BeforeColon
|
||||
# BreakBeforeTernaryOperators: true
|
||||
# BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: AfterColon
|
||||
# BreakStringLiterals: true
|
||||
ColumnLimit: 0
|
||||
# CommentPragmas: '^ IWYU pragma:'
|
||||
# QualifierAlignment: Leave
|
||||
# CompactNamespaces: false
|
||||
ConstructorInitializerIndentWidth: 8
|
||||
ContinuationIndentWidth: 8
|
||||
Cpp11BracedListStyle: false
|
||||
# DeriveLineEnding: true
|
||||
# DerivePointerAlignment: false
|
||||
# DisableFormat: false
|
||||
# EmptyLineAfterAccessModifier: Never
|
||||
# EmptyLineBeforeAccessModifier: LogicalBlock
|
||||
# ExperimentalAutoDetectBinPacking: false
|
||||
# PackConstructorInitializers: BinPack
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
# AllowAllConstructorInitializersOnNextLine: true
|
||||
# FixNamespaceComments: true
|
||||
# ForEachMacros:
|
||||
# - foreach
|
||||
# - Q_FOREACH
|
||||
# - BOOST_FOREACH
|
||||
# IfMacros:
|
||||
# - KJ_IF_MAYBE
|
||||
# IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '".*"'
|
||||
Priority: 1
|
||||
- Regex: '^<.*\.h>'
|
||||
Priority: 2
|
||||
- Regex: '^<.*'
|
||||
Priority: 3
|
||||
# IncludeIsMainRegex: '(Test)?$'
|
||||
# IncludeIsMainSourceRegex: ''
|
||||
# IndentAccessModifiers: false
|
||||
IndentCaseLabels: true
|
||||
# IndentCaseBlocks: false
|
||||
# IndentGotoLabels: true
|
||||
# IndentPPDirectives: None
|
||||
# IndentExternBlock: AfterExternBlock
|
||||
# IndentRequires: false
|
||||
IndentWidth: 4
|
||||
# IndentWrappedFunctionNames: false
|
||||
# InsertTrailingCommas: None
|
||||
# JavaScriptQuotes: Leave
|
||||
# JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
# LambdaBodyIndentation: Signature
|
||||
# MacroBlockBegin: ''
|
||||
# MacroBlockEnd: ''
|
||||
# MaxEmptyLinesToKeep: 1
|
||||
# NamespaceIndentation: None
|
||||
# PenaltyBreakAssignment: 2
|
||||
# PenaltyBreakBeforeFirstCallParameter: 19
|
||||
# PenaltyBreakComment: 300
|
||||
# PenaltyBreakFirstLessLess: 120
|
||||
# PenaltyBreakOpenParenthesis: 0
|
||||
# PenaltyBreakString: 1000
|
||||
# PenaltyBreakTemplateDeclaration: 10
|
||||
# PenaltyExcessCharacter: 1000000
|
||||
# PenaltyReturnTypeOnItsOwnLine: 60
|
||||
# PenaltyIndentedWhitespace: 0
|
||||
# PointerAlignment: Right
|
||||
# PPIndentWidth: -1
|
||||
# ReferenceAlignment: Pointer
|
||||
# ReflowComments: true
|
||||
# RemoveBracesLLVM: false
|
||||
# SeparateDefinitionBlocks: Leave
|
||||
# ShortNamespaceLines: 1
|
||||
# SortIncludes: CaseSensitive
|
||||
# SortJavaStaticImport: Before
|
||||
# SortUsingDeclarations: true
|
||||
# SpaceAfterCStyleCast: false
|
||||
# SpaceAfterLogicalNot: false
|
||||
# SpaceAfterTemplateKeyword: true
|
||||
# SpaceBeforeAssignmentOperators: true
|
||||
# SpaceBeforeCaseColon: false
|
||||
# SpaceBeforeCpp11BracedList: false
|
||||
# SpaceBeforeCtorInitializerColon: true
|
||||
# SpaceBeforeInheritanceColon: true
|
||||
# SpaceBeforeParens: ControlStatements
|
||||
# SpaceBeforeParensOptions:
|
||||
# AfterControlStatements: true
|
||||
# AfterForeachMacros: true
|
||||
# AfterFunctionDefinitionName: false
|
||||
# AfterFunctionDeclarationName: false
|
||||
# AfterIfMacros: true
|
||||
# AfterOverloadedOperator: false
|
||||
# BeforeNonEmptyParentheses: false
|
||||
# SpaceAroundPointerQualifiers: Default
|
||||
# SpaceBeforeRangeBasedForLoopColon: true
|
||||
# SpaceInEmptyBlock: false
|
||||
# SpaceInEmptyParentheses: false
|
||||
# SpacesBeforeTrailingComments: 1
|
||||
# SpacesInAngles: Never
|
||||
# SpacesInConditionalStatement: false
|
||||
# SpacesInContainerLiterals: true
|
||||
# SpacesInCStyleCastParentheses: false
|
||||
## Godot TODO: We'll want to use a min of 1, but we need to see how to fix
|
||||
## our comment capitalization at the same time.
|
||||
SpacesInLineCommentPrefix:
|
||||
Minimum: 0
|
||||
Maximum: -1
|
||||
# SpacesInParentheses: false
|
||||
# SpacesInSquareBrackets: false
|
||||
# SpaceBeforeSquareBrackets: false
|
||||
# BitFieldColonSpacing: Both
|
||||
# StatementAttributeLikeMacros:
|
||||
# - Q_EMIT
|
||||
# StatementMacros:
|
||||
# - Q_UNUSED
|
||||
# - QT_REQUIRE_VERSION
|
||||
TabWidth: 4
|
||||
# UseCRLF: false
|
||||
UseTab: Always
|
||||
# WhitespaceSensitiveMacros:
|
||||
# - STRINGIZE
|
||||
# - PP_STRINGIZE
|
||||
# - BOOST_PP_STRINGIZE
|
||||
# - NS_SWIFT_NAME
|
||||
# - CF_SWIFT_NAME
|
||||
---
|
||||
### C++ specific config ###
|
||||
Language: Cpp
|
||||
Standard: c++17
|
||||
---
|
||||
### ObjC specific config ###
|
||||
Language: ObjC
|
||||
# ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 4
|
||||
# ObjCBreakBeforeNestedBlockParam: true
|
||||
# ObjCSpaceAfterProperty: false
|
||||
# ObjCSpaceBeforeProtocolList: true
|
||||
---
|
||||
### Java specific config ###
|
||||
Language: Java
|
||||
# BreakAfterJavaFieldAnnotations: false
|
||||
JavaImportGroups: ['org.godotengine', 'android', 'androidx', 'com.android', 'com.google', 'java', 'javax']
|
||||
...
|
||||
47
.clang-tidy
47
.clang-tidy
@ -1,47 +0,0 @@
|
||||
---
|
||||
Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,cppcoreguidelines-pro-type-member-init,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-use-default-member-init,modernize-use-nullptr,readability-braces-around-statements,readability-redundant-member-init'
|
||||
WarningsAsErrors: ''
|
||||
HeaderFilterRegex: ''
|
||||
AnalyzeTemporaryDtors: false
|
||||
FormatStyle: none
|
||||
CheckOptions:
|
||||
- key: cert-dcl16-c.NewSuffixes
|
||||
value: 'L;LL;LU;LLU'
|
||||
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
|
||||
value: '0'
|
||||
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
|
||||
value: '1'
|
||||
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
|
||||
value: '1'
|
||||
- key: cppcoreguidelines-pro-type-member-init.IgnoreArrays
|
||||
value: '1'
|
||||
- key: cppcoreguidelines-pro-type-member-init.UseAssignment
|
||||
value: '1'
|
||||
- key: google-readability-function-size.StatementThreshold
|
||||
value: '800'
|
||||
- key: google-readability-namespace-comments.ShortNamespaceLines
|
||||
value: '10'
|
||||
- key: google-readability-namespace-comments.SpacesBeforeComments
|
||||
value: '2'
|
||||
- key: modernize-loop-convert.MaxCopySize
|
||||
value: '16'
|
||||
- key: modernize-loop-convert.MinConfidence
|
||||
value: reasonable
|
||||
- key: modernize-loop-convert.NamingStyle
|
||||
value: CamelCase
|
||||
- key: modernize-pass-by-value.IncludeStyle
|
||||
value: llvm
|
||||
- key: modernize-replace-auto-ptr.IncludeStyle
|
||||
value: llvm
|
||||
- key: modernize-use-bool-literals.IgnoreMacros
|
||||
value: '0'
|
||||
- key: modernize-use-default-member-init.IgnoreMacros
|
||||
value: '0'
|
||||
- key: modernize-use-default-member-init.UseAssignment
|
||||
value: '1'
|
||||
- key: modernize-use-nullptr.NullMacros
|
||||
value: 'NULL'
|
||||
- key: readability-braces-around-statements.ShortStatementLines
|
||||
value: '0'
|
||||
...
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_style = tab
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{cpp,hpp,c,h,mm}]
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[{*.gradle,AndroidManifest.xml}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[{*.py,SConstruct,SCsub}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
# YAML requires indentation with spaces instead of tabs.
|
||||
[*.{yml,yaml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
# GDScript unit test files
|
||||
[*.gd]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.out]
|
||||
insert_final_newline = true
|
||||
@ -1,53 +0,0 @@
|
||||
# This file contains a list of Git commit hashes that should be hidden from the
|
||||
# regular Git history. Typically, this includes commits involving mass auto-formatting
|
||||
# or other normalizations. Commit hashes *must* use the full 40-character notation.
|
||||
# To apply the ignore list in your local Git client, you must run:
|
||||
#
|
||||
# git config blame.ignoreRevsFile .git-blame-ignore-revs
|
||||
#
|
||||
# This file is automatically used by GitHub.com's blame view.
|
||||
|
||||
# A Whole New World (clang-format edition)
|
||||
5dbf1809c6e3e905b94b8764e99491e608122261
|
||||
|
||||
# Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
|
||||
0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a
|
||||
|
||||
# Style: clang-format: Disable AllowShortIfStatementsOnASingleLine
|
||||
e956e80c1fa1cc8aefcb1533e5acf5cf3c8ffdd9
|
||||
|
||||
# One Copyright Update to rule them all
|
||||
d95794ec8a7c362b06a9cf080e2554ef77adb667
|
||||
|
||||
# Update copyright statements to 2022
|
||||
fe52458154c64fb1b741df4f7bd10106395f7cbd
|
||||
|
||||
# Update copyright statements to 2021
|
||||
b5334d14f7a471f94bcbd64d5bae2ad853d0b7f1
|
||||
|
||||
# Update copyright statements to 2020
|
||||
a7f49ac9a107820a62677ee3fb49d38982a25165
|
||||
|
||||
# Update copyright statements to 2019
|
||||
b16c309f82c77d606472c3c721a1857e323a09e7
|
||||
|
||||
# Update copyright statements to 2018
|
||||
b50a9114b105dafafdda8248a38653bca314a6f3
|
||||
|
||||
# Welcome in 2017, dear changelog reader!
|
||||
c7bc44d5ad9aae4902280012f7654e2318cd910e
|
||||
|
||||
# Update copyright to 2016 in headers
|
||||
5be9ff7b6715a661e85f99b108f96340de7ef435
|
||||
|
||||
# Updated copyright year in all headers
|
||||
fdaa2920eb21fff3320a17e9239e04dfadecdb00
|
||||
|
||||
# Add missing copyright headers and fix formatting
|
||||
e4213e66b2dd8f5a87d8cf5015ac83ba3143279d
|
||||
|
||||
# Use HTTPS URL for Godot's website in the headers
|
||||
bd282ff43f23fe845f29a3e25c8efc01bd65ffb0
|
||||
|
||||
# Add "Godot Engine contributors" copyright line
|
||||
df61dc4b2bd54a5a40c515493c76f5a458e5b541
|
||||
20
.gitattributes
vendored
20
.gitattributes
vendored
@ -1,20 +0,0 @@
|
||||
# Properly detect languages on Github
|
||||
*.h linguist-language=cpp
|
||||
*.inc linguist-language=cpp
|
||||
thirdparty/* linguist-vendored
|
||||
|
||||
# Normalize EOL for all files that Git considers text files
|
||||
* text=auto eol=lf
|
||||
# Except for bat files, which are Windows only files
|
||||
*.bat eol=crlf
|
||||
# And some test files where the EOL matters
|
||||
*.test.txt -text
|
||||
|
||||
# The above only works properly for Git 2.10+, so for older versions
|
||||
# we need to manually list the binary files we don't want modified.
|
||||
*.icns binary
|
||||
*.ico binary
|
||||
*.jar binary
|
||||
*.png binary
|
||||
*.ttf binary
|
||||
*.tza binary
|
||||
179
.github/CODEOWNERS
vendored
179
.github/CODEOWNERS
vendored
@ -1,179 +0,0 @@
|
||||
# Lines starting with '#' are comments.
|
||||
# Each line is a file pattern followed by one or more owners.
|
||||
# Owners can be @users, @org/teams or emails
|
||||
|
||||
# Buildsystem
|
||||
|
||||
.* @godotengine/buildsystem
|
||||
.github/ @godotengine/buildsystem
|
||||
*.py @godotengine/buildsystem
|
||||
SConstruct @godotengine/buildsystem
|
||||
SCsub @godotengine/buildsystem
|
||||
|
||||
# Core
|
||||
|
||||
/core/ @godotengine/core
|
||||
/core/crypto/ @godotengine/network
|
||||
/core/debugger/ @godotengine/debugger
|
||||
/core/extension/ @godotengine/gdextension
|
||||
/core/input/ @godotengine/input
|
||||
|
||||
# Doc
|
||||
|
||||
/doc/ @godotengine/documentation
|
||||
doc_classes/* @godotengine/documentation
|
||||
|
||||
# Drivers
|
||||
|
||||
## Audio
|
||||
/drivers/alsa/ @godotengine/audio
|
||||
/drivers/alsamidi/ @godotengine/audio
|
||||
/drivers/coreaudio/ @godotengine/audio
|
||||
/drivers/coremidi/ @godotengine/audio
|
||||
/drivers/pulseaudio/ @godotengine/audio
|
||||
/drivers/wasapi/ @godotengine/audio
|
||||
/drivers/winmidi/ @godotengine/audio
|
||||
/drivers/xaudio2/ @godotengine/audio
|
||||
|
||||
## Rendering
|
||||
/drivers/dummy/ @godotengine/rendering
|
||||
/drivers/gles3/ @godotengine/rendering
|
||||
/drivers/spirv-reflect/ @godotengine/rendering
|
||||
/drivers/vulkan/ @godotengine/rendering
|
||||
|
||||
## OS
|
||||
/drivers/unix/ @godotengine/_platforms
|
||||
/drivers/windows/ @godotengine/windows
|
||||
|
||||
## Misc
|
||||
/drivers/png/ @godotengine/import
|
||||
|
||||
# Editor
|
||||
|
||||
/editor/*debugger* @godotengine/debugger
|
||||
/editor/icons/ @godotengine/usability
|
||||
/editor/import/ @godotengine/import
|
||||
/editor/plugins/*2d_*.* @godotengine/2d-editor
|
||||
/editor/plugins/*3d_*.* @godotengine/3d-editor
|
||||
/editor/plugins/script_*.* @godotengine/script-editor
|
||||
/editor/plugins/*shader*.* @godotengine/shaders
|
||||
/editor/code_editor.* @godotengine/script-editor
|
||||
/editor/*dock*.* @godotengine/docks
|
||||
/editor/*shader*.* @godotengine/shaders
|
||||
|
||||
# Main
|
||||
|
||||
/main/ @godotengine/core
|
||||
|
||||
# Misc
|
||||
|
||||
/misc/ @godotengine/buildsystem
|
||||
|
||||
# Modules
|
||||
|
||||
## Audio (+ video)
|
||||
/modules/minimp3/ @godotengine/audio
|
||||
/modules/ogg/ @godotengine/audio
|
||||
/modules/opus/ @godotengine/audio
|
||||
/modules/theora/ @godotengine/audio
|
||||
/modules/vorbis/ @godotengine/audio
|
||||
/modules/webm/ @godotengine/audio
|
||||
|
||||
## Import
|
||||
/modules/basis_universal/ @godotengine/import
|
||||
/modules/bmp/ @godotengine/import
|
||||
/modules/cvtt/ @godotengine/import
|
||||
/modules/dds/ @godotengine/import
|
||||
/modules/etc/ @godotengine/import
|
||||
/modules/fbx/ @godotengine/import
|
||||
/modules/gltf/ @godotengine/import
|
||||
/modules/hdr/ @godotengine/import
|
||||
/modules/jpg/ @godotengine/import
|
||||
/modules/pvr/ @godotengine/import
|
||||
/modules/squish/ @godotengine/import
|
||||
/modules/svg/ @godotengine/import
|
||||
/modules/tga/ @godotengine/import
|
||||
/modules/tinyexr/ @godotengine/import
|
||||
/modules/webp/ @godotengine/import
|
||||
|
||||
## Network
|
||||
/modules/enet/ @godotengine/network
|
||||
/modules/mbedtls/ @godotengine/network
|
||||
/modules/upnp/ @godotengine/network
|
||||
/modules/webrtc/ @godotengine/network
|
||||
/modules/websocket/ @godotengine/network
|
||||
|
||||
## Rendering
|
||||
/modules/denoise/ @godotengine/rendering
|
||||
/modules/glslang/ @godotengine/rendering
|
||||
/modules/lightmapper_rd/ @godotengine/rendering
|
||||
/modules/meshoptimizer/ @godotengine/rendering
|
||||
/modules/vhacd/ @godotengine/rendering
|
||||
/modules/xatlas_unwrap/ @godotengine/rendering
|
||||
|
||||
## Scripting
|
||||
/modules/gdscript/ @godotengine/gdscript
|
||||
/modules/jsonrpc/ @godotengine/gdscript
|
||||
/modules/mono/ @godotengine/dotnet
|
||||
|
||||
## Text
|
||||
/modules/freetype/ @godotengine/buildsystem
|
||||
/modules/text_server_adv/ @godotengine/gui-nodes
|
||||
/modules/text_server_fb/ @godotengine/gui-nodes
|
||||
|
||||
## XR
|
||||
/modules/camera/ @godotengine/xr
|
||||
/modules/gdextension/xr/ @godotengine/xr
|
||||
/modules/mobile_vr/ @godotengine/xr
|
||||
/modules/webxr/ @godotengine/xr
|
||||
|
||||
## Misc
|
||||
/modules/bullet/ @godotengine/physics
|
||||
/modules/csg/ @godotengine/3d-nodes
|
||||
/modules/gdnavigation/ @godotengine/navigation
|
||||
/modules/gridmap/ @godotengine/3d-nodes
|
||||
/modules/opensimplex/ @godotengine/3d-nodes
|
||||
/modules/regex/ @godotengine/core
|
||||
|
||||
# Platform
|
||||
|
||||
/platform/android/ @godotengine/android
|
||||
/platform/ios/ @godotengine/ios
|
||||
/platform/linuxbsd/ @godotengine/linux-bsd
|
||||
/platform/macos/ @godotengine/macos
|
||||
/platform/web/ @godotengine/web
|
||||
/platform/windows/ @godotengine/windows
|
||||
|
||||
# Scene
|
||||
|
||||
/scene/2d/ @godotengine/2d-nodes
|
||||
/scene/3d/ @godotengine/3d-nodes
|
||||
/scene/animation/ @godotengine/animation
|
||||
/scene/audio/ @godotengine/audio
|
||||
/scene/debugger/ @godotengine/debugger
|
||||
/scene/gui/ @godotengine/gui-nodes
|
||||
/scene/main/ @godotengine/core
|
||||
/scene/resources/default_theme/ @godotengine/gui-nodes
|
||||
/scene/resources/font.* @godotengine/gui-nodes
|
||||
/scene/resources/text_line.* @godotengine/gui-nodes
|
||||
/scene/resources/text_paragraph.* @godotengine/gui-nodes
|
||||
/scene/resources/visual_shader*.* @godotengine/shaders
|
||||
|
||||
# Servers
|
||||
|
||||
/servers/audio* @godotengine/audio
|
||||
/servers/camera* @godotengine/xr
|
||||
/servers/display_server.* @godotengine/_platforms
|
||||
/servers/navigation_server*.* @godotengine/navigation
|
||||
/servers/physics* @godotengine/physics
|
||||
/servers/rendering* @godotengine/rendering
|
||||
/servers/text_server.* @godotengine/gui-nodes
|
||||
/servers/xr* @godotengine/xr
|
||||
|
||||
# Tests
|
||||
|
||||
/tests/ @godotengine/tests
|
||||
|
||||
# Thirdparty
|
||||
|
||||
/thirdparty/ @godotengine/buildsystem
|
||||
65
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
65
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@ -1,65 +0,0 @@
|
||||
name: Bug report
|
||||
description: Report a bug in Godot
|
||||
body:
|
||||
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
- When reporting bugs, you'll make our life simpler (and the fix will come sooner) if you follow the guidelines in this template.
|
||||
- Write a descriptive issue title above.
|
||||
- The golden rule is to **always open *one* issue for *one* bug**. If you notice several bugs and want to report them, make sure to create one new issue for each of them.
|
||||
- Search [open](https://github.com/godotengine/godot/issues) and [closed](https://github.com/godotengine/godot/issues?q=is%3Aissue+is%3Aclosed) issues to ensure it has not already been reported. If you don't find a relevant match or if you're unsure, don't hesitate to **open a new issue**. The bugsquad will handle it from there if it's a duplicate.
|
||||
- Verify that you are using a [supported Godot version](https://docs.godotengine.org/en/stable/about/release_policy.html).
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Godot version
|
||||
description: >
|
||||
Specify the Godot version, including the Git commit hash if using a development or non-official build. The exact Godot version (including the commit hash) can be copied by clicking the version shown in the editor (bottom bar) or in the project manager (top bar).
|
||||
If you use a custom build, please test if your issue is reproducible in official builds too.
|
||||
placeholder: 3.5.stable, 4.0.dev [3041becc6]
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: System information
|
||||
description: |
|
||||
- Specify the OS version, and when relevant hardware information.
|
||||
- For issues that are likely OS-specific and/or graphics-related, please specify the CPU model and architecture.
|
||||
- For graphics-related issues, specify the GPU model, driver version, and the rendering backend (GLES2, GLES3, Vulkan).
|
||||
- **Bug reports not including the required information may be closed at the maintainers' discretion.** If in doubt, always include all the requested information; it's better to include too much information than not enough information.
|
||||
- **Starting from Godot 4.1, you can copy this information to your clipboard by using *Help > Copy System Info* at the top of the editor window.**
|
||||
placeholder: Windows 10 - Godot v4.0.3.stable - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 970 (nvidia, 510.85.02) - Intel Core i7-10700KF CPU @ 3.80GHz (16 Threads)
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Issue description
|
||||
description: |
|
||||
Describe your issue briefly. What doesn't work, and how do you expect it to work instead?
|
||||
You can include images or videos with drag and drop, and format code blocks or logs with <code>```</code> tags.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Steps to reproduce
|
||||
description: |
|
||||
List of steps or sample code that reproduces the issue. Having reproducible issues is a prerequisite for contributors to be able to solve them.
|
||||
If you include a minimal reproduction project below, you can detail how to use it here.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Minimal reproduction project
|
||||
description: |
|
||||
- A small Godot project which reproduces the issue, with no unnecessary files included. Be sure to not include the `.godot` folder in the archive (but keep `project.godot`).
|
||||
- Required, unless the reproduction steps are trivial and don't require any project files to be followed. In this case, write "N/A" in the field.
|
||||
- Drag and drop a ZIP archive to upload it. **Do not select another field until the project is done uploading.**
|
||||
- **Note for C# users:** If your issue is *not* Mono-specific, please upload a minimal reproduction project written in GDScript or VisualScript. This will make it easier for contributors to reproduce the issue locally as not everyone has a Mono setup available.
|
||||
- **If you've been asked by a maintainer to upload a minimal reproduction project, you *must* do so within 7 days.** Otherwise, your bug report will be closed as it'll be considered too difficult to diagnose.
|
||||
validations:
|
||||
required: true
|
||||
14
.github/ISSUE_TEMPLATE/config.yml
vendored
14
.github/ISSUE_TEMPLATE/config.yml
vendored
@ -1,14 +0,0 @@
|
||||
blank_issues_enabled: false
|
||||
|
||||
contact_links:
|
||||
- name: Godot proposals
|
||||
url: https://github.com/godotengine/godot-proposals
|
||||
about: Please submit feature proposals on the Godot proposals repository, not here.
|
||||
|
||||
- name: Godot documentation repository
|
||||
url: https://github.com/godotengine/godot-docs
|
||||
about: Please report issues with documentation on the Godot documentation repository, not here.
|
||||
|
||||
- name: Godot community channels
|
||||
url: https://godotengine.org/community
|
||||
about: Please ask for technical support on one of the other community channels, not here.
|
||||
10
.github/PULL_REQUEST_TEMPLATE.md
vendored
10
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -1,10 +0,0 @@
|
||||
<!--
|
||||
Please target the `master` branch in priority.
|
||||
PRs can target `3.x` if the same change was done in `master`, or is not relevant there.
|
||||
|
||||
Relevant fixes are cherry-picked for stable branches as needed by maintainers.
|
||||
You can mention in the description if the change is compatible with `3.x`.
|
||||
|
||||
To speed up the contribution process and avoid CI errors, please set up pre-commit hooks locally:
|
||||
https://docs.godotengine.org/en/latest/contributing/development/code_style_guidelines.html
|
||||
-->
|
||||
20
.github/actions/download-artifact/action.yml
vendored
20
.github/actions/download-artifact/action.yml
vendored
@ -1,20 +0,0 @@
|
||||
name: Download Godot artifact
|
||||
description: Download the Godot artifact.
|
||||
|
||||
inputs:
|
||||
name:
|
||||
description: The artifact name.
|
||||
default: ${{ github.job }}
|
||||
path:
|
||||
description: The path to download and extract to.
|
||||
required: true
|
||||
default: ./
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Download Godot Artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ inputs.name }}
|
||||
path: ${{ inputs.path }}
|
||||
52
.github/actions/godot-build/action.yml
vendored
52
.github/actions/godot-build/action.yml
vendored
@ -1,52 +0,0 @@
|
||||
name: Build Godot
|
||||
description: Build Godot with the provided options.
|
||||
|
||||
inputs:
|
||||
target:
|
||||
description: Build target (editor, template_release, template_debug).
|
||||
default: editor
|
||||
tests:
|
||||
description: Unit tests.
|
||||
default: false
|
||||
required: false
|
||||
platform:
|
||||
description: Target platform.
|
||||
required: false
|
||||
sconsflags:
|
||||
description: Additional SCons flags.
|
||||
default: ""
|
||||
required: false
|
||||
scons-cache:
|
||||
description: The SCons cache path.
|
||||
default: ${{ github.workspace }}/.scons_cache/
|
||||
scons-cache-limit:
|
||||
description: The SCons cache size limit.
|
||||
# actions/cache has 10 GiB limit, and GitHub runners have a 14 GiB disk.
|
||||
# Limit to 7 GiB to avoid having the extracted cache fill the disk.
|
||||
default: 7168
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: SCons Build
|
||||
shell: sh
|
||||
env:
|
||||
SCONSFLAGS: ${{ inputs.sconsflags }}
|
||||
SCONS_CACHE: ${{ inputs.scons-cache }}
|
||||
SCONS_CACHE_LIMIT: ${{ inputs.scons-cache-limit }}
|
||||
run: |
|
||||
echo "Building with flags:" platform=${{ inputs.platform }} target=${{ inputs.target }} tests=${{ inputs.tests }} ${{ env.SCONSFLAGS }}
|
||||
|
||||
if [ "${{ inputs.target }}" != "editor" ]; then
|
||||
# Ensure we don't include editor code in export template builds.
|
||||
rm -rf editor
|
||||
fi
|
||||
|
||||
if [ "${{ github.event.number }}" != "" ]; then
|
||||
# Set build identifier with pull request number if available. This is displayed throughout the editor.
|
||||
export BUILD_NAME="gh-${{ github.event.number }}"
|
||||
else
|
||||
export BUILD_NAME="gh"
|
||||
fi
|
||||
|
||||
scons platform=${{ inputs.platform }} target=${{ inputs.target }} tests=${{ inputs.tests }} ${{ env.SCONSFLAGS }}
|
||||
ls -l bin/
|
||||
35
.github/actions/godot-cache-restore/action.yml
vendored
35
.github/actions/godot-cache-restore/action.yml
vendored
@ -1,35 +0,0 @@
|
||||
name: Restore Godot build cache
|
||||
description: Restore Godot build cache.
|
||||
inputs:
|
||||
cache-name:
|
||||
description: The cache base name (job name by default).
|
||||
default: ${{ github.job }}
|
||||
scons-cache:
|
||||
description: The SCons cache path.
|
||||
default: ${{ github.workspace }}/.scons_cache/
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Restore SCons cache directory
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ${{ inputs.scons-cache }}
|
||||
key: ${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }}
|
||||
|
||||
# We try to match an existing cache to restore from it. Each potential key is checked against
|
||||
# all existing caches as a prefix. E.g. 'linux-template-minimal' would match any cache that
|
||||
# starts with "linux-template-minimal", such as "linux-template-minimal-master-refs/heads/master-6588a4a29af1621086feac0117d5d4d37af957fd".
|
||||
#
|
||||
# We check these prefixes in this order:
|
||||
#
|
||||
# 1. The exact match, including the base branch, the commit reference, and the SHA hash of the commit.
|
||||
# 2. A partial match for the same base branch and the same commit reference.
|
||||
# 3. A partial match for the same base branch and the base branch commit reference.
|
||||
# 4. A partial match for the same base branch only (not ideal, matches any PR with the same base branch).
|
||||
|
||||
restore-keys: |
|
||||
${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }}
|
||||
${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}
|
||||
${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-refs/heads/${{ env.GODOT_BASE_BRANCH }}
|
||||
${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}
|
||||
18
.github/actions/godot-cache-save/action.yml
vendored
18
.github/actions/godot-cache-save/action.yml
vendored
@ -1,18 +0,0 @@
|
||||
name: Save Godot build cache
|
||||
description: Save Godot build cache.
|
||||
inputs:
|
||||
cache-name:
|
||||
description: The cache base name (job name by default).
|
||||
default: ${{ github.job }}
|
||||
scons-cache:
|
||||
description: The SCons cache path.
|
||||
default: ${{ github.workspace }}/.scons_cache/
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Save SCons cache directory
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: ${{ inputs.scons-cache }}
|
||||
key: ${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }}
|
||||
20
.github/actions/godot-converter-test/action.yml
vendored
20
.github/actions/godot-converter-test/action.yml
vendored
@ -1,20 +0,0 @@
|
||||
name: Test Godot project converter
|
||||
description: Test the Godot project converter.
|
||||
|
||||
inputs:
|
||||
bin:
|
||||
description: The path to the Godot executable
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Test 3-to-4 conversion
|
||||
shell: sh
|
||||
run: |
|
||||
mkdir converter_test
|
||||
cd converter_test
|
||||
touch project.godot
|
||||
../${{ inputs.bin }} --headless --validate-conversion-3to4
|
||||
cd ..
|
||||
rm converter_test -rf
|
||||
40
.github/actions/godot-cpp-build/action.yml
vendored
40
.github/actions/godot-cpp-build/action.yml
vendored
@ -1,40 +0,0 @@
|
||||
name: Build godot-cpp
|
||||
description: Build godot-cpp with the provided options.
|
||||
|
||||
inputs:
|
||||
bin:
|
||||
description: Path to the Godot binary.
|
||||
required: true
|
||||
type: string
|
||||
scons-flags:
|
||||
description: Additional SCons flags.
|
||||
type: string
|
||||
scons-cache:
|
||||
description: The SCons cache path.
|
||||
default: ${{ github.workspace }}/.scons_cache/
|
||||
type: string
|
||||
godot-cpp-branch:
|
||||
description: The godot-cpp branch.
|
||||
default: master
|
||||
type: string
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
repository: godotengine/godot-cpp
|
||||
ref: ${{ inputs.godot-cpp-branch }}
|
||||
path: godot-cpp
|
||||
|
||||
- name: Extract API
|
||||
shell: sh
|
||||
run: ${{ inputs.bin }} --headless --dump-gdextension-interface --dump-extension-api
|
||||
|
||||
- name: SCons Build
|
||||
shell: sh
|
||||
env:
|
||||
SCONS_CACHE: ${{ inputs.scons-cache }}
|
||||
run: scons --directory=./godot-cpp/test "gdextension_dir=${{ github.workspace }}" ${{ inputs.scons-flags }}
|
||||
31
.github/actions/godot-deps/action.yml
vendored
31
.github/actions/godot-deps/action.yml
vendored
@ -1,31 +0,0 @@
|
||||
name: Setup Python and SCons
|
||||
description: Setup Python, install the pip version of SCons.
|
||||
|
||||
inputs:
|
||||
python-version:
|
||||
description: The Python version to use.
|
||||
default: 3.x
|
||||
python-arch:
|
||||
description: The Python architecture.
|
||||
default: x64
|
||||
scons-version:
|
||||
description: The SCons version to use.
|
||||
default: 4.8.1
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Set up Python 3.x
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
# Semantic version range syntax or exact version of a Python version.
|
||||
python-version: ${{ inputs.python-version }}
|
||||
# Optional - x64 or x86 architecture, defaults to x64.
|
||||
architecture: ${{ inputs.python-arch }}
|
||||
|
||||
- name: Setup SCons
|
||||
shell: bash
|
||||
run: |
|
||||
python -c "import sys; print(sys.version)"
|
||||
python -m pip install scons==${{ inputs.scons-version }}
|
||||
scons --version
|
||||
39
.github/actions/godot-project-test/action.yml
vendored
39
.github/actions/godot-project-test/action.yml
vendored
@ -1,39 +0,0 @@
|
||||
name: Test Godot project
|
||||
description: Run the test Godot project.
|
||||
|
||||
inputs:
|
||||
bin:
|
||||
description: The path to the Godot executable
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
# Download and extract zip archive with project, folder is renamed to be able to easy change used project
|
||||
- name: Download test project
|
||||
shell: sh
|
||||
run: |
|
||||
wget https://github.com/godotengine/regression-test-project/archive/4.0.zip
|
||||
unzip 4.0.zip
|
||||
mv "regression-test-project-4.0" "test_project"
|
||||
|
||||
# Editor is quite complicated piece of software, so it is easy to introduce bug here.
|
||||
|
||||
- name: Open and close editor (Vulkan)
|
||||
shell: sh
|
||||
run: |
|
||||
xvfb-run ${{ inputs.bin }} --audio-driver Dummy --editor --quit --path test_project 2>&1 | tee sanitizers_log.txt || true
|
||||
misc/scripts/check_ci_log.py sanitizers_log.txt
|
||||
|
||||
- name: Open and close editor (GLES3)
|
||||
shell: sh
|
||||
run: |
|
||||
DRI_PRIME=0 xvfb-run ${{ inputs.bin }} --audio-driver Dummy --rendering-driver opengl3 --editor --quit --path test_project 2>&1 | tee sanitizers_log.txt || true
|
||||
misc/scripts/check_ci_log.py sanitizers_log.txt
|
||||
|
||||
# Run test project
|
||||
- name: Run project
|
||||
shell: sh
|
||||
run: |
|
||||
xvfb-run ${{ inputs.bin }} 40 --audio-driver Dummy --path test_project 2>&1 | tee sanitizers_log.txt || true
|
||||
misc/scripts/check_ci_log.py sanitizers_log.txt
|
||||
22
.github/actions/upload-artifact/action.yml
vendored
22
.github/actions/upload-artifact/action.yml
vendored
@ -1,22 +0,0 @@
|
||||
name: Upload Godot artifact
|
||||
description: Upload the Godot artifact.
|
||||
|
||||
inputs:
|
||||
name:
|
||||
description: The artifact name.
|
||||
default: ${{ github.job }}
|
||||
path:
|
||||
description: The path to upload.
|
||||
required: true
|
||||
default: bin/*
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Upload Godot Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ inputs.name }}
|
||||
path: ${{ inputs.path }}
|
||||
# Default is 90 days.
|
||||
retention-days: 60
|
||||
92
.github/workflows/android_builds.yml
vendored
92
.github/workflows/android_builds.yml
vendored
@ -1,92 +0,0 @@
|
||||
name: 🤖 Android Builds
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
# Global Settings
|
||||
env:
|
||||
# Used for the cache key. Add version suffix to force clean build.
|
||||
GODOT_BASE_BRANCH: 4.1
|
||||
SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no module_text_server_fb_enabled=yes
|
||||
|
||||
jobs:
|
||||
build-android:
|
||||
runs-on: ubuntu-24.04
|
||||
name: ${{ matrix.name }}
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: Editor (target=editor)
|
||||
cache-name: android-editor
|
||||
target: editor
|
||||
tests: false
|
||||
sconsflags: arch=arm64 production=yes
|
||||
|
||||
- name: Template arm32 (target=template_release, arch=arm32)
|
||||
cache-name: android-template-arm32
|
||||
target: template_release
|
||||
tests: false
|
||||
sconsflags: arch=arm32
|
||||
|
||||
- name: Template arm64 (target=template_release, arch=arm64)
|
||||
cache-name: android-template-arm64
|
||||
target: template_release
|
||||
tests: false
|
||||
sconsflags: arch=arm64
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Set up Java 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 17
|
||||
|
||||
- name: Restore Godot build cache
|
||||
uses: ./.github/actions/godot-cache-restore
|
||||
with:
|
||||
cache-name: ${{ matrix.cache-name }}
|
||||
continue-on-error: true
|
||||
|
||||
- name: Setup Python and SCons
|
||||
uses: ./.github/actions/godot-deps
|
||||
|
||||
- name: Compilation
|
||||
uses: ./.github/actions/godot-build
|
||||
with:
|
||||
sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
|
||||
platform: android
|
||||
target: ${{ matrix.target }}
|
||||
tests: ${{ matrix.tests }}
|
||||
|
||||
- name: Save Godot build cache
|
||||
uses: ./.github/actions/godot-cache-save
|
||||
with:
|
||||
cache-name: ${{ matrix.cache-name }}
|
||||
continue-on-error: true
|
||||
|
||||
- name: Generate Godot templates
|
||||
if: matrix.target == 'template_release'
|
||||
run: |
|
||||
cd platform/android/java
|
||||
./gradlew generateGodotTemplates
|
||||
cd ../../..
|
||||
ls -l bin/
|
||||
|
||||
- name: Generate Godot editor
|
||||
if: matrix.target == 'editor'
|
||||
run: |
|
||||
cd platform/android/java
|
||||
./gradlew generateGodotEditor
|
||||
cd ../../..
|
||||
ls -l bin/android_editor_builds/
|
||||
|
||||
- name: Upload artifact
|
||||
uses: ./.github/actions/upload-artifact
|
||||
with:
|
||||
name: ${{ matrix.cache-name }}
|
||||
43
.github/workflows/ios_builds.yml
vendored
43
.github/workflows/ios_builds.yml
vendored
@ -1,43 +0,0 @@
|
||||
name: 🍏 iOS Builds
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
# Global Settings
|
||||
env:
|
||||
# Used for the cache key. Add version suffix to force clean build.
|
||||
GODOT_BASE_BRANCH: 4.1
|
||||
SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no module_text_server_fb_enabled=yes
|
||||
|
||||
jobs:
|
||||
ios-template:
|
||||
runs-on: macos-latest
|
||||
name: Template (target=template_release)
|
||||
timeout-minutes: 60
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Restore Godot build cache
|
||||
uses: ./.github/actions/godot-cache-restore
|
||||
continue-on-error: true
|
||||
|
||||
- name: Setup Python and SCons
|
||||
uses: ./.github/actions/godot-deps
|
||||
|
||||
- name: Compilation (arm64)
|
||||
uses: ./.github/actions/godot-build
|
||||
with:
|
||||
sconsflags: ${{ env.SCONSFLAGS }}
|
||||
platform: ios
|
||||
target: template_release
|
||||
tests: false
|
||||
|
||||
- name: Save Godot build cache
|
||||
uses: ./.github/actions/godot-cache-save
|
||||
continue-on-error: true
|
||||
|
||||
- name: Upload artifact
|
||||
uses: ./.github/actions/upload-artifact
|
||||
224
.github/workflows/linux_builds.yml
vendored
224
.github/workflows/linux_builds.yml
vendored
@ -1,224 +0,0 @@
|
||||
name: 🐧 Linux Builds
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
# Global Settings
|
||||
env:
|
||||
# Used for the cache key. Add version suffix to force clean build.
|
||||
GODOT_BASE_BRANCH: 4.1
|
||||
GODOT_CPP_BRANCH: 4.1
|
||||
SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes
|
||||
DOTNET_NOLOGO: true
|
||||
DOTNET_CLI_TELEMETRY_OPTOUT: true
|
||||
|
||||
jobs:
|
||||
build-linux:
|
||||
# Stay one LTS before latest to increase portability of Linux artifacts.
|
||||
runs-on: ubuntu-22.04
|
||||
name: ${{ matrix.name }}
|
||||
timeout-minutes: 120
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: Editor w/ Mono (target=editor)
|
||||
cache-name: linux-editor-mono
|
||||
target: editor
|
||||
sconsflags: module_mono_enabled=yes
|
||||
bin: ./bin/godot.linuxbsd.editor.x86_64.mono
|
||||
build-mono: true
|
||||
tests: false # Disabled due freeze caused by mix Mono build and CI
|
||||
doc-test: true
|
||||
proj-conv: true
|
||||
api-compat: true
|
||||
artifact: true
|
||||
# Validate godot-cpp compatibility on one arbitrary editor build.
|
||||
godot-cpp: true
|
||||
|
||||
- name: Editor with doubles and GCC sanitizers (target=editor, tests=yes, dev_build=yes, scu_build=yes, precision=double, use_asan=yes, use_ubsan=yes, linker=gold)
|
||||
cache-name: linux-editor-double-sanitizers
|
||||
target: editor
|
||||
# Debug symbols disabled as they're huge on this build and we hit the 14 GB limit for runners.
|
||||
sconsflags: dev_build=yes scu_build=yes debug_symbols=no precision=double use_asan=yes use_ubsan=yes linker=gold
|
||||
bin: ./bin/godot.linuxbsd.editor.dev.double.x86_64.san
|
||||
build-mono: false
|
||||
tests: true
|
||||
proj-test: true
|
||||
# Skip 2GiB artifact speeding up action.
|
||||
artifact: false
|
||||
|
||||
- name: Editor with clang sanitizers (target=editor, tests=yes, dev_build=yes, use_asan=yes, use_ubsan=yes, use_llvm=yes, linker=lld)
|
||||
cache-name: linux-editor-llvm-sanitizers
|
||||
target: editor
|
||||
sconsflags: dev_build=yes use_asan=yes use_ubsan=yes use_llvm=yes linker=lld
|
||||
bin: ./bin/godot.linuxbsd.editor.dev.x86_64.llvm.san
|
||||
build-mono: false
|
||||
tests: true
|
||||
# Skip 2GiB artifact speeding up action.
|
||||
artifact: false
|
||||
# Test our oldest supported SCons/Python versions on one arbitrary editor build.
|
||||
legacy-scons: true
|
||||
|
||||
# Template builds need various fixes for unit tests to be supported in 4.1,
|
||||
# so we don't enable tests in this legacy branch.
|
||||
|
||||
- name: Template w/ Mono, release (target=template_release)
|
||||
cache-name: linux-template-mono
|
||||
target: template_release
|
||||
sconsflags: module_mono_enabled=yes
|
||||
bin: ./bin/godot.linuxbsd.template_release.x86_64.mono
|
||||
build-mono: false
|
||||
tests: false
|
||||
artifact: true
|
||||
|
||||
- name: Template w/ Mono, debug (target=template_debug)
|
||||
cache-name: linux-template-mono-debug
|
||||
target: template_debug
|
||||
sconsflags: module_mono_enabled=yes
|
||||
bin: ./bin/godot.linuxbsd.template_debug.x86_64.mono
|
||||
build-mono: false
|
||||
tests: false
|
||||
artifact: true
|
||||
|
||||
- name: Minimal template (target=template_release, everything disabled)
|
||||
cache-name: linux-template-minimal
|
||||
target: template_release
|
||||
sconsflags: modules_enabled_by_default=no disable_3d=yes disable_advanced_gui=yes deprecated=no minizip=no
|
||||
bin: ./bin/godot.linuxbsd.template_release.x86_64
|
||||
tests: false
|
||||
artifact: true
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
# Need newer mesa for lavapipe to work properly.
|
||||
- name: Linux dependencies for tests
|
||||
if: matrix.proj-test
|
||||
run: |
|
||||
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
|
||||
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EB8B81E14DA65431D7504EA8F63F0F2B90935439
|
||||
sudo add-apt-repository "deb https://ppa.launchpadcontent.net/kisak/turtle/ubuntu jammy main"
|
||||
sudo apt-get install -qq mesa-vulkan-drivers
|
||||
|
||||
- name: Free disk space on runner
|
||||
run: |
|
||||
echo "Disk usage before:" && df -h
|
||||
sudo rm -rf /usr/local/lib/android
|
||||
echo "Disk usage after:" && df -h
|
||||
|
||||
- name: Restore Godot build cache
|
||||
uses: ./.github/actions/godot-cache-restore
|
||||
with:
|
||||
cache-name: ${{ matrix.cache-name }}
|
||||
continue-on-error: true
|
||||
|
||||
- name: Setup Python and SCons
|
||||
if: "!matrix.legacy-scons"
|
||||
uses: ./.github/actions/godot-deps
|
||||
|
||||
- name: Setup Python and SCons (legacy versions)
|
||||
if: matrix.legacy-scons
|
||||
uses: ./.github/actions/godot-deps
|
||||
with:
|
||||
# Sync with Ensure*Version in SConstruct.
|
||||
python-version: 3.8 # No Python < 3.8 available for Ubuntu 22.04.
|
||||
scons-version: 3.1.2
|
||||
|
||||
- name: Force remove preinstalled .NET SDKs
|
||||
if: matrix.build-mono
|
||||
run: |
|
||||
sudo rm -rf /usr/share/dotnet/sdk/*
|
||||
|
||||
- name: Setup older .NET SDK as baseline
|
||||
if: matrix.build-mono
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
# Targeting the oldest version we want to support to ensure it still builds.
|
||||
dotnet-version: 6.0.100
|
||||
|
||||
- name: Setup GCC problem matcher
|
||||
uses: ammaraskar/gcc-problem-matcher@master
|
||||
|
||||
- name: Compilation
|
||||
uses: ./.github/actions/godot-build
|
||||
with:
|
||||
sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
|
||||
platform: linuxbsd
|
||||
target: ${{ matrix.target }}
|
||||
tests: ${{ matrix.tests }}
|
||||
|
||||
- name: Compilation (godot-cpp)
|
||||
uses: ./.github/actions/godot-cpp-build
|
||||
if: matrix.godot-cpp
|
||||
with:
|
||||
bin: ${{ matrix.bin }}
|
||||
scons-flags: target=template_debug dev_build=yes verbose=yes
|
||||
godot-cpp-branch: ${{ env.GODOT_CPP_BRANCH }}
|
||||
|
||||
- name: Save Godot build cache
|
||||
uses: ./.github/actions/godot-cache-save
|
||||
with:
|
||||
cache-name: ${{ matrix.cache-name }}
|
||||
continue-on-error: true
|
||||
|
||||
- name: Generate C# glue
|
||||
if: matrix.build-mono
|
||||
run: |
|
||||
${{ matrix.bin }} --headless --generate-mono-glue ./modules/mono/glue
|
||||
|
||||
- name: Build .NET solutions
|
||||
if: matrix.build-mono
|
||||
run: |
|
||||
dotnet --info
|
||||
./modules/mono/build_scripts/build_assemblies.py --godot-output-dir=./bin --godot-platform=linuxbsd
|
||||
|
||||
- name: Prepare artifact
|
||||
if: matrix.artifact
|
||||
run: |
|
||||
strip bin/godot.*
|
||||
chmod +x bin/godot.*
|
||||
|
||||
- name: Upload artifact
|
||||
uses: ./.github/actions/upload-artifact
|
||||
if: matrix.artifact
|
||||
with:
|
||||
name: ${{ matrix.cache-name }}
|
||||
|
||||
- name: Unit tests
|
||||
if: matrix.tests
|
||||
run: |
|
||||
${{ matrix.bin }} --version
|
||||
${{ matrix.bin }} --help
|
||||
${{ matrix.bin }} --headless --test --force-colors
|
||||
|
||||
# Check class reference
|
||||
- name: Check for class reference updates
|
||||
if: matrix.doc-test
|
||||
run: |
|
||||
echo "Running --doctool to see if this changes the public API without updating the documentation."
|
||||
echo -e "If a diff is shown, it means that your code/doc changes are incomplete and you should update the class reference with --doctool.\n\n"
|
||||
${{ matrix.bin }} --doctool --headless 2>&1 > /dev/null || true
|
||||
git diff --color --exit-code && ! git ls-files --others --exclude-standard | sed -e 's/^/New doc file missing in PR: /' | grep 'xml$'
|
||||
|
||||
# Check API backwards compatibility
|
||||
- name: Check for GDExtension compatibility
|
||||
if: matrix.api-compat
|
||||
run: |
|
||||
./misc/scripts/validate_extension_api.sh "${{ matrix.bin }}"
|
||||
|
||||
# Download and run the test project
|
||||
- name: Test Godot project
|
||||
uses: ./.github/actions/godot-project-test
|
||||
if: matrix.proj-test
|
||||
with:
|
||||
bin: ${{ matrix.bin }}
|
||||
|
||||
# Test the project converter
|
||||
- name: Test project converter
|
||||
uses: ./.github/actions/godot-converter-test
|
||||
if: matrix.proj-conv
|
||||
with:
|
||||
bin: ${{ matrix.bin }}
|
||||
94
.github/workflows/macos_builds.yml
vendored
94
.github/workflows/macos_builds.yml
vendored
@ -1,94 +0,0 @@
|
||||
name: 🍎 macOS Builds
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
# Global Settings
|
||||
env:
|
||||
# Used for the cache key. Add version suffix to force clean build.
|
||||
GODOT_BASE_BRANCH: 4.1
|
||||
SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes
|
||||
|
||||
jobs:
|
||||
build-macos:
|
||||
runs-on: macos-latest
|
||||
name: ${{ matrix.name }}
|
||||
timeout-minutes: 120
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: Editor (target=editor, tests=yes)
|
||||
cache-name: macos-editor
|
||||
target: editor
|
||||
tests: true
|
||||
bin: ./bin/godot.macos.editor.universal
|
||||
|
||||
# Template builds need various fixes for unit tests to be supported in 4.1,
|
||||
# so we don't enable tests in this legacy branch.
|
||||
|
||||
- name: Template (target=template_release)
|
||||
cache-name: macos-template
|
||||
target: template_release
|
||||
tests: false
|
||||
sconsflags: debug_symbols=no
|
||||
bin: ./bin/godot.macos.template_release.universal
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Restore Godot build cache
|
||||
uses: ./.github/actions/godot-cache-restore
|
||||
with:
|
||||
cache-name: ${{ matrix.cache-name }}
|
||||
continue-on-error: true
|
||||
|
||||
- name: Setup Python and SCons
|
||||
uses: ./.github/actions/godot-deps
|
||||
|
||||
- name: Setup Vulkan SDK
|
||||
run: |
|
||||
sh misc/scripts/install_vulkan_sdk_macos.sh
|
||||
|
||||
- name: Compilation (x86_64)
|
||||
uses: ./.github/actions/godot-build
|
||||
with:
|
||||
sconsflags: ${{ env.SCONSFLAGS }} arch=x86_64
|
||||
platform: macos
|
||||
target: ${{ matrix.target }}
|
||||
tests: ${{ matrix.tests }}
|
||||
|
||||
- name: Compilation (arm64)
|
||||
uses: ./.github/actions/godot-build
|
||||
with:
|
||||
sconsflags: ${{ env.SCONSFLAGS }} arch=arm64
|
||||
platform: macos
|
||||
target: ${{ matrix.target }}
|
||||
tests: ${{ matrix.tests }}
|
||||
|
||||
- name: Save Godot build cache
|
||||
uses: ./.github/actions/godot-cache-save
|
||||
with:
|
||||
cache-name: ${{ matrix.cache-name }}
|
||||
continue-on-error: true
|
||||
|
||||
- name: Prepare artifact
|
||||
run: |
|
||||
lipo -create ./bin/godot.macos.${{ matrix.target }}.x86_64 ./bin/godot.macos.${{ matrix.target }}.arm64 -output ./bin/godot.macos.${{ matrix.target }}.universal
|
||||
rm ./bin/godot.macos.${{ matrix.target }}.x86_64 ./bin/godot.macos.${{ matrix.target }}.arm64
|
||||
strip bin/godot.*
|
||||
chmod +x bin/godot.*
|
||||
|
||||
- name: Upload artifact
|
||||
uses: ./.github/actions/upload-artifact
|
||||
with:
|
||||
name: ${{ matrix.cache-name }}
|
||||
|
||||
- name: Unit tests
|
||||
if: matrix.tests
|
||||
run: |
|
||||
${{ matrix.bin }} --version
|
||||
${{ matrix.bin }} --help
|
||||
${{ matrix.bin }} --test --force-colors
|
||||
46
.github/workflows/runner.yml
vendored
46
.github/workflows/runner.yml
vendored
@ -1,46 +0,0 @@
|
||||
name: 🔗 GHA
|
||||
on: [push, pull_request, merge_group]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}|${{ github.ref_name }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
# First stage: Only static checks, fast and prevent expensive builds from running.
|
||||
|
||||
static-checks:
|
||||
if: "!vars.DISABLE_GODOT_CI"
|
||||
name: 📊 Static checks
|
||||
uses: ./.github/workflows/static_checks.yml
|
||||
|
||||
# Second stage: Run all the builds and some of the tests.
|
||||
|
||||
android-build:
|
||||
name: 🤖 Android
|
||||
needs: static-checks
|
||||
uses: ./.github/workflows/android_builds.yml
|
||||
|
||||
ios-build:
|
||||
name: 🍏 iOS
|
||||
needs: static-checks
|
||||
uses: ./.github/workflows/ios_builds.yml
|
||||
|
||||
linux-build:
|
||||
name: 🐧 Linux
|
||||
needs: static-checks
|
||||
uses: ./.github/workflows/linux_builds.yml
|
||||
|
||||
macos-build:
|
||||
name: 🍎 macOS
|
||||
needs: static-checks
|
||||
uses: ./.github/workflows/macos_builds.yml
|
||||
|
||||
windows-build:
|
||||
name: 🏁 Windows
|
||||
needs: static-checks
|
||||
uses: ./.github/workflows/windows_builds.yml
|
||||
|
||||
web-build:
|
||||
name: 🌐 Web
|
||||
needs: static-checks
|
||||
uses: ./.github/workflows/web_builds.yml
|
||||
112
.github/workflows/static_checks.yml
vendored
112
.github/workflows/static_checks.yml
vendored
@ -1,112 +0,0 @@
|
||||
name: 📊 Static Checks
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
static-checks:
|
||||
name: Code style, file formatting, and docs
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- name: Install APT dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y dos2unix libxml2-utils moreutils
|
||||
|
||||
- name: Install Python dependencies and general setup
|
||||
run: |
|
||||
pip3 install black==23.3.0 pytest==7.1.2 mypy==0.971
|
||||
git config diff.wsErrorHighlight all
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" == "pull_request" ]; then
|
||||
files=$(git diff-tree --no-commit-id --name-only -r HEAD^1..HEAD 2> /dev/null || true)
|
||||
elif [ "${{ github.event_name }}" == "push" -a "${{ github.event.forced }}" == "false" -a "${{ github.event.created }}" == "false" ]; then
|
||||
files=$(git diff-tree --no-commit-id --name-only -r ${{ github.event.before }}..${{ github.event.after }} 2> /dev/null || true)
|
||||
fi
|
||||
echo "$files" >> changed.txt
|
||||
cat changed.txt
|
||||
files=$(echo "$files" | grep -v 'thirdparty' | xargs -I {} sh -c 'echo "\"./{}\""' | tr '\n' ' ')
|
||||
echo "CHANGED_FILES=$files" >> $GITHUB_ENV
|
||||
|
||||
- name: File formatting checks (file_format.sh)
|
||||
run: |
|
||||
bash ./misc/scripts/file_format.sh changed.txt
|
||||
|
||||
- name: Header guards formatting checks (header_guards.sh)
|
||||
run: |
|
||||
bash ./misc/scripts/header_guards.sh changed.txt
|
||||
|
||||
- name: Python style checks via black (black_format.sh)
|
||||
run: |
|
||||
if grep -qE '\.py$|SConstruct|SCsub' changed.txt || [ -z "$(cat changed.txt)" ]; then
|
||||
bash ./misc/scripts/black_format.sh
|
||||
else
|
||||
echo "Skipping Python formatting as no Python files were changed."
|
||||
fi
|
||||
|
||||
- name: Python scripts static analysis (mypy_check.sh)
|
||||
run: |
|
||||
if grep -qE '\.py$|SConstruct|SCsub' changed.txt || [ -z "$(cat changed.txt)" ]; then
|
||||
bash ./misc/scripts/mypy_check.sh
|
||||
else
|
||||
echo "Skipping Python static analysis as no Python files were changed."
|
||||
fi
|
||||
|
||||
- name: Python builders checks via pytest (pytest_builders.sh)
|
||||
run: |
|
||||
bash ./misc/scripts/pytest_builders.sh
|
||||
|
||||
- name: JavaScript style and documentation checks via ESLint and JSDoc
|
||||
run: |
|
||||
if grep -q "platform/web" changed.txt || [ -z "$(cat changed.txt)" ]; then
|
||||
cd platform/web
|
||||
npm ci
|
||||
npm run lint
|
||||
npm run docs -- -d dry-run
|
||||
else
|
||||
echo "Skipping JavaScript formatting as no Web/JS files were changed."
|
||||
fi
|
||||
|
||||
- name: Class reference schema checks
|
||||
run: |
|
||||
xmllint --noout --schema doc/class.xsd doc/classes/*.xml modules/*/doc_classes/*.xml platform/*/doc_classes/*.xml
|
||||
|
||||
- name: Documentation checks
|
||||
run: |
|
||||
doc/tools/doc_status.py doc/classes modules/*/doc_classes platform/*/doc_classes
|
||||
doc/tools/make_rst.py --dry-run --color doc/classes modules platform
|
||||
|
||||
- name: Style checks via clang-format (clang_format.sh)
|
||||
run: |
|
||||
clang-format --version
|
||||
bash ./misc/scripts/clang_format.sh changed.txt
|
||||
|
||||
- name: Style checks via dotnet format (dotnet_format.sh)
|
||||
run: |
|
||||
if grep -q "modules/mono" changed.txt || [ -z "$(cat changed.txt)" ]; then
|
||||
bash ./misc/scripts/dotnet_format.sh
|
||||
else
|
||||
echo "Skipping dotnet format as no C# files were changed."
|
||||
fi
|
||||
|
||||
- name: Spell checks via codespell
|
||||
if: github.event_name == 'pull_request' && env.CHANGED_FILES != ''
|
||||
uses: codespell-project/actions-codespell@v2
|
||||
with:
|
||||
skip: "./bin,./thirdparty,*.desktop,*.gen.*,*.po,*.pot,*.rc,./AUTHORS.md,./COPYRIGHT.txt,./DONORS.md,./core/input/gamecontrollerdb.txt,./core/string/locales.h,./editor/project_converter_3_to_4.cpp,./misc/scripts/codespell.sh,./platform/android/java/lib/src/com,./platform/web/node_modules,./platform/web/package-lock.json"
|
||||
ignore_words_list: "breaked,checkin,curvelinear,doubleclick,expct,findn,gird,hel,inout,labelin,lod,mis,nd,numer,ot,pointin,requestor,te,textin,thirdparty,vai"
|
||||
path: ${{ env.CHANGED_FILES }}
|
||||
|
||||
- name: Run C compiler on `gdextension_interface.h`
|
||||
run: |
|
||||
gcc -c core/extension/gdextension_interface.h
|
||||
71
.github/workflows/web_builds.yml
vendored
71
.github/workflows/web_builds.yml
vendored
@ -1,71 +0,0 @@
|
||||
name: 🌐 Web Builds
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
# Global Settings
|
||||
env:
|
||||
# Used for the cache key. Add version suffix to force clean build.
|
||||
GODOT_BASE_BRANCH: 4.1
|
||||
SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no
|
||||
EM_VERSION: 3.1.39
|
||||
|
||||
jobs:
|
||||
web-template:
|
||||
runs-on: ubuntu-24.04
|
||||
name: ${{ matrix.name }}
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: Template (target=template_release)
|
||||
cache-name: web-template
|
||||
target: template_release
|
||||
sconsflags:
|
||||
tests: false
|
||||
artifact: true
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Set up Emscripten latest
|
||||
uses: mymindstorm/setup-emsdk@v14
|
||||
with:
|
||||
version: ${{ env.EM_VERSION }}
|
||||
no-cache: true
|
||||
|
||||
- name: Verify Emscripten setup
|
||||
run: |
|
||||
emcc -v
|
||||
|
||||
- name: Restore Godot build cache
|
||||
uses: ./.github/actions/godot-cache-restore
|
||||
with:
|
||||
cache-name: ${{ matrix.cache-name }}
|
||||
continue-on-error: true
|
||||
|
||||
- name: Setup Python and SCons
|
||||
uses: ./.github/actions/godot-deps
|
||||
|
||||
- name: Compilation
|
||||
uses: ./.github/actions/godot-build
|
||||
with:
|
||||
sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
|
||||
platform: web
|
||||
target: ${{ matrix.target }}
|
||||
tests: ${{ matrix.tests }}
|
||||
|
||||
- name: Save Godot build cache
|
||||
uses: ./.github/actions/godot-cache-save
|
||||
with:
|
||||
cache-name: ${{ matrix.cache-name }}
|
||||
continue-on-error: true
|
||||
|
||||
- name: Upload artifact
|
||||
uses: ./.github/actions/upload-artifact
|
||||
if: matrix.artifact
|
||||
with:
|
||||
name: ${{ matrix.cache-name }}
|
||||
100
.github/workflows/windows_builds.yml
vendored
100
.github/workflows/windows_builds.yml
vendored
@ -1,100 +0,0 @@
|
||||
name: 🏁 Windows Builds
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
# Global Settings
|
||||
# SCONS_CACHE for windows must be set in the build environment
|
||||
env:
|
||||
# Used for the cache key. Add version suffix to force clean build.
|
||||
GODOT_BASE_BRANCH: 4.1
|
||||
SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes
|
||||
SCONS_CACHE_MSVC_CONFIG: true
|
||||
|
||||
jobs:
|
||||
build-windows:
|
||||
# Windows 10 with latest image
|
||||
runs-on: windows-latest
|
||||
name: ${{ matrix.name }}
|
||||
timeout-minutes: 120
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: Editor (target=editor, tests=yes)
|
||||
cache-name: windows-editor
|
||||
target: editor
|
||||
tests: true
|
||||
# Skip debug symbols, they're way too big with MSVC.
|
||||
sconsflags: debug_symbols=no vsproj=yes windows_subsystem=console
|
||||
bin: ./bin/godot.windows.editor.x86_64.exe
|
||||
compiler: msvc
|
||||
|
||||
# Template builds need various fixes for unit tests to be supported in 4.1,
|
||||
# so we don't enable tests in this legacy branch.
|
||||
|
||||
- name: Template (target=template_release)
|
||||
cache-name: windows-template
|
||||
target: template_release
|
||||
tests: false
|
||||
sconsflags: debug_symbols=no
|
||||
bin: ./bin/godot.windows.template_release.x86_64.console.exe
|
||||
compiler: msvc
|
||||
|
||||
- name: Template w/ GCC (target=template_release, use_mingw=yes)
|
||||
cache-name: windows-template-gcc
|
||||
# MinGW takes MUCH longer to compile; save time by only targeting Template.
|
||||
target: template_release
|
||||
tests: false
|
||||
sconsflags: debug_symbols=no use_mingw=yes
|
||||
bin: ./bin/godot.windows.template_release.x86_64.console.exe
|
||||
compiler: gcc
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Restore Godot build cache
|
||||
uses: ./.github/actions/godot-cache-restore
|
||||
with:
|
||||
cache-name: ${{ matrix.cache-name }}
|
||||
continue-on-error: true
|
||||
|
||||
- name: Setup Python and SCons
|
||||
uses: ./.github/actions/godot-deps
|
||||
|
||||
- name: Setup MSVC problem matcher
|
||||
uses: ammaraskar/msvc-problem-matcher@master
|
||||
|
||||
- name: Compilation
|
||||
uses: ./.github/actions/godot-build
|
||||
with:
|
||||
sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
|
||||
platform: windows
|
||||
target: ${{ matrix.target }}
|
||||
tests: ${{ matrix.tests }}
|
||||
|
||||
- name: Save Godot build cache
|
||||
uses: ./.github/actions/godot-cache-save
|
||||
with:
|
||||
cache-name: ${{ matrix.cache-name }}
|
||||
continue-on-error: true
|
||||
|
||||
- name: Prepare artifact
|
||||
if: matrix.compiler == 'msvc'
|
||||
run: |
|
||||
Remove-Item bin/* -Include *.exp,*.lib,*.pdb -Force
|
||||
|
||||
- name: Upload artifact
|
||||
if: matrix.compiler == 'msvc'
|
||||
uses: ./.github/actions/upload-artifact
|
||||
with:
|
||||
name: ${{ matrix.cache-name }}
|
||||
|
||||
- name: Unit tests
|
||||
if: matrix.tests
|
||||
run: |
|
||||
${{ matrix.bin }} --version
|
||||
${{ matrix.bin }} --help
|
||||
${{ matrix.bin }} --test --force-colors
|
||||
459
.gitignore
vendored
459
.gitignore
vendored
@ -1,274 +1,107 @@
|
||||
# Godot .gitignore config
|
||||
#
|
||||
# Aims to encompass the most commonly found files that we don't want committed
|
||||
# to Git, such as compilation output, IDE specific files, etc.
|
||||
#
|
||||
# It doesn't cover *all* thirdparty IDE extensions under the sun so if you have
|
||||
# specific needs covered here, you can add them to:
|
||||
# .git/info/exclude
|
||||
#
|
||||
# Or contribute them to this file if they're common enough that a good number of
|
||||
# users would benefit from the shared rules.
|
||||
#
|
||||
# This file is organized by sections, with subsections ordered alphabetically.
|
||||
# - Build configuration
|
||||
# - Godot generated files
|
||||
# - General build output
|
||||
# - IDE and tool specific
|
||||
# - Visual Studio specific
|
||||
# - OS specific
|
||||
# GoDot auto generated files
|
||||
platform/server/logo.h
|
||||
platform/android/logo.h
|
||||
platform/bb10/logo.h
|
||||
platform/iphone/logo.h
|
||||
platform/javascript/logo.h
|
||||
platform/nacl/logo.h
|
||||
platform/osx/logo.h
|
||||
platform/windows/logo.h
|
||||
platform/x11/logo.h
|
||||
drivers/gles2/shaders/*.h
|
||||
modules/register_module_types.cpp
|
||||
core/version.h
|
||||
core/method_bind.inc
|
||||
core/method_bind_ext.inc
|
||||
core/script_encryption_key.cpp
|
||||
core/global_defaults.cpp
|
||||
tools/editor/register_exporters.cpp
|
||||
tools/editor/doc_data_compressed.h
|
||||
tools/editor/editor_icons.cpp
|
||||
-fpic
|
||||
.fscache
|
||||
make.bat
|
||||
log.txt
|
||||
|
||||
###########################
|
||||
### Build configuration ###
|
||||
###########################
|
||||
# Javascript specific
|
||||
*.bc
|
||||
|
||||
/custom.py
|
||||
misc/hooks/pre-commit-custom-*
|
||||
# Android specific
|
||||
platform/android/java/local.properties
|
||||
platform/android/java/project.properties
|
||||
platform/android/java/AndroidManifest.xml
|
||||
platform/android/java/bin/*
|
||||
platform/android/java/libs/*
|
||||
platform/android/java/gen/*
|
||||
platform/android/java/assets
|
||||
platform/android/libs/apk_expansion/bin/*
|
||||
platform/android/libs/apk_expansion/gen/*
|
||||
platform/android/libs/google_play_services/bin/*
|
||||
platform/android/libs/google_play_services/gen/*
|
||||
platform/android/libs/play_licensing/bin/*
|
||||
platform/android/libs/play_licensing/gen/*
|
||||
|
||||
#############################
|
||||
### Godot generated files ###
|
||||
#############################
|
||||
|
||||
# Buildsystem
|
||||
bin
|
||||
*.gen.*
|
||||
compile_commands.json
|
||||
platform/windows/godot_res.res
|
||||
|
||||
# Generated by Godot binary
|
||||
.import/
|
||||
/gdextension_interface.h
|
||||
extension_api.json
|
||||
logs/
|
||||
|
||||
# Generated by unit tests
|
||||
tests/data/*.translation
|
||||
|
||||
############################
|
||||
### General build output ###
|
||||
############################
|
||||
|
||||
# C/C++ generated
|
||||
# General c++ generated files
|
||||
*.lib
|
||||
*.o
|
||||
*.ox
|
||||
*.a
|
||||
*.ax
|
||||
*.d
|
||||
*.dll
|
||||
*.lib
|
||||
*.lo
|
||||
*.o
|
||||
*.os
|
||||
*.ox
|
||||
*.Plo
|
||||
*.so
|
||||
# Binutils tmp linker output of the form "stXXXXXX" where "X" is alphanumeric
|
||||
st[A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9]
|
||||
*.os
|
||||
|
||||
# Python development
|
||||
.venv
|
||||
venv
|
||||
|
||||
# Python generated
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Documentation
|
||||
doc/_build/
|
||||
|
||||
# Android
|
||||
.gradle/
|
||||
local.properties
|
||||
*.iml
|
||||
.gradletasknamecache
|
||||
project.properties
|
||||
platform/android/java/*/.cxx/
|
||||
platform/android/java/*/build/
|
||||
platform/android/java/*/libs/
|
||||
|
||||
# iOS
|
||||
*.dSYM
|
||||
|
||||
# Web platform
|
||||
*.bc
|
||||
platform/web/node_modules/
|
||||
|
||||
# Misc
|
||||
*.debug
|
||||
|
||||
#############################
|
||||
### IDE and tool specific ###
|
||||
#############################
|
||||
|
||||
# Automake
|
||||
.deps/*
|
||||
.dirstamp
|
||||
|
||||
# ccls
|
||||
.ccls-cache/
|
||||
|
||||
# clangd
|
||||
.clangd/
|
||||
.cache/
|
||||
|
||||
# CLion
|
||||
cmake-build-debug
|
||||
|
||||
# Code::Blocks
|
||||
*.cbp
|
||||
*.layout
|
||||
*.depend
|
||||
|
||||
# CodeLite
|
||||
*.project
|
||||
*.workspace
|
||||
.codelite/
|
||||
|
||||
# Cppcheck
|
||||
*.cppcheck
|
||||
cppcheck-cppcheck-build-dir/
|
||||
|
||||
# Eclipse CDT
|
||||
.cproject
|
||||
.settings/
|
||||
*.pydevproject
|
||||
*.launch
|
||||
|
||||
# Emacs
|
||||
\#*\#
|
||||
.\#*
|
||||
|
||||
# GCOV code coverage
|
||||
*.gcda
|
||||
*.gcno
|
||||
|
||||
# Geany
|
||||
*.geany
|
||||
.geanyprj
|
||||
|
||||
# Gprof
|
||||
gmon.out
|
||||
|
||||
# Jetbrains IDEs
|
||||
.idea/
|
||||
.fleet/
|
||||
|
||||
# Kate
|
||||
*.kate-swp
|
||||
|
||||
# Kdevelop
|
||||
*.kdev4
|
||||
|
||||
# Qt Creator
|
||||
# QT project files
|
||||
*.config
|
||||
*.creator
|
||||
*.creator.*
|
||||
*.files
|
||||
*.includes
|
||||
*.cflags
|
||||
*.cxxflags
|
||||
|
||||
# SCons
|
||||
.sconf_temp
|
||||
.sconsign*.dblite
|
||||
.scons_env.json
|
||||
.scons_node_count
|
||||
# Misc
|
||||
.DS_Store
|
||||
|
||||
# Sourcetrail
|
||||
*.srctrl*
|
||||
# for projects that use SCons for building: http://http://www.scons.org/
|
||||
.sconsign.dblite
|
||||
*.pyc
|
||||
|
||||
# Tags
|
||||
# https://github.com/github/gitignore/blob/master/Global/Tags.gitignore
|
||||
# Ignore tags created by etags, ctags, gtags (GNU global) and cscope
|
||||
TAGS
|
||||
!TAGS/
|
||||
tags
|
||||
*.tags
|
||||
!tags/
|
||||
gtags.files
|
||||
GTAGS
|
||||
GRTAGS
|
||||
GPATH
|
||||
cscope.files
|
||||
cscope.out
|
||||
cscope.in.out
|
||||
cscope.po.out
|
||||
|
||||
# Vim
|
||||
*.swo
|
||||
*.swp
|
||||
|
||||
# Visual Studio Code
|
||||
.vscode/
|
||||
*.code-workspace
|
||||
.history/
|
||||
|
||||
# Xcode
|
||||
xcuserdata/
|
||||
*.xcscmblueprint
|
||||
*.xccheckout
|
||||
*.xcodeproj/*
|
||||
|
||||
##############################
|
||||
### Visual Studio specific ###
|
||||
##############################
|
||||
|
||||
# https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
# Ignore Visual Studio temporary files, build results, and
|
||||
# files generated by popular Visual Studio add-ons.
|
||||
|
||||
# Actual VS project files we don't use
|
||||
*.sln
|
||||
*.vcxproj*
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
build/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Do not ignore arch-specific folders anywhere under thirdparty libraries
|
||||
!thirdparty/**/x64/
|
||||
!thirdparty/**/x86/
|
||||
!thirdparty/**/arm/
|
||||
!thirdparty/**/arm64/
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
#NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# Files built by Visual Studio
|
||||
*.o
|
||||
*.a
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
@ -278,9 +111,7 @@ Generated\ Files/
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.tlog
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
@ -288,83 +119,165 @@ Generated\ Files/
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
# CodeLite project files
|
||||
*.project
|
||||
*.workspace
|
||||
.codelite/
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# JustCode is a .NET coding addin-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
*.ncrunch*
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# dumpdoc generated files
|
||||
doc/html/class_list
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
|
||||
# NuGet Packages Directory
|
||||
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
|
||||
#packages/*
|
||||
## TODO: If the tool you use requires repositories.config, also uncomment the next line
|
||||
#!packages/repositories.config
|
||||
|
||||
# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
|
||||
# This line needs to be after the ignore of the build folder (and the packages folder if the line above has been uncommented)
|
||||
!packages/build/
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Others
|
||||
sql/
|
||||
*.Cache
|
||||
ClientBin/
|
||||
enc_temp_folder/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
node_modules/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
# KDE
|
||||
.directory
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file to a newer
|
||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# Hint file for IntelliSense
|
||||
cpp.hint
|
||||
# SQL Server files
|
||||
App_Data/*.mdf
|
||||
App_Data/*.ldf
|
||||
|
||||
###################
|
||||
### OS specific ###
|
||||
###################
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
|
||||
# Linux
|
||||
*~
|
||||
.directory
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# macOS
|
||||
.DS_Store
|
||||
__MACOSX
|
||||
# =========================
|
||||
# Windows detritus
|
||||
# =========================
|
||||
|
||||
# Windows
|
||||
# https://github.com/github/gitignore/blob/main/Global/Windows.gitignore
|
||||
[Tt]humbs.db
|
||||
[Tt]humbs.db:encryptable
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
*.stackdump
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
*.lnk
|
||||
logo.h
|
||||
*.autosave
|
||||
|
||||
# https://github.com/github/gitignore/blob/master/Global/Tags.gitignore
|
||||
# Ignore tags created by etags, ctags, gtags (GNU global) and cscope
|
||||
TAGS
|
||||
!TAGS/
|
||||
tags
|
||||
!tags/
|
||||
gtags.files
|
||||
GTAGS
|
||||
GRTAGS
|
||||
GPATH
|
||||
cscope.files
|
||||
cscope.out
|
||||
cscope.in.out
|
||||
cscope.po.out
|
||||
godot.creator.user.wd3476
|
||||
|
||||
167
.mailmap
167
.mailmap
@ -1,167 +0,0 @@
|
||||
Aaron Record <aaronjrecord@gmail.com>
|
||||
ajreckof <66184050+ajreckof@users.noreply.github.com> <tbonhoure@ymail.com>
|
||||
Alexander Holland <alexander.holland@live.de>
|
||||
Alexander Holland <alexander.holland@live.de> <alexander.holland@haw-hamburg.de>
|
||||
Alexander Holland <alexander.holland@live.de> <AlexHolly>
|
||||
Alfred Reinold Baudisch <alfred@alfredbaudisch.com>
|
||||
Andrea Catania <info@andreacatania.com>
|
||||
Anish Bhobe <anishbhobe@hotmail.com>
|
||||
Anutrix <numaanzaheerahmed@yahoo.com>
|
||||
Aren Villanueva <arenvillanueva@yomogi-soft.com> <aren@displaysweet.com>
|
||||
Ariel Manzur <ariel@godotengine.org>
|
||||
Ariel Manzur <ariel@godotengine.org> <puntob@gmail.com>
|
||||
Ariel Manzur <ariel@godotengine.org> <punto@godotengine.org>
|
||||
Ariel Manzur <ariel@godotengine.org> <ariel@okamstudio.com>
|
||||
Ariel Manzur <ariel@godotengine.org> <punto@Ariels-Mac-mini.local>
|
||||
Ariel Manzur <ariel@godotengine.org> <punto@Ariels-Mac-mini-2.local>
|
||||
Bastiaan Olij <mux213@gmail.com>
|
||||
Benjamin <mafortion.benjamin@gmail.com>
|
||||
Bernhard Liebl <Bernhard.Liebl@gmx.org> <poke1024@gmx.de>
|
||||
Bernhard Liebl <Bernhard.Liebl@gmx.org> <poke1024@gmx.org>
|
||||
Bruno Lourenço <madequa@users.noreply.github.com> <bmlourenco@gmail.com>
|
||||
Chaosus <chaosus89@gmail.com>
|
||||
Chris Bradfield <chris@kidscancode.org> <cb@scribe.net>
|
||||
Clay John <claynjohn@gmail.com>
|
||||
Clay John <claynjohn@gmail.com> <clayjohn@shaw.ca>
|
||||
Dana Olson <dana@shineuponthee.com> <adolson@gmail.com>
|
||||
dankan1890 <mewuidev2@gmail.com>
|
||||
Daniel J. Ramirez <djrmuv@gmail.com>
|
||||
David Cambré <david.cambre@gmail.com> <David.Cambre@gmail.com>
|
||||
Dominik 'dreamsComeTrue' Jasiński <dominikjasinski@o2.pl>
|
||||
DeeJayLSP <djlsplays@gmail.com> <60024671+DeeJayLSP@users.noreply.github.com>
|
||||
Emmanuel Barroga <emmanuelbarroga@gmail.com>
|
||||
Eric M <itsjusteza@gmail.com>
|
||||
Eric Rybicki <info@ericrybicki.com> <stratos695@googlemail.com>
|
||||
Erik Selecký <35656626+rxlecky@users.noreply.github.com>
|
||||
Erik Selecký <35656626+rxlecky@users.noreply.github.com> <35656626+SeleckyErik@users.noreply.github.com>
|
||||
Eveline Jarosz <marqin.pl@gmail.com>
|
||||
Eveline Jarosz <marqin.pl@gmail.com> <marqin.pl+git@gmail.com>
|
||||
Fabian <supagu@gmail.com>
|
||||
Ferenc Arn <tagcup@yahoo.com>
|
||||
Ferenc Arn <tagcup@yahoo.com> <tagcup@users.noreply.github.com>
|
||||
FireForge <67974470+fire-forge@users.noreply.github.com> <isaacr.7.2005@gmail.com>
|
||||
foxydevloper <12120644+foxydevloper@users.noreply.github.com>
|
||||
Fredia Huya-Kouadio <fhuyakou@gmail.com>
|
||||
Fredia Huya-Kouadio <fhuyakou@gmail.com> <fhuya@google.com>
|
||||
Fredia Huya-Kouadio <fhuyakou@gmail.com> <fhuya@fb.com>
|
||||
Fredia Huya-Kouadio <fhuyakou@gmail.com> <fhuya@meta.com>
|
||||
Geequlim <geequlim@gmail.com>
|
||||
Gilles Roudiere <gilles.roudiere@gmail.com>
|
||||
Gilles Roudiere <gilles.roudiere@gmail.com> <gilles.roudiere@laas.fr>
|
||||
Gordon MacPherson <gordon@gordonite.tech>
|
||||
Guilherme Felipe <guilhermefelipecgs@gmail.com>
|
||||
Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
|
||||
HaSa1002 <johawitt@outlook.de>
|
||||
Hein-Pieter van Braam-Stewart <hp@tmm.cx>
|
||||
Hugo Locurcio <hugo.locurcio@hugo.pro> <hugo.l@openmailbox.org>
|
||||
Hugo Locurcio <hugo.locurcio@hugo.pro> <Calinou@users.noreply.github.com>
|
||||
Hugo Locurcio <hugo.locurcio@hugo.pro> Calinou <calinou@opmbx.org>
|
||||
Ian Bishop <ianb96@gmail.com>
|
||||
Ignacio Etcheverry <ignalfonsore@gmail.com>
|
||||
Ignacio Etcheverry <ignalfonsore@gmail.com> <neikeq@users.noreply.github.com>
|
||||
Ilaria Cislaghi <cislaghi.ilaria@gmail.com>
|
||||
Ilaria Cislaghi <cislaghi.ilaria@gmail.com> <ilaria.cislaghi@simedis.com>
|
||||
Indah Sylvia <ISylvox@yahoo.com>
|
||||
iwek <miwanczuk7@gmail.com>
|
||||
J08nY <johny@neuromancer.sk> <jancar.jj@gmail.com>
|
||||
J08nY <johny@neuromancer.sk> <J08nY@users.noreply.github.com>
|
||||
Jake Young <young9003@gmail.com>
|
||||
Jakub Grzesik <kubecz3k@gmail.com>
|
||||
janglee <merupatel123@gmail.com>
|
||||
Jason Knight <00jknight@gmail.com> <jason@winterpixel.com>
|
||||
Jean-Michel Bernard <jmb462@gmail.com>
|
||||
Jérôme Gully <jerome.gully0@gmail.com>
|
||||
JFonS <joan.fonssanchez@gmail.com>
|
||||
Juan Linietsky <reduzio@gmail.com>
|
||||
Juan Linietsky <reduzio@gmail.com> <juan@godotengine.org>
|
||||
Juan Linietsky <reduzio@gmail.com> <juan@okamstudio.com>
|
||||
Juan Linietsky <reduzio@gmail.com> <reduz@Juans-MBP.fibertel.com.ar>
|
||||
Juan Linietsky <reduzio@gmail.com> <red@kyoko>
|
||||
Julian Murgia <the.straton@gmail.com>
|
||||
Kanabenki <lucien.menassol@gmail.com> <18357657+Kanabenki@users.noreply.github.com>
|
||||
karroffel <therzog@mail.de>
|
||||
karroffel <therzog@mail.de> <thomas.herzog@mail.com>
|
||||
karroffel <therzog@mail.de> <thomas.herzog@simedis.com>
|
||||
Kelly Thomas <kelly.thomas@hotmail.com.au>
|
||||
Kongfa Waroros <gongpha@hotmail.com>
|
||||
K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>
|
||||
kleonc <9283098+kleonc@users.noreply.github.com> <kleonc@users.noreply.github.com>
|
||||
Leon Krause <lk@leonkrause.com> <eska@eska.me>
|
||||
Leon Krause <lk@leonkrause.com> <eska014@users.noreply.github.com>
|
||||
Liz Haas <27thLiz@gmail.com>
|
||||
Liz Haas <27thLiz@gmail.com> <liu.gam3@gmail.com>
|
||||
Liz Haas <27thLiz@gmail.com> <hinsbart@gmail.com>
|
||||
Liz Haas <27thLiz@gmail.com> <hinsbart@users.noreply.github.com>
|
||||
Liz Haas <27thLiz@gmail.com> <entenflugstuhl@gmail.com>
|
||||
Manuele Finocchiaro <m4nu3lf@gmail.com>
|
||||
Manuel Strey <manuel.strey@gmx.de>
|
||||
Marcel Admiraal <madmiraal@users.noreply.github.com>
|
||||
Marcelo Fernandez <marcelofg55@gmail.com>
|
||||
Marcin Zawiejski <dragmz@gmail.com>
|
||||
Marcus Elg <marcusaccounts@yahoo.se>
|
||||
Mariano Javier Suligoy <marianognu.easyrpg@gmail.com>
|
||||
Mario Schlack <m4r10.5ch14ck@gmail.com>
|
||||
marxin <mliska@suse.cz>
|
||||
marynate <mary.w.nate@gmail.com> <marynate@github.com>
|
||||
Mateo Kuruk Miccino <mateomiccino@gmail.com>
|
||||
Max Hilbrunner <m.hilbrunner@gmail.com>
|
||||
Max Hilbrunner <m.hilbrunner@gmail.com> <mhilbrunner@users.noreply.github.com>
|
||||
MewPurPur <mew.pur.pur@abv.bg>
|
||||
Michael Alexsander <michaelalexsander@protonmail.com>
|
||||
Micky <micheledevita2@gmail.com> <66727710+Mickeon@users.noreply.github.com>
|
||||
Nathan Franke <natfra@pm.me> <nathanwfranke@gmail.com>
|
||||
Nathan Lovato <nathan@gdquest.com>
|
||||
Nathan Warden <nathan@nathanwarden.com> <nathanwardenlee@icloud.com>
|
||||
Nicholas Huelin <62965063+SirQuartz@users.noreply.github.com>
|
||||
Nils ANDRÉ-CHANG <nils@nilsand.re>
|
||||
Nils ANDRÉ-CHANG <nils@nilsand.re> <nils.andre.chang@gmail.com>
|
||||
Nuno Donato <nunodonato@gmail.com> <n.donato@estrelasustentavel.pt>
|
||||
ocean (they/them) <anvilfolk@gmail.com>
|
||||
Pawel Kowal <pkowal1982@gmail.com>
|
||||
Pedro J. Estébanez <pedrojrulez@gmail.com> <RandomShaper@users.noreply.github.com>
|
||||
Patrick <firefly2442@gmail.com>
|
||||
Paul Batty <p_batty@hotmail.co.uk>
|
||||
Paul Batty <p_batty@hotmail.co.uk> <Paulb23@users.noreply.github.com>
|
||||
Pawel Kowal <pkowal1982@gmail.com> <pawel.kowal@javart.eu>
|
||||
Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
|
||||
Pieter-Jan Briers <pieterjan.briers+git@gmail.com> <pieterjan.briers@gmail.com>
|
||||
Poommetee Ketson <poommetee@protonmail.com>
|
||||
Przemysław Gołąb (n-pigeon) <golab.przemyslaw@gmail.com>
|
||||
Rafał Mikrut <mikrutrafal@protonmail.com>
|
||||
Rafał Mikrut <mikrutrafal@protonmail.com> <mikrutrafal54@gmail.com>
|
||||
Ralf Hölzemer <r.hoelzemer@posteo.de> <rollenrolm@posteo.de>
|
||||
Ralf Hölzemer <r.hoelzemer@posteo.de> <rollenrolm@users.noreply.github.com>
|
||||
Ramesh Ravone <ramesh.maran443@gmail.com>
|
||||
RaphaelHunter <raphael10241024@gmail.com>
|
||||
RaphaelHunter <raphael10241024@gmail.com> <Raphael10241024@gmail.com>
|
||||
RaphaelHunter <raphael10241024@gmail.com> <raphael20141024@gmail.com>
|
||||
Rémi Verschelde <rverschelde@gmail.com> <remi@verschelde.fr>
|
||||
Rhody Lugo <rhodylugo@gmail.com> <rhodylugo@me.com>
|
||||
Ricardo Subtil <ricasubtil@gmail.com>
|
||||
Rindbee <idleman@yeah.net>
|
||||
Riteo Siuga <riteo@posteo.net>
|
||||
Robin Hübner <profan@prfn.se> <robinhubner@gmail.com>
|
||||
romulox_x <romulox_x@yahoo.com>
|
||||
rune-scape <allie.smith.epic@gmail.com>
|
||||
rune-scape <allie.smith.epic@gmail.com> <spartacrafter@gmail.com>
|
||||
Ruslan Mustakov <r.mustakov@gmail.com> <ruslan.mustakov@xored.com>
|
||||
Saracen <SaracenOne@gmail.com>
|
||||
sheepandshepherd <sheepandshepherd@hotmail.com> <sheepandshepherd@users.noreply.github.com>
|
||||
Silc 'Tokage' Renew <tokage.it.lab@gmail.com>
|
||||
Silc 'Tokage' Renew <tokage.it.lab@gmail.com> <61938263+TokageItLab@users.noreply.github.com>
|
||||
Swarnim Arun <swarnimarun11@gmail.com>
|
||||
TechnoPorg <jonah.janzen@gmail.com> <69441745+TechnoPorg@users.noreply.github.com>
|
||||
Theo Hallenius <redsymbzone@hotmail.com>
|
||||
Tomasz Chabora <kobewi4e@gmail.com>
|
||||
Twarit <wtwarit@gmail.com>
|
||||
Vitika9 <vitika.program@gmail.com>
|
||||
V.VamsiKrishna <vk@bsb.in> <vamsikrishna.v@gmail.com>
|
||||
Wilhem Barbier <nounoursheureux@openmailbox.org> <wilhem.b@free.fr>
|
||||
Wilhem Barbier <nounoursheureux@openmailbox.org> <schtroumps31@gmail.com>
|
||||
Will Nations <willnationsdev@gmail.com>
|
||||
yg2f <yoann@terminajones.com>
|
||||
Yuri Sizov <yuris@humnom.net> <pycbouh@users.noreply.github.com>
|
||||
Yuri Sizov <yuris@humnom.net> <yaschik4ilicha@gmail.com>
|
||||
Zae <zaevi@live.com>
|
||||
Zak Stam <zakscomputers@hotmail.com>
|
||||
Zher Huei Lee <lee.zh.92@gmail.com>
|
||||
14
.travis.yml
Normal file
14
.travis.yml
Normal file
@ -0,0 +1,14 @@
|
||||
language: cpp
|
||||
compiler:
|
||||
- gcc
|
||||
before_install:
|
||||
|
||||
|
||||
before_script:
|
||||
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -qq scons pkg-config libx11-dev libxcursor-dev build-essential libasound2-dev libfreetype6-dev libgl1-mesa-dev libglu-dev
|
||||
- if [ "$CXX" = "g++" ]; then sudo apt-get install -qq g++-4.8; fi
|
||||
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
|
||||
|
||||
script: scons platform=x11
|
||||
278
AUTHORS.md
278
AUTHORS.md
@ -1,278 +0,0 @@
|
||||
# Godot Engine authors
|
||||
|
||||
Godot Engine is developed by a community of voluntary contributors who
|
||||
contribute code, bug reports, documentation, artwork, support, etc.
|
||||
|
||||
It is impossible to list them all; nevertheless, this file aims at listing
|
||||
the developers who contributed significant patches to this MIT licensed
|
||||
source code. "Significant" is arbitrarily decided, but should be fair :)
|
||||
|
||||
GitHub usernames are indicated in parentheses, or as sole entry when no other
|
||||
name is available.
|
||||
|
||||
## Project Founders
|
||||
|
||||
Juan Linietsky (reduz)
|
||||
Ariel Manzur (punto-)
|
||||
|
||||
## Lead Developer
|
||||
|
||||
Juan Linietsky (reduz)
|
||||
|
||||
## Project Manager
|
||||
|
||||
Rémi Verschelde (akien-mga)
|
||||
|
||||
## Developers
|
||||
|
||||
(in alphabetical order, with over 10 commits excluding merges)
|
||||
|
||||
Aaron Franke (aaronfranke)
|
||||
Aaron Record (LightningAA)
|
||||
Adam Scott (adamscott)
|
||||
Alexander Holland (AlexHolly)
|
||||
Alexey Khoroshavin (allkhor)
|
||||
Alfred Reinold Baudisch (alfredbaudisch)
|
||||
Alket Rexhepi (alketii)
|
||||
Andrea Catania (AndreaCatania)
|
||||
Andrii Doroshenko (Xrayez)
|
||||
Andy Maloney (asmaloney)
|
||||
Andy Moss (MillionOstrich)
|
||||
Angad Kambli (angad-k)
|
||||
Anilforextra (AnilBK)
|
||||
Anish Bhobe (KidRigger)
|
||||
Anton Yabchinskiy (a12n)
|
||||
Anutrix
|
||||
Aren Villanueva (kurikaesu)
|
||||
Ariel Manzur (punto-)
|
||||
AThousandShips
|
||||
Bartłomiej T. Listwon (Listwon)
|
||||
Bastiaan Olij (BastiaanOlij)
|
||||
Ben Brookshire (sheepandshepherd)
|
||||
Benjamin Larsson (Nallebeorn)
|
||||
Bernhard Liebl (poke1024)
|
||||
Bhuvan Vemula (Bhu1-V)
|
||||
bitsawer
|
||||
Błażej Szczygieł (zaps166)
|
||||
Bojidar Marinov (bojidar-bg)
|
||||
Brian Semrau (briansemrau)
|
||||
Bruno Lourenço (MadEqua)
|
||||
Cameron Reikes (creikey)
|
||||
Camille Mohr-Daurat (pouleyKetchoupp)
|
||||
Caner Demirer (cdemirer)
|
||||
Carl Olsson (not-surt)
|
||||
Carter Anderson (cart)
|
||||
Chris Bradfield (cbscribe)
|
||||
Clay John (clayjohn)
|
||||
ConteZero
|
||||
Dana Olson (adolson)
|
||||
Daniel J. Ramirez (djrm)
|
||||
Daniel Rakos (aqnuep)
|
||||
Daniel Zilberleyb (dzil123)
|
||||
Danil Alexeev (dalexeev)
|
||||
dankan1890
|
||||
David Cambré (Gallilus)
|
||||
David Sichma (DavidSichma)
|
||||
David Snopek (dsnopek)
|
||||
Dharkael (lupoDharkael)
|
||||
Dmitry Koteroff (Krakean)
|
||||
Dmitry Maganov (vonagam)
|
||||
Dominik Jasiński (dreamsComeTrue)
|
||||
Douglas Leão (DeeJayLSP)
|
||||
DualMatrix
|
||||
Ellen Poe (ellenhp)
|
||||
Emmanuel Barroga (codecustard)
|
||||
Emmanuel Leblond (touilleMan)
|
||||
Eoin O'Neill (Eoin-ONeill-Yokai)
|
||||
Eric Lasota (elasota)
|
||||
Eric M (EricEzaM)
|
||||
Eric Rybicki (ericrybick)
|
||||
Erik Selecký (rxlecky)
|
||||
est31
|
||||
Eveline Jarosz (Marqin)
|
||||
Fabian Mathews (supagu)
|
||||
Fabio Alessandrelli (Faless)
|
||||
Fabrice Cipolla (fabriceci)
|
||||
Ferenc Arn (tagcup)
|
||||
FireForge (fire-forge)
|
||||
follower
|
||||
foxydevloper
|
||||
François Belair (Razoric480)
|
||||
Franklin Sobrinho (TheHX)
|
||||
Fredia Huya-Kouadio (m4gr3d)
|
||||
Geequlim
|
||||
George Marques (vnen)
|
||||
Gerrit Großkopf (Grosskopf)
|
||||
Gilles Roudiere (groud)
|
||||
Gordon MacPherson (RevoluPowered)
|
||||
Guilherme Felipe de C. G. da Silva (guilhermefelipecgs)
|
||||
Hakim Rouatbi (hakro)
|
||||
Hanif Bin Ariffin (hbina)
|
||||
Haoyu Qiu (timothyqiu)
|
||||
Hein-Pieter van Braam-Stewart (hpvb)
|
||||
Hendrik Brucker (Geometror)
|
||||
hilfazer
|
||||
Hiroshi Ogawa (hi-ogawa)
|
||||
homer666
|
||||
hoontee
|
||||
Hugo Locurcio (Calinou)
|
||||
Ian Bishop (ianb96)
|
||||
Ibrahn Sahir (ibrahn)
|
||||
Ignacio Etcheverry (neikeq)
|
||||
Igor Kordiukiewicz (IgorKordiukiewicz)
|
||||
Ilaria Cislaghi (QbieShay)
|
||||
Indah Sylvia (ISylvox)
|
||||
J08nY
|
||||
Jake Young (Duroxxigar)
|
||||
Jakub Grzesik (kubecz3k)
|
||||
James Buck (jbuck3)
|
||||
Jan Haller (Bromeon)
|
||||
Jason Knight (jasonwinterpixel)
|
||||
Jean-Michel Bernard (jmb462)
|
||||
Jérôme Gully (Nutriz)
|
||||
Jia Jun Chai (SkyLucilfer)
|
||||
Joan Fons Sanchez (JFonS)
|
||||
Johan Manuel (29jm)
|
||||
Johannes Witt (HaSa1002)
|
||||
Jonathan Nicholl (jtnicholl)
|
||||
Jordan Schidlowsky (winterpixelgames)
|
||||
Josh Jones (DarkKilauea)
|
||||
Joshua Grams (JoshuaGrams)
|
||||
Juan Linietsky (reduz)
|
||||
Julian Murgia (StraToN)
|
||||
Julien Nguyen (Blackiris)
|
||||
Jummit
|
||||
Justo Delgado (mrcdk)
|
||||
karroffel
|
||||
Kelly Thomas (KellyThomas)
|
||||
kleonc
|
||||
Kongfa Waroros (gongpha)
|
||||
Kostadin Damyanov (Max-Might)
|
||||
K. S. Ernest (iFire) Lee (fire)
|
||||
lawnjelly
|
||||
Leon Krause (leonkrause)
|
||||
Liz Haas (27thLiz)
|
||||
Lucien Menassol (Kanabenki)
|
||||
Lyuma
|
||||
Maganty Rushyendra (mrushyendra)
|
||||
Manuele Finocchiaro (m4nu3lf)
|
||||
Marcel Admiraal (madmiraal)
|
||||
Marcelo Fernandez (marcelofg55)
|
||||
Marc Gilleron (Zylann)
|
||||
Marcin Zawiejski (dragmz)
|
||||
Marcus Brummer (mbrlabs)
|
||||
Marcus Elg (MCrafterzz)
|
||||
Mariano Javier Suligoy (MarianoGnu)
|
||||
Mario Schlack (hurikhan)
|
||||
Marios Staikopoulos (marstaik)
|
||||
Marius Hanl (Maran23)
|
||||
Mark Riedesel (klowner)
|
||||
Markus Sauermann (Sauermann)
|
||||
Martin Capitanio (capnm)
|
||||
Martin Liška (marxin)
|
||||
Martin Sjursen (binbitten)
|
||||
marynate
|
||||
Masoud BH (masoudbh3)
|
||||
Mateo Kuruk Miccino (kuruk-mm)
|
||||
Matthew (skyace65)
|
||||
Matthias Hölzl (hoelzl)
|
||||
Max Hilbrunner (mhilbrunner)
|
||||
merumelu
|
||||
Meru Patel (Janglee123)
|
||||
MewPurPur
|
||||
Michael Alexsander (YeldhamDev)
|
||||
Michał Iwańczuk (iwek7)
|
||||
MichiRecRoom (LikeLakers2)
|
||||
Micky (Mickeon)
|
||||
Mikael Hermansson (mihe)
|
||||
MinusKube
|
||||
Morris "Tabor" Arroad (mortarroad)
|
||||
mrezai
|
||||
Muhammad Huri (CakHuri)
|
||||
muiroc
|
||||
Nathan Franke (nathanfranke)
|
||||
Nathan Lovato (NathanLovato)
|
||||
Nathan Warden (NathanWarden)
|
||||
Nicholas Huelin (SirQuartz)
|
||||
Nikita Lita (nikitalita)
|
||||
Nils André-Chang (NilsIrl)
|
||||
Noah Beard (TwistedTwigleg)
|
||||
Nông Văn Tình (nongvantinh)
|
||||
Nuno Donato (nunodonato)
|
||||
ocean (they/them) (anvilfolk)
|
||||
Omar El Sheikh (The-O-King)
|
||||
Ovnuniarchos
|
||||
Pascal Richter (ShyRed)
|
||||
Patrick (firefly2442)
|
||||
Paul Batty (Paulb23)
|
||||
Paul Joannon (paulloz)
|
||||
Paul Trojahn (ptrojahn)
|
||||
Pāvels Nadtočajevs (bruvzg)
|
||||
Paweł Fertyk (pfertyk)
|
||||
Pawel Kowal (pkowal1982)
|
||||
Pawel Lampe (Scony)
|
||||
Pedro J. Estébanez (RandomShaper)
|
||||
Pieter-Jan Briers (PJB3005)
|
||||
Poommetee Ketson (Noshyaar)
|
||||
Przemysław Gołąb (n-pigeon)
|
||||
Rafael M. G. (rafallus)
|
||||
Rafał Mikrut (qarmin)
|
||||
Ralf Hölzemer (rollenrolm)
|
||||
Ramesh Ravone (RameshRavone)
|
||||
Raphael2048
|
||||
Raul Santos (raulsntos)
|
||||
Ray Koopa (RayKoopa)
|
||||
RedMser
|
||||
RedworkDE
|
||||
Rémi Verschelde (akien-mga)
|
||||
Rhody Lugo (rraallvv)
|
||||
Ricardo Buring (rburing)
|
||||
Ricardo Subtil (Ev1lbl0w)
|
||||
Riteo Siuga (Riteo)
|
||||
Roberto F. Arroyo (robfram)
|
||||
Robin Hübner (profan)
|
||||
romulox-x
|
||||
Rune Smith (rune-scape)
|
||||
Ruslan Mustakov (endragor)
|
||||
Ryan Roden-Corrent (rrcore)
|
||||
Saniko (sanikoyes)
|
||||
santouits
|
||||
SaracenOne
|
||||
Sergey Minakov (naithar)
|
||||
sersoong
|
||||
Shiqing (kawa-yoiko)
|
||||
Silc 'Tokage' Renew (TokageItLab)
|
||||
Simon Wenner (swenner)
|
||||
smix8
|
||||
snailrhymer
|
||||
Stijn Hinlopen (hinlopen)
|
||||
Swarnim Arun (minraws)
|
||||
TC (floppyhammer)
|
||||
TechnoPorg
|
||||
Thakee Nathees (ThakeeNathees)
|
||||
thebestnom
|
||||
Theo Hallenius (TheoXD)
|
||||
Timo Schwarzer (timoschwarzer)
|
||||
Timothé Bonhoure (ajreckof)
|
||||
Timo (toger5)
|
||||
Tomasz Chabora (KoBeWi)
|
||||
trollodel
|
||||
Twarit Waikar (IronicallySerious)
|
||||
Umang Kalra (theoway)
|
||||
Vinzenz Feenstra (vinzenz)
|
||||
Vitika Soni (Vitika9)
|
||||
박한얼 (volzhs)
|
||||
V. Vamsi Krishna (vkbsb)
|
||||
Wilhem Barbier (nounoursheureux)
|
||||
William Deurwaarder (williamd67)
|
||||
Will Nations (willnationsdev)
|
||||
Wilson E. Alvarez (Rubonnek)
|
||||
Xavier Cho (mysticfall)
|
||||
yg2f (SuperUserNameMan)
|
||||
Yuri Rubinsky (Chaosus)
|
||||
Yuri Sizov (YuriSizov)
|
||||
Zae Chao (zaevi)
|
||||
Zak Stam (zaksnet)
|
||||
Zher Huei Lee (leezh)
|
||||
ZuBsPaCe
|
||||
风青山 (Rindbee)
|
||||
3727
CHANGELOG.md
3727
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
190
CONTRIBUTING.md
190
CONTRIBUTING.md
@ -1,190 +0,0 @@
|
||||
# How to contribute efficiently
|
||||
|
||||
## Table of contents
|
||||
|
||||
- [Reporting bugs](#reporting-bugs)
|
||||
- [Proposing features or improvements](#proposing-features-or-improvements)
|
||||
- [Contributing pull requests](#contributing-pull-requests)
|
||||
- [Contributing to Godot's translation](#contributing-to-godots-translation)
|
||||
- [Communicating with developers](#communicating-with-developers)
|
||||
|
||||
## Reporting bugs
|
||||
|
||||
Report bugs [here](https://github.com/godotengine/godot/issues/new?assignees=&labels=&template=bug_report.yml).
|
||||
Please follow the instructions in the template when you do.
|
||||
|
||||
## Proposing features or improvements
|
||||
|
||||
**Since August 2019, the main issue tracker no longer accepts feature proposals.**
|
||||
Instead, head to the [Godot Proposals repository](https://github.com/godotengine/godot-proposals)
|
||||
and follow the instructions in the README file. High-quality feature proposals
|
||||
are more likely to be well-received by the maintainers and community, so do
|
||||
your best :)
|
||||
|
||||
See [this article](https://godotengine.org/article/introducing-godot-proposals-repository)
|
||||
for detailed rationale on this change.
|
||||
|
||||
## Contributing pull requests
|
||||
|
||||
If you want to add new engine features, please make sure that:
|
||||
|
||||
- This functionality is desired, which means that it solves a common use case
|
||||
that several users will need in their real-life projects.
|
||||
- You talked to other developers on how to implement it best. See also
|
||||
[Proposing features or improvements](#proposing-features-or-improvements).
|
||||
- Even if it doesn't get merged, your PR is useful for future work by another
|
||||
developer.
|
||||
|
||||
Similar rules can be applied when contributing bug fixes - it's always best to
|
||||
discuss the implementation in the bug report first if you are not 100% about
|
||||
what would be the best fix.
|
||||
|
||||
[This blog post](https://godotengine.org/article/will-your-contribution-be-merged-heres-how-tell)
|
||||
outlines the process used by core developers when assessing PRs. We strongly
|
||||
recommend that you have a look at it to know what's important to take into
|
||||
account for a PR to be considered for merging.
|
||||
|
||||
In addition to the following tips, also take a look at the
|
||||
[Engine development guide](https://docs.godotengine.org/en/latest/contributing/development/index.html)
|
||||
for an introduction to developing on Godot.
|
||||
|
||||
The [Contributing docs](https://docs.godotengine.org/en/latest/contributing/ways_to_contribute.html)
|
||||
also have important information on the [PR workflow](https://docs.godotengine.org/en/latest/contributing/workflow/pr_workflow.html)
|
||||
and the [code style](https://docs.godotengine.org/en/latest/contributing/development/code_style_guidelines.html) we use.
|
||||
|
||||
### Document your changes
|
||||
|
||||
If your pull request adds methods, properties or signals that are exposed to
|
||||
scripting APIs, you **must** update the class reference to document those.
|
||||
This is to ensure the documentation coverage doesn't decrease as contributions
|
||||
are merged.
|
||||
|
||||
[Update documentation XML files](https://docs.godotengine.org/en/latest/contributing/documentation/updating_the_class_reference.html#updating-class-reference-when-working-on-the-engine)
|
||||
using your compiled binary, then fill in the descriptions.
|
||||
Follow the style guide described in the
|
||||
[Writing guidelines](https://docs.godotengine.org/en/latest/contributing/documentation/docs_writing_guidelines.html).
|
||||
|
||||
If your pull request modifies parts of the code in a non-obvious way, make sure
|
||||
to add comments in the code as well. This helps other people understand the
|
||||
change without having to look at `git blame`.
|
||||
|
||||
### Write unit tests
|
||||
|
||||
When fixing a bug or contributing a new feature, we recommend including unit
|
||||
tests in the same commit as the rest of the pull request. Unit tests are pieces
|
||||
of code that compare the output to a predetermined *expected result* to detect
|
||||
regressions. Tests are compiled and run on GitHub Actions for every commit and
|
||||
pull request.
|
||||
|
||||
Pull requests that include tests are more likely to be merged, since we can have
|
||||
greater confidence in them not being the target of regressions in the future.
|
||||
|
||||
For bugs, the unit tests should cover the functionality that was previously
|
||||
broken. If done well, this ensures regressions won't appear in the future
|
||||
again. For new features, the unit tests should cover the newly added
|
||||
functionality, testing both the "success" and "expected failure" cases if
|
||||
applicable.
|
||||
|
||||
Feel free to contribute standalone pull requests to add new tests or improve
|
||||
existing tests as well.
|
||||
|
||||
See [Unit testing](https://docs.godotengine.org/en/latest/contributing/development/core_and_modules/unit_testing.html)
|
||||
for information on writing tests in Godot's C++ codebase.
|
||||
|
||||
### Be nice to the Git history
|
||||
|
||||
Try to make simple PRs that handle one specific topic. Just like for reporting
|
||||
issues, it's better to open 3 different PRs that each address a different issue
|
||||
than one big PR with three commits.
|
||||
|
||||
When updating your fork with upstream changes, please use ``git pull --rebase``
|
||||
to avoid creating "merge commits". Those commits unnecessarily pollute the git
|
||||
history when coming from PRs.
|
||||
|
||||
Also try to make commits that bring the engine from one stable state to another
|
||||
stable state, i.e. if your first commit has a bug that you fixed in the second
|
||||
commit, try to merge them together before making your pull request (see ``git
|
||||
rebase -i`` and relevant help about rebasing or amending commits on the
|
||||
Internet).
|
||||
|
||||
This [Git style guide](https://github.com/agis-/git-style-guide) has some
|
||||
good practices to have in mind.
|
||||
|
||||
See our [PR workflow](https://docs.godotengine.org/en/latest/contributing/workflow/pr_workflow.html)
|
||||
documentation for tips on using Git, amending commits and rebasing branches.
|
||||
|
||||
### Format your commit messages with readability in mind
|
||||
|
||||
The way you format your commit messages is quite important to ensure that the
|
||||
commit history and changelog will be easy to read and understand. A Git commit
|
||||
message is formatted as a short title (first line) and an extended description
|
||||
(everything after the first line and an empty separation line).
|
||||
|
||||
The short title is the most important part, as it is what will appear in the
|
||||
`shortlog` changelog (one line per commit, so no description shown) or in the
|
||||
GitHub interface unless you click the "expand" button. As the name says, try to
|
||||
keep that first line under 72 characters. It should describe what the commit
|
||||
does globally, while details would go in the description. Typically, if you
|
||||
can't keep the title short because you have too much stuff to mention, it means
|
||||
you should probably split your changes in several commits :)
|
||||
|
||||
Here's an example of a well-formatted commit message (note how the extended
|
||||
description is also manually wrapped at 80 chars for readability):
|
||||
|
||||
```text
|
||||
Prevent French fries carbonization by fixing heat regulation
|
||||
|
||||
When using the French fries frying module, Godot would not regulate the heat
|
||||
and thus bring the oil bath to supercritical liquid conditions, thus causing
|
||||
unwanted side effects in the physics engine.
|
||||
|
||||
By fixing the regulation system via an added binding to the internal feature,
|
||||
this commit now ensures that Godot will not go past the ebullition temperature
|
||||
of cooking oil under normal atmospheric conditions.
|
||||
|
||||
Fixes #1789, long live the Realm!
|
||||
```
|
||||
|
||||
**Note:** When using the GitHub online editor or its drag-and-drop
|
||||
feature, *please* edit the commit title to something meaningful. Commits named
|
||||
"Update my_file.cpp" won't be accepted.
|
||||
|
||||
## Contributing to Godot's translation
|
||||
|
||||
You can contribute to Godot's translation from the [Hosted
|
||||
Weblate](https://hosted.weblate.org/projects/godot-engine/godot), an open
|
||||
source and web-based translation platform. Please refer to the [translation
|
||||
readme](editor/translations/README.md) for more information.
|
||||
|
||||
You can also help translate [Godot's
|
||||
documentation](https://hosted.weblate.org/projects/godot-engine/godot-docs/)
|
||||
on Weblate.
|
||||
|
||||
## Communicating with developers
|
||||
|
||||
The Godot Engine community has [many communication
|
||||
channels](https://godotengine.org/community), some used more for user-level
|
||||
discussions and support, others more for development discussions.
|
||||
|
||||
To communicate with developers (e.g. to discuss a feature you want to implement
|
||||
or a bug you want to fix), the following channels can be used:
|
||||
|
||||
- [Godot Contributors Chat](https://chat.godotengine.org): You will
|
||||
find most core developers there, so it's the go-to platform for direct chat
|
||||
about Godot Engine development. Feel free to start discussing something there
|
||||
to get some early feedback before writing up a detailed proposal in a GitHub
|
||||
issue.
|
||||
- [Bug tracker](https://github.com/godotengine/godot/issues): If there is an
|
||||
existing issue about a topic you want to discuss, just add a comment to it -
|
||||
many developers watch the repository and will get a notification. You can
|
||||
also create a new issue - please keep in mind to create issues only to
|
||||
discuss quite specific points about the development, and not general user
|
||||
feedback or support requests.
|
||||
- [Feature proposals](https://github.com/godotengine/godot-proposals/issues):
|
||||
To propose a new feature, we have a dedicated issue tracker for that. Don't
|
||||
hesitate to start by talking about your idea on the Godot Contributors Chat
|
||||
to make sure that it makes sense in Godot's context.
|
||||
|
||||
Thanks for your interest in contributing!
|
||||
|
||||
—The Godot development team
|
||||
1955
COPYRIGHT.txt
1955
COPYRIGHT.txt
File diff suppressed because it is too large
Load Diff
716
DONORS.md
716
DONORS.md
@ -1,716 +0,0 @@
|
||||
# Donors to the Godot Engine project
|
||||
|
||||
Godot Engine is a non-profit project developed by a community of voluntary
|
||||
contributors, as well as occasional paid contributors thanks to the financial
|
||||
support of generous donors.
|
||||
|
||||
The ways to donate to the project, as well as details on how the funds are
|
||||
used, are described on [Godot's website](https://godotengine.org/donate).
|
||||
|
||||
The following is a list of the current monthly donors, who will have their
|
||||
generous deed immortalized in the next stable release of Godot Engine.
|
||||
|
||||
## Platinum sponsors
|
||||
|
||||
Gamblify <https://www.gamblify.com>
|
||||
Heroic Labs <https://heroiclabs.com>
|
||||
Spiffcode <http://spiffcode.com>
|
||||
|
||||
## Gold sponsors
|
||||
|
||||
None currently, become one! <https://godotengine.org/donate>
|
||||
|
||||
## Silver sponsors
|
||||
|
||||
Affray Interactive <https://scp.games/pandemic>
|
||||
Delton Ding
|
||||
Playful Studios <https://playfulstudios.com>
|
||||
Robot Gentleman <http://robotgentleman.com>
|
||||
|
||||
## Bronze sponsors
|
||||
|
||||
Basically Games
|
||||
Bippinbits <https://bippinbits.com>
|
||||
Brandon Lamb
|
||||
Bri
|
||||
Garry Newman
|
||||
Isaiah smith
|
||||
Jb Evain
|
||||
Keepsake Games <https://keepsake.games>
|
||||
Kenney <https://kenney.nl>
|
||||
Kitcat490
|
||||
Kyle Szklenski
|
||||
Matthew Campbell
|
||||
Maxim Karsten
|
||||
Nik Rudenko
|
||||
TrampolineTales <https://trampolinetales.com>
|
||||
|
||||
## Mini sponsors
|
||||
|
||||
AD Ford
|
||||
Albin Lundahl
|
||||
Andres Hernandez
|
||||
Andrew Dunai
|
||||
anti666
|
||||
Christopher Shifflett
|
||||
Christoph Woinke
|
||||
Daniel Edwards
|
||||
Darrin Massena
|
||||
David Mydlarz
|
||||
Edward Flick
|
||||
Hein-Pieter van Braam
|
||||
Jonah Stich
|
||||
Justin Arnold
|
||||
Justin McGettigan
|
||||
Justo Delgado Baudí
|
||||
Kossi Selom Banybah
|
||||
Lloyd Bond
|
||||
Marek Belski
|
||||
Markus Ort
|
||||
Michael
|
||||
Mike King
|
||||
Nassor Paulino da Silva
|
||||
nate-wilkins
|
||||
Neal Gompa (Conan Kudo)
|
||||
Nick Macholl
|
||||
Patrick Horn
|
||||
Rami
|
||||
Ronnie Cheng
|
||||
Ryan Heath
|
||||
Samantha
|
||||
ShikadiGum
|
||||
Slobodan Milnovic
|
||||
Stephan Lanfermann
|
||||
Tim Yuen
|
||||
Violin Iliev
|
||||
Vladimír Chvátil
|
||||
|
||||
## Gold donors
|
||||
|
||||
Adam Brown
|
||||
albinaask
|
||||
Allen Pestaluky
|
||||
Asher Glick
|
||||
Barugon
|
||||
Benito
|
||||
Carlo Cabanilla
|
||||
Daniel James
|
||||
David Fedorchak
|
||||
David Gehrig
|
||||
David Hubber
|
||||
David Snopek
|
||||
Dima Paloskin
|
||||
Ed Morley
|
||||
Guilherme de Oliveira
|
||||
Guy Kay Jay
|
||||
Javier Roman
|
||||
Jonathan Wright
|
||||
Jon Woodward
|
||||
Karl Werf
|
||||
Klavdij Voncina
|
||||
Manuele Finocchiaro
|
||||
Markus Wiesner
|
||||
Mateo Navarrete
|
||||
Matthew Hillier
|
||||
Officine Pixel S.n.c.
|
||||
Pedro Silva
|
||||
Sarksus
|
||||
Sean
|
||||
Sofox
|
||||
Stephan Kessler
|
||||
Tom Langwaldt
|
||||
tukon
|
||||
|
||||
␣
|
||||
Acheron
|
||||
AdamRatai
|
||||
Alexander Erlemann
|
||||
Alexandre VALIN
|
||||
Alexej Kowalew
|
||||
Alex Khayrullin
|
||||
Algebrute
|
||||
alice gambrell
|
||||
Alo Mis
|
||||
Andriy
|
||||
Antanas Paskauskas
|
||||
Ari
|
||||
Arisaka Mayuki
|
||||
Arthur S. Muszynski
|
||||
BasicIncomePlz
|
||||
Brandon Hawkinson
|
||||
BrizzleBrip
|
||||
c64cosmin
|
||||
Cameron Connolly
|
||||
Carlo del Mundo
|
||||
Charlie Whitfield
|
||||
Chris Petrich
|
||||
Chris Serino
|
||||
Craig Ostrin
|
||||
Craig Scarborough
|
||||
Craig Smith
|
||||
CzechBlueBear
|
||||
Daniel Eichler
|
||||
Daniel Grice
|
||||
Daniel Reed
|
||||
Daniel Tebbutt
|
||||
Dennis Belfrage
|
||||
Donn Eddy
|
||||
Emily A. Bellows
|
||||
Eric Brand
|
||||
Eugenio Hugo Salgüero Jáñez
|
||||
Felix Winterhalter
|
||||
Florencio Olsen
|
||||
Fransiska
|
||||
Furroy
|
||||
Gabrielius Vaiškūnas
|
||||
Gary Hulst
|
||||
Geoffroy Warin
|
||||
George Venizelos
|
||||
GlassBrick
|
||||
GrayDwarf
|
||||
Guilherme Felipe de C. G. da Silva
|
||||
Guillaume Pham Ngoc
|
||||
Harry Tumber
|
||||
Harvey Fong
|
||||
Horváth-Lázár Péter
|
||||
illuxxium
|
||||
Jamal Bencharki
|
||||
James Couzens
|
||||
Jared White
|
||||
Jason Yundt
|
||||
Jesús Chicharro
|
||||
Jihun Moon
|
||||
Joel Fivat
|
||||
Johnathan Kupferer
|
||||
Josef Stumpfegger
|
||||
Joshua Lesperance
|
||||
Judd
|
||||
Julian Todd
|
||||
JUSTIN CARROLL
|
||||
Kelson Ball
|
||||
Kelteseth
|
||||
Khora
|
||||
kickmaniac
|
||||
kinfox
|
||||
leetNightshade
|
||||
Liam Smyth
|
||||
LoparPanda
|
||||
Lucaaa
|
||||
Luca Vazzano
|
||||
LyaaaaaGames
|
||||
Marcus Dobler
|
||||
Marcus Richter
|
||||
Mark Barrett
|
||||
Martin Eigel
|
||||
Martin Gulliksson
|
||||
Martin Kotz
|
||||
Martin Soucek
|
||||
Matt Greene
|
||||
Matthew Dana
|
||||
Matthieu Huvé
|
||||
Michael Dürwald
|
||||
Michael Policastro
|
||||
MikadoSC
|
||||
n00sh
|
||||
nate etan
|
||||
Nicola Cocchiaro
|
||||
Nicolás Monner Sans
|
||||
Nikita Blizniuk
|
||||
Nikita Rotskov
|
||||
Nikola Whallon
|
||||
Oliver Dick
|
||||
Otis Clark
|
||||
Patrick Wuttke
|
||||
Paul Hocker
|
||||
Pete Goodwin
|
||||
Petr Malac
|
||||
Petrus Prinsloo
|
||||
Philip Woods
|
||||
Rebekah Farr
|
||||
red1939
|
||||
Reilt
|
||||
Rene Tailleur
|
||||
Rickard Hermanson
|
||||
Rob
|
||||
Rob McInroy
|
||||
RodZilla
|
||||
Ronan Zeegers
|
||||
Ronnie Ashlock
|
||||
Ronny Mühle
|
||||
Ryan Breaker
|
||||
"Sage Automatic Systems, LLC"
|
||||
Samuel Hummerstone
|
||||
Samuel Judd
|
||||
schroedinger's possum
|
||||
Shishir Tandale
|
||||
SKison
|
||||
Song Junwoo
|
||||
spacechase0
|
||||
SpicyCactuar
|
||||
Steven Landow
|
||||
Stoned Xander
|
||||
sus
|
||||
Talii
|
||||
Teslatech
|
||||
Thomas Bjarnelöf
|
||||
Thomas Kurz
|
||||
Tim Nedvyga
|
||||
Tobias Bocanegra
|
||||
Tobias Raggl
|
||||
Torbulous
|
||||
toto bibi
|
||||
Troy Kinsella
|
||||
Turntsnaco
|
||||
UltyX
|
||||
Valryia
|
||||
VeryProfessionalDodo
|
||||
VoidPointer
|
||||
whatever
|
||||
Winston
|
||||
Yifan Lai
|
||||
Yuancheng Zhang
|
||||
zkip lan
|
||||
|
||||
## Silver donors
|
||||
|
||||
Aaron Adriano
|
||||
Aaron Mayfield
|
||||
Aaron Oldenburg
|
||||
Adam Brunnmeier
|
||||
Adam Carr
|
||||
Adam N Webber
|
||||
Adam Smeltzer
|
||||
Adinimys
|
||||
Adisibio
|
||||
Adriano Orioli
|
||||
Adrien de Pierres
|
||||
Agustinus Arya
|
||||
Aidan O'Flannagain
|
||||
Aiguo Wang
|
||||
ajaxcc
|
||||
Aki Mimoto
|
||||
Alan Beauchamp
|
||||
Alberto Salazar Muñoz
|
||||
Alberto Vilches
|
||||
Alder Stefano
|
||||
Alejandro Saucedo
|
||||
AleMax
|
||||
Alex Clavelle
|
||||
Alex de la Mare
|
||||
alex raeside
|
||||
Allan Davis
|
||||
Andre Altmueller
|
||||
Andrei Pufu
|
||||
Andre Stackhouse
|
||||
Andrew
|
||||
Andrew Groot
|
||||
andrew james morris
|
||||
Andy Baird
|
||||
Ano Nim
|
||||
Anthony Avina
|
||||
Anton Bouwer
|
||||
Arch Toasty
|
||||
Arda Erol
|
||||
Arthur Brainville
|
||||
Arturo Rosales
|
||||
Ash K
|
||||
Aubrey Falconer
|
||||
aurelien condomines
|
||||
Austin Miller
|
||||
Azar Gurbanov
|
||||
AzulCrescent
|
||||
Balázs Batári
|
||||
Beau Seymour
|
||||
Benedikt
|
||||
Ben Vercammen
|
||||
Ben Visness
|
||||
Bill Thibault
|
||||
bitbrain
|
||||
Bjarne Voigtländer
|
||||
Brady Goldsworthy
|
||||
Bram
|
||||
Brian
|
||||
Brian Ford
|
||||
Brigham Keys
|
||||
Burney Waring
|
||||
Caleb Makela
|
||||
Caliburn
|
||||
Cameron Meyer
|
||||
Carlos Rios
|
||||
Carl van der Geest
|
||||
Cesar Ruiz
|
||||
Chad Steadman
|
||||
Checkpoint Charlie
|
||||
chendrak
|
||||
Chris Cavalluzzi
|
||||
Chris Jagusch
|
||||
Chris Langford
|
||||
Chris Ridenour
|
||||
Christer Stenbrenden
|
||||
Christian Alexander Bjørklund Bøhler
|
||||
Christian Kaltenecker
|
||||
Christian Mauduit
|
||||
Christian Winter
|
||||
Christoph Czurda
|
||||
Christophe Gagnier
|
||||
Ciyvius
|
||||
Codex404
|
||||
Cody Parker
|
||||
Conall O
|
||||
Corchari
|
||||
Corey W
|
||||
Craig Post
|
||||
CrispyPin
|
||||
cynwav
|
||||
Dakota Watkins
|
||||
Daniel Hoffmann
|
||||
Danielle
|
||||
Daniel Ramos
|
||||
Dare Looks
|
||||
Daren Scot Wilson
|
||||
Dave Jansen
|
||||
Davesnothere
|
||||
David Baker
|
||||
David Bôle
|
||||
David May
|
||||
David Maziarka
|
||||
Devin Carraway
|
||||
Devin R
|
||||
Dimitri Roche
|
||||
Dominik Wetzel
|
||||
Donovan Hutcheon
|
||||
Doug Walker
|
||||
Dragontrapper
|
||||
dragoon
|
||||
Dr Ewan Murray
|
||||
Ducky
|
||||
Duobix
|
||||
Duodecimal
|
||||
Eduardo Teixeira
|
||||
Edward Swartz
|
||||
Egon Elbre
|
||||
Elgenzay
|
||||
Elijah Anderson
|
||||
Emerson MX
|
||||
Ends
|
||||
Ephemeral
|
||||
Eric Stokes
|
||||
Eric Williams
|
||||
Erkki Seppälä
|
||||
Ewan Holmes
|
||||
Faisal Alkubaisi
|
||||
fby
|
||||
Felix Adam
|
||||
Fer DC
|
||||
Filip Lundby
|
||||
Frank
|
||||
Frank Kurka
|
||||
Frying☆Pan
|
||||
Game Endeavor
|
||||
Garrett Steffen
|
||||
Gary Thomas
|
||||
gebba
|
||||
George Marques
|
||||
Green Fox
|
||||
Greg Burkland
|
||||
Gregory Campbell
|
||||
Greyson Richey
|
||||
Grid
|
||||
Grominet
|
||||
Guldoman
|
||||
Guo Hongci
|
||||
Hans Jorgensen
|
||||
Haplo
|
||||
Helge Maus
|
||||
Helianthus Games
|
||||
Heribert Hirth
|
||||
Ian Richard Kunert
|
||||
Ian Williams
|
||||
Interstice
|
||||
itsybitesyspider
|
||||
iveks
|
||||
Jacob D
|
||||
Jaguar
|
||||
Jako Danar
|
||||
James Gary
|
||||
James Thomas
|
||||
Jamie Massey
|
||||
JARKKO PARVIAINEN
|
||||
Jason Evans
|
||||
Jason Uechi
|
||||
Jeff Hungerford
|
||||
Jeffrey Berube
|
||||
Jennifer Graves
|
||||
Jesse Dubay
|
||||
João Pedro Braz
|
||||
John Barlex
|
||||
John Bruce
|
||||
John Palgut
|
||||
Jonas
|
||||
Jonas Arndt
|
||||
Jonas Bernemann
|
||||
Jonas LHOSTE
|
||||
Jonas Rudlang
|
||||
Jonas Yamazaki
|
||||
Jonathan Bieber
|
||||
Jonathan Ellis
|
||||
Jonathan G
|
||||
Jon Sully
|
||||
Jordy Goodridge
|
||||
Joseph Catrambone
|
||||
Josh Segall
|
||||
Josh Taylor
|
||||
Joshua Heidrich
|
||||
Jozef Krcho
|
||||
Juanfran
|
||||
Juan Maggi
|
||||
Juan Uys
|
||||
Jueast
|
||||
Julian le Roux
|
||||
Julien Kaspar
|
||||
Justin Hamilton
|
||||
Justin Spedding
|
||||
J Vetulani
|
||||
Kalydi Balázs
|
||||
Katsuomi Kobayashi
|
||||
Keedong Park
|
||||
Keegan Scott
|
||||
Keith Bradner
|
||||
Ken Minardo
|
||||
Kent Jofur
|
||||
killaQueen
|
||||
kindzadza
|
||||
Kodera Software
|
||||
Kostas Mouratidis
|
||||
Krishna Nadoor
|
||||
KsyTek Games
|
||||
kycho
|
||||
Kyle Burnett
|
||||
Kyle Jacobs
|
||||
Lasse le Dous
|
||||
Laurent Dethoor
|
||||
Laxman Pradhan
|
||||
Lech Rozanski
|
||||
Leland Vakarian
|
||||
Leonardo Baumle
|
||||
Levi Berciu
|
||||
Levi Lindsey
|
||||
Linus Lind Lundgren
|
||||
Logan Apple
|
||||
Logan Bratton
|
||||
Lonnie Cox
|
||||
Ludovic DELVAL
|
||||
Luigi Renna
|
||||
Luis Ernesto Del Toro Peña
|
||||
Luis Gaemperle
|
||||
Luis Morao
|
||||
Lukas Komischke
|
||||
Luke Diasio
|
||||
Luke Kasz
|
||||
Major Haul
|
||||
Malcolm
|
||||
Mara Huldra
|
||||
Marcell Simon
|
||||
Marcos Heitor Carvalho
|
||||
Markie Music
|
||||
Mark Tyler
|
||||
Markus Martin
|
||||
Markus Michael Egger
|
||||
Markus Strompen
|
||||
Martin Fitzke
|
||||
Martin Holas
|
||||
Martin Linklater
|
||||
Martin Liška
|
||||
Martin Trbola
|
||||
Martin Zabinski
|
||||
Matěj Drábek
|
||||
Matt Edwards
|
||||
Matthew
|
||||
Matthew Booe
|
||||
Maverick
|
||||
Maxime Blade
|
||||
Maxwell
|
||||
McStuffings
|
||||
Melissa Mears
|
||||
Metal Demon 2000
|
||||
Michael
|
||||
Michael Morrison
|
||||
Michal Skwarek
|
||||
Mikael Nordenberg
|
||||
Mikail Freitas
|
||||
Mikayla
|
||||
Mike Copley
|
||||
Mike McRoberts
|
||||
Mitchell J. Wagner
|
||||
MJacred
|
||||
ModularMind
|
||||
Molinghu
|
||||
Molly Jameson
|
||||
MoltenGears
|
||||
Moritz Weissenberger
|
||||
MrAZIE
|
||||
Mrjemandem
|
||||
Nathaniel
|
||||
neguse
|
||||
neighty
|
||||
Neil Blakey-Milner
|
||||
Neofytos Chimonas
|
||||
Nerdforge
|
||||
Nerdyninja
|
||||
Nicholas La Roux
|
||||
Nick Eldrenkamp
|
||||
Nicolas Rosset
|
||||
Nicolò Brigadoi Calamari
|
||||
Nils Nordmark
|
||||
Noel Billig
|
||||
Noesis
|
||||
obscuresteel
|
||||
Okatima
|
||||
Oleg Reva
|
||||
Olexa Tourko
|
||||
Oliver Ambrose
|
||||
oscar1000108
|
||||
Oscar Domingo
|
||||
Parth Patel
|
||||
Patrick Indermühle
|
||||
Patrickm
|
||||
Patrick Nafarrete
|
||||
Paul Black
|
||||
Paul Gieske
|
||||
Paul Hankins
|
||||
Paul Mozet
|
||||
Paweł Kowal
|
||||
Paweł Łyczkowski
|
||||
Pedro Henrique Martins Garcia
|
||||
Philip Ludington (MrPhil)
|
||||
Phoenix Jauregui
|
||||
Pierre Caye
|
||||
Pixel Archipel
|
||||
pj
|
||||
Point08
|
||||
Portponky
|
||||
Preethi Vaidyanathan
|
||||
PsycHead
|
||||
PsyCrab
|
||||
Puntigames
|
||||
pwab
|
||||
Quincy Quincy
|
||||
Quinn Morrison
|
||||
Rafa Laguna
|
||||
RagingRoosevelt
|
||||
Ragnar Pettersson
|
||||
Rainer Amler
|
||||
Rammeow
|
||||
Rebecca H
|
||||
Relintai
|
||||
Remi Rampin
|
||||
Reneator
|
||||
Richard Hayes
|
||||
Richard Ivánek
|
||||
Riley
|
||||
Robin Ward
|
||||
RobotCritter
|
||||
Rob Ruana
|
||||
Rodrigo Loli
|
||||
Roger Smith
|
||||
Roglozor
|
||||
Roka
|
||||
Roland Rząsa
|
||||
Roman Papush
|
||||
Roy Scayged
|
||||
Russ
|
||||
Russell Matney
|
||||
Ryan Groom
|
||||
Sacha Waked (Shaidak)
|
||||
Sammy Fischer
|
||||
Sangeeth Pavithran
|
||||
Sasha Schwartz
|
||||
Sebastian Michailidis
|
||||
Sekuta
|
||||
SeongWan Kim
|
||||
Sessamekesh
|
||||
SeungJong k
|
||||
Shane Lillie
|
||||
Shane Spoor
|
||||
Shaun Kohanowski
|
||||
simdee
|
||||
Simon Jonas Larsen
|
||||
Simon Schoenenberger
|
||||
Sina Yeganeh
|
||||
sirn
|
||||
Skalli
|
||||
slavfox
|
||||
SleepDepJoel1
|
||||
smbe19
|
||||
smo1704
|
||||
Solene Waked
|
||||
Sophie Winter
|
||||
Squidgy
|
||||
Squirrel
|
||||
SSebigo
|
||||
Stephen Rice
|
||||
Stephen Schlie
|
||||
summerblind
|
||||
Sung soo Choi
|
||||
SxP
|
||||
tadashi endo
|
||||
Tarch
|
||||
Terry
|
||||
TheVoiceInMyHead
|
||||
Thibaut DECROMBECQUE
|
||||
thomas
|
||||
Thomas Bechtold
|
||||
Thomas Detoy
|
||||
Thomas Pickett
|
||||
thommy
|
||||
Till1805
|
||||
Tim Drumheller
|
||||
Tim Erskine
|
||||
Tim Gleason
|
||||
Tim Klein
|
||||
Timothy B. MacDonald
|
||||
Tim Raveling
|
||||
Tim Riley
|
||||
Toadile
|
||||
Tom Coxon
|
||||
Tom Webster
|
||||
Torsten Crass
|
||||
Trent Skinner
|
||||
tril zerobyte
|
||||
Tryggve Sollid
|
||||
Turgut Temucin
|
||||
Tycho
|
||||
Tyler Stafos
|
||||
Tyler Stepke
|
||||
Ukko K.
|
||||
Uther
|
||||
v01tech
|
||||
Vaida
|
||||
Vaughan Ling
|
||||
Vavin.X
|
||||
Vincent Barkmann
|
||||
Vincent Cloutier
|
||||
Vincent Foulon
|
||||
Vulinux
|
||||
Wapiti .
|
||||
Wiley Thompson
|
||||
William Bodin
|
||||
William Edwards
|
||||
William F Siqueira
|
||||
Wolfram
|
||||
Woonki Moon
|
||||
Xananax
|
||||
Yan Shi
|
||||
yin
|
||||
Zekim
|
||||
Zher Huei Lee
|
||||
Zoee Silcock
|
||||
Zyphery
|
||||
ケルベロス
|
||||
貴宏 小松
|
||||
郝晨煜
|
||||
|
||||
## Bronze donors
|
||||
|
||||
There are even more donors that support the project with a small monthly donation.
|
||||
Every bit counts and we thank every one of them for their amazing support!
|
||||
@ -20,7 +20,7 @@
|
||||
# This tag specifies the encoding used for all characters in the config file
|
||||
# that follow. The default is UTF-8 which is also the encoding used for all text
|
||||
# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
|
||||
# built into libc) for the transcoding. See https://www.gnu.org/software/libiconv
|
||||
# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
|
||||
# for the list of possible encodings.
|
||||
# The default value is: UTF-8.
|
||||
|
||||
@ -38,7 +38,7 @@ PROJECT_NAME = Godot
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER =
|
||||
PROJECT_NUMBER =
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
@ -51,14 +51,14 @@ PROJECT_BRIEF = "Game Engine MIT"
|
||||
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
|
||||
# the logo to the output directory.
|
||||
|
||||
PROJECT_LOGO = ../logo.png
|
||||
PROJECT_LOGO = E:/development/godot/logo_small.png
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
|
||||
# into which the generated documentation will be written. If a relative path is
|
||||
# entered, it will be relative to the location where doxygen was started. If
|
||||
# left blank the current directory will be used.
|
||||
|
||||
OUTPUT_DIRECTORY = ./_build/doxygen/
|
||||
OUTPUT_DIRECTORY = E:/development/godot/doxygen
|
||||
|
||||
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
|
||||
# directories (in 2 levels) under the output directory of each output format and
|
||||
@ -162,7 +162,7 @@ FULL_PATH_NAMES = YES
|
||||
# will be relative from the directory where doxygen is started.
|
||||
# This tag requires that the tag FULL_PATH_NAMES is set to YES.
|
||||
|
||||
STRIP_FROM_PATH =
|
||||
STRIP_FROM_PATH =
|
||||
|
||||
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
|
||||
# path mentioned in the documentation of a class, which tells the reader which
|
||||
@ -171,7 +171,7 @@ STRIP_FROM_PATH =
|
||||
# specify the list of include paths that are normally passed to the compiler
|
||||
# using the -I flag.
|
||||
|
||||
STRIP_FROM_INC_PATH =
|
||||
STRIP_FROM_INC_PATH =
|
||||
|
||||
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
|
||||
# less readable) file names. This can be useful is your file systems doesn't
|
||||
@ -238,13 +238,13 @@ TAB_SIZE = 4
|
||||
# "Side Effects:". You can put \n's in the value part of an alias to insert
|
||||
# newlines.
|
||||
|
||||
ALIASES =
|
||||
ALIASES =
|
||||
|
||||
# This tag can be used to specify a number of word-keyword mappings (TCL only).
|
||||
# A mapping has the form "name=value". For example adding "class=itcl::class"
|
||||
# will allow you to use the command class in the itcl::class meaning.
|
||||
|
||||
TCL_SUBST =
|
||||
TCL_SUBST =
|
||||
|
||||
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
|
||||
# only. Doxygen will then generate output that is more tailored for C. For
|
||||
@ -291,11 +291,11 @@ OPTIMIZE_OUTPUT_VHDL = NO
|
||||
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
|
||||
# the files are not read by doxygen.
|
||||
|
||||
EXTENSION_MAPPING =
|
||||
EXTENSION_MAPPING =
|
||||
|
||||
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
|
||||
# according to the Markdown format, which allows for more readable
|
||||
# documentation. See https://daringfireball.net/projects/markdown/ for details.
|
||||
# documentation. See http://daringfireball.net/projects/markdown/ for details.
|
||||
# The output of markdown processing is further processed by doxygen, so you can
|
||||
# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
|
||||
# case of backward compatibilities issues.
|
||||
@ -632,7 +632,7 @@ GENERATE_DEPRECATEDLIST= YES
|
||||
# sections, marked by \if <section_label> ... \endif and \cond <section_label>
|
||||
# ... \endcond blocks.
|
||||
|
||||
ENABLED_SECTIONS =
|
||||
ENABLED_SECTIONS =
|
||||
|
||||
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
|
||||
# initial value of a variable or macro / define can have for it to appear in the
|
||||
@ -674,7 +674,7 @@ SHOW_NAMESPACES = YES
|
||||
# by doxygen. Whatever the program writes to standard output is used as the file
|
||||
# version. For an example see the documentation.
|
||||
|
||||
FILE_VERSION_FILTER =
|
||||
FILE_VERSION_FILTER =
|
||||
|
||||
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
|
||||
# by doxygen. The layout file controls the global structure of the generated
|
||||
@ -687,17 +687,17 @@ FILE_VERSION_FILTER =
|
||||
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
|
||||
# tag is left empty.
|
||||
|
||||
LAYOUT_FILE =
|
||||
LAYOUT_FILE =
|
||||
|
||||
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
|
||||
# the reference definitions. This must be a list of .bib files. The .bib
|
||||
# extension is automatically appended if omitted. This requires the bibtex tool
|
||||
# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info.
|
||||
# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
|
||||
# For LaTeX the style of the bibliography can be controlled using
|
||||
# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
|
||||
# search path. See also \cite for info how to create references.
|
||||
|
||||
CITE_BIB_FILES =
|
||||
CITE_BIB_FILES =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to warning and progress messages
|
||||
@ -756,7 +756,7 @@ WARN_FORMAT = "$file:$line: $text"
|
||||
# messages should be written. If left blank the output is written to standard
|
||||
# error (stderr).
|
||||
|
||||
WARN_LOGFILE =
|
||||
WARN_LOGFILE =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the input files
|
||||
@ -768,12 +768,12 @@ WARN_LOGFILE =
|
||||
# spaces.
|
||||
# Note: If this tag is empty the current directory is searched.
|
||||
|
||||
INPUT = ../core/ ../main/ ../scene/
|
||||
INPUT = E:/development/godot
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||
# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
|
||||
# documentation (see: https://www.gnu.org/software/libiconv) for the list of
|
||||
# documentation (see: http://www.gnu.org/software/libiconv) for the list of
|
||||
# possible encodings.
|
||||
# The default value is: UTF-8.
|
||||
|
||||
@ -844,7 +844,7 @@ RECURSIVE = YES
|
||||
# Note that relative paths are relative to the directory from which doxygen is
|
||||
# run.
|
||||
|
||||
EXCLUDE =
|
||||
EXCLUDE =
|
||||
|
||||
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
|
||||
# directories that are symbolic links (a Unix file system feature) are excluded
|
||||
@ -860,7 +860,7 @@ EXCLUDE_SYMLINKS = NO
|
||||
# Note that the wildcards are matched against the file with absolute path, so to
|
||||
# exclude all test directories for example use the pattern */test/*
|
||||
|
||||
EXCLUDE_PATTERNS =
|
||||
EXCLUDE_PATTERNS =
|
||||
|
||||
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
|
||||
# (namespaces, classes, functions, etc.) that should be excluded from the
|
||||
@ -871,13 +871,13 @@ EXCLUDE_PATTERNS =
|
||||
# Note that the wildcards are matched against the file with absolute path, so to
|
||||
# exclude all test directories use the pattern */test/*
|
||||
|
||||
EXCLUDE_SYMBOLS =
|
||||
EXCLUDE_SYMBOLS =
|
||||
|
||||
# The EXAMPLE_PATH tag can be used to specify one or more files or directories
|
||||
# that contain example code fragments that are included (see the \include
|
||||
# command).
|
||||
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATH =
|
||||
|
||||
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
|
||||
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
|
||||
@ -897,7 +897,7 @@ EXAMPLE_RECURSIVE = NO
|
||||
# that contain images that are to be included in the documentation (see the
|
||||
# \image command).
|
||||
|
||||
IMAGE_PATH =
|
||||
IMAGE_PATH =
|
||||
|
||||
# The INPUT_FILTER tag can be used to specify a program that doxygen should
|
||||
# invoke to filter for each input file. Doxygen will invoke the filter program
|
||||
@ -914,7 +914,7 @@ IMAGE_PATH =
|
||||
# code is scanned, but not when the output code is generated. If lines are added
|
||||
# or removed, the anchors will not be placed correctly.
|
||||
|
||||
INPUT_FILTER =
|
||||
INPUT_FILTER =
|
||||
|
||||
# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
|
||||
# basis. Doxygen will compare the file name with each pattern and apply the
|
||||
@ -923,7 +923,7 @@ INPUT_FILTER =
|
||||
# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
|
||||
# patterns match the file name, INPUT_FILTER is applied.
|
||||
|
||||
FILTER_PATTERNS =
|
||||
FILTER_PATTERNS =
|
||||
|
||||
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
|
||||
# INPUT_FILTER) will also be used to filter the input files that are used for
|
||||
@ -938,7 +938,7 @@ FILTER_SOURCE_FILES = NO
|
||||
# *.ext= (so without naming a filter).
|
||||
# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
|
||||
|
||||
FILTER_SOURCE_PATTERNS =
|
||||
FILTER_SOURCE_PATTERNS =
|
||||
|
||||
# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
|
||||
# is part of the input, its contents will be placed on the main page
|
||||
@ -1006,7 +1006,7 @@ SOURCE_TOOLTIPS = YES
|
||||
# If the USE_HTAGS tag is set to YES then the references to source code will
|
||||
# point to the HTML generated by the htags(1) tool instead of doxygen built-in
|
||||
# source browser. The htags tool is part of GNU's global source tagging system
|
||||
# (see https://www.gnu.org/software/global/global.html). You will need version
|
||||
# (see http://www.gnu.org/software/global/global.html). You will need version
|
||||
# 4.8.6 or higher.
|
||||
#
|
||||
# To use it do the following:
|
||||
@ -1034,7 +1034,7 @@ USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
|
||||
# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
|
||||
# clang parser (see: https://clang.llvm.org/) for more accurate parsing at the
|
||||
# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
|
||||
# cost of reduced performance. This can be particularly helpful with template
|
||||
# rich C++ code for which doxygen's built-in parser lacks the necessary type
|
||||
# information.
|
||||
@ -1050,7 +1050,7 @@ CLANG_ASSISTED_PARSING = NO
|
||||
# specified with INPUT and INCLUDE_PATH.
|
||||
# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
|
||||
|
||||
CLANG_OPTIONS =
|
||||
CLANG_OPTIONS =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the alphabetical class index
|
||||
@ -1076,7 +1076,7 @@ COLS_IN_ALPHA_INDEX = 5
|
||||
# while generating the index headers.
|
||||
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
|
||||
|
||||
IGNORE_PREFIX =
|
||||
IGNORE_PREFIX =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the HTML output
|
||||
@ -1120,7 +1120,7 @@ HTML_FILE_EXTENSION = .html
|
||||
# of the possible markers and block names see the documentation.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_HEADER =
|
||||
HTML_HEADER =
|
||||
|
||||
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
|
||||
# generated HTML page. If the tag is left blank doxygen will generate a standard
|
||||
@ -1130,7 +1130,7 @@ HTML_HEADER =
|
||||
# that doxygen normally uses.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_FOOTER =
|
||||
HTML_FOOTER =
|
||||
|
||||
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
|
||||
# sheet that is used by each HTML page. It can be used to fine-tune the look of
|
||||
@ -1142,7 +1142,7 @@ HTML_FOOTER =
|
||||
# obsolete.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_STYLESHEET =
|
||||
HTML_STYLESHEET =
|
||||
|
||||
# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
|
||||
# cascading style sheets that are included after the standard style sheets
|
||||
@ -1155,7 +1155,7 @@ HTML_STYLESHEET =
|
||||
# list). For an example see the documentation.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_EXTRA_STYLESHEET =
|
||||
HTML_EXTRA_STYLESHEET =
|
||||
|
||||
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
|
||||
# other source files which should be copied to the HTML output directory. Note
|
||||
@ -1165,12 +1165,12 @@ HTML_EXTRA_STYLESHEET =
|
||||
# files will be copied as-is; there are no commands or markers available.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_EXTRA_FILES =
|
||||
HTML_EXTRA_FILES =
|
||||
|
||||
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
|
||||
# will adjust the colors in the style sheet and background images according to
|
||||
# this color. Hue is specified as an angle on a colorwheel, see
|
||||
# https://en.wikipedia.org/wiki/Hue for more information. For instance the value
|
||||
# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
|
||||
# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
|
||||
# purple, and 360 is red again.
|
||||
# Minimum value: 0, maximum value: 359, default value: 220.
|
||||
@ -1293,7 +1293,7 @@ GENERATE_HTMLHELP = NO
|
||||
# written to the html output directory.
|
||||
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
|
||||
|
||||
CHM_FILE =
|
||||
CHM_FILE =
|
||||
|
||||
# The HHC_LOCATION tag can be used to specify the location (absolute path
|
||||
# including file name) of the HTML help compiler (hhc.exe). If non-empty,
|
||||
@ -1301,7 +1301,7 @@ CHM_FILE =
|
||||
# The file has to be specified with full path.
|
||||
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
|
||||
|
||||
HHC_LOCATION =
|
||||
HHC_LOCATION =
|
||||
|
||||
# The GENERATE_CHI flag controls if a separate .chi index file is generated
|
||||
# (YES) or that it should be included in the master .chm file (NO).
|
||||
@ -1314,7 +1314,7 @@ GENERATE_CHI = NO
|
||||
# and project file content.
|
||||
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
|
||||
|
||||
CHM_INDEX_ENCODING =
|
||||
CHM_INDEX_ENCODING =
|
||||
|
||||
# The BINARY_TOC flag controls whether a binary table of contents is generated
|
||||
# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
|
||||
@ -1345,11 +1345,11 @@ GENERATE_QHP = NO
|
||||
# the HTML output folder.
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
QCH_FILE =
|
||||
QCH_FILE =
|
||||
|
||||
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
|
||||
# Project output. For more information please see Qt Help Project / Namespace
|
||||
# (see: https://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
|
||||
# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
|
||||
# The default value is: org.doxygen.Project.
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
@ -1357,7 +1357,7 @@ QHP_NAMESPACE = org.doxygen.Project
|
||||
|
||||
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
|
||||
# Help Project output. For more information please see Qt Help Project / Virtual
|
||||
# Folders (see: https://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
|
||||
# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
|
||||
# folders).
|
||||
# The default value is: doc.
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
@ -1366,33 +1366,33 @@ QHP_VIRTUAL_FOLDER = doc
|
||||
|
||||
# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
|
||||
# filter to add. For more information please see Qt Help Project / Custom
|
||||
# Filters (see: https://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
|
||||
# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
|
||||
# filters).
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
QHP_CUST_FILTER_NAME =
|
||||
QHP_CUST_FILTER_NAME =
|
||||
|
||||
# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
|
||||
# custom filter to add. For more information please see Qt Help Project / Custom
|
||||
# Filters (see: https://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
|
||||
# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
|
||||
# filters).
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
QHP_CUST_FILTER_ATTRS =
|
||||
QHP_CUST_FILTER_ATTRS =
|
||||
|
||||
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
|
||||
# project's filter section matches. Qt Help Project / Filter Attributes (see:
|
||||
# https://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
|
||||
# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
QHP_SECT_FILTER_ATTRS =
|
||||
QHP_SECT_FILTER_ATTRS =
|
||||
|
||||
# The QHG_LOCATION tag can be used to specify the location of Qt's
|
||||
# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
|
||||
# generated .qhp file.
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
QHG_LOCATION =
|
||||
QHG_LOCATION =
|
||||
|
||||
# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
|
||||
# generated, together with the HTML files, they form an Eclipse help plugin. To
|
||||
@ -1487,7 +1487,7 @@ FORMULA_FONTSIZE = 10
|
||||
FORMULA_TRANSPARENT = YES
|
||||
|
||||
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
|
||||
# https://www.mathjax.org) which uses client side Javascript for the rendering
|
||||
# http://www.mathjax.org) which uses client side Javascript for the rendering
|
||||
# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
|
||||
# installed or if you want to formulas look prettier in the HTML output. When
|
||||
# enabled you may also need to install MathJax separately and configure the path
|
||||
@ -1514,7 +1514,7 @@ MATHJAX_FORMAT = HTML-CSS
|
||||
# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
|
||||
# Content Delivery Network so you can quickly see the result without installing
|
||||
# MathJax. However, it is strongly recommended to install a local copy of
|
||||
# MathJax from https://www.mathjax.org before deployment.
|
||||
# MathJax from http://www.mathjax.org before deployment.
|
||||
# The default value is: http://cdn.mathjax.org/mathjax/latest.
|
||||
# This tag requires that the tag USE_MATHJAX is set to YES.
|
||||
|
||||
@ -1525,7 +1525,7 @@ MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
|
||||
# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
|
||||
# This tag requires that the tag USE_MATHJAX is set to YES.
|
||||
|
||||
MATHJAX_EXTENSIONS =
|
||||
MATHJAX_EXTENSIONS =
|
||||
|
||||
# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
|
||||
# of code that will be used on startup of the MathJax code. See the MathJax site
|
||||
@ -1533,7 +1533,7 @@ MATHJAX_EXTENSIONS =
|
||||
# example see the documentation.
|
||||
# This tag requires that the tag USE_MATHJAX is set to YES.
|
||||
|
||||
MATHJAX_CODEFILE =
|
||||
MATHJAX_CODEFILE =
|
||||
|
||||
# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
|
||||
# the HTML output. The underlying search engine uses javascript and DHTML and
|
||||
@ -1576,7 +1576,7 @@ SERVER_BASED_SEARCH = NO
|
||||
#
|
||||
# Doxygen ships with an example indexer (doxyindexer) and search engine
|
||||
# (doxysearch.cgi) which are based on the open source search engine library
|
||||
# Xapian (see: https://xapian.org/).
|
||||
# Xapian (see: http://xapian.org/).
|
||||
#
|
||||
# See the section "External Indexing and Searching" for details.
|
||||
# The default value is: NO.
|
||||
@ -1589,11 +1589,11 @@ EXTERNAL_SEARCH = NO
|
||||
#
|
||||
# Doxygen ships with an example indexer (doxyindexer) and search engine
|
||||
# (doxysearch.cgi) which are based on the open source search engine library
|
||||
# Xapian (see: https://xapian.org/). See the section "External Indexing and
|
||||
# Xapian (see: http://xapian.org/). See the section "External Indexing and
|
||||
# Searching" for details.
|
||||
# This tag requires that the tag SEARCHENGINE is set to YES.
|
||||
|
||||
SEARCHENGINE_URL =
|
||||
SEARCHENGINE_URL =
|
||||
|
||||
# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
|
||||
# search data is written to a file for indexing by an external tool. With the
|
||||
@ -1609,7 +1609,7 @@ SEARCHDATA_FILE = searchdata.xml
|
||||
# projects and redirect the results back to the right project.
|
||||
# This tag requires that the tag SEARCHENGINE is set to YES.
|
||||
|
||||
EXTERNAL_SEARCH_ID =
|
||||
EXTERNAL_SEARCH_ID =
|
||||
|
||||
# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
|
||||
# projects other than the one defined by this configuration file, but that are
|
||||
@ -1619,7 +1619,7 @@ EXTERNAL_SEARCH_ID =
|
||||
# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
|
||||
# This tag requires that the tag SEARCHENGINE is set to YES.
|
||||
|
||||
EXTRA_SEARCH_MAPPINGS =
|
||||
EXTRA_SEARCH_MAPPINGS =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the LaTeX output
|
||||
@ -1680,7 +1680,7 @@ PAPER_TYPE = a4
|
||||
# If left blank no extra packages will be included.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
EXTRA_PACKAGES =
|
||||
EXTRA_PACKAGES =
|
||||
|
||||
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
|
||||
# generated LaTeX document. The header should contain everything until the first
|
||||
@ -1696,7 +1696,7 @@ EXTRA_PACKAGES =
|
||||
# to HTML_HEADER.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
LATEX_HEADER =
|
||||
LATEX_HEADER =
|
||||
|
||||
# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
|
||||
# generated LaTeX document. The footer should contain everything after the last
|
||||
@ -1707,7 +1707,7 @@ LATEX_HEADER =
|
||||
# Note: Only use a user-defined footer if you know what you are doing!
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
LATEX_FOOTER =
|
||||
LATEX_FOOTER =
|
||||
|
||||
# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined
|
||||
# LaTeX style sheets that are included after the standard style sheets created
|
||||
@ -1718,7 +1718,7 @@ LATEX_FOOTER =
|
||||
# list).
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
LATEX_EXTRA_STYLESHEET =
|
||||
LATEX_EXTRA_STYLESHEET =
|
||||
|
||||
# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
|
||||
# other source files which should be copied to the LATEX_OUTPUT output
|
||||
@ -1726,7 +1726,7 @@ LATEX_EXTRA_STYLESHEET =
|
||||
# markers available.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
LATEX_EXTRA_FILES =
|
||||
LATEX_EXTRA_FILES =
|
||||
|
||||
# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
|
||||
# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
|
||||
@ -1773,7 +1773,7 @@ LATEX_SOURCE_CODE = NO
|
||||
|
||||
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
|
||||
# bibliography, e.g. plainnat, or ieeetr. See
|
||||
# https://en.wikipedia.org/wiki/BibTeX and \cite for more info.
|
||||
# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
|
||||
# The default value is: plain.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
@ -1826,14 +1826,14 @@ RTF_HYPERLINKS = NO
|
||||
# default style sheet that doxygen normally uses.
|
||||
# This tag requires that the tag GENERATE_RTF is set to YES.
|
||||
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_STYLESHEET_FILE =
|
||||
|
||||
# Set optional variables used in the generation of an RTF document. Syntax is
|
||||
# similar to doxygen's config file. A template extensions file can be generated
|
||||
# using doxygen -e rtf extensionFile.
|
||||
# This tag requires that the tag GENERATE_RTF is set to YES.
|
||||
|
||||
RTF_EXTENSIONS_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
|
||||
# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
|
||||
# with syntax highlighting in the RTF output.
|
||||
@ -1878,7 +1878,7 @@ MAN_EXTENSION = .3
|
||||
# MAN_EXTENSION with the initial . removed.
|
||||
# This tag requires that the tag GENERATE_MAN is set to YES.
|
||||
|
||||
MAN_SUBDIR =
|
||||
MAN_SUBDIR =
|
||||
|
||||
# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
|
||||
# will generate one additional man file for each entity documented in the real
|
||||
@ -1991,7 +1991,7 @@ PERLMOD_PRETTY = YES
|
||||
# overwrite each other's variables.
|
||||
# This tag requires that the tag GENERATE_PERLMOD is set to YES.
|
||||
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
@ -2032,7 +2032,7 @@ SEARCH_INCLUDES = YES
|
||||
# preprocessor.
|
||||
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
|
||||
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_PATH =
|
||||
|
||||
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
|
||||
# patterns (like *.h and *.hpp) to filter out the header-files in the
|
||||
@ -2040,7 +2040,7 @@ INCLUDE_PATH =
|
||||
# used.
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
|
||||
# The PREDEFINED tag can be used to specify one or more macro names that are
|
||||
# defined before the preprocessor is started (similar to the -D option of e.g.
|
||||
@ -2050,7 +2050,7 @@ INCLUDE_FILE_PATTERNS =
|
||||
# recursively expanded use the := operator instead of the = operator.
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
|
||||
PREDEFINED =
|
||||
PREDEFINED =
|
||||
|
||||
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
|
||||
# tag can be used to specify a list of macro names that should be expanded. The
|
||||
@ -2059,7 +2059,7 @@ PREDEFINED =
|
||||
# definition found in the source code.
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
|
||||
EXPAND_AS_DEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
|
||||
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
|
||||
# remove all references to function-like macros that are alone on a line, have
|
||||
@ -2088,13 +2088,13 @@ SKIP_FUNCTION_MACROS = YES
|
||||
# the path). If a tag file is not located in the directory in which doxygen is
|
||||
# run, you must also specify the path to the tagfile here.
|
||||
|
||||
TAGFILES =
|
||||
TAGFILES =
|
||||
|
||||
# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
|
||||
# tag file that is based on the input files it reads. See section "Linking to
|
||||
# external documentation" for more information about the usage of tag files.
|
||||
|
||||
GENERATE_TAGFILE =
|
||||
GENERATE_TAGFILE =
|
||||
|
||||
# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
|
||||
# the class index. If set to NO, only the inherited external classes will be
|
||||
@ -2138,19 +2138,19 @@ CLASS_DIAGRAMS = YES
|
||||
|
||||
# You can define message sequence charts within doxygen comments using the \msc
|
||||
# command. Doxygen will then run the mscgen tool (see:
|
||||
# https://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
|
||||
# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
|
||||
# documentation. The MSCGEN_PATH tag allows you to specify the directory where
|
||||
# the mscgen tool resides. If left empty the tool is assumed to be found in the
|
||||
# default search path.
|
||||
|
||||
MSCGEN_PATH =
|
||||
MSCGEN_PATH =
|
||||
|
||||
# You can include diagrams made with dia in doxygen documentation. Doxygen will
|
||||
# then run dia to produce the diagram and insert it in the documentation. The
|
||||
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
|
||||
# If left empty dia is assumed to be found in the default search path.
|
||||
|
||||
DIA_PATH =
|
||||
DIA_PATH =
|
||||
|
||||
# If set to YES the inheritance and collaboration graphs will hide inheritance
|
||||
# and usage relations if the target is undocumented or is not a class.
|
||||
@ -2160,7 +2160,7 @@ HIDE_UNDOC_RELATIONS = YES
|
||||
|
||||
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
|
||||
# available from the path. This tool is part of Graphviz (see:
|
||||
# https://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
|
||||
# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
|
||||
# Bell Labs. The other options in this section have no effect if this option is
|
||||
# set to NO
|
||||
# The default value is: NO.
|
||||
@ -2199,7 +2199,7 @@ DOT_FONTSIZE = 10
|
||||
# the path where dot can find it using this tag.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
DOT_FONTPATH =
|
||||
DOT_FONTPATH =
|
||||
|
||||
# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
|
||||
# each documented class showing the direct and indirect inheritance relations.
|
||||
@ -2337,26 +2337,26 @@ INTERACTIVE_SVG = NO
|
||||
# found. If left blank, it is assumed the dot tool can be found in the path.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
DOT_PATH =
|
||||
DOT_PATH =
|
||||
|
||||
# The DOTFILE_DIRS tag can be used to specify one or more directories that
|
||||
# contain dot files that are included in the documentation (see the \dotfile
|
||||
# command).
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
DOTFILE_DIRS =
|
||||
DOTFILE_DIRS =
|
||||
|
||||
# The MSCFILE_DIRS tag can be used to specify one or more directories that
|
||||
# contain msc files that are included in the documentation (see the \mscfile
|
||||
# command).
|
||||
|
||||
MSCFILE_DIRS =
|
||||
MSCFILE_DIRS =
|
||||
|
||||
# The DIAFILE_DIRS tag can be used to specify one or more directories that
|
||||
# contain dia files that are included in the documentation (see the \diafile
|
||||
# command).
|
||||
|
||||
DIAFILE_DIRS =
|
||||
DIAFILE_DIRS =
|
||||
|
||||
# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
|
||||
# path where java can find the plantuml.jar file. If left blank, it is assumed
|
||||
@ -2364,12 +2364,12 @@ DIAFILE_DIRS =
|
||||
# generate a warning when it encounters a \startuml command in this case and
|
||||
# will not generate output for the diagram.
|
||||
|
||||
PLANTUML_JAR_PATH =
|
||||
PLANTUML_JAR_PATH =
|
||||
|
||||
# When using plantuml, the specified paths are searched for files specified by
|
||||
# the !include statement in a plantuml block.
|
||||
|
||||
PLANTUML_INCLUDE_PATH =
|
||||
PLANTUML_INCLUDE_PATH =
|
||||
|
||||
# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
|
||||
# that will be shown in the graph. If the number of nodes in a graph becomes
|
||||
27
LICENSE.md
Normal file
27
LICENSE.md
Normal file
@ -0,0 +1,27 @@
|
||||
GODOT ENGINE
|
||||
http://www.godotengine.org
|
||||
**********************************************************************
|
||||
Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
**********************************************************************
|
||||
|
||||
20
LICENSE.txt
20
LICENSE.txt
@ -1,20 +0,0 @@
|
||||
Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md).
|
||||
Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@ -1,5 +0,0 @@
|
||||
Godot Engine Logo
|
||||
Copyright (c) 2017 Andrea Calabró
|
||||
|
||||
This work is licensed under a Creative Commons Attribution 4.0 International
|
||||
License (CC-BY-4.0 International) <https://creativecommons.org/licenses/by/4.0/>.
|
||||
80
README.md
80
README.md
@ -1,76 +1,26 @@
|
||||
# Godot Engine
|
||||

|
||||
|
||||
<p align="center">
|
||||
<a href="https://godotengine.org">
|
||||
<img src="logo_outlined.svg" width="400" alt="Godot Engine logo">
|
||||
</a>
|
||||
</p>
|
||||
### The Engine
|
||||
|
||||
## 2D and 3D cross-platform game engine
|
||||
Godot is a fully featured, open source, MIT licensed, game engine. It focuses on having great tools, and a visual oriented workflow that can export to PC, Mobile and Web platforms with no hassle.
|
||||
The editor, language and APIs are feature rich, yet simple to learn, allowing you to become productive in a matter of hours.
|
||||
|
||||
**[Godot Engine](https://godotengine.org) is a feature-packed, cross-platform
|
||||
game engine to create 2D and 3D games from a unified interface.** It provides a
|
||||
comprehensive set of [common tools](https://godotengine.org/features), so that users can focus on making games
|
||||
without having to reinvent the wheel. Games can be exported with one click to a
|
||||
number of platforms, including the major desktop platforms (Linux, macOS,
|
||||
Windows), mobile platforms (Android, iOS), as well as Web-based platforms
|
||||
and [consoles](https://docs.godotengine.org/en/latest/tutorials/platform/consoles.html).
|
||||
### About
|
||||
|
||||
## Free, open source and community-driven
|
||||
Godot has been developed by Juan Linietsky and Ariel Manzur for several years, and was born as an in-house engine, used to publish several work-for-hire titles.
|
||||
Development is sponsored by OKAM Studio (http://www.okamstudio.com).
|
||||
|
||||
Godot is completely free and open source under the very permissive [MIT license](https://godotengine.org/license).
|
||||
No strings attached, no royalties, nothing. The users' games are theirs, down
|
||||
to the last line of engine code. Godot's development is fully independent and
|
||||
community-driven, empowering users to help shape their engine to match their
|
||||
expectations. It is supported by the [Software Freedom Conservancy](https://sfconservancy.org/)
|
||||
not-for-profit.
|
||||
### Documentation
|
||||
|
||||
Before being open sourced in [February 2014](https://github.com/godotengine/godot/commit/0b806ee0fc9097fa7bda7ac0109191c9c5e0a1ac),
|
||||
Godot had been developed by [Juan Linietsky](https://github.com/reduz) and
|
||||
[Ariel Manzur](https://github.com/punto-) (both still maintaining the project) for several
|
||||
years as an in-house engine, used to publish several work-for-hire titles.
|
||||
Documentation has been moved to the [GitHub Wiki](https://github.com/okamstudio/godot/wiki).
|
||||
|
||||

|
||||
### Binary Downloads, Community, etc.
|
||||
|
||||
## Getting the engine
|
||||
Binary downloads, community, etc. can be found in Godot homepage:
|
||||
|
||||
### Binary downloads
|
||||
http://www.godotengine.org
|
||||
|
||||
Official binaries for the Godot editor and the export templates can be found
|
||||
[on the homepage](https://godotengine.org/download).
|
||||
### Compiling from Source
|
||||
|
||||
### Compiling from source
|
||||
|
||||
[See the official docs](https://docs.godotengine.org/en/latest/contributing/development/compiling)
|
||||
for compilation instructions for every supported platform.
|
||||
|
||||
## Community and contributing
|
||||
|
||||
Godot is not only an engine but an ever-growing community of users and engine
|
||||
developers. The main community channels are listed [on the homepage](https://godotengine.org/community).
|
||||
|
||||
The best way to get in touch with the core engine developers is to join the
|
||||
[Godot Contributors Chat](https://chat.godotengine.org).
|
||||
|
||||
To get started contributing to the project, see the [contributing guide](CONTRIBUTING.md).
|
||||
|
||||
## Documentation and demos
|
||||
|
||||
The official documentation is hosted on [Read the Docs](https://docs.godotengine.org).
|
||||
It is maintained by the Godot community in its own [GitHub repository](https://github.com/godotengine/godot-docs).
|
||||
|
||||
The [class reference](https://docs.godotengine.org/en/latest/classes/)
|
||||
is also accessible from the Godot editor.
|
||||
|
||||
We also maintain official demos in their own [GitHub repository](https://github.com/godotengine/godot-demo-projects)
|
||||
as well as a list of [awesome Godot community resources](https://github.com/godotengine/awesome-godot).
|
||||
|
||||
There are also a number of other
|
||||
[learning resources](https://docs.godotengine.org/en/latest/community/tutorials.html)
|
||||
provided by the community, such as text and video tutorials, demos, etc.
|
||||
Consult the [community channels](https://godotengine.org/community)
|
||||
for more information.
|
||||
|
||||
[](https://www.codetriage.com/godotengine/godot)
|
||||
[](https://hosted.weblate.org/engage/godot-engine/?utm_source=widget)
|
||||
[](https://www.tickgit.com/browse?repo=github.com/godotengine/godot)
|
||||
Compilation instructions for every platform can be found in the Wiki:
|
||||
https://github.com/okamstudio/godot/wiki/advanced
|
||||
|
||||
1327
SConstruct
1327
SConstruct
File diff suppressed because it is too large
Load Diff
4
bin/SCsub
Normal file
4
bin/SCsub
Normal file
@ -0,0 +1,4 @@
|
||||
Import('env')
|
||||
Export('env')
|
||||
|
||||
SConscript('tests/SCsub');
|
||||
14
bin/tests/SCsub
Normal file
14
bin/tests/SCsub
Normal file
@ -0,0 +1,14 @@
|
||||
Import('env')
|
||||
|
||||
env.tests_sources=[]
|
||||
env.add_source_files(env.tests_sources,"*.cpp")
|
||||
|
||||
Export('env')
|
||||
|
||||
#SConscript('math/SCsub');
|
||||
|
||||
lib = env.Library("tests",env.tests_sources)
|
||||
|
||||
env.Prepend(LIBS=[lib])
|
||||
|
||||
|
||||
107
bin/tests/test_containers.cpp
Normal file
107
bin/tests/test_containers.cpp
Normal file
@ -0,0 +1,107 @@
|
||||
/*************************************************************************/
|
||||
/* test_containers.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "test_containers.h"
|
||||
#include "dvector.h"
|
||||
#include "set.h"
|
||||
#include "print_string.h"
|
||||
#include "math_funcs.h"
|
||||
#include "servers/visual/default_mouse_cursor.xpm"
|
||||
|
||||
#include "variant.h"
|
||||
#include "list.h"
|
||||
#include "image.h"
|
||||
|
||||
namespace TestContainers {
|
||||
|
||||
MainLoop * test() {
|
||||
|
||||
|
||||
/*
|
||||
HashMap<int,int> int_map;
|
||||
|
||||
for (int i=0;i<68000;i++) {
|
||||
|
||||
int num=(int)Math::random(0,1024);
|
||||
int_map[i]=num;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
{
|
||||
|
||||
// static const int size = 16;
|
||||
Image img;
|
||||
img.create(default_mouse_cursor_xpm);
|
||||
|
||||
{
|
||||
for (int i=0; i<8; i++) {
|
||||
|
||||
Image mipmap;
|
||||
//img.make_mipmap(mipmap);
|
||||
img = mipmap;
|
||||
if (img.get_width() <= 4) break;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#if 0
|
||||
Set<int> set;
|
||||
|
||||
print_line("Begin Insert");
|
||||
for (int i=0;i<1100;i++) {
|
||||
|
||||
int num=i;//(int)Math::random(0,1024);
|
||||
// print_line("inserting "+itos(num));
|
||||
set.insert( num );
|
||||
}
|
||||
|
||||
/*
|
||||
for (int i=0;i<400;i++) {
|
||||
|
||||
int num=(int)Math::random(0,1024);
|
||||
set.erase(num);
|
||||
}
|
||||
*/
|
||||
//set.print_tree();
|
||||
|
||||
for(Set<int>::Element *I=set.front();I;I=I->next()) {
|
||||
|
||||
print_line("inserted "+itos(I->get())+" prev is "+itos(I->prev()?I->prev()->get():-100));
|
||||
|
||||
}
|
||||
|
||||
print_line("depth is "+itos(set.calculate_depth()));
|
||||
print_line("Insert Success");
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
43
bin/tests/test_containers.h
Normal file
43
bin/tests/test_containers.h
Normal file
@ -0,0 +1,43 @@
|
||||
/*************************************************************************/
|
||||
/* test_containers.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef TEST_CONTAINERS_H
|
||||
#define TEST_CONTAINERS_H
|
||||
|
||||
#include "os/main_loop.h"
|
||||
/**
|
||||
@author Juan Linietsky <reduzio@gmail.com>
|
||||
*/
|
||||
|
||||
namespace TestContainers {
|
||||
|
||||
MainLoop * test();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
217
bin/tests/test_detailer.cpp
Normal file
217
bin/tests/test_detailer.cpp
Normal file
@ -0,0 +1,217 @@
|
||||
/*************************************************************************/
|
||||
/* test_detailer.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "test_detailer.h"
|
||||
#include "servers/visual_server.h"
|
||||
#include "os/main_loop.h"
|
||||
#include "math_funcs.h"
|
||||
#include "print_string.h"
|
||||
#include "geometry.h"
|
||||
#include "quick_hull.h"
|
||||
namespace TestMultiMesh {
|
||||
|
||||
|
||||
class TestMainLoop : public MainLoop {
|
||||
|
||||
RID instance;
|
||||
RID camera;
|
||||
RID viewport;
|
||||
RID light;
|
||||
RID mesh;
|
||||
RID scenario;
|
||||
|
||||
#define MULTIMESH_COUNT 1500
|
||||
|
||||
float ofs_x,ofs_y;
|
||||
bool quit;
|
||||
public:
|
||||
|
||||
|
||||
virtual void _update_qh() {
|
||||
|
||||
VisualServer *vs=VisualServer::get_singleton();
|
||||
Vector<Vector3> vts;
|
||||
/*
|
||||
|
||||
static const int s = 20;
|
||||
for(int i=0;i<s;i++) {
|
||||
Matrix3 rot(Vector3(0,1,0),i*Math_PI/s);
|
||||
|
||||
for(int j=0;j<s;j++) {
|
||||
Vector3 v;
|
||||
v.x=Math::sin(j*Math_PI*2/s);
|
||||
v.y=Math::cos(j*Math_PI*2/s);
|
||||
|
||||
vts.push_back( rot.xform(v*2 ) );
|
||||
}
|
||||
}*/
|
||||
/*
|
||||
Math::seed(0);
|
||||
for(int i=0;i<50;i++) {
|
||||
|
||||
vts.push_back( Vector3(Math::randf()*2-1.0,Math::randf()*2-1.0,Math::randf()*2-1.0).normalized()*2);
|
||||
}*/
|
||||
/*
|
||||
vts.push_back(Vector3(0,0,1));
|
||||
vts.push_back(Vector3(0,0,-1));
|
||||
vts.push_back(Vector3(0,1,0));
|
||||
vts.push_back(Vector3(0,-1,0));
|
||||
vts.push_back(Vector3(1,0,0));
|
||||
vts.push_back(Vector3(-1,0,0));*/
|
||||
/*
|
||||
vts.push_back(Vector3(1,1,1));
|
||||
vts.push_back(Vector3(1,-1,1));
|
||||
vts.push_back(Vector3(-1,1,1));
|
||||
vts.push_back(Vector3(-1,-1,1));
|
||||
vts.push_back(Vector3(1,1,-1));
|
||||
vts.push_back(Vector3(1,-1,-1));
|
||||
vts.push_back(Vector3(-1,1,-1));
|
||||
vts.push_back(Vector3(-1,-1,-1));
|
||||
*/
|
||||
|
||||
|
||||
DVector<Plane> convex_planes = Geometry::build_cylinder_planes(0.5,0.7,4,Vector3::AXIS_Z);
|
||||
Geometry::MeshData convex_data = Geometry::build_convex_mesh(convex_planes);
|
||||
vts=convex_data.vertices;
|
||||
|
||||
Geometry::MeshData md;
|
||||
Error err = QuickHull::build(vts,md);
|
||||
print_line("ERR: "+itos(err));
|
||||
|
||||
vs->mesh_remove_surface(mesh,0);
|
||||
vs->mesh_add_surface_from_mesh_data(mesh,md);
|
||||
|
||||
|
||||
|
||||
//vs->scenario_set_debug(scenario,VS::SCENARIO_DEBUG_WIREFRAME);
|
||||
|
||||
/*
|
||||
RID sm = vs->shader_create();
|
||||
//vs->shader_set_fragment_code(sm,"OUT_ALPHA=mod(TIME,1);");
|
||||
//vs->shader_set_vertex_code(sm,"OUT_VERTEX=IN_VERTEX*mod(TIME,1);");
|
||||
vs->shader_set_fragment_code(sm,"OUT_DIFFUSE=vec3(1,0,1);OUT_GLOW=abs(sin(TIME));");
|
||||
RID tcmat = vs->mesh_surface_get_material(test_cube,0);
|
||||
vs->material_set_shader(tcmat,sm);
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
virtual void input_event(const InputEvent& p_event) {
|
||||
|
||||
if (p_event.type==InputEvent::MOUSE_MOTION && p_event.mouse_motion.button_mask&4) {
|
||||
|
||||
ofs_x+=p_event.mouse_motion.relative_y/200.0;
|
||||
ofs_y+=p_event.mouse_motion.relative_x/200.0;
|
||||
}
|
||||
if (p_event.type==InputEvent::MOUSE_BUTTON && p_event.mouse_button.pressed && p_event.mouse_button.button_index==1) {
|
||||
|
||||
QuickHull::debug_stop_after++;
|
||||
_update_qh();
|
||||
}
|
||||
if (p_event.type==InputEvent::MOUSE_BUTTON && p_event.mouse_button.pressed && p_event.mouse_button.button_index==2) {
|
||||
|
||||
if (QuickHull::debug_stop_after>0)
|
||||
QuickHull::debug_stop_after--;
|
||||
_update_qh();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
virtual void request_quit() {
|
||||
|
||||
quit=true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual void init() {
|
||||
|
||||
VisualServer *vs=VisualServer::get_singleton();
|
||||
|
||||
|
||||
mesh = vs->mesh_create();
|
||||
|
||||
scenario = vs->scenario_create();
|
||||
|
||||
QuickHull::debug_stop_after=0;
|
||||
_update_qh();
|
||||
|
||||
instance = vs->instance_create2(mesh,scenario);
|
||||
|
||||
camera = vs->camera_create();
|
||||
|
||||
|
||||
vs->camera_set_perspective( camera, 60.0,0.1, 100.0 );
|
||||
viewport = vs->viewport_create();
|
||||
vs->viewport_attach_camera( viewport, camera );
|
||||
vs->viewport_attach_to_screen(viewport);
|
||||
vs->viewport_set_scenario( viewport, scenario );
|
||||
|
||||
vs->camera_set_transform(camera, Transform( Matrix3(), Vector3(0,0,2 ) ) );
|
||||
|
||||
RID lightaux = vs->light_create( VisualServer::LIGHT_DIRECTIONAL );
|
||||
//vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.3,0.3,0.3) );
|
||||
light = vs->instance_create2( lightaux,scenario );
|
||||
vs->instance_set_transform(light,Transform(Matrix3(Vector3(0.1,0.4,0.7).normalized(),0.9)));
|
||||
|
||||
ofs_x=0;
|
||||
ofs_y=0;
|
||||
quit=false;
|
||||
}
|
||||
|
||||
virtual bool idle(float p_time) {
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool iteration(float p_time) {
|
||||
|
||||
VisualServer *vs=VisualServer::get_singleton();
|
||||
|
||||
Transform tr_camera;
|
||||
tr_camera.rotate( Vector3(0,1,0), ofs_y );
|
||||
tr_camera.rotate( Vector3(1,0,0),ofs_x );
|
||||
tr_camera.translate(0,0,10);
|
||||
|
||||
vs->camera_set_transform( camera, tr_camera );
|
||||
|
||||
return quit;
|
||||
}
|
||||
virtual void finish() {
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
MainLoop* test() {
|
||||
|
||||
return memnew(TestMainLoop);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
44
bin/tests/test_detailer.h
Normal file
44
bin/tests/test_detailer.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*************************************************************************/
|
||||
/* test_detailer.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef TEST_MULTIMESH_H
|
||||
#define TEST_MULTIMESH_H
|
||||
|
||||
/**
|
||||
@author Juan Linietsky <reduzio@gmail.com>
|
||||
*/
|
||||
#include "os/main_loop.h"
|
||||
|
||||
namespace TestMultiMesh {
|
||||
|
||||
MainLoop* test();
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
1042
bin/tests/test_gdscript.cpp
Normal file
1042
bin/tests/test_gdscript.cpp
Normal file
File diff suppressed because it is too large
Load Diff
47
bin/tests/test_gdscript.h
Normal file
47
bin/tests/test_gdscript.h
Normal file
@ -0,0 +1,47 @@
|
||||
/*************************************************************************/
|
||||
/* test_gdscript.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef TEST_GDSCRIPT_H
|
||||
#define TEST_GDSCRIPT_H
|
||||
|
||||
#include "os/main_loop.h"
|
||||
|
||||
namespace TestGDScript {
|
||||
|
||||
enum TestType {
|
||||
TEST_TOKENIZER,
|
||||
TEST_PARSER,
|
||||
TEST_COMPILER,
|
||||
TEST_BYTECODE,
|
||||
};
|
||||
|
||||
MainLoop* test(TestType p_type);
|
||||
|
||||
}
|
||||
|
||||
#endif // TEST_GDSCRIPT_H
|
||||
399
bin/tests/test_gui.cpp
Normal file
399
bin/tests/test_gui.cpp
Normal file
@ -0,0 +1,399 @@
|
||||
/*************************************************************************/
|
||||
/* test_gui.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef _3D_DISABLED
|
||||
|
||||
#include "test_gui.h"
|
||||
|
||||
#include "scene/main/scene_main_loop.h"
|
||||
#include "os/os.h"
|
||||
#include "scene/gui/control.h"
|
||||
#include "scene/gui/button.h"
|
||||
#include "scene/gui/label.h"
|
||||
#include "scene/gui/line_edit.h"
|
||||
#include "scene/gui/scroll_bar.h"
|
||||
#include "scene/gui/popup_menu.h"
|
||||
#include "scene/gui/option_button.h"
|
||||
#include "scene/gui/spin_box.h"
|
||||
#include "scene/gui/menu_button.h"
|
||||
#include "scene/gui/progress_bar.h"
|
||||
#include "scene/gui/panel.h"
|
||||
#include "scene/gui/tab_container.h"
|
||||
#include "scene/gui/tree.h"
|
||||
#include "scene/gui/rich_text_label.h"
|
||||
#include "scene/gui/texture_frame.h"
|
||||
#include "io/image_loader.h"
|
||||
#include "print_string.h"
|
||||
#include "scene/2d/sprite.h"
|
||||
|
||||
#include "scene/main/viewport.h"
|
||||
#include "scene/3d/camera.h"
|
||||
#include "scene/3d/test_cube.h"
|
||||
|
||||
namespace TestGUI {
|
||||
|
||||
|
||||
class TestMainLoop : public SceneTree {
|
||||
|
||||
|
||||
Control *control;
|
||||
|
||||
public:
|
||||
|
||||
virtual void request_quit() {
|
||||
|
||||
quit();
|
||||
|
||||
}
|
||||
virtual void init() {
|
||||
|
||||
SceneTree::init();
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
|
||||
Viewport *vp = memnew( Viewport );
|
||||
vp->set_world( Ref<World>( memnew( World )));
|
||||
get_root()->add_child(vp);
|
||||
|
||||
vp->set_rect(Rect2(0,0,256,256));
|
||||
vp->set_as_render_target(true);
|
||||
vp->set_render_target_update_mode(Viewport::RENDER_TARGET_UPDATE_ALWAYS);
|
||||
|
||||
|
||||
Camera *camera = memnew( Camera );
|
||||
vp->add_child(camera);
|
||||
camera->make_current();
|
||||
|
||||
TestCube *testcube = memnew( TestCube );
|
||||
vp->add_child(testcube);
|
||||
testcube->set_transform(Transform( Matrix3().rotated(Vector3(0,1,0),Math_PI*0.25), Vector3(0,0,-8)));
|
||||
|
||||
Sprite *sp = memnew( Sprite );
|
||||
sp->set_texture( vp->get_render_target_texture() );
|
||||
// sp->set_texture( ResourceLoader::load("res://ball.png") );
|
||||
sp->set_pos(Point2(300,300));
|
||||
get_root()->add_child(sp);
|
||||
|
||||
|
||||
return;
|
||||
#endif
|
||||
|
||||
Panel * frame = memnew( Panel );
|
||||
frame->set_anchor( MARGIN_RIGHT, Control::ANCHOR_END );
|
||||
frame->set_anchor( MARGIN_BOTTOM, Control::ANCHOR_END );
|
||||
frame->set_end( Point2(0,0) );
|
||||
|
||||
get_root()->add_child( frame );
|
||||
|
||||
Label *label = memnew( Label );
|
||||
|
||||
label->set_pos( Point2( 80,90 ) );
|
||||
label->set_size( Point2( 170,80 ) );
|
||||
label->set_align( Label::ALIGN_FILL );
|
||||
//label->set_text("There");
|
||||
label->set_text("There was once upon a time a beautiful unicorn that loved to play with little girls...");
|
||||
|
||||
frame->add_child(label);
|
||||
|
||||
Button *button = memnew( Button );
|
||||
|
||||
button->set_pos( Point2( 20,20 ) );
|
||||
button->set_size( Point2( 1,1 ) );
|
||||
button->set_text("This is a biggie button");
|
||||
|
||||
|
||||
frame->add_child( button );
|
||||
|
||||
|
||||
#if 0
|
||||
Sprite *tf = memnew( Sprite );
|
||||
frame->add_child(tf);
|
||||
Image img;
|
||||
ImageLoader::load_image("LarvoClub.png",&img);
|
||||
|
||||
img.resize(512,512);
|
||||
img.generate_mipmaps();
|
||||
img.compress(Image::COMPRESS_PVRTC4);
|
||||
Ref<ImageTexture> tt = memnew( ImageTexture );
|
||||
tt->create_from_image(img);
|
||||
tf->set_texture(tt);
|
||||
tf->set_pos(Point2(50,50));
|
||||
//tf->set_scale(Point2(0.3,0.3));
|
||||
|
||||
|
||||
return;
|
||||
#endif
|
||||
|
||||
Tree * tree = memnew( Tree );
|
||||
tree->set_columns(2);
|
||||
|
||||
tree->set_pos( Point2( 230,210 ) );
|
||||
tree->set_size( Point2( 150,250 ) );
|
||||
|
||||
|
||||
TreeItem *item = tree->create_item();
|
||||
item->set_editable(0,true);
|
||||
item->set_text(0,"root");
|
||||
item = tree->create_item( tree->get_root() );
|
||||
item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
|
||||
item->set_editable(0,true);
|
||||
item->set_text(0,"check");
|
||||
item->set_cell_mode(1, TreeItem::CELL_MODE_CHECK);
|
||||
item->set_editable(1,true);
|
||||
item->set_text(1,"check2");
|
||||
item = tree->create_item( tree->get_root() );
|
||||
item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE);
|
||||
item->set_editable(0,true);
|
||||
item->set_range_config(0,0,20,0.1);
|
||||
item->set_range(0,2);
|
||||
item->add_button(0,Theme::get_default()->get_icon("folder","FileDialog"));
|
||||
item->set_cell_mode(1, TreeItem::CELL_MODE_RANGE);
|
||||
item->set_editable(1,true);
|
||||
item->set_range_config(1,0,20,0.1);
|
||||
item->set_range(1,3);
|
||||
|
||||
item = tree->create_item( tree->get_root() );
|
||||
item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE);
|
||||
item->set_editable(0,true);
|
||||
item->set_text(0,"Have,Many,Several,Options!");
|
||||
item->set_range(0,2);
|
||||
|
||||
item = tree->create_item( item );
|
||||
item->set_editable(0,true);
|
||||
item->set_text(0,"Gershwin!");
|
||||
|
||||
frame->add_child(tree);
|
||||
|
||||
//control = memnew( Control );
|
||||
//root->add_child( control );
|
||||
|
||||
|
||||
|
||||
LineEdit *line_edit = memnew( LineEdit );
|
||||
|
||||
line_edit->set_pos( Point2( 30,190 ) );
|
||||
line_edit->set_size( Point2( 180,1 ) );
|
||||
|
||||
frame->add_child(line_edit);
|
||||
|
||||
HScrollBar *hscroll = memnew( HScrollBar );
|
||||
|
||||
hscroll->set_pos( Point2( 30,290 ) );
|
||||
hscroll->set_size( Point2( 180,1 ) );
|
||||
hscroll->set_max(10);
|
||||
hscroll->set_page(4);
|
||||
|
||||
frame->add_child(hscroll);
|
||||
|
||||
|
||||
|
||||
SpinBox *spin = memnew( SpinBox );
|
||||
|
||||
spin->set_pos( Point2( 30,260 ) );
|
||||
spin->set_size( Point2( 120,1 ) );
|
||||
|
||||
frame->add_child(spin);
|
||||
hscroll->share(spin);
|
||||
|
||||
ProgressBar *progress = memnew( ProgressBar );
|
||||
|
||||
progress->set_pos( Point2( 30,330 ) );
|
||||
progress->set_size( Point2( 120,1 ) );
|
||||
|
||||
frame->add_child(progress);
|
||||
hscroll->share(progress);
|
||||
|
||||
MenuButton *menu_button = memnew( MenuButton );
|
||||
|
||||
menu_button->set_text("I'm a menu!");
|
||||
menu_button->set_pos( Point2( 30,380 ) );
|
||||
menu_button->set_size( Point2( 1,1 ) );
|
||||
|
||||
frame->add_child(menu_button);
|
||||
|
||||
PopupMenu *popup = menu_button->get_popup();
|
||||
|
||||
popup->add_item("Hello, testing");
|
||||
popup->add_item("My Dearest");
|
||||
popup->add_separator();
|
||||
popup->add_item("Popup");
|
||||
popup->add_check_item("Check Popup");
|
||||
popup->set_item_checked(4,true);
|
||||
|
||||
OptionButton *options = memnew( OptionButton );
|
||||
|
||||
options->add_item("Hello, testing");
|
||||
options->add_item("My Dearest");
|
||||
|
||||
options->set_pos( Point2( 230,180 ) );
|
||||
options->set_size( Point2( 1,1 ) );
|
||||
|
||||
frame->add_child(options);
|
||||
|
||||
/*
|
||||
Tree * tree = memnew( Tree );
|
||||
tree->set_columns(2);
|
||||
|
||||
tree->set_pos( Point2( 230,210 ) );
|
||||
tree->set_size( Point2( 150,250 ) );
|
||||
|
||||
|
||||
TreeItem *item = tree->create_item();
|
||||
item->set_editable(0,true);
|
||||
item->set_text(0,"root");
|
||||
item = tree->create_item( tree->get_root() );
|
||||
item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
|
||||
item->set_editable(0,true);
|
||||
item->set_text(0,"check");
|
||||
item = tree->create_item( tree->get_root() );
|
||||
item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE);
|
||||
item->set_editable(0,true);
|
||||
item->set_range_config(0,0,20,0.1);
|
||||
item->set_range(0,2);
|
||||
item->add_button(0,Theme::get_default()->get_icon("folder","FileDialog"));
|
||||
item = tree->create_item( tree->get_root() );
|
||||
item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE);
|
||||
item->set_editable(0,true);
|
||||
item->set_text(0,"Have,Many,Several,Options!");
|
||||
item->set_range(0,2);
|
||||
|
||||
frame->add_child(tree);
|
||||
*/
|
||||
|
||||
|
||||
RichTextLabel *richtext = memnew( RichTextLabel );
|
||||
|
||||
richtext->set_pos( Point2( 600,210 ) );
|
||||
richtext->set_size( Point2( 180,250 ) );
|
||||
richtext->set_anchor_and_margin(MARGIN_RIGHT,Control::ANCHOR_END,20);
|
||||
|
||||
frame->add_child(richtext);
|
||||
|
||||
|
||||
richtext->add_text("Hello, My Friends!\n\nWelcome to the amazing world of ");
|
||||
|
||||
richtext->add_newline();
|
||||
richtext->add_newline();
|
||||
|
||||
richtext->push_color(Color(1,0.5,0.5));
|
||||
richtext->add_text("leprechauns");
|
||||
richtext->pop();
|
||||
|
||||
richtext->add_text(" and ");
|
||||
richtext->push_color(Color(0,1.0,0.5));
|
||||
richtext->add_text("faeries.\n");
|
||||
richtext->pop();
|
||||
richtext->add_text("In this new episode, we will attemp to ");
|
||||
richtext->push_font(richtext->get_font("mono_font","Fonts"));
|
||||
richtext->push_color(Color(0.7,0.5,1.0));
|
||||
richtext->add_text("deliver something nice");
|
||||
richtext->pop();
|
||||
richtext->pop();
|
||||
richtext->add_text(" to all the viewers! Unfortunately, I need to ");
|
||||
richtext->push_underline();
|
||||
richtext->add_text("keep writing a lot of text");
|
||||
richtext->pop();
|
||||
richtext->add_text(" so the label control overflows and the scrollbar appears.\n");
|
||||
//richtext->push_indent(1);
|
||||
//richtext->add_text("By the way, testing indent levels! Yohohoho! Everything should appear to the right sightly here!\n");
|
||||
//richtext->pop();
|
||||
richtext->push_meta("http://www.scrollingcapabilities.xz");
|
||||
richtext->add_text("This allows to test for the scrolling capabilities ");
|
||||
richtext->pop();
|
||||
richtext->add_text("of the rich text label for huge text (not like this text will really be huge but, you know).\nAs long as it is so long that it will work nicely for a test/demo, then it's welcomed in my book...\nChanging subject, the day is cloudy today and I'm wondering if I'll get che chance to travel somewhere nice. Sometimes, watching the clouds from satellite images may give a nice insight about how pressure zones in our planet work, althogh it also makes it pretty obvious to see why most weather forecasts get it wrong so often.\nClouds are so difficult to predict!\nBut it's pretty cool how our civilization has adapted to having water falling from the sky each time it rains...");
|
||||
//richtext->add_text("Hello!\nGorgeous..");
|
||||
|
||||
|
||||
//richtext->push_meta("http://www.scrollingcapabilities.xz");
|
||||
///richtext->add_text("Hello!\n");
|
||||
//richtext->pop();
|
||||
|
||||
richtext->set_anchor(MARGIN_RIGHT,Control::ANCHOR_END);
|
||||
|
||||
|
||||
TabContainer * tabc = memnew( TabContainer );
|
||||
|
||||
Control *ctl= memnew( Control );
|
||||
ctl->set_name("tab 1");
|
||||
tabc->add_child(ctl);
|
||||
|
||||
ctl= memnew( Control );
|
||||
ctl->set_name("tab 2");
|
||||
tabc->add_child(ctl);
|
||||
label = memnew( Label );
|
||||
label->set_text("Some Label");
|
||||
label->set_pos( Point2(20,20) );
|
||||
ctl->add_child(label);;
|
||||
|
||||
ctl= memnew( Control );
|
||||
ctl->set_name("tab 3");
|
||||
button = memnew( Button );
|
||||
button->set_text("Some Button");
|
||||
button->set_pos( Point2(30,50) );
|
||||
ctl->add_child(button);;
|
||||
|
||||
tabc->add_child(ctl);
|
||||
|
||||
frame->add_child(tabc);
|
||||
|
||||
tabc->set_pos( Point2( 400,210 ) );
|
||||
tabc->set_size( Point2( 180,250 ) );
|
||||
|
||||
|
||||
Ref<ImageTexture> text = memnew( ImageTexture );
|
||||
text->load("test_data/concave.png");
|
||||
|
||||
Sprite* sprite = memnew(Sprite);
|
||||
sprite->set_texture(text);
|
||||
sprite->set_pos(Point2(300, 300));
|
||||
frame->add_child(sprite);
|
||||
sprite->show();
|
||||
|
||||
Sprite* sprite2 = memnew(Sprite);
|
||||
sprite->set_texture(text);
|
||||
sprite->add_child(sprite2);
|
||||
sprite2->set_pos(Point2(50, 50));
|
||||
sprite2->show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
MainLoop* test() {
|
||||
|
||||
|
||||
return memnew( TestMainLoop );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
44
bin/tests/test_gui.h
Normal file
44
bin/tests/test_gui.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*************************************************************************/
|
||||
/* test_gui.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef TEST_GUI_H
|
||||
#define TEST_GUI_H
|
||||
|
||||
#include "os/main_loop.h"
|
||||
|
||||
/**
|
||||
@author Juan Linietsky <reduzio@gmail.com>
|
||||
*/
|
||||
namespace TestGUI {
|
||||
|
||||
MainLoop* test();
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
77
bin/tests/test_image.cpp
Normal file
77
bin/tests/test_image.cpp
Normal file
@ -0,0 +1,77 @@
|
||||
/*************************************************************************/
|
||||
/* test_image.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "test_image.h"
|
||||
#include "os/main_loop.h"
|
||||
#include "math_funcs.h"
|
||||
#include "print_string.h"
|
||||
#include "io/image_loader.h"
|
||||
namespace TestImage {
|
||||
|
||||
|
||||
class TestMainLoop : public MainLoop {
|
||||
|
||||
bool quit;
|
||||
public:
|
||||
virtual void input_event(const InputEvent& p_event) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
virtual void init() {
|
||||
|
||||
quit=false;
|
||||
}
|
||||
virtual bool iteration(float p_time) {
|
||||
|
||||
return quit;
|
||||
}
|
||||
|
||||
virtual bool idle(float p_time) {
|
||||
return quit;
|
||||
}
|
||||
|
||||
virtual void finish() {
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
MainLoop* test() {
|
||||
|
||||
Image img;
|
||||
ImageLoader::load_image("as1.png",&img);
|
||||
|
||||
img.resize(512,512);
|
||||
|
||||
return memnew( TestMainLoop );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
44
bin/tests/test_image.h
Normal file
44
bin/tests/test_image.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*************************************************************************/
|
||||
/* test_image.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef TEST_IMAGE_H
|
||||
#define TEST_IMAGE_H
|
||||
|
||||
/**
|
||||
@author Juan Linietsky <reduzio@gmail.com>
|
||||
*/
|
||||
|
||||
#include "os/main_loop.h"
|
||||
|
||||
namespace TestImage {
|
||||
|
||||
MainLoop* test();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
208
bin/tests/test_io.cpp
Normal file
208
bin/tests/test_io.cpp
Normal file
@ -0,0 +1,208 @@
|
||||
/*************************************************************************/
|
||||
/* test_io.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "test_io.h"
|
||||
|
||||
#ifdef MINIZIP_ENABLED
|
||||
|
||||
|
||||
|
||||
#include "os/main_loop.h"
|
||||
#include "os/os.h"
|
||||
#include "scene/resources/texture.h"
|
||||
#include "print_string.h"
|
||||
#include "io/resource_loader.h"
|
||||
#include "io/resource_saver.h"
|
||||
#include "os/dir_access.h"
|
||||
#include "core/globals.h"
|
||||
|
||||
#include "io/file_access_memory.h"
|
||||
|
||||
namespace TestIO {
|
||||
|
||||
|
||||
class TestMainLoop : public MainLoop {
|
||||
|
||||
|
||||
bool quit;
|
||||
|
||||
public:
|
||||
virtual void input_event(const InputEvent& p_event) {
|
||||
|
||||
|
||||
}
|
||||
virtual bool idle(float p_time) {
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void request_quit() {
|
||||
|
||||
quit=true;
|
||||
|
||||
}
|
||||
virtual void init() {
|
||||
|
||||
quit=true;
|
||||
}
|
||||
virtual bool iteration(float p_time) {
|
||||
|
||||
return quit;
|
||||
}
|
||||
virtual void finish() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
MainLoop* test() {
|
||||
|
||||
print_line("this is test io");
|
||||
DirAccess* da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
|
||||
da->change_dir(".");
|
||||
print_line("Opening current dir "+ da->get_current_dir());
|
||||
String entry;
|
||||
da->list_dir_begin();
|
||||
while ( (entry = da->get_next()) != "") {
|
||||
|
||||
print_line("entry "+entry+" is dir: " + Variant(da->current_is_dir()));
|
||||
};
|
||||
da->list_dir_end();
|
||||
|
||||
RES texture = ResourceLoader::load("test_data/rock.png");
|
||||
ERR_FAIL_COND_V(texture.is_null(), NULL);
|
||||
|
||||
ResourceSaver::save("test_data/rock.xml",texture);
|
||||
|
||||
print_line("localize paths");
|
||||
print_line(Globals::get_singleton()->localize_path("algo.xml"));
|
||||
print_line(Globals::get_singleton()->localize_path("c:\\windows\\algo.xml"));
|
||||
print_line(Globals::get_singleton()->localize_path(Globals::get_singleton()->get_resource_path()+"/something/something.xml"));
|
||||
print_line(Globals::get_singleton()->localize_path("somedir/algo.xml"));
|
||||
|
||||
{
|
||||
|
||||
FileAccess* z = FileAccess::open("test_data/archive.zip", FileAccess::READ);
|
||||
int len = z->get_len();
|
||||
Vector<uint8_t> zip;
|
||||
zip.resize(len);
|
||||
z->get_buffer(&zip[0], len);
|
||||
z->close();
|
||||
memdelete(z);
|
||||
|
||||
FileAccessMemory::register_file("a_package", zip);
|
||||
FileAccess::make_default<FileAccessMemory>(FileAccess::ACCESS_RESOURCES);
|
||||
FileAccess::make_default<FileAccessMemory>(FileAccess::ACCESS_FILESYSTEM);
|
||||
FileAccess::make_default<FileAccessMemory>(FileAccess::ACCESS_USERDATA);
|
||||
|
||||
print_line("archive test");
|
||||
#if 0
|
||||
Archive arch;
|
||||
|
||||
Archive::get_singleton()->add_package("a_package");
|
||||
FileAccessArchive f;
|
||||
|
||||
print_line("opening for read");
|
||||
f._open("file.txt", FileAccess::READ);
|
||||
int pos = f.get_pos();
|
||||
printf("file has %i bytes, initial pos %i\n", (int)f.get_len(), pos);
|
||||
|
||||
do {
|
||||
printf("%c", f.get_8());
|
||||
|
||||
} while (!f.eof_reached());
|
||||
|
||||
print_line("opening for stored seek");
|
||||
f.open("seek.bin", FileAccess::READ);
|
||||
pos = f.get_pos();
|
||||
printf("byte at pos %i is %i\n", pos, (int)f.get_8());
|
||||
f.seek(128);
|
||||
pos = f.get_pos();
|
||||
printf("byte at pos %i is %i\n", pos, (int)f.get_8());
|
||||
|
||||
print_line("opening for deflated seek");
|
||||
f.open("seek_deflated.bin", FileAccess::READ);
|
||||
pos = f.get_pos();
|
||||
printf("byte at pos %i is %i\n", pos, (int)f.get_8());
|
||||
f.seek(128);
|
||||
pos = f.get_pos();
|
||||
printf("byte at pos %i is %i\n", pos, (int)f.get_8());
|
||||
pos = f.get_pos();
|
||||
printf("byte at pos %i is %i\n", pos, (int)f.get_8());
|
||||
pos = f.get_pos();
|
||||
printf("byte at pos %i is %i\n", pos, (int)f.get_8());
|
||||
f.seek(256);
|
||||
pos = f.get_pos();
|
||||
printf("byte at pos %i is %i\n", pos, (int)f.get_8());
|
||||
pos = f.get_pos();
|
||||
printf("byte at pos %i is %i\n", pos, (int)f.get_8());
|
||||
pos = f.get_pos();
|
||||
printf("byte at pos %i is %i\n", pos, (int)f.get_8());
|
||||
f.seek(4);
|
||||
pos = f.get_pos();
|
||||
printf("byte at pos %i is %i\n", pos, (int)f.get_8());
|
||||
pos = f.get_pos();
|
||||
printf("byte at pos %i is %i\n", pos, (int)f.get_8());
|
||||
pos = f.get_pos();
|
||||
printf("byte at pos %i is %i\n", pos, (int)f.get_8());
|
||||
|
||||
f.close();
|
||||
|
||||
DirAccessArchive d;
|
||||
String dir = "../blah1/blah2/blahask/../blah3/.//blah4/";
|
||||
printf("changing dir to %s\n", dir.utf8().get_data());
|
||||
d.change_dir(dir);
|
||||
printf("current dir is %s\n", d.get_current_dir().utf8().get_data());
|
||||
|
||||
FileAccessMemory::cleanup();
|
||||
#endif
|
||||
};
|
||||
|
||||
print_line("test done");
|
||||
|
||||
|
||||
return memnew( TestMainLoop );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
namespace TestIO {
|
||||
|
||||
|
||||
MainLoop* test() {
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
44
bin/tests/test_io.h
Normal file
44
bin/tests/test_io.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*************************************************************************/
|
||||
/* test_io.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef TEST_IO_H
|
||||
#define TEST_IO_H
|
||||
|
||||
/**
|
||||
@author Juan Linietsky <reduzio@gmail.com>
|
||||
*/
|
||||
|
||||
#include "os/main_loop.h"
|
||||
|
||||
namespace TestIO {
|
||||
|
||||
MainLoop* test();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
197
bin/tests/test_main.cpp
Normal file
197
bin/tests/test_main.cpp
Normal file
@ -0,0 +1,197 @@
|
||||
/*************************************************************************/
|
||||
/* test_main.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "list.h"
|
||||
#include "os/main_loop.h"
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
||||
#include "test_string.h"
|
||||
#include "test_containers.h"
|
||||
#include "test_math.h"
|
||||
#include "test_gui.h"
|
||||
#include "test_render.h"
|
||||
#include "test_sound.h"
|
||||
#include "test_misc.h"
|
||||
#include "test_physics.h"
|
||||
#include "test_physics_2d.h"
|
||||
#include "test_python.h"
|
||||
#include "test_io.h"
|
||||
#include "test_particles.h"
|
||||
#include "test_detailer.h"
|
||||
#include "test_shader_lang.h"
|
||||
#include "test_gdscript.h"
|
||||
#include "test_image.h"
|
||||
|
||||
|
||||
const char ** tests_get_names() {
|
||||
|
||||
static const char* test_names[]={
|
||||
"string",
|
||||
"containers",
|
||||
"math",
|
||||
"render",
|
||||
"particles",
|
||||
"multimesh",
|
||||
"gui",
|
||||
"io",
|
||||
"shaderlang",
|
||||
NULL
|
||||
};
|
||||
|
||||
return test_names;
|
||||
}
|
||||
|
||||
MainLoop* test_main(String p_test,const List<String>& p_args) {
|
||||
|
||||
|
||||
if (p_test=="string") {
|
||||
|
||||
return TestString::test();
|
||||
}
|
||||
|
||||
if (p_test=="containers") {
|
||||
|
||||
return TestContainers::test();
|
||||
}
|
||||
|
||||
if (p_test=="math") {
|
||||
|
||||
return TestMath::test();
|
||||
}
|
||||
|
||||
if (p_test=="physics") {
|
||||
|
||||
return TestPhysics::test();
|
||||
}
|
||||
|
||||
if (p_test=="physics_2d") {
|
||||
|
||||
return TestPhysics2D::test();
|
||||
}
|
||||
|
||||
if (p_test=="misc") {
|
||||
|
||||
return TestMisc::test();
|
||||
}
|
||||
|
||||
if (p_test=="render") {
|
||||
|
||||
return TestRender::test();
|
||||
}
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
if (p_test=="gui") {
|
||||
|
||||
return TestGUI::test();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (p_test=="sound") {
|
||||
|
||||
return TestSound::test();
|
||||
}
|
||||
|
||||
if (p_test=="io") {
|
||||
|
||||
return TestIO::test();
|
||||
}
|
||||
|
||||
if (p_test=="particles") {
|
||||
|
||||
return TestParticles::test();
|
||||
}
|
||||
|
||||
if (p_test=="multimesh") {
|
||||
|
||||
return TestMultiMesh::test();
|
||||
}
|
||||
|
||||
if (p_test=="shaderlang") {
|
||||
|
||||
return TestShaderLang::test();
|
||||
}
|
||||
|
||||
if (p_test=="gd_tokenizer") {
|
||||
|
||||
return TestGDScript::test(TestGDScript::TEST_TOKENIZER);
|
||||
}
|
||||
|
||||
if (p_test=="gd_parser") {
|
||||
|
||||
return TestGDScript::test(TestGDScript::TEST_PARSER);
|
||||
}
|
||||
|
||||
if (p_test=="gd_compiler") {
|
||||
|
||||
return TestGDScript::test(TestGDScript::TEST_COMPILER);
|
||||
}
|
||||
|
||||
if (p_test=="gd_bytecode") {
|
||||
|
||||
return TestGDScript::test(TestGDScript::TEST_BYTECODE);
|
||||
}
|
||||
|
||||
if (p_test=="image") {
|
||||
|
||||
return TestImage::test();
|
||||
}
|
||||
|
||||
if (p_test=="detailer") {
|
||||
|
||||
return TestMultiMesh::test();
|
||||
}
|
||||
|
||||
#ifdef PYTHON_ENABLED
|
||||
|
||||
if (p_test=="python") {
|
||||
|
||||
return TestPython::test();
|
||||
}
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
const char ** tests_get_names() {
|
||||
|
||||
static const char* test_names[]={
|
||||
NULL
|
||||
};
|
||||
|
||||
return test_names;
|
||||
}
|
||||
|
||||
MainLoop* test_main(String p_test,const List<String>& p_args) {
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
41
bin/tests/test_main.h
Normal file
41
bin/tests/test_main.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*************************************************************************/
|
||||
/* test_main.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef TEST_MAIN_H
|
||||
#define TEST_MAIN_H
|
||||
|
||||
#include "ustring.h"
|
||||
#include "list.h"
|
||||
|
||||
const char ** tests_get_names();
|
||||
MainLoop* test_main(String p_test,const List<String>& p_args);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
301
bin/tests/test_math.cpp
Normal file
301
bin/tests/test_math.cpp
Normal file
@ -0,0 +1,301 @@
|
||||
/*************************************************************************/
|
||||
/* test_math.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "test_math.h"
|
||||
#include "ustring.h"
|
||||
#include "print_string.h"
|
||||
#include "transform.h"
|
||||
#include "matrix3.h"
|
||||
#include "math_funcs.h"
|
||||
#include "camera_matrix.h"
|
||||
#include "scene/main/node.h"
|
||||
#include "variant.h"
|
||||
#include "servers/visual/shader_language.h"
|
||||
#include "os/keyboard.h"
|
||||
#include "scene/resources/texture.h"
|
||||
#include "vmap.h"
|
||||
#include "os/os.h"
|
||||
namespace TestMath {
|
||||
|
||||
|
||||
void test_vec(Plane p_vec) {
|
||||
|
||||
|
||||
CameraMatrix cm;
|
||||
cm.set_perspective(45,1,0,100);
|
||||
Plane v0=cm.xform4(p_vec);
|
||||
|
||||
print_line("out: "+v0);
|
||||
v0.normal.z = (v0.d/100.0 *2.0-1.0) * v0.d;
|
||||
print_line("out_F: "+v0);
|
||||
|
||||
|
||||
/*v0: 0, 0, -0.1, 0.1
|
||||
v1: 0, 0, 0, 0.1
|
||||
fix: 0, 0, 0, 0.1
|
||||
v0: 0, 0, 1.302803, 1.5
|
||||
v1: 0, 0, 1.401401, 1.5
|
||||
fix: 0, 0, 1.401401, 1.5
|
||||
v0: 0, 0, 25.851850, 26
|
||||
v1: 0, 0, 25.925926, 26
|
||||
fix: 0, 0, 25.925924, 26
|
||||
v0: 0, 0, 49.899902, 50
|
||||
v1: 0, 0, 49.949947, 50
|
||||
fix: 0, 0, 49.949951, 50
|
||||
v0: 0, 0, 100, 100
|
||||
v1: 0, 0, 100, 100
|
||||
fix: 0, 0, 100, 100
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
MainLoop* test() {
|
||||
|
||||
{
|
||||
|
||||
|
||||
// print_line("NUM: "+itos(237641278346127));
|
||||
print_line("NUM: "+itos(-128));
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
Vector3 v(1,2,3);
|
||||
v.normalize();
|
||||
float a=0.3;
|
||||
|
||||
//Quat q(v,a);
|
||||
Matrix3 m(v,a);
|
||||
|
||||
Vector3 v2(7,3,1);
|
||||
v2.normalize();
|
||||
float a2=0.8;
|
||||
|
||||
//Quat q(v,a);
|
||||
Matrix3 m2(v2,a2);
|
||||
|
||||
Quat q=m;
|
||||
Quat q2=m2;
|
||||
|
||||
Matrix3 m3 = m.inverse() * m2;
|
||||
Quat q3 = (q.inverse() * q2);//.normalized();
|
||||
|
||||
print_line(Quat(m3));
|
||||
print_line(q3);
|
||||
|
||||
print_line("before v: "+v+" a: "+rtos(a));
|
||||
q.get_axis_and_angle(v,a);
|
||||
print_line("after v: "+v+" a: "+rtos(a));
|
||||
}
|
||||
|
||||
return NULL;
|
||||
String ret;
|
||||
|
||||
List<String> args;
|
||||
args.push_back("-l");
|
||||
Error err = OS::get_singleton()->execute("/bin/ls",args,true,NULL,&ret);
|
||||
print_line("error: "+itos(err));
|
||||
print_line(ret);
|
||||
|
||||
return NULL;
|
||||
Matrix3 m3;
|
||||
m3.rotate(Vector3(1,0,0),0.2);
|
||||
m3.rotate(Vector3(0,1,0),1.77);
|
||||
m3.rotate(Vector3(0,0,1),212);
|
||||
Matrix3 m32;
|
||||
m32.set_euler(m3.get_euler());
|
||||
print_line("ELEULEEEEEEEEEEEEEEEEEER: "+m3.get_euler()+" vs "+m32.get_euler());
|
||||
|
||||
|
||||
return NULL;
|
||||
|
||||
{
|
||||
|
||||
Dictionary d;
|
||||
d["momo"]=1;
|
||||
Dictionary b=d;
|
||||
b["44"]=4;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return NULL;
|
||||
print_line("inters: "+rtos(Geometry::segment_intersects_circle(Vector2(-5,0),Vector2(-2,0),Vector2(),1.0)));
|
||||
|
||||
|
||||
|
||||
print_line("cross: "+Vector3(1,2,3).cross(Vector3(4,5,7)));
|
||||
print_line("dot: "+rtos(Vector3(1,2,3).dot(Vector3(4,5,7))));
|
||||
print_line("abs: "+Vector3(-1,2,-3).abs());
|
||||
print_line("distance_to: "+rtos(Vector3(1,2,3).distance_to(Vector3(4,5,7))));
|
||||
print_line("distance_squared_to: "+rtos(Vector3(1,2,3).distance_squared_to(Vector3(4,5,7))));
|
||||
print_line("plus: "+(Vector3(1,2,3)+Vector3(Vector3(4,5,7))));
|
||||
print_line("minus: "+(Vector3(1,2,3)-Vector3(Vector3(4,5,7))));
|
||||
print_line("mul: "+(Vector3(1,2,3)*Vector3(Vector3(4,5,7))));
|
||||
print_line("div: "+(Vector3(1,2,3)/Vector3(Vector3(4,5,7))));
|
||||
print_line("mul scalar: "+(Vector3(1,2,3)*2));
|
||||
print_line("premul scalar: "+(2*Vector3(1,2,3)));
|
||||
print_line("div scalar: "+(Vector3(1,2,3)/3.0));
|
||||
print_line("length: "+rtos(Vector3(1,2,3).length()));
|
||||
print_line("length squared: "+rtos(Vector3(1,2,3).length_squared()));
|
||||
print_line("normalized: "+Vector3(1,2,3).normalized());
|
||||
print_line("inverse: "+Vector3(1,2,3).inverse());
|
||||
|
||||
{
|
||||
Vector3 v(4,5,7);
|
||||
v.normalize();
|
||||
print_line("normalize: "+v);
|
||||
}
|
||||
|
||||
{
|
||||
Vector3 v(4,5,7);
|
||||
v+=Vector3(1,2,3);
|
||||
print_line("+=: "+v);
|
||||
}
|
||||
|
||||
{
|
||||
Vector3 v(4,5,7);
|
||||
v-=Vector3(1,2,3);
|
||||
print_line("-=: "+v);
|
||||
}
|
||||
|
||||
{
|
||||
Vector3 v(4,5,7);
|
||||
v*=Vector3(1,2,3);
|
||||
print_line("*=: "+v);
|
||||
}
|
||||
|
||||
{
|
||||
Vector3 v(4,5,7);
|
||||
v/=Vector3(1,2,3);
|
||||
print_line("/=: "+v);
|
||||
}
|
||||
|
||||
{
|
||||
Vector3 v(4,5,7);
|
||||
v*=2.0;
|
||||
print_line("scalar *=: "+v);
|
||||
}
|
||||
|
||||
{
|
||||
Vector3 v(4,5,7);
|
||||
v/=2.0;
|
||||
print_line("scalar /=: "+v);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
print_line(String("C:\\momo\\.\\popo\\..\\gongo").simplify_path());
|
||||
print_line(String("res://../popo/..//gongo").simplify_path());
|
||||
print_line(String("res://..").simplify_path());
|
||||
|
||||
|
||||
DVector<uint8_t> a;
|
||||
DVector<uint8_t> b;
|
||||
|
||||
a.resize(20);
|
||||
b=a;
|
||||
b.resize(30);
|
||||
a=b;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
String za = String::utf8("á");
|
||||
printf("unicode: %x\n",za[0]);
|
||||
CharString cs=za.utf8();
|
||||
for(int i=0;i<cs.size();i++) {
|
||||
uint32_t v = uint8_t(cs[i]);
|
||||
printf("%i - %x\n",i,v);
|
||||
}
|
||||
return NULL;
|
||||
|
||||
print_line(String("C:\\window\\system\\momo").path_to("C:\\window\\momonga"));
|
||||
print_line(String("res://momo/sampler").path_to("res://pindonga"));
|
||||
print_line(String("/margarito/terere").path_to("/margarito/pilates"));
|
||||
print_line(String("/algo").path_to("/algo"));
|
||||
print_line(String("c:").path_to("c:\\"));
|
||||
print_line(String("/").path_to("/"));
|
||||
|
||||
|
||||
print_line(itos(sizeof(Variant)));
|
||||
return NULL;
|
||||
|
||||
Vector<StringName> path;
|
||||
path.push_back("three");
|
||||
path.push_back("two");
|
||||
path.push_back("one");
|
||||
path.push_back("comeon");
|
||||
path.revert();
|
||||
|
||||
NodePath np(path,true);
|
||||
|
||||
print_line(np);
|
||||
|
||||
|
||||
return NULL;
|
||||
|
||||
bool a=2;
|
||||
|
||||
print_line(Variant(a));
|
||||
|
||||
|
||||
Matrix32 mat2_1;
|
||||
mat2_1.rotate(0.5);
|
||||
Matrix32 mat2_2;
|
||||
mat2_2.translate(Vector2(1,2));
|
||||
Matrix32 mat2_3 = mat2_1 * mat2_2;
|
||||
mat2_3.affine_invert();
|
||||
|
||||
print_line(mat2_3.elements[0]);
|
||||
print_line(mat2_3.elements[1]);
|
||||
print_line(mat2_3.elements[2]);
|
||||
|
||||
|
||||
|
||||
Transform mat3_1;
|
||||
mat3_1.basis.rotate(Vector3(0,0,1),0.5);
|
||||
Transform mat3_2;
|
||||
mat3_2.translate(Vector3(1,2,0));
|
||||
Transform mat3_3 = mat3_1 * mat3_2;
|
||||
mat3_3.affine_invert();
|
||||
|
||||
print_line(mat3_3.basis.get_axis(0));
|
||||
print_line(mat3_3.basis.get_axis(1));
|
||||
print_line(mat3_3.origin);
|
||||
|
||||
#endif
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
40
bin/tests/test_math.h
Normal file
40
bin/tests/test_math.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*************************************************************************/
|
||||
/* test_math.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef TEST_MATH_H
|
||||
#define TEST_MATH_H
|
||||
|
||||
#include "os/main_loop.h"
|
||||
|
||||
namespace TestMath {
|
||||
|
||||
MainLoop* test();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
499
bin/tests/test_misc.cpp
Normal file
499
bin/tests/test_misc.cpp
Normal file
@ -0,0 +1,499 @@
|
||||
/*************************************************************************/
|
||||
/* test_misc.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "test_misc.h"
|
||||
#include "servers/visual_server.h"
|
||||
#include "os/main_loop.h"
|
||||
#include "math_funcs.h"
|
||||
#include "print_string.h"
|
||||
|
||||
|
||||
namespace TestMisc {
|
||||
|
||||
struct ConvexTestResult
|
||||
{
|
||||
|
||||
Vector3 edgeA[2];
|
||||
Vector3 edgeB[2];
|
||||
bool valid;
|
||||
Vector3 contactA;
|
||||
Vector3 contactB;
|
||||
Vector3 contactNormal;
|
||||
float depth;
|
||||
|
||||
/*
|
||||
Vector3 contactA;
|
||||
Vector3 contactB;
|
||||
Vector3 contactNormal;
|
||||
Vector3 contactX;
|
||||
Vector3 contactY;
|
||||
Vector3 edgeA[2];
|
||||
Vector3 edgeB[2];
|
||||
float depth;
|
||||
bool valid;
|
||||
bool isEdgeEdge;
|
||||
bool needTransform;
|
||||
neBool ComputerEdgeContactPoint(ConvexTestResult & res);
|
||||
neBool ComputerEdgeContactPoint2(float & au, float & bu);
|
||||
void Reverse()
|
||||
{
|
||||
neSwap(contactA, contactB);
|
||||
contactNormal *= -1.0f;
|
||||
}*/
|
||||
bool ComputerEdgeContactPoint2(float & au, float & bu);
|
||||
};
|
||||
|
||||
|
||||
|
||||
bool ConvexTestResult::ComputerEdgeContactPoint2(float & au, float & bu)
|
||||
{
|
||||
float d1343, d4321, d1321, d4343, d2121;
|
||||
float numer, denom;
|
||||
|
||||
Vector3 p13;
|
||||
Vector3 p43;
|
||||
Vector3 p21;
|
||||
Vector3 diff;
|
||||
|
||||
p13 = (edgeA[0]) - (edgeB[0]);
|
||||
p43 = (edgeB[1]) - (edgeB[0]);
|
||||
|
||||
if ( p43.length_squared() < CMP_EPSILON2 )
|
||||
{
|
||||
valid = false;
|
||||
goto ComputerEdgeContactPoint2_Exit;
|
||||
}
|
||||
|
||||
p21 = (edgeA[1]) - (edgeA[0]);
|
||||
|
||||
if ( p21.length_squared()<CMP_EPSILON2 )
|
||||
{
|
||||
valid = false;
|
||||
goto ComputerEdgeContactPoint2_Exit;
|
||||
}
|
||||
|
||||
d1343 = p13.dot(p43);
|
||||
d4321 = p43.dot(p21);
|
||||
d1321 = p13.dot(p21);
|
||||
d4343 = p43.dot(p43);
|
||||
d2121 = p21.dot(p21);
|
||||
|
||||
denom = d2121 * d4343 - d4321 * d4321;
|
||||
|
||||
if (ABS(denom) < CMP_EPSILON)
|
||||
{
|
||||
valid = false;
|
||||
|
||||
goto ComputerEdgeContactPoint2_Exit;
|
||||
}
|
||||
|
||||
numer = d1343 * d4321 - d1321 * d4343;
|
||||
au = numer / denom;
|
||||
bu = (d1343 + d4321 * (au)) / d4343;
|
||||
|
||||
if (au < 0.0f || au >= 1.0f)
|
||||
{
|
||||
valid = false;
|
||||
}
|
||||
else if (bu < 0.0f || bu >= 1.0f)
|
||||
{
|
||||
valid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
valid = true;
|
||||
}
|
||||
{
|
||||
Vector3 tmpv;
|
||||
|
||||
tmpv = p21 * au;
|
||||
contactA = (edgeA[0]) + tmpv;
|
||||
|
||||
tmpv = p43 * bu;
|
||||
contactB = (edgeB[0]) + tmpv;
|
||||
}
|
||||
|
||||
diff = contactA - contactB;
|
||||
|
||||
depth = Math::sqrt(diff.dot(diff));
|
||||
|
||||
return true;
|
||||
|
||||
ComputerEdgeContactPoint2_Exit:
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
struct neCollisionResult {
|
||||
|
||||
float depth;
|
||||
bool penetrate;
|
||||
Matrix3 collisionFrame;
|
||||
Vector3 contactA;
|
||||
Vector3 contactB;
|
||||
};
|
||||
|
||||
|
||||
struct TConvex {
|
||||
|
||||
float radius;
|
||||
float half_height;
|
||||
float CylinderRadius() const { return radius; }
|
||||
float CylinderHalfHeight() const { return half_height; }
|
||||
};
|
||||
|
||||
float GetDistanceFromLine2(Vector3 v, Vector3 & project, const Vector3 & pointA, const Vector3 & pointB)
|
||||
{
|
||||
Vector3 ba = pointB - pointA;
|
||||
|
||||
float len = ba.length();
|
||||
|
||||
if (len<CMP_EPSILON)
|
||||
ba=Vector3();
|
||||
else
|
||||
ba *= 1.0f / len;
|
||||
|
||||
Vector3 pa = v - pointA;
|
||||
|
||||
float k = pa.dot(ba);
|
||||
|
||||
project = pointA + ba * k;
|
||||
|
||||
Vector3 diff = v - project;
|
||||
|
||||
return diff.length();
|
||||
}
|
||||
|
||||
void TestCylinderVertEdge(neCollisionResult & result, Vector3 & edgeA1, Vector3 & edgeA2, Vector3 & vertB,
|
||||
TConvex & cA, TConvex & cB, Transform & transA, Transform & transB, bool flip)
|
||||
{
|
||||
Vector3 project;
|
||||
|
||||
float dist = GetDistanceFromLine2(vertB,project, edgeA1, edgeA2);
|
||||
|
||||
float depth = cA.CylinderRadius() + cB.CylinderRadius() - dist;
|
||||
|
||||
if (depth <= 0.0f)
|
||||
return;
|
||||
|
||||
if (depth <= result.depth)
|
||||
return;
|
||||
|
||||
result.penetrate = true;
|
||||
|
||||
result.depth = depth;
|
||||
|
||||
if (!flip)
|
||||
{
|
||||
result.collisionFrame.set_axis(2,(project - vertB).normalized());
|
||||
|
||||
result.contactA = project - result.collisionFrame.get_axis(2) * cA.CylinderRadius();
|
||||
|
||||
result.contactB = vertB + result.collisionFrame.get_axis(2) * cB.CylinderRadius();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
result.collisionFrame.set_axis(2,(vertB - project).normalized());
|
||||
|
||||
result.contactA = vertB - result.collisionFrame.get_axis(2) * cB.CylinderRadius();
|
||||
|
||||
result.contactB = project + result.collisionFrame.get_axis(2) * cA.CylinderRadius();
|
||||
}
|
||||
}
|
||||
|
||||
void TestCylinderVertVert(neCollisionResult & result, Vector3 & vertA, Vector3 & vertB,
|
||||
TConvex & cA, TConvex & cB, Transform & transA, Transform & transB)
|
||||
{
|
||||
Vector3 diff = vertA - vertB;
|
||||
|
||||
float dist = diff.length();
|
||||
|
||||
float depth = cA.CylinderRadius() + cB.CylinderRadius() - dist;
|
||||
|
||||
if (depth <= 0.0f)
|
||||
return;
|
||||
|
||||
if (depth <= result.depth)
|
||||
return;
|
||||
|
||||
result.penetrate = true;
|
||||
|
||||
result.depth = depth;
|
||||
|
||||
result.collisionFrame.set_axis(2, diff * (1.0f / dist));
|
||||
|
||||
result.contactA = vertA - result.collisionFrame.get_axis(2) * cA.CylinderRadius();
|
||||
|
||||
result.contactB = vertB + result.collisionFrame.get_axis(2) * cB.CylinderRadius();
|
||||
}
|
||||
|
||||
void Cylinder2CylinderTest(neCollisionResult & result, TConvex & cA, Transform & transA, TConvex & cB, Transform & transB)
|
||||
{
|
||||
result.penetrate = false;
|
||||
|
||||
Vector3 dir = transA.basis.get_axis(1).cross(transB.basis.get_axis(1));
|
||||
|
||||
float len = dir.length();
|
||||
|
||||
// bool isParallel = len<CMP_EPSILON;
|
||||
|
||||
// int doVertCheck = 0;
|
||||
|
||||
ConvexTestResult cr;
|
||||
|
||||
cr.edgeA[0] = transA.origin + transA.basis.get_axis(1) * cA.CylinderHalfHeight();
|
||||
cr.edgeA[1] = transA.origin - transA.basis.get_axis(1) * cA.CylinderHalfHeight();
|
||||
cr.edgeB[0] = transB.origin + transB.basis.get_axis(1) * cB.CylinderHalfHeight();
|
||||
cr.edgeB[1] = transB.origin - transB.basis.get_axis(1) * cB.CylinderHalfHeight();
|
||||
|
||||
// float dot = transA.basis.get_axis(1).dot(transB.basis.get_axis(1));
|
||||
|
||||
if (len>CMP_EPSILON)
|
||||
{
|
||||
float au, bu;
|
||||
|
||||
cr.ComputerEdgeContactPoint2(au, bu);
|
||||
|
||||
if (cr.valid)
|
||||
{
|
||||
float depth = cA.CylinderRadius() + cB.CylinderRadius() - cr.depth;
|
||||
|
||||
if (depth <= 0.0f)
|
||||
return;
|
||||
|
||||
result.depth = depth;
|
||||
|
||||
result.penetrate = true;
|
||||
|
||||
result.collisionFrame.set_axis(2, (cr.contactA - cr.contactB)*(1.0f / cr.depth));
|
||||
|
||||
result.contactA = cr.contactA - result.collisionFrame.get_axis(2) * cA.CylinderRadius();
|
||||
|
||||
result.contactB = cr.contactB + result.collisionFrame.get_axis(2) * cB.CylinderRadius();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
result.depth = -1.0e6f;
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
//project onto edge b
|
||||
|
||||
Vector3 diff = cr.edgeA[i] - cr.edgeB[1];
|
||||
|
||||
float dot = diff.dot(transB.basis.get_axis(1));
|
||||
|
||||
if (dot < 0.0f)
|
||||
{
|
||||
TestCylinderVertVert(result, cr.edgeA[i], cr.edgeB[1], cA, cB, transA, transB);
|
||||
}
|
||||
else if (dot > (2.0f * cB.CylinderHalfHeight()))
|
||||
{
|
||||
TestCylinderVertVert(result, cr.edgeA[i], cr.edgeB[0], cA, cB, transA, transB);
|
||||
}
|
||||
else
|
||||
{
|
||||
TestCylinderVertEdge(result, cr.edgeB[0], cr.edgeB[1], cr.edgeA[i], cB, cA, transB, transA, true);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
//project onto edge b
|
||||
|
||||
Vector3 diff = cr.edgeB[i] - cr.edgeA[1];
|
||||
|
||||
float dot = diff.dot(transA.basis.get_axis(1));
|
||||
|
||||
if (dot < 0.0f)
|
||||
{
|
||||
TestCylinderVertVert(result, cr.edgeB[i], cr.edgeA[1], cA, cB, transA, transB);
|
||||
}
|
||||
else if (dot > (2.0f * cB.CylinderHalfHeight()))
|
||||
{
|
||||
TestCylinderVertVert(result, cr.edgeB[i], cr.edgeA[0], cA, cB, transA, transB);
|
||||
}
|
||||
else
|
||||
{
|
||||
TestCylinderVertEdge(result, cr.edgeA[0], cr.edgeA[1], cr.edgeB[i], cA, cB, transA, transB, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class TestMainLoop : public MainLoop {
|
||||
|
||||
RID meshA;
|
||||
RID meshB;
|
||||
RID poly;
|
||||
RID instance;
|
||||
RID camera;
|
||||
RID viewport;
|
||||
RID boxA;
|
||||
RID boxB;
|
||||
RID scenario;
|
||||
|
||||
Transform rot_a;
|
||||
Transform rot_b;
|
||||
|
||||
bool quit;
|
||||
public:
|
||||
virtual void input_event(const InputEvent& p_event) {
|
||||
|
||||
if (p_event.type==InputEvent::MOUSE_MOTION && p_event.mouse_motion.button_mask&BUTTON_MASK_LEFT) {
|
||||
|
||||
rot_b.origin.y+=-p_event.mouse_motion.relative_y/100.0;
|
||||
rot_b.origin.x+=p_event.mouse_motion.relative_x/100.0;
|
||||
}
|
||||
if (p_event.type==InputEvent::MOUSE_MOTION && p_event.mouse_motion.button_mask&BUTTON_MASK_MIDDLE) {
|
||||
|
||||
//rot_b.origin.x+=-p_event.mouse_motion.relative_y/100.0;
|
||||
rot_b.origin.z+=p_event.mouse_motion.relative_x/100.0;
|
||||
}
|
||||
if (p_event.type==InputEvent::MOUSE_MOTION && p_event.mouse_motion.button_mask&BUTTON_MASK_RIGHT) {
|
||||
|
||||
float rot_x=-p_event.mouse_motion.relative_y/100.0;
|
||||
float rot_y=p_event.mouse_motion.relative_x/100.0;
|
||||
rot_b.basis = rot_b.basis * Matrix3(Vector3(1,0,0),rot_x) * Matrix3(Vector3(0,1,0),rot_y);
|
||||
}
|
||||
|
||||
}
|
||||
virtual void request_quit() {
|
||||
|
||||
quit=true;
|
||||
}
|
||||
virtual void init() {
|
||||
|
||||
VisualServer *vs=VisualServer::get_singleton();
|
||||
|
||||
camera = vs->camera_create();
|
||||
|
||||
viewport = vs->viewport_create();
|
||||
vs->viewport_attach_to_screen(viewport);
|
||||
vs->viewport_attach_camera( viewport, camera );
|
||||
vs->camera_set_transform(camera, Transform( Matrix3(), Vector3(0,0,3 ) ) );
|
||||
|
||||
/* CONVEX SHAPE */
|
||||
|
||||
DVector<Plane> cylinder_planes = Geometry::build_cylinder_planes(0.5,2,9,Vector3::AXIS_Y);
|
||||
RID cylinder_material = vs->fixed_material_create();
|
||||
vs->fixed_material_set_param( cylinder_material, VisualServer::FIXED_MATERIAL_PARAM_DIFFUSE, Color(0.8,0.2,0.9));
|
||||
vs->material_set_flag( cylinder_material, VisualServer::MATERIAL_FLAG_ONTOP,true);
|
||||
//vs->material_set_flag( cylinder_material, VisualServer::MATERIAL_FLAG_WIREFRAME,true);
|
||||
vs->material_set_flag( cylinder_material, VisualServer::MATERIAL_FLAG_DOUBLE_SIDED,true);
|
||||
vs->material_set_flag( cylinder_material, VisualServer::MATERIAL_FLAG_UNSHADED,true);
|
||||
|
||||
RID cylinder_mesh = vs->mesh_create();
|
||||
Geometry::MeshData cylinder_data = Geometry::build_convex_mesh(cylinder_planes);
|
||||
vs->mesh_add_surface_from_mesh_data(cylinder_mesh,cylinder_data);
|
||||
vs->mesh_surface_set_material( cylinder_mesh, 0, cylinder_material );
|
||||
|
||||
meshA=vs->instance_create2(cylinder_mesh,scenario);
|
||||
meshB=vs->instance_create2(cylinder_mesh,scenario);
|
||||
boxA=vs->instance_create2(vs->get_test_cube(),scenario);
|
||||
boxB=vs->instance_create2(vs->get_test_cube(),scenario);
|
||||
|
||||
/*
|
||||
RID lightaux = vs->light_create( VisualServer::LIGHT_OMNI );
|
||||
vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_RADIUS, 80 );
|
||||
vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_ATTENUATION, 1 );
|
||||
vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_ENERGY, 1.5 );
|
||||
light = vs->instance_create2( lightaux );
|
||||
*/
|
||||
RID lightaux = vs->light_create( VisualServer::LIGHT_DIRECTIONAL );
|
||||
//vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,0.0) );
|
||||
//vs->light_set_shadow( lightaux, true );
|
||||
RID light = vs->instance_create2( lightaux,scenario );
|
||||
|
||||
//rot_a=Transform(Matrix3(Vector3(1,0,0),Math_PI/2.0),Vector3());
|
||||
rot_b=Transform(Matrix3(),Vector3(2,0,0));
|
||||
|
||||
//rot_x=0;
|
||||
//rot_y=0;
|
||||
quit=false;
|
||||
}
|
||||
virtual bool idle(float p_time) {
|
||||
|
||||
VisualServer *vs=VisualServer::get_singleton();
|
||||
|
||||
vs->instance_set_transform(meshA,rot_a);
|
||||
vs->instance_set_transform(meshB,rot_b);
|
||||
|
||||
|
||||
neCollisionResult res;
|
||||
TConvex a;
|
||||
a.radius=0.5;
|
||||
a.half_height=1;
|
||||
Cylinder2CylinderTest(res,a,rot_a,a,rot_b);
|
||||
if (res.penetrate) {
|
||||
|
||||
Matrix3 scale;
|
||||
scale.scale(Vector3(0.1,0.1,0.1));
|
||||
vs->instance_set_transform(boxA,Transform(scale,res.contactA));
|
||||
vs->instance_set_transform(boxB,Transform(scale,res.contactB));
|
||||
print_line("depth: "+rtos(res.depth));
|
||||
} else {
|
||||
|
||||
Matrix3 scale;
|
||||
scale.scale(Vector3());
|
||||
vs->instance_set_transform(boxA,Transform(scale,res.contactA));
|
||||
vs->instance_set_transform(boxB,Transform(scale,res.contactB));
|
||||
|
||||
}
|
||||
print_line("collided: "+itos(res.penetrate));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
virtual bool iteration(float p_time) {
|
||||
|
||||
|
||||
|
||||
return quit;
|
||||
}
|
||||
virtual void finish() {
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
MainLoop* test() {
|
||||
|
||||
return memnew( TestMainLoop );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
40
bin/tests/test_misc.h
Normal file
40
bin/tests/test_misc.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*************************************************************************/
|
||||
/* test_misc.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef TEST_MISC_H
|
||||
#define TEST_MISC_H
|
||||
|
||||
#include "os/main_loop.h"
|
||||
|
||||
namespace TestMisc {
|
||||
|
||||
MainLoop* test();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
121
bin/tests/test_particles.cpp
Normal file
121
bin/tests/test_particles.cpp
Normal file
@ -0,0 +1,121 @@
|
||||
/*************************************************************************/
|
||||
/* test_particles.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "test_particles.h"
|
||||
#include "servers/visual_server.h"
|
||||
#include "os/main_loop.h"
|
||||
#include "math_funcs.h"
|
||||
#include "print_string.h"
|
||||
|
||||
namespace TestParticles {
|
||||
|
||||
|
||||
class TestMainLoop : public MainLoop {
|
||||
|
||||
RID particles;
|
||||
RID instance;
|
||||
RID camera;
|
||||
RID viewport;
|
||||
RID light;
|
||||
RID scenario;
|
||||
|
||||
struct InstanceInfo {
|
||||
|
||||
RID instance;
|
||||
Transform base;
|
||||
Vector3 rot_axis;
|
||||
};
|
||||
|
||||
List<InstanceInfo> instances;
|
||||
|
||||
float ofs;
|
||||
bool quit;
|
||||
public:
|
||||
virtual void input_event(const InputEvent& p_event) {
|
||||
|
||||
|
||||
}
|
||||
virtual void request_quit() {
|
||||
|
||||
quit=true;
|
||||
}
|
||||
virtual void init() {
|
||||
|
||||
VisualServer *vs=VisualServer::get_singleton();
|
||||
particles = vs->particles_create();
|
||||
vs->particles_set_amount(particles,1000);
|
||||
|
||||
instance = vs->instance_create2(particles,scenario);
|
||||
|
||||
|
||||
camera = vs->camera_create();
|
||||
|
||||
// vs->camera_set_perspective( camera, 60.0,0.1, 100.0 );
|
||||
viewport = vs->viewport_create();
|
||||
vs->viewport_attach_camera( viewport, camera );
|
||||
vs->camera_set_transform(camera, Transform( Matrix3(), Vector3(0,0,20 ) ) );
|
||||
/*
|
||||
RID lightaux = vs->light_create( VisualServer::LIGHT_OMNI );
|
||||
vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_RADIUS, 80 );
|
||||
vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_ATTENUATION, 1 );
|
||||
vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_ENERGY, 1.5 );
|
||||
light = vs->instance_create2( lightaux );
|
||||
*/
|
||||
RID lightaux = vs->light_create( VisualServer::LIGHT_DIRECTIONAL );
|
||||
// vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,0.0) );
|
||||
light = vs->instance_create2( lightaux, scenario );
|
||||
|
||||
ofs=0;
|
||||
quit=false;
|
||||
}
|
||||
virtual bool idle(float p_time) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
virtual bool iteration(float p_time) {
|
||||
|
||||
// VisualServer *vs=VisualServer::get_singleton();
|
||||
|
||||
ofs+=p_time;
|
||||
return quit;
|
||||
}
|
||||
virtual void finish() {
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
MainLoop* test() {
|
||||
|
||||
return memnew( TestMainLoop );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
43
bin/tests/test_particles.h
Normal file
43
bin/tests/test_particles.h
Normal file
@ -0,0 +1,43 @@
|
||||
/*************************************************************************/
|
||||
/* test_particles.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef TEST_PARTICLES_H
|
||||
#define TEST_PARTICLES_H
|
||||
|
||||
/**
|
||||
@author Juan Linietsky <reduzio@gmail.com>
|
||||
*/
|
||||
#include "os/main_loop.h"
|
||||
|
||||
namespace TestParticles {
|
||||
|
||||
MainLoop* test();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
662
bin/tests/test_physics.cpp
Normal file
662
bin/tests/test_physics.cpp
Normal file
@ -0,0 +1,662 @@
|
||||
/*************************************************************************/
|
||||
/* test_physics.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "test_physics.h"
|
||||
|
||||
|
||||
#include "servers/visual_server.h"
|
||||
#include "servers/physics_server.h"
|
||||
#include "os/main_loop.h"
|
||||
#include "math_funcs.h"
|
||||
#include "print_string.h"
|
||||
#include "map.h"
|
||||
#include "os/os.h"
|
||||
#include "quick_hull.h"
|
||||
|
||||
class TestPhysicsMainLoop : public MainLoop {
|
||||
|
||||
OBJ_TYPE( TestPhysicsMainLoop, MainLoop );
|
||||
|
||||
enum {
|
||||
LINK_COUNT = 20,
|
||||
};
|
||||
|
||||
RID test_cube;
|
||||
|
||||
RID plane;
|
||||
RID sphere;
|
||||
RID light;
|
||||
RID camera;
|
||||
RID mover;
|
||||
RID scenario;
|
||||
RID space;
|
||||
|
||||
RID character;
|
||||
|
||||
float ofs_x,ofs_y;
|
||||
|
||||
Point2 joy_direction;
|
||||
|
||||
List<RID> bodies;
|
||||
Map<PhysicsServer::ShapeType,RID> type_shape_map;
|
||||
Map<PhysicsServer::ShapeType,RID> type_mesh_map;
|
||||
|
||||
void body_changed_transform(Object *p_state, RID p_visual_instance) {
|
||||
|
||||
PhysicsDirectBodyState *state = (PhysicsDirectBodyState*)p_state;
|
||||
VisualServer *vs=VisualServer::get_singleton();
|
||||
Transform t=state->get_transform();
|
||||
//t.basis.scale( Vector3(1.0,0.5,0.2) );
|
||||
vs->instance_set_transform(p_visual_instance,t);
|
||||
}
|
||||
|
||||
bool quit;
|
||||
|
||||
protected:
|
||||
|
||||
static void _bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method("body_changed_transform",&TestPhysicsMainLoop::body_changed_transform);
|
||||
}
|
||||
|
||||
RID create_body(PhysicsServer::ShapeType p_shape, PhysicsServer::BodyMode p_body,const Transform p_location,bool p_active_default=true,const Transform&p_shape_xform=Transform()) {
|
||||
|
||||
VisualServer *vs=VisualServer::get_singleton();
|
||||
PhysicsServer * ps = PhysicsServer::get_singleton();
|
||||
|
||||
RID mesh_instance = vs->instance_create2(type_mesh_map[p_shape],scenario);
|
||||
RID body = ps->body_create(p_body,!p_active_default);
|
||||
ps->body_set_space(body,space);
|
||||
ps->body_set_param(body,PhysicsServer::BODY_PARAM_BOUNCE,0.0);
|
||||
//todo set space
|
||||
ps->body_add_shape(body,type_shape_map[p_shape]);
|
||||
ps->body_set_force_integration_callback(body,this,"body_changed_transform",mesh_instance);
|
||||
|
||||
ps->body_set_state( body, PhysicsServer::BODY_STATE_TRANSFORM,p_location);
|
||||
bodies.push_back(body);
|
||||
|
||||
if (p_body==PhysicsServer::BODY_MODE_STATIC) {
|
||||
|
||||
vs->instance_set_transform(mesh_instance,p_location);
|
||||
}
|
||||
return body;
|
||||
}
|
||||
|
||||
RID create_static_plane(const Plane& p_plane) {
|
||||
|
||||
PhysicsServer * ps = PhysicsServer::get_singleton();
|
||||
|
||||
RID plane_shape = ps->shape_create(PhysicsServer::SHAPE_PLANE);;
|
||||
ps->shape_set_data( plane_shape, p_plane );
|
||||
|
||||
RID b = ps->body_create( PhysicsServer::BODY_MODE_STATIC );
|
||||
ps->body_set_space(b,space);
|
||||
//todo set space
|
||||
ps->body_add_shape(b, plane_shape);
|
||||
return b;
|
||||
|
||||
}
|
||||
|
||||
void configure_body(RID p_body,float p_mass, float p_friction, float p_bounce) {
|
||||
|
||||
PhysicsServer * ps = PhysicsServer::get_singleton();
|
||||
ps->body_set_param( p_body, PhysicsServer::BODY_PARAM_MASS, p_mass );
|
||||
ps->body_set_param( p_body, PhysicsServer::BODY_PARAM_FRICTION, p_friction );
|
||||
ps->body_set_param( p_body, PhysicsServer::BODY_PARAM_BOUNCE, p_bounce );
|
||||
|
||||
}
|
||||
|
||||
void init_shapes() {
|
||||
|
||||
VisualServer *vs=VisualServer::get_singleton();
|
||||
PhysicsServer * ps = PhysicsServer::get_singleton();
|
||||
|
||||
/* SPHERE SHAPE */
|
||||
RID sphere_mesh = vs->make_sphere_mesh(10,20,0.5);
|
||||
RID sphere_material = vs->fixed_material_create();
|
||||
//vs->material_set_flag( sphere_material, VisualServer::MATERIAL_FLAG_WIREFRAME, true );
|
||||
vs->fixed_material_set_param( sphere_material, VisualServer::FIXED_MATERIAL_PARAM_DIFFUSE, Color(0.7,0.8,3.0) );
|
||||
vs->mesh_surface_set_material( sphere_mesh, 0, sphere_material );
|
||||
type_mesh_map[PhysicsServer::SHAPE_SPHERE]=sphere_mesh;
|
||||
|
||||
RID sphere_shape=ps->shape_create(PhysicsServer::SHAPE_SPHERE);
|
||||
ps->shape_set_data( sphere_shape, 0.5 );
|
||||
type_shape_map[PhysicsServer::SHAPE_SPHERE]=sphere_shape;
|
||||
|
||||
/* BOX SHAPE */
|
||||
|
||||
DVector<Plane> box_planes = Geometry::build_box_planes(Vector3(0.5,0.5,0.5));
|
||||
RID box_material = vs->fixed_material_create();
|
||||
vs->fixed_material_set_param( box_material, VisualServer::FIXED_MATERIAL_PARAM_DIFFUSE, Color(1.0,0.2,0.2) );
|
||||
RID box_mesh = vs->mesh_create();
|
||||
Geometry::MeshData box_data = Geometry::build_convex_mesh(box_planes);
|
||||
vs->mesh_add_surface_from_mesh_data(box_mesh,box_data);
|
||||
vs->mesh_surface_set_material( box_mesh, 0, box_material );
|
||||
type_mesh_map[PhysicsServer::SHAPE_BOX]=box_mesh;
|
||||
|
||||
RID box_shape=ps->shape_create(PhysicsServer::SHAPE_BOX);
|
||||
ps->shape_set_data( box_shape, Vector3(0.5,0.5,0.5) );
|
||||
type_shape_map[PhysicsServer::SHAPE_BOX]=box_shape;
|
||||
|
||||
|
||||
/* CAPSULE SHAPE */
|
||||
|
||||
DVector<Plane> capsule_planes = Geometry::build_capsule_planes(0.5,0.7,12,Vector3::AXIS_Z);
|
||||
RID capsule_material = vs->fixed_material_create();
|
||||
vs->fixed_material_set_param( capsule_material, VisualServer::FIXED_MATERIAL_PARAM_DIFFUSE, Color(0.3,0.4,1.0) );
|
||||
|
||||
RID capsule_mesh = vs->mesh_create();
|
||||
Geometry::MeshData capsule_data = Geometry::build_convex_mesh(capsule_planes);
|
||||
vs->mesh_add_surface_from_mesh_data(capsule_mesh,capsule_data);
|
||||
vs->mesh_surface_set_material( capsule_mesh, 0, capsule_material );
|
||||
type_mesh_map[PhysicsServer::SHAPE_CAPSULE]=capsule_mesh;
|
||||
|
||||
RID capsule_shape=ps->shape_create(PhysicsServer::SHAPE_CAPSULE);
|
||||
Dictionary capsule_params;
|
||||
capsule_params["radius"]=0.5;
|
||||
capsule_params["height"]=1.4;
|
||||
ps->shape_set_data( capsule_shape, capsule_params );
|
||||
type_shape_map[PhysicsServer::SHAPE_CAPSULE]=capsule_shape;
|
||||
|
||||
/* CONVEX SHAPE */
|
||||
|
||||
DVector<Plane> convex_planes = Geometry::build_cylinder_planes(0.5,0.7,5,Vector3::AXIS_Z);
|
||||
RID convex_material = vs->fixed_material_create();
|
||||
vs->fixed_material_set_param( convex_material, VisualServer::FIXED_MATERIAL_PARAM_DIFFUSE, Color(0.8,0.2,0.9));
|
||||
|
||||
RID convex_mesh = vs->mesh_create();
|
||||
Geometry::MeshData convex_data = Geometry::build_convex_mesh(convex_planes);
|
||||
QuickHull::build(convex_data.vertices,convex_data);
|
||||
vs->mesh_add_surface_from_mesh_data(convex_mesh,convex_data);
|
||||
vs->mesh_surface_set_material( convex_mesh, 0, convex_material );
|
||||
type_mesh_map[PhysicsServer::SHAPE_CONVEX_POLYGON]=convex_mesh;
|
||||
|
||||
RID convex_shape=ps->shape_create(PhysicsServer::SHAPE_CONVEX_POLYGON);
|
||||
ps->shape_set_data( convex_shape, convex_data.vertices );
|
||||
type_shape_map[PhysicsServer::SHAPE_CONVEX_POLYGON]=convex_shape;
|
||||
|
||||
}
|
||||
|
||||
void make_trimesh(Vector<Vector3> p_faces,const Transform& p_xform=Transform()) {
|
||||
|
||||
VisualServer *vs=VisualServer::get_singleton();
|
||||
PhysicsServer * ps = PhysicsServer::get_singleton();
|
||||
RID trimesh_shape = ps->shape_create(PhysicsServer::SHAPE_CONCAVE_POLYGON);
|
||||
ps->shape_set_data(trimesh_shape, p_faces);
|
||||
p_faces=ps->shape_get_data(trimesh_shape); // optimized one
|
||||
Vector<Vector3> normals; // for drawing
|
||||
for (int i=0;i<p_faces.size()/3;i++) {
|
||||
|
||||
Plane p( p_faces[i*3+0],p_faces[i*3+1], p_faces[i*3+2] );
|
||||
normals.push_back(p.normal);
|
||||
normals.push_back(p.normal);
|
||||
normals.push_back(p.normal);
|
||||
}
|
||||
|
||||
RID trimesh_mesh = vs->mesh_create();
|
||||
Array d;
|
||||
d.resize(VS::ARRAY_MAX);
|
||||
d[VS::ARRAY_VERTEX]=p_faces;
|
||||
d[VS::ARRAY_NORMAL]=normals;
|
||||
vs->mesh_add_surface(trimesh_mesh, VS::PRIMITIVE_TRIANGLES, d );
|
||||
RID trimesh_mat = vs->fixed_material_create();
|
||||
vs->fixed_material_set_param( trimesh_mat, VisualServer::FIXED_MATERIAL_PARAM_DIFFUSE, Color(1.0,0.5,0.8));
|
||||
//vs->material_set_flag( trimesh_mat, VisualServer::MATERIAL_FLAG_UNSHADED,true);
|
||||
vs->mesh_surface_set_material( trimesh_mesh, 0, trimesh_mat );
|
||||
|
||||
RID triins = vs->instance_create2(trimesh_mesh,scenario);
|
||||
|
||||
|
||||
RID tribody = ps->body_create( PhysicsServer::BODY_MODE_STATIC);
|
||||
ps->body_set_space(tribody,space);
|
||||
//todo set space
|
||||
ps->body_add_shape(tribody, trimesh_shape);
|
||||
Transform tritrans = p_xform;
|
||||
ps->body_set_state( tribody, PhysicsServer::BODY_STATE_TRANSFORM, tritrans );
|
||||
vs->instance_set_transform( triins, tritrans );
|
||||
//RID trimesh_material = vs->fixed_material_create();
|
||||
//vs->material_generate( trimesh_material, Color(0.2,0.4,0.6) );
|
||||
//vs->mesh_surface_set_material( trimesh_mesh, 0, trimesh_material );
|
||||
|
||||
}
|
||||
|
||||
void make_grid(int p_width,int p_height,float p_cellsize,float p_cellheight,const Transform& p_xform=Transform()) {
|
||||
|
||||
Vector< Vector< float > > grid;
|
||||
|
||||
grid.resize(p_width);
|
||||
|
||||
for (int i=0;i<p_width;i++) {
|
||||
|
||||
grid[i].resize(p_height);
|
||||
|
||||
for (int j=0;j<p_height;j++) {
|
||||
|
||||
grid[i][j]=1.0+Math::random(-p_cellheight, p_cellheight );
|
||||
}
|
||||
}
|
||||
|
||||
Vector<Vector3> faces;
|
||||
|
||||
for (int i=1;i<p_width;i++) {
|
||||
|
||||
for (int j=1;j<p_height;j++) {
|
||||
|
||||
|
||||
#define MAKE_VERTEX(m_x,m_z)\
|
||||
faces.push_back( Vector3( (m_x-p_width/2)*p_cellsize, grid[m_x][m_z], (m_z-p_height/2)*p_cellsize ) )
|
||||
|
||||
MAKE_VERTEX(i,j-1);
|
||||
MAKE_VERTEX(i,j);
|
||||
MAKE_VERTEX(i-1,j);
|
||||
|
||||
MAKE_VERTEX(i-1,j-1);
|
||||
MAKE_VERTEX(i,j-1);
|
||||
MAKE_VERTEX(i-1,j);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
make_trimesh(faces,p_xform);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
virtual void input_event(const InputEvent& p_event) {
|
||||
|
||||
if (p_event.type==InputEvent::MOUSE_MOTION && p_event.mouse_motion.button_mask&4) {
|
||||
|
||||
ofs_y-=p_event.mouse_motion.relative_y/200.0;
|
||||
ofs_x+=p_event.mouse_motion.relative_x/200.0;
|
||||
|
||||
}
|
||||
|
||||
if (p_event.type==InputEvent::MOUSE_MOTION && p_event.mouse_motion.button_mask&1) {
|
||||
|
||||
float y=-p_event.mouse_motion.relative_y/20.0;
|
||||
float x=p_event.mouse_motion.relative_x/20.0;
|
||||
|
||||
if (mover.is_valid()) {
|
||||
|
||||
|
||||
PhysicsServer * ps = PhysicsServer::get_singleton();
|
||||
Transform t = ps->body_get_state(mover,PhysicsServer::BODY_STATE_TRANSFORM);
|
||||
t.origin+=Vector3(x,y,0);
|
||||
|
||||
ps->body_set_state(mover,PhysicsServer::BODY_STATE_TRANSFORM,t);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (p_event.type == InputEvent::JOYSTICK_MOTION) {
|
||||
|
||||
if (p_event.joy_motion.axis == 0) {
|
||||
|
||||
joy_direction.x = p_event.joy_motion.axis_value;
|
||||
};
|
||||
|
||||
if (p_event.joy_motion.axis == 1) {
|
||||
|
||||
joy_direction.y = p_event.joy_motion.axis_value;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
virtual void request_quit() {
|
||||
|
||||
quit=true;
|
||||
}
|
||||
virtual void init() {
|
||||
|
||||
ofs_x=ofs_y=0;
|
||||
init_shapes();
|
||||
|
||||
PhysicsServer *ps = PhysicsServer::get_singleton();
|
||||
space=ps->space_create();
|
||||
ps->space_set_active(space,true);
|
||||
|
||||
VisualServer *vs=VisualServer::get_singleton();
|
||||
|
||||
/* LIGHT */
|
||||
RID lightaux = vs->light_create( VisualServer::LIGHT_DIRECTIONAL );
|
||||
//vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,0.0) );
|
||||
scenario = vs->scenario_create();
|
||||
vs->light_set_shadow(lightaux,true);
|
||||
light = vs->instance_create2( lightaux,scenario );
|
||||
Transform t;
|
||||
t.rotate(Vector3(1.0,0,0),0.6);
|
||||
vs->instance_set_transform(light,t);
|
||||
|
||||
|
||||
|
||||
/* CAMERA */
|
||||
|
||||
camera = vs->camera_create();
|
||||
RID viewport = vs->viewport_create();
|
||||
vs->viewport_attach_camera( viewport, camera );
|
||||
vs->viewport_attach_to_screen(viewport);
|
||||
vs->viewport_set_scenario( viewport, scenario );
|
||||
|
||||
vs->camera_set_perspective(camera,60,0.1,40.0);
|
||||
vs->camera_set_transform(camera,Transform( Matrix3(), Vector3(0,9,12)));
|
||||
//vs->scenario_set_debug(scenario,VS::SCENARIO_DEBUG_WIREFRAME);
|
||||
|
||||
Transform gxf;
|
||||
gxf.basis.scale(Vector3(1.4,0.4,1.4));
|
||||
gxf.origin=Vector3(-2,1,-2);
|
||||
make_grid(5,5,2.5,1,gxf);
|
||||
// create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_STATIC,gxf);
|
||||
//create_static_plane( Plane( Vector3(0,1,0), -2) );
|
||||
// test_joint();
|
||||
test_fall();
|
||||
//test_joint();
|
||||
|
||||
|
||||
/*
|
||||
Vector<Vector3> faces;
|
||||
faces.push_back( Vector3(10,0,-5) );
|
||||
faces.push_back( Vector3(0,0,10) );
|
||||
faces.push_back( Vector3(-10,-0.2,-5) );
|
||||
make_trimesh(faces);
|
||||
*/
|
||||
/* Make Trimesh */
|
||||
quit=false;
|
||||
return;
|
||||
|
||||
#if 0
|
||||
#define GRID_SIZE 5
|
||||
|
||||
float grid[GRID_SIZE][GRID_SIZE];
|
||||
|
||||
for (int i=0;i<GRID_SIZE;i++) {
|
||||
|
||||
for (int j=0;j<GRID_SIZE;j++) {
|
||||
|
||||
grid[j][i]=Math::random(0.0, 1.0 );
|
||||
}
|
||||
}
|
||||
|
||||
Vector<Vector3> faces;
|
||||
|
||||
for (int i=1;i<GRID_SIZE;i++) {
|
||||
|
||||
for (int j=1;j<GRID_SIZE;j++) {
|
||||
|
||||
|
||||
#define MAKE_VERTEX(m_x,m_z)\
|
||||
faces.push_back( Vector3( m_x-GRID_SIZE/2.0, grid[m_x][m_z], m_z-GRID_SIZE/2.0 )*3.0 )
|
||||
|
||||
MAKE_VERTEX(i,j-1);
|
||||
MAKE_VERTEX(i,j);
|
||||
MAKE_VERTEX(i-1,j);
|
||||
|
||||
MAKE_VERTEX(i-1,j-1);
|
||||
MAKE_VERTEX(i,j-1);
|
||||
MAKE_VERTEX(i-1,j);
|
||||
|
||||
}
|
||||
}
|
||||
/*
|
||||
faces.clear();
|
||||
faces.push_back( Vector3(0,0,-5) );
|
||||
faces.push_back( Vector3(1,0,-1) );
|
||||
faces.push_back( Vector3(-1,-0,-1) );
|
||||
*/
|
||||
|
||||
RID trimesh_shape = ps->shape_create();
|
||||
ps->shape_set_data(trimesh_shape, PhysicsServer::SHAPE_CONCAVE_POLYGON,faces);
|
||||
faces=ps->shape_get_shape(trimesh_shape, 0);
|
||||
Vector<Vector3> normals; // for drawing
|
||||
for (int i=0;i<faces.size()/3;i++) {
|
||||
|
||||
Plane p( faces[i*3+0],faces[i*3+1], faces[i*3+2] );
|
||||
normals.push_back(p.normal);
|
||||
normals.push_back(p.normal);
|
||||
normals.push_back(p.normal);
|
||||
}
|
||||
|
||||
RID trimesh_mesh = vs->mesh_create();
|
||||
vs->mesh_add_surface(trimesh_mesh, VS::PRIMITIVE_TRIANGLES, VS::ARRAY_FORMAT_VERTEX|VS::ARRAY_FORMAT_NORMAL, faces.size() );
|
||||
vs->mesh_surface_set_array(trimesh_mesh,0,VS::ARRAY_VERTEX, faces );
|
||||
vs->mesh_surface_set_array(trimesh_mesh,0,VS::ARRAY_NORMAL, normals );
|
||||
RID trimesh_mat = vs->fixed_material_create();
|
||||
vs->material_generate( trimesh_mat, Color(1.0,0.5,0.3) );
|
||||
vs->mesh_surface_set_material( trimesh_mesh, 0, trimesh_mat );
|
||||
|
||||
RID triins = vs->instance_create2(trimesh_mesh);
|
||||
|
||||
|
||||
|
||||
RID tribody = ps->body_create( PhysicsServer::BODY_MODE_STATIC, trimesh_shape);
|
||||
Transform tritrans = Transform( Matrix3(), Vector3(0,0,-2) );
|
||||
ps->body_set_state( tribody, PhysicsServer::BODY_STATE_TRANSFORM, tritrans );
|
||||
vs->instance_set_transform( triins, tritrans );
|
||||
RID trimesh_material = vs->fixed_material_create();
|
||||
vs->material_generate( trimesh_material, Color(0.2,0.4,0.6) );
|
||||
vs->mesh_surface_set_material( trimesh_mesh, 0, trimesh_material );
|
||||
#endif
|
||||
}
|
||||
virtual bool iteration(float p_time) {
|
||||
|
||||
if (mover) {
|
||||
static float joy_speed = 10;
|
||||
PhysicsServer * ps = PhysicsServer::get_singleton();
|
||||
Transform t = ps->body_get_state(mover,PhysicsServer::BODY_STATE_TRANSFORM);
|
||||
t.origin+=Vector3(joy_speed * joy_direction.x * p_time, -joy_speed * joy_direction.y * p_time,0);
|
||||
ps->body_set_state(mover,PhysicsServer::BODY_STATE_TRANSFORM,t);
|
||||
};
|
||||
|
||||
|
||||
Transform cameratr;
|
||||
cameratr.rotate(Vector3(0,1,0),ofs_x);
|
||||
cameratr.rotate(Vector3(1,0,0),-ofs_y);
|
||||
cameratr.translate(Vector3(0,2,8));
|
||||
VisualServer *vs=VisualServer::get_singleton();
|
||||
vs->camera_set_transform(camera,cameratr);
|
||||
|
||||
return quit;
|
||||
}
|
||||
virtual void finish() {
|
||||
|
||||
}
|
||||
|
||||
void test_joint() {
|
||||
#if 0
|
||||
PhysicsServer * ps = PhysicsServer::get_singleton();
|
||||
|
||||
mover = create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_STATIC,Transform(Matrix3(),Vector3(0,0,-24)));
|
||||
RID b = create_body(PhysicsServer::SHAPE_CAPSULE,PhysicsServer::BODY_MODE_RIGID,Transform());
|
||||
|
||||
ps->joint_create_double_pin(b,Vector3(0,0,1.0),mover,Vector3(0,0,0));
|
||||
ps->body_add_collision_exception(mover,b);
|
||||
|
||||
|
||||
List<String> cmdline = OS::get_singleton()->get_cmdline_args();
|
||||
int link_count = LINK_COUNT;
|
||||
if (cmdline.size() > 0 && cmdline[cmdline.size()-1].to_int()) {
|
||||
link_count = cmdline[cmdline.size()-1].to_int();
|
||||
};
|
||||
|
||||
for(int i=0;i<link_count;i++) {
|
||||
|
||||
RID c = create_body(PhysicsServer::SHAPE_CAPSULE,PhysicsServer::BODY_MODE_RIGID,Transform());
|
||||
ps->joint_create_double_pin(b,Vector3(0,0,-0.7),c,Vector3(0,0,0.7));
|
||||
ps->body_add_collision_exception(c,b);
|
||||
b=c;
|
||||
}
|
||||
|
||||
|
||||
create_static_plane(Plane(Vector3(0,1,0),-8));
|
||||
#endif
|
||||
}
|
||||
|
||||
void test_hinge() {
|
||||
#if 0
|
||||
PhysicsServer * ps = PhysicsServer::get_singleton();
|
||||
|
||||
|
||||
mover = create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_STATIC,Transform(Matrix3(),Vector3(0,0,-24)));
|
||||
RID b = create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_RIGID,Transform());
|
||||
|
||||
ps->joint_create_double_hinge(b,Transform(Matrix3(),Vector3(1,1,1.0)),mover,Transform(Matrix3(),Vector3(0,0,0)));
|
||||
ps->body_add_collision_exception(mover,b);
|
||||
|
||||
/*
|
||||
for(int i=0;i<20;i++) {
|
||||
|
||||
RID c = create_body(PhysicsServer::SHAPE_CAPSULE,PhysicsServer::BODY_MODE_RIGID,Transform());
|
||||
ps->joint_create_double_hinge(b,Transform(Matrix3(),Vector3(0,0,-0.7)),c,Transform(Matrix3(),Vector3(0,0,0.7)));
|
||||
ps->body_add_collision_exception(c,b);
|
||||
b=c;
|
||||
}
|
||||
|
||||
*/
|
||||
//create_static_plane(Plane(Vector3(0,1,0),-8));
|
||||
#endif
|
||||
}
|
||||
|
||||
void test_character() {
|
||||
|
||||
VisualServer *vs=VisualServer::get_singleton();
|
||||
PhysicsServer * ps = PhysicsServer::get_singleton();
|
||||
|
||||
|
||||
DVector<Plane> capsule_planes = Geometry::build_capsule_planes(0.5,1,12,5,Vector3::AXIS_Y);
|
||||
RID capsule_material = vs->fixed_material_create();
|
||||
|
||||
vs->fixed_material_set_param( capsule_material, VisualServer::FIXED_MATERIAL_PARAM_DIFFUSE, Color(1,1,1) );
|
||||
|
||||
|
||||
RID capsule_mesh = vs->mesh_create();
|
||||
Geometry::MeshData capsule_data = Geometry::build_convex_mesh(capsule_planes);
|
||||
vs->mesh_add_surface_from_mesh_data(capsule_mesh,capsule_data);
|
||||
vs->mesh_surface_set_material( capsule_mesh, 0, capsule_material );
|
||||
type_mesh_map[PhysicsServer::SHAPE_CAPSULE]=capsule_mesh;
|
||||
|
||||
RID capsule_shape=ps->shape_create(PhysicsServer::SHAPE_CAPSULE);
|
||||
Dictionary capsule_params;
|
||||
capsule_params["radius"]=0.5;
|
||||
capsule_params["height"]=1;
|
||||
Transform shape_xform;
|
||||
shape_xform.rotate(Vector3(1,0,0),Math_PI/2.0);
|
||||
//shape_xform.origin=Vector3(1,1,1);
|
||||
ps->shape_set_data( capsule_shape, capsule_params);
|
||||
|
||||
|
||||
RID mesh_instance = vs->instance_create2(capsule_mesh,scenario);
|
||||
character = ps->body_create(PhysicsServer::BODY_MODE_CHARACTER);
|
||||
ps->body_set_space(character,space);
|
||||
//todo add space
|
||||
ps->body_add_shape(character,capsule_shape);
|
||||
|
||||
ps->body_set_force_integration_callback(character,this,"body_changed_transform",mesh_instance);
|
||||
|
||||
|
||||
ps->body_set_state( character, PhysicsServer::BODY_STATE_TRANSFORM,Transform(Matrix3(),Vector3(-2,5,-2)));
|
||||
bodies.push_back(character);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void test_fall() {
|
||||
|
||||
|
||||
for (int i=0;i<35;i++) {
|
||||
|
||||
static const PhysicsServer::ShapeType shape_idx[]={
|
||||
PhysicsServer::SHAPE_CAPSULE,
|
||||
PhysicsServer::SHAPE_BOX,
|
||||
PhysicsServer::SHAPE_SPHERE,
|
||||
PhysicsServer::SHAPE_CONVEX_POLYGON
|
||||
};
|
||||
|
||||
PhysicsServer::ShapeType type=shape_idx[i%4];
|
||||
//type=PhysicsServer::SHAPE_CONVEX_POLYGON;
|
||||
|
||||
Transform t;
|
||||
|
||||
t.origin=Vector3(0.0*i,3.5+1.1*i,0.7+0.0*i);
|
||||
//t.origin=Vector3(-0.7+0.0*i,0.5+4.1*i,0);
|
||||
t.basis.rotate(Vector3(0.2,-1,0),Math_PI/2*0.6);
|
||||
//t.basis.rotate(Vector3(0,-1,0),Math_PI/4*i);
|
||||
//t.basis.rotate(Vector3(0,-1,0),Math_PI/4*i);
|
||||
//t.basis.rotate(Vector3(-1,0,0),Math_PI/4*i);
|
||||
|
||||
|
||||
RID b = create_body(type,PhysicsServer::BODY_MODE_RIGID,t);
|
||||
//RID b = create_body(type,i==0?PhysicsServer::BODY_MODE_STATIC:PhysicsServer::BODY_MODE_RIGID,t);
|
||||
|
||||
}
|
||||
|
||||
create_static_plane( Plane( Vector3(0,1,0), -1) );
|
||||
|
||||
|
||||
/*
|
||||
create_static_plane( Plane( Vector3(1,0,0), -2) );
|
||||
create_static_plane( Plane( Vector3(-1,0,0), -2) );
|
||||
create_static_plane( Plane( Vector3(0,0,1), -2) );
|
||||
create_static_plane( Plane( Vector3(0,0,-1), -2) );
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
void test_activate() {
|
||||
|
||||
create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_RIGID,Transform(Matrix3(),Vector3(0,2,0)),true);
|
||||
//create_body(PhysicsServer::SHAPE_SPHERE,PhysicsServer::BODY_MODE_RIGID,Transform(Matrix3(),Vector3(0,6,0)),true);
|
||||
create_static_plane( Plane( Vector3(0,1,0), -1) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
virtual bool idle(float p_time) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TestPhysicsMainLoop() {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
namespace TestPhysics {
|
||||
|
||||
MainLoop* test() {
|
||||
|
||||
return memnew( TestPhysicsMainLoop );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
44
bin/tests/test_physics.h
Normal file
44
bin/tests/test_physics.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*************************************************************************/
|
||||
/* test_physics.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef TEST_PHYSICS_H
|
||||
#define TEST_PHYSICS_H
|
||||
|
||||
/**
|
||||
@author Juan Linietsky <reduzio@gmail.com>
|
||||
*/
|
||||
|
||||
#include "os/main_loop.h"
|
||||
|
||||
namespace TestPhysics {
|
||||
|
||||
MainLoop* test();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
467
bin/tests/test_physics_2d.cpp
Normal file
467
bin/tests/test_physics_2d.cpp
Normal file
File diff suppressed because one or more lines are too long
41
bin/tests/test_physics_2d.h
Normal file
41
bin/tests/test_physics_2d.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*************************************************************************/
|
||||
/* test_physics_2d.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef TEST_PHYSICS_2D_H
|
||||
#define TEST_PHYSICS_2D_H
|
||||
|
||||
|
||||
#include "os/main_loop.h"
|
||||
|
||||
namespace TestPhysics2D {
|
||||
|
||||
MainLoop* test();
|
||||
|
||||
}
|
||||
|
||||
#endif // TEST_PHYSICS_2D_H
|
||||
56
bin/tests/test_python.cpp
Normal file
56
bin/tests/test_python.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
/*************************************************************************/
|
||||
/* test_python.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "test_python.h"
|
||||
|
||||
#ifdef PYTHON_ENABLED
|
||||
|
||||
#include "Python.h"
|
||||
#include "print_string.h"
|
||||
|
||||
namespace TestPython {
|
||||
|
||||
void test() {
|
||||
|
||||
print_line("testing python");
|
||||
PyRun_SimpleString("import engine\n");
|
||||
PyRun_SimpleString("def test(self):\n\tprint(\"noway\")\n");
|
||||
PyRun_SimpleString("a=engine.ObjectPtr()\n");
|
||||
PyRun_SimpleString("a.noway(22,'hello')\n");
|
||||
PyRun_SimpleString("a.normalize()\n");
|
||||
PyRun_SimpleString("class Moch(engine.ObjectPtr):\n\tdef mooch(self):\n\t\tprint('muchi')\n");
|
||||
PyRun_SimpleString("b=Moch();\n");
|
||||
PyRun_SimpleString("b.mooch();\n");
|
||||
PyRun_SimpleString("b.meis();\n");
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
43
bin/tests/test_python.h
Normal file
43
bin/tests/test_python.h
Normal file
@ -0,0 +1,43 @@
|
||||
/*************************************************************************/
|
||||
/* test_python.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef TEST_PYTHON_H
|
||||
#define TEST_PYTHON_H
|
||||
|
||||
#ifdef PYTHON_ENABLED
|
||||
/**
|
||||
@author Juan Linietsky <reduzio@gmail.com>
|
||||
*/
|
||||
namespace TestPython {
|
||||
|
||||
void test();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
263
bin/tests/test_render.cpp
Normal file
263
bin/tests/test_render.cpp
Normal file
@ -0,0 +1,263 @@
|
||||
/*************************************************************************/
|
||||
/* test_render.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "test_render.h"
|
||||
#include "servers/visual_server.h"
|
||||
#include "os/main_loop.h"
|
||||
#include "math_funcs.h"
|
||||
#include "print_string.h"
|
||||
#include "os/os.h"
|
||||
#include "quick_hull.h"
|
||||
#include "os/keyboard.h"
|
||||
|
||||
#define OBJECT_COUNT 50
|
||||
|
||||
namespace TestRender {
|
||||
|
||||
|
||||
class TestMainLoop : public MainLoop {
|
||||
|
||||
|
||||
RID test_cube;
|
||||
RID instance;
|
||||
RID camera;
|
||||
RID viewport;
|
||||
RID light;
|
||||
RID scenario;
|
||||
|
||||
struct InstanceInfo {
|
||||
|
||||
RID instance;
|
||||
Transform base;
|
||||
Vector3 rot_axis;
|
||||
};
|
||||
|
||||
List<InstanceInfo> instances;
|
||||
|
||||
float ofs;
|
||||
bool quit;
|
||||
protected:
|
||||
|
||||
|
||||
public:
|
||||
virtual void input_event(const InputEvent& p_event) {
|
||||
|
||||
if (p_event.type==InputEvent::KEY && p_event.key.pressed)
|
||||
quit=true;
|
||||
}
|
||||
|
||||
virtual void init() {
|
||||
|
||||
|
||||
print_line("INITIALIZING TEST RENDER");
|
||||
VisualServer *vs=VisualServer::get_singleton();
|
||||
test_cube = vs->get_test_cube();
|
||||
scenario = vs->scenario_create();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Vector<Vector3> vts;
|
||||
|
||||
/*
|
||||
DVector<Plane> sp = Geometry::build_sphere_planes(2,5,5);
|
||||
Geometry::MeshData md2 = Geometry::build_convex_mesh(sp);
|
||||
vts=md2.vertices;
|
||||
*/
|
||||
/*
|
||||
|
||||
static const int s = 20;
|
||||
for(int i=0;i<s;i++) {
|
||||
Matrix3 rot(Vector3(0,1,0),i*Math_PI/s);
|
||||
|
||||
for(int j=0;j<s;j++) {
|
||||
Vector3 v;
|
||||
v.x=Math::sin(j*Math_PI*2/s);
|
||||
v.y=Math::cos(j*Math_PI*2/s);
|
||||
|
||||
vts.push_back( rot.xform(v*2 ) );
|
||||
}
|
||||
}*/
|
||||
/*for(int i=0;i<100;i++) {
|
||||
|
||||
vts.push_back( Vector3(Math::randf()*2-1.0,Math::randf()*2-1.0,Math::randf()*2-1.0).normalized()*2);
|
||||
}*/
|
||||
/*
|
||||
vts.push_back(Vector3(0,0,1));
|
||||
vts.push_back(Vector3(0,0,-1));
|
||||
vts.push_back(Vector3(0,1,0));
|
||||
vts.push_back(Vector3(0,-1,0));
|
||||
vts.push_back(Vector3(1,0,0));
|
||||
vts.push_back(Vector3(-1,0,0));*/
|
||||
|
||||
vts.push_back(Vector3(1,1,1));
|
||||
vts.push_back(Vector3(1,-1,1));
|
||||
vts.push_back(Vector3(-1,1,1));
|
||||
vts.push_back(Vector3(-1,-1,1));
|
||||
vts.push_back(Vector3(1,1,-1));
|
||||
vts.push_back(Vector3(1,-1,-1));
|
||||
vts.push_back(Vector3(-1,1,-1));
|
||||
vts.push_back(Vector3(-1,-1,-1));
|
||||
|
||||
Geometry::MeshData md;
|
||||
Error err = QuickHull::build(vts,md);
|
||||
print_line("ERR: "+itos(err));
|
||||
test_cube = vs->mesh_create();
|
||||
vs->mesh_add_surface_from_mesh_data(test_cube,md);
|
||||
//vs->scenario_set_debug(scenario,VS::SCENARIO_DEBUG_WIREFRAME);
|
||||
|
||||
/*
|
||||
RID sm = vs->shader_create();
|
||||
//vs->shader_set_fragment_code(sm,"OUT_ALPHA=mod(TIME,1);");
|
||||
//vs->shader_set_vertex_code(sm,"OUT_VERTEX=IN_VERTEX*mod(TIME,1);");
|
||||
vs->shader_set_fragment_code(sm,"OUT_DIFFUSE=vec3(1,0,1);OUT_GLOW=abs(sin(TIME));");
|
||||
RID tcmat = vs->mesh_surface_get_material(test_cube,0);
|
||||
vs->material_set_shader(tcmat,sm);
|
||||
*/
|
||||
|
||||
|
||||
List<String> cmdline = OS::get_singleton()->get_cmdline_args();
|
||||
int object_count = OBJECT_COUNT;
|
||||
if (cmdline.size() > 0 && cmdline[cmdline.size()-1].to_int()) {
|
||||
object_count = cmdline[cmdline.size()-1].to_int();
|
||||
};
|
||||
|
||||
for (int i=0;i<object_count;i++) {
|
||||
|
||||
InstanceInfo ii;
|
||||
|
||||
|
||||
ii.instance = vs->instance_create2( test_cube, scenario );
|
||||
|
||||
|
||||
ii.base.translate( Math::random(-20,20), Math::random(-20,20),Math::random(-20,18) );
|
||||
ii.base.rotate( Vector3(0,1,0), Math::randf() * Math_PI );
|
||||
ii.base.rotate( Vector3(1,0,0), Math::randf() * Math_PI );
|
||||
vs->instance_set_transform( ii.instance, ii.base );
|
||||
|
||||
ii.rot_axis = Vector3( Math::random(-1,1), Math::random(-1,1), Math::random(-1,1) ).normalized();
|
||||
|
||||
instances.push_back(ii);
|
||||
|
||||
}
|
||||
|
||||
camera = vs->camera_create();
|
||||
|
||||
// vs->camera_set_perspective( camera, 60.0,0.1, 100.0 );
|
||||
|
||||
viewport = vs->viewport_create();
|
||||
vs->viewport_attach_to_screen(viewport);
|
||||
vs->viewport_attach_camera( viewport, camera );
|
||||
vs->viewport_set_scenario( viewport, scenario );
|
||||
vs->camera_set_transform(camera, Transform( Matrix3(), Vector3(0,3,30 ) ) );
|
||||
vs->camera_set_perspective( camera, 60, 0.1, 1000);
|
||||
|
||||
|
||||
/*
|
||||
RID lightaux = vs->light_create( VisualServer::LIGHT_OMNI );
|
||||
vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_RADIUS, 80 );
|
||||
vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_ATTENUATION, 1 );
|
||||
vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_ENERGY, 1.5 );
|
||||
light = vs->instance_create( lightaux );
|
||||
*/
|
||||
RID lightaux;
|
||||
|
||||
//*
|
||||
lightaux = vs->light_create( VisualServer::LIGHT_DIRECTIONAL );
|
||||
//vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,0.0) );
|
||||
vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_DIFFUSE, Color(1.0,1.0,1.0) );
|
||||
//vs->light_set_shadow( lightaux, true );
|
||||
light = vs->instance_create2( lightaux, scenario );
|
||||
Transform lla;
|
||||
//lla.set_look_at(Vector3(),Vector3(1,-1,1),Vector3(0,1,0));
|
||||
lla.set_look_at(Vector3(),Vector3(-0.000000,-0.836026,-0.548690),Vector3(0,1,0));
|
||||
|
||||
vs->instance_set_transform( light, lla );
|
||||
// */
|
||||
|
||||
//*
|
||||
lightaux = vs->light_create( VisualServer::LIGHT_OMNI );
|
||||
// vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,1.0) );
|
||||
vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_DIFFUSE, Color(1.0,1.0,0.0) );
|
||||
vs->light_set_param( lightaux, VisualServer::LIGHT_PARAM_RADIUS, 4 );
|
||||
vs->light_set_param( lightaux, VisualServer::LIGHT_PARAM_ENERGY, 8 );
|
||||
//vs->light_set_shadow( lightaux, true );
|
||||
//light = vs->instance_create( lightaux );
|
||||
// */
|
||||
|
||||
ofs=0;
|
||||
quit=false;
|
||||
}
|
||||
virtual bool iteration(float p_time) {
|
||||
|
||||
VisualServer *vs=VisualServer::get_singleton();
|
||||
//Transform t;
|
||||
//t.rotate(Vector3(0, 1, 0), ofs);
|
||||
//t.translate(Vector3(0,0,20 ));
|
||||
//vs->camera_set_transform(camera, t);
|
||||
|
||||
ofs+=p_time*0.05;
|
||||
|
||||
//return quit;
|
||||
|
||||
for(List<InstanceInfo>::Element *E=instances.front();E;E=E->next()) {
|
||||
|
||||
Transform pre( Matrix3(E->get().rot_axis, ofs), Vector3() );
|
||||
vs->instance_set_transform( E->get().instance, pre * E->get().base );
|
||||
/*
|
||||
if( !E->next() ) {
|
||||
|
||||
vs->free( E->get().instance );
|
||||
instances.erase(E );
|
||||
}*/
|
||||
}
|
||||
|
||||
return quit;
|
||||
}
|
||||
|
||||
virtual bool idle(float p_time) {
|
||||
return quit;
|
||||
}
|
||||
|
||||
|
||||
virtual void finish() {
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
MainLoop* test() {
|
||||
|
||||
return memnew( TestMainLoop );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
44
bin/tests/test_render.h
Normal file
44
bin/tests/test_render.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*************************************************************************/
|
||||
/* test_render.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef TEST_RENDER_H
|
||||
#define TEST_RENDER_H
|
||||
|
||||
/**
|
||||
@author Juan Linietsky <reduzio@gmail.com>
|
||||
*/
|
||||
|
||||
#include "os/main_loop.h"
|
||||
|
||||
namespace TestRender {
|
||||
|
||||
MainLoop* test();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
340
bin/tests/test_shader_lang.cpp
Normal file
340
bin/tests/test_shader_lang.cpp
Normal file
@ -0,0 +1,340 @@
|
||||
/*************************************************************************/
|
||||
/* test_shader_lang.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "test_shader_lang.h"
|
||||
|
||||
|
||||
#include "os/main_loop.h"
|
||||
#include "os/os.h"
|
||||
#include "os/file_access.h"
|
||||
|
||||
#include "scene/gui/control.h"
|
||||
#include "scene/gui/text_edit.h"
|
||||
#include "print_string.h"
|
||||
#include "servers/visual/shader_language.h"
|
||||
#include "drivers/gles2/shader_compiler_gles2.h"
|
||||
|
||||
|
||||
typedef ShaderLanguage SL;
|
||||
|
||||
namespace TestShaderLang {
|
||||
|
||||
|
||||
static String _mktab(int p_level) {
|
||||
|
||||
String tb;
|
||||
for(int i=0;i<p_level;i++) {
|
||||
tb+="\t";
|
||||
}
|
||||
|
||||
return tb;
|
||||
}
|
||||
|
||||
static String _typestr(SL::DataType p_type) {
|
||||
|
||||
switch(p_type) {
|
||||
|
||||
case SL::TYPE_VOID: return "void";
|
||||
case SL::TYPE_BOOL: return "bool";
|
||||
case SL::TYPE_FLOAT: return "float";
|
||||
case SL::TYPE_VEC2: return "vec2";
|
||||
case SL::TYPE_VEC3: return "vec3";
|
||||
case SL::TYPE_VEC4: return "vec4";
|
||||
case SL::TYPE_MAT3: return "mat3";
|
||||
case SL::TYPE_MAT4: return "mat4";
|
||||
case SL::TYPE_TEXTURE: return "texture";
|
||||
case SL::TYPE_CUBEMAP: return "cubemap";
|
||||
default: {}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
static String _opstr(SL::Operator p_op) {
|
||||
|
||||
switch(p_op) {
|
||||
case SL::OP_ASSIGN: return "=";
|
||||
case SL::OP_ADD: return "+";
|
||||
case SL::OP_SUB: return "-";
|
||||
case SL::OP_MUL: return "*";
|
||||
case SL::OP_DIV: return "/";
|
||||
case SL::OP_ASSIGN_ADD: return "+=";
|
||||
case SL::OP_ASSIGN_SUB: return "-=";
|
||||
case SL::OP_ASSIGN_MUL: return "*=";
|
||||
case SL::OP_ASSIGN_DIV: return "/=";
|
||||
case SL::OP_NEG: return "-";
|
||||
case SL::OP_NOT: return "!";
|
||||
case SL::OP_CMP_EQ: return "==";
|
||||
case SL::OP_CMP_NEQ: return "!=";
|
||||
case SL::OP_CMP_LEQ: return "<=";
|
||||
case SL::OP_CMP_GEQ: return ">=";
|
||||
case SL::OP_CMP_LESS: return "<";
|
||||
case SL::OP_CMP_GREATER: return ">";
|
||||
case SL::OP_CMP_OR: return "||";
|
||||
case SL::OP_CMP_AND: return "&&";
|
||||
default: return "";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
static String dump_node_code(SL::Node *p_node,int p_level) {
|
||||
|
||||
String code;
|
||||
|
||||
switch(p_node->type) {
|
||||
|
||||
case SL::Node::TYPE_PROGRAM: {
|
||||
|
||||
SL::ProgramNode *pnode=(SL::ProgramNode*)p_node;
|
||||
|
||||
for(Map<StringName,SL::Uniform>::Element *E=pnode->uniforms.front();E;E=E->next()) {
|
||||
|
||||
String ucode="uniform ";
|
||||
ucode+=_typestr(E->get().type)+"="+String(E->get().default_value)+"\n";
|
||||
code+=ucode;
|
||||
|
||||
}
|
||||
|
||||
for(int i=0;i<pnode->functions.size();i++) {
|
||||
|
||||
SL::FunctionNode *fnode=pnode->functions[i].function;
|
||||
|
||||
String header;
|
||||
header=_typestr(fnode->return_type)+" "+fnode->name+"(";
|
||||
for(int i=0;i<fnode->arguments.size();i++) {
|
||||
|
||||
if (i>0)
|
||||
header+=", ";
|
||||
header+=_typestr(fnode->arguments[i].type)+" "+fnode->arguments[i].name;
|
||||
}
|
||||
|
||||
header+=") {\n";
|
||||
code+=header;
|
||||
code+=dump_node_code(fnode->body,p_level+1);
|
||||
code+="}\n";
|
||||
}
|
||||
|
||||
code+=dump_node_code(pnode->body,p_level);
|
||||
} break;
|
||||
case SL::Node::TYPE_FUNCTION: {
|
||||
|
||||
} break;
|
||||
case SL::Node::TYPE_BLOCK: {
|
||||
SL::BlockNode *bnode=(SL::BlockNode*)p_node;
|
||||
|
||||
//variables
|
||||
for(Map<StringName,SL::DataType>::Element *E=bnode->variables.front();E;E=E->next()) {
|
||||
|
||||
code+=_mktab(p_level)+_typestr(E->value())+" "+E->key()+";\n";
|
||||
}
|
||||
|
||||
for(int i=0;i<bnode->statements.size();i++) {
|
||||
|
||||
code+=_mktab(p_level)+dump_node_code(bnode->statements[i],p_level)+";\n";
|
||||
}
|
||||
|
||||
|
||||
} break;
|
||||
case SL::Node::TYPE_VARIABLE: {
|
||||
SL::VariableNode *vnode=(SL::VariableNode*)p_node;
|
||||
code=vnode->name;
|
||||
|
||||
} break;
|
||||
case SL::Node::TYPE_CONSTANT: {
|
||||
SL::ConstantNode *cnode=(SL::ConstantNode*)p_node;
|
||||
switch(cnode->datatype) {
|
||||
|
||||
|
||||
case SL::TYPE_BOOL: code=cnode->value.operator bool()?"true":"false"; break;
|
||||
case SL::TYPE_FLOAT: code=cnode->value; break;
|
||||
case SL::TYPE_VEC2: { Vector2 v = cnode->value; code="vec2("+rtos(v.x)+", "+rtos(v.y)+")"; } break;
|
||||
case SL::TYPE_VEC3: { Vector3 v = cnode->value; code="vec3("+rtos(v.x)+", "+rtos(v.y)+", "+rtos(v.z)+")"; } break;
|
||||
case SL::TYPE_VEC4: { Plane v = cnode->value; code="vec4("+rtos(v.normal.x)+", "+rtos(v.normal.y)+", "+rtos(v.normal.z)+", "+rtos(v.d)+")"; } break;
|
||||
case SL::TYPE_MAT3: { Matrix3 x = cnode->value; code="mat3( vec3("+rtos(x.get_axis(0).x)+", "+rtos(x.get_axis(0).y)+", "+rtos(x.get_axis(0).z)+"), vec3("+rtos(x.get_axis(1).x)+", "+rtos(x.get_axis(1).y)+", "+rtos(x.get_axis(1).z)+"), vec3("+rtos(x.get_axis(2).x)+", "+rtos(x.get_axis(2).y)+", "+rtos(x.get_axis(2).z)+"))"; } break;
|
||||
case SL::TYPE_MAT4: { Transform x = cnode->value; code="mat4( vec3("+rtos(x.basis.get_axis(0).x)+", "+rtos(x.basis.get_axis(0).y)+", "+rtos(x.basis.get_axis(0).z)+"), vec3("+rtos(x.basis.get_axis(1).x)+", "+rtos(x.basis.get_axis(1).y)+", "+rtos(x.basis.get_axis(1).z)+"), vec3("+rtos(x.basis.get_axis(2).x)+", "+rtos(x.basis.get_axis(2).y)+", "+rtos(x.basis.get_axis(2).z)+"), vec3("+rtos(x.origin.x)+", "+rtos(x.origin.y)+", "+rtos(x.origin.z)+"))"; } break;
|
||||
default: code="<error: "+Variant::get_type_name(cnode->value.get_type())+" ("+itos(cnode->datatype)+">";
|
||||
}
|
||||
|
||||
} break;
|
||||
case SL::Node::TYPE_OPERATOR: {
|
||||
SL::OperatorNode *onode=(SL::OperatorNode*)p_node;
|
||||
|
||||
|
||||
switch(onode->op) {
|
||||
|
||||
case SL::OP_ASSIGN:
|
||||
case SL::OP_ASSIGN_ADD:
|
||||
case SL::OP_ASSIGN_SUB:
|
||||
case SL::OP_ASSIGN_MUL:
|
||||
case SL::OP_ASSIGN_DIV:
|
||||
code=dump_node_code(onode->arguments[0],p_level)+_opstr(onode->op)+dump_node_code(onode->arguments[1],p_level);
|
||||
break;
|
||||
|
||||
case SL::OP_ADD:
|
||||
case SL::OP_SUB:
|
||||
case SL::OP_MUL:
|
||||
case SL::OP_DIV:
|
||||
case SL::OP_CMP_EQ:
|
||||
case SL::OP_CMP_NEQ:
|
||||
case SL::OP_CMP_LEQ:
|
||||
case SL::OP_CMP_GEQ:
|
||||
case SL::OP_CMP_LESS:
|
||||
case SL::OP_CMP_GREATER:
|
||||
case SL::OP_CMP_OR:
|
||||
case SL::OP_CMP_AND:
|
||||
|
||||
code="("+dump_node_code(onode->arguments[0],p_level)+_opstr(onode->op)+dump_node_code(onode->arguments[1],p_level)+")";
|
||||
break;
|
||||
case SL::OP_NEG:
|
||||
case SL::OP_NOT:
|
||||
code=_opstr(onode->op)+dump_node_code(onode->arguments[0],p_level);
|
||||
break;
|
||||
case SL::OP_CALL:
|
||||
case SL::OP_CONSTRUCT:
|
||||
code=dump_node_code(onode->arguments[0],p_level)+"(";
|
||||
for(int i=1;i<onode->arguments.size();i++) {
|
||||
if (i>1)
|
||||
code+=", ";
|
||||
code+=dump_node_code(onode->arguments[i],p_level);
|
||||
}
|
||||
code+=")";
|
||||
break;
|
||||
default: {}
|
||||
}
|
||||
|
||||
} break;
|
||||
case SL::Node::TYPE_CONTROL_FLOW: {
|
||||
SL::ControlFlowNode *cfnode=(SL::ControlFlowNode*)p_node;
|
||||
if (cfnode->flow_op==SL::FLOW_OP_IF) {
|
||||
|
||||
code+="if ("+dump_node_code(cfnode->statements[0],p_level)+") {\n";
|
||||
code+=dump_node_code(cfnode->statements[1],p_level+1);
|
||||
if (cfnode->statements.size()==3) {
|
||||
|
||||
code+="} else {\n";
|
||||
code+=dump_node_code(cfnode->statements[2],p_level+1);
|
||||
}
|
||||
|
||||
code+="}\n";
|
||||
|
||||
} else if (cfnode->flow_op==SL::FLOW_OP_RETURN) {
|
||||
|
||||
if (cfnode->statements.size()) {
|
||||
code="return "+dump_node_code(cfnode->statements[0],p_level);
|
||||
} else {
|
||||
code="return";
|
||||
}
|
||||
}
|
||||
|
||||
} break;
|
||||
case SL::Node::TYPE_MEMBER: {
|
||||
SL::MemberNode *mnode=(SL::MemberNode*)p_node;
|
||||
code=dump_node_code(mnode->owner,p_level)+"."+mnode->name;
|
||||
|
||||
} break;
|
||||
}
|
||||
|
||||
return code;
|
||||
|
||||
}
|
||||
|
||||
static Error recreate_code(void *p_str,SL::ProgramNode *p_program) {
|
||||
|
||||
print_line("recr");
|
||||
String *str=(String*)p_str;
|
||||
|
||||
*str=dump_node_code(p_program,0);
|
||||
|
||||
return OK;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
MainLoop* test() {
|
||||
|
||||
List<String> cmdlargs = OS::get_singleton()->get_cmdline_args();
|
||||
|
||||
if (cmdlargs.empty()) {
|
||||
//try editor!
|
||||
return NULL;
|
||||
}
|
||||
|
||||
String test = cmdlargs.back()->get();
|
||||
|
||||
FileAccess *fa = FileAccess::open(test,FileAccess::READ);
|
||||
|
||||
if (!fa) {
|
||||
ERR_FAIL_V(NULL);
|
||||
}
|
||||
|
||||
String code;
|
||||
|
||||
while(true) {
|
||||
CharType c = fa->get_8();
|
||||
if (fa->eof_reached())
|
||||
break;
|
||||
code+=c;
|
||||
}
|
||||
|
||||
int errline;
|
||||
int errcol;
|
||||
String error;
|
||||
print_line(SL::lex_debug(code));
|
||||
Error err = SL::compile(code,ShaderLanguage::SHADER_MATERIAL_FRAGMENT,NULL,NULL,&error,&errline,&errcol);
|
||||
|
||||
if (err) {
|
||||
|
||||
print_line("Error: "+itos(errline)+":"+itos(errcol)+" "+error);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
print_line("Compile OK! - pretty printing");
|
||||
|
||||
String rcode;
|
||||
err = SL::compile(code,ShaderLanguage::SHADER_MATERIAL_FRAGMENT,recreate_code,&rcode,&error,&errline,&errcol);
|
||||
|
||||
if (!err) {
|
||||
print_line(rcode);
|
||||
}
|
||||
|
||||
ShaderCompilerGLES2 comp;
|
||||
String codeline,globalsline;
|
||||
SL::VarInfo vi;
|
||||
vi.name="mongs";
|
||||
vi.type=SL::TYPE_VEC3;
|
||||
|
||||
|
||||
ShaderCompilerGLES2::Flags fl;
|
||||
comp.compile(code,ShaderLanguage::SHADER_MATERIAL_FRAGMENT,codeline,globalsline,fl);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
40
bin/tests/test_shader_lang.h
Normal file
40
bin/tests/test_shader_lang.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*************************************************************************/
|
||||
/* test_shader_lang.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef TEST_SHADER_LANG_H
|
||||
#define TEST_SHADER_LANG_H
|
||||
|
||||
#include "os/main_loop.h"
|
||||
|
||||
namespace TestShaderLang {
|
||||
|
||||
MainLoop* test();
|
||||
|
||||
}
|
||||
|
||||
#endif // TEST_SHADER_LANG_H
|
||||
95
bin/tests/test_sound.cpp
Normal file
95
bin/tests/test_sound.cpp
Normal file
@ -0,0 +1,95 @@
|
||||
/*************************************************************************/
|
||||
/* test_sound.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "test_sound.h"
|
||||
#include "servers/visual_server.h"
|
||||
#include "os/main_loop.h"
|
||||
#include "math_funcs.h"
|
||||
#include "scene/resources/sample.h"
|
||||
#include "io/resource_loader.h"
|
||||
#include "print_string.h"
|
||||
#include "servers/audio_server.h"
|
||||
#include "os/os.h"
|
||||
namespace TestSound {
|
||||
|
||||
|
||||
class TestMainLoop : public MainLoop {
|
||||
|
||||
bool quit;
|
||||
Ref<Sample> sample;
|
||||
|
||||
public:
|
||||
virtual void input_event(const InputEvent& p_event) {
|
||||
|
||||
|
||||
}
|
||||
virtual void request_quit() {
|
||||
|
||||
quit=true;
|
||||
}
|
||||
|
||||
virtual void init() {
|
||||
|
||||
List<String> cmdline = OS::get_singleton()->get_cmdline_args();
|
||||
quit=false;
|
||||
if (cmdline.size()) {
|
||||
|
||||
sample=ResourceLoader::load(cmdline.back()->get());
|
||||
ERR_FAIL_COND(sample.is_null());
|
||||
print_line("Sample loaded OK");
|
||||
}
|
||||
|
||||
RID voice = AudioServer::get_singleton()->voice_create();
|
||||
AudioServer::get_singleton()->voice_play( voice, sample->get_rid() );
|
||||
|
||||
|
||||
}
|
||||
|
||||
virtual bool idle(float p_time) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
virtual bool iteration(float p_time) {
|
||||
|
||||
return quit;
|
||||
}
|
||||
virtual void finish() {
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
MainLoop* test() {
|
||||
|
||||
return memnew( TestMainLoop );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
40
bin/tests/test_sound.h
Normal file
40
bin/tests/test_sound.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*************************************************************************/
|
||||
/* test_sound.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef TEST_SOUND_H
|
||||
#define TEST_SOUND_H
|
||||
|
||||
#include "os/main_loop.h"
|
||||
|
||||
namespace TestSound {
|
||||
|
||||
MainLoop* test();
|
||||
|
||||
}
|
||||
|
||||
#endif // TEST_SOUND_H
|
||||
916
bin/tests/test_string.cpp
Normal file
916
bin/tests/test_string.cpp
Normal file
@ -0,0 +1,916 @@
|
||||
/*************************************************************************/
|
||||
/* test_string.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "ustring.h"
|
||||
#include <wchar.h>
|
||||
//#include "math_funcs.h"
|
||||
#include <stdio.h>
|
||||
#include "os/os.h"
|
||||
#include "drivers/trex/regex.h"
|
||||
|
||||
#include "test_string.h"
|
||||
|
||||
namespace TestString {
|
||||
|
||||
bool test_1() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 1: Assign from cstr\n");
|
||||
|
||||
String s = "Hello";
|
||||
|
||||
OS::get_singleton()->print("\tExpected: Hello\n");
|
||||
OS::get_singleton()->print("\tResulted: %ls\n",s.c_str());
|
||||
|
||||
return (wcscmp(s.c_str(),L"Hello")==0);
|
||||
|
||||
}
|
||||
|
||||
bool test_2() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 2: Assign from string (operator=)\n");
|
||||
|
||||
String s = "Dolly";
|
||||
String t = s;
|
||||
|
||||
OS::get_singleton()->print("\tExpected: Dolly\n");
|
||||
OS::get_singleton()->print("\tResulted: %ls\n",t.c_str());
|
||||
|
||||
return (wcscmp(t.c_str(),L"Dolly")==0);
|
||||
|
||||
}
|
||||
|
||||
bool test_3() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 3: Assign from c-string (copycon)\n");
|
||||
|
||||
String s("Sheep");
|
||||
String t(s);
|
||||
|
||||
OS::get_singleton()->print("\tExpected: Sheep\n");
|
||||
OS::get_singleton()->print("\tResulted: %ls\n",t.c_str());
|
||||
|
||||
return (wcscmp(t.c_str(),L"Sheep")==0);
|
||||
|
||||
}
|
||||
|
||||
bool test_4() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 4: Assign from c-widechar (operator=)\n");
|
||||
|
||||
String s(L"Give me");
|
||||
|
||||
OS::get_singleton()->print("\tExpected: Give me\n");
|
||||
OS::get_singleton()->print("\tResulted: %ls\n",s.c_str());
|
||||
|
||||
return (wcscmp(s.c_str(),L"Give me")==0);
|
||||
|
||||
}
|
||||
|
||||
bool test_5() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 5: Assign from c-widechar (copycon)\n");
|
||||
|
||||
String s(L"Wool");
|
||||
|
||||
OS::get_singleton()->print("\tExpected: Wool\n");
|
||||
OS::get_singleton()->print("\tResulted: %ls\n",s.c_str());
|
||||
|
||||
return (wcscmp(s.c_str(),L"Wool")==0);
|
||||
|
||||
}
|
||||
|
||||
bool test_6() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 6: comparisons (equal)\n");
|
||||
|
||||
|
||||
String s="Test Compare";
|
||||
|
||||
OS::get_singleton()->print("\tComparing to \"Test Compare\"\n");
|
||||
|
||||
if (! ( s=="Test Compare" ) )
|
||||
return false;
|
||||
|
||||
if (! ( s==L"Test Compare" ) )
|
||||
return false;
|
||||
|
||||
if (! ( s==String("Test Compare") ) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
bool test_7() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 7: comparisons (unequal)\n");
|
||||
|
||||
|
||||
String s="Test Compare";
|
||||
|
||||
OS::get_singleton()->print("\tComparing to \"Test Compare\"\n");
|
||||
|
||||
if (! ( s!="Peanut" ) )
|
||||
return false;
|
||||
|
||||
if (! ( s!=L"Coconut" ) )
|
||||
return false;
|
||||
|
||||
if (! ( s!=String("Butter") ) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
bool test_8() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 8: comparisons (operator<)\n");
|
||||
|
||||
|
||||
String s="Bees";
|
||||
|
||||
OS::get_singleton()->print("\tComparing to \"Bees\"\n");
|
||||
|
||||
if ( ! (s < "Elephant") )
|
||||
return false;
|
||||
|
||||
if ( s < L"Amber" )
|
||||
return false;
|
||||
|
||||
if ( s < String("Beatrix") )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
bool test_9() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 9: Concatenation\n");
|
||||
|
||||
|
||||
String s;
|
||||
|
||||
s+="Have";
|
||||
s+=' ';
|
||||
s+='a';
|
||||
s+=String(" ");
|
||||
s = s + L"Nice";
|
||||
s = s + " ";
|
||||
s = s + String("Day");
|
||||
|
||||
OS::get_singleton()->print("\tComparing to \"Have a Nice Day\"\n");
|
||||
|
||||
return (s == "Have a Nice Day");
|
||||
|
||||
}
|
||||
|
||||
bool test_10() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 10: Misc funcs (size/length/empty/etc)\n");
|
||||
|
||||
if (! String("").empty())
|
||||
return false;
|
||||
|
||||
if (String("Mellon").size() != 7)
|
||||
return false;
|
||||
|
||||
if (String("Oranges").length() != 7)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool test_11() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 11: Operator[]\n");
|
||||
|
||||
String a="Kugar Sane";
|
||||
|
||||
a[0]='S';
|
||||
a[6]='C';
|
||||
|
||||
if (a != "Sugar Cane")
|
||||
return false;
|
||||
|
||||
if (a[1]!='u')
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
bool test_12() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 12: case functions\n");
|
||||
|
||||
|
||||
String a="MoMoNgA";
|
||||
|
||||
if (a.to_upper() != "MOMONGA")
|
||||
return false;
|
||||
|
||||
if (a.nocasecmp_to("momonga")!=0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
bool test_13() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 13: UTF8\n");
|
||||
|
||||
/* how can i embed UTF in here? */
|
||||
|
||||
static const CharType ustr[] = { 0x304A , 0x360F, 0x3088, 0x3046, 0 };
|
||||
// static const wchar_t ustr[] = { 'P', 0xCE, 'p',0xD3, 0 };
|
||||
String s=ustr;
|
||||
|
||||
OS::get_singleton()->print("\tUnicode: %ls\n",ustr);
|
||||
s.parse_utf8( s.utf8().get_data() );
|
||||
OS::get_singleton()->print("\tConvert/Parse UTF8: %ls\n",s.c_str());
|
||||
|
||||
return (s==ustr);
|
||||
|
||||
}
|
||||
|
||||
bool test_14() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 14: ASCII\n");
|
||||
|
||||
String s = L"Primero Leche";
|
||||
OS::get_singleton()->print("\tAscii: %s\n",s.ascii().get_data());
|
||||
|
||||
String t=s.ascii().get_data();
|
||||
return (s==t);
|
||||
|
||||
}
|
||||
|
||||
bool test_15() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 15: substr\n");
|
||||
|
||||
String s="Killer Baby";
|
||||
OS::get_singleton()->print("\tsubstr(3,4) of \"%ls\" is \"%ls\"\n",s.c_str(),s.substr(3,4).c_str());
|
||||
|
||||
return (s.substr(3,4)=="ler ");
|
||||
|
||||
}
|
||||
|
||||
bool test_16() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 16: find\n");
|
||||
|
||||
String s="Pretty Woman";
|
||||
OS::get_singleton()->print("\tString: %ls\n",s.c_str());
|
||||
OS::get_singleton()->print("\t\"tty\" is at %i pos.\n",s.find("tty"));
|
||||
OS::get_singleton()->print("\t\"Revenge of the Monster Truck\" is at %i pos.\n",s.find("Revenge of the Monster Truck"));
|
||||
|
||||
if (s.find("tty")!=3)
|
||||
return false;
|
||||
|
||||
if (s.find("Revenge of the Monster Truck")!=-1)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
bool test_17() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 17: find no case\n");
|
||||
|
||||
String s="Pretty Whale";
|
||||
OS::get_singleton()->print("\tString: %ls\n",s.c_str());
|
||||
OS::get_singleton()->print("\t\"WHA\" is at %i pos.\n",s.findn("WHA"));
|
||||
OS::get_singleton()->print("\t\"Revenge of the Monster SawFish\" is at %i pos.\n",s.findn("Revenge of the Monster Truck"));
|
||||
|
||||
if (s.findn("WHA")!=7)
|
||||
return false;
|
||||
|
||||
if (s.findn("Revenge of the Monster SawFish")!=-1)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
bool test_18() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 18: find no case\n");
|
||||
|
||||
String s="Pretty Whale";
|
||||
OS::get_singleton()->print("\tString: %ls\n",s.c_str());
|
||||
OS::get_singleton()->print("\t\"WHA\" is at %i pos.\n",s.findn("WHA"));
|
||||
OS::get_singleton()->print("\t\"Revenge of the Monster SawFish\" is at %i pos.\n",s.findn("Revenge of the Monster Truck"));
|
||||
|
||||
if (s.findn("WHA")!=7)
|
||||
return false;
|
||||
|
||||
if (s.findn("Revenge of the Monster SawFish")!=-1)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
bool test_19() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 19: Search & replace\n");
|
||||
|
||||
String s="Happy Birthday, Anna!";
|
||||
OS::get_singleton()->print("\tString: %ls\n",s.c_str());
|
||||
|
||||
s=s.replace("Birthday","Halloween");
|
||||
OS::get_singleton()->print("\tReplaced Birthday/Halloween: %ls.\n",s.c_str());
|
||||
|
||||
return (s=="Happy Halloween, Anna!");
|
||||
|
||||
}
|
||||
|
||||
bool test_20() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 20: Insertion\n");
|
||||
|
||||
String s="Who is Frederic?";
|
||||
|
||||
OS::get_singleton()->print("\tString: %ls\n",s.c_str());
|
||||
s=s.insert( s.find("?")," Chopin" );
|
||||
OS::get_singleton()->print("\tInserted Chopin: %ls.\n",s.c_str());
|
||||
|
||||
return (s=="Who is Frederic Chopin?");
|
||||
|
||||
}
|
||||
|
||||
bool test_21() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 21: Number -> String\n");
|
||||
|
||||
OS::get_singleton()->print("\tPi is %f\n",33.141593);
|
||||
OS::get_singleton()->print("\tPi String is %ls\n",String::num(3.141593).c_str());
|
||||
|
||||
return String::num(3.141593)=="3.141593";
|
||||
|
||||
}
|
||||
|
||||
bool test_22() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 22: String -> Int\n");
|
||||
|
||||
static const char* nums[4]={ "1237461283", "- 22", "0", " - 1123412" };
|
||||
static const int num[4]={ 1237461283, -22, 0, -1123412 };
|
||||
|
||||
for (int i=0;i<4;i++) {
|
||||
OS::get_singleton()->print("\tString: \"%s\" as Int is %i\n",nums[i],String(nums[i]).to_int());
|
||||
|
||||
if (String(nums[i]).to_int()!=num[i])
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
bool test_23() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 23: String -> Float\n");
|
||||
|
||||
static const char* nums[4]={ "-12348298412.2", "0.05", "2.0002", " -0.0001" };
|
||||
static const double num[4]={ -12348298412.2, 0.05, 2.0002, -0.0001 };
|
||||
|
||||
for (int i=0;i<4;i++) {
|
||||
OS::get_singleton()->print("\tString: \"%s\" as Float is %f\n",nums[i],String(nums[i]).to_double());
|
||||
|
||||
if ( ABS(String(nums[i]).to_double()-num[i])>0.00001)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool test_24() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 24: Slicing\n");
|
||||
|
||||
String s="Mars,Jupiter,Saturn,Uranus";
|
||||
|
||||
const char*slices[4]={"Mars","Jupiter","Saturn","Uranus"};
|
||||
|
||||
OS::get_singleton()->print("\tSlicing \"%ls\" by \"%s\"..\n",s.c_str(),",");
|
||||
|
||||
for (int i=0;i<s.get_slice_count(",");i++) {
|
||||
|
||||
OS::get_singleton()->print("\t\t%i- %ls\n",i+1,s.get_slice(",",i).c_str());
|
||||
|
||||
|
||||
if (s.get_slice(",",i)!=slices[i])
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
bool test_25() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 25: Erasing\n");
|
||||
|
||||
String s="Josephine is such a cute girl!";
|
||||
|
||||
OS::get_singleton()->print("\tString: %ls\n",s.c_str());
|
||||
OS::get_singleton()->print("\tRemoving \"cute\"\n");
|
||||
|
||||
s.erase(s.find("cute "),String("cute ").length());
|
||||
OS::get_singleton()->print("\tResult: %ls\n",s.c_str());
|
||||
|
||||
|
||||
return (s=="Josephine is such a girl!");
|
||||
|
||||
}
|
||||
|
||||
bool test_26() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 26: RegEx\n");
|
||||
RegEx regexp("(.*):(.*)");
|
||||
List<String> captures;
|
||||
|
||||
bool match = regexp.match("name:password", &captures);
|
||||
printf("\tmatch: %s\n", match?"true":"false");
|
||||
|
||||
printf("\t%i captures:\n", captures.size());
|
||||
List<String>::Element *I = captures.front();
|
||||
while (I) {
|
||||
|
||||
printf("%ls\n", I->get().c_str());
|
||||
|
||||
I = I->next();
|
||||
};
|
||||
return captures.size();
|
||||
};
|
||||
|
||||
struct test_27_data {
|
||||
char const * data;
|
||||
char const * begin;
|
||||
bool expected;
|
||||
};
|
||||
|
||||
bool test_27() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 27: begins_with\n");
|
||||
test_27_data tc[] = {
|
||||
{"res://foobar", "res://", true},
|
||||
{"res", "res://", false},
|
||||
{"abc", "abc", true}
|
||||
};
|
||||
size_t count = sizeof(tc) / sizeof(tc[0]);
|
||||
bool state = true;
|
||||
for (size_t i = 0;state && i < count; ++i) {
|
||||
String s = tc[i].data;
|
||||
state = s.begins_with(tc[i].begin) == tc[i].expected;
|
||||
if (state) {
|
||||
String sb = tc[i].begin;
|
||||
state = s.begins_with(sb) == tc[i].expected;
|
||||
}
|
||||
if (!state) {
|
||||
OS::get_singleton()->print("\n\t Failure on:\n\t\tstring: ", tc[i].data, "\n\t\tbegin: ", tc[i].begin, "\n\t\texpected: ", tc[i].expected ? "true" : "false", "\n");
|
||||
break;
|
||||
}
|
||||
};
|
||||
return state;
|
||||
};
|
||||
|
||||
|
||||
bool test_28() {
|
||||
|
||||
OS::get_singleton()->print("\n\nTest 28: sprintf\n");
|
||||
|
||||
bool success, state = true;
|
||||
char output_format[] = "\tTest:\t%ls => %ls (%s)\n";
|
||||
String format, output;
|
||||
Array args;
|
||||
bool error;
|
||||
|
||||
// %%
|
||||
format = "fish %% frog";
|
||||
args.clear();
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish % frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
//////// INTS
|
||||
|
||||
// Int
|
||||
format = "fish %d frog";
|
||||
args.clear();
|
||||
args.push_back(5);
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish 5 frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// Int left padded with zeroes.
|
||||
format = "fish %05d frog";
|
||||
args.clear();
|
||||
args.push_back(5);
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish 00005 frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// Int left padded with spaces.
|
||||
format = "fish %5d frog";
|
||||
args.clear();
|
||||
args.push_back(5);
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish 5 frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// Int right padded with spaces.
|
||||
format = "fish %-5d frog";
|
||||
args.clear();
|
||||
args.push_back(5);
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish 5 frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// Int with sign (positive).
|
||||
format = "fish %+d frog";
|
||||
args.clear();
|
||||
args.push_back(5);
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish +5 frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// Negative int.
|
||||
format = "fish %d frog";
|
||||
args.clear();
|
||||
args.push_back(-5);
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish -5 frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// Hex (lower)
|
||||
format = "fish %x frog";
|
||||
args.clear();
|
||||
args.push_back(45);
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish 2d frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// Hex (upper)
|
||||
format = "fish %X frog";
|
||||
args.clear();
|
||||
args.push_back(45);
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish 2D frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// Octal
|
||||
format = "fish %o frog";
|
||||
args.clear();
|
||||
args.push_back(99);
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish 143 frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
////// REALS
|
||||
|
||||
// Real
|
||||
format = "fish %f frog";
|
||||
args.clear();
|
||||
args.push_back(99.99);
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish 99.990000 frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// Real left-padded
|
||||
format = "fish %11f frog";
|
||||
args.clear();
|
||||
args.push_back(99.99);
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish 99.990000 frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// Real right-padded
|
||||
format = "fish %-11f frog";
|
||||
args.clear();
|
||||
args.push_back(99.99);
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish 99.990000 frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// Real given int.
|
||||
format = "fish %f frog";
|
||||
args.clear();
|
||||
args.push_back(99);
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish 99.000000 frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// Real with sign (positive).
|
||||
format = "fish %+f frog";
|
||||
args.clear();
|
||||
args.push_back(99.99);
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish +99.990000 frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// Real with 1 decimals.
|
||||
format = "fish %.1f frog";
|
||||
args.clear();
|
||||
args.push_back(99.99);
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish 100.0 frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// Real with 12 decimals.
|
||||
format = "fish %.12f frog";
|
||||
args.clear();
|
||||
args.push_back(99.99);
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish 99.990000000000 frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// Real with no decimals.
|
||||
format = "fish %.f frog";
|
||||
args.clear();
|
||||
args.push_back(99.99);
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish 100 frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
/////// Strings.
|
||||
|
||||
// String
|
||||
format = "fish %s frog";
|
||||
args.clear();
|
||||
args.push_back("cheese");
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish cheese frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// String left-padded
|
||||
format = "fish %10s frog";
|
||||
args.clear();
|
||||
args.push_back("cheese");
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish cheese frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// String right-padded
|
||||
format = "fish %-10s frog";
|
||||
args.clear();
|
||||
args.push_back("cheese");
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish cheese frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
///// Characters
|
||||
|
||||
// Character as string.
|
||||
format = "fish %c frog";
|
||||
args.clear();
|
||||
args.push_back("A");
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish A frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// Character as int.
|
||||
format = "fish %c frog";
|
||||
args.clear();
|
||||
args.push_back(65);
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish A frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
///// Dynamic width
|
||||
|
||||
// String dynamic width
|
||||
format = "fish %*s frog";
|
||||
args.clear();
|
||||
args.push_back(10);
|
||||
args.push_back("cheese");
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish cheese frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// Int dynamic width
|
||||
format = "fish %*d frog";
|
||||
args.clear();
|
||||
args.push_back(10);
|
||||
args.push_back(99);
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish 99 frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// Float dynamic width
|
||||
format = "fish %*.*f frog";
|
||||
args.clear();
|
||||
args.push_back(10);
|
||||
args.push_back(3);
|
||||
args.push_back(99.99);
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == String("fish 99.990 frog") && !error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
///// Errors
|
||||
|
||||
// More formats than arguments.
|
||||
format = "fish %s %s frog";
|
||||
args.clear();
|
||||
args.push_back("cheese");
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == "not enough arguments for format string" && error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// More arguments than formats.
|
||||
format = "fish %s frog";
|
||||
args.clear();
|
||||
args.push_back("hello");
|
||||
args.push_back("cheese");
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == "not all arguments converted during string formatting" && error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// Incomplete format.
|
||||
format = "fish %10";
|
||||
args.clear();
|
||||
args.push_back("cheese");
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == "incomplete format" && error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// Bad character in format string
|
||||
format = "fish %&f frog";
|
||||
args.clear();
|
||||
args.push_back("cheese");
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == "unsupported format character" && error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// Too many decimals.
|
||||
format = "fish %2.2.2f frog";
|
||||
args.clear();
|
||||
args.push_back(99.99);
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == "too many decimal points in format" && error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// * not a number
|
||||
format = "fish %*f frog";
|
||||
args.clear();
|
||||
args.push_back("cheese");
|
||||
args.push_back(99.99);
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == "* wants number" && error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// Character too long.
|
||||
format = "fish %c frog";
|
||||
args.clear();
|
||||
args.push_back("sc");
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == "%c requires number or single-character string" && error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
// Character bad type.
|
||||
format = "fish %c frog";
|
||||
args.clear();
|
||||
args.push_back(Array());
|
||||
output = format.sprintf(args, &error);
|
||||
success = (output == "%c requires number or single-character string" && error);
|
||||
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
|
||||
if (!success) state = false;
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
typedef bool (*TestFunc)(void);
|
||||
|
||||
TestFunc test_funcs[] = {
|
||||
|
||||
test_1,
|
||||
test_2,
|
||||
test_3,
|
||||
test_4,
|
||||
test_5,
|
||||
test_6,
|
||||
test_7,
|
||||
test_8,
|
||||
test_9,
|
||||
test_10,
|
||||
test_11,
|
||||
test_12,
|
||||
test_13,
|
||||
test_14,
|
||||
test_15,
|
||||
test_16,
|
||||
test_17,
|
||||
test_18,
|
||||
test_19,
|
||||
test_20,
|
||||
test_21,
|
||||
test_22,
|
||||
test_23,
|
||||
test_24,
|
||||
test_25,
|
||||
test_26,
|
||||
test_27,
|
||||
test_28,
|
||||
0
|
||||
|
||||
};
|
||||
|
||||
MainLoop* test() {
|
||||
|
||||
/** A character length != wchar_t may be forced, so the tests wont work */
|
||||
|
||||
ERR_FAIL_COND_V( sizeof(CharType) != sizeof(wchar_t), NULL );
|
||||
|
||||
int count=0;
|
||||
int passed=0;
|
||||
|
||||
while(true) {
|
||||
if (!test_funcs[count])
|
||||
break;
|
||||
bool pass=test_funcs[count]();
|
||||
if (pass)
|
||||
passed++;
|
||||
OS::get_singleton()->print("\t%s\n",pass?"PASS":"FAILED");
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
OS::get_singleton()->print("\n\n\n");
|
||||
OS::get_singleton()->print("*************\n");
|
||||
OS::get_singleton()->print("***TOTALS!***\n");
|
||||
OS::get_singleton()->print("*************\n");
|
||||
|
||||
OS::get_singleton()->print("Passed %i of %i tests\n",count,passed);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
44
bin/tests/test_string.h
Normal file
44
bin/tests/test_string.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*************************************************************************/
|
||||
/* test_string.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef TEST_STRING_H
|
||||
#define TEST_STRING_H
|
||||
|
||||
#include "ustring.h"
|
||||
#include "os/main_loop.h"
|
||||
|
||||
namespace TestString {
|
||||
|
||||
MainLoop* test();
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
266
core/SCsub
266
core/SCsub
@ -1,231 +1,67 @@
|
||||
#!/usr/bin/env python
|
||||
Import('env')
|
||||
|
||||
Import("env")
|
||||
|
||||
import core_builders
|
||||
|
||||
env.core_sources = []
|
||||
env.core_sources=[]
|
||||
|
||||
|
||||
# Generate AES256 script encryption key
|
||||
gd_call=""
|
||||
gd_inc=""
|
||||
|
||||
for x in env.global_defaults:
|
||||
env.core_sources.append("#platform/"+x+"/globals/global_defaults.cpp")
|
||||
gd_inc+='#include "platform/'+x+'/globals/global_defaults.h"\n'
|
||||
gd_call+="\tregister_"+x+"_global_defaults();\n"
|
||||
|
||||
gd_cpp='#include "globals.h"\n'
|
||||
gd_cpp+=gd_inc
|
||||
gd_cpp+="void Globals::register_global_defaults() {\n"+gd_call+"\n}\n"
|
||||
|
||||
f = open("global_defaults.cpp","wb")
|
||||
f.write(gd_cpp)
|
||||
f.close()
|
||||
|
||||
import os
|
||||
|
||||
txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0"
|
||||
if "SCRIPT_AES256_ENCRYPTION_KEY" in os.environ:
|
||||
key = os.environ["SCRIPT_AES256_ENCRYPTION_KEY"]
|
||||
ec_valid = True
|
||||
if len(key) != 64:
|
||||
ec_valid = False
|
||||
else:
|
||||
txt = ""
|
||||
for i in range(len(key) >> 1):
|
||||
if i > 0:
|
||||
txt += ","
|
||||
txts = "0x" + key[i * 2 : i * 2 + 2]
|
||||
try:
|
||||
int(txts, 16)
|
||||
except Exception:
|
||||
ec_valid = False
|
||||
txt += txts
|
||||
if not ec_valid:
|
||||
print("Error: Invalid AES256 encryption key, not 64 hexadecimal characters: '" + key + "'.")
|
||||
print(
|
||||
"Unset 'SCRIPT_AES256_ENCRYPTION_KEY' in your environment "
|
||||
"or make sure that it contains exactly 64 hexadecimal characters."
|
||||
)
|
||||
Exit(255)
|
||||
if ("SCRIPT_AES256_ENCRYPTION_KEY" in os.environ):
|
||||
e=os.environ["SCRIPT_AES256_ENCRYPTION_KEY"]
|
||||
txt = ""
|
||||
ec_valid=True
|
||||
if (len(e)!=64):
|
||||
ec_valid=False
|
||||
else:
|
||||
|
||||
# NOTE: It is safe to generate this file here, since this is still executed serially
|
||||
with open("script_encryption_key.gen.cpp", "w") as f:
|
||||
f.write('#include "core/config/project_settings.h"\nuint8_t script_encryption_key[32]={' + txt + "};\n")
|
||||
for i in range(len(e)>>1):
|
||||
if (i>0):
|
||||
txt+=","
|
||||
txts="0x"+e[i*2:i*2+2]
|
||||
try:
|
||||
int(txts,16)
|
||||
except:
|
||||
ec_valid=False
|
||||
txt+=txts
|
||||
if (not ec_valid):
|
||||
txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0"
|
||||
print("Invalid AES256 encryption key, not 64 bits hex: "+e)
|
||||
|
||||
f = open("script_encryption_key.cpp", "wb")
|
||||
f.write("#include \"globals.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n")
|
||||
f.close()
|
||||
|
||||
|
||||
# Add required thirdparty code.
|
||||
|
||||
thirdparty_obj = []
|
||||
|
||||
env_thirdparty = env.Clone()
|
||||
env_thirdparty.disable_warnings()
|
||||
|
||||
# Misc thirdparty code: header paths are hardcoded, we don't need to append
|
||||
# to the include path (saves a few chars on the compiler invocation for touchy MSVC...)
|
||||
thirdparty_misc_dir = "#thirdparty/misc/"
|
||||
thirdparty_misc_sources = [
|
||||
# C sources
|
||||
"fastlz.c",
|
||||
"r128.c",
|
||||
"smaz.c",
|
||||
# C++ sources
|
||||
"pcg.cpp",
|
||||
"polypartition.cpp",
|
||||
"clipper.cpp",
|
||||
"smolv.cpp",
|
||||
]
|
||||
thirdparty_misc_sources = [thirdparty_misc_dir + file for file in thirdparty_misc_sources]
|
||||
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_misc_sources)
|
||||
|
||||
# Brotli
|
||||
if env["brotli"] and env["builtin_brotli"]:
|
||||
thirdparty_brotli_dir = "#thirdparty/brotli/"
|
||||
thirdparty_brotli_sources = [
|
||||
"common/constants.c",
|
||||
"common/context.c",
|
||||
"common/dictionary.c",
|
||||
"common/platform.c",
|
||||
"common/shared_dictionary.c",
|
||||
"common/transform.c",
|
||||
"dec/bit_reader.c",
|
||||
"dec/decode.c",
|
||||
"dec/huffman.c",
|
||||
"dec/state.c",
|
||||
]
|
||||
thirdparty_brotli_sources = [thirdparty_brotli_dir + file for file in thirdparty_brotli_sources]
|
||||
|
||||
env_thirdparty.Prepend(CPPPATH=[thirdparty_brotli_dir + "include"])
|
||||
env.Prepend(CPPPATH=[thirdparty_brotli_dir + "include"])
|
||||
|
||||
if env.get("use_ubsan") or env.get("use_asan") or env.get("use_tsan") or env.get("use_lsan") or env.get("use_msan"):
|
||||
env_thirdparty.Append(CPPDEFINES=["BROTLI_BUILD_PORTABLE"])
|
||||
|
||||
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_brotli_sources)
|
||||
|
||||
# Zlib library, can be unbundled
|
||||
if env["builtin_zlib"]:
|
||||
thirdparty_zlib_dir = "#thirdparty/zlib/"
|
||||
thirdparty_zlib_sources = [
|
||||
"adler32.c",
|
||||
"compress.c",
|
||||
"crc32.c",
|
||||
"deflate.c",
|
||||
"inffast.c",
|
||||
"inflate.c",
|
||||
"inftrees.c",
|
||||
"trees.c",
|
||||
"uncompr.c",
|
||||
"zutil.c",
|
||||
]
|
||||
thirdparty_zlib_sources = [thirdparty_zlib_dir + file for file in thirdparty_zlib_sources]
|
||||
|
||||
env_thirdparty.Prepend(CPPPATH=[thirdparty_zlib_dir])
|
||||
# Needs to be available in main env too
|
||||
env.Prepend(CPPPATH=[thirdparty_zlib_dir])
|
||||
if env.dev_build:
|
||||
env_thirdparty.Append(CPPDEFINES=["ZLIB_DEBUG"])
|
||||
|
||||
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_zlib_sources)
|
||||
|
||||
# Minizip library, could be unbundled in theory
|
||||
# However, our version has some custom modifications, so it won't compile with the system one
|
||||
thirdparty_minizip_dir = "#thirdparty/minizip/"
|
||||
thirdparty_minizip_sources = ["ioapi.c", "unzip.c", "zip.c"]
|
||||
thirdparty_minizip_sources = [thirdparty_minizip_dir + file for file in thirdparty_minizip_sources]
|
||||
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_minizip_sources)
|
||||
|
||||
# Zstd library, can be unbundled in theory
|
||||
# though we currently use some private symbols
|
||||
# https://github.com/godotengine/godot/issues/17374
|
||||
if env["builtin_zstd"]:
|
||||
thirdparty_zstd_dir = "#thirdparty/zstd/"
|
||||
thirdparty_zstd_sources = [
|
||||
"common/debug.c",
|
||||
"common/entropy_common.c",
|
||||
"common/error_private.c",
|
||||
"common/fse_decompress.c",
|
||||
"common/pool.c",
|
||||
"common/threading.c",
|
||||
"common/xxhash.c",
|
||||
"common/zstd_common.c",
|
||||
"compress/fse_compress.c",
|
||||
"compress/hist.c",
|
||||
"compress/huf_compress.c",
|
||||
"compress/zstd_compress.c",
|
||||
"compress/zstd_double_fast.c",
|
||||
"compress/zstd_fast.c",
|
||||
"compress/zstd_lazy.c",
|
||||
"compress/zstd_ldm.c",
|
||||
"compress/zstd_opt.c",
|
||||
"compress/zstdmt_compress.c",
|
||||
"compress/zstd_compress_literals.c",
|
||||
"compress/zstd_compress_sequences.c",
|
||||
"compress/zstd_compress_superblock.c",
|
||||
"decompress/huf_decompress.c",
|
||||
"decompress/zstd_ddict.c",
|
||||
"decompress/zstd_decompress_block.c",
|
||||
"decompress/zstd_decompress.c",
|
||||
]
|
||||
if env["platform"] in ["android", "ios", "linuxbsd", "macos"]:
|
||||
# Match platforms with ZSTD_ASM_SUPPORTED in common/portability_macros.h
|
||||
thirdparty_zstd_sources.append("decompress/huf_decompress_amd64.S")
|
||||
thirdparty_zstd_sources = [thirdparty_zstd_dir + file for file in thirdparty_zstd_sources]
|
||||
|
||||
env_thirdparty.Prepend(CPPPATH=[thirdparty_zstd_dir, thirdparty_zstd_dir + "common"])
|
||||
env_thirdparty.Append(CPPDEFINES=["ZSTD_STATIC_LINKING_ONLY"])
|
||||
env.Prepend(CPPPATH=thirdparty_zstd_dir)
|
||||
# Also needed in main env includes will trigger warnings
|
||||
env.Append(CPPDEFINES=["ZSTD_STATIC_LINKING_ONLY"])
|
||||
|
||||
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_zstd_sources)
|
||||
env.add_source_files(env.core_sources,"*.cpp")
|
||||
|
||||
|
||||
env.core_sources += thirdparty_obj
|
||||
Export('env')
|
||||
|
||||
import make_binders
|
||||
env.Command(['method_bind.inc','method_bind_ext.inc'], 'make_binders.py', make_binders.run)
|
||||
|
||||
# Godot source files
|
||||
SConscript('os/SCsub');
|
||||
SConscript('math/SCsub');
|
||||
SConscript('io/SCsub');
|
||||
SConscript('bind/SCsub');
|
||||
|
||||
env.add_source_files(env.core_sources, "*.cpp")
|
||||
env.add_source_files(env.core_sources, "script_encryption_key.gen.cpp")
|
||||
env.add_source_files(env.core_sources, "version_hash.gen.cpp")
|
||||
lib = env.Library("core",env.core_sources)
|
||||
|
||||
# Certificates
|
||||
env.Depends(
|
||||
"#core/io/certs_compressed.gen.h",
|
||||
["#thirdparty/certs/ca-certificates.crt", env.Value(env["builtin_certs"]), env.Value(env["system_certs_path"])],
|
||||
)
|
||||
env.CommandNoCache(
|
||||
"#core/io/certs_compressed.gen.h",
|
||||
"#thirdparty/certs/ca-certificates.crt",
|
||||
env.Run(core_builders.make_certs_header, "Building ca-certificates header."),
|
||||
)
|
||||
|
||||
# Authors
|
||||
env.Depends("#core/authors.gen.h", "../AUTHORS.md")
|
||||
env.CommandNoCache(
|
||||
"#core/authors.gen.h", "../AUTHORS.md", env.Run(core_builders.make_authors_header, "Generating authors header.")
|
||||
)
|
||||
|
||||
# Donors
|
||||
env.Depends("#core/donors.gen.h", "../DONORS.md")
|
||||
env.CommandNoCache(
|
||||
"#core/donors.gen.h", "../DONORS.md", env.Run(core_builders.make_donors_header, "Generating donors header.")
|
||||
)
|
||||
|
||||
# License
|
||||
env.Depends("#core/license.gen.h", ["../COPYRIGHT.txt", "../LICENSE.txt"])
|
||||
env.CommandNoCache(
|
||||
"#core/license.gen.h",
|
||||
["../COPYRIGHT.txt", "../LICENSE.txt"],
|
||||
env.Run(core_builders.make_license_header, "Generating license header."),
|
||||
)
|
||||
|
||||
# Chain load SCsubs
|
||||
SConscript("os/SCsub")
|
||||
SConscript("math/SCsub")
|
||||
SConscript("crypto/SCsub")
|
||||
SConscript("io/SCsub")
|
||||
SConscript("debugger/SCsub")
|
||||
SConscript("input/SCsub")
|
||||
SConscript("variant/SCsub")
|
||||
SConscript("extension/SCsub")
|
||||
SConscript("object/SCsub")
|
||||
SConscript("templates/SCsub")
|
||||
SConscript("string/SCsub")
|
||||
SConscript("config/SCsub")
|
||||
SConscript("error/SCsub")
|
||||
|
||||
|
||||
# Build it all as a library
|
||||
lib = env.add_library("core", env.core_sources)
|
||||
env.Prepend(LIBS=[lib])
|
||||
|
||||
# Needed to force rebuilding the core files when the thirdparty code is updated.
|
||||
env.Depends(lib, thirdparty_obj)
|
||||
|
||||
|
||||
198
core/allocators.h
Normal file
198
core/allocators.h
Normal file
@ -0,0 +1,198 @@
|
||||
/*************************************************************************/
|
||||
/* allocators.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef ALLOCATORS_H
|
||||
#define ALLOCATORS_H
|
||||
|
||||
#include "os/memory.h"
|
||||
template<int PREALLOC_COUNT=64, int MAX_HANDS=8>
|
||||
class BalloonAllocator {
|
||||
|
||||
enum {
|
||||
|
||||
USED_FLAG=(1<<30),
|
||||
USED_MASK=USED_FLAG-1
|
||||
};
|
||||
|
||||
struct Balloon {
|
||||
|
||||
Balloon *next;
|
||||
Balloon *prev;
|
||||
uint32_t hand;
|
||||
};
|
||||
|
||||
|
||||
struct Hand {
|
||||
|
||||
int used;
|
||||
int allocated;
|
||||
Balloon *first;
|
||||
Balloon *last;
|
||||
};
|
||||
|
||||
|
||||
Hand hands[MAX_HANDS];
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
void* alloc(size_t p_size) {
|
||||
|
||||
size_t max=(1<<MAX_HANDS);
|
||||
ERR_FAIL_COND_V( p_size>max, NULL );
|
||||
|
||||
unsigned int hand=0;
|
||||
|
||||
while(p_size>(size_t)(1<<hand)) ++hand;
|
||||
|
||||
Hand &h=hands[hand];
|
||||
|
||||
if (h.used==h.allocated) {
|
||||
|
||||
for(int i=0;i<PREALLOC_COUNT;i++) {
|
||||
|
||||
Balloon *b = (Balloon*)memalloc(sizeof(Balloon)+(1<<hand));
|
||||
b->hand=hand;
|
||||
if (h.last) {
|
||||
|
||||
b->prev=h.last;
|
||||
h.last->next=b;
|
||||
h.last=b;
|
||||
} else {
|
||||
|
||||
b->prev=NULL;
|
||||
h.last=b;
|
||||
h.first=b;
|
||||
}
|
||||
}
|
||||
|
||||
h.last->next=NULL;
|
||||
h.allocated+=PREALLOC_COUNT;
|
||||
}
|
||||
|
||||
Balloon *pick=h.last;
|
||||
|
||||
ERR_FAIL_COND_V( (pick->hand&USED_FLAG), NULL );
|
||||
|
||||
// remove last
|
||||
h.last=h.last->prev;
|
||||
h.last->next=NULL;
|
||||
|
||||
pick->next=h.first;
|
||||
h.first->prev=pick;
|
||||
pick->prev=NULL;
|
||||
h.first=pick;
|
||||
h.used++;
|
||||
pick->hand|=USED_FLAG;
|
||||
|
||||
return (void*)(pick+1);
|
||||
}
|
||||
|
||||
void free(void* p_ptr) {
|
||||
|
||||
Balloon *b=(Balloon*)p_ptr;
|
||||
b-=1;
|
||||
|
||||
ERR_FAIL_COND(!(b->hand&USED_FLAG) );
|
||||
|
||||
b->hand=b->hand&USED_MASK; // not used
|
||||
int hand=b->hand;
|
||||
|
||||
Hand &h=hands[hand];
|
||||
|
||||
if (b==h.first)
|
||||
h.first=b->next;
|
||||
|
||||
if (b->prev)
|
||||
b->prev->next=b->next;
|
||||
if (b->next)
|
||||
b->next->prev=b->prev;
|
||||
|
||||
if (h.last!=b) {
|
||||
h.last->next=b;
|
||||
b->prev=h.last;
|
||||
b->next=NULL;
|
||||
h.last=b;
|
||||
}
|
||||
|
||||
h.used--;
|
||||
|
||||
if (h.used<=(h.allocated-(PREALLOC_COUNT*2))) { // this is done to ensure no alloc/free is done constantly
|
||||
|
||||
for(int i=0;i<PREALLOC_COUNT;i++) {
|
||||
ERR_CONTINUE( h.last->hand& USED_FLAG );
|
||||
|
||||
Balloon *new_last=h.last->prev;
|
||||
if (new_last)
|
||||
new_last->next=NULL;
|
||||
memfree( h.last );
|
||||
h.last=new_last;
|
||||
}
|
||||
h.allocated-=PREALLOC_COUNT;
|
||||
}
|
||||
}
|
||||
|
||||
BalloonAllocator() {
|
||||
|
||||
for(int i=0;i<MAX_HANDS;i++) {
|
||||
|
||||
hands[i].allocated=0;
|
||||
hands[i].used=0;
|
||||
hands[i].first=NULL;
|
||||
hands[i].last=NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void clear() {
|
||||
|
||||
for(int i=0;i<MAX_HANDS;i++) {
|
||||
|
||||
while(hands[i].first) {
|
||||
|
||||
Balloon *b=hands[i].first;
|
||||
hands[i].first=b->next;
|
||||
memfree(b);
|
||||
}
|
||||
|
||||
hands[i].allocated=0;
|
||||
hands[i].used=0;
|
||||
hands[i].first=NULL;
|
||||
hands[i].last=NULL;
|
||||
}
|
||||
}
|
||||
|
||||
~BalloonAllocator() {
|
||||
|
||||
clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif // ALLOCATORS_H
|
||||
241
core/array.cpp
Normal file
241
core/array.cpp
Normal file
@ -0,0 +1,241 @@
|
||||
/*************************************************************************/
|
||||
/* array.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "array.h"
|
||||
#include "vector.h"
|
||||
#include "hashfuncs.h"
|
||||
#include "variant.h"
|
||||
#include "object.h"
|
||||
|
||||
struct ArrayPrivate {
|
||||
|
||||
SafeRefCount refcount;
|
||||
Vector<Variant> array;
|
||||
bool shared;
|
||||
};
|
||||
|
||||
void Array::_ref(const Array& p_from) const {
|
||||
|
||||
ArrayPrivate *_fp = p_from._p;
|
||||
|
||||
ERR_FAIL_COND(!_fp); // should NOT happen.
|
||||
|
||||
if (_fp == _p)
|
||||
return; //wathever it is, nothing to do here move along
|
||||
|
||||
bool success = _fp->refcount.ref();
|
||||
|
||||
ERR_FAIL_COND(!success); //should really not happen either
|
||||
|
||||
_unref();
|
||||
|
||||
if (_fp->shared) {
|
||||
|
||||
_p = p_from._p;
|
||||
|
||||
} else {
|
||||
|
||||
_p = memnew( ArrayPrivate );
|
||||
_p->shared=false;
|
||||
_p->refcount.init();
|
||||
_p->array=_fp->array;
|
||||
|
||||
if (_fp->refcount.unref())
|
||||
memdelete(_fp);
|
||||
}
|
||||
}
|
||||
|
||||
void Array::_unref() const {
|
||||
|
||||
if (!_p)
|
||||
return;
|
||||
|
||||
if (_p->refcount.unref()) {
|
||||
memdelete(_p);
|
||||
}
|
||||
_p=NULL;
|
||||
}
|
||||
|
||||
|
||||
Variant& Array::operator[](int p_idx) {
|
||||
|
||||
return _p->array[p_idx];
|
||||
}
|
||||
|
||||
const Variant& Array::operator[](int p_idx) const {
|
||||
|
||||
return _p->array[p_idx];
|
||||
|
||||
}
|
||||
|
||||
int Array::size() const {
|
||||
|
||||
return _p->array.size();
|
||||
}
|
||||
bool Array::empty() const {
|
||||
|
||||
return _p->array.empty();
|
||||
}
|
||||
void Array::clear() {
|
||||
|
||||
_p->array.clear();
|
||||
}
|
||||
|
||||
bool Array::is_shared() const {
|
||||
|
||||
return _p->shared;
|
||||
}
|
||||
|
||||
bool Array::operator==(const Array& p_array) const {
|
||||
|
||||
return _p==p_array._p;
|
||||
}
|
||||
|
||||
uint32_t Array::hash() const {
|
||||
|
||||
uint32_t h=hash_djb2_one_32(0);
|
||||
|
||||
for (int i=0;i<_p->array.size();i++) {
|
||||
|
||||
h = hash_djb2_one_32( _p->array[i].hash(), h);
|
||||
}
|
||||
return h;
|
||||
}
|
||||
void Array::operator=(const Array& p_array) {
|
||||
|
||||
_ref(p_array);
|
||||
}
|
||||
void Array::push_back(const Variant& p_value) {
|
||||
|
||||
_p->array.push_back(p_value);
|
||||
}
|
||||
|
||||
Error Array::resize(int p_new_size) {
|
||||
|
||||
return _p->array.resize(p_new_size);
|
||||
}
|
||||
|
||||
void Array::insert(int p_pos, const Variant& p_value) {
|
||||
|
||||
_p->array.insert(p_pos,p_value);
|
||||
}
|
||||
|
||||
void Array::erase(const Variant& p_value) {
|
||||
|
||||
_p->array.erase(p_value);
|
||||
}
|
||||
|
||||
int Array::find(const Variant& p_value) const {
|
||||
|
||||
return _p->array.find(p_value);
|
||||
}
|
||||
|
||||
void Array::remove(int p_pos) {
|
||||
|
||||
_p->array.remove(p_pos);
|
||||
}
|
||||
|
||||
|
||||
void Array::set(int p_idx,const Variant& p_value) {
|
||||
|
||||
operator[](p_idx)=p_value;
|
||||
}
|
||||
|
||||
const Variant& Array::get(int p_idx) const {
|
||||
|
||||
return operator[](p_idx);
|
||||
}
|
||||
|
||||
struct _ArrayVariantSort {
|
||||
|
||||
_FORCE_INLINE_ bool operator()(const Variant& p_l, const Variant& p_r) const {
|
||||
bool valid=false;
|
||||
Variant res;
|
||||
Variant::evaluate(Variant::OP_LESS,p_l,p_r,res,valid);
|
||||
if (!valid)
|
||||
res=false;
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
void Array::sort() {
|
||||
|
||||
_p->array.sort_custom<_ArrayVariantSort>();
|
||||
|
||||
}
|
||||
|
||||
struct _ArrayVariantSortCustom {
|
||||
|
||||
Object *obj;
|
||||
StringName func;
|
||||
|
||||
_FORCE_INLINE_ bool operator()(const Variant& p_l, const Variant& p_r) const {
|
||||
|
||||
const Variant*args[2]={&p_l,&p_r};
|
||||
Variant::CallError err;
|
||||
bool res = obj->call(func,args,2,err);
|
||||
if (err.error!=Variant::CallError::CALL_OK)
|
||||
res=false;
|
||||
return res;
|
||||
|
||||
}
|
||||
};
|
||||
void Array::sort_custom(Object *p_obj,const StringName& p_function){
|
||||
|
||||
ERR_FAIL_NULL(p_obj);
|
||||
|
||||
SortArray<Variant,_ArrayVariantSortCustom> avs;
|
||||
avs.compare.obj=p_obj;
|
||||
avs.compare.func=p_function;
|
||||
avs.sort(_p->array.ptr(),_p->array.size());
|
||||
|
||||
}
|
||||
|
||||
void Array::invert(){
|
||||
|
||||
_p->array.invert();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Array::Array(const Array& p_from) {
|
||||
|
||||
_p=NULL;
|
||||
_ref(p_from);
|
||||
|
||||
}
|
||||
Array::Array(bool p_shared) {
|
||||
|
||||
_p = memnew( ArrayPrivate );
|
||||
_p->refcount.init();
|
||||
_p->shared=p_shared;
|
||||
}
|
||||
Array::~Array() {
|
||||
|
||||
_unref();
|
||||
}
|
||||
84
core/array.h
Normal file
84
core/array.h
Normal file
@ -0,0 +1,84 @@
|
||||
/*************************************************************************/
|
||||
/* array.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef ARRAY_H
|
||||
#define ARRAY_H
|
||||
|
||||
#include "typedefs.h"
|
||||
class Variant;
|
||||
class ArrayPrivate;
|
||||
class Object;
|
||||
class StringName;
|
||||
|
||||
class Array {
|
||||
|
||||
mutable ArrayPrivate *_p;
|
||||
void _ref(const Array& p_from) const;
|
||||
void _unref() const;
|
||||
|
||||
public:
|
||||
|
||||
Variant& operator[](int p_idx);
|
||||
const Variant& operator[](int p_idx) const;
|
||||
|
||||
void set(int p_idx,const Variant& p_value);
|
||||
const Variant& get(int p_idx) const;
|
||||
|
||||
int size() const;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
|
||||
bool is_shared() const;
|
||||
|
||||
bool operator==(const Array& p_array) const;
|
||||
|
||||
uint32_t hash() const;
|
||||
void operator=(const Array& p_array);
|
||||
|
||||
void push_back(const Variant& p_value);
|
||||
_FORCE_INLINE_ void append(const Variant& p_value) { push_back(p_value); } //for python compatibility
|
||||
Error resize(int p_new_size);
|
||||
|
||||
void insert(int p_pos, const Variant& p_value);
|
||||
void remove(int p_pos);
|
||||
|
||||
void sort();
|
||||
void sort_custom(Object *p_obj,const StringName& p_function);
|
||||
void invert();
|
||||
|
||||
int find(const Variant& p_value) const;
|
||||
|
||||
void erase(const Variant& p_value);
|
||||
|
||||
Array(const Array& p_from);
|
||||
Array(bool p_shared=false);
|
||||
~Array();
|
||||
|
||||
};
|
||||
|
||||
#endif // ARRAY_H
|
||||
35
core/balloon_allocator.h
Normal file
35
core/balloon_allocator.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*************************************************************************/
|
||||
/* balloon_allocator.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef BALLOON_ALLOCATOR_H
|
||||
#define BALLOON_ALLOCATOR_H
|
||||
|
||||
#include "os/memory.h"
|
||||
|
||||
#include "allocators.h"
|
||||
#endif // BALLOON_ALLOCATOR_H
|
||||
7
core/bind/SCsub
Normal file
7
core/bind/SCsub
Normal file
@ -0,0 +1,7 @@
|
||||
Import('env')
|
||||
|
||||
env.add_source_files(env.core_sources,"*.cpp")
|
||||
|
||||
Export('env')
|
||||
|
||||
|
||||
1878
core/bind/core_bind.cpp
Normal file
1878
core/bind/core_bind.cpp
Normal file
File diff suppressed because it is too large
Load Diff
505
core/bind/core_bind.h
Normal file
505
core/bind/core_bind.h
Normal file
@ -0,0 +1,505 @@
|
||||
#ifndef CORE_BIND_H
|
||||
#define CORE_BIND_H
|
||||
|
||||
#include "io/resource_loader.h"
|
||||
#include "io/resource_saver.h"
|
||||
#include "os/file_access.h"
|
||||
#include "os/dir_access.h"
|
||||
#include "os/thread.h"
|
||||
#include "os/semaphore.h"
|
||||
|
||||
|
||||
class _ResourceLoader : public Object {
|
||||
OBJ_TYPE(_ResourceLoader,Object);
|
||||
|
||||
protected:
|
||||
|
||||
static void _bind_methods();
|
||||
static _ResourceLoader *singleton;
|
||||
public:
|
||||
|
||||
|
||||
static _ResourceLoader *get_singleton() { return singleton; }
|
||||
Ref<ResourceInteractiveLoader> load_interactive(const String& p_path,const String& p_type_hint="");
|
||||
RES load(const String &p_path,const String& p_type_hint="", bool p_no_cache = false);
|
||||
DVector<String> get_recognized_extensions_for_type(const String& p_type);
|
||||
void set_abort_on_missing_resources(bool p_abort);
|
||||
StringArray get_dependencies(const String& p_path);
|
||||
bool has(const String& p_path);
|
||||
|
||||
_ResourceLoader();
|
||||
};
|
||||
|
||||
class _ResourceSaver : public Object {
|
||||
OBJ_TYPE(_ResourceSaver,Object);
|
||||
|
||||
protected:
|
||||
|
||||
static void _bind_methods();
|
||||
static _ResourceSaver *singleton;
|
||||
public:
|
||||
|
||||
enum SaverFlags {
|
||||
|
||||
FLAG_RELATIVE_PATHS=1,
|
||||
FLAG_BUNDLE_RESOURCES=2,
|
||||
FLAG_CHANGE_PATH=4,
|
||||
FLAG_OMIT_EDITOR_PROPERTIES=8,
|
||||
FLAG_SAVE_BIG_ENDIAN=16,
|
||||
FLAG_COMPRESS=32,
|
||||
};
|
||||
|
||||
static _ResourceSaver *get_singleton() { return singleton; }
|
||||
|
||||
Error save(const String &p_path,const RES& p_resource, uint32_t p_flags);
|
||||
DVector<String> get_recognized_extensions(const RES& p_resource);
|
||||
|
||||
|
||||
_ResourceSaver();
|
||||
};
|
||||
|
||||
class MainLoop;
|
||||
|
||||
class _OS : public Object {
|
||||
OBJ_TYPE(_OS,Object);
|
||||
|
||||
protected:
|
||||
|
||||
static void _bind_methods();
|
||||
static _OS *singleton;
|
||||
public:
|
||||
|
||||
enum Weekday {
|
||||
DAY_SUNDAY,
|
||||
DAY_MONDAY,
|
||||
DAY_TUESDAY,
|
||||
DAY_WEDNESDAY,
|
||||
DAY_THURSDAY,
|
||||
DAY_FRIDAY,
|
||||
DAY_SATURDAY
|
||||
};
|
||||
|
||||
enum Month {
|
||||
MONTH_JANUARY,
|
||||
MONTH_FEBRUARY,
|
||||
MONTH_MARCH,
|
||||
MONTH_APRIL,
|
||||
MONTH_MAY,
|
||||
MONTH_JUNE,
|
||||
MONTH_JULY,
|
||||
MONTH_AUGUST,
|
||||
MONTH_SEPTEMBER,
|
||||
MONTH_OCTOBER,
|
||||
MONTH_NOVEMBER,
|
||||
MONTH_DECEMBER
|
||||
};
|
||||
|
||||
Point2 get_mouse_pos() const;
|
||||
void set_window_title(const String& p_title);
|
||||
int get_mouse_button_state() const;
|
||||
|
||||
|
||||
void set_clipboard(const String& p_text);
|
||||
String get_clipboard() const;
|
||||
|
||||
void set_video_mode(const Size2& p_size, bool p_fullscreen,bool p_resizeable,int p_screen=0);
|
||||
Size2 get_video_mode(int p_screen=0) const;
|
||||
bool is_video_mode_fullscreen(int p_screen=0) const;
|
||||
bool is_video_mode_resizable(int p_screen=0) const;
|
||||
Array get_fullscreen_mode_list(int p_screen=0) const;
|
||||
|
||||
|
||||
virtual int get_screen_count() const;
|
||||
virtual int get_current_screen() const;
|
||||
virtual void set_current_screen(int p_screen);
|
||||
virtual Point2 get_screen_position(int p_screen=0) const;
|
||||
virtual Size2 get_screen_size(int p_screen=0) const;
|
||||
virtual Point2 get_window_position() const;
|
||||
virtual void set_window_position(const Point2& p_position);
|
||||
virtual Size2 get_window_size() const;
|
||||
virtual void set_window_size(const Size2& p_size);
|
||||
virtual void set_window_fullscreen(bool p_enabled);
|
||||
virtual bool is_window_fullscreen() const;
|
||||
virtual void set_window_resizable(bool p_enabled);
|
||||
virtual bool is_window_resizable() const;
|
||||
virtual void set_window_minimized(bool p_enabled);
|
||||
virtual bool is_window_minimized() const;
|
||||
virtual void set_window_maximized(bool p_enabled);
|
||||
virtual bool is_window_maximized() const;
|
||||
|
||||
|
||||
Error native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track);
|
||||
bool native_video_is_playing();
|
||||
void native_video_pause();
|
||||
void native_video_stop();
|
||||
|
||||
void set_iterations_per_second(int p_ips);
|
||||
int get_iterations_per_second() const;
|
||||
|
||||
void set_target_fps(int p_fps);
|
||||
float get_target_fps() const;
|
||||
|
||||
void set_low_processor_usage_mode(bool p_enabled);
|
||||
bool is_in_low_processor_usage_mode() const;
|
||||
|
||||
String get_executable_path() const;
|
||||
int execute(const String& p_path, const Vector<String> & p_arguments,bool p_blocking,Array p_output=Array());
|
||||
|
||||
Error kill(int p_pid);
|
||||
Error shell_open(String p_uri);
|
||||
|
||||
int get_process_ID() const;
|
||||
|
||||
bool has_environment(const String& p_var) const;
|
||||
String get_environment(const String& p_var) const;
|
||||
|
||||
String get_name() const;
|
||||
Vector<String> get_cmdline_args();
|
||||
|
||||
String get_locale() const;
|
||||
String get_model_name() const;
|
||||
MainLoop *get_main_loop() const;
|
||||
|
||||
String get_custom_level() const;
|
||||
|
||||
float get_frames_per_second() const;
|
||||
|
||||
void dump_memory_to_file(const String& p_file);
|
||||
void dump_resources_to_file(const String& p_file);
|
||||
|
||||
void print_resources_in_use(bool p_short=false);
|
||||
void print_all_resources(const String& p_to_file);
|
||||
void print_all_textures_by_size();
|
||||
void print_resources_by_type(const Vector<String>& p_types);
|
||||
|
||||
bool has_touchscreen_ui_hint() const;
|
||||
|
||||
bool is_debug_build() const;
|
||||
|
||||
String get_unique_ID() const;
|
||||
|
||||
String get_scancode_string(uint32_t p_code) const;
|
||||
bool is_scancode_unicode(uint32_t p_unicode) const;
|
||||
int find_scancode_from_string(const String& p_code) const;
|
||||
|
||||
|
||||
/*
|
||||
struct Date {
|
||||
|
||||
int year;
|
||||
Month month;
|
||||
int day;
|
||||
Weekday weekday;
|
||||
bool dst;
|
||||
};
|
||||
|
||||
struct Time {
|
||||
|
||||
int hour;
|
||||
int min;
|
||||
int sec;
|
||||
};
|
||||
*/
|
||||
|
||||
void set_use_file_access_save_and_swap(bool p_enable);
|
||||
|
||||
void set_icon(const Image& p_icon);
|
||||
Dictionary get_date() const;
|
||||
Dictionary get_time() const;
|
||||
uint64_t get_unix_time() const;
|
||||
|
||||
int get_static_memory_usage() const;
|
||||
int get_static_memory_peak_usage() const;
|
||||
int get_dynamic_memory_usage() const;
|
||||
|
||||
void delay_usec(uint32_t p_usec) const;
|
||||
void delay_msec(uint32_t p_msec) const;
|
||||
uint32_t get_ticks_msec() const;
|
||||
uint32_t get_splash_tick_msec() const;
|
||||
|
||||
bool can_use_threads() const;
|
||||
|
||||
bool can_draw() const;
|
||||
|
||||
int get_frames_drawn();
|
||||
|
||||
bool is_stdout_verbose() const;
|
||||
|
||||
int get_processor_count() const;
|
||||
|
||||
enum SystemDir {
|
||||
SYSTEM_DIR_DESKTOP,
|
||||
SYSTEM_DIR_DCIM,
|
||||
SYSTEM_DIR_DOCUMENTS,
|
||||
SYSTEM_DIR_DOWNLOADS,
|
||||
SYSTEM_DIR_MOVIES,
|
||||
SYSTEM_DIR_MUSIC,
|
||||
SYSTEM_DIR_PICTURES,
|
||||
SYSTEM_DIR_RINGTONES,
|
||||
};
|
||||
|
||||
String get_system_dir(SystemDir p_dir) const;
|
||||
|
||||
|
||||
String get_data_dir() const;
|
||||
|
||||
void set_time_scale(float p_scale);
|
||||
float get_time_scale();
|
||||
|
||||
bool is_ok_left_and_cancel_right() const;
|
||||
|
||||
static _OS *get_singleton() { return singleton; }
|
||||
|
||||
_OS();
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(_OS::SystemDir);
|
||||
|
||||
|
||||
class _Geometry : public Object {
|
||||
|
||||
OBJ_TYPE(_Geometry, Object);
|
||||
|
||||
static _Geometry *singleton;
|
||||
protected:
|
||||
|
||||
static void _bind_methods();
|
||||
public:
|
||||
|
||||
static _Geometry *get_singleton();
|
||||
DVector<Plane> build_box_planes(const Vector3& p_extents);
|
||||
DVector<Plane> build_cylinder_planes(float p_radius, float p_height, int p_sides, Vector3::Axis p_axis=Vector3::AXIS_Z);
|
||||
DVector<Plane> build_capsule_planes(float p_radius, float p_height, int p_sides, int p_lats, Vector3::Axis p_axis=Vector3::AXIS_Z);
|
||||
Variant segment_intersects_segment_2d(const Vector2& p_from_a,const Vector2& p_to_a,const Vector2& p_from_b,const Vector2& p_to_b);
|
||||
DVector<Vector2> get_closest_points_between_segments_2d( const Vector2& p1,const Vector2& q1, const Vector2& p2,const Vector2& q2);
|
||||
DVector<Vector3> get_closest_points_between_segments(const Vector3& p1,const Vector3& p2,const Vector3& q1,const Vector3& q2);
|
||||
Vector3 get_closest_point_to_segment(const Vector3& p_point, const Vector3& p_a,const Vector3& p_b);
|
||||
Variant ray_intersects_triangle( const Vector3& p_from, const Vector3& p_dir, const Vector3& p_v0,const Vector3& p_v1,const Vector3& p_v2);
|
||||
Variant segment_intersects_triangle( const Vector3& p_from, const Vector3& p_to, const Vector3& p_v0,const Vector3& p_v1,const Vector3& p_v2);
|
||||
bool point_is_inside_triangle(const Vector2& s, const Vector2& a, const Vector2& b, const Vector2& c) const;
|
||||
|
||||
DVector<Vector3> segment_intersects_sphere( const Vector3& p_from, const Vector3& p_to, const Vector3& p_sphere_pos,real_t p_sphere_radius);
|
||||
DVector<Vector3> segment_intersects_cylinder( const Vector3& p_from, const Vector3& p_to, float p_height,float p_radius);
|
||||
DVector<Vector3> segment_intersects_convex(const Vector3& p_from, const Vector3& p_to,const Vector<Plane>& p_planes);
|
||||
real_t segment_intersects_circle(const Vector2& p_from, const Vector2& p_to, const Vector2& p_circle_pos, real_t p_circle_radius);
|
||||
int get_uv84_normal_bit(const Vector3& p_vector);
|
||||
|
||||
Vector<int> triangulate_polygon(const Vector<Vector2>& p_polygon);
|
||||
|
||||
Dictionary make_atlas(const Vector<Size2>& p_rects);
|
||||
|
||||
_Geometry();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class _File : public Reference {
|
||||
|
||||
OBJ_TYPE(_File,Reference);
|
||||
FileAccess *f;
|
||||
bool eswap;
|
||||
protected:
|
||||
|
||||
static void _bind_methods();
|
||||
public:
|
||||
|
||||
enum ModeFlags {
|
||||
|
||||
READ=1,
|
||||
WRITE=2,
|
||||
READ_WRITE=3,
|
||||
};
|
||||
|
||||
Error open_encrypted(const String& p_path, int p_mode_flags,const Vector<uint8_t>& p_key);
|
||||
Error open_encrypted_pass(const String& p_path, int p_mode_flags,const String& p_pass);
|
||||
|
||||
|
||||
Error open(const String& p_path, int p_mode_flags); ///< open a file
|
||||
void close(); ///< close a file
|
||||
bool is_open() const; ///< true when file is open
|
||||
|
||||
void seek(int64_t p_position); ///< seek to a given position
|
||||
void seek_end(int64_t p_position=0); ///< seek from the end of file
|
||||
int64_t get_pos() const; ///< get position in the file
|
||||
int64_t get_len() const; ///< get size of the file
|
||||
|
||||
bool eof_reached() const; ///< reading passed EOF
|
||||
|
||||
uint8_t get_8() const; ///< get a byte
|
||||
uint16_t get_16() const; ///< get 16 bits uint
|
||||
uint32_t get_32() const; ///< get 32 bits uint
|
||||
uint64_t get_64() const; ///< get 64 bits uint
|
||||
|
||||
float get_float() const;
|
||||
double get_double() const;
|
||||
real_t get_real() const;
|
||||
|
||||
Variant get_var() const;
|
||||
|
||||
DVector<uint8_t> get_buffer(int p_length) const; ///< get an array of bytes
|
||||
String get_line() const;
|
||||
String get_as_text() const;
|
||||
|
||||
/**< use this for files WRITTEN in _big_ endian machines (ie, amiga/mac)
|
||||
* It's not about the current CPU type but file formats.
|
||||
* this flags get reset to false (little endian) on each open
|
||||
*/
|
||||
|
||||
void set_endian_swap(bool p_swap);
|
||||
bool get_endian_swap();
|
||||
|
||||
Error get_error() const; ///< get last error
|
||||
|
||||
void store_8(uint8_t p_dest); ///< store a byte
|
||||
void store_16(uint16_t p_dest); ///< store 16 bits uint
|
||||
void store_32(uint32_t p_dest); ///< store 32 bits uint
|
||||
void store_64(uint64_t p_dest); ///< store 64 bits uint
|
||||
|
||||
void store_float(float p_dest);
|
||||
void store_double(double p_dest);
|
||||
void store_real(real_t p_real);
|
||||
|
||||
void store_string(const String& p_string);
|
||||
void store_line(const String& p_string);
|
||||
|
||||
virtual void store_pascal_string(const String& p_string);
|
||||
virtual String get_pascal_string();
|
||||
|
||||
Vector<String> get_csv_line() const;
|
||||
|
||||
|
||||
void store_buffer(const DVector<uint8_t>& p_buffer); ///< store an array of bytes
|
||||
|
||||
void store_var(const Variant& p_var);
|
||||
|
||||
bool file_exists(const String& p_name) const; ///< return true if a file exists
|
||||
|
||||
_File();
|
||||
virtual ~_File();
|
||||
|
||||
};
|
||||
|
||||
class _Directory : public Reference {
|
||||
|
||||
OBJ_TYPE(_Directory,Reference);
|
||||
DirAccess *d;
|
||||
protected:
|
||||
|
||||
static void _bind_methods();
|
||||
public:
|
||||
|
||||
Error open(const String& p_path);
|
||||
|
||||
bool list_dir_begin(); ///< This starts dir listing
|
||||
String get_next();
|
||||
bool current_is_dir() const;
|
||||
|
||||
void list_dir_end(); ///<
|
||||
|
||||
int get_drive_count();
|
||||
String get_drive(int p_drive);
|
||||
|
||||
Error change_dir(String p_dir); ///< can be relative or absolute, return false on success
|
||||
String get_current_dir(); ///< return current dir location
|
||||
|
||||
Error make_dir(String p_dir);
|
||||
Error make_dir_recursive(String p_dir);
|
||||
|
||||
bool file_exists(String p_file);
|
||||
bool dir_exists(String p_dir);
|
||||
|
||||
int get_space_left();
|
||||
|
||||
Error copy(String p_from,String p_to);
|
||||
Error rename(String p_from, String p_to);
|
||||
Error remove(String p_name);
|
||||
|
||||
|
||||
_Directory();
|
||||
virtual ~_Directory();
|
||||
|
||||
};
|
||||
|
||||
class _Marshalls : public Reference {
|
||||
|
||||
OBJ_TYPE(_Marshalls,Reference);
|
||||
|
||||
protected:
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
String variant_to_base64(const Variant& p_var);
|
||||
Variant base64_to_variant(const String& p_str);
|
||||
|
||||
_Marshalls() {};
|
||||
};
|
||||
|
||||
|
||||
class _Mutex : public Reference {
|
||||
|
||||
OBJ_TYPE(_Mutex,Reference);
|
||||
Mutex *mutex;
|
||||
|
||||
static void _bind_methods();
|
||||
public:
|
||||
|
||||
void lock();
|
||||
Error try_lock();
|
||||
void unlock();
|
||||
|
||||
_Mutex();
|
||||
~_Mutex();
|
||||
};
|
||||
|
||||
class _Semaphore : public Reference {
|
||||
|
||||
OBJ_TYPE(_Semaphore,Reference);
|
||||
Semaphore *semaphore;
|
||||
|
||||
static void _bind_methods();
|
||||
public:
|
||||
|
||||
Error wait();
|
||||
Error post();
|
||||
|
||||
_Semaphore();
|
||||
~_Semaphore();
|
||||
};
|
||||
|
||||
class _Thread : public Reference {
|
||||
|
||||
OBJ_TYPE(_Thread,Reference);
|
||||
|
||||
protected:
|
||||
|
||||
Variant ret;
|
||||
Variant userdata;
|
||||
volatile bool active;
|
||||
Object *target_instance;
|
||||
StringName target_method;
|
||||
Thread *thread;
|
||||
static void _bind_methods();
|
||||
static void _start_func(void *ud);
|
||||
public:
|
||||
|
||||
enum Priority {
|
||||
|
||||
PRIORITY_LOW,
|
||||
PRIORITY_NORMAL,
|
||||
PRIORITY_HIGH
|
||||
};
|
||||
|
||||
Error start(Object *p_instance,const StringName& p_method,const Variant& p_userdata=Variant(),int p_priority=PRIORITY_NORMAL);
|
||||
String get_id() const;
|
||||
bool is_active() const;
|
||||
Variant wait_to_finish();
|
||||
|
||||
_Thread();
|
||||
~_Thread();
|
||||
};
|
||||
|
||||
#endif // CORE_BIND_H
|
||||
377
core/color.cpp
Normal file
377
core/color.cpp
Normal file
@ -0,0 +1,377 @@
|
||||
/*************************************************************************/
|
||||
/* color.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "color.h"
|
||||
#include "math_funcs.h"
|
||||
#include "print_string.h"
|
||||
|
||||
uint32_t Color::to_ARGB32() const {
|
||||
|
||||
uint32_t c=(uint8_t)(a*255);
|
||||
c<<=8;
|
||||
c|=(uint8_t)(r*255);
|
||||
c<<=8;
|
||||
c|=(uint8_t)(g*255);
|
||||
c<<=8;
|
||||
c|=(uint8_t)(b*255);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
uint32_t Color::to_32() const {
|
||||
|
||||
uint32_t c=(uint8_t)(a*255);
|
||||
c<<=8;
|
||||
c|=(uint8_t)(r*255);
|
||||
c<<=8;
|
||||
c|=(uint8_t)(g*255);
|
||||
c<<=8;
|
||||
c|=(uint8_t)(b*255);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
float Color::get_h() const {
|
||||
|
||||
float min = MIN( r, g );
|
||||
min = MIN( min, b );
|
||||
float max = MAX( r, g );
|
||||
max = MAX( max, b );
|
||||
|
||||
float delta = max - min;
|
||||
|
||||
if( delta == 0 )
|
||||
return 0;
|
||||
|
||||
float h;
|
||||
if( r == max )
|
||||
h = ( g - b ) / delta; // between yellow & magenta
|
||||
else if( g == max )
|
||||
h = 2 + ( b - r ) / delta; // between cyan & yellow
|
||||
else
|
||||
h = 4 + ( r - g ) / delta; // between magenta & cyan
|
||||
|
||||
h/=6.0;
|
||||
if (h<0)
|
||||
h+=1.0;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
float Color::get_s() const {
|
||||
|
||||
|
||||
float min = MIN( r, g );
|
||||
min = MIN( min, b );
|
||||
float max = MAX( r, g );
|
||||
max = MAX( max, b );
|
||||
|
||||
float delta = max - min;
|
||||
|
||||
return (max!=0) ? (delta / max) : 0;
|
||||
|
||||
}
|
||||
|
||||
float Color::get_v() const {
|
||||
|
||||
float max = MAX( r, g );
|
||||
max = MAX( max, b );
|
||||
return max;
|
||||
}
|
||||
|
||||
void Color::set_hsv(float p_h, float p_s, float p_v, float p_alpha) {
|
||||
|
||||
int i;
|
||||
float f, p, q, t;
|
||||
a=p_alpha;
|
||||
|
||||
if( p_s == 0 ) {
|
||||
// acp_hromatic (grey)
|
||||
r = g = b = p_v;
|
||||
return;
|
||||
}
|
||||
|
||||
p_h *=6.0;
|
||||
i = Math::floor( p_h );
|
||||
f = p_h - i;
|
||||
p = p_v * ( 1 - p_s );
|
||||
q = p_v * ( 1 - p_s * f );
|
||||
t = p_v * ( 1 - p_s * ( 1 - f ) );
|
||||
|
||||
switch( i ) {
|
||||
case 0:
|
||||
r = p_v;
|
||||
g = t;
|
||||
b = p;
|
||||
break;
|
||||
case 1:
|
||||
r = q;
|
||||
g = p_v;
|
||||
b = p;
|
||||
break;
|
||||
case 2:
|
||||
r = p;
|
||||
g = p_v;
|
||||
b = t;
|
||||
break;
|
||||
case 3:
|
||||
r = p;
|
||||
g = q;
|
||||
b = p_v;
|
||||
break;
|
||||
case 4:
|
||||
r = t;
|
||||
g = p;
|
||||
b = p_v;
|
||||
break;
|
||||
default: // cap_se 5:
|
||||
r = p_v;
|
||||
g = p;
|
||||
b = q;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Color::invert() {
|
||||
|
||||
r=1.0-r;
|
||||
g=1.0-g;
|
||||
g=1.0-b;
|
||||
}
|
||||
void Color::contrast() {
|
||||
|
||||
r=Math::fmod(r+0.5,1.0);
|
||||
g=Math::fmod(g+0.5,1.0);
|
||||
b=Math::fmod(b+0.5,1.0);
|
||||
}
|
||||
|
||||
Color Color::hex(uint32_t p_hex) {
|
||||
|
||||
float a = (p_hex&0xFF)/255.0;
|
||||
p_hex>>=8;
|
||||
float b = (p_hex&0xFF)/255.0;
|
||||
p_hex>>=8;
|
||||
float g = (p_hex&0xFF)/255.0;
|
||||
p_hex>>=8;
|
||||
float r = (p_hex&0xFF)/255.0;
|
||||
|
||||
return Color(r,g,b,a);
|
||||
}
|
||||
|
||||
static float _parse_col(const String& p_str, int p_ofs) {
|
||||
|
||||
int ig=0;
|
||||
|
||||
for(int i=0;i<2;i++) {
|
||||
|
||||
int c=p_str[i+p_ofs];
|
||||
int v=0;
|
||||
|
||||
if (c>='0' && c<='9') {
|
||||
v=c-'0';
|
||||
} else if (c>='a' && c<='f') {
|
||||
v=c-'a';
|
||||
v+=10;
|
||||
} else if (c>='A' && c<='F') {
|
||||
v=c-'A';
|
||||
v+=10;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (i==0)
|
||||
ig+=v*16;
|
||||
else
|
||||
ig+=v;
|
||||
|
||||
}
|
||||
|
||||
return ig;
|
||||
|
||||
}
|
||||
|
||||
Color Color::inverted() const {
|
||||
|
||||
Color c=*this;
|
||||
c.invert();
|
||||
return c;
|
||||
}
|
||||
|
||||
Color Color::contrasted() const {
|
||||
|
||||
Color c=*this;
|
||||
c.contrast();
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
Color Color::html(const String& p_color) {
|
||||
|
||||
String color = p_color;
|
||||
if (color.length()==0)
|
||||
return Color();
|
||||
if (color[0]=='#')
|
||||
color=color.substr(1,color.length()-1);
|
||||
|
||||
bool alpha=false;
|
||||
|
||||
if (color.length()==8) {
|
||||
alpha=true;
|
||||
} else if (color.length()==6) {
|
||||
alpha=false;
|
||||
} else {
|
||||
ERR_EXPLAIN("Invalid Color Code: "+p_color);
|
||||
ERR_FAIL_V(Color());
|
||||
}
|
||||
|
||||
int a=255;
|
||||
if (alpha) {
|
||||
a=_parse_col(color,0);
|
||||
if (a<0) {
|
||||
ERR_EXPLAIN("Invalid Color Code: "+p_color);
|
||||
ERR_FAIL_V(Color());
|
||||
}
|
||||
}
|
||||
|
||||
int from=alpha?2:0;
|
||||
|
||||
int r=_parse_col(color,from+0);
|
||||
if (r<0) {
|
||||
ERR_EXPLAIN("Invalid Color Code: "+p_color);
|
||||
ERR_FAIL_V(Color());
|
||||
}
|
||||
int g=_parse_col(color,from+2);
|
||||
if (g<0) {
|
||||
ERR_EXPLAIN("Invalid Color Code: "+p_color);
|
||||
ERR_FAIL_V(Color());
|
||||
}
|
||||
int b=_parse_col(color,from+4);
|
||||
if (b<0) {
|
||||
ERR_EXPLAIN("Invalid Color Code: "+p_color);
|
||||
ERR_FAIL_V(Color());
|
||||
}
|
||||
|
||||
return Color(r/255.0,g/255.0,b/255.0,a/255.0);
|
||||
}
|
||||
|
||||
bool Color::html_is_valid(const String& p_color) {
|
||||
|
||||
String color = p_color;
|
||||
|
||||
if (color.length()==0)
|
||||
return false;
|
||||
if (color[0]=='#')
|
||||
color=color.substr(1,color.length()-1);
|
||||
|
||||
bool alpha=false;
|
||||
|
||||
if (color.length()==8) {
|
||||
alpha=true;
|
||||
} else if (color.length()==6) {
|
||||
alpha=false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
int a=255;
|
||||
if (alpha) {
|
||||
a=_parse_col(color,0);
|
||||
if (a<0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int from=alpha?2:0;
|
||||
|
||||
int r=_parse_col(color,from+0);
|
||||
if (r<0) {
|
||||
return false;
|
||||
}
|
||||
int g=_parse_col(color,from+2);
|
||||
if (g<0) {
|
||||
return false;
|
||||
}
|
||||
int b=_parse_col(color,from+4);
|
||||
if (b<0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
String _to_hex(float p_val) {
|
||||
|
||||
int v = p_val * 255;
|
||||
v = CLAMP(v,0,255);
|
||||
String ret;
|
||||
|
||||
for(int i=0;i<2;i++) {
|
||||
|
||||
CharType c[2]={0,0};
|
||||
int lv = v&0xF;
|
||||
if (lv<10)
|
||||
c[0]='0'+lv;
|
||||
else
|
||||
c[0]='a'+lv-10;
|
||||
|
||||
v>>=4;
|
||||
String cs=(const CharType*)c;
|
||||
ret = cs + ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
String Color::to_html(bool p_alpha) const {
|
||||
|
||||
String txt;
|
||||
txt+=_to_hex(r);
|
||||
txt+=_to_hex(g);
|
||||
txt+=_to_hex(b);
|
||||
if (p_alpha)
|
||||
txt=_to_hex(a)+txt;
|
||||
return txt;
|
||||
|
||||
}
|
||||
|
||||
|
||||
float Color::gray() const {
|
||||
|
||||
return (r+g+b)/3.0;
|
||||
}
|
||||
|
||||
Color::operator String() const {
|
||||
|
||||
return rtos(r)+", "+rtos(g)+", "+rtos(b)+", "+rtos(a);
|
||||
}
|
||||
|
||||
|
||||
147
core/color.h
Normal file
147
core/color.h
Normal file
@ -0,0 +1,147 @@
|
||||
/*************************************************************************/
|
||||
/* color.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef COLOR_H
|
||||
#define COLOR_H
|
||||
|
||||
#include "ustring.h"
|
||||
#include "math_funcs.h"
|
||||
/**
|
||||
@author Juan Linietsky <reduzio@gmail.com>
|
||||
*/
|
||||
struct Color {
|
||||
|
||||
union {
|
||||
|
||||
struct {
|
||||
float r;
|
||||
float g;
|
||||
float b;
|
||||
float a;
|
||||
};
|
||||
float components[4];
|
||||
};
|
||||
|
||||
bool operator==(const Color &p_color) const { return (r==p_color.r && g==p_color.g && b==p_color.b && a==p_color.a ); }
|
||||
bool operator!=(const Color &p_color) const { return (r!=p_color.r || g!=p_color.g || b!=p_color.b || a!=p_color.a ); }
|
||||
|
||||
uint32_t to_32() const;
|
||||
uint32_t to_ARGB32() const;
|
||||
float gray() const;
|
||||
float get_h() const;
|
||||
float get_s() const;
|
||||
float get_v() const;
|
||||
void set_hsv(float p_h, float p_s, float p_v, float p_alpha=1.0);
|
||||
|
||||
_FORCE_INLINE_ float& operator[](int idx) {
|
||||
return components[idx];
|
||||
}
|
||||
_FORCE_INLINE_ const float& operator[](int idx) const {
|
||||
return components[idx];
|
||||
}
|
||||
|
||||
void invert();
|
||||
void contrast();
|
||||
Color inverted() const;
|
||||
Color contrasted() const;
|
||||
|
||||
_FORCE_INLINE_ Color linear_interpolate(const Color& p_b, float p_t) const {
|
||||
|
||||
Color res=*this;
|
||||
|
||||
res.r+= (p_t * (p_b.r-r));
|
||||
res.g+= (p_t * (p_b.g-g));
|
||||
res.b+= (p_t * (p_b.b-b));
|
||||
res.a+= (p_t * (p_b.a-a));
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ Color blend(const Color& p_over) const {
|
||||
|
||||
|
||||
Color res;
|
||||
float sa = 1.0 - p_over.a;
|
||||
res.a = a*sa+p_over.a;
|
||||
if (res.a==0) {
|
||||
return Color(0,0,0,0);
|
||||
} else {
|
||||
res.r = (r*a*sa + p_over.r * p_over.a)/res.a;
|
||||
res.g = (g*a*sa + p_over.g * p_over.a)/res.a;
|
||||
res.b = (b*a*sa + p_over.b * p_over.a)/res.a;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ Color to_linear() const {
|
||||
|
||||
return Color(
|
||||
r<0.04045 ? r * (1.0 / 12.92) : Math::pow((r + 0.055) * (1.0 / (1 + 0.055)), 2.4),
|
||||
g<0.04045 ? g * (1.0 / 12.92) : Math::pow((g + 0.055) * (1.0 / (1 + 0.055)), 2.4),
|
||||
b<0.04045 ? b * (1.0 / 12.92) : Math::pow((b + 0.055) * (1.0 / (1 + 0.055)), 2.4),
|
||||
a
|
||||
);
|
||||
}
|
||||
|
||||
static Color hex(uint32_t p_hex);
|
||||
static Color html(const String& p_color);
|
||||
static bool html_is_valid(const String& p_color);
|
||||
String to_html(bool p_alpha=true) const;
|
||||
|
||||
_FORCE_INLINE_ bool operator<(const Color& p_color) const; //used in set keys
|
||||
operator String() const;
|
||||
|
||||
/**
|
||||
* No construct parameters, r=0, g=0, b=0. a=255
|
||||
*/
|
||||
_FORCE_INLINE_ Color() {
|
||||
r=0; g=0; b=0; a=1.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* RGB / RGBA construct parameters. Alpha is optional, but defaults to 1.0
|
||||
*/
|
||||
_FORCE_INLINE_ Color(float p_r,float p_g,float p_b,float p_a=1.0) { r=p_r; g=p_g; b=p_b; a=p_a; }
|
||||
};
|
||||
|
||||
bool Color::operator<(const Color& p_color) const {
|
||||
|
||||
if (r==p_color.r) {
|
||||
if (g==p_color.g) {
|
||||
if(b==p_color.b) {
|
||||
return (a<p_color.a);
|
||||
} else
|
||||
return (b<p_color.b);
|
||||
} else
|
||||
return g<p_color.g;
|
||||
} else
|
||||
return r<p_color.r;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
107
core/command_queue_mt.cpp
Normal file
107
core/command_queue_mt.cpp
Normal file
@ -0,0 +1,107 @@
|
||||
/*************************************************************************/
|
||||
/* command_queue_mt.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "command_queue_mt.h"
|
||||
#include "os/os.h"
|
||||
|
||||
void CommandQueueMT::lock() {
|
||||
|
||||
if (mutex)
|
||||
mutex->lock();
|
||||
}
|
||||
|
||||
void CommandQueueMT::unlock() {
|
||||
|
||||
if (mutex)
|
||||
mutex->unlock();
|
||||
}
|
||||
|
||||
void CommandQueueMT::wait_for_flush() {
|
||||
|
||||
// wait one millisecond for a flush to happen
|
||||
OS::get_singleton()->delay_usec(1000);
|
||||
}
|
||||
|
||||
CommandQueueMT::SyncSemaphore* CommandQueueMT::_alloc_sync_sem() {
|
||||
|
||||
int idx=-1;
|
||||
|
||||
while(true) {
|
||||
|
||||
for(int i=0;i<SYNC_SEMAPHORES;i++) {
|
||||
|
||||
if (!sync_sems[i].in_use) {
|
||||
sync_sems[i].in_use=true;
|
||||
idx=i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (idx==-1) {
|
||||
wait_for_flush();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return &sync_sems[idx];
|
||||
}
|
||||
|
||||
|
||||
CommandQueueMT::CommandQueueMT(bool p_sync){
|
||||
|
||||
read_ptr=0;
|
||||
write_ptr=0;
|
||||
mutex = Mutex::create();
|
||||
|
||||
for(int i=0;i<SYNC_SEMAPHORES;i++) {
|
||||
|
||||
sync_sems[i].sem=Semaphore::create();
|
||||
sync_sems[i].in_use=false;
|
||||
|
||||
|
||||
}
|
||||
if (p_sync)
|
||||
sync = Semaphore::create();
|
||||
else
|
||||
sync=NULL;
|
||||
}
|
||||
|
||||
|
||||
CommandQueueMT::~CommandQueueMT() {
|
||||
|
||||
if (sync)
|
||||
memdelete(sync);
|
||||
memdelete(mutex);
|
||||
for(int i=0;i<SYNC_SEMAPHORES;i++) {
|
||||
|
||||
memdelete(sync_sems[i].sem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
999
core/command_queue_mt.h
Normal file
999
core/command_queue_mt.h
Normal file
@ -0,0 +1,999 @@
|
||||
/*************************************************************************/
|
||||
/* command_queue_mt.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef COMMAND_QUEUE_MT_H
|
||||
#define COMMAND_QUEUE_MT_H
|
||||
|
||||
#include "typedefs.h"
|
||||
#include "os/semaphore.h"
|
||||
#include "os/mutex.h"
|
||||
#include "os/memory.h"
|
||||
#include "simple_type.h"
|
||||
/**
|
||||
@author Juan Linietsky <reduzio@gmail.com>
|
||||
*/
|
||||
|
||||
class CommandQueueMT {
|
||||
|
||||
struct SyncSemaphore {
|
||||
|
||||
Semaphore *sem;
|
||||
bool in_use;
|
||||
};
|
||||
|
||||
struct CommandBase {
|
||||
|
||||
virtual void call()=0;
|
||||
virtual ~CommandBase() {};
|
||||
};
|
||||
|
||||
template<class T,class M>
|
||||
struct Command0 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
|
||||
virtual void call() { (instance->*method)(); }
|
||||
};
|
||||
|
||||
template<class T,class M,class P1>
|
||||
struct Command1 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
typename GetSimpleTypeT<P1>::type_t p1;
|
||||
|
||||
virtual void call() { (instance->*method)(p1); }
|
||||
};
|
||||
|
||||
template<class T,class M,class P1,class P2>
|
||||
struct Command2 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
typename GetSimpleTypeT<P1>::type_t p1;
|
||||
typename GetSimpleTypeT<P2>::type_t p2;
|
||||
|
||||
virtual void call() { (instance->*method)(p1,p2); }
|
||||
};
|
||||
|
||||
template<class T,class M,class P1,class P2,class P3>
|
||||
struct Command3 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
typename GetSimpleTypeT<P1>::type_t p1;
|
||||
typename GetSimpleTypeT<P2>::type_t p2;
|
||||
typename GetSimpleTypeT<P3>::type_t p3;
|
||||
|
||||
virtual void call() { (instance->*method)(p1,p2,p3); }
|
||||
};
|
||||
|
||||
template<class T,class M,class P1,class P2,class P3,class P4>
|
||||
struct Command4 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
typename GetSimpleTypeT<P1>::type_t p1;
|
||||
typename GetSimpleTypeT<P2>::type_t p2;
|
||||
typename GetSimpleTypeT<P3>::type_t p3;
|
||||
typename GetSimpleTypeT<P4>::type_t p4;
|
||||
|
||||
virtual void call() { (instance->*method)(p1,p2,p3,p4); }
|
||||
};
|
||||
|
||||
template<class T,class M,class P1,class P2,class P3,class P4,class P5>
|
||||
struct Command5 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
typename GetSimpleTypeT<P1>::type_t p1;
|
||||
typename GetSimpleTypeT<P2>::type_t p2;
|
||||
typename GetSimpleTypeT<P3>::type_t p3;
|
||||
typename GetSimpleTypeT<P4>::type_t p4;
|
||||
typename GetSimpleTypeT<P5>::type_t p5;
|
||||
|
||||
virtual void call() { (instance->*method)(p1,p2,p3,p4,p5); }
|
||||
};
|
||||
|
||||
template<class T,class M,class P1,class P2,class P3,class P4,class P5,class P6>
|
||||
struct Command6 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
typename GetSimpleTypeT<P1>::type_t p1;
|
||||
typename GetSimpleTypeT<P2>::type_t p2;
|
||||
typename GetSimpleTypeT<P3>::type_t p3;
|
||||
typename GetSimpleTypeT<P4>::type_t p4;
|
||||
typename GetSimpleTypeT<P5>::type_t p5;
|
||||
typename GetSimpleTypeT<P6>::type_t p6;
|
||||
|
||||
virtual void call() { (instance->*method)(p1,p2,p3,p4,p5,p6); }
|
||||
};
|
||||
|
||||
template<class T,class M,class P1,class P2,class P3,class P4,class P5,class P6,class P7>
|
||||
struct Command7 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
typename GetSimpleTypeT<P1>::type_t p1;
|
||||
typename GetSimpleTypeT<P2>::type_t p2;
|
||||
typename GetSimpleTypeT<P3>::type_t p3;
|
||||
typename GetSimpleTypeT<P4>::type_t p4;
|
||||
typename GetSimpleTypeT<P5>::type_t p5;
|
||||
typename GetSimpleTypeT<P6>::type_t p6;
|
||||
typename GetSimpleTypeT<P7>::type_t p7;
|
||||
|
||||
virtual void call() { (instance->*method)(p1,p2,p3,p4,p5,p6,p7); }
|
||||
};
|
||||
|
||||
/* comands that return */
|
||||
|
||||
template<class T,class M,class R>
|
||||
struct CommandRet0 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
R* ret;
|
||||
SyncSemaphore *sync;
|
||||
|
||||
virtual void call() { *ret = (instance->*method)(); sync->sem->post(); sync->in_use=false; ; }
|
||||
};
|
||||
|
||||
template<class T,class M,class P1,class R>
|
||||
struct CommandRet1 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
typename GetSimpleTypeT<P1>::type_t p1;
|
||||
R* ret;
|
||||
SyncSemaphore *sync;
|
||||
|
||||
virtual void call() { *ret = (instance->*method)(p1); sync->sem->post(); sync->in_use=false; ; }
|
||||
};
|
||||
|
||||
template<class T,class M,class P1,class P2,class R>
|
||||
struct CommandRet2 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
typename GetSimpleTypeT<P1>::type_t p1;
|
||||
typename GetSimpleTypeT<P2>::type_t p2;
|
||||
R* ret;
|
||||
SyncSemaphore *sync;
|
||||
|
||||
virtual void call() { *ret = (instance->*method)(p1,p2); sync->sem->post(); sync->in_use=false; ; }
|
||||
};
|
||||
|
||||
template<class T,class M,class P1,class P2,class P3,class R>
|
||||
struct CommandRet3 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
typename GetSimpleTypeT<P1>::type_t p1;
|
||||
typename GetSimpleTypeT<P2>::type_t p2;
|
||||
typename GetSimpleTypeT<P3>::type_t p3;
|
||||
R* ret;
|
||||
SyncSemaphore *sync;
|
||||
|
||||
virtual void call() { *ret = (instance->*method)(p1,p2,p3); sync->sem->post(); sync->in_use=false; ; }
|
||||
};
|
||||
|
||||
template<class T,class M,class P1,class P2,class P3,class P4,class R>
|
||||
struct CommandRet4 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
typename GetSimpleTypeT<P1>::type_t p1;
|
||||
typename GetSimpleTypeT<P2>::type_t p2;
|
||||
typename GetSimpleTypeT<P3>::type_t p3;
|
||||
typename GetSimpleTypeT<P4>::type_t p4;
|
||||
R* ret;
|
||||
SyncSemaphore *sync;
|
||||
|
||||
virtual void call() { *ret = (instance->*method)(p1,p2,p3,p4); sync->sem->post(); sync->in_use=false; ; }
|
||||
};
|
||||
|
||||
template<class T,class M,class P1,class P2,class P3,class P4,class P5,class R>
|
||||
struct CommandRet5 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
typename GetSimpleTypeT<P1>::type_t p1;
|
||||
typename GetSimpleTypeT<P2>::type_t p2;
|
||||
typename GetSimpleTypeT<P3>::type_t p3;
|
||||
typename GetSimpleTypeT<P4>::type_t p4;
|
||||
typename GetSimpleTypeT<P5>::type_t p5;
|
||||
R* ret;
|
||||
SyncSemaphore *sync;
|
||||
|
||||
virtual void call() { *ret = (instance->*method)(p1,p2,p3,p4,p5); sync->sem->post(); sync->in_use=false; ; }
|
||||
};
|
||||
|
||||
template<class T,class M,class P1,class P2,class P3,class P4,class P5,class P6,class R>
|
||||
struct CommandRet6 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
typename GetSimpleTypeT<P1>::type_t p1;
|
||||
typename GetSimpleTypeT<P2>::type_t p2;
|
||||
typename GetSimpleTypeT<P3>::type_t p3;
|
||||
typename GetSimpleTypeT<P4>::type_t p4;
|
||||
typename GetSimpleTypeT<P5>::type_t p5;
|
||||
typename GetSimpleTypeT<P6>::type_t p6;
|
||||
R* ret;
|
||||
SyncSemaphore *sync;
|
||||
|
||||
virtual void call() { *ret = (instance->*method)(p1,p2,p3,p4,p5,p6); sync->sem->post(); sync->in_use=false; ; }
|
||||
};
|
||||
|
||||
template<class T,class M,class P1,class P2,class P3,class P4,class P5,class P6,class P7,class R>
|
||||
struct CommandRet7 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
typename GetSimpleTypeT<P1>::type_t p1;
|
||||
typename GetSimpleTypeT<P2>::type_t p2;
|
||||
typename GetSimpleTypeT<P3>::type_t p3;
|
||||
typename GetSimpleTypeT<P4>::type_t p4;
|
||||
typename GetSimpleTypeT<P5>::type_t p5;
|
||||
typename GetSimpleTypeT<P6>::type_t p6;
|
||||
typename GetSimpleTypeT<P7>::type_t p7;
|
||||
R* ret;
|
||||
SyncSemaphore *sync;
|
||||
|
||||
virtual void call() { *ret = (instance->*method)(p1,p2,p3,p4,p5,p6,p7); sync->sem->post(); sync->in_use=false; ; }
|
||||
};
|
||||
|
||||
/** commands that don't return but sync */
|
||||
|
||||
/* comands that return */
|
||||
|
||||
template<class T,class M>
|
||||
struct CommandSync0 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
|
||||
SyncSemaphore *sync;
|
||||
|
||||
virtual void call() { (instance->*method)(); sync->sem->post(); sync->in_use=false; ; }
|
||||
};
|
||||
|
||||
template<class T,class M,class P1>
|
||||
struct CommandSync1 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
typename GetSimpleTypeT<P1>::type_t p1;
|
||||
|
||||
SyncSemaphore *sync;
|
||||
|
||||
virtual void call() { (instance->*method)(p1); sync->sem->post(); sync->in_use=false; ; }
|
||||
};
|
||||
|
||||
template<class T,class M,class P1,class P2>
|
||||
struct CommandSync2 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
typename GetSimpleTypeT<P1>::type_t p1;
|
||||
typename GetSimpleTypeT<P2>::type_t p2;
|
||||
|
||||
SyncSemaphore *sync;
|
||||
|
||||
virtual void call() { (instance->*method)(p1,p2); sync->sem->post(); sync->in_use=false; ; }
|
||||
};
|
||||
|
||||
template<class T,class M,class P1,class P2,class P3>
|
||||
struct CommandSync3 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
typename GetSimpleTypeT<P1>::type_t p1;
|
||||
typename GetSimpleTypeT<P2>::type_t p2;
|
||||
typename GetSimpleTypeT<P3>::type_t p3;
|
||||
|
||||
SyncSemaphore *sync;
|
||||
|
||||
virtual void call() { (instance->*method)(p1,p2,p3); sync->sem->post(); sync->in_use=false; ; }
|
||||
};
|
||||
|
||||
template<class T,class M,class P1,class P2,class P3,class P4>
|
||||
struct CommandSync4 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
typename GetSimpleTypeT<P1>::type_t p1;
|
||||
typename GetSimpleTypeT<P2>::type_t p2;
|
||||
typename GetSimpleTypeT<P3>::type_t p3;
|
||||
typename GetSimpleTypeT<P4>::type_t p4;
|
||||
|
||||
SyncSemaphore *sync;
|
||||
|
||||
virtual void call() { (instance->*method)(p1,p2,p3,p4); sync->sem->post(); sync->in_use=false; ; }
|
||||
};
|
||||
|
||||
template<class T,class M,class P1,class P2,class P3,class P4,class P5>
|
||||
struct CommandSync5 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
typename GetSimpleTypeT<P1>::type_t p1;
|
||||
typename GetSimpleTypeT<P2>::type_t p2;
|
||||
typename GetSimpleTypeT<P3>::type_t p3;
|
||||
typename GetSimpleTypeT<P4>::type_t p4;
|
||||
typename GetSimpleTypeT<P5>::type_t p5;
|
||||
|
||||
SyncSemaphore *sync;
|
||||
|
||||
virtual void call() { (instance->*method)(p1,p2,p3,p4,p5); sync->sem->post(); sync->in_use=false; ; }
|
||||
};
|
||||
|
||||
template<class T,class M,class P1,class P2,class P3,class P4,class P5,class P6>
|
||||
struct CommandSync6 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
typename GetSimpleTypeT<P1>::type_t p1;
|
||||
typename GetSimpleTypeT<P2>::type_t p2;
|
||||
typename GetSimpleTypeT<P3>::type_t p3;
|
||||
typename GetSimpleTypeT<P4>::type_t p4;
|
||||
typename GetSimpleTypeT<P5>::type_t p5;
|
||||
typename GetSimpleTypeT<P6>::type_t p6;
|
||||
|
||||
SyncSemaphore *sync;
|
||||
|
||||
virtual void call() { (instance->*method)(p1,p2,p3,p4,p5,p6); sync->sem->post(); sync->in_use=false; ; }
|
||||
};
|
||||
|
||||
template<class T,class M,class P1,class P2,class P3,class P4,class P5,class P6,class P7>
|
||||
struct CommandSync7 : public CommandBase {
|
||||
|
||||
T*instance;
|
||||
M method;
|
||||
typename GetSimpleTypeT<P1>::type_t p1;
|
||||
typename GetSimpleTypeT<P2>::type_t p2;
|
||||
typename GetSimpleTypeT<P3>::type_t p3;
|
||||
typename GetSimpleTypeT<P4>::type_t p4;
|
||||
typename GetSimpleTypeT<P5>::type_t p5;
|
||||
typename GetSimpleTypeT<P6>::type_t p6;
|
||||
typename GetSimpleTypeT<P7>::type_t p7;
|
||||
|
||||
SyncSemaphore *sync;
|
||||
|
||||
virtual void call() { (instance->*method)(p1,p2,p3,p4,p5,p6,p7); sync->sem->post(); sync->in_use=false; ; }
|
||||
};
|
||||
|
||||
/***** BASE *******/
|
||||
|
||||
enum {
|
||||
COMMAND_MEM_SIZE_KB=256,
|
||||
COMMAND_MEM_SIZE=COMMAND_MEM_SIZE_KB*1024,
|
||||
SYNC_SEMAPHORES=8
|
||||
};
|
||||
|
||||
|
||||
uint8_t command_mem[COMMAND_MEM_SIZE];
|
||||
uint32_t read_ptr;
|
||||
uint32_t write_ptr;
|
||||
SyncSemaphore sync_sems[SYNC_SEMAPHORES];
|
||||
Mutex *mutex;
|
||||
Semaphore *sync;
|
||||
|
||||
|
||||
template<class T>
|
||||
T* allocate() {
|
||||
|
||||
// alloc size is size+T+safeguard
|
||||
uint32_t alloc_size=sizeof(T)+sizeof(uint32_t);
|
||||
|
||||
tryagain:
|
||||
|
||||
if (write_ptr < read_ptr) {
|
||||
// behind read_ptr, check that there is room
|
||||
if ( (read_ptr-write_ptr) <= alloc_size )
|
||||
return NULL;
|
||||
} else if (write_ptr >= read_ptr) {
|
||||
// ahead of read_ptr, check that there is room
|
||||
|
||||
|
||||
if ( (COMMAND_MEM_SIZE-write_ptr) < alloc_size+4 ) {
|
||||
// no room at the end, wrap down;
|
||||
|
||||
if (read_ptr==0) // dont want write_ptr to become read_ptr
|
||||
return NULL;
|
||||
|
||||
// if this happens, it's a bug
|
||||
ERR_FAIL_COND_V( (COMMAND_MEM_SIZE-write_ptr) < sizeof(uint32_t), NULL );
|
||||
// zero means, wrap to begining
|
||||
|
||||
uint32_t * p = (uint32_t*)&command_mem[write_ptr];
|
||||
*p=0;
|
||||
write_ptr=0;
|
||||
goto tryagain;
|
||||
}
|
||||
}
|
||||
// allocate the size
|
||||
uint32_t * p = (uint32_t*)&command_mem[write_ptr];
|
||||
*p=sizeof(T);
|
||||
write_ptr+=sizeof(uint32_t);
|
||||
// allocate the command
|
||||
T* cmd = memnew_placement( &command_mem[write_ptr], T );
|
||||
write_ptr+=sizeof(T);
|
||||
return cmd;
|
||||
|
||||
}
|
||||
|
||||
template<class T>
|
||||
T* allocate_and_lock() {
|
||||
|
||||
lock();
|
||||
T* ret;
|
||||
|
||||
while ( (ret=allocate<T>())==NULL ) {
|
||||
|
||||
unlock();
|
||||
// sleep a little until fetch happened and some room is made
|
||||
wait_for_flush();
|
||||
lock();
|
||||
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool flush_one() {
|
||||
|
||||
tryagain:
|
||||
|
||||
// tried to read an empty queue
|
||||
if (read_ptr == write_ptr )
|
||||
return false;
|
||||
|
||||
uint32_t size = *(uint32_t*)( &command_mem[read_ptr] );
|
||||
|
||||
if (size==0) {
|
||||
//end of ringbuffer, wrap
|
||||
read_ptr=0;
|
||||
goto tryagain;
|
||||
}
|
||||
|
||||
read_ptr+=sizeof(uint32_t);
|
||||
|
||||
CommandBase *cmd = reinterpret_cast<CommandBase*>( &command_mem[read_ptr] );
|
||||
|
||||
cmd->call();
|
||||
cmd->~CommandBase();
|
||||
|
||||
read_ptr+=size;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void lock();
|
||||
void unlock();
|
||||
void wait_for_flush();
|
||||
SyncSemaphore* _alloc_sync_sem();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/* NORMAL PUSH COMMANDS */
|
||||
|
||||
template<class T, class M>
|
||||
void push( T * p_instance, M p_method ) {
|
||||
|
||||
Command0<T,M> * cmd = allocate_and_lock< Command0<T,M> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
}
|
||||
|
||||
template<class T, class M, class P1>
|
||||
void push( T * p_instance, M p_method, P1 p1 ) {
|
||||
|
||||
Command1<T,M,P1> * cmd = allocate_and_lock< Command1<T,M,P1> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
cmd->p1=p1;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
}
|
||||
|
||||
template<class T, class M, class P1, class P2>
|
||||
void push( T * p_instance, M p_method, P1 p1, P2 p2 ) {
|
||||
|
||||
Command2<T,M,P1,P2> * cmd = allocate_and_lock< Command2<T,M,P1,P2> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
cmd->p1=p1;
|
||||
cmd->p2=p2;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
}
|
||||
|
||||
template<class T, class M, class P1, class P2, class P3>
|
||||
void push( T * p_instance, M p_method, P1 p1, P2 p2, P3 p3 ) {
|
||||
|
||||
Command3<T,M,P1,P2,P3> * cmd = allocate_and_lock< Command3<T,M,P1,P2,P3> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
cmd->p1=p1;
|
||||
cmd->p2=p2;
|
||||
cmd->p3=p3;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
}
|
||||
|
||||
template<class T, class M, class P1, class P2, class P3, class P4>
|
||||
void push( T * p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4 ) {
|
||||
|
||||
Command4<T,M,P1,P2,P3,P4> * cmd = allocate_and_lock< Command4<T,M,P1,P2,P3,P4> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
cmd->p1=p1;
|
||||
cmd->p2=p2;
|
||||
cmd->p3=p3;
|
||||
cmd->p4=p4;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
}
|
||||
|
||||
template<class T, class M, class P1, class P2, class P3, class P4, class P5>
|
||||
void push( T * p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 ) {
|
||||
|
||||
Command5<T,M,P1,P2,P3,P4,P5> * cmd = allocate_and_lock< Command5<T,M,P1,P2,P3,P4,P5> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
cmd->p1=p1;
|
||||
cmd->p2=p2;
|
||||
cmd->p3=p3;
|
||||
cmd->p4=p4;
|
||||
cmd->p5=p5;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
}
|
||||
|
||||
template<class T, class M, class P1, class P2, class P3, class P4, class P5, class P6>
|
||||
void push( T * p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6 ) {
|
||||
|
||||
Command6<T,M,P1,P2,P3,P4,P5,P6> * cmd = allocate_and_lock< Command6<T,M,P1,P2,P3,P4,P5,P6> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
cmd->p1=p1;
|
||||
cmd->p2=p2;
|
||||
cmd->p3=p3;
|
||||
cmd->p4=p4;
|
||||
cmd->p5=p5;
|
||||
cmd->p6=p6;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
}
|
||||
|
||||
template<class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class P7>
|
||||
void push( T * p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7 ) {
|
||||
|
||||
Command7<T,M,P1,P2,P3,P4,P5,P6,P7> * cmd = allocate_and_lock< Command7<T,M,P1,P2,P3,P4,P5,P6,P7> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
cmd->p1=p1;
|
||||
cmd->p2=p2;
|
||||
cmd->p3=p3;
|
||||
cmd->p4=p4;
|
||||
cmd->p5=p5;
|
||||
cmd->p6=p6;
|
||||
cmd->p7=p7;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
}
|
||||
/*** PUSH AND RET COMMANDS ***/
|
||||
|
||||
|
||||
template<class T, class M,class R>
|
||||
void push_and_ret( T * p_instance, M p_method, R* r_ret) {
|
||||
|
||||
CommandRet0<T,M,R> * cmd = allocate_and_lock< CommandRet0<T,M,R> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
cmd->ret=r_ret;
|
||||
SyncSemaphore *ss=_alloc_sync_sem();
|
||||
cmd->sync=ss;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
ss->sem->wait();
|
||||
}
|
||||
|
||||
template<class T, class M, class P1,class R>
|
||||
void push_and_ret( T * p_instance, M p_method, P1 p1, R* r_ret) {
|
||||
|
||||
CommandRet1<T,M,P1,R> * cmd = allocate_and_lock< CommandRet1<T,M,P1,R> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
cmd->p1=p1;
|
||||
cmd->ret=r_ret;
|
||||
SyncSemaphore *ss=_alloc_sync_sem();
|
||||
cmd->sync=ss;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
ss->sem->wait();
|
||||
}
|
||||
|
||||
template<class T, class M, class P1, class P2,class R>
|
||||
void push_and_ret( T * p_instance, M p_method, P1 p1, P2 p2, R* r_ret) {
|
||||
|
||||
CommandRet2<T,M,P1,P2,R> * cmd = allocate_and_lock< CommandRet2<T,M,P1,P2,R> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
cmd->p1=p1;
|
||||
cmd->p2=p2;
|
||||
cmd->ret=r_ret;
|
||||
SyncSemaphore *ss=_alloc_sync_sem();
|
||||
cmd->sync=ss;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
ss->sem->wait();
|
||||
}
|
||||
|
||||
template<class T, class M, class P1, class P2, class P3,class R>
|
||||
void push_and_ret( T * p_instance, M p_method, P1 p1, P2 p2, P3 p3, R* r_ret ) {
|
||||
|
||||
CommandRet3<T,M,P1,P2,P3,R> * cmd = allocate_and_lock< CommandRet3<T,M,P1,P2,P3,R> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
cmd->p1=p1;
|
||||
cmd->p2=p2;
|
||||
cmd->p3=p3;
|
||||
cmd->ret=r_ret;
|
||||
SyncSemaphore *ss=_alloc_sync_sem();
|
||||
cmd->sync=ss;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
ss->sem->wait();
|
||||
}
|
||||
|
||||
template<class T, class M, class P1, class P2, class P3, class P4,class R>
|
||||
void push_and_ret( T * p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, R* r_ret ) {
|
||||
|
||||
CommandRet4<T,M,P1,P2,P3,P4,R> * cmd = allocate_and_lock< CommandRet4<T,M,P1,P2,P3,P4,R> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
cmd->p1=p1;
|
||||
cmd->p2=p2;
|
||||
cmd->p3=p3;
|
||||
cmd->p4=p4;
|
||||
cmd->ret=r_ret;
|
||||
SyncSemaphore *ss=_alloc_sync_sem();
|
||||
cmd->sync=ss;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
ss->sem->wait();
|
||||
}
|
||||
|
||||
template<class T, class M, class P1, class P2, class P3, class P4, class P5,class R>
|
||||
void push_and_ret( T * p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, R* r_ret ) {
|
||||
|
||||
CommandRet5<T,M,P1,P2,P3,P4,P5,R> * cmd = allocate_and_lock< CommandRet5<T,M,P1,P2,P3,P4,P5,R> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
cmd->p1=p1;
|
||||
cmd->p2=p2;
|
||||
cmd->p3=p3;
|
||||
cmd->p4=p4;
|
||||
cmd->p5=p5;
|
||||
cmd->ret=r_ret;
|
||||
SyncSemaphore *ss=_alloc_sync_sem();
|
||||
cmd->sync=ss;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
ss->sem->wait();
|
||||
}
|
||||
|
||||
template<class T, class M, class P1, class P2, class P3, class P4, class P5, class P6,class R>
|
||||
void push_and_ret( T * p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, R* r_ret ) {
|
||||
|
||||
CommandRet6<T,M,P1,P2,P3,P4,P5,P6,R> * cmd = allocate_and_lock< CommandRet6<T,M,P1,P2,P3,P4,P5,P6,R> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
cmd->p1=p1;
|
||||
cmd->p2=p2;
|
||||
cmd->p3=p3;
|
||||
cmd->p4=p4;
|
||||
cmd->p5=p5;
|
||||
cmd->p6=p6;
|
||||
cmd->ret=r_ret;
|
||||
SyncSemaphore *ss=_alloc_sync_sem();
|
||||
cmd->sync=ss;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
ss->sem->wait();
|
||||
}
|
||||
|
||||
template<class T, class M, class P1, class P2, class P3, class P4, class P5, class P6,class P7,class R>
|
||||
void push_and_ret( T * p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,P7 p7, R* r_ret ) {
|
||||
|
||||
CommandRet7<T,M,P1,P2,P3,P4,P5,P6,P7,R> * cmd = allocate_and_lock< CommandRet7<T,M,P1,P2,P3,P4,P5,P6,P7,R> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
cmd->p1=p1;
|
||||
cmd->p2=p2;
|
||||
cmd->p3=p3;
|
||||
cmd->p4=p4;
|
||||
cmd->p5=p5;
|
||||
cmd->p6=p6;
|
||||
cmd->p7=p7;
|
||||
cmd->ret=r_ret;
|
||||
SyncSemaphore *ss=_alloc_sync_sem();
|
||||
cmd->sync=ss;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
ss->sem->wait();
|
||||
}
|
||||
|
||||
|
||||
template<class T, class M>
|
||||
void push_and_sync( T * p_instance, M p_method) {
|
||||
|
||||
CommandSync0<T,M> * cmd = allocate_and_lock< CommandSync0<T,M> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
|
||||
SyncSemaphore *ss=_alloc_sync_sem();
|
||||
cmd->sync=ss;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
ss->sem->wait();
|
||||
}
|
||||
|
||||
template<class T, class M, class P1>
|
||||
void push_and_sync( T * p_instance, M p_method, P1 p1) {
|
||||
|
||||
CommandSync1<T,M,P1> * cmd = allocate_and_lock< CommandSync1<T,M,P1> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
cmd->p1=p1;
|
||||
|
||||
SyncSemaphore *ss=_alloc_sync_sem();
|
||||
cmd->sync=ss;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
ss->sem->wait();
|
||||
}
|
||||
|
||||
template<class T, class M, class P1, class P2>
|
||||
void push_and_sync( T * p_instance, M p_method, P1 p1, P2 p2) {
|
||||
|
||||
CommandSync2<T,M,P1,P2> * cmd = allocate_and_lock< CommandSync2<T,M,P1,P2> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
cmd->p1=p1;
|
||||
cmd->p2=p2;
|
||||
|
||||
SyncSemaphore *ss=_alloc_sync_sem();
|
||||
cmd->sync=ss;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
ss->sem->wait();
|
||||
}
|
||||
|
||||
template<class T, class M, class P1, class P2, class P3>
|
||||
void push_and_sync( T * p_instance, M p_method, P1 p1, P2 p2, P3 p3 ) {
|
||||
|
||||
CommandSync3<T,M,P1,P2,P3> * cmd = allocate_and_lock< CommandSync3<T,M,P1,P2,P3> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
cmd->p1=p1;
|
||||
cmd->p2=p2;
|
||||
cmd->p3=p3;
|
||||
|
||||
SyncSemaphore *ss=_alloc_sync_sem();
|
||||
cmd->sync=ss;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
ss->sem->wait();
|
||||
}
|
||||
|
||||
template<class T, class M, class P1, class P2, class P3, class P4>
|
||||
void push_and_sync( T * p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4 ) {
|
||||
|
||||
CommandSync4<T,M,P1,P2,P3,P4> * cmd = allocate_and_lock< CommandSync4<T,M,P1,P2,P3,P4> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
cmd->p1=p1;
|
||||
cmd->p2=p2;
|
||||
cmd->p3=p3;
|
||||
cmd->p4=p4;
|
||||
|
||||
SyncSemaphore *ss=_alloc_sync_sem();
|
||||
cmd->sync=ss;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
ss->sem->wait();
|
||||
}
|
||||
|
||||
template<class T, class M, class P1, class P2, class P3, class P4, class P5>
|
||||
void push_and_sync( T * p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 ) {
|
||||
|
||||
CommandSync5<T,M,P1,P2,P3,P4,P5> * cmd = allocate_and_lock< CommandSync5<T,M,P1,P2,P3,P4,P5> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
cmd->p1=p1;
|
||||
cmd->p2=p2;
|
||||
cmd->p3=p3;
|
||||
cmd->p4=p4;
|
||||
cmd->p5=p5;
|
||||
|
||||
SyncSemaphore *ss=_alloc_sync_sem();
|
||||
cmd->sync=ss;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
ss->sem->wait();
|
||||
}
|
||||
|
||||
template<class T, class M, class P1, class P2, class P3, class P4, class P5, class P6>
|
||||
void push_and_sync( T * p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6 ) {
|
||||
|
||||
CommandSync6<T,M,P1,P2,P3,P4,P5,P6> * cmd = allocate_and_lock< CommandSync6<T,M,P1,P2,P3,P4,P5,P6> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
cmd->p1=p1;
|
||||
cmd->p2=p2;
|
||||
cmd->p3=p3;
|
||||
cmd->p4=p4;
|
||||
cmd->p5=p5;
|
||||
cmd->p6=p6;
|
||||
|
||||
SyncSemaphore *ss=_alloc_sync_sem();
|
||||
cmd->sync=ss;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
ss->sem->wait();
|
||||
}
|
||||
|
||||
template<class T, class M, class P1, class P2, class P3, class P4, class P5, class P6,class P7>
|
||||
void push_and_sync( T * p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,P7 p7 ) {
|
||||
|
||||
CommandSync7<T,M,P1,P2,P3,P4,P5,P6,P7> * cmd = allocate_and_lock< CommandSync7<T,M,P1,P2,P3,P4,P5,P6,P7> >();
|
||||
|
||||
cmd->instance=p_instance;
|
||||
cmd->method=p_method;
|
||||
cmd->p1=p1;
|
||||
cmd->p2=p2;
|
||||
cmd->p3=p3;
|
||||
cmd->p4=p4;
|
||||
cmd->p5=p5;
|
||||
cmd->p6=p6;
|
||||
cmd->p7=p7;
|
||||
|
||||
SyncSemaphore *ss=_alloc_sync_sem();
|
||||
cmd->sync=ss;
|
||||
|
||||
unlock();
|
||||
|
||||
if (sync) sync->post();
|
||||
ss->sem->wait();
|
||||
}
|
||||
|
||||
void wait_and_flush_one() {
|
||||
ERR_FAIL_COND(!sync);
|
||||
sync->wait();
|
||||
lock();
|
||||
flush_one();
|
||||
unlock();
|
||||
}
|
||||
|
||||
void flush_all() {
|
||||
|
||||
ERR_FAIL_COND(sync);
|
||||
lock();
|
||||
while (true) {
|
||||
bool exit = !flush_one();
|
||||
if (exit)
|
||||
break;
|
||||
}
|
||||
unlock();
|
||||
}
|
||||
|
||||
CommandQueueMT(bool p_sync);
|
||||
~CommandQueueMT();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
534
core/compressed_translation.cpp
Normal file
534
core/compressed_translation.cpp
Normal file
@ -0,0 +1,534 @@
|
||||
/*************************************************************************/
|
||||
/* compressed_translation.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "compressed_translation.h"
|
||||
#include "pair.h"
|
||||
#include <string.h>
|
||||
|
||||
/////////// SMAZ /////////////
|
||||
|
||||
/*
|
||||
Copyright (c) 2006-2009, Salvatore Sanfilippo
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Smaz nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
/* Our compression codebook, used for compression */
|
||||
static const char *Smaz_cb[241] = {
|
||||
"\002s,\266", "\003had\232\002leW", "\003on \216", "", "\001yS",
|
||||
"\002ma\255\002li\227", "\003or \260", "", "\002ll\230\003s t\277",
|
||||
"\004fromg\002mel", "", "\003its\332", "\001z\333", "\003ingF", "\001>\336",
|
||||
"\001 \000\003 (\002nc\344", "\002nd=\003 on\312",
|
||||
"\002ne\213\003hat\276\003re q", "", "\002ngT\003herz\004have\306\003s o\225",
|
||||
"", "\003ionk\003s a\254\002ly\352", "\003hisL\003 inN\003 be\252", "",
|
||||
"\003 fo\325\003 of \003 ha\311", "", "\002of\005",
|
||||
"\003 co\241\002no\267\003 ma\370", "", "", "\003 cl\356\003enta\003 an7",
|
||||
"\002ns\300\001\"e", "\003n t\217\002ntP\003s, \205",
|
||||
"\002pe\320\003 we\351\002om\223", "\002on\037", "", "\002y G", "\003 wa\271",
|
||||
"\003 re\321\002or*", "", "\002=\"\251\002ot\337", "\003forD\002ou[",
|
||||
"\003 toR", "\003 th\r", "\003 it\366",
|
||||
"\003but\261\002ra\202\003 wi\363\002</\361", "\003 wh\237", "\002 4",
|
||||
"\003nd ?", "\002re!", "", "\003ng c", "",
|
||||
"\003ly \307\003ass\323\001a\004\002rir", "", "", "", "\002se_", "\003of \"",
|
||||
"\003div\364\002ros\003ere\240", "", "\002ta\310\001bZ\002si\324", "",
|
||||
"\003and\a\002rs\335", "\002rt\362", "\002teE", "\003ati\316", "\002so\263",
|
||||
"\002th\021", "\002tiJ\001c\034\003allp", "\003ate\345", "\002ss\246",
|
||||
"\002stM", "", "\002><\346", "\002to\024", "\003arew", "\001d\030",
|
||||
"\002tr\303", "", "\001\n1\003 a \222", "\003f tv\002veo", "\002un\340", "",
|
||||
"\003e o\242", "\002a \243\002wa\326\001e\002", "\002ur\226\003e a\274",
|
||||
"\002us\244\003\n\r\n\247", "\002ut\304\003e c\373", "\002we\221", "", "",
|
||||
"\002wh\302", "\001f,", "", "", "", "\003d t\206", "", "", "\003th \343",
|
||||
"\001g;", "", "", "\001\r9\003e s\265", "\003e t\234", "", "\003to Y",
|
||||
"\003e\r\n\236", "\002d \036\001h\022", "", "\001,Q", "\002 a\031", "\002 b^",
|
||||
"\002\r\n\025\002 cI", "\002 d\245", "\002 e\253", "\002 fh\001i\b\002e \v",
|
||||
"", "\002 hU\001-\314", "\002 i8", "", "", "\002 l\315", "\002 m{",
|
||||
"\002f :\002 n\354", "\002 o\035", "\002 p}\001.n\003\r\n\r\250", "",
|
||||
"\002 r\275", "\002 s>", "\002 t\016", "", "\002g \235\005which+\003whi\367",
|
||||
"\002 w5", "\001/\305", "\003as \214", "\003at \207", "", "\003who\331", "",
|
||||
"\001l\026\002h \212", "", "\002, $", "", "\004withV", "", "", "", "\001m-", "",
|
||||
"", "\002ac\357", "\002ad\350", "\003TheH", "", "", "\004this\233\001n\t",
|
||||
"", "\002. y", "", "\002alX\003e, \365", "\003tio\215\002be\\",
|
||||
"\002an\032\003ver\347", "", "\004that0\003tha\313\001o\006", "\003was2",
|
||||
"\002arO", "\002as.", "\002at'\003the\001\004they\200\005there\322\005theird",
|
||||
"\002ce\210", "\004were]", "", "\002ch\231\002l \264\001p<", "", "",
|
||||
"\003one\256", "", "\003he \023\002dej", "\003ter\270", "\002cou", "",
|
||||
"\002by\177\002di\201\002eax", "", "\002ec\327", "\002edB", "\002ee\353", "",
|
||||
"", "\001r\f\002n )", "", "", "", "\002el\262", "", "\003in i\002en3", "",
|
||||
"\002o `\001s\n", "", "\002er\033", "\003is t\002es6", "", "\002ge\371",
|
||||
"\004.com\375", "\002fo\334\003our\330", "\003ch \301\001t\003", "\002hab", "",
|
||||
"\003men\374", "", "\002he\020", "", "", "\001u&", "\002hif", "",
|
||||
"\003not\204\002ic\203", "\003ed @\002id\355", "", "", "\002ho\273",
|
||||
"\002r K\001vm", "", "", "", "\003t t\257\002il\360", "\002im\342",
|
||||
"\003en \317\002in\017", "\002io\220", "\002s \027\001wA", "", "\003er |",
|
||||
"\003es ~\002is%", "\002it/", "", "\002iv\272", "",
|
||||
"\002t #\ahttp://C\001x\372", "\002la\211", "\001<\341", "\003, a\224"
|
||||
};
|
||||
|
||||
/* Reverse compression codebook, used for decompression */
|
||||
static const char *Smaz_rcb[254] = {
|
||||
" ", "the", "e", "t", "a", "of", "o", "and", "i", "n", "s", "e ", "r", " th",
|
||||
" t", "in", "he", "th", "h", "he ", "to", "\r\n", "l", "s ", "d", " a", "an",
|
||||
"er", "c", " o", "d ", "on", " of", "re", "of ", "t ", ", ", "is", "u", "at",
|
||||
" ", "n ", "or", "which", "f", "m", "as", "it", "that", "\n", "was", "en",
|
||||
" ", " w", "es", " an", " i", "\r", "f ", "g", "p", "nd", " s", "nd ", "ed ",
|
||||
"w", "ed", "http://", "for", "te", "ing", "y ", "The", " c", "ti", "r ", "his",
|
||||
"st", " in", "ar", "nt", ",", " to", "y", "ng", " h", "with", "le", "al", "to ",
|
||||
"b", "ou", "be", "were", " b", "se", "o ", "ent", "ha", "ng ", "their", "\"",
|
||||
"hi", "from", " f", "in ", "de", "ion", "me", "v", ".", "ve", "all", "re ",
|
||||
"ri", "ro", "is ", "co", "f t", "are", "ea", ". ", "her", " m", "er ", " p",
|
||||
"es ", "by", "they", "di", "ra", "ic", "not", "s, ", "d t", "at ", "ce", "la",
|
||||
"h ", "ne", "as ", "tio", "on ", "n t", "io", "we", " a ", "om", ", a", "s o",
|
||||
"ur", "li", "ll", "ch", "had", "this", "e t", "g ", "e\r\n", " wh", "ere",
|
||||
" co", "e o", "a ", "us", " d", "ss", "\n\r\n", "\r\n\r", "=\"", " be", " e",
|
||||
"s a", "ma", "one", "t t", "or ", "but", "el", "so", "l ", "e s", "s,", "no",
|
||||
"ter", " wa", "iv", "ho", "e a", " r", "hat", "s t", "ns", "ch ", "wh", "tr",
|
||||
"ut", "/", "have", "ly ", "ta", " ha", " on", "tha", "-", " l", "ati", "en ",
|
||||
"pe", " re", "there", "ass", "si", " fo", "wa", "ec", "our", "who", "its", "z",
|
||||
"fo", "rs", ">", "ot", "un", "<", "im", "th ", "nc", "ate", "><", "ver", "ad",
|
||||
" we", "ly", "ee", " n", "id", " cl", "ac", "il", "</", "rt", " wi", "div",
|
||||
"e, ", " it", "whi", " ma", "ge", "x", "e c", "men", ".com"
|
||||
};
|
||||
|
||||
static int smaz_compress(const char *in, int inlen, char *out, int outlen) {
|
||||
unsigned int h1,h2,h3=0;
|
||||
int verblen = 0, _outlen = outlen;
|
||||
char verb[256], *_out = out;
|
||||
|
||||
while(inlen) {
|
||||
int j = 7, needed;
|
||||
char *flush = NULL;
|
||||
const char *slot;
|
||||
|
||||
h1 = h2 = in[0]<<3;
|
||||
if (inlen > 1) h2 += in[1];
|
||||
if (inlen > 2) h3 = h2^in[2];
|
||||
if (j > inlen) j = inlen;
|
||||
|
||||
/* Try to lookup substrings into the hash table, starting from the
|
||||
* longer to the shorter substrings */
|
||||
for (; j > 0; j--) {
|
||||
switch(j) {
|
||||
case 1: slot = Smaz_cb[h1%241]; break;
|
||||
case 2: slot = Smaz_cb[h2%241]; break;
|
||||
default: slot = Smaz_cb[h3%241]; break;
|
||||
}
|
||||
while(slot[0]) {
|
||||
if (slot[0] == j && memcmp(slot+1,in,j) == 0) {
|
||||
/* Match found in the hash table,
|
||||
* prepare a verbatim bytes flush if needed */
|
||||
if (verblen) {
|
||||
needed = (verblen == 1) ? 2 : 2+verblen;
|
||||
flush = out;
|
||||
out += needed;
|
||||
outlen -= needed;
|
||||
}
|
||||
/* Emit the byte */
|
||||
if (outlen <= 0) return _outlen+1;
|
||||
out[0] = slot[slot[0]+1];
|
||||
out++;
|
||||
outlen--;
|
||||
inlen -= j;
|
||||
in += j;
|
||||
goto out;
|
||||
} else {
|
||||
slot += slot[0]+2;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Match not found - add the byte to the verbatim buffer */
|
||||
verb[verblen] = in[0];
|
||||
verblen++;
|
||||
inlen--;
|
||||
in++;
|
||||
out:
|
||||
/* Prepare a flush if we reached the flush length limit, and there
|
||||
* is not already a pending flush operation. */
|
||||
if (!flush && (verblen == 256 || (verblen > 0 && inlen == 0))) {
|
||||
needed = (verblen == 1) ? 2 : 2+verblen;
|
||||
flush = out;
|
||||
out += needed;
|
||||
outlen -= needed;
|
||||
if (outlen < 0) return _outlen+1;
|
||||
}
|
||||
/* Perform a verbatim flush if needed */
|
||||
if (flush) {
|
||||
if (verblen == 1) {
|
||||
flush[0] = (signed char)254;
|
||||
flush[1] = verb[0];
|
||||
} else {
|
||||
flush[0] = (signed char)255;
|
||||
flush[1] = (signed char)(verblen-1);
|
||||
memcpy(flush+2,verb,verblen);
|
||||
}
|
||||
flush = NULL;
|
||||
verblen = 0;
|
||||
}
|
||||
}
|
||||
return out-_out;
|
||||
}
|
||||
|
||||
static int smaz_decompress(const char *in, int inlen, char *out, int outlen) {
|
||||
unsigned char *c = (unsigned char*) in;
|
||||
char *_out = out;
|
||||
int _outlen = outlen;
|
||||
|
||||
while(inlen) {
|
||||
if (*c == 254) {
|
||||
/* Verbatim byte */
|
||||
if (outlen < 1) return _outlen+1;
|
||||
*out = *(c+1);
|
||||
out++;
|
||||
outlen--;
|
||||
c += 2;
|
||||
inlen -= 2;
|
||||
} else if (*c == 255) {
|
||||
/* Verbatim string */
|
||||
int len = (*(c+1))+1;
|
||||
if (outlen < len) return _outlen+1;
|
||||
memcpy(out,c+2,len);
|
||||
out += len;
|
||||
outlen -= len;
|
||||
c += 2+len;
|
||||
inlen -= 2+len;
|
||||
} else {
|
||||
/* Codebook entry */
|
||||
const char *s = Smaz_rcb[*c];
|
||||
int len = strlen(s);
|
||||
|
||||
if (outlen < len) return _outlen+1;
|
||||
memcpy(out,s,len);
|
||||
out += len;
|
||||
outlen -= len;
|
||||
c++;
|
||||
inlen--;
|
||||
}
|
||||
}
|
||||
return out-_out;
|
||||
}
|
||||
|
||||
|
||||
/////////// END OF SMAZ /////////////
|
||||
|
||||
struct _PHashTranslationCmp {
|
||||
|
||||
int orig_len;
|
||||
CharString compressed;
|
||||
int offset;
|
||||
};
|
||||
|
||||
void PHashTranslation::generate(const Ref<Translation> &p_from) {
|
||||
#ifdef TOOLS_ENABLED
|
||||
List<StringName> keys;
|
||||
p_from->get_message_list(&keys);
|
||||
|
||||
int size=Math::larger_prime(keys.size());
|
||||
|
||||
|
||||
print_line("compressing keys: "+itos(keys.size()));
|
||||
Vector< Vector< Pair<int,CharString> > > buckets;
|
||||
Vector< Map< uint32_t, int > > table;
|
||||
Vector< uint32_t > hfunc_table;
|
||||
Vector< _PHashTranslationCmp > compressed;
|
||||
|
||||
table.resize(size);
|
||||
hfunc_table.resize(size);
|
||||
buckets.resize(size);
|
||||
compressed.resize(keys.size());
|
||||
|
||||
int idx=0;
|
||||
int total_compression_size=0;
|
||||
int total_string_size=0;
|
||||
|
||||
for(List<StringName>::Element *E=keys.front();E;E=E->next()) {
|
||||
|
||||
//hash string
|
||||
CharString cs = E->get().operator String().utf8();
|
||||
uint32_t h = hash(0,cs.get_data());
|
||||
Pair<int,CharString> p;
|
||||
p.first=idx;
|
||||
p.second=cs;
|
||||
buckets[h % size].push_back(p);
|
||||
|
||||
//compress string
|
||||
CharString src_s = p_from->get_message(E->get()).operator String().utf8();
|
||||
_PHashTranslationCmp ps;
|
||||
ps.orig_len=src_s.size();
|
||||
ps.offset=total_compression_size;
|
||||
|
||||
if (ps.orig_len!=0) {
|
||||
CharString dst_s;
|
||||
dst_s.resize(src_s.size());
|
||||
int ret = smaz_compress(src_s.get_data(),src_s.size(),&dst_s[0],src_s.size());
|
||||
if (ret>=src_s.size()) {
|
||||
//if compressed is larger than original, just use original
|
||||
ps.orig_len=src_s.size();
|
||||
ps.compressed=src_s;
|
||||
} else {
|
||||
dst_s.resize(ret);
|
||||
//ps.orig_len=;
|
||||
ps.compressed=dst_s;
|
||||
}
|
||||
} else {
|
||||
ps.orig_len=1;
|
||||
ps.compressed.resize(1);
|
||||
ps.compressed[0]=0;
|
||||
}
|
||||
|
||||
|
||||
compressed[idx]=ps;
|
||||
total_compression_size+=ps.compressed.size();
|
||||
total_string_size+=src_s.size();
|
||||
idx++;
|
||||
}
|
||||
|
||||
int bucket_table_size=0;
|
||||
print_line("total compressed string size: "+itos(total_compression_size)+" ("+itos(total_string_size)+" uncompressed).");
|
||||
|
||||
for(int i=0;i<size;i++) {
|
||||
|
||||
Vector< Pair<int,CharString> > &b = buckets[i];
|
||||
Map< uint32_t, int > &t=table[i];
|
||||
|
||||
if (b.size()==0)
|
||||
continue;
|
||||
|
||||
//print_line("bucket: "+itos(i)+" - elements: "+itos(b.size()));
|
||||
|
||||
int d = 1;
|
||||
int item =0;
|
||||
|
||||
while(item < b.size()) {
|
||||
|
||||
uint32_t slot = hash(d,b[item].second.get_data());
|
||||
if (t.has(slot)) {
|
||||
|
||||
item=0;
|
||||
d++;
|
||||
t.clear();
|
||||
} else {
|
||||
t[slot]=b[item].first;
|
||||
item++;
|
||||
}
|
||||
}
|
||||
|
||||
hfunc_table[i]=d;
|
||||
bucket_table_size+=2+b.size()*4;
|
||||
|
||||
}
|
||||
|
||||
|
||||
print_line("bucket table size: "+itos(bucket_table_size*4));
|
||||
print_line("hash table size: "+itos(size*4));
|
||||
|
||||
hash_table.resize(size);
|
||||
bucket_table.resize(bucket_table_size);
|
||||
|
||||
DVector<int>::Write htwb = hash_table.write();
|
||||
DVector<int>::Write btwb = bucket_table.write();
|
||||
|
||||
uint32_t *htw = (uint32_t*)&htwb[0];
|
||||
uint32_t *btw = (uint32_t*)&btwb[0];
|
||||
|
||||
int btindex=0;
|
||||
int collisions=0;
|
||||
|
||||
for(int i=0;i<size;i++) {
|
||||
|
||||
Map< uint32_t, int > &t=table[i];
|
||||
if (t.size()==0) {
|
||||
htw[i]=0xFFFFFFFF; //nothing
|
||||
continue;
|
||||
} else if (t.size()>1) {
|
||||
collisions+=t.size()-1;
|
||||
}
|
||||
|
||||
htw[i]=btindex;
|
||||
btw[btindex++]=t.size();
|
||||
btw[btindex++]=hfunc_table[i];
|
||||
|
||||
for( Map< uint32_t, int >::Element *E=t.front();E;E=E->next()) {
|
||||
|
||||
btw[btindex++]=E->key();
|
||||
btw[btindex++]=compressed[E->get()].offset;
|
||||
btw[btindex++]=compressed[E->get()].compressed.size();
|
||||
btw[btindex++]=compressed[E->get()].orig_len;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
print_line("total collisions: "+itos(collisions));
|
||||
|
||||
strings.resize(total_compression_size);
|
||||
DVector<uint8_t>::Write cw = strings.write();
|
||||
|
||||
for(int i=0;i<compressed.size();i++) {
|
||||
memcpy(&cw[compressed[i].offset],compressed[i].compressed.get_data(),compressed[i].compressed.size());
|
||||
}
|
||||
|
||||
|
||||
ERR_FAIL_COND(btindex!=bucket_table_size);
|
||||
set_locale(p_from->get_locale());
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
bool PHashTranslation::_set(const StringName& p_name, const Variant& p_value) {
|
||||
|
||||
String name = p_name.operator String();
|
||||
if (name=="hash_table") {
|
||||
hash_table=p_value;
|
||||
print_line("translation: loaded hash table of size: "+itos(hash_table.size()));
|
||||
} else if (name=="bucket_table") {
|
||||
bucket_table=p_value;
|
||||
print_line("translation: loaded bucket table of size: "+itos(bucket_table.size()));
|
||||
} else if (name=="strings") {
|
||||
strings=p_value;
|
||||
print_line("translation: loaded string table of size: "+itos(strings.size()));
|
||||
} else if (name=="load_from") {
|
||||
print_line("generating");
|
||||
generate(p_value);
|
||||
} else
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
bool PHashTranslation::_get(const StringName& p_name,Variant &r_ret) const{
|
||||
|
||||
String name = p_name.operator String();
|
||||
if (name=="hash_table")
|
||||
r_ret=hash_table;
|
||||
else if (name=="bucket_table")
|
||||
r_ret=bucket_table;
|
||||
else if (name=="strings")
|
||||
r_ret=strings;
|
||||
else
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
StringName PHashTranslation::get_message(const StringName& p_src_text) const {
|
||||
|
||||
int htsize = hash_table.size();
|
||||
|
||||
if (htsize==0)
|
||||
return StringName();
|
||||
|
||||
CharString str = p_src_text.operator String().utf8();
|
||||
uint32_t h = hash(0,str.get_data());
|
||||
|
||||
|
||||
DVector<int>::Read htr = hash_table.read();
|
||||
const uint32_t *htptr = (const uint32_t*)&htr[0];
|
||||
DVector<int>::Read btr = bucket_table.read();
|
||||
const uint32_t *btptr = (const uint32_t*)&btr[0];
|
||||
DVector<uint8_t>::Read sr = strings.read();
|
||||
const char *sptr= (const char*)&sr[0];
|
||||
|
||||
uint32_t p = htptr[ h % htsize];
|
||||
|
||||
//print_line("String: "+p_src_text.operator String());
|
||||
//print_line("Hash: "+itos(p));
|
||||
|
||||
if (p==0xFFFFFFFF) {
|
||||
// print_line("GETMSG: Nothing!");
|
||||
return StringName(); //nothing
|
||||
}
|
||||
|
||||
const Bucket &bucket = *(const Bucket*)&btptr[p];
|
||||
|
||||
h = hash(bucket.func,str.get_data());
|
||||
|
||||
int idx=-1;
|
||||
|
||||
for(int i=0;i<bucket.size;i++) {
|
||||
|
||||
if (bucket.elem[i].key==h) {
|
||||
|
||||
idx=i;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//print_line("bucket pos: "+itos(idx));
|
||||
if (idx==-1) {
|
||||
// print_line("GETMSG: Not in Bucket!");
|
||||
return StringName();
|
||||
}
|
||||
|
||||
if (bucket.elem[idx].comp_size == bucket.elem[idx].uncomp_size) {
|
||||
|
||||
String rstr;
|
||||
rstr.parse_utf8(&sptr[ bucket.elem[idx].str_offset ], bucket.elem[idx].uncomp_size );
|
||||
// print_line("Uncompressed, size: "+itos(bucket.elem[idx].comp_size));
|
||||
// print_line("Return: "+rstr);
|
||||
|
||||
return rstr;
|
||||
} else {
|
||||
|
||||
CharString uncomp;
|
||||
uncomp.resize( bucket.elem[idx].uncomp_size+1 );
|
||||
smaz_decompress(&sptr[ bucket.elem[idx].str_offset ], bucket.elem[idx].comp_size,uncomp.ptr(),bucket.elem[idx].uncomp_size );
|
||||
String rstr;
|
||||
rstr.parse_utf8(uncomp.get_data());
|
||||
// print_line("Compressed, size: "+itos(bucket.elem[idx].comp_size));
|
||||
// print_line("Return: "+rstr);
|
||||
return rstr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void PHashTranslation::_get_property_list( List<PropertyInfo> *p_list) const{
|
||||
|
||||
p_list->push_back( PropertyInfo(Variant::INT_ARRAY, "hash_table"));
|
||||
p_list->push_back( PropertyInfo(Variant::INT_ARRAY, "bucket_table"));
|
||||
p_list->push_back( PropertyInfo(Variant::RAW_ARRAY, "strings"));
|
||||
p_list->push_back( PropertyInfo(Variant::OBJECT, "load_from",PROPERTY_HINT_RESOURCE_TYPE,"Translation",PROPERTY_USAGE_EDITOR));
|
||||
|
||||
}
|
||||
void PHashTranslation::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("generate","from:Translation"),&PHashTranslation::generate);
|
||||
}
|
||||
|
||||
PHashTranslation::PHashTranslation()
|
||||
{
|
||||
}
|
||||
93
core/compressed_translation.h
Normal file
93
core/compressed_translation.h
Normal file
@ -0,0 +1,93 @@
|
||||
/*************************************************************************/
|
||||
/* compressed_translation.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* http://www.godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifndef COMPRESSED_TRANSLATION_H
|
||||
#define COMPRESSED_TRANSLATION_H
|
||||
|
||||
#include "translation.h"
|
||||
|
||||
class PHashTranslation : public Translation {
|
||||
|
||||
OBJ_TYPE(PHashTranslation,Translation);
|
||||
|
||||
|
||||
//this translation uses a sort of modified perfect hash algorithm
|
||||
//it requieres hashing strings twice and then does a binary search,
|
||||
//so it's slower, but at the same time it has an extreemly high chance
|
||||
//of catching untranslated strings
|
||||
|
||||
//load/store friendly types
|
||||
DVector<int> hash_table;
|
||||
DVector<int> bucket_table;
|
||||
DVector<uint8_t> strings;
|
||||
|
||||
|
||||
struct Bucket {
|
||||
|
||||
int size;
|
||||
uint32_t func;
|
||||
|
||||
struct Elem {
|
||||
|
||||
uint32_t key;
|
||||
uint32_t str_offset;
|
||||
uint32_t comp_size;
|
||||
uint32_t uncomp_size;
|
||||
};
|
||||
|
||||
Elem elem[1];
|
||||
};
|
||||
|
||||
_FORCE_INLINE_ uint32_t hash( uint32_t d, const char *p_str ) const {
|
||||
|
||||
if (d==0)
|
||||
d=0x1000193;
|
||||
while(*p_str) {
|
||||
|
||||
d = (d * 0x1000193) ^ uint32_t(*p_str);
|
||||
p_str++;
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
protected:
|
||||
|
||||
bool _set(const StringName& p_name, const Variant& p_value);
|
||||
bool _get(const StringName& p_name,Variant &r_ret) const;
|
||||
void _get_property_list( List<PropertyInfo> *p_list) const;
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
|
||||
virtual StringName get_message(const StringName& p_src_text) const; //overridable for other implementations
|
||||
void generate(const Ref<Translation> &p_from);
|
||||
|
||||
PHashTranslation();
|
||||
};
|
||||
|
||||
#endif // COMPRESSED_TRANSLATION_H
|
||||
@ -1,7 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import("env")
|
||||
|
||||
env_config = env.Clone()
|
||||
|
||||
env_config.add_source_files(env.core_sources, "*.cpp")
|
||||
@ -1,330 +0,0 @@
|
||||
/**************************************************************************/
|
||||
/* engine.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "engine.h"
|
||||
|
||||
#include "core/authors.gen.h"
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/donors.gen.h"
|
||||
#include "core/license.gen.h"
|
||||
#include "core/variant/typed_array.h"
|
||||
#include "core/version.h"
|
||||
|
||||
void Engine::set_physics_ticks_per_second(int p_ips) {
|
||||
ERR_FAIL_COND_MSG(p_ips <= 0, "Engine iterations per second must be greater than 0.");
|
||||
ips = p_ips;
|
||||
}
|
||||
|
||||
int Engine::get_physics_ticks_per_second() const {
|
||||
return ips;
|
||||
}
|
||||
|
||||
void Engine::set_max_physics_steps_per_frame(int p_max_physics_steps) {
|
||||
ERR_FAIL_COND_MSG(p_max_physics_steps <= 0, "Maximum number of physics steps per frame must be greater than 0.");
|
||||
max_physics_steps_per_frame = p_max_physics_steps;
|
||||
}
|
||||
|
||||
int Engine::get_max_physics_steps_per_frame() const {
|
||||
return max_physics_steps_per_frame;
|
||||
}
|
||||
|
||||
void Engine::set_physics_jitter_fix(double p_threshold) {
|
||||
if (p_threshold < 0) {
|
||||
p_threshold = 0;
|
||||
}
|
||||
physics_jitter_fix = p_threshold;
|
||||
}
|
||||
|
||||
double Engine::get_physics_jitter_fix() const {
|
||||
return physics_jitter_fix;
|
||||
}
|
||||
|
||||
void Engine::set_max_fps(int p_fps) {
|
||||
_max_fps = p_fps > 0 ? p_fps : 0;
|
||||
}
|
||||
|
||||
int Engine::get_max_fps() const {
|
||||
return _max_fps;
|
||||
}
|
||||
|
||||
uint64_t Engine::get_frames_drawn() {
|
||||
return frames_drawn;
|
||||
}
|
||||
|
||||
void Engine::set_frame_delay(uint32_t p_msec) {
|
||||
_frame_delay = p_msec;
|
||||
}
|
||||
|
||||
uint32_t Engine::get_frame_delay() const {
|
||||
return _frame_delay;
|
||||
}
|
||||
|
||||
void Engine::set_time_scale(double p_scale) {
|
||||
_time_scale = p_scale;
|
||||
}
|
||||
|
||||
double Engine::get_time_scale() const {
|
||||
return _time_scale;
|
||||
}
|
||||
|
||||
Dictionary Engine::get_version_info() const {
|
||||
Dictionary dict;
|
||||
dict["major"] = VERSION_MAJOR;
|
||||
dict["minor"] = VERSION_MINOR;
|
||||
dict["patch"] = VERSION_PATCH;
|
||||
dict["hex"] = VERSION_HEX;
|
||||
dict["status"] = VERSION_STATUS;
|
||||
dict["build"] = VERSION_BUILD;
|
||||
dict["year"] = VERSION_YEAR;
|
||||
|
||||
String hash = String(VERSION_HASH);
|
||||
dict["hash"] = hash.is_empty() ? String("unknown") : hash;
|
||||
|
||||
String stringver = String(dict["major"]) + "." + String(dict["minor"]);
|
||||
if ((int)dict["patch"] != 0) {
|
||||
stringver += "." + String(dict["patch"]);
|
||||
}
|
||||
stringver += "-" + String(dict["status"]) + " (" + String(dict["build"]) + ")";
|
||||
dict["string"] = stringver;
|
||||
|
||||
return dict;
|
||||
}
|
||||
|
||||
static Array array_from_info(const char *const *info_list) {
|
||||
Array arr;
|
||||
for (int i = 0; info_list[i] != nullptr; i++) {
|
||||
arr.push_back(String::utf8(info_list[i]));
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
static Array array_from_info_count(const char *const *info_list, int info_count) {
|
||||
Array arr;
|
||||
for (int i = 0; i < info_count; i++) {
|
||||
arr.push_back(String::utf8(info_list[i]));
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
Dictionary Engine::get_author_info() const {
|
||||
Dictionary dict;
|
||||
|
||||
dict["lead_developers"] = array_from_info(AUTHORS_LEAD_DEVELOPERS);
|
||||
dict["project_managers"] = array_from_info(AUTHORS_PROJECT_MANAGERS);
|
||||
dict["founders"] = array_from_info(AUTHORS_FOUNDERS);
|
||||
dict["developers"] = array_from_info(AUTHORS_DEVELOPERS);
|
||||
|
||||
return dict;
|
||||
}
|
||||
|
||||
TypedArray<Dictionary> Engine::get_copyright_info() const {
|
||||
TypedArray<Dictionary> components;
|
||||
for (int component_index = 0; component_index < COPYRIGHT_INFO_COUNT; component_index++) {
|
||||
const ComponentCopyright &cp_info = COPYRIGHT_INFO[component_index];
|
||||
Dictionary component_dict;
|
||||
component_dict["name"] = String::utf8(cp_info.name);
|
||||
Array parts;
|
||||
for (int i = 0; i < cp_info.part_count; i++) {
|
||||
const ComponentCopyrightPart &cp_part = cp_info.parts[i];
|
||||
Dictionary part_dict;
|
||||
part_dict["files"] = array_from_info_count(cp_part.files, cp_part.file_count);
|
||||
part_dict["copyright"] = array_from_info_count(cp_part.copyright_statements, cp_part.copyright_count);
|
||||
part_dict["license"] = String::utf8(cp_part.license);
|
||||
parts.push_back(part_dict);
|
||||
}
|
||||
component_dict["parts"] = parts;
|
||||
|
||||
components.push_back(component_dict);
|
||||
}
|
||||
return components;
|
||||
}
|
||||
|
||||
Dictionary Engine::get_donor_info() const {
|
||||
Dictionary donors;
|
||||
donors["platinum_sponsors"] = array_from_info(DONORS_SPONSOR_PLATINUM);
|
||||
donors["gold_sponsors"] = array_from_info(DONORS_SPONSOR_GOLD);
|
||||
donors["silver_sponsors"] = array_from_info(DONORS_SPONSOR_SILVER);
|
||||
donors["bronze_sponsors"] = array_from_info(DONORS_SPONSOR_BRONZE);
|
||||
donors["mini_sponsors"] = array_from_info(DONORS_SPONSOR_MINI);
|
||||
donors["gold_donors"] = array_from_info(DONORS_GOLD);
|
||||
donors["silver_donors"] = array_from_info(DONORS_SILVER);
|
||||
donors["bronze_donors"] = array_from_info(DONORS_BRONZE);
|
||||
return donors;
|
||||
}
|
||||
|
||||
Dictionary Engine::get_license_info() const {
|
||||
Dictionary licenses;
|
||||
for (int i = 0; i < LICENSE_COUNT; i++) {
|
||||
licenses[LICENSE_NAMES[i]] = LICENSE_BODIES[i];
|
||||
}
|
||||
return licenses;
|
||||
}
|
||||
|
||||
String Engine::get_license_text() const {
|
||||
return String(GODOT_LICENSE_TEXT);
|
||||
}
|
||||
|
||||
String Engine::get_architecture_name() const {
|
||||
#if defined(__x86_64) || defined(__x86_64__) || defined(__amd64__) || defined(_M_X64)
|
||||
return "x86_64";
|
||||
|
||||
#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
|
||||
return "x86_32";
|
||||
|
||||
#elif defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC)
|
||||
return "arm64";
|
||||
|
||||
#elif defined(__arm__) || defined(_M_ARM)
|
||||
return "arm32";
|
||||
|
||||
#elif defined(__riscv)
|
||||
#if __riscv_xlen == 8
|
||||
return "rv64";
|
||||
#else
|
||||
return "riscv";
|
||||
#endif
|
||||
|
||||
#elif defined(__powerpc__)
|
||||
#if defined(__powerpc64__)
|
||||
return "ppc64";
|
||||
#else
|
||||
return "ppc";
|
||||
#endif
|
||||
|
||||
#elif defined(__wasm__)
|
||||
#if defined(__wasm64__)
|
||||
return "wasm64";
|
||||
#elif defined(__wasm32__)
|
||||
return "wasm32";
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Engine::is_abort_on_gpu_errors_enabled() const {
|
||||
return abort_on_gpu_errors;
|
||||
}
|
||||
|
||||
int32_t Engine::get_gpu_index() const {
|
||||
return gpu_idx;
|
||||
}
|
||||
|
||||
bool Engine::is_validation_layers_enabled() const {
|
||||
return use_validation_layers;
|
||||
}
|
||||
|
||||
void Engine::set_print_error_messages(bool p_enabled) {
|
||||
CoreGlobals::print_error_enabled = p_enabled;
|
||||
}
|
||||
|
||||
bool Engine::is_printing_error_messages() const {
|
||||
return CoreGlobals::print_error_enabled;
|
||||
}
|
||||
|
||||
void Engine::add_singleton(const Singleton &p_singleton) {
|
||||
ERR_FAIL_COND_MSG(singleton_ptrs.has(p_singleton.name), "Can't register singleton that already exists: " + String(p_singleton.name));
|
||||
singletons.push_back(p_singleton);
|
||||
singleton_ptrs[p_singleton.name] = p_singleton.ptr;
|
||||
}
|
||||
|
||||
Object *Engine::get_singleton_object(const StringName &p_name) const {
|
||||
HashMap<StringName, Object *>::ConstIterator E = singleton_ptrs.find(p_name);
|
||||
ERR_FAIL_COND_V_MSG(!E, nullptr, "Failed to retrieve non-existent singleton '" + String(p_name) + "'.");
|
||||
return E->value;
|
||||
}
|
||||
|
||||
bool Engine::is_singleton_user_created(const StringName &p_name) const {
|
||||
ERR_FAIL_COND_V(!singleton_ptrs.has(p_name), false);
|
||||
|
||||
for (const Singleton &E : singletons) {
|
||||
if (E.name == p_name && E.user_created) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
void Engine::remove_singleton(const StringName &p_name) {
|
||||
ERR_FAIL_COND(!singleton_ptrs.has(p_name));
|
||||
|
||||
for (List<Singleton>::Element *E = singletons.front(); E; E = E->next()) {
|
||||
if (E->get().name == p_name) {
|
||||
singletons.erase(E);
|
||||
singleton_ptrs.erase(p_name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Engine::has_singleton(const StringName &p_name) const {
|
||||
return singleton_ptrs.has(p_name);
|
||||
}
|
||||
|
||||
void Engine::get_singletons(List<Singleton> *p_singletons) {
|
||||
for (const Singleton &E : singletons) {
|
||||
p_singletons->push_back(E);
|
||||
}
|
||||
}
|
||||
|
||||
String Engine::get_write_movie_path() const {
|
||||
return write_movie_path;
|
||||
}
|
||||
|
||||
void Engine::set_write_movie_path(const String &p_path) {
|
||||
write_movie_path = p_path;
|
||||
}
|
||||
|
||||
void Engine::set_shader_cache_path(const String &p_path) {
|
||||
shader_cache_path = p_path;
|
||||
}
|
||||
String Engine::get_shader_cache_path() const {
|
||||
return shader_cache_path;
|
||||
}
|
||||
|
||||
Engine *Engine::singleton = nullptr;
|
||||
|
||||
Engine *Engine::get_singleton() {
|
||||
return singleton;
|
||||
}
|
||||
|
||||
Engine::Engine() {
|
||||
singleton = this;
|
||||
}
|
||||
|
||||
Engine::Singleton::Singleton(const StringName &p_name, Object *p_ptr, const StringName &p_class_name) :
|
||||
name(p_name),
|
||||
ptr(p_ptr),
|
||||
class_name(p_class_name) {
|
||||
#ifdef DEBUG_ENABLED
|
||||
RefCounted *rc = Object::cast_to<RefCounted>(p_ptr);
|
||||
if (rc && !rc->is_referenced()) {
|
||||
WARN_PRINT("You must use Ref<> to ensure the lifetime of a RefCounted object intended to be used as a singleton.");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -1,165 +0,0 @@
|
||||
/**************************************************************************/
|
||||
/* engine.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef ENGINE_H
|
||||
#define ENGINE_H
|
||||
|
||||
#include "core/os/main_loop.h"
|
||||
#include "core/string/ustring.h"
|
||||
#include "core/templates/list.h"
|
||||
#include "core/templates/vector.h"
|
||||
|
||||
template <typename T>
|
||||
class TypedArray;
|
||||
|
||||
class Engine {
|
||||
public:
|
||||
struct Singleton {
|
||||
StringName name;
|
||||
Object *ptr = nullptr;
|
||||
StringName class_name; //used for binding generation hinting
|
||||
bool user_created = false;
|
||||
Singleton(const StringName &p_name = StringName(), Object *p_ptr = nullptr, const StringName &p_class_name = StringName());
|
||||
};
|
||||
|
||||
private:
|
||||
friend class Main;
|
||||
|
||||
uint64_t frames_drawn = 0;
|
||||
uint32_t _frame_delay = 0;
|
||||
uint64_t _frame_ticks = 0;
|
||||
double _process_step = 0;
|
||||
|
||||
int ips = 60;
|
||||
double physics_jitter_fix = 0.5;
|
||||
double _fps = 1;
|
||||
int _max_fps = 0;
|
||||
double _time_scale = 1.0;
|
||||
uint64_t _physics_frames = 0;
|
||||
int max_physics_steps_per_frame = 8;
|
||||
double _physics_interpolation_fraction = 0.0f;
|
||||
bool abort_on_gpu_errors = false;
|
||||
bool use_validation_layers = false;
|
||||
int32_t gpu_idx = -1;
|
||||
|
||||
uint64_t _process_frames = 0;
|
||||
bool _in_physics = false;
|
||||
|
||||
List<Singleton> singletons;
|
||||
HashMap<StringName, Object *> singleton_ptrs;
|
||||
|
||||
bool editor_hint = false;
|
||||
bool project_manager_hint = false;
|
||||
|
||||
static Engine *singleton;
|
||||
|
||||
String write_movie_path;
|
||||
String shader_cache_path;
|
||||
|
||||
public:
|
||||
static Engine *get_singleton();
|
||||
|
||||
virtual void set_physics_ticks_per_second(int p_ips);
|
||||
virtual int get_physics_ticks_per_second() const;
|
||||
|
||||
virtual void set_max_physics_steps_per_frame(int p_max_physics_steps);
|
||||
virtual int get_max_physics_steps_per_frame() const;
|
||||
|
||||
void set_physics_jitter_fix(double p_threshold);
|
||||
double get_physics_jitter_fix() const;
|
||||
|
||||
virtual void set_max_fps(int p_fps);
|
||||
virtual int get_max_fps() const;
|
||||
|
||||
virtual double get_frames_per_second() const { return _fps; }
|
||||
|
||||
uint64_t get_frames_drawn();
|
||||
|
||||
uint64_t get_physics_frames() const { return _physics_frames; }
|
||||
uint64_t get_process_frames() const { return _process_frames; }
|
||||
bool is_in_physics_frame() const { return _in_physics; }
|
||||
uint64_t get_frame_ticks() const { return _frame_ticks; }
|
||||
double get_process_step() const { return _process_step; }
|
||||
double get_physics_interpolation_fraction() const { return _physics_interpolation_fraction; }
|
||||
|
||||
void set_time_scale(double p_scale);
|
||||
double get_time_scale() const;
|
||||
|
||||
void set_print_error_messages(bool p_enabled);
|
||||
bool is_printing_error_messages() const;
|
||||
|
||||
void set_frame_delay(uint32_t p_msec);
|
||||
uint32_t get_frame_delay() const;
|
||||
|
||||
void add_singleton(const Singleton &p_singleton);
|
||||
void get_singletons(List<Singleton> *p_singletons);
|
||||
bool has_singleton(const StringName &p_name) const;
|
||||
Object *get_singleton_object(const StringName &p_name) const;
|
||||
void remove_singleton(const StringName &p_name);
|
||||
bool is_singleton_user_created(const StringName &p_name) const;
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
_FORCE_INLINE_ void set_editor_hint(bool p_enabled) { editor_hint = p_enabled; }
|
||||
_FORCE_INLINE_ bool is_editor_hint() const { return editor_hint; }
|
||||
|
||||
_FORCE_INLINE_ void set_project_manager_hint(bool p_enabled) { project_manager_hint = p_enabled; }
|
||||
_FORCE_INLINE_ bool is_project_manager_hint() const { return project_manager_hint; }
|
||||
#else
|
||||
_FORCE_INLINE_ void set_editor_hint(bool p_enabled) {}
|
||||
_FORCE_INLINE_ bool is_editor_hint() const { return false; }
|
||||
|
||||
_FORCE_INLINE_ void set_project_manager_hint(bool p_enabled) {}
|
||||
_FORCE_INLINE_ bool is_project_manager_hint() const { return false; }
|
||||
#endif
|
||||
|
||||
Dictionary get_version_info() const;
|
||||
Dictionary get_author_info() const;
|
||||
TypedArray<Dictionary> get_copyright_info() const;
|
||||
Dictionary get_donor_info() const;
|
||||
Dictionary get_license_info() const;
|
||||
String get_license_text() const;
|
||||
|
||||
void set_write_movie_path(const String &p_path);
|
||||
String get_write_movie_path() const;
|
||||
|
||||
String get_architecture_name() const;
|
||||
|
||||
void set_shader_cache_path(const String &p_path);
|
||||
String get_shader_cache_path() const;
|
||||
|
||||
bool is_abort_on_gpu_errors_enabled() const;
|
||||
bool is_validation_layers_enabled() const;
|
||||
int32_t get_gpu_index() const;
|
||||
|
||||
Engine();
|
||||
virtual ~Engine() {}
|
||||
};
|
||||
|
||||
#endif // ENGINE_H
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,224 +0,0 @@
|
||||
/**************************************************************************/
|
||||
/* project_settings.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef PROJECT_SETTINGS_H
|
||||
#define PROJECT_SETTINGS_H
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/os/thread_safe.h"
|
||||
#include "core/templates/hash_map.h"
|
||||
#include "core/templates/local_vector.h"
|
||||
#include "core/templates/rb_set.h"
|
||||
|
||||
template <typename T>
|
||||
class TypedArray;
|
||||
|
||||
class ProjectSettings : public Object {
|
||||
GDCLASS(ProjectSettings, Object);
|
||||
_THREAD_SAFE_CLASS_
|
||||
|
||||
public:
|
||||
typedef HashMap<String, Variant> CustomMap;
|
||||
static const String PROJECT_DATA_DIR_NAME_SUFFIX;
|
||||
|
||||
enum {
|
||||
// Properties that are not for built in values begin from this value, so builtin ones are displayed first.
|
||||
NO_BUILTIN_ORDER_BASE = 1 << 16
|
||||
};
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
const static PackedStringArray get_required_features();
|
||||
const static PackedStringArray get_unsupported_features(const PackedStringArray &p_project_features);
|
||||
#endif // TOOLS_ENABLED
|
||||
|
||||
struct AutoloadInfo {
|
||||
StringName name;
|
||||
String path;
|
||||
bool is_singleton = false;
|
||||
};
|
||||
|
||||
protected:
|
||||
struct VariantContainer {
|
||||
int order = 0;
|
||||
bool persist = false;
|
||||
bool basic = false;
|
||||
bool internal = false;
|
||||
Variant variant;
|
||||
Variant initial;
|
||||
bool hide_from_editor = false;
|
||||
bool restart_if_changed = false;
|
||||
#ifdef DEBUG_METHODS_ENABLED
|
||||
bool ignore_value_in_docs = false;
|
||||
#endif
|
||||
|
||||
VariantContainer() {}
|
||||
|
||||
VariantContainer(const Variant &p_variant, int p_order, bool p_persist = false) :
|
||||
order(p_order),
|
||||
persist(p_persist),
|
||||
variant(p_variant) {
|
||||
}
|
||||
};
|
||||
|
||||
int last_order = NO_BUILTIN_ORDER_BASE;
|
||||
int last_builtin_order = 0;
|
||||
uint64_t last_save_time = 0;
|
||||
|
||||
RBMap<StringName, VariantContainer> props; // NOTE: Key order is used e.g. in the save_custom method.
|
||||
String resource_path;
|
||||
HashMap<StringName, PropertyInfo> custom_prop_info;
|
||||
bool using_datapack = false;
|
||||
bool project_loaded = false;
|
||||
List<String> input_presets;
|
||||
|
||||
HashSet<String> custom_features;
|
||||
HashMap<StringName, LocalVector<Pair<StringName, StringName>>> feature_overrides;
|
||||
|
||||
HashMap<StringName, AutoloadInfo> autoloads;
|
||||
|
||||
Array global_class_list;
|
||||
bool is_global_class_list_loaded = false;
|
||||
|
||||
String project_data_dir_name;
|
||||
|
||||
bool _set(const StringName &p_name, const Variant &p_value);
|
||||
bool _get(const StringName &p_name, Variant &r_ret) const;
|
||||
void _get_property_list(List<PropertyInfo> *p_list) const;
|
||||
bool _property_can_revert(const StringName &p_name) const;
|
||||
bool _property_get_revert(const StringName &p_name, Variant &r_property) const;
|
||||
|
||||
static ProjectSettings *singleton;
|
||||
|
||||
Error _load_settings_text(const String &p_path);
|
||||
Error _load_settings_binary(const String &p_path);
|
||||
Error _load_settings_text_or_binary(const String &p_text_path, const String &p_bin_path);
|
||||
|
||||
Error _save_settings_text(const String &p_file, const RBMap<String, List<String>> &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String());
|
||||
Error _save_settings_binary(const String &p_file, const RBMap<String, List<String>> &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String());
|
||||
|
||||
Error _save_custom_bnd(const String &p_file);
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
const static PackedStringArray _get_supported_features();
|
||||
const static PackedStringArray _trim_to_supported_features(const PackedStringArray &p_project_features);
|
||||
#endif // TOOLS_ENABLED
|
||||
|
||||
void _convert_to_last_version(int p_from_version);
|
||||
|
||||
bool _load_resource_pack(const String &p_pack, bool p_replace_files = true, int p_offset = 0);
|
||||
|
||||
void _add_property_info_bind(const Dictionary &p_info);
|
||||
|
||||
Error _setup(const String &p_path, const String &p_main_pack, bool p_upwards = false, bool p_ignore_override = false);
|
||||
|
||||
void _add_builtin_input_map();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
static const int CONFIG_VERSION = 5;
|
||||
|
||||
void set_setting(const String &p_setting, const Variant &p_value);
|
||||
Variant get_setting(const String &p_setting, const Variant &p_default_value = Variant()) const;
|
||||
TypedArray<Dictionary> get_global_class_list();
|
||||
void store_global_class_list(const Array &p_classes);
|
||||
String get_global_class_list_path() const;
|
||||
|
||||
bool has_setting(String p_var) const;
|
||||
String localize_path(const String &p_path) const;
|
||||
String globalize_path(const String &p_path) const;
|
||||
|
||||
void set_initial_value(const String &p_name, const Variant &p_value);
|
||||
void set_as_basic(const String &p_name, bool p_basic);
|
||||
void set_as_internal(const String &p_name, bool p_internal);
|
||||
void set_restart_if_changed(const String &p_name, bool p_restart);
|
||||
void set_ignore_value_in_docs(const String &p_name, bool p_ignore);
|
||||
bool get_ignore_value_in_docs(const String &p_name) const;
|
||||
|
||||
String get_project_data_dir_name() const;
|
||||
String get_project_data_path() const;
|
||||
String get_resource_path() const;
|
||||
String get_imported_files_path() const;
|
||||
|
||||
static ProjectSettings *get_singleton();
|
||||
|
||||
void clear(const String &p_name);
|
||||
int get_order(const String &p_name) const;
|
||||
void set_order(const String &p_name, int p_order);
|
||||
void set_builtin_order(const String &p_name);
|
||||
bool is_builtin_setting(const String &p_name) const;
|
||||
|
||||
Error setup(const String &p_path, const String &p_main_pack, bool p_upwards = false, bool p_ignore_override = false);
|
||||
|
||||
Error load_custom(const String &p_path);
|
||||
Error save_custom(const String &p_path = "", const CustomMap &p_custom = CustomMap(), const Vector<String> &p_custom_features = Vector<String>(), bool p_merge_with_current = true);
|
||||
Error save();
|
||||
void set_custom_property_info(const PropertyInfo &p_info);
|
||||
const HashMap<StringName, PropertyInfo> &get_custom_property_info() const;
|
||||
uint64_t get_last_saved_time() { return last_save_time; }
|
||||
|
||||
List<String> get_input_presets() const { return input_presets; }
|
||||
|
||||
Variant get_setting_with_override(const StringName &p_name) const;
|
||||
|
||||
bool is_using_datapack() const;
|
||||
bool is_project_loaded() const;
|
||||
|
||||
bool has_custom_feature(const String &p_feature) const;
|
||||
|
||||
const HashMap<StringName, AutoloadInfo> &get_autoload_list() const;
|
||||
void add_autoload(const AutoloadInfo &p_autoload);
|
||||
void remove_autoload(const StringName &p_autoload);
|
||||
bool has_autoload(const StringName &p_autoload) const;
|
||||
AutoloadInfo get_autoload(const StringName &p_name) const;
|
||||
|
||||
ProjectSettings();
|
||||
~ProjectSettings();
|
||||
};
|
||||
|
||||
// Not a macro any longer.
|
||||
Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default, bool p_restart_if_changed = false, bool p_ignore_value_in_docs = false, bool p_basic = false, bool p_internal = false);
|
||||
Variant _GLOBAL_DEF(const PropertyInfo &p_info, const Variant &p_default, bool p_restart_if_changed = false, bool p_ignore_value_in_docs = false, bool p_basic = false, bool p_internal = false);
|
||||
|
||||
#define GLOBAL_DEF(m_var, m_value) _GLOBAL_DEF(m_var, m_value)
|
||||
#define GLOBAL_DEF_RST(m_var, m_value) _GLOBAL_DEF(m_var, m_value, true)
|
||||
#define GLOBAL_DEF_NOVAL(m_var, m_value) _GLOBAL_DEF(m_var, m_value, false, true)
|
||||
#define GLOBAL_DEF_RST_NOVAL(m_var, m_value) _GLOBAL_DEF(m_var, m_value, true, true)
|
||||
#define GLOBAL_GET(m_var) ProjectSettings::get_singleton()->get_setting_with_override(m_var)
|
||||
|
||||
#define GLOBAL_DEF_BASIC(m_var, m_value) _GLOBAL_DEF(m_var, m_value, false, false, true)
|
||||
#define GLOBAL_DEF_RST_BASIC(m_var, m_value) _GLOBAL_DEF(m_var, m_value, true, false, true)
|
||||
#define GLOBAL_DEF_NOVAL_BASIC(m_var, m_value) _GLOBAL_DEF(m_var, m_value, false, true, true)
|
||||
#define GLOBAL_DEF_RST_NOVAL_BASIC(m_var, m_value) _GLOBAL_DEF(m_var, m_value, true, true, true)
|
||||
|
||||
#define GLOBAL_DEF_INTERNAL(m_var, m_value) _GLOBAL_DEF(m_var, m_value, false, false, false, true)
|
||||
|
||||
#endif // PROJECT_SETTINGS_H
|
||||
1859
core/core_bind.cpp
1859
core/core_bind.cpp
File diff suppressed because it is too large
Load Diff
578
core/core_bind.h
578
core/core_bind.h
@ -1,578 +0,0 @@
|
||||
/**************************************************************************/
|
||||
/* core_bind.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef CORE_BIND_H
|
||||
#define CORE_BIND_H
|
||||
|
||||
#include "core/debugger/engine_profiler.h"
|
||||
#include "core/io/image.h"
|
||||
#include "core/io/resource_loader.h"
|
||||
#include "core/io/resource_saver.h"
|
||||
#include "core/object/script_language.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/os/semaphore.h"
|
||||
#include "core/os/thread.h"
|
||||
#include "core/templates/safe_refcount.h"
|
||||
|
||||
class MainLoop;
|
||||
template <typename T>
|
||||
class TypedArray;
|
||||
|
||||
namespace core_bind {
|
||||
|
||||
class ResourceLoader : public Object {
|
||||
GDCLASS(ResourceLoader, Object);
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
static ResourceLoader *singleton;
|
||||
|
||||
public:
|
||||
enum ThreadLoadStatus {
|
||||
THREAD_LOAD_INVALID_RESOURCE,
|
||||
THREAD_LOAD_IN_PROGRESS,
|
||||
THREAD_LOAD_FAILED,
|
||||
THREAD_LOAD_LOADED
|
||||
};
|
||||
|
||||
enum CacheMode {
|
||||
CACHE_MODE_IGNORE, // Resource and subresources do not use path cache, no path is set into resource.
|
||||
CACHE_MODE_REUSE, // Resource and subresources use patch cache, reuse existing loaded resources instead of loading from disk when available.
|
||||
CACHE_MODE_REPLACE, // Resource and subresource use path cache, but replace existing loaded resources when available with information from disk.
|
||||
};
|
||||
|
||||
static ResourceLoader *get_singleton() { return singleton; }
|
||||
|
||||
Error load_threaded_request(const String &p_path, const String &p_type_hint = "", bool p_use_sub_threads = false, CacheMode p_cache_mode = CACHE_MODE_REUSE);
|
||||
ThreadLoadStatus load_threaded_get_status(const String &p_path, Array r_progress = Array());
|
||||
Ref<Resource> load_threaded_get(const String &p_path);
|
||||
|
||||
Ref<Resource> load(const String &p_path, const String &p_type_hint = "", CacheMode p_cache_mode = CACHE_MODE_REUSE);
|
||||
Vector<String> get_recognized_extensions_for_type(const String &p_type);
|
||||
void add_resource_format_loader(Ref<ResourceFormatLoader> p_format_loader, bool p_at_front);
|
||||
void remove_resource_format_loader(Ref<ResourceFormatLoader> p_format_loader);
|
||||
void set_abort_on_missing_resources(bool p_abort);
|
||||
PackedStringArray get_dependencies(const String &p_path);
|
||||
bool has_cached(const String &p_path);
|
||||
bool exists(const String &p_path, const String &p_type_hint = "");
|
||||
ResourceUID::ID get_resource_uid(const String &p_path);
|
||||
|
||||
ResourceLoader() { singleton = this; }
|
||||
};
|
||||
|
||||
class ResourceSaver : public Object {
|
||||
GDCLASS(ResourceSaver, Object);
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
static ResourceSaver *singleton;
|
||||
|
||||
public:
|
||||
enum SaverFlags {
|
||||
FLAG_NONE = 0,
|
||||
FLAG_RELATIVE_PATHS = 1,
|
||||
FLAG_BUNDLE_RESOURCES = 2,
|
||||
FLAG_CHANGE_PATH = 4,
|
||||
FLAG_OMIT_EDITOR_PROPERTIES = 8,
|
||||
FLAG_SAVE_BIG_ENDIAN = 16,
|
||||
FLAG_COMPRESS = 32,
|
||||
FLAG_REPLACE_SUBRESOURCE_PATHS = 64,
|
||||
};
|
||||
|
||||
static ResourceSaver *get_singleton() { return singleton; }
|
||||
|
||||
Error save(const Ref<Resource> &p_resource, const String &p_path, BitField<SaverFlags> p_flags);
|
||||
Vector<String> get_recognized_extensions(const Ref<Resource> &p_resource);
|
||||
void add_resource_format_saver(Ref<ResourceFormatSaver> p_format_saver, bool p_at_front);
|
||||
void remove_resource_format_saver(Ref<ResourceFormatSaver> p_format_saver);
|
||||
|
||||
ResourceSaver() { singleton = this; }
|
||||
};
|
||||
|
||||
class OS : public Object {
|
||||
GDCLASS(OS, Object);
|
||||
|
||||
mutable HashMap<String, bool> feature_cache;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
static OS *singleton;
|
||||
|
||||
public:
|
||||
enum RenderingDriver {
|
||||
RENDERING_DRIVER_VULKAN,
|
||||
RENDERING_DRIVER_OPENGL3,
|
||||
};
|
||||
|
||||
virtual PackedStringArray get_connected_midi_inputs();
|
||||
virtual void open_midi_inputs();
|
||||
virtual void close_midi_inputs();
|
||||
|
||||
void set_low_processor_usage_mode(bool p_enabled);
|
||||
bool is_in_low_processor_usage_mode() const;
|
||||
|
||||
void set_low_processor_usage_mode_sleep_usec(int p_usec);
|
||||
int get_low_processor_usage_mode_sleep_usec() const;
|
||||
|
||||
void set_delta_smoothing(bool p_enabled);
|
||||
bool is_delta_smoothing_enabled() const;
|
||||
|
||||
void alert(const String &p_alert, const String &p_title = "ALERT!");
|
||||
void crash(const String &p_message);
|
||||
|
||||
Vector<String> get_system_fonts() const;
|
||||
String get_system_font_path(const String &p_font_name, int p_weight = 400, int p_stretch = 100, bool p_italic = false) const;
|
||||
Vector<String> get_system_font_path_for_text(const String &p_font_name, const String &p_text, const String &p_locale = String(), const String &p_script = String(), int p_weight = 400, int p_stretch = 100, bool p_italic = false) const;
|
||||
String get_executable_path() const;
|
||||
String read_string_from_stdin();
|
||||
int execute(const String &p_path, const Vector<String> &p_arguments, Array r_output = Array(), bool p_read_stderr = false, bool p_open_console = false);
|
||||
int create_process(const String &p_path, const Vector<String> &p_arguments, bool p_open_console = false);
|
||||
int create_instance(const Vector<String> &p_arguments);
|
||||
Error kill(int p_pid);
|
||||
Error shell_open(String p_uri);
|
||||
Error shell_show_in_file_manager(String p_path, bool p_open_folder = true);
|
||||
|
||||
bool is_process_running(int p_pid) const;
|
||||
int get_process_id() const;
|
||||
|
||||
void set_restart_on_exit(bool p_restart, const Vector<String> &p_restart_arguments = Vector<String>());
|
||||
bool is_restart_on_exit_set() const;
|
||||
Vector<String> get_restart_on_exit_arguments() const;
|
||||
|
||||
bool has_environment(const String &p_var) const;
|
||||
String get_environment(const String &p_var) const;
|
||||
void set_environment(const String &p_var, const String &p_value) const;
|
||||
void unset_environment(const String &p_var) const;
|
||||
|
||||
String get_name() const;
|
||||
String get_distribution_name() const;
|
||||
String get_version() const;
|
||||
Vector<String> get_cmdline_args();
|
||||
Vector<String> get_cmdline_user_args();
|
||||
|
||||
Vector<String> get_video_adapter_driver_info() const;
|
||||
|
||||
String get_locale() const;
|
||||
String get_locale_language() const;
|
||||
|
||||
String get_model_name() const;
|
||||
|
||||
bool is_debug_build() const;
|
||||
|
||||
String get_unique_id() const;
|
||||
|
||||
String get_keycode_string(Key p_code) const;
|
||||
bool is_keycode_unicode(char32_t p_unicode) const;
|
||||
Key find_keycode_from_string(const String &p_code) const;
|
||||
|
||||
void set_use_file_access_save_and_swap(bool p_enable);
|
||||
|
||||
uint64_t get_static_memory_usage() const;
|
||||
uint64_t get_static_memory_peak_usage() const;
|
||||
Dictionary get_memory_info() const;
|
||||
|
||||
void delay_usec(int p_usec) const;
|
||||
void delay_msec(int p_msec) const;
|
||||
uint64_t get_ticks_msec() const;
|
||||
uint64_t get_ticks_usec() const;
|
||||
|
||||
bool is_userfs_persistent() const;
|
||||
|
||||
bool is_stdout_verbose() const;
|
||||
|
||||
int get_processor_count() const;
|
||||
String get_processor_name() const;
|
||||
|
||||
enum SystemDir {
|
||||
SYSTEM_DIR_DESKTOP,
|
||||
SYSTEM_DIR_DCIM,
|
||||
SYSTEM_DIR_DOCUMENTS,
|
||||
SYSTEM_DIR_DOWNLOADS,
|
||||
SYSTEM_DIR_MOVIES,
|
||||
SYSTEM_DIR_MUSIC,
|
||||
SYSTEM_DIR_PICTURES,
|
||||
SYSTEM_DIR_RINGTONES,
|
||||
};
|
||||
|
||||
String get_system_dir(SystemDir p_dir, bool p_shared_storage = true) const;
|
||||
|
||||
Error move_to_trash(const String &p_path) const;
|
||||
String get_user_data_dir() const;
|
||||
String get_config_dir() const;
|
||||
String get_data_dir() const;
|
||||
String get_cache_dir() const;
|
||||
|
||||
Error set_thread_name(const String &p_name);
|
||||
Thread::ID get_thread_caller_id() const;
|
||||
Thread::ID get_main_thread_id() const;
|
||||
|
||||
bool has_feature(const String &p_feature) const;
|
||||
|
||||
bool request_permission(const String &p_name);
|
||||
bool request_permissions();
|
||||
Vector<String> get_granted_permissions() const;
|
||||
|
||||
static OS *get_singleton() { return singleton; }
|
||||
|
||||
OS() { singleton = this; }
|
||||
};
|
||||
|
||||
class Geometry2D : public Object {
|
||||
GDCLASS(Geometry2D, Object);
|
||||
|
||||
static Geometry2D *singleton;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
static Geometry2D *get_singleton();
|
||||
Variant segment_intersects_segment(const Vector2 &p_from_a, const Vector2 &p_to_a, const Vector2 &p_from_b, const Vector2 &p_to_b);
|
||||
Variant line_intersects_line(const Vector2 &p_from_a, const Vector2 &p_dir_a, const Vector2 &p_from_b, const Vector2 &p_dir_b);
|
||||
Vector<Vector2> get_closest_points_between_segments(const Vector2 &p1, const Vector2 &q1, const Vector2 &p2, const Vector2 &q2);
|
||||
Vector2 get_closest_point_to_segment(const Vector2 &p_point, const Vector2 &p_a, const Vector2 &p_b);
|
||||
Vector2 get_closest_point_to_segment_uncapped(const Vector2 &p_point, const Vector2 &p_a, const Vector2 &p_b);
|
||||
bool point_is_inside_triangle(const Vector2 &s, const Vector2 &a, const Vector2 &b, const Vector2 &c) const;
|
||||
|
||||
bool is_point_in_circle(const Vector2 &p_point, const Vector2 &p_circle_pos, real_t p_circle_radius);
|
||||
real_t segment_intersects_circle(const Vector2 &p_from, const Vector2 &p_to, const Vector2 &p_circle_pos, real_t p_circle_radius);
|
||||
|
||||
bool is_polygon_clockwise(const Vector<Vector2> &p_polygon);
|
||||
bool is_point_in_polygon(const Point2 &p_point, const Vector<Vector2> &p_polygon);
|
||||
Vector<int> triangulate_polygon(const Vector<Vector2> &p_polygon);
|
||||
Vector<int> triangulate_delaunay(const Vector<Vector2> &p_points);
|
||||
Vector<Point2> convex_hull(const Vector<Point2> &p_points);
|
||||
TypedArray<PackedVector2Array> decompose_polygon_in_convex(const Vector<Vector2> &p_polygon);
|
||||
|
||||
enum PolyBooleanOperation {
|
||||
OPERATION_UNION,
|
||||
OPERATION_DIFFERENCE,
|
||||
OPERATION_INTERSECTION,
|
||||
OPERATION_XOR
|
||||
};
|
||||
// 2D polygon boolean operations.
|
||||
TypedArray<PackedVector2Array> merge_polygons(const Vector<Vector2> &p_polygon_a, const Vector<Vector2> &p_polygon_b); // Union (add).
|
||||
TypedArray<PackedVector2Array> clip_polygons(const Vector<Vector2> &p_polygon_a, const Vector<Vector2> &p_polygon_b); // Difference (subtract).
|
||||
TypedArray<PackedVector2Array> intersect_polygons(const Vector<Vector2> &p_polygon_a, const Vector<Vector2> &p_polygon_b); // Common area (multiply).
|
||||
TypedArray<PackedVector2Array> exclude_polygons(const Vector<Vector2> &p_polygon_a, const Vector<Vector2> &p_polygon_b); // All but common area (xor).
|
||||
|
||||
// 2D polyline vs polygon operations.
|
||||
TypedArray<PackedVector2Array> clip_polyline_with_polygon(const Vector<Vector2> &p_polyline, const Vector<Vector2> &p_polygon); // Cut.
|
||||
TypedArray<PackedVector2Array> intersect_polyline_with_polygon(const Vector<Vector2> &p_polyline, const Vector<Vector2> &p_polygon); // Chop.
|
||||
|
||||
// 2D offset polygons/polylines.
|
||||
enum PolyJoinType {
|
||||
JOIN_SQUARE,
|
||||
JOIN_ROUND,
|
||||
JOIN_MITER
|
||||
};
|
||||
enum PolyEndType {
|
||||
END_POLYGON,
|
||||
END_JOINED,
|
||||
END_BUTT,
|
||||
END_SQUARE,
|
||||
END_ROUND
|
||||
};
|
||||
TypedArray<PackedVector2Array> offset_polygon(const Vector<Vector2> &p_polygon, real_t p_delta, PolyJoinType p_join_type = JOIN_SQUARE);
|
||||
TypedArray<PackedVector2Array> offset_polyline(const Vector<Vector2> &p_polygon, real_t p_delta, PolyJoinType p_join_type = JOIN_SQUARE, PolyEndType p_end_type = END_SQUARE);
|
||||
|
||||
Dictionary make_atlas(const Vector<Size2> &p_rects);
|
||||
|
||||
Geometry2D() { singleton = this; }
|
||||
};
|
||||
|
||||
class Geometry3D : public Object {
|
||||
GDCLASS(Geometry3D, Object);
|
||||
|
||||
static Geometry3D *singleton;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
static Geometry3D *get_singleton();
|
||||
TypedArray<Plane> build_box_planes(const Vector3 &p_extents);
|
||||
TypedArray<Plane> build_cylinder_planes(float p_radius, float p_height, int p_sides, Vector3::Axis p_axis = Vector3::AXIS_Z);
|
||||
TypedArray<Plane> build_capsule_planes(float p_radius, float p_height, int p_sides, int p_lats, Vector3::Axis p_axis = Vector3::AXIS_Z);
|
||||
Vector<Vector3> get_closest_points_between_segments(const Vector3 &p1, const Vector3 &p2, const Vector3 &q1, const Vector3 &q2);
|
||||
Vector3 get_closest_point_to_segment(const Vector3 &p_point, const Vector3 &p_a, const Vector3 &p_b);
|
||||
Vector3 get_closest_point_to_segment_uncapped(const Vector3 &p_point, const Vector3 &p_a, const Vector3 &p_b);
|
||||
Variant ray_intersects_triangle(const Vector3 &p_from, const Vector3 &p_dir, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2);
|
||||
Variant segment_intersects_triangle(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2);
|
||||
|
||||
Vector<Vector3> segment_intersects_sphere(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_sphere_pos, real_t p_sphere_radius);
|
||||
Vector<Vector3> segment_intersects_cylinder(const Vector3 &p_from, const Vector3 &p_to, float p_height, float p_radius);
|
||||
Vector<Vector3> segment_intersects_convex(const Vector3 &p_from, const Vector3 &p_to, const TypedArray<Plane> &p_planes);
|
||||
|
||||
Vector<Vector3> clip_polygon(const Vector<Vector3> &p_points, const Plane &p_plane);
|
||||
|
||||
Geometry3D() { singleton = this; }
|
||||
};
|
||||
|
||||
class Marshalls : public Object {
|
||||
GDCLASS(Marshalls, Object);
|
||||
|
||||
static Marshalls *singleton;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
static Marshalls *get_singleton();
|
||||
|
||||
String variant_to_base64(const Variant &p_var, bool p_full_objects = false);
|
||||
Variant base64_to_variant(const String &p_str, bool p_allow_objects = false);
|
||||
|
||||
String raw_to_base64(const Vector<uint8_t> &p_arr);
|
||||
Vector<uint8_t> base64_to_raw(const String &p_str);
|
||||
|
||||
String utf8_to_base64(const String &p_str);
|
||||
String base64_to_utf8(const String &p_str);
|
||||
|
||||
Marshalls() { singleton = this; }
|
||||
~Marshalls() { singleton = nullptr; }
|
||||
};
|
||||
|
||||
class Mutex : public RefCounted {
|
||||
GDCLASS(Mutex, RefCounted);
|
||||
::Mutex mutex;
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
void lock();
|
||||
bool try_lock();
|
||||
void unlock();
|
||||
};
|
||||
|
||||
class Semaphore : public RefCounted {
|
||||
GDCLASS(Semaphore, RefCounted);
|
||||
::Semaphore semaphore;
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
void wait();
|
||||
bool try_wait();
|
||||
void post();
|
||||
};
|
||||
|
||||
class Thread : public RefCounted {
|
||||
GDCLASS(Thread, RefCounted);
|
||||
|
||||
protected:
|
||||
Variant ret;
|
||||
SafeFlag running;
|
||||
Callable target_callable;
|
||||
::Thread thread;
|
||||
static void _bind_methods();
|
||||
static void _start_func(void *ud);
|
||||
|
||||
public:
|
||||
enum Priority {
|
||||
PRIORITY_LOW,
|
||||
PRIORITY_NORMAL,
|
||||
PRIORITY_HIGH,
|
||||
PRIORITY_MAX
|
||||
};
|
||||
|
||||
Error start(const Callable &p_callable, Priority p_priority = PRIORITY_NORMAL);
|
||||
String get_id() const;
|
||||
bool is_started() const;
|
||||
bool is_alive() const;
|
||||
Variant wait_to_finish();
|
||||
|
||||
static void set_thread_safety_checks_enabled(bool p_enabled);
|
||||
};
|
||||
|
||||
namespace special {
|
||||
|
||||
class ClassDB : public Object {
|
||||
GDCLASS(ClassDB, Object);
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
PackedStringArray get_class_list() const;
|
||||
PackedStringArray get_inheriters_from_class(const StringName &p_class) const;
|
||||
StringName get_parent_class(const StringName &p_class) const;
|
||||
bool class_exists(const StringName &p_class) const;
|
||||
bool is_parent_class(const StringName &p_class, const StringName &p_inherits) const;
|
||||
bool can_instantiate(const StringName &p_class) const;
|
||||
Variant instantiate(const StringName &p_class) const;
|
||||
|
||||
bool class_has_signal(StringName p_class, StringName p_signal) const;
|
||||
Dictionary class_get_signal(StringName p_class, StringName p_signal) const;
|
||||
TypedArray<Dictionary> class_get_signal_list(StringName p_class, bool p_no_inheritance = false) const;
|
||||
|
||||
TypedArray<Dictionary> class_get_property_list(StringName p_class, bool p_no_inheritance = false) const;
|
||||
Variant class_get_property(Object *p_object, const StringName &p_property) const;
|
||||
Error class_set_property(Object *p_object, const StringName &p_property, const Variant &p_value) const;
|
||||
|
||||
bool class_has_method(StringName p_class, StringName p_method, bool p_no_inheritance = false) const;
|
||||
|
||||
TypedArray<Dictionary> class_get_method_list(StringName p_class, bool p_no_inheritance = false) const;
|
||||
|
||||
PackedStringArray class_get_integer_constant_list(const StringName &p_class, bool p_no_inheritance = false) const;
|
||||
bool class_has_integer_constant(const StringName &p_class, const StringName &p_name) const;
|
||||
int64_t class_get_integer_constant(const StringName &p_class, const StringName &p_name) const;
|
||||
|
||||
bool class_has_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance = false) const;
|
||||
PackedStringArray class_get_enum_list(const StringName &p_class, bool p_no_inheritance = false) const;
|
||||
PackedStringArray class_get_enum_constants(const StringName &p_class, const StringName &p_enum, bool p_no_inheritance = false) const;
|
||||
StringName class_get_integer_constant_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance = false) const;
|
||||
|
||||
bool is_class_enabled(StringName p_class) const;
|
||||
|
||||
ClassDB() {}
|
||||
~ClassDB() {}
|
||||
};
|
||||
|
||||
} // namespace special
|
||||
|
||||
class Engine : public Object {
|
||||
GDCLASS(Engine, Object);
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
static Engine *singleton;
|
||||
|
||||
public:
|
||||
static Engine *get_singleton() { return singleton; }
|
||||
void set_physics_ticks_per_second(int p_ips);
|
||||
int get_physics_ticks_per_second() const;
|
||||
|
||||
void set_max_physics_steps_per_frame(int p_max_physics_steps);
|
||||
int get_max_physics_steps_per_frame() const;
|
||||
|
||||
void set_physics_jitter_fix(double p_threshold);
|
||||
double get_physics_jitter_fix() const;
|
||||
double get_physics_interpolation_fraction() const;
|
||||
|
||||
void set_max_fps(int p_fps);
|
||||
int get_max_fps() const;
|
||||
|
||||
double get_frames_per_second() const;
|
||||
uint64_t get_physics_frames() const;
|
||||
uint64_t get_process_frames() const;
|
||||
|
||||
int get_frames_drawn();
|
||||
|
||||
void set_time_scale(double p_scale);
|
||||
double get_time_scale();
|
||||
|
||||
MainLoop *get_main_loop() const;
|
||||
|
||||
Dictionary get_version_info() const;
|
||||
Dictionary get_author_info() const;
|
||||
TypedArray<Dictionary> get_copyright_info() const;
|
||||
Dictionary get_donor_info() const;
|
||||
Dictionary get_license_info() const;
|
||||
String get_license_text() const;
|
||||
|
||||
String get_architecture_name() const;
|
||||
|
||||
bool is_in_physics_frame() const;
|
||||
|
||||
bool has_singleton(const StringName &p_name) const;
|
||||
Object *get_singleton_object(const StringName &p_name) const;
|
||||
void register_singleton(const StringName &p_name, Object *p_object);
|
||||
void unregister_singleton(const StringName &p_name);
|
||||
Vector<String> get_singleton_list() const;
|
||||
|
||||
Error register_script_language(ScriptLanguage *p_language);
|
||||
Error unregister_script_language(const ScriptLanguage *p_language);
|
||||
int get_script_language_count();
|
||||
ScriptLanguage *get_script_language(int p_index) const;
|
||||
|
||||
void set_editor_hint(bool p_enabled);
|
||||
bool is_editor_hint() const;
|
||||
|
||||
// `set_write_movie_path()` is not exposed to the scripting API as changing it at run-time has no effect.
|
||||
String get_write_movie_path() const;
|
||||
|
||||
void set_print_error_messages(bool p_enabled);
|
||||
bool is_printing_error_messages() const;
|
||||
|
||||
Engine() { singleton = this; }
|
||||
};
|
||||
|
||||
class EngineDebugger : public Object {
|
||||
GDCLASS(EngineDebugger, Object);
|
||||
|
||||
HashMap<StringName, Callable> captures;
|
||||
HashMap<StringName, Ref<EngineProfiler>> profilers;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
static EngineDebugger *singleton;
|
||||
|
||||
public:
|
||||
static EngineDebugger *get_singleton() { return singleton; }
|
||||
|
||||
bool is_active();
|
||||
|
||||
void register_profiler(const StringName &p_name, Ref<EngineProfiler> p_profiler);
|
||||
void unregister_profiler(const StringName &p_name);
|
||||
bool is_profiling(const StringName &p_name);
|
||||
bool has_profiler(const StringName &p_name);
|
||||
void profiler_add_frame_data(const StringName &p_name, const Array &p_data);
|
||||
void profiler_enable(const StringName &p_name, bool p_enabled, const Array &p_opts = Array());
|
||||
|
||||
void register_message_capture(const StringName &p_name, const Callable &p_callable);
|
||||
void unregister_message_capture(const StringName &p_name);
|
||||
bool has_capture(const StringName &p_name);
|
||||
|
||||
void send_message(const String &p_msg, const Array &p_data);
|
||||
|
||||
static Error call_capture(void *p_user, const String &p_cmd, const Array &p_data, bool &r_captured);
|
||||
|
||||
EngineDebugger() { singleton = this; }
|
||||
~EngineDebugger();
|
||||
};
|
||||
|
||||
} // namespace core_bind
|
||||
|
||||
VARIANT_ENUM_CAST(core_bind::ResourceLoader::ThreadLoadStatus);
|
||||
VARIANT_ENUM_CAST(core_bind::ResourceLoader::CacheMode);
|
||||
|
||||
VARIANT_BITFIELD_CAST(core_bind::ResourceSaver::SaverFlags);
|
||||
|
||||
VARIANT_ENUM_CAST(core_bind::OS::RenderingDriver);
|
||||
VARIANT_ENUM_CAST(core_bind::OS::SystemDir);
|
||||
|
||||
VARIANT_ENUM_CAST(core_bind::Geometry2D::PolyBooleanOperation);
|
||||
VARIANT_ENUM_CAST(core_bind::Geometry2D::PolyJoinType);
|
||||
VARIANT_ENUM_CAST(core_bind::Geometry2D::PolyEndType);
|
||||
|
||||
VARIANT_ENUM_CAST(core_bind::Thread::Priority);
|
||||
|
||||
#endif // CORE_BIND_H
|
||||
@ -1,337 +0,0 @@
|
||||
"""Functions used to generate source files during build time
|
||||
|
||||
All such functions are invoked in a subprocess on Windows to prevent build flakiness.
|
||||
"""
|
||||
import zlib
|
||||
|
||||
from platform_methods import subprocess_main
|
||||
|
||||
|
||||
def escape_string(s):
|
||||
def charcode_to_c_escapes(c):
|
||||
rev_result = []
|
||||
while c >= 256:
|
||||
c, low = (c // 256, c % 256)
|
||||
rev_result.append("\\%03o" % low)
|
||||
rev_result.append("\\%03o" % c)
|
||||
return "".join(reversed(rev_result))
|
||||
|
||||
result = ""
|
||||
if isinstance(s, str):
|
||||
s = s.encode("utf-8")
|
||||
for c in s:
|
||||
if not (32 <= c < 127) or c in (ord("\\"), ord('"')):
|
||||
result += charcode_to_c_escapes(c)
|
||||
else:
|
||||
result += chr(c)
|
||||
return result
|
||||
|
||||
|
||||
def make_certs_header(target, source, env):
|
||||
src = source[0]
|
||||
dst = target[0]
|
||||
f = open(src, "rb")
|
||||
g = open(dst, "w", encoding="utf-8")
|
||||
buf = f.read()
|
||||
decomp_size = len(buf)
|
||||
|
||||
# Use maximum zlib compression level to further reduce file size
|
||||
# (at the cost of initial build times).
|
||||
buf = zlib.compress(buf, zlib.Z_BEST_COMPRESSION)
|
||||
|
||||
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
|
||||
g.write("#ifndef CERTS_COMPRESSED_GEN_H\n")
|
||||
g.write("#define CERTS_COMPRESSED_GEN_H\n")
|
||||
|
||||
# System certs path. Editor will use them if defined. (for package maintainers)
|
||||
path = env["system_certs_path"]
|
||||
g.write('#define _SYSTEM_CERTS_PATH "%s"\n' % str(path))
|
||||
if env["builtin_certs"]:
|
||||
# Defined here and not in env so changing it does not trigger a full rebuild.
|
||||
g.write("#define BUILTIN_CERTS_ENABLED\n")
|
||||
g.write("static const int _certs_compressed_size = " + str(len(buf)) + ";\n")
|
||||
g.write("static const int _certs_uncompressed_size = " + str(decomp_size) + ";\n")
|
||||
g.write("static const unsigned char _certs_compressed[] = {\n")
|
||||
for i in range(len(buf)):
|
||||
g.write("\t" + str(buf[i]) + ",\n")
|
||||
g.write("};\n")
|
||||
g.write("#endif // CERTS_COMPRESSED_GEN_H")
|
||||
|
||||
g.close()
|
||||
f.close()
|
||||
|
||||
|
||||
def make_authors_header(target, source, env):
|
||||
sections = [
|
||||
"Project Founders",
|
||||
"Lead Developer",
|
||||
"Project Manager",
|
||||
"Developers",
|
||||
]
|
||||
sections_id = [
|
||||
"AUTHORS_FOUNDERS",
|
||||
"AUTHORS_LEAD_DEVELOPERS",
|
||||
"AUTHORS_PROJECT_MANAGERS",
|
||||
"AUTHORS_DEVELOPERS",
|
||||
]
|
||||
|
||||
src = source[0]
|
||||
dst = target[0]
|
||||
f = open(src, "r", encoding="utf-8")
|
||||
g = open(dst, "w", encoding="utf-8")
|
||||
|
||||
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
|
||||
g.write("#ifndef AUTHORS_GEN_H\n")
|
||||
g.write("#define AUTHORS_GEN_H\n")
|
||||
|
||||
reading = False
|
||||
|
||||
def close_section():
|
||||
g.write("\t0\n")
|
||||
g.write("};\n")
|
||||
|
||||
for line in f:
|
||||
if reading:
|
||||
if line.startswith(" "):
|
||||
g.write('\t"' + escape_string(line.strip()) + '",\n')
|
||||
continue
|
||||
if line.startswith("## "):
|
||||
if reading:
|
||||
close_section()
|
||||
reading = False
|
||||
for section, section_id in zip(sections, sections_id):
|
||||
if line.strip().endswith(section):
|
||||
current_section = escape_string(section_id)
|
||||
reading = True
|
||||
g.write("const char *const " + current_section + "[] = {\n")
|
||||
break
|
||||
|
||||
if reading:
|
||||
close_section()
|
||||
|
||||
g.write("#endif // AUTHORS_GEN_H\n")
|
||||
|
||||
g.close()
|
||||
f.close()
|
||||
|
||||
|
||||
def make_donors_header(target, source, env):
|
||||
sections = [
|
||||
"Platinum sponsors",
|
||||
"Gold sponsors",
|
||||
"Silver sponsors",
|
||||
"Bronze sponsors",
|
||||
"Mini sponsors",
|
||||
"Gold donors",
|
||||
"Silver donors",
|
||||
"Bronze donors",
|
||||
]
|
||||
sections_id = [
|
||||
"DONORS_SPONSOR_PLATINUM",
|
||||
"DONORS_SPONSOR_GOLD",
|
||||
"DONORS_SPONSOR_SILVER",
|
||||
"DONORS_SPONSOR_BRONZE",
|
||||
"DONORS_SPONSOR_MINI",
|
||||
"DONORS_GOLD",
|
||||
"DONORS_SILVER",
|
||||
"DONORS_BRONZE",
|
||||
]
|
||||
|
||||
src = source[0]
|
||||
dst = target[0]
|
||||
f = open(src, "r", encoding="utf-8")
|
||||
g = open(dst, "w", encoding="utf-8")
|
||||
|
||||
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
|
||||
g.write("#ifndef DONORS_GEN_H\n")
|
||||
g.write("#define DONORS_GEN_H\n")
|
||||
|
||||
reading = False
|
||||
|
||||
def close_section():
|
||||
g.write("\t0\n")
|
||||
g.write("};\n")
|
||||
|
||||
for line in f:
|
||||
if reading >= 0:
|
||||
if line.startswith(" "):
|
||||
g.write('\t"' + escape_string(line.strip()) + '",\n')
|
||||
continue
|
||||
if line.startswith("## "):
|
||||
if reading:
|
||||
close_section()
|
||||
reading = False
|
||||
for section, section_id in zip(sections, sections_id):
|
||||
if line.strip().endswith(section):
|
||||
current_section = escape_string(section_id)
|
||||
reading = True
|
||||
g.write("const char *const " + current_section + "[] = {\n")
|
||||
break
|
||||
|
||||
if reading:
|
||||
close_section()
|
||||
|
||||
g.write("#endif // DONORS_GEN_H\n")
|
||||
|
||||
g.close()
|
||||
f.close()
|
||||
|
||||
|
||||
def make_license_header(target, source, env):
|
||||
src_copyright = source[0]
|
||||
src_license = source[1]
|
||||
dst = target[0]
|
||||
|
||||
class LicenseReader:
|
||||
def __init__(self, license_file):
|
||||
self._license_file = license_file
|
||||
self.line_num = 0
|
||||
self.current = self.next_line()
|
||||
|
||||
def next_line(self):
|
||||
line = self._license_file.readline()
|
||||
self.line_num += 1
|
||||
while line.startswith("#"):
|
||||
line = self._license_file.readline()
|
||||
self.line_num += 1
|
||||
self.current = line
|
||||
return line
|
||||
|
||||
def next_tag(self):
|
||||
if not ":" in self.current:
|
||||
return ("", [])
|
||||
tag, line = self.current.split(":", 1)
|
||||
lines = [line.strip()]
|
||||
while self.next_line() and self.current.startswith(" "):
|
||||
lines.append(self.current.strip())
|
||||
return (tag, lines)
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
projects: dict = OrderedDict()
|
||||
license_list = []
|
||||
|
||||
with open(src_copyright, "r", encoding="utf-8") as copyright_file:
|
||||
reader = LicenseReader(copyright_file)
|
||||
part = {}
|
||||
while reader.current:
|
||||
tag, content = reader.next_tag()
|
||||
if tag in ("Files", "Copyright", "License"):
|
||||
part[tag] = content[:]
|
||||
elif tag == "Comment":
|
||||
# attach part to named project
|
||||
projects[content[0]] = projects.get(content[0], []) + [part]
|
||||
|
||||
if not tag or not reader.current:
|
||||
# end of a paragraph start a new part
|
||||
if "License" in part and not "Files" in part:
|
||||
# no Files tag in this one, so assume standalone license
|
||||
license_list.append(part["License"])
|
||||
part = {}
|
||||
reader.next_line()
|
||||
|
||||
data_list: list = []
|
||||
for project in iter(projects.values()):
|
||||
for part in project:
|
||||
part["file_index"] = len(data_list)
|
||||
data_list += part["Files"]
|
||||
part["copyright_index"] = len(data_list)
|
||||
data_list += part["Copyright"]
|
||||
|
||||
with open(dst, "w", encoding="utf-8") as f:
|
||||
f.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
|
||||
f.write("#ifndef LICENSE_GEN_H\n")
|
||||
f.write("#define LICENSE_GEN_H\n")
|
||||
f.write("const char *const GODOT_LICENSE_TEXT =")
|
||||
|
||||
with open(src_license, "r", encoding="utf-8") as license_file:
|
||||
for line in license_file:
|
||||
escaped_string = escape_string(line.strip())
|
||||
f.write('\n\t\t"' + escaped_string + '\\n"')
|
||||
f.write(";\n\n")
|
||||
|
||||
f.write(
|
||||
"struct ComponentCopyrightPart {\n"
|
||||
"\tconst char *license;\n"
|
||||
"\tconst char *const *files;\n"
|
||||
"\tconst char *const *copyright_statements;\n"
|
||||
"\tint file_count;\n"
|
||||
"\tint copyright_count;\n"
|
||||
"};\n\n"
|
||||
)
|
||||
|
||||
f.write(
|
||||
"struct ComponentCopyright {\n"
|
||||
"\tconst char *name;\n"
|
||||
"\tconst ComponentCopyrightPart *parts;\n"
|
||||
"\tint part_count;\n"
|
||||
"};\n\n"
|
||||
)
|
||||
|
||||
f.write("const char *const COPYRIGHT_INFO_DATA[] = {\n")
|
||||
for line in data_list:
|
||||
f.write('\t"' + escape_string(line) + '",\n')
|
||||
f.write("};\n\n")
|
||||
|
||||
f.write("const ComponentCopyrightPart COPYRIGHT_PROJECT_PARTS[] = {\n")
|
||||
part_index = 0
|
||||
part_indexes = {}
|
||||
for project_name, project in iter(projects.items()):
|
||||
part_indexes[project_name] = part_index
|
||||
for part in project:
|
||||
f.write(
|
||||
'\t{ "'
|
||||
+ escape_string(part["License"][0])
|
||||
+ '", '
|
||||
+ "©RIGHT_INFO_DATA["
|
||||
+ str(part["file_index"])
|
||||
+ "], "
|
||||
+ "©RIGHT_INFO_DATA["
|
||||
+ str(part["copyright_index"])
|
||||
+ "], "
|
||||
+ str(len(part["Files"]))
|
||||
+ ", "
|
||||
+ str(len(part["Copyright"]))
|
||||
+ " },\n"
|
||||
)
|
||||
part_index += 1
|
||||
f.write("};\n\n")
|
||||
|
||||
f.write("const int COPYRIGHT_INFO_COUNT = " + str(len(projects)) + ";\n")
|
||||
|
||||
f.write("const ComponentCopyright COPYRIGHT_INFO[] = {\n")
|
||||
for project_name, project in iter(projects.items()):
|
||||
f.write(
|
||||
'\t{ "'
|
||||
+ escape_string(project_name)
|
||||
+ '", '
|
||||
+ "©RIGHT_PROJECT_PARTS["
|
||||
+ str(part_indexes[project_name])
|
||||
+ "], "
|
||||
+ str(len(project))
|
||||
+ " },\n"
|
||||
)
|
||||
f.write("};\n\n")
|
||||
|
||||
f.write("const int LICENSE_COUNT = " + str(len(license_list)) + ";\n")
|
||||
|
||||
f.write("const char *const LICENSE_NAMES[] = {\n")
|
||||
for l in license_list:
|
||||
f.write('\t"' + escape_string(l[0]) + '",\n')
|
||||
f.write("};\n\n")
|
||||
|
||||
f.write("const char *const LICENSE_BODIES[] = {\n\n")
|
||||
for l in license_list:
|
||||
for line in l[1:]:
|
||||
if line == ".":
|
||||
f.write('\t"\\n"\n')
|
||||
else:
|
||||
f.write('\t"' + escape_string(line) + '\\n"\n')
|
||||
f.write('\t"",\n\n')
|
||||
f.write("};\n\n")
|
||||
|
||||
f.write("#endif // LICENSE_GEN_H\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
subprocess_main(globals())
|
||||
@ -1,852 +0,0 @@
|
||||
/**************************************************************************/
|
||||
/* core_constants.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "core_constants.h"
|
||||
|
||||
#include "core/input/input_event.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "core/templates/hash_set.h"
|
||||
#include "core/variant/variant.h"
|
||||
|
||||
struct _CoreConstant {
|
||||
#ifdef DEBUG_METHODS_ENABLED
|
||||
bool ignore_value_in_docs = false;
|
||||
bool is_bitfield = false;
|
||||
#endif
|
||||
StringName enum_name;
|
||||
const char *name = nullptr;
|
||||
int64_t value = 0;
|
||||
|
||||
_CoreConstant() {}
|
||||
|
||||
#ifdef DEBUG_METHODS_ENABLED
|
||||
_CoreConstant(const StringName &p_enum_name, const char *p_name, int64_t p_value, bool p_ignore_value_in_docs = false, bool p_is_bitfield = false) :
|
||||
ignore_value_in_docs(p_ignore_value_in_docs),
|
||||
is_bitfield(p_is_bitfield),
|
||||
enum_name(p_enum_name),
|
||||
name(p_name),
|
||||
value(p_value) {
|
||||
}
|
||||
#else
|
||||
_CoreConstant(const StringName &p_enum_name, const char *p_name, int64_t p_value) :
|
||||
enum_name(p_enum_name),
|
||||
name(p_name),
|
||||
value(p_value) {
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static Vector<_CoreConstant> _global_constants;
|
||||
static HashMap<StringName, int> _global_constants_map;
|
||||
static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
|
||||
|
||||
#ifdef DEBUG_METHODS_ENABLED
|
||||
|
||||
#define BIND_CORE_CONSTANT(m_constant) \
|
||||
_global_constants.push_back(_CoreConstant(StringName(), #m_constant, m_constant)); \
|
||||
_global_constants_map[#m_constant] = _global_constants.size() - 1;
|
||||
|
||||
#define BIND_CORE_ENUM_CONSTANT(m_constant) \
|
||||
{ \
|
||||
StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \
|
||||
_global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \
|
||||
_global_constants_map[#m_constant] = _global_constants.size() - 1; \
|
||||
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
|
||||
}
|
||||
|
||||
#define BIND_CORE_BITFIELD_FLAG(m_constant) \
|
||||
{ \
|
||||
StringName enum_name = __constant_get_bitfield_name(m_constant, #m_constant); \
|
||||
_global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant, false, true)); \
|
||||
_global_constants_map[#m_constant] = _global_constants.size() - 1; \
|
||||
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
|
||||
}
|
||||
|
||||
// This just binds enum classes as if they were regular enum constants.
|
||||
#define BIND_CORE_ENUM_CLASS_CONSTANT(m_enum, m_prefix, m_member) \
|
||||
{ \
|
||||
StringName enum_name = __constant_get_enum_name(m_enum::m_member, #m_prefix "_" #m_member); \
|
||||
_global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member)); \
|
||||
_global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \
|
||||
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
|
||||
}
|
||||
|
||||
#define BIND_CORE_BITFIELD_CLASS_FLAG(m_enum, m_prefix, m_member) \
|
||||
{ \
|
||||
StringName enum_name = __constant_get_bitfield_name(m_enum::m_member, #m_prefix "_" #m_member); \
|
||||
_global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member, false, true)); \
|
||||
_global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \
|
||||
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
|
||||
}
|
||||
|
||||
#define BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(m_enum, m_name, m_member) \
|
||||
{ \
|
||||
StringName enum_name = __constant_get_enum_name(m_enum::m_member, #m_name); \
|
||||
_global_constants.push_back(_CoreConstant(enum_name, #m_name, (int64_t)m_enum::m_member)); \
|
||||
_global_constants_map[#m_name] = _global_constants.size() - 1; \
|
||||
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
|
||||
}
|
||||
|
||||
#define BIND_CORE_BITFIELD_CLASS_FLAG_CUSTOM(m_enum, m_name, m_member) \
|
||||
{ \
|
||||
StringName enum_name = __constant_get_bitfield_name(m_enum::m_member, #m_name); \
|
||||
_global_constants.push_back(_CoreConstant(enum_name, #m_name, (int64_t)m_enum::m_member, false, true)); \
|
||||
_global_constants_map[#m_name] = _global_constants.size() - 1; \
|
||||
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
|
||||
}
|
||||
|
||||
#define BIND_CORE_ENUM_CLASS_CONSTANT_NO_VAL(m_enum, m_prefix, m_member) \
|
||||
{ \
|
||||
StringName enum_name = __constant_get_enum_name(m_enum::m_member, #m_prefix "_" #m_member); \
|
||||
_global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member, true)); \
|
||||
_global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \
|
||||
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
|
||||
}
|
||||
|
||||
#define BIND_CORE_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \
|
||||
{ \
|
||||
StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \
|
||||
_global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant)); \
|
||||
_global_constants_map[m_custom_name] = _global_constants.size() - 1; \
|
||||
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
|
||||
}
|
||||
|
||||
#define BIND_CORE_CONSTANT_NO_VAL(m_constant) \
|
||||
_global_constants.push_back(_CoreConstant(StringName(), #m_constant, m_constant, true)); \
|
||||
_global_constants_map[#m_constant] = _global_constants.size() - 1;
|
||||
|
||||
#define BIND_CORE_ENUM_CONSTANT_NO_VAL(m_constant) \
|
||||
{ \
|
||||
StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \
|
||||
_global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant, true)); \
|
||||
_global_constants_map[#m_constant] = _global_constants.size() - 1; \
|
||||
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
|
||||
}
|
||||
|
||||
#define BIND_CORE_ENUM_CONSTANT_CUSTOM_NO_VAL(m_custom_name, m_constant) \
|
||||
{ \
|
||||
StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \
|
||||
_global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant, true)); \
|
||||
_global_constants_map[m_custom_name] = _global_constants.size() - 1; \
|
||||
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define BIND_CORE_CONSTANT(m_constant) \
|
||||
_global_constants.push_back(_CoreConstant(StringName(), #m_constant, m_constant)); \
|
||||
_global_constants_map[#m_constant] = _global_constants.size() - 1;
|
||||
|
||||
#define BIND_CORE_ENUM_CONSTANT(m_constant) \
|
||||
{ \
|
||||
StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \
|
||||
_global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \
|
||||
_global_constants_map[#m_constant] = _global_constants.size() - 1; \
|
||||
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
|
||||
}
|
||||
|
||||
#define BIND_CORE_BITFIELD_FLAG(m_constant) \
|
||||
{ \
|
||||
StringName enum_name = __constant_get_bitfield_name(m_constant, #m_constant); \
|
||||
_global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \
|
||||
_global_constants_map[#m_constant] = _global_constants.size() - 1; \
|
||||
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
|
||||
}
|
||||
|
||||
// This just binds enum classes as if they were regular enum constants.
|
||||
#define BIND_CORE_ENUM_CLASS_CONSTANT(m_enum, m_prefix, m_member) \
|
||||
{ \
|
||||
StringName enum_name = __constant_get_enum_name(m_enum::m_member, #m_prefix "_" #m_member); \
|
||||
_global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member)); \
|
||||
_global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \
|
||||
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
|
||||
}
|
||||
|
||||
#define BIND_CORE_BITFIELD_CLASS_FLAG(m_enum, m_prefix, m_member) \
|
||||
{ \
|
||||
StringName enum_name = __constant_get_bitfield_name(m_enum::m_member, #m_prefix "_" #m_member); \
|
||||
_global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member)); \
|
||||
_global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \
|
||||
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
|
||||
}
|
||||
|
||||
#define BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(m_enum, m_name, m_member) \
|
||||
{ \
|
||||
StringName enum_name = __constant_get_enum_name(m_enum::m_member, #m_name); \
|
||||
_global_constants.push_back(_CoreConstant(enum_name, #m_name, (int64_t)m_enum::m_member)); \
|
||||
_global_constants_map[#m_name] = _global_constants.size() - 1; \
|
||||
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
|
||||
}
|
||||
|
||||
#define BIND_CORE_BITFIELD_CLASS_FLAG_CUSTOM(m_enum, m_name, m_member) \
|
||||
{ \
|
||||
StringName enum_name = __constant_get_bitfield_name(m_enum::m_member, #m_name); \
|
||||
_global_constants.push_back(_CoreConstant(enum_name, #m_name, (int64_t)m_enum::m_member)); \
|
||||
_global_constants_map[#m_name] = _global_constants.size() - 1; \
|
||||
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
|
||||
}
|
||||
|
||||
#define BIND_CORE_ENUM_CLASS_CONSTANT_NO_VAL(m_enum, m_prefix, m_member) \
|
||||
{ \
|
||||
StringName enum_name = __constant_get_enum_name(m_enum::m_member, #m_prefix "_" #m_member); \
|
||||
_global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member)); \
|
||||
_global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \
|
||||
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
|
||||
}
|
||||
|
||||
#define BIND_CORE_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \
|
||||
{ \
|
||||
StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \
|
||||
_global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant)); \
|
||||
_global_constants_map[m_custom_name] = _global_constants.size() - 1; \
|
||||
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
|
||||
}
|
||||
|
||||
#define BIND_CORE_CONSTANT_NO_VAL(m_constant) \
|
||||
_global_constants.push_back(_CoreConstant(StringName(), #m_constant, m_constant)); \
|
||||
_global_constants_map[#m_constant] = _global_constants.size() - 1;
|
||||
|
||||
#define BIND_CORE_ENUM_CONSTANT_NO_VAL(m_constant) \
|
||||
{ \
|
||||
StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \
|
||||
_global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \
|
||||
_global_constants_map[#m_constant] = _global_constants.size() - 1; \
|
||||
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
|
||||
}
|
||||
|
||||
#define BIND_CORE_ENUM_CONSTANT_CUSTOM_NO_VAL(m_custom_name, m_constant) \
|
||||
{ \
|
||||
StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \
|
||||
_global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant)); \
|
||||
_global_constants_map[m_custom_name] = _global_constants.size() - 1; \
|
||||
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void register_global_constants() {
|
||||
BIND_CORE_ENUM_CONSTANT(SIDE_LEFT);
|
||||
BIND_CORE_ENUM_CONSTANT(SIDE_TOP);
|
||||
BIND_CORE_ENUM_CONSTANT(SIDE_RIGHT);
|
||||
BIND_CORE_ENUM_CONSTANT(SIDE_BOTTOM);
|
||||
|
||||
BIND_CORE_ENUM_CONSTANT(CORNER_TOP_LEFT);
|
||||
BIND_CORE_ENUM_CONSTANT(CORNER_TOP_RIGHT);
|
||||
BIND_CORE_ENUM_CONSTANT(CORNER_BOTTOM_RIGHT);
|
||||
BIND_CORE_ENUM_CONSTANT(CORNER_BOTTOM_LEFT);
|
||||
|
||||
BIND_CORE_ENUM_CONSTANT(VERTICAL);
|
||||
BIND_CORE_ENUM_CONSTANT(HORIZONTAL);
|
||||
|
||||
BIND_CORE_ENUM_CONSTANT(CLOCKWISE);
|
||||
BIND_CORE_ENUM_CONSTANT(COUNTERCLOCKWISE);
|
||||
|
||||
BIND_CORE_ENUM_CONSTANT(HORIZONTAL_ALIGNMENT_LEFT);
|
||||
BIND_CORE_ENUM_CONSTANT(HORIZONTAL_ALIGNMENT_CENTER);
|
||||
BIND_CORE_ENUM_CONSTANT(HORIZONTAL_ALIGNMENT_RIGHT);
|
||||
BIND_CORE_ENUM_CONSTANT(HORIZONTAL_ALIGNMENT_FILL);
|
||||
|
||||
BIND_CORE_ENUM_CONSTANT(VERTICAL_ALIGNMENT_TOP);
|
||||
BIND_CORE_ENUM_CONSTANT(VERTICAL_ALIGNMENT_CENTER);
|
||||
BIND_CORE_ENUM_CONSTANT(VERTICAL_ALIGNMENT_BOTTOM);
|
||||
BIND_CORE_ENUM_CONSTANT(VERTICAL_ALIGNMENT_FILL);
|
||||
|
||||
BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_TOP_TO);
|
||||
BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_CENTER_TO);
|
||||
BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_BASELINE_TO);
|
||||
BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_BOTTOM_TO);
|
||||
|
||||
BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_TO_TOP);
|
||||
BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_TO_CENTER);
|
||||
BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_TO_BASELINE);
|
||||
BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_TO_BOTTOM);
|
||||
|
||||
BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_TOP);
|
||||
BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_CENTER);
|
||||
BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_BOTTOM);
|
||||
|
||||
BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_IMAGE_MASK);
|
||||
BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_TEXT_MASK);
|
||||
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(EulerOrder, EULER_ORDER, XYZ);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(EulerOrder, EULER_ORDER, XZY);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(EulerOrder, EULER_ORDER, YXZ);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(EulerOrder, EULER_ORDER, YZX);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(EulerOrder, EULER_ORDER, ZXY);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(EulerOrder, EULER_ORDER, ZYX);
|
||||
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, NONE);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SPECIAL);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ESCAPE);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, TAB);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BACKTAB);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BACKSPACE);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ENTER);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_ENTER);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, INSERT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_DELETE, KEY_DELETE);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PAUSE);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PRINT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SYSREQ);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, CLEAR);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, HOME);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, END);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LEFT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, UP);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, RIGHT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, DOWN);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PAGEUP);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PAGEDOWN);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SHIFT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, CTRL);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, META);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ALT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, CAPSLOCK);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, NUMLOCK);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SCROLLLOCK);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F1);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F2);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F3);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F4);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F5);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F6);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F7);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F8);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F9);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F10);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F11);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F12);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F13);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F14);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F15);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F16);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F17);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F18);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F19);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F20);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F21);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F22);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F23);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F24);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F25);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F26);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F27);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F28);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F29);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F30);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F31);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F32);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F33);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F34);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F35);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_MULTIPLY);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_DIVIDE);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_SUBTRACT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_PERIOD);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_ADD);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_0);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_1);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_2);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_3);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_4);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_5);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_6);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_7);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_8);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_9);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MENU);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, HYPER);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, HELP);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BACK);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, FORWARD);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, STOP);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, REFRESH);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, VOLUMEDOWN);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, VOLUMEMUTE);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, VOLUMEUP);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MEDIAPLAY);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MEDIASTOP);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MEDIAPREVIOUS);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MEDIANEXT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MEDIARECORD);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, HOMEPAGE);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, FAVORITES);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SEARCH);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, STANDBY);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, OPENURL);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHMAIL);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHMEDIA);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH0);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH1);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH2);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH3);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH4);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH5);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH6);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH7);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH8);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH9);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHA);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHB);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHC);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHD);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHE);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHF);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, GLOBE);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KEYBOARD);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, JIS_EISU);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, JIS_KANA);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, UNKNOWN);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SPACE);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, EXCLAM);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, QUOTEDBL);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, NUMBERSIGN);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, DOLLAR);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PERCENT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, AMPERSAND);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, APOSTROPHE);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PARENLEFT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PARENRIGHT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ASTERISK);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PLUS);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, COMMA);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MINUS);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PERIOD);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SLASH);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_0, KEY_0);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_1, KEY_1);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_2, KEY_2);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_3, KEY_3);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_4, KEY_4);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_5, KEY_5);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_6, KEY_6);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_7, KEY_7);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_8, KEY_8);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_9, KEY_9);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, COLON);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SEMICOLON);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LESS);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, EQUAL);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, GREATER);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, QUESTION);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, AT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, A);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, B);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, C);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, D);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, E);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, G);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, H);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, I);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, J);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, K);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, L);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, M);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, N);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, O);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, P);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, Q);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, R);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, S);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, T);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, U);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, V);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, W);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, X);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, Y);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, Z);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BRACKETLEFT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BACKSLASH);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BRACKETRIGHT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ASCIICIRCUM);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, UNDERSCORE);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, QUOTELEFT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BRACELEFT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BAR);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BRACERIGHT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ASCIITILDE);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, YEN);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SECTION);
|
||||
|
||||
BIND_CORE_BITFIELD_CLASS_FLAG_CUSTOM(KeyModifierMask, KEY_CODE_MASK, CODE_MASK);
|
||||
BIND_CORE_BITFIELD_CLASS_FLAG_CUSTOM(KeyModifierMask, KEY_MODIFIER_MASK, MODIFIER_MASK);
|
||||
BIND_CORE_BITFIELD_CLASS_FLAG(KeyModifierMask, KEY_MASK, CMD_OR_CTRL);
|
||||
BIND_CORE_BITFIELD_CLASS_FLAG(KeyModifierMask, KEY_MASK, SHIFT);
|
||||
BIND_CORE_BITFIELD_CLASS_FLAG(KeyModifierMask, KEY_MASK, ALT);
|
||||
BIND_CORE_BITFIELD_CLASS_FLAG(KeyModifierMask, KEY_MASK, META);
|
||||
BIND_CORE_BITFIELD_CLASS_FLAG(KeyModifierMask, KEY_MASK, CTRL);
|
||||
BIND_CORE_BITFIELD_CLASS_FLAG(KeyModifierMask, KEY_MASK, KPAD);
|
||||
BIND_CORE_BITFIELD_CLASS_FLAG(KeyModifierMask, KEY_MASK, GROUP_SWITCH);
|
||||
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, NONE);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, LEFT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, RIGHT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, MIDDLE);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, WHEEL_UP);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, WHEEL_DOWN);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, WHEEL_LEFT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, WHEEL_RIGHT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(MouseButton, MOUSE_BUTTON_XBUTTON1, MB_XBUTTON1);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(MouseButton, MOUSE_BUTTON_XBUTTON2, MB_XBUTTON2);
|
||||
|
||||
BIND_CORE_BITFIELD_CLASS_FLAG(MouseButtonMask, MOUSE_BUTTON_MASK, LEFT);
|
||||
BIND_CORE_BITFIELD_CLASS_FLAG(MouseButtonMask, MOUSE_BUTTON_MASK, RIGHT);
|
||||
BIND_CORE_BITFIELD_CLASS_FLAG(MouseButtonMask, MOUSE_BUTTON_MASK, MIDDLE);
|
||||
BIND_CORE_BITFIELD_CLASS_FLAG(MouseButtonMask, MOUSE_BUTTON_MASK, MB_XBUTTON1);
|
||||
BIND_CORE_BITFIELD_CLASS_FLAG(MouseButtonMask, MOUSE_BUTTON_MASK, MB_XBUTTON2);
|
||||
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, INVALID);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, A);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, B);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, X);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, Y);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, BACK);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, GUIDE);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, START);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, LEFT_STICK);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, RIGHT_STICK);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, LEFT_SHOULDER);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, RIGHT_SHOULDER);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, DPAD_UP);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, DPAD_DOWN);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, DPAD_LEFT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, DPAD_RIGHT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, MISC1);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, PADDLE1);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, PADDLE2);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, PADDLE3);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, PADDLE4);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, TOUCHPAD);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, SDL_MAX);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, MAX);
|
||||
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, INVALID);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, LEFT_X);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, LEFT_Y);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, RIGHT_X);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, RIGHT_Y);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, TRIGGER_LEFT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, TRIGGER_RIGHT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, SDL_MAX);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, MAX);
|
||||
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, NONE);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, NOTE_OFF);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, NOTE_ON);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, AFTERTOUCH);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, CONTROL_CHANGE);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, PROGRAM_CHANGE);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, CHANNEL_PRESSURE);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, PITCH_BEND);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, SYSTEM_EXCLUSIVE);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, QUARTER_FRAME);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, SONG_POSITION_POINTER);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, SONG_SELECT);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, TUNE_REQUEST);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, TIMING_CLOCK);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, START);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, CONTINUE);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, STOP);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, ACTIVE_SENSING);
|
||||
BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, SYSTEM_RESET);
|
||||
|
||||
// error list
|
||||
|
||||
BIND_CORE_ENUM_CONSTANT(OK); // (0)
|
||||
BIND_CORE_ENUM_CONSTANT(FAILED);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_UNAVAILABLE);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_UNCONFIGURED);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_UNAUTHORIZED);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_PARAMETER_RANGE_ERROR); // (5)
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_OUT_OF_MEMORY);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_FILE_NOT_FOUND);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_FILE_BAD_DRIVE);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_FILE_BAD_PATH);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_FILE_NO_PERMISSION); // (10)
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_FILE_ALREADY_IN_USE);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_FILE_CANT_OPEN);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_FILE_CANT_WRITE);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_FILE_CANT_READ);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_FILE_UNRECOGNIZED); // (15)
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_FILE_CORRUPT);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_FILE_MISSING_DEPENDENCIES);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_FILE_EOF);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_CANT_OPEN);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_CANT_CREATE); // (20)
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_QUERY_FAILED);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_ALREADY_IN_USE);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_LOCKED);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_TIMEOUT);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_CANT_CONNECT); // (25)
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_CANT_RESOLVE);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_CONNECTION_ERROR);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_CANT_ACQUIRE_RESOURCE);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_CANT_FORK);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_INVALID_DATA); // (30)
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_INVALID_PARAMETER);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_ALREADY_EXISTS);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_DOES_NOT_EXIST);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_DATABASE_CANT_READ);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_DATABASE_CANT_WRITE); // (35)
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_COMPILATION_FAILED);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_METHOD_NOT_FOUND);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_LINK_FAILED);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_SCRIPT_FAILED);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_CYCLIC_LINK); // (40)
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_INVALID_DECLARATION);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_DUPLICATE_SYMBOL);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_PARSE_ERROR);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_BUSY);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_SKIP); // (45)
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_HELP);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_BUG);
|
||||
BIND_CORE_ENUM_CONSTANT(ERR_PRINTER_ON_FIRE);
|
||||
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_NONE);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_RANGE);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_ENUM);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_ENUM_SUGGESTION);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_EXP_EASING);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LINK);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_FLAGS);
|
||||
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_2D_RENDER);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_2D_PHYSICS);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_2D_NAVIGATION);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_3D_RENDER);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_3D_PHYSICS);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_3D_NAVIGATION);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_AVOIDANCE);
|
||||
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_FILE);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_DIR);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_GLOBAL_FILE);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_GLOBAL_DIR);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_RESOURCE_TYPE);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_MULTILINE_TEXT);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_EXPRESSION);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_PLACEHOLDER_TEXT);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_COLOR_NO_ALPHA);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_OBJECT_ID);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_TYPE_STRING);
|
||||
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_OBJECT_TOO_BIG);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_NODE_PATH_VALID_TYPES);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_SAVE_FILE);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_GLOBAL_SAVE_FILE);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_INT_IS_OBJECTID);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_INT_IS_POINTER);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_ARRAY_TYPE);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LOCALE_ID);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LOCALIZABLE_STRING);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_NODE_TYPE);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_HIDE_QUATERNION_EDIT);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_PASSWORD);
|
||||
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_MAX);
|
||||
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_NONE);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_STORAGE);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_EDITOR);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_INTERNAL);
|
||||
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_CHECKABLE);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_CHECKED);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_GROUP);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_CATEGORY);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_SUBGROUP);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_CLASS_IS_BITFIELD);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_NO_INSTANCE_STATE);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_RESTART_IF_CHANGED);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_SCRIPT_VARIABLE);
|
||||
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_STORE_IF_NULL);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_CLASS_IS_ENUM);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_NIL_IS_VARIANT);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_ARRAY);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_ALWAYS_DUPLICATE);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_NEVER_DUPLICATE);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_HIGH_END_GFX);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_KEYING_INCREMENTS);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_DEFERRED_SET_RESOURCE);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_EDITOR_BASIC_SETTING);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_READ_ONLY);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_SECRET);
|
||||
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_DEFAULT);
|
||||
BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_NO_EDITOR);
|
||||
|
||||
BIND_CORE_BITFIELD_FLAG(METHOD_FLAG_NORMAL);
|
||||
BIND_CORE_BITFIELD_FLAG(METHOD_FLAG_EDITOR);
|
||||
BIND_CORE_BITFIELD_FLAG(METHOD_FLAG_CONST);
|
||||
BIND_CORE_BITFIELD_FLAG(METHOD_FLAG_VIRTUAL);
|
||||
BIND_CORE_BITFIELD_FLAG(METHOD_FLAG_VARARG);
|
||||
BIND_CORE_BITFIELD_FLAG(METHOD_FLAG_STATIC);
|
||||
BIND_CORE_BITFIELD_FLAG(METHOD_FLAG_OBJECT_CORE);
|
||||
BIND_CORE_BITFIELD_FLAG(METHOD_FLAGS_DEFAULT);
|
||||
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_NIL", Variant::NIL);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_BOOL", Variant::BOOL);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_INT", Variant::INT);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_FLOAT", Variant::FLOAT);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_STRING", Variant::STRING);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2", Variant::VECTOR2);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2I", Variant::VECTOR2I);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_RECT2", Variant::RECT2);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_RECT2I", Variant::RECT2I);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3", Variant::VECTOR3);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3I", Variant::VECTOR3I);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_TRANSFORM2D", Variant::TRANSFORM2D);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR4", Variant::VECTOR4);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR4I", Variant::VECTOR4I);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PLANE", Variant::PLANE);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_QUATERNION", Variant::QUATERNION);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_AABB", Variant::AABB);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_BASIS", Variant::BASIS);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_TRANSFORM3D", Variant::TRANSFORM3D);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PROJECTION", Variant::PROJECTION);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_COLOR", Variant::COLOR);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_STRING_NAME", Variant::STRING_NAME);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_NODE_PATH", Variant::NODE_PATH);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_RID", Variant::RID);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_OBJECT", Variant::OBJECT);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_CALLABLE", Variant::CALLABLE);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_SIGNAL", Variant::SIGNAL);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_DICTIONARY", Variant::DICTIONARY);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_ARRAY", Variant::ARRAY);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PACKED_BYTE_ARRAY", Variant::PACKED_BYTE_ARRAY);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PACKED_INT32_ARRAY", Variant::PACKED_INT32_ARRAY);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PACKED_INT64_ARRAY", Variant::PACKED_INT64_ARRAY);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PACKED_FLOAT32_ARRAY", Variant::PACKED_FLOAT32_ARRAY);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PACKED_FLOAT64_ARRAY", Variant::PACKED_FLOAT64_ARRAY);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PACKED_STRING_ARRAY", Variant::PACKED_STRING_ARRAY);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PACKED_VECTOR2_ARRAY", Variant::PACKED_VECTOR2_ARRAY);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PACKED_VECTOR3_ARRAY", Variant::PACKED_VECTOR3_ARRAY);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PACKED_COLOR_ARRAY", Variant::PACKED_COLOR_ARRAY);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_MAX", Variant::VARIANT_MAX);
|
||||
|
||||
//comparison
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_EQUAL", Variant::OP_EQUAL);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_NOT_EQUAL", Variant::OP_NOT_EQUAL);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_LESS", Variant::OP_LESS);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_LESS_EQUAL", Variant::OP_LESS_EQUAL);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_GREATER", Variant::OP_GREATER);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_GREATER_EQUAL", Variant::OP_GREATER_EQUAL);
|
||||
//mathematic
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_ADD", Variant::OP_ADD);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_SUBTRACT", Variant::OP_SUBTRACT);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_MULTIPLY", Variant::OP_MULTIPLY);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_DIVIDE", Variant::OP_DIVIDE);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_NEGATE", Variant::OP_NEGATE);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_POSITIVE", Variant::OP_POSITIVE);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_MODULE", Variant::OP_MODULE);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_POWER", Variant::OP_POWER);
|
||||
//bitwise
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_SHIFT_LEFT", Variant::OP_SHIFT_LEFT);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_SHIFT_RIGHT", Variant::OP_SHIFT_RIGHT);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_BIT_AND", Variant::OP_BIT_AND);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_BIT_OR", Variant::OP_BIT_OR);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_BIT_XOR", Variant::OP_BIT_XOR);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_BIT_NEGATE", Variant::OP_BIT_NEGATE);
|
||||
//logic
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_AND", Variant::OP_AND);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_OR", Variant::OP_OR);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_XOR", Variant::OP_XOR);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_NOT", Variant::OP_NOT);
|
||||
//containment
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_IN", Variant::OP_IN);
|
||||
BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_MAX", Variant::OP_MAX);
|
||||
}
|
||||
|
||||
void unregister_global_constants() {
|
||||
_global_constants.clear();
|
||||
}
|
||||
|
||||
int CoreConstants::get_global_constant_count() {
|
||||
return _global_constants.size();
|
||||
}
|
||||
|
||||
StringName CoreConstants::get_global_constant_enum(int p_idx) {
|
||||
return _global_constants[p_idx].enum_name;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_METHODS_ENABLED
|
||||
bool CoreConstants::is_global_constant_bitfield(int p_idx) {
|
||||
return _global_constants[p_idx].is_bitfield;
|
||||
}
|
||||
|
||||
bool CoreConstants::get_ignore_value_in_docs(int p_idx) {
|
||||
return _global_constants[p_idx].ignore_value_in_docs;
|
||||
}
|
||||
#else
|
||||
bool CoreConstants::is_global_constant_bitfield(int p_idx) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CoreConstants::get_ignore_value_in_docs(int p_idx) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
const char *CoreConstants::get_global_constant_name(int p_idx) {
|
||||
return _global_constants[p_idx].name;
|
||||
}
|
||||
|
||||
int64_t CoreConstants::get_global_constant_value(int p_idx) {
|
||||
return _global_constants[p_idx].value;
|
||||
}
|
||||
|
||||
bool CoreConstants::is_global_constant(const StringName &p_name) {
|
||||
return _global_constants_map.has(p_name);
|
||||
}
|
||||
|
||||
int CoreConstants::get_global_constant_index(const StringName &p_name) {
|
||||
ERR_FAIL_COND_V_MSG(!_global_constants_map.has(p_name), -1, "Trying to get index of non-existing constant.");
|
||||
return _global_constants_map[p_name];
|
||||
}
|
||||
|
||||
bool CoreConstants::is_global_enum(const StringName &p_enum) {
|
||||
return _global_enums.has(p_enum);
|
||||
}
|
||||
|
||||
void CoreConstants::get_enum_values(StringName p_enum, HashMap<StringName, int64_t> *p_values) {
|
||||
ERR_FAIL_NULL_MSG(p_values, "Trying to get enum values with null map.");
|
||||
ERR_FAIL_COND_MSG(!_global_enums.has(p_enum), "Trying to get values of non-existing enum.");
|
||||
for (const _CoreConstant &constant : _global_enums[p_enum]) {
|
||||
(*p_values)[constant.name] = constant.value;
|
||||
}
|
||||
}
|
||||
@ -1,51 +0,0 @@
|
||||
/**************************************************************************/
|
||||
/* core_constants.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef CORE_CONSTANTS_H
|
||||
#define CORE_CONSTANTS_H
|
||||
|
||||
#include "core/string/string_name.h"
|
||||
#include "core/templates/hash_set.h"
|
||||
|
||||
class CoreConstants {
|
||||
public:
|
||||
static int get_global_constant_count();
|
||||
static StringName get_global_constant_enum(int p_idx);
|
||||
static bool is_global_constant_bitfield(int p_idx);
|
||||
static bool get_ignore_value_in_docs(int p_idx);
|
||||
static const char *get_global_constant_name(int p_idx);
|
||||
static int64_t get_global_constant_value(int p_idx);
|
||||
static bool is_global_constant(const StringName &p_name);
|
||||
static int get_global_constant_index(const StringName &p_name);
|
||||
static bool is_global_enum(const StringName &p_enum);
|
||||
static void get_enum_values(StringName p_enum, HashMap<StringName, int64_t> *p_values);
|
||||
};
|
||||
|
||||
#endif // CORE_CONSTANTS_H
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user