Compare commits
	
		
			No commits in common. "NewGame" and "master" have entirely different histories.
		
	
	
		
							
								
								
									
										108
									
								
								.clang-format
								
								
								
								
							
							
						
						|  | @ -1,108 +0,0 @@ | ||||||
| # Clang-format version v9.0.0 |  | ||||||
| --- |  | ||||||
| Language: Cpp |  | ||||||
| BasedOnStyle: Google |  | ||||||
| 
 |  | ||||||
| ColumnLimit: 120 |  | ||||||
| 
 |  | ||||||
| ## |  | ||||||
| ## Indent Style |  | ||||||
| ## |  | ||||||
| 
 |  | ||||||
| IndentWidth: 4 |  | ||||||
| AccessModifierOffset: -4 |  | ||||||
| ConstructorInitializerIndentWidth: 4 |  | ||||||
| ContinuationIndentWidth: 4 |  | ||||||
| TabWidth: 4 |  | ||||||
| UseTab: Never |  | ||||||
| IndentCaseLabels: false |  | ||||||
| NamespaceIndentation: None |  | ||||||
| 
 |  | ||||||
| ## |  | ||||||
| ## Align Style |  | ||||||
| ## |  | ||||||
| 
 |  | ||||||
| AlignAfterOpenBracket: Align |  | ||||||
| AlignConsecutiveAssignments: true |  | ||||||
| AlignConsecutiveDeclarations: true |  | ||||||
| AlignEscapedNewlinesLeft: true |  | ||||||
| AlignOperands: true |  | ||||||
| AlignTrailingComments: true |  | ||||||
| PointerAlignment: Left |  | ||||||
| 
 |  | ||||||
| ## |  | ||||||
| ## SingleLine Style |  | ||||||
| ## |  | ||||||
| 
 |  | ||||||
| AllowAllParametersOfDeclarationOnNextLine: true |  | ||||||
| AllowShortBlocksOnASingleLine: false |  | ||||||
| AllowShortCaseLabelsOnASingleLine: false |  | ||||||
| AllowShortFunctionsOnASingleLine: Empty |  | ||||||
| AllowShortIfStatementsOnASingleLine: false |  | ||||||
| AllowShortLoopsOnASingleLine: false |  | ||||||
| AlwaysBreakAfterDefinitionReturnType: None |  | ||||||
| AlwaysBreakAfterReturnType: None |  | ||||||
| AlwaysBreakBeforeMultilineStrings: false |  | ||||||
| AlwaysBreakTemplateDeclarations: true |  | ||||||
| BinPackArguments: true |  | ||||||
| BinPackParameters: true |  | ||||||
| BreakBeforeBraces: Allman |  | ||||||
| BraceWrapping: |  | ||||||
|   AfterClass: true |  | ||||||
|   AfterControlStatement: true |  | ||||||
|   AfterEnum: true |  | ||||||
|   AfterFunction: true |  | ||||||
|   AfterNamespace: true |  | ||||||
|   AfterObjCDeclaration: true |  | ||||||
|   AfterStruct: true |  | ||||||
|   AfterUnion: true |  | ||||||
|   BeforeCatch: true |  | ||||||
|   BeforeElse: true |  | ||||||
|   IndentBraces: true |  | ||||||
| BreakBeforeBinaryOperators: NonAssignment |  | ||||||
| BreakBeforeTernaryOperators: true |  | ||||||
| CommentPragmas: "^ IWYU pragma:" |  | ||||||
| ConstructorInitializerAllOnOneLineOrOnePerLine: false |  | ||||||
| 
 |  | ||||||
| ## |  | ||||||
| ## Others |  | ||||||
| ## |  | ||||||
| 
 |  | ||||||
| BreakConstructorInitializers: BeforeComma |  | ||||||
| BreakInheritanceList: BeforeComma |  | ||||||
| ReflowComments: true |  | ||||||
| SortIncludes: false |  | ||||||
| Cpp11BracedListStyle: false |  | ||||||
| DerivePointerAlignment: false |  | ||||||
| DisableFormat: false |  | ||||||
| ExperimentalAutoDetectBinPacking: false |  | ||||||
| ForEachMacros: [foreach, Q_FOREACH, BOOST_FOREACH] |  | ||||||
| IncludeCategories: |  | ||||||
|   - Regex: '^"(llvm|llvm-c|clang|clang-c)/' |  | ||||||
|     Priority: 2 |  | ||||||
|   - Regex: '^(<|"(gtest|isl|json)/)' |  | ||||||
|     Priority: 3 |  | ||||||
|   - Regex: ".*" |  | ||||||
|     Priority: 1 |  | ||||||
| IndentWrappedFunctionNames: false |  | ||||||
| KeepEmptyLinesAtTheStartOfBlocks: true |  | ||||||
| MacroBlockBegin: "" |  | ||||||
| MacroBlockEnd: "" |  | ||||||
| MaxEmptyLinesToKeep: 1 |  | ||||||
| PenaltyBreakBeforeFirstCallParameter: 19 |  | ||||||
| PenaltyBreakComment: 300 |  | ||||||
| PenaltyBreakFirstLessLess: 120 |  | ||||||
| PenaltyBreakString: 1000 |  | ||||||
| PenaltyExcessCharacter: 1000000 |  | ||||||
| PenaltyReturnTypeOnItsOwnLine: 60 |  | ||||||
| SpaceAfterCStyleCast: false |  | ||||||
| SpaceBeforeAssignmentOperators: true |  | ||||||
| SpaceBeforeParens: ControlStatements |  | ||||||
| SpaceInEmptyParentheses: false |  | ||||||
| SpacesBeforeTrailingComments: 2 |  | ||||||
| SpacesInAngles: false |  | ||||||
| SpacesInContainerLiterals: true |  | ||||||
| SpacesInCStyleCastParentheses: false |  | ||||||
| SpacesInParentheses: false |  | ||||||
| SpacesInSquareBrackets: false |  | ||||||
| Standard: Cpp11 |  | ||||||
|  | @ -1,23 +0,0 @@ | ||||||
| # EditorConfig is awesome: https://EditorConfig.org |  | ||||||
| 
 |  | ||||||
| # top-most EditorConfig file |  | ||||||
| root = true |  | ||||||
| 
 |  | ||||||
| # Unix-style newlines with a newline ending every file |  | ||||||
| [*] |  | ||||||
| end_of_line = crlf |  | ||||||
| insert_final_newline = true |  | ||||||
| 
 |  | ||||||
| # Matches multiple files with brace expansion notation |  | ||||||
| # Set default charset |  | ||||||
| [*.{h,hpp,cpp}] |  | ||||||
| charset = gb2312 |  | ||||||
| 
 |  | ||||||
| # 4 space indentation |  | ||||||
| indent_style = space |  | ||||||
| indent_size = 4 |  | ||||||
| 
 |  | ||||||
| # Matches the exact files |  | ||||||
| [*.{json,xml}] |  | ||||||
| indent_style = space |  | ||||||
| indent_size = 2 |  | ||||||
|  | @ -1,26 +0,0 @@ | ||||||
| --- |  | ||||||
| name: Bug report |  | ||||||
| about: 创建一个 Bug 报告,请选择这个模版 |  | ||||||
| 
 |  | ||||||
| --- |  | ||||||
| 
 |  | ||||||
| ### 编译环境 |  | ||||||
| 
 |  | ||||||
| - Kiwano 版本号: |  | ||||||
| - 操作系统: |  | ||||||
| - 编译器: |  | ||||||
| 
 |  | ||||||
| ### 复现步骤 |  | ||||||
| 
 |  | ||||||
| (告诉我们如何才能复现这个 BUG) |  | ||||||
| 
 |  | ||||||
| 1. 步骤一 |  | ||||||
| 2. 步骤二 |  | ||||||
| 
 |  | ||||||
| ### 预期现象 |  | ||||||
| 
 |  | ||||||
| 描述一下你认为正常情况下应该发生什么现象 |  | ||||||
| 
 |  | ||||||
| ### 实际现象 |  | ||||||
| 
 |  | ||||||
| 描述一下你运行代码时实际发生的现象 |  | ||||||
|  | @ -1,13 +0,0 @@ | ||||||
| --- |  | ||||||
| name: Confused |  | ||||||
| about: 使用 Kiwano 时有任何疑问,请选择这个模版 |  | ||||||
| 
 |  | ||||||
| --- |  | ||||||
| 
 |  | ||||||
| ### 简述 |  | ||||||
| 
 |  | ||||||
| 用一两句话描述你的疑惑 |  | ||||||
| 
 |  | ||||||
| ### 环境 |  | ||||||
| 
 |  | ||||||
| 留下你使用的 Kiwano 版本号,以及系统、编译器等信息 |  | ||||||
|  | @ -1,9 +0,0 @@ | ||||||
| --- |  | ||||||
| name: Feature request |  | ||||||
| about: 想要提出一个优化建议,请选择这个模版 |  | ||||||
| 
 |  | ||||||
| --- |  | ||||||
| 
 |  | ||||||
| ### 需求描述 |  | ||||||
| 
 |  | ||||||
| 描述你认为需要进行优化的地方 |  | ||||||
|  | @ -1,28 +0,0 @@ | ||||||
| name: deploy to aliyun oss |  | ||||||
| 
 |  | ||||||
| on: |  | ||||||
|   push: |  | ||||||
|     branches: [ main, master ] |  | ||||||
| 
 |  | ||||||
| jobs: |  | ||||||
|   build: |  | ||||||
|     runs-on: ubuntu-latest |  | ||||||
|     steps: |  | ||||||
|     - uses: actions/checkout@v1 |  | ||||||
|     - name: setup node |  | ||||||
|       uses: actions/setup-node@v1 |  | ||||||
|       with: |  | ||||||
|         node-version: 16 |  | ||||||
| 
 |  | ||||||
|     - name: build |  | ||||||
|       uses: mattnotmitt/doxygen-action@v1.9.4 |  | ||||||
| 
 |  | ||||||
|     - name: setup aliyun oss |  | ||||||
|       uses: manyuanrong/setup-ossutil@master |  | ||||||
|       with: |  | ||||||
|         endpoint: oss-cn-chengdu.aliyuncs.com |  | ||||||
|         access-key-id: ${{ secrets.OSS_KEY_ID }} |  | ||||||
|         access-key-secret: ${{ secrets.OSS_KEY_SECRET }} |  | ||||||
| 
 |  | ||||||
|     - name: upload files |  | ||||||
|       run: ossutil cp -rf ./docs/html oss://kiwano-docs-website/ |  | ||||||
|  | @ -1,41 +1,12 @@ | ||||||
| # Build folders | .vs/ | ||||||
| build/ |  | ||||||
| output/ |  | ||||||
| 
 |  | ||||||
| x64/ | x64/ | ||||||
| Debug/ | *.recipe | ||||||
| Release/ | *.tlog | ||||||
| 
 | *.vcxproj | ||||||
| # CMake folders | *.sln | ||||||
| /cmake-build-release/ | *.log | ||||||
| /cmake-build-debug/ | *.filters | ||||||
| 
 |  | ||||||
| # Application folders |  | ||||||
| .vs |  | ||||||
| .idea |  | ||||||
| ._Kiwano.sln |  | ||||||
| .vscode |  | ||||||
| 
 |  | ||||||
| # vs2010 |  | ||||||
| ipch/ |  | ||||||
| *.opensdf |  | ||||||
| *.sdf |  | ||||||
| *.suo |  | ||||||
| 
 |  | ||||||
| *.user | *.user | ||||||
| *.lnk | *.config | ||||||
| 
 | m_packages/ | ||||||
| # NuGet packages |  | ||||||
| packages/ | packages/ | ||||||
| 
 |  | ||||||
| !*.dll |  | ||||||
| !*.lib |  | ||||||
| 
 |  | ||||||
| # Resources bin |  | ||||||
| *.aps |  | ||||||
| 
 |  | ||||||
| # Mac cache files |  | ||||||
| .DS_Store |  | ||||||
| 
 |  | ||||||
| # Documents |  | ||||||
| docs/ |  | ||||||
|  |  | ||||||
|  | @ -1,26 +0,0 @@ | ||||||
| cmake_minimum_required(VERSION 3.16) |  | ||||||
| project(Kiwano C CXX) |  | ||||||
| 
 |  | ||||||
| set(CMAKE_CXX_STANDARD 17) |  | ||||||
| 
 |  | ||||||
| if (WIN32) |  | ||||||
|     message(STATUS "Building on Windows platform.") |  | ||||||
| elseif (APPLE) |  | ||||||
|     message(STATUS "Building on MacOS platform.") |  | ||||||
|     add_compile_definitions(TARGET_OS_MAC) |  | ||||||
| elseif (UNIX) |  | ||||||
|     message(STATUS "Building on UNIX-like OS platform.") |  | ||||||
| endif () |  | ||||||
| 
 |  | ||||||
| include_directories(src/3rd-party) |  | ||||||
| include_directories(src) |  | ||||||
| 
 |  | ||||||
| add_subdirectory(src/kiwano) |  | ||||||
| add_subdirectory(src/kiwano-audio) |  | ||||||
| add_subdirectory(src/kiwano-imgui) |  | ||||||
| add_subdirectory(src/kiwano-network) |  | ||||||
| add_subdirectory(src/kiwano-physics) |  | ||||||
| add_subdirectory(src/3rd-party/Box2D) |  | ||||||
| add_subdirectory(src/3rd-party/curl) |  | ||||||
| add_subdirectory(src/3rd-party/nlohmann) |  | ||||||
| add_subdirectory(src/3rd-party/pugixml) |  | ||||||
							
								
								
									
										94
									
								
								Doxyfile
								
								
								
								
							
							
						
						|  | @ -1,94 +0,0 @@ | ||||||
| # Doxyfile 1.8.16 |  | ||||||
| 
 |  | ||||||
| #--------------------------------------------------------------------------- |  | ||||||
| # Project related configuration options |  | ||||||
| #--------------------------------------------------------------------------- |  | ||||||
| 
 |  | ||||||
| PROJECT_NAME           = "Kiwano Engine" |  | ||||||
| PROJECT_NUMBER         = v1.2.x |  | ||||||
| PROJECT_BRIEF          = |  | ||||||
| PROJECT_LOGO           = logo/logo_tiny.png |  | ||||||
| 
 |  | ||||||
| DOXYFILE_ENCODING      = UTF-8 |  | ||||||
| CREATE_SUBDIRS         = YES |  | ||||||
| 
 |  | ||||||
| OUTPUT_LANGUAGE        = Chinese |  | ||||||
| OUTPUT_DIRECTORY       = docs/ |  | ||||||
| 
 |  | ||||||
| EXTRACT_PRIVATE        = NO |  | ||||||
| EXTRACT_STATIC         = YES |  | ||||||
| EXTRACT_LOCAL_CLASSES  = NO |  | ||||||
| 
 |  | ||||||
| HIDE_UNDOC_MEMBERS     = NO |  | ||||||
| HIDE_UNDOC_CLASSES     = NO |  | ||||||
| 
 |  | ||||||
| SHOW_INCLUDE_FILES     = YES |  | ||||||
| SHOW_USED_FILES        = NO |  | ||||||
| SHOW_FILES             = NO |  | ||||||
| SHOW_NAMESPACES        = YES |  | ||||||
| 
 |  | ||||||
| #--------------------------------------------------------------------------- |  | ||||||
| # Configuration options related to the input files |  | ||||||
| #--------------------------------------------------------------------------- |  | ||||||
| 
 |  | ||||||
| INPUT                  = src/ |  | ||||||
| INPUT_ENCODING         = GBK |  | ||||||
| FILE_PATTERNS          = *.c \ |  | ||||||
|                          *.cc \ |  | ||||||
|                          *.cxx \ |  | ||||||
|                          *.cpp \ |  | ||||||
|                          *.c++ \ |  | ||||||
|                          *.h \ |  | ||||||
|                          *.hh \ |  | ||||||
|                          *.hxx \ |  | ||||||
|                          *.hpp \ |  | ||||||
|                          *.h++ |  | ||||||
| 
 |  | ||||||
| RECURSIVE              = YES |  | ||||||
| EXCLUDE                = src/3rd-party \ |  | ||||||
|                          src/kiwano/platform/win32 \ |  | ||||||
|                          src/kiwano/renderer/win32 |  | ||||||
| 
 |  | ||||||
| #--------------------------------------------------------------------------- |  | ||||||
| # Configuration options related to the preprocessor |  | ||||||
| #--------------------------------------------------------------------------- |  | ||||||
| 
 |  | ||||||
| ENABLE_PREPROCESSING   = YES |  | ||||||
| MACRO_EXPANSION        = YES |  | ||||||
| PREDEFINED             = KGE_API= \ |  | ||||||
|                          KGE_DOXYGEN_DO_NOT_INCLUDE= \ |  | ||||||
|                          _Out_= \ |  | ||||||
|                          _In_= \ |  | ||||||
|                          _In_opt_=  |  | ||||||
| 
 |  | ||||||
| # The INCLUDE_PATH tag can be used to specify one or more directories that |  | ||||||
| # contain include files that are not input files but should be processed by the |  | ||||||
| # preprocessor. |  | ||||||
| # This tag requires that the tag SEARCH_INCLUDES is set to YES. |  | ||||||
| 
 |  | ||||||
| SEARCH_INCLUDES        = YES |  | ||||||
| INCLUDE_PATH           = |  | ||||||
| INCLUDE_FILE_PATTERNS  = |  | ||||||
| 
 |  | ||||||
| #--------------------------------------------------------------------------- |  | ||||||
| # Configuration options related to the HTML output |  | ||||||
| #--------------------------------------------------------------------------- |  | ||||||
| 
 |  | ||||||
| GENERATE_HTML          = YES |  | ||||||
| HTML_OUTPUT            = html |  | ||||||
| 
 |  | ||||||
| HTML_HEADER            = |  | ||||||
| HTML_FOOTER            = |  | ||||||
| HTML_STYLESHEET        = |  | ||||||
| HTML_EXTRA_STYLESHEET  = |  | ||||||
| HTML_EXTRA_FILES       = logo/favicon.ico |  | ||||||
| 
 |  | ||||||
| GENERATE_TREEVIEW      = YES |  | ||||||
| ENUM_VALUES_PER_LINE   = 4 |  | ||||||
| TREEVIEW_WIDTH         = 250 |  | ||||||
| 
 |  | ||||||
| #--------------------------------------------------------------------------- |  | ||||||
| # Configuration options related to the LATEX output |  | ||||||
| #--------------------------------------------------------------------------- |  | ||||||
| 
 |  | ||||||
| GENERATE_LATEX         = NO |  | ||||||
							
								
								
									
										21
									
								
								LICENSE
								
								
								
								
							
							
						
						|  | @ -1,21 +0,0 @@ | ||||||
| MIT License |  | ||||||
| 
 |  | ||||||
| Copyright (c) 2018 Haibo |  | ||||||
| 
 |  | ||||||
| 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. |  | ||||||
							
								
								
									
										66
									
								
								README-zh.md
								
								
								
								
							
							
						
						|  | @ -1,66 +0,0 @@ | ||||||
|  |  | ||||||
| 
 |  | ||||||
| # Kiwano 游戏引擎 |  | ||||||
| 
 |  | ||||||
| [](https://ci.appveyor.com/project/Nomango/kiwano/branch/master) |  | ||||||
| [](https://github.com/Nomango/Kiwano/releases/latest) |  | ||||||
| [](https://github.com/Nomango/Kiwano/blob/master/LICENSE) |  | ||||||
| 
 |  | ||||||
| [English](./README.md) | 简体中文 |  | ||||||
| 
 |  | ||||||
| ## 介绍 |  | ||||||
| 
 |  | ||||||
| Kiwano 是一个使用 C++ 开发的 2D 游戏引擎,目前仅支持 Windows 平台。 |  | ||||||
| 
 |  | ||||||
| Kiwano-Core 是一个提供了一系列实用工具的游戏无关库,它的目的是简化 C++ 开发过程。 |  | ||||||
| 
 |  | ||||||
| 这个仓库仍处于开发过程中,我创建这个仓库用来学习游戏引擎知识和开发自己的小游戏。 |  | ||||||
| 
 |  | ||||||
| 你可以到 [Kiwano Demos](https://github.com/kiwanogame/KiwanoDemos) 仓库查看和学习如何使用 Kiwano 引擎实现小游戏。 |  | ||||||
| 
 |  | ||||||
| 欢迎您任何形式的贡献。 |  | ||||||
| 
 |  | ||||||
| ## 功能 |  | ||||||
| 
 |  | ||||||
| * 舞台和角色管理 |  | ||||||
| * 舞台过渡动画 |  | ||||||
| * 动作行为 |  | ||||||
| * 按钮等简易UI元素 |  | ||||||
| * 音频支持 |  | ||||||
| * 网络通信支持 |  | ||||||
| * 数据持久化 |  | ||||||
| * 物理引擎 (基于 Box2D) |  | ||||||
| * GUI 引擎 (基于 ImGui) |  | ||||||
| 
 |  | ||||||
| ## 安装 |  | ||||||
| 
 |  | ||||||
| ### 开发环境 |  | ||||||
| 
 |  | ||||||
| - Win8 或更高 (推荐 Win10) |  | ||||||
| - Visual Studio 2015 或更高 |  | ||||||
| 
 |  | ||||||
| ### 通过 NuGet 安装 |  | ||||||
| 
 |  | ||||||
| 1. 打开你的 Visual Studio 解决方案 |  | ||||||
| 2. 在解决方案资源管理器, 右击 `引用` 并选择 `管理 NuGet 程序包` |  | ||||||
| 3. 选择 `浏览` 选项卡, 搜索 `kiwano`, 选中列表中的包然后点击 `安装` |  | ||||||
| 4. 开始使用 Kiwano 进行开发吧! |  | ||||||
| 
 |  | ||||||
| ### 通过源代码安装 |  | ||||||
| 
 |  | ||||||
| 1. 从 Github 仓库克隆或下载源代码 |  | ||||||
| 2. 打开你的 Visual Studio 解决方案, 在解决方案资源管理器中右键你的解决方案, 选择 `添加` => `现有项` |  | ||||||
| 3. 选中源代码目录下 /projects 文件夹中所有的 `.vcxproj` 文件,并确认添加 |  | ||||||
| 4. 右键你的项目,打开 `属性`, 选中 C\C++ => 常规, 并将源代码文件夹下的 src 目录添加到 `附加包含目录` 中 |  | ||||||
| 5. 右键你的项目 `引用` 并选择 `添加引用`, 选中 `kiwano` 项目和其他你需要的项目 |  | ||||||
| 6. 开始使用 Kiwano 进行开发吧! |  | ||||||
| 
 |  | ||||||
| ## 开发计划 |  | ||||||
| 
 |  | ||||||
| * 跨平台支持 |  | ||||||
| * 粒子系统 |  | ||||||
| 
 |  | ||||||
| ## 社交媒体 |  | ||||||
| 
 |  | ||||||
| * 网站: [kiwanoengine.com](https://kiwanoengine.com) |  | ||||||
| * QQ群: 608406540 |  | ||||||
							
								
								
									
										62
									
								
								README.md
								
								
								
								
							
							
						
						|  | @ -1,62 +0,0 @@ | ||||||
|  |  | ||||||
| 
 |  | ||||||
| # Kiwano Game Engine |  | ||||||
| 
 |  | ||||||
| [](https://ci.appveyor.com/project/Nomango/kiwano/branch/master) |  | ||||||
| [](https://github.com/Nomango/Kiwano/releases/latest) |  | ||||||
| [](https://github.com/Nomango/Kiwano/blob/master/LICENSE) |  | ||||||
| 
 |  | ||||||
| English | [简体中文](./README-zh.md) |  | ||||||
| 
 |  | ||||||
| ## Introduction |  | ||||||
| Kiwano is a open-source 2D C++ game engine, only support win32 platform. |  | ||||||
| 
 |  | ||||||
| Kiwano-Core is a game irrelevant lib that provide a lot useful tools can be used in other projects. I made a lot wheels to make cpp simpler to use. |  | ||||||
| 
 |  | ||||||
| It's still under heavy developing. I write it and use it to developy my own tiny games. |  | ||||||
| 
 |  | ||||||
| You can move to [Kiwano Demos](https://github.com/kiwanogame/KiwanoDemos) repository to see how to use Kiwano to implement simple games. |  | ||||||
| 
 |  | ||||||
| More docs and examples will be added later. |  | ||||||
| 
 |  | ||||||
| ## Features |  | ||||||
| * Scene management |  | ||||||
| * Transitions between scenes |  | ||||||
| * Action behaviours |  | ||||||
| * Buttons and menus |  | ||||||
| * Texture atlas support |  | ||||||
| * Audio support |  | ||||||
| * Custom data storage |  | ||||||
| * Physical engine (based on Box2D) |  | ||||||
| * GUI system (based on ImGui) |  | ||||||
| 
 |  | ||||||
| ## Install |  | ||||||
| 
 |  | ||||||
| ### Dev Environment |  | ||||||
| 
 |  | ||||||
| - Win8 or Greater (Win10 recommended) |  | ||||||
| - Visual Studio 2015 or Greater |  | ||||||
| 
 |  | ||||||
| ### Install with NuGet |  | ||||||
| 
 |  | ||||||
| 1. Open your Visual Studio solution |  | ||||||
| 2. In Solution Explorer, right-click `References` and choose `Manage NuGet Packages` |  | ||||||
| 3. Select the `Browse` tab, search for `kiwano`, select that package in the list, and select Install |  | ||||||
| 4. Have a good trip with Kiwano ! |  | ||||||
| 
 |  | ||||||
| ### Install with source code |  | ||||||
| 
 |  | ||||||
| 1. Clone or download source code from Github repository |  | ||||||
| 2. Open your Visual Studio solution, right-click your solution in Solution Explorer, select `Add` and then `Existing item` |  | ||||||
| 3. Select `.vcxproj` files in /projects folder which you downloaded in 1st step |  | ||||||
| 4. Right-click your project and choose `Properties`, select C\C++ => General, add the root directory of kiwano project to the `Additional include directory` field |  | ||||||
| 5. Right-click `References` and choose `Add Reference`, select `kiwano` project |  | ||||||
| 6. Now you can build your own applications based on Kiwano source code ! |  | ||||||
| 
 |  | ||||||
| ## Next plan |  | ||||||
| * Cross-platform |  | ||||||
| * Particle system |  | ||||||
| 
 |  | ||||||
| ## Contact |  | ||||||
| * Website: [kiwanoengine.com](https://kiwanoengine.com) |  | ||||||
| * QQ Group: 608406540 |  | ||||||
							
								
								
									
										135
									
								
								appveyor.yml
								
								
								
								
							
							
						
						|  | @ -1,135 +0,0 @@ | ||||||
| version: 1.2.{build} |  | ||||||
| 
 |  | ||||||
| skip_tags: true |  | ||||||
| 
 |  | ||||||
| # fetch repository as zip archive |  | ||||||
| shallow_clone: true |  | ||||||
| 
 |  | ||||||
| pull_requests: |  | ||||||
|   do_not_increment_build_number: true |  | ||||||
| 
 |  | ||||||
| # Do not build feature branch with open Pull Requests |  | ||||||
| # skip_branch_with_pr: true |  | ||||||
| 
 |  | ||||||
| # image: |  | ||||||
| # - Visual Studio 2019 |  | ||||||
| # - Visual Studio 2017 |  | ||||||
| # - Visual Studio 2015 |  | ||||||
| 
 |  | ||||||
| environment: |  | ||||||
|   global: |  | ||||||
|     time_out_mins: 5 |  | ||||||
|     flag_to_deploy: false |  | ||||||
|     appveyor_api_token: |  | ||||||
|       secure: UJFCbRNHMOqQg3e3Kv/ZnaIqqwXAt+5HDldetaZsZ5E= |  | ||||||
| 
 |  | ||||||
| matrix: |  | ||||||
|   fast_finish: true # set this flag to immediately finish build once one of the jobs fails |  | ||||||
|   # allow_failures: |  | ||||||
|   #   - platform: x86 |  | ||||||
|   #     configuration: Debug |  | ||||||
| 
 |  | ||||||
| skip_commits: |  | ||||||
|   message: /\[chore\]/ |  | ||||||
| 
 |  | ||||||
| only_commits: |  | ||||||
|   files: |  | ||||||
|     - projects/ |  | ||||||
|     - src/ |  | ||||||
|     - scripts/**/*.ps1 |  | ||||||
|     - appveyor.yml |  | ||||||
| 
 |  | ||||||
| for: |  | ||||||
| - |  | ||||||
|   branches: |  | ||||||
|     only: |  | ||||||
|       - master |  | ||||||
|   environment: |  | ||||||
|     matrix: |  | ||||||
|     - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 |  | ||||||
|     - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 |  | ||||||
|     - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 |  | ||||||
|     - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 |  | ||||||
|     global: |  | ||||||
|       job_to_deploy: 16 # 4(images) * 1(platform) * 4(configuration) |  | ||||||
| - |  | ||||||
|   branches: |  | ||||||
|     except: |  | ||||||
|       - master |  | ||||||
|   # only_commits: |  | ||||||
|   #   message: /\[build\]/ |  | ||||||
|   environment: |  | ||||||
|     matrix: |  | ||||||
|     # - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 |  | ||||||
|     # - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 |  | ||||||
|     # - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 |  | ||||||
|     - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 |  | ||||||
|     global: |  | ||||||
|       job_to_deploy: 4 # 1(images) * 1(platform) * 4(configuration) |  | ||||||
| 
 |  | ||||||
| configuration: |  | ||||||
| - Debug |  | ||||||
| - Release |  | ||||||
| 
 |  | ||||||
| platform: |  | ||||||
| - Win32 |  | ||||||
| - x64 |  | ||||||
| 
 |  | ||||||
| # cache: packages/ |  | ||||||
| 
 |  | ||||||
| install: |  | ||||||
| - ps: .\scripts\appveyor\install_coapp.ps1 |  | ||||||
| 
 |  | ||||||
| before_build: |  | ||||||
| - ps: .\scripts\appveyor\clear_project_configuration.ps1 |  | ||||||
| # - ps: nuget restore projects/Kiwano.sln |  | ||||||
| 
 |  | ||||||
| build: |  | ||||||
|   parallel: true |  | ||||||
|   project: projects/Kiwano.sln |  | ||||||
|   verbosity: minimal |  | ||||||
| 
 |  | ||||||
| after_build: |  | ||||||
| - ps: .\scripts\appveyor\wait_for_other_jobs.ps1 |  | ||||||
| 
 |  | ||||||
| artifacts: |  | ||||||
| - path: projects/output/**/*.lib |  | ||||||
|   name: PublishedLibraries |  | ||||||
| - path: projects/output/**/*.pdb |  | ||||||
|   name: PublishedSymbols |  | ||||||
| 
 |  | ||||||
| before_deploy: |  | ||||||
| - ps: .\scripts\appveyor\coapp_make.ps1 |  | ||||||
| 
 |  | ||||||
| deploy: |  | ||||||
| - provider: GitHub |  | ||||||
|   repository: KiwanoEngine/Kiwano |  | ||||||
|   tag: v$(APPVEYOR_BUILD_VERSION) |  | ||||||
|   release: v$(APPVEYOR_BUILD_VERSION) |  | ||||||
|   description: Kiwano-v$(APPVEYOR_BUILD_VERSION) releases. |  | ||||||
|   auth_token: |  | ||||||
|     secure: psAvqoc1T3UXtZpgmtYjof7kEKlLBdnWyM3BmAIj7bC9LJYtk89XqX+fPIOZpRZX |  | ||||||
|   artifact: /.*\.nupkg/ |  | ||||||
|   draft: true |  | ||||||
|   on: |  | ||||||
|     branch: master |  | ||||||
|     # APPVEYOR_REPO_TAG: true |  | ||||||
|     flag_to_deploy: true |  | ||||||
| 
 |  | ||||||
| - provider: NuGet |  | ||||||
|   api_key: |  | ||||||
|     secure: OG7anY4ofTg8aLWU+4a3GoyOzZ0K/iNtMzCd7XU4MKGJg/Q534gVXkT9PXoBdYVU |  | ||||||
|   # skip_symbols: true |  | ||||||
|   artifact: /.*\.nupkg/ |  | ||||||
|   on: |  | ||||||
|     branch: master |  | ||||||
|     # APPVEYOR_REPO_TAG: true |  | ||||||
|     flag_to_deploy: true |  | ||||||
| 
 |  | ||||||
| notifications: |  | ||||||
| - provider: Email |  | ||||||
|   to: |  | ||||||
|   - 569629550@qq.com |  | ||||||
|   on_build_success: true |  | ||||||
|   on_build_failure: true |  | ||||||
|   on_build_status_changed: false |  | ||||||
|  | @ -0,0 +1,116 @@ | ||||||
|  | #pragma once | ||||||
|  | #include <mutex> | ||||||
|  | #include <kiwano/core/Common.h> | ||||||
|  | #include <kiwano/base/Module.h> | ||||||
|  | #include "SquirrelClassEx.h" | ||||||
|  | #include "KiwanoEx/SpriteEx.hpp" | ||||||
|  | extern HSQUIRRELVM v; | ||||||
|  | extern std::mutex VmMtx; | ||||||
|  | extern WThreadPool threadPool; | ||||||
|  | 
 | ||||||
|  | namespace kiwano | ||||||
|  | { | ||||||
|  |     namespace cursor | ||||||
|  |     { | ||||||
|  |         class KGE_API CursorModule | ||||||
|  |             : public Singleton<CursorModule> | ||||||
|  |             , public Module | ||||||
|  |         { | ||||||
|  |             friend Singleton<CursorModule>; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |         public: | ||||||
|  | 
 | ||||||
|  |             ~CursorModule() {}; | ||||||
|  |             void OnUpdate(UpdateModuleContext& ctx) override; | ||||||
|  |             void OnRender(RenderModuleContext& ctx) override; | ||||||
|  | 
 | ||||||
|  |         private: | ||||||
|  |             CursorModule(); | ||||||
|  | 
 | ||||||
|  |         private: | ||||||
|  |             SpriteEx*        cursor_actor_; | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     }  | ||||||
|  | }  | ||||||
|  | 
 | ||||||
|  | void InitGameRecFunc() { | ||||||
|  |     PVF_M::getInstance().Init(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | namespace kiwano | ||||||
|  | { | ||||||
|  |     namespace cursor { | ||||||
|  | 
 | ||||||
|  |         CursorModule::CursorModule() { | ||||||
|  | 
 | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         bool IsMouseInWindow(HWND hWnd) | ||||||
|  |         { | ||||||
|  |             POINT mousePos; | ||||||
|  |             GetCursorPos(&mousePos); | ||||||
|  |             ScreenToClient(hWnd, &mousePos); | ||||||
|  | 
 | ||||||
|  |             RECT windowRect; | ||||||
|  |             GetClientRect(hWnd, &windowRect); | ||||||
|  | 
 | ||||||
|  |             return PtInRect(&windowRect, mousePos); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         void CursorModule::OnUpdate(UpdateModuleContext& ctx) { | ||||||
|  |             //确保虚拟机已经初始化了 从虚拟机回调中加载鼠标
 | ||||||
|  |             if (v && !cursor_actor_) { | ||||||
|  |                 if (VmMtx.try_lock()) { | ||||||
|  |                     SQUserPointer Cursor; | ||||||
|  |                     SQInteger top = sq_gettop(v); //saves the stack size before the call
 | ||||||
|  |                     sq_pushroottable(v); //pushes the global table
 | ||||||
|  |                     sq_pushstring(v, _SC("InitCursor"), -1); | ||||||
|  |                     if (SQ_SUCCEEDED(sq_get(v, -2))) { //gets the field 'foo' from the global table
 | ||||||
|  |                         sq_pushroottable(v); //push the 'this' (in this case is the global table)
 | ||||||
|  |                         sq_call(v, 1, SQTrue, SQTrue); //calls the function
 | ||||||
|  |                         sq_getuserpointer(v, -1, &Cursor); | ||||||
|  |                         cursor_actor_ = (SpriteEx*)Cursor; | ||||||
|  |                     } | ||||||
|  |                     sq_settop(v, top); //restores the original stack size
 | ||||||
|  |                     VmMtx.unlock(); | ||||||
|  | 
 | ||||||
|  |                     //分配线程去初始化数据
 | ||||||
|  |                     threadPool.concurrentRun(InitGameRecFunc); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |             else { | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |                 if (VmMtx.try_lock()) { | ||||||
|  |                     SQInteger top = sq_gettop(v); //saves the stack size before the call
 | ||||||
|  |                     sq_pushroottable(v); //pushes the global table
 | ||||||
|  |                     sq_pushstring(v, _SC("UpdateCursor"), -1); | ||||||
|  |                     if (SQ_SUCCEEDED(sq_get(v, -2))) { //gets the field 'foo' from the global table
 | ||||||
|  |                         sq_pushroottable(v); //push the 'this' (in this case is the global table)
 | ||||||
|  |                         sq_pushinteger(v, ctx.dt.GetMilliseconds()); | ||||||
|  |                         sq_call(v, 2, SQFalse, SQTrue); //calls the function
 | ||||||
|  |                     } | ||||||
|  |                     sq_settop(v, top); //restores the original stack size
 | ||||||
|  |                     VmMtx.unlock(); | ||||||
|  |                 } | ||||||
|  |                 ////获取输入
 | ||||||
|  |                 Input& input = Input::GetInstance(); | ||||||
|  | 
 | ||||||
|  |                 cursor_actor_->SetPosition(input.GetMousePos()); | ||||||
|  | 
 | ||||||
|  |                 if (IsMouseInWindow(GetForegroundWindow())) | ||||||
|  |                     ShowCursor(FALSE); | ||||||
|  |                 else | ||||||
|  |                     ShowCursor(TRUE); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         void CursorModule::OnRender(RenderModuleContext& ctx) { | ||||||
|  |             if (cursor_actor_)cursor_actor_->Render(ctx.render_ctx); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | @ -0,0 +1,12 @@ | ||||||
|  | #pragma once | ||||||
|  | #include "SquirrelClassEx.h" | ||||||
|  | #include <map> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | class GameState | ||||||
|  | { | ||||||
|  | public: | ||||||
|  | 	void Run(); | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | @ -0,0 +1,60 @@ | ||||||
|  | #pragma once | ||||||
|  | 
 | ||||||
|  | #include <kiwano/kiwano.h> | ||||||
|  | using namespace kiwano; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | namespace kiwano | ||||||
|  | { | ||||||
|  | 
 | ||||||
|  | 	KGE_DECLARE_SMART_PTR(SpriteEx); | ||||||
|  | 	class SpriteEx :public Sprite | ||||||
|  | 	{ | ||||||
|  | 	public: | ||||||
|  | 		void OnUpdate(Duration dt) override; | ||||||
|  | 		void OnRender(RenderContext& ctx) override; | ||||||
|  | 		void Update(Duration dt)override; | ||||||
|  | 		void Render(RenderContext& ctx)override; | ||||||
|  | 		void RenderBorder(RenderContext& ctx)override; | ||||||
|  | 	private: | ||||||
|  | 		int MyModel = -1; | ||||||
|  | 	public: | ||||||
|  | 		void SetMode(const int Type); | ||||||
|  | 	}; | ||||||
|  | 
 | ||||||
|  | 	inline void SpriteEx::SetMode(const int Type) { | ||||||
|  | 		MyModel = Type; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	inline void SpriteEx::OnUpdate(Duration dt) { | ||||||
|  | 		Sprite::OnUpdate(dt); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	inline void SpriteEx::OnRender(RenderContext& ctx) { | ||||||
|  | 		switch (MyModel) | ||||||
|  | 		{ | ||||||
|  | 		case -1:        //-1Ôʼģʽ
 | ||||||
|  | 			ctx.SetBlendMode(BlendMode::SourceOver); | ||||||
|  | 			break; | ||||||
|  | 		case 0:        //0ÏßÐÔ¼õµ
 | ||||||
|  | 			ctx.SetBlendMode(BlendMode::Add); | ||||||
|  | 			break; | ||||||
|  | 		default: | ||||||
|  | 			ctx.SetBlendMode(BlendMode::SourceOver); | ||||||
|  | 			break; | ||||||
|  | 		} | ||||||
|  | 		Sprite::OnRender(ctx); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	inline void SpriteEx::Update(Duration dt) { | ||||||
|  | 		Sprite::Update(dt); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	inline void SpriteEx::Render(RenderContext& ctx) { | ||||||
|  | 		Sprite::Render(ctx); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	inline void SpriteEx::RenderBorder(RenderContext& ctx) { | ||||||
|  | 		Sprite::RenderBorder(ctx); | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | @ -0,0 +1,53 @@ | ||||||
|  | #pragma once | ||||||
|  | #include <mutex> | ||||||
|  | #include <kiwano/kiwano.h> | ||||||
|  | using namespace kiwano; | ||||||
|  | 
 | ||||||
|  | extern HSQUIRRELVM v; | ||||||
|  | extern std::mutex VmMtx; | ||||||
|  | 
 | ||||||
|  | KGE_DECLARE_SMART_PTR(StageEx); | ||||||
|  | class StageEx :public Stage | ||||||
|  | { | ||||||
|  | public: | ||||||
|  | 	void OnUpdate(Duration dt) override; | ||||||
|  | 	void SetSqrobj(HSQOBJECT obj); | ||||||
|  | 	void OnExit()override; | ||||||
|  | private: | ||||||
|  | 	HSQOBJECT obj; | ||||||
|  | 	bool CallBackFlag = false; | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | void StageEx::OnUpdate(Duration dt) { | ||||||
|  | 	if (CallBackFlag) { | ||||||
|  | 		if (VmMtx.try_lock()) { | ||||||
|  | 			SQInteger top = sq_gettop(v); //saves the stack size before the call
 | ||||||
|  | 			sq_pushobject(v, obj); | ||||||
|  | 			sq_pushstring(v, _SC("OnUpdate"), -1); | ||||||
|  | 			if (SQ_SUCCEEDED(sq_get(v, -2))) { | ||||||
|  | 				//sq_pushroottable(v);
 | ||||||
|  | 				sq_pushobject(v, obj); | ||||||
|  | 				sq_pushinteger(v, dt.GetMilliseconds()); | ||||||
|  | 				sq_call(v, 2, SQFalse, SQTrue); | ||||||
|  | 			} | ||||||
|  | 			sq_settop(v, top); //restores the original stack size
 | ||||||
|  | 			VmMtx.unlock(); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void StageEx::OnExit() { | ||||||
|  | 	if (this->CallBackFlag) { | ||||||
|  | 		if (VmMtx.try_lock()) { | ||||||
|  | 			sq_release(v, &this->obj); | ||||||
|  | 			VmMtx.unlock(); | ||||||
|  | 		} | ||||||
|  | 		this->CallBackFlag = false; | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void StageEx::SetSqrobj(HSQOBJECT obj) { | ||||||
|  | 	this->obj = obj; | ||||||
|  | 	this->CallBackFlag = true; | ||||||
|  | } | ||||||
|  | @ -0,0 +1,65 @@ | ||||||
|  | #pragma once | ||||||
|  | #include <map> | ||||||
|  | #include <string> | ||||||
|  | #include <windows.h> | ||||||
|  | #include <iostream> | ||||||
|  | #include <zlib.h> | ||||||
|  | 
 | ||||||
|  | #define NPK_R_FLAG(b){if(!b)continue;} | ||||||
|  | 
 | ||||||
|  | //PNG结构体
 | ||||||
|  | struct ImgInfo | ||||||
|  | { | ||||||
|  | 	//图片格式
 | ||||||
|  | 	int Type; | ||||||
|  | 	//压缩类型
 | ||||||
|  | 	int CmpType; | ||||||
|  | 	//宽度
 | ||||||
|  | 	int Width; | ||||||
|  | 	//高度
 | ||||||
|  | 	int Height; | ||||||
|  | 	//大小
 | ||||||
|  | 	int Size; | ||||||
|  | 	//Xpos
 | ||||||
|  | 	int Xpos; | ||||||
|  | 	//Ypos
 | ||||||
|  | 	int Ypos; | ||||||
|  | 	//帧域X
 | ||||||
|  | 	int FrameXpos; | ||||||
|  | 	//帧域Y
 | ||||||
|  | 	int FrameYpos; | ||||||
|  | 	//偏移
 | ||||||
|  | 	int Offset; | ||||||
|  | 	//Png位图数据
 | ||||||
|  | 	BYTE* PNGdata; | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | struct NpkInfo | ||||||
|  | { | ||||||
|  | 	int Offset; | ||||||
|  | 	int Length; | ||||||
|  | 	std::string Path; | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | struct IMG     //npk的img的结构体
 | ||||||
|  | { | ||||||
|  | 	std::string lpImgName; //img文件的路径
 | ||||||
|  | 	int img_index;  //img文件在npk文件里的序号
 | ||||||
|  | 	unsigned imgOffset; | ||||||
|  | 	unsigned imgSize; | ||||||
|  | 	std::string lpBelongsFile; //这个img属于哪个npk文件
 | ||||||
|  | 	int png_sum; //这个img文件有多少个 图片
 | ||||||
|  | 	ImgInfo* lp_lplist; //图片的数组..
 | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | class NPK_M { | ||||||
|  | private: | ||||||
|  | 	std::map <std::string, IMG> map_npk; | ||||||
|  | public: | ||||||
|  | 	NPK_M(); | ||||||
|  | 	void init(); | ||||||
|  | 	LPDWORD LoadImgToMem(IMG* p); | ||||||
|  | 	IMG* ReadNpkTable(const std::string imgname); | ||||||
|  | 	void ReleaseNpkTable(IMG* p); | ||||||
|  | 	~NPK_M(); | ||||||
|  | }; | ||||||
|  | @ -0,0 +1,30 @@ | ||||||
|  | #pragma once | ||||||
|  | #include <map> | ||||||
|  | 
 | ||||||
|  | class PVF_M { | ||||||
|  | public: | ||||||
|  |     static PVF_M& getInstance() { | ||||||
|  |         static PVF_M instance; | ||||||
|  |         return instance; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     // 禁止拷贝构造函数和赋值运算符重载
 | ||||||
|  |     PVF_M(const PVF_M&) = delete; | ||||||
|  |     PVF_M& operator=(const PVF_M&) = delete; | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     PVF_M() {} // 私有构造函数,防止外部创建实例
 | ||||||
|  | 
 | ||||||
|  |     struct PvfData | ||||||
|  |     { | ||||||
|  |         char* Data; | ||||||
|  |         int Size; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | public: | ||||||
|  |     void Init(); | ||||||
|  |     int charPtrToInt(const char* ptr); | ||||||
|  |     void intToCharPtr(int value, char* ptr); | ||||||
|  |     void CrcDecode(PvfData &Data, const int crc32); | ||||||
|  | }; | ||||||
|  | @ -0,0 +1,754 @@ | ||||||
|  | #pragma once | ||||||
|  | #include "SquirrelClassEx.h" | ||||||
|  | #include "Tool.hpp" | ||||||
|  | #include <iostream> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | #define SAFE_READN(ptr,len) { \ | ||||||
|  |     if(self->Read(ptr,len) != len) return sq_throwerror(v,_SC("io error")); \ | ||||||
|  |     } | ||||||
|  | static SQInteger _stream_myreadstring(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQStream* self = NULL; | ||||||
|  |     if (SQ_FAILED(sq_getinstanceup(v, 1, (SQUserPointer*)&self, (SQUserPointer)((SQUnsignedInteger)SQSTD_STREAM_TYPE_TAG), SQFalse))) \ | ||||||
|  |         return sq_throwerror(v, _SC("invalid type tag")); \ | ||||||
|  |         if (!self || !self->IsValid())  \ | ||||||
|  |             return sq_throwerror(v, _SC("the stream is invalid")); | ||||||
|  | 
 | ||||||
|  |     SQInteger Count; | ||||||
|  |     sq_getinteger(v, 2, &Count); | ||||||
|  |     char* Str = new char[Count+1]; | ||||||
|  |     self->Read(Str, Count); | ||||||
|  |     std::string Sstr(Str, Count); | ||||||
|  |     delete[]Str; | ||||||
|  |     sq_pushstring(v, TOOL::charTowchar_t(Sstr).c_str(), -1); | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | static SQInteger _file_releasehook(SQUserPointer p, SQInteger SQ_UNUSED_ARG(size)) | ||||||
|  | { | ||||||
|  |     Actor* Abli = (Actor*)p; | ||||||
|  |     std::cout << "C++对象: " << (Abli->GetName().empty() ? "无名字" : Abli->GetName()) << "当前引用计数: " << Abli->GetRefCount() << "已释放一次引用计数" << std::endl; | ||||||
|  |     Abli->Release(); | ||||||
|  | 
 | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | //注册析构函数
 | ||||||
|  | static SQInteger Register_Destruction(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     //析构函数测试    
 | ||||||
|  |     SQUserPointer P; | ||||||
|  |     sq_getuserpointer(v, 2, &P); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     sq_setinstanceup(v, 3, P); | ||||||
|  |     sq_setreleasehook(v, 3, _file_releasehook); | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | //内存泄露追踪
 | ||||||
|  | static SQInteger BaseObject_DumpTracing(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     ObjectBase::DumpTracingObjects(); | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | //角色类通用添加子对象
 | ||||||
|  | static SQInteger BaseObject_Addchild(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  | 
 | ||||||
|  |     SQUserPointer B_obj; | ||||||
|  |     sq_getuserpointer(v, 3, &B_obj); | ||||||
|  | 
 | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     Actor* Bobj = (Actor*)B_obj; | ||||||
|  |     Aobj->AddChild(Bobj); | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | //角色类通用移除子对象
 | ||||||
|  | static SQInteger BaseObject_Removechild(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  | 
 | ||||||
|  |     SQUserPointer B_obj; | ||||||
|  |     sq_getuserpointer(v, 3, &B_obj); | ||||||
|  | 
 | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     Actor* Bobj = (Actor*)B_obj; | ||||||
|  |     Aobj->RemoveChild(Bobj); | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | //角色类通用设置名字
 | ||||||
|  | static SQInteger BaseObject_SetName(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  | 
 | ||||||
|  |     const SQChar* Name; | ||||||
|  |     sq_getstring(v, 3, &Name); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     Aobj->SetName(TOOL::SquirrelU2W(Name)); | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | //角色类通用获取名字
 | ||||||
|  | static SQInteger BaseObject_GetName(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  | 
 | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     std::string Name = Aobj->GetName(); | ||||||
|  |      | ||||||
|  |     sq_pushstring(v, TOOL::charTowchar_t(Name).c_str(), -1); | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | //角色类通用获取ObjectId
 | ||||||
|  | static SQInteger BaseObject_GetId(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  | 
 | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     sq_pushinteger(v, Aobj->GetObjectID()); | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | //角色类通用	获取显示状态
 | ||||||
|  | static SQInteger BaseObject_IsVisible(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     sq_pushbool(v, Aobj->IsVisible()); | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | //角色类通用	是否启用级联透明度
 | ||||||
|  | static SQInteger BaseObject_IsCascadeOpacityEnabled(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     sq_pushbool(v, Aobj->IsCascadeOpacityEnabled()); | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | //角色类通用	是否启用事件分发
 | ||||||
|  | static SQInteger BaseObject_IsEventDispatchEnabled(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     sq_pushbool(v, Aobj->IsEventDispatchEnabled()); | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | //角色类通用	获取名称的 Hash 值
 | ||||||
|  | static SQInteger BaseObject_GetHashName(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     sq_pushinteger(v, Aobj->GetHashName()); | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | //角色类通用	获取 Z 轴顺序
 | ||||||
|  | static SQInteger BaseObject_GetZOrder(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     sq_pushinteger(v, Aobj->GetZOrder()); | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | //角色类通用	获取坐标
 | ||||||
|  | static SQInteger BaseObject_GetPosition(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     Point Pos = Aobj->GetPosition(); | ||||||
|  | 
 | ||||||
|  |     sq_newtable(v); | ||||||
|  |     sq_pushstring(v, _SC("x"), -1); | ||||||
|  |     sq_pushfloat(v,Pos.x); | ||||||
|  |     sq_newslot(v, 3, SQFalse); | ||||||
|  |     sq_pushstring(v, _SC("y"), -1); | ||||||
|  |     sq_pushfloat(v, Pos.y); | ||||||
|  |     sq_newslot(v, 3, SQFalse); | ||||||
|  | 
 | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | //角色类通用	获取大小
 | ||||||
|  | static SQInteger BaseObject_GetSize(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     Size Pos = Aobj->GetSize(); | ||||||
|  | 
 | ||||||
|  |     sq_newtable(v); | ||||||
|  |     sq_pushstring(v, _SC("w"), -1); | ||||||
|  |     sq_pushfloat(v, Pos.x); | ||||||
|  |     sq_newslot(v, 3, SQFalse); | ||||||
|  |     sq_pushstring(v, _SC("h"), -1); | ||||||
|  |     sq_pushfloat(v, Pos.y); | ||||||
|  |     sq_newslot(v, 3, SQFalse); | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | //角色类通用	获取缩放后的大小
 | ||||||
|  | static SQInteger BaseObject_GetScaledSize(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     Size Pos = Aobj->GetScaledSize(); | ||||||
|  | 
 | ||||||
|  |     sq_newtable(v); | ||||||
|  |     sq_pushstring(v, _SC("w"), -1); | ||||||
|  |     sq_pushfloat(v, Pos.x); | ||||||
|  |     sq_newslot(v, 3, SQFalse); | ||||||
|  |     sq_pushstring(v, _SC("h"), -1); | ||||||
|  |     sq_pushfloat(v, Pos.y); | ||||||
|  |     sq_newslot(v, 3, SQFalse); | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | //角色类通用	获取锚点
 | ||||||
|  | static SQInteger BaseObject_GetAnchor(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     Point Pos = Aobj->GetAnchor(); | ||||||
|  | 
 | ||||||
|  |     sq_newtable(v); | ||||||
|  |     sq_pushstring(v, _SC("x"), -1); | ||||||
|  |     sq_pushfloat(v, Pos.x); | ||||||
|  |     sq_newslot(v, 3, SQFalse); | ||||||
|  |     sq_pushstring(v, _SC("y"), -1); | ||||||
|  |     sq_pushfloat(v, Pos.y); | ||||||
|  |     sq_newslot(v, 3, SQFalse); | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | //角色类通用	获取透明度
 | ||||||
|  | static SQInteger BaseObject_GetOpacity(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  | 
 | ||||||
|  |     sq_pushfloat(v, Aobj->GetOpacity()); | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | //角色类通用	获取显示透明度
 | ||||||
|  | static SQInteger BaseObject_GetDisplayedOpacity(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  | 
 | ||||||
|  |     sq_pushfloat(v, Aobj->GetDisplayedOpacity()); | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | //角色类通用	获取旋转角度
 | ||||||
|  | static SQInteger BaseObject_GetRotation(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  | 
 | ||||||
|  |     sq_pushfloat(v, Aobj->GetRotation()); | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | //角色类通用	获取缩放比例
 | ||||||
|  | static SQInteger BaseObject_GetScale(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     Point Pos = Aobj->GetScale(); | ||||||
|  | 
 | ||||||
|  |     sq_newtable(v); | ||||||
|  |     sq_pushstring(v, _SC("x"), -1); | ||||||
|  |     sq_pushfloat(v, Pos.x); | ||||||
|  |     sq_newslot(v, 3, SQFalse); | ||||||
|  |     sq_pushstring(v, _SC("y"), -1); | ||||||
|  |     sq_pushfloat(v, Pos.y); | ||||||
|  |     sq_newslot(v, 3, SQFalse); | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | //角色类通用	获取错切角度
 | ||||||
|  | static SQInteger BaseObject_GetSkew(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     Point Pos = Aobj->GetSkew(); | ||||||
|  | 
 | ||||||
|  |     sq_newtable(v); | ||||||
|  |     sq_pushstring(v, _SC("x"), -1); | ||||||
|  |     sq_pushfloat(v, Pos.x); | ||||||
|  |     sq_newslot(v, 3, SQFalse); | ||||||
|  |     sq_pushstring(v, _SC("y"), -1); | ||||||
|  |     sq_pushfloat(v, Pos.y); | ||||||
|  |     sq_newslot(v, 3, SQFalse); | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | //角色类通用	获取变换
 | ||||||
|  | static SQInteger BaseObject_GetTransform(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     Transform Tf = Aobj->GetTransform(); | ||||||
|  | 
 | ||||||
|  |     sq_newtable(v); | ||||||
|  | 
 | ||||||
|  |     sq_pushstring(v, _SC("pos"), -1); | ||||||
|  |     sq_newtable(v); | ||||||
|  |     sq_pushstring(v, _SC("x"), -1); | ||||||
|  |     sq_pushfloat(v, Tf.position.x); | ||||||
|  |     sq_newslot(v, 5, SQFalse); | ||||||
|  |     sq_pushstring(v, _SC("y"), -1); | ||||||
|  |     sq_pushfloat(v, Tf.position.y); | ||||||
|  |     sq_newslot(v, 5, SQFalse); | ||||||
|  |     sq_newslot(v, 3, SQFalse); | ||||||
|  | 
 | ||||||
|  |     sq_pushstring(v, _SC("scale"), -1); | ||||||
|  |     sq_newtable(v); | ||||||
|  |     sq_pushstring(v, _SC("x"), -1); | ||||||
|  |     sq_pushfloat(v, Tf.scale.x); | ||||||
|  |     sq_newslot(v, 5, SQFalse); | ||||||
|  |     sq_pushstring(v, _SC("y"), -1); | ||||||
|  |     sq_pushfloat(v, Tf.scale.y); | ||||||
|  |     sq_newslot(v, 5, SQFalse); | ||||||
|  |     sq_newslot(v, 3, SQFalse); | ||||||
|  | 
 | ||||||
|  |     sq_pushstring(v, _SC("skew"), -1); | ||||||
|  |     sq_newtable(v); | ||||||
|  |     sq_pushstring(v, _SC("x"), -1); | ||||||
|  |     sq_pushfloat(v, Tf.skew.x); | ||||||
|  |     sq_newslot(v, 5, SQFalse); | ||||||
|  |     sq_pushstring(v, _SC("y"), -1); | ||||||
|  |     sq_pushfloat(v, Tf.skew.y); | ||||||
|  |     sq_newslot(v, 5, SQFalse); | ||||||
|  |     sq_newslot(v, 3, SQFalse); | ||||||
|  | 
 | ||||||
|  |     sq_pushstring(v, _SC("rotation"), -1); | ||||||
|  |     sq_pushfloat(v, Tf.rotation); | ||||||
|  |     sq_newslot(v, 3, SQFalse); | ||||||
|  | 
 | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | //角色类通用	获取父角色
 | ||||||
|  | static SQInteger BaseObject_GetParent(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     Actor* P = Aobj->GetParent(); | ||||||
|  | 
 | ||||||
|  |     sq_pushuserpointer(v, P); | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | //角色类通用	获取所在舞台
 | ||||||
|  | static SQInteger BaseObject_GetStage(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     StageEx* P = (StageEx*)Aobj->GetStage(); | ||||||
|  | 
 | ||||||
|  |     sq_pushuserpointer(v, P); | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | //角色类通用	设置角色是否可见
 | ||||||
|  | static SQInteger BaseObject_SetVisible(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     SQBool Value; | ||||||
|  |     sq_getbool(v, 3, &Value); | ||||||
|  | 
 | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     Aobj->SetVisible(Value); | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | //角色类通用	设置坐标
 | ||||||
|  | static SQInteger BaseObject_SetPosition(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  | 
 | ||||||
|  |     if (sq_gettop(v) == 3) { | ||||||
|  |         Point Pos; | ||||||
|  |         sq_pushnull(v);  // null iterator
 | ||||||
|  |         while (SQ_SUCCEEDED(sq_next(v, 3))) | ||||||
|  |         { | ||||||
|  |             SQFloat value; | ||||||
|  |             sq_getfloat(v, -1, &value); | ||||||
|  |             const SQChar* key; | ||||||
|  |             sq_getstring(v, -2, &key); | ||||||
|  | 
 | ||||||
|  |             if (wcscmp(key, _SC("x")) == 0) { | ||||||
|  |                 Pos.x = value; | ||||||
|  |             } | ||||||
|  |             else if (wcscmp(key, _SC("y")) == 0) { | ||||||
|  |                 Pos.y = value; | ||||||
|  |             } | ||||||
|  |             sq_pop(v, 2); | ||||||
|  |         } | ||||||
|  |         sq_pop(v, 1); | ||||||
|  | 
 | ||||||
|  |         Actor* Aobj = (Actor*)A_obj; | ||||||
|  |         Aobj->SetPosition(Pos); | ||||||
|  |     } | ||||||
|  |     else if (sq_gettop(v) == 4) { | ||||||
|  |         SQFloat X, Y; | ||||||
|  |         sq_getfloat(v, 3, &X); | ||||||
|  |         sq_getfloat(v, 4, &Y); | ||||||
|  |         Actor* Aobj = (Actor*)A_obj; | ||||||
|  |         Aobj->SetPosition(X,Y); | ||||||
|  |     } | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | //角色类通用	设置缩放比例
 | ||||||
|  | static SQInteger BaseObject_SetScale(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  | 
 | ||||||
|  |     if (sq_gettop(v) == 3) { | ||||||
|  |         Point Pos; | ||||||
|  |         sq_pushnull(v);  // null iterator
 | ||||||
|  |         while (SQ_SUCCEEDED(sq_next(v, 3))) | ||||||
|  |         { | ||||||
|  |             SQFloat value; | ||||||
|  |             sq_getfloat(v, -1, &value); | ||||||
|  |             const SQChar* key; | ||||||
|  |             sq_getstring(v, -2, &key); | ||||||
|  | 
 | ||||||
|  |             if (wcscmp(key, _SC("x")) == 0) { | ||||||
|  |                 Pos.x = value; | ||||||
|  |             } | ||||||
|  |             else if (wcscmp(key, _SC("y")) == 0) { | ||||||
|  |                 Pos.y = value; | ||||||
|  |             } | ||||||
|  |             sq_pop(v, 2); | ||||||
|  |         } | ||||||
|  |         sq_pop(v, 1); | ||||||
|  | 
 | ||||||
|  |         Actor* Aobj = (Actor*)A_obj; | ||||||
|  |         Aobj->SetScale(Pos); | ||||||
|  |     } | ||||||
|  |     else if (sq_gettop(v) == 4) { | ||||||
|  |         SQFloat X, Y; | ||||||
|  |         sq_getfloat(v, 3, &X); | ||||||
|  |         sq_getfloat(v, 4, &Y); | ||||||
|  |         Actor* Aobj = (Actor*)A_obj; | ||||||
|  |         Aobj->SetScale(X, Y); | ||||||
|  |     } | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | //角色类通用	设置错切角度
 | ||||||
|  | static SQInteger BaseObject_SetSkew(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  | 
 | ||||||
|  |     if (sq_gettop(v) == 3) { | ||||||
|  |         Point Pos; | ||||||
|  |         sq_pushnull(v);  // null iterator
 | ||||||
|  |         while (SQ_SUCCEEDED(sq_next(v, 3))) | ||||||
|  |         { | ||||||
|  |             SQFloat value; | ||||||
|  |             sq_getfloat(v, -1, &value); | ||||||
|  |             const SQChar* key; | ||||||
|  |             sq_getstring(v, -2, &key); | ||||||
|  | 
 | ||||||
|  |             if (wcscmp(key, _SC("x")) == 0) { | ||||||
|  |                 Pos.x = value; | ||||||
|  |             } | ||||||
|  |             else if (wcscmp(key, _SC("y")) == 0) { | ||||||
|  |                 Pos.y = value; | ||||||
|  |             } | ||||||
|  |             sq_pop(v, 2); | ||||||
|  |         } | ||||||
|  |         sq_pop(v, 1); | ||||||
|  | 
 | ||||||
|  |         Actor* Aobj = (Actor*)A_obj; | ||||||
|  |         Aobj->SetSkew(Pos); | ||||||
|  |     } | ||||||
|  |     else if (sq_gettop(v) == 4) { | ||||||
|  |         SQFloat X, Y; | ||||||
|  |         sq_getfloat(v, 3, &X); | ||||||
|  |         sq_getfloat(v, 4, &Y); | ||||||
|  |         Actor* Aobj = (Actor*)A_obj; | ||||||
|  |         Aobj->SetSkew(X, Y); | ||||||
|  |     } | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | //角色类通用	设置锚点位置
 | ||||||
|  | static SQInteger BaseObject_SetAnchor(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  | 
 | ||||||
|  |     if (sq_gettop(v) == 3) { | ||||||
|  |         Point Pos; | ||||||
|  |         sq_pushnull(v);  // null iterator
 | ||||||
|  |         while (SQ_SUCCEEDED(sq_next(v, 3))) | ||||||
|  |         { | ||||||
|  |             SQFloat value; | ||||||
|  |             sq_getfloat(v, -1, &value); | ||||||
|  |             const SQChar* key; | ||||||
|  |             sq_getstring(v, -2, &key); | ||||||
|  | 
 | ||||||
|  |             if (wcscmp(key, _SC("x")) == 0) { | ||||||
|  |                 Pos.x = value; | ||||||
|  |             } | ||||||
|  |             else if (wcscmp(key, _SC("y")) == 0) { | ||||||
|  |                 Pos.y = value; | ||||||
|  |             } | ||||||
|  |             sq_pop(v, 2); | ||||||
|  |         } | ||||||
|  |         sq_pop(v, 1); | ||||||
|  | 
 | ||||||
|  |         Actor* Aobj = (Actor*)A_obj; | ||||||
|  |         Aobj->SetAnchor(Pos); | ||||||
|  |     } | ||||||
|  |     else if (sq_gettop(v) == 4) { | ||||||
|  |         SQFloat X, Y; | ||||||
|  |         sq_getfloat(v, 3, &X); | ||||||
|  |         sq_getfloat(v, 4, &Y); | ||||||
|  |         Actor* Aobj = (Actor*)A_obj; | ||||||
|  |         Aobj->SetAnchor(X, Y); | ||||||
|  |     } | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | //角色类通用	修改大小
 | ||||||
|  | static SQInteger BaseObject_SetSize(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  | 
 | ||||||
|  |     if (sq_gettop(v) == 3) { | ||||||
|  |         Size Pos; | ||||||
|  |         sq_pushnull(v);  // null iterator
 | ||||||
|  |         while (SQ_SUCCEEDED(sq_next(v, 3))) | ||||||
|  |         { | ||||||
|  |             SQFloat value; | ||||||
|  |             sq_getfloat(v, -1, &value); | ||||||
|  |             const SQChar* key; | ||||||
|  |             sq_getstring(v, -2, &key); | ||||||
|  | 
 | ||||||
|  |             if (wcscmp(key, _SC("w")) == 0) { | ||||||
|  |                 Pos.x = value; | ||||||
|  |             } | ||||||
|  |             else if (wcscmp(key, _SC("h")) == 0) { | ||||||
|  |                 Pos.y = value; | ||||||
|  |             } | ||||||
|  |             sq_pop(v, 2); | ||||||
|  |         } | ||||||
|  |         sq_pop(v, 1); | ||||||
|  | 
 | ||||||
|  |         Actor* Aobj = (Actor*)A_obj; | ||||||
|  |         Aobj->SetSize(Pos); | ||||||
|  |     } | ||||||
|  |     else if (sq_gettop(v) == 4) { | ||||||
|  |         SQFloat X, Y; | ||||||
|  |         sq_getfloat(v, 3, &X); | ||||||
|  |         sq_getfloat(v, 4, &Y); | ||||||
|  |         Actor* Aobj = (Actor*)A_obj; | ||||||
|  |         Aobj->SetSize(X, Y); | ||||||
|  |     } | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | //角色类通用	设置旋转角度
 | ||||||
|  | static SQInteger BaseObject_SetRotation(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     SQFloat Value; | ||||||
|  |     sq_getfloat(v, 3, &Value); | ||||||
|  | 
 | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     Aobj->SetRotation(Value); | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | //角色类通用	设置透明度
 | ||||||
|  | static SQInteger BaseObject_SetOpacity(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     SQFloat Value; | ||||||
|  |     sq_getfloat(v, 3, &Value); | ||||||
|  | 
 | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     Aobj->SetOpacity(Value); | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | //角色类通用	启用或禁用级联透明度
 | ||||||
|  | static SQInteger BaseObject_SetCascadeOpacityEnabled(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     SQBool Value; | ||||||
|  |     sq_getbool(v, 3, &Value); | ||||||
|  | 
 | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     Aobj->SetCascadeOpacityEnabled(Value); | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | //角色类通用	设置 Z 轴顺序
 | ||||||
|  | static SQInteger BaseObject_SetZOrder(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     SQInteger Value; | ||||||
|  |     sq_getinteger(v, 3, &Value); | ||||||
|  | 
 | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     Aobj->SetZOrder(Value); | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | //角色类通用	判断点是否在角色内
 | ||||||
|  | static SQInteger BaseObject_IsContainsPoint(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  | 
 | ||||||
|  |     if (sq_gettop(v) == 3) { | ||||||
|  |         Point Pos; | ||||||
|  |         sq_pushnull(v);  // null iterator
 | ||||||
|  |         while (SQ_SUCCEEDED(sq_next(v, 3))) | ||||||
|  |         { | ||||||
|  |             SQFloat value; | ||||||
|  |             sq_getfloat(v, -1, &value); | ||||||
|  |             const SQChar* key; | ||||||
|  |             sq_getstring(v, -2, &key); | ||||||
|  | 
 | ||||||
|  |             if (wcscmp(key, _SC("w")) == 0) { | ||||||
|  |                 Pos.x = value; | ||||||
|  |             } | ||||||
|  |             else if (wcscmp(key, _SC("h")) == 0) { | ||||||
|  |                 Pos.y = value; | ||||||
|  |             } | ||||||
|  |             sq_pop(v, 2); | ||||||
|  |         } | ||||||
|  |         sq_pop(v, 1); | ||||||
|  | 
 | ||||||
|  |         Actor* Aobj = (Actor*)A_obj; | ||||||
|  |         sq_pushbool(v, Aobj->ContainsPoint(Pos)); | ||||||
|  |     } | ||||||
|  |     else if (sq_gettop(v) == 4) { | ||||||
|  |         SQFloat X, Y; | ||||||
|  |         sq_getfloat(v, 3, &X); | ||||||
|  |         sq_getfloat(v, 4, &Y); | ||||||
|  |         Point Pos(X,Y); | ||||||
|  |         Actor* Aobj = (Actor*)A_obj; | ||||||
|  |         sq_pushbool(v, Aobj->ContainsPoint(Pos)); | ||||||
|  |     } | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | //角色类通用	渲染角色边界
 | ||||||
|  | static SQInteger BaseObject_ShowBorder(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     SQBool Value; | ||||||
|  |     sq_getbool(v, 3, &Value); | ||||||
|  | 
 | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     Aobj->ShowBorder(Value); | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | //角色类通用	旋轉
 | ||||||
|  | static SQInteger BaseObject_SetRotate(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer A_obj; | ||||||
|  |     sq_getuserpointer(v, 2, &A_obj); | ||||||
|  |     SQInteger Duration; | ||||||
|  |     sq_getinteger(v, 3, &Duration); | ||||||
|  |     SQFloat Rotation; | ||||||
|  |     sq_getfloat(v, 4, &Rotation); | ||||||
|  |     //通过时间和角度设置动画
 | ||||||
|  |     auto rotate_by = animation::RotateBy(Duration, Rotation); | ||||||
|  |     //设置无限循环
 | ||||||
|  |     rotate_by.Loops(-1); | ||||||
|  | 
 | ||||||
|  |     Actor* Aobj = (Actor*)A_obj; | ||||||
|  |     Aobj->StartAnimation(rotate_by); | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | void RegisterBaseNutApi(const SQChar* funcName, void* funcAddr, HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     sq_pushroottable(v); | ||||||
|  |     sq_pushstring(v, funcName, -1); | ||||||
|  |     sq_newclosure(v, (SQFUNCTION)funcAddr, 0); | ||||||
|  |     sq_newslot(v, -3, false); | ||||||
|  |     sq_poptop(v); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void RegisterBase(HSQUIRRELVM v) { | ||||||
|  |     //打印全部kiwano对象个数
 | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_DumpTracing"), BaseObject_DumpTracing, v); | ||||||
|  |     //读取流的字符串
 | ||||||
|  |     RegisterBaseNutApi(_SC("stream_myreadstring"), _stream_myreadstring, v); | ||||||
|  |     //析构函数
 | ||||||
|  |     RegisterBaseNutApi(_SC("Register_Destruction"), Register_Destruction, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_Addchild"), BaseObject_Addchild, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_Removechild"), BaseObject_Removechild, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_SetName"), BaseObject_SetName, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_GetName"), BaseObject_GetName, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_GetId"), BaseObject_GetId, v); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_IsVisible"), BaseObject_IsVisible, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_IsCascadeOpacityEnabled"), BaseObject_IsCascadeOpacityEnabled, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_IsEventDispatchEnabled"), BaseObject_IsEventDispatchEnabled, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_GetHashName"), BaseObject_GetHashName, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_GetZOrder"), BaseObject_GetZOrder, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_GetPosition"), BaseObject_GetPosition, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_GetSize"), BaseObject_GetSize, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_GetScaledSize"), BaseObject_GetScaledSize, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_GetAnchor"), BaseObject_GetAnchor, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_GetOpacity"), BaseObject_GetOpacity, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_GetDisplayedOpacity"), BaseObject_GetDisplayedOpacity, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_GetRotation"), BaseObject_GetRotation, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_GetScale"), BaseObject_GetScale, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_GetSkew"), BaseObject_GetSkew, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_GetTransform"), BaseObject_GetTransform, v); | ||||||
|  | 
 | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_GetParent"), BaseObject_GetParent, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_GetStage"), BaseObject_GetStage, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_SetVisible"), BaseObject_SetVisible, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_SetPosition"), BaseObject_SetPosition, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_SetScale"), BaseObject_SetScale, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_SetSkew"), BaseObject_SetSkew, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_SetAnchor"), BaseObject_SetAnchor, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_SetSize"), BaseObject_SetSize, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_SetRotation"), BaseObject_SetRotation, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_SetOpacity"), BaseObject_SetOpacity, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_SetCascadeOpacityEnabled"), BaseObject_SetCascadeOpacityEnabled, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_SetZOrder"), BaseObject_SetZOrder, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_IsContainsPoint"), BaseObject_IsContainsPoint, v); | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_ShowBorder"), BaseObject_ShowBorder, v); | ||||||
|  | 
 | ||||||
|  |     RegisterBaseNutApi(_SC("BaseObject_SetRotate"), BaseObject_SetRotate, v); | ||||||
|  | } | ||||||
|  | @ -0,0 +1,34 @@ | ||||||
|  | #pragma once | ||||||
|  | #include "SquirrelClassEx.h" | ||||||
|  | 
 | ||||||
|  | #include <kiwano/kiwano.h> | ||||||
|  | using namespace kiwano; | ||||||
|  | #include <kiwano-audio/kiwano-audio.h> | ||||||
|  | using namespace kiwano::audio; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | static SQInteger Director_EnterStage(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     //»ñµÃÎę̀¶ÔÏó
 | ||||||
|  |     SQUserPointer P; | ||||||
|  |     sq_getuserpointer(v, 2, &P); | ||||||
|  | 
 | ||||||
|  |     Director::GetInstance().EnterStage((StageEx*)P); | ||||||
|  | 
 | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void RegisterDirectorNutApi(const SQChar* funcName, void* funcAddr, HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     sq_pushroottable(v); | ||||||
|  |     sq_pushstring(v, funcName, -1); | ||||||
|  |     sq_newclosure(v, (SQFUNCTION)funcAddr, 0); | ||||||
|  |     sq_newslot(v, -3, false); | ||||||
|  |     sq_poptop(v); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void RegisterDirector(HSQUIRRELVM v) { | ||||||
|  |     //Îö¹¹º¯Êý
 | ||||||
|  |     RegisterDirectorNutApi(_SC("Director_EnterStage"), Director_EnterStage, v); | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | @ -0,0 +1,53 @@ | ||||||
|  | #pragma once | ||||||
|  | #include "squirrel.h" | ||||||
|  | #include "sqstdaux.h" | ||||||
|  | #include "sqstdblob.h" | ||||||
|  | #include "sqstdio.h" | ||||||
|  | #include "sqstdmath.h" | ||||||
|  | #include "sqstdstring.h" | ||||||
|  | #include "sqstdsystem.h" | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | #include <kiwano/kiwano.h> | ||||||
|  | using namespace kiwano; | ||||||
|  | 
 | ||||||
|  | static SQInteger Input_IsDown(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     //»ñµÃ¼ü 
 | ||||||
|  |     SQInteger Key, Model; | ||||||
|  |     sq_getinteger(v, 2, &Key); | ||||||
|  |     //»ñȡģʽ
 | ||||||
|  |     sq_getinteger(v, 3, &Model); | ||||||
|  | 
 | ||||||
|  |     //»ñÈ¡ÊäÈë
 | ||||||
|  |     Input& input = Input::GetInstance(); | ||||||
|  |     bool Flag = false; | ||||||
|  | 
 | ||||||
|  |     switch (Model) | ||||||
|  |     { | ||||||
|  |     case 0: | ||||||
|  |         Flag = input.IsDown(static_cast<MouseButton>(Key)); | ||||||
|  |         break; | ||||||
|  |     case 1: | ||||||
|  |         Flag = input.IsDown(static_cast<KeyCode>(Key)); | ||||||
|  |         break; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     sq_pushbool(v, Flag); | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | static void RegisterInputNutApi(const SQChar* funcName, void* funcAddr, HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     sq_pushroottable(v); | ||||||
|  |     sq_pushstring(v, funcName, -1); | ||||||
|  |     sq_newclosure(v, (SQFUNCTION)funcAddr, 0); | ||||||
|  |     sq_newslot(v, -3, false); | ||||||
|  |     sq_poptop(v); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | static void RegisterInput(HSQUIRRELVM v) { | ||||||
|  | 
 | ||||||
|  |     RegisterInputNutApi(_SC("Input_IsDown"), Input_IsDown, v); | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | @ -0,0 +1,105 @@ | ||||||
|  | #pragma once | ||||||
|  | #include "SquirrelClassEx.h" | ||||||
|  | #include "Npk.h" | ||||||
|  | #include "KiwanoEx/SpriteEx.hpp" | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | std::unordered_map<std::string, std::map<int, TexturePtr>>ImageRecObject; | ||||||
|  | extern NPK_M* npk; | ||||||
|  | 
 | ||||||
|  | static SQInteger Sprite_Create(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SpriteExPtr sprite = new SpriteEx; | ||||||
|  |     //如果用这个方式new 增加一次引用计数
 | ||||||
|  |     sprite->Retain(); | ||||||
|  | 
 | ||||||
|  |     sq_pushuserpointer(v, sprite.Get()); | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | TexturePtr GetTexturePtrByImg(const std::string ImgPath, const int Frame) { | ||||||
|  | 
 | ||||||
|  |     if (ImageRecObject.count(ImgPath) && ImageRecObject[ImgPath].count(Frame)) { | ||||||
|  |         return ImageRecObject[ImgPath][Frame]; | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |         IMG* img = npk->ReadNpkTable(ImgPath); | ||||||
|  |         DWORD Height = img->lp_lplist[Frame].Height; | ||||||
|  |         DWORD Width = img->lp_lplist[Frame].Width; | ||||||
|  |         BYTE* Data = img->lp_lplist[Frame].PNGdata; | ||||||
|  | 
 | ||||||
|  |         BinaryData data = { ((void*)Data) ,Height * Width * 4 }; | ||||||
|  |         TexturePtr t = new Texture; | ||||||
|  |         //如果用这个方式new 增加一次引用计数
 | ||||||
|  |         t->Retain(); | ||||||
|  |         t->Load(PixelSize(Width, Height), data, PixelFormat::Bpp32BGRA); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |         t->SetUserData(&img->lp_lplist[Frame]); | ||||||
|  |         ImageRecObject[ImgPath][Frame] = t; | ||||||
|  |         return t; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | static SQInteger SpriteFrame_Create(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     const SQChar* ImgPath; | ||||||
|  |     sq_getstring(v, 2, &ImgPath); | ||||||
|  |     SQInteger Idx; | ||||||
|  |     sq_getinteger(v, 3, &Idx); | ||||||
|  | 
 | ||||||
|  |     std::wstring wstr(ImgPath); | ||||||
|  |     std::string str(wstr.begin(), wstr.end()); | ||||||
|  |     TexturePtr Sf =  GetTexturePtrByImg(str, Idx); | ||||||
|  | 
 | ||||||
|  |     sq_pushuserpointer(v, Sf.Get()); | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | static SQInteger Sprite_SetFrame(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer SP; | ||||||
|  |     sq_getuserpointer(v, 2, &SP); | ||||||
|  |     SQUserPointer SF; | ||||||
|  |     sq_getuserpointer(v, 3, &SF); | ||||||
|  | 
 | ||||||
|  |     SpriteEx* X = (SpriteEx*)SP; | ||||||
|  |     Texture* XSF = (Texture*)SF; | ||||||
|  |     SpriteFrame A = SpriteFrame(XSF); | ||||||
|  |     X->SetFrame(A); | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | static SQInteger Sprite_SetMode(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer SP; | ||||||
|  |     sq_getuserpointer(v, 2, &SP); | ||||||
|  |     SQInteger Mode; | ||||||
|  |     sq_getinteger(v, 3, &Mode); | ||||||
|  | 
 | ||||||
|  |     SpriteEx* X = (SpriteEx*)SP; | ||||||
|  |     X->SetMode(Mode); | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | void RegisterSpriteNutApi(const SQChar* funcName, void* funcAddr, HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     sq_pushroottable(v); | ||||||
|  |     sq_pushstring(v, funcName, -1); | ||||||
|  |     sq_newclosure(v, (SQFUNCTION)funcAddr, 0); | ||||||
|  |     sq_newslot(v, -3, false); | ||||||
|  |     sq_poptop(v); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void RegisterSprite(HSQUIRRELVM v) { | ||||||
|  |     //创建精灵
 | ||||||
|  |     RegisterSpriteNutApi(_SC("Sprite_Create"), Sprite_Create, v); | ||||||
|  |     //创建精灵帧
 | ||||||
|  |     RegisterSpriteNutApi(_SC("SpriteFrame_Create"), SpriteFrame_Create, v); | ||||||
|  |     //设置精灵帧
 | ||||||
|  |     RegisterSpriteNutApi(_SC("Sprite_SetFrame"), Sprite_SetFrame, v); | ||||||
|  |     //设置混合模式
 | ||||||
|  |     RegisterSpriteNutApi(_SC("Sprite_SetMode"), Sprite_SetMode, v); | ||||||
|  | } | ||||||
|  | @ -0,0 +1,50 @@ | ||||||
|  | #pragma once | ||||||
|  | #include "SquirrelClassEx.h" | ||||||
|  | #include "KiwanoEx/StageEx.hpp" | ||||||
|  | #include <kiwano/kiwano.h> | ||||||
|  | using namespace kiwano; | ||||||
|  | #include <kiwano-audio/kiwano-audio.h> | ||||||
|  | using namespace kiwano::audio; | ||||||
|  | 
 | ||||||
|  | SQInteger Stage_Create(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     StageExPtr stage = new StageEx; | ||||||
|  |     //如果用这个方式new 增加一次引用计数
 | ||||||
|  |     stage->Retain(); | ||||||
|  | 
 | ||||||
|  |     sq_pushuserpointer(v, stage.Get()); | ||||||
|  |     return 1; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | SQInteger Stage_BindenvUpdate(HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     SQUserPointer P; | ||||||
|  |     sq_getuserpointer(v, 2, &P); | ||||||
|  | 
 | ||||||
|  |     StageEx* X = (StageEx*)P; | ||||||
|  | 
 | ||||||
|  |     HSQOBJECT obj; | ||||||
|  |     sq_getstackobj(v, 3, &obj); | ||||||
|  |     sq_addref(v, &obj); | ||||||
|  |     X->SetSqrobj(obj); | ||||||
|  | 
 | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | void RegisterStageNutApi(const SQChar* funcName, void* funcAddr, HSQUIRRELVM v) | ||||||
|  | { | ||||||
|  |     sq_pushroottable(v); | ||||||
|  |     sq_pushstring(v, funcName, -1); | ||||||
|  |     sq_newclosure(v, (SQFUNCTION)funcAddr, 0); | ||||||
|  |     sq_newslot(v, -3, false); | ||||||
|  |     sq_poptop(v); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void RegisterStage(HSQUIRRELVM v) { | ||||||
|  |     //创建场景
 | ||||||
|  |     RegisterStageNutApi(_SC("Stage_Create"), Stage_Create, v); | ||||||
|  |     //绑定update
 | ||||||
|  |     RegisterStageNutApi(_SC("Stage_BindenvUpdate"), Stage_BindenvUpdate, v); | ||||||
|  | } | ||||||
|  | @ -0,0 +1,45 @@ | ||||||
|  | #pragma once | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | #include "squirrel.h" | ||||||
|  | #include "sqstdaux.h" | ||||||
|  | #include "sqstdblob.h" | ||||||
|  | #include "sqstdio.h" | ||||||
|  | #include "sqstdmath.h" | ||||||
|  | #include "sqstdstring.h" | ||||||
|  | #include "sqstdsystem.h" | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | class SquirrelClassEx | ||||||
|  | { | ||||||
|  | 
 | ||||||
|  | public://输出拓展
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | public://API类
 | ||||||
|  | 	//重载Nut脚本
 | ||||||
|  | 	static SQInteger ReloadingScript(); | ||||||
|  | 	//退出游戏
 | ||||||
|  | 	static SQInteger Exit(HSQUIRRELVM v); | ||||||
|  | 
 | ||||||
|  | public://注册闭包函数
 | ||||||
|  | 	//新增nut接口funcName绑定C语言函数funcAddr
 | ||||||
|  | 	static void RegisterNutApi(const SQChar* funcName, void* funcAddr, HSQUIRRELVM v); | ||||||
|  | 	//注册接口
 | ||||||
|  | 	void R_Register_Nut(HSQUIRRELVM v); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | public: | ||||||
|  | 	SquirrelClassEx() { | ||||||
|  | 		 | ||||||
|  | 	} | ||||||
|  | 	//初始化
 | ||||||
|  | 	void Init(); | ||||||
|  | 	//运行
 | ||||||
|  | 	void Run(); | ||||||
|  | 	//关闭
 | ||||||
|  | 	void Close(); | ||||||
|  | }; | ||||||
|  | @ -0,0 +1,95 @@ | ||||||
|  | #pragma once | ||||||
|  | #include <Windows.h> | ||||||
|  | #include <locale> | ||||||
|  | #include <codecvt> | ||||||
|  | 
 | ||||||
|  | #include "squirrel.h" | ||||||
|  | #include "sqstdaux.h" | ||||||
|  | #include "sqstdblob.h" | ||||||
|  | #include "sqstdio.h" | ||||||
|  | #include "sqstdmath.h" | ||||||
|  | #include "sqstdstring.h" | ||||||
|  | #include "sqstdsystem.h" | ||||||
|  | 
 | ||||||
|  | class TOOL | ||||||
|  | { | ||||||
|  | public: | ||||||
|  |     TOOL() {}; | ||||||
|  |     ~TOOL() {}; | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | public: | ||||||
|  | 	 | ||||||
|  |     static char* U8ToU16(const char* szU8) | ||||||
|  |     { | ||||||
|  |         //预转换,得到所需空间的大小
 | ||||||
|  |         int wcsLen = ::MultiByteToWideChar(CP_UTF8, NULL, szU8, strlen(szU8), NULL, 0); | ||||||
|  |         //分配空间要给'\0'留个空间,MultiByteToWideChar不会给'\0'空间
 | ||||||
|  |         wchar_t* wszString = new wchar_t[wcsLen + 1]; | ||||||
|  |         //转换
 | ||||||
|  |         ::MultiByteToWideChar(CP_UTF8, NULL, szU8, strlen(szU8), wszString, wcsLen); | ||||||
|  |         //最后加上'\0'
 | ||||||
|  |         wszString[wcsLen] = '\0'; | ||||||
|  | 
 | ||||||
|  |         char* m_char; | ||||||
|  |         int len = WideCharToMultiByte(CP_ACP, 0, wszString, wcslen(wszString), NULL, 0, NULL, NULL); | ||||||
|  |         m_char = new char[len + 1]; | ||||||
|  |         WideCharToMultiByte(CP_ACP, 0, wszString, wcslen(wszString), m_char, len, NULL, NULL); | ||||||
|  |         delete[]wszString; | ||||||
|  |         m_char[len] = '\0'; | ||||||
|  |         return m_char; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     static std::string SquirrelU2W(const SQChar* Str) | ||||||
|  |     { | ||||||
|  | 
 | ||||||
|  |         char* wbuffer = (char*)(Str); | ||||||
|  |         size_t len = 0; | ||||||
|  |         while (wbuffer[len] != 0 || wbuffer[len - 1] != 0) | ||||||
|  |         { | ||||||
|  |             ++len; | ||||||
|  |         } | ||||||
|  |         char* cbuffer = new char[len / 2 + 1]; | ||||||
|  |         int k = 0; | ||||||
|  |         for (size_t i = 0; i < len; i += 2) | ||||||
|  |         { | ||||||
|  |             cbuffer[k] = wbuffer[i]; | ||||||
|  |             ++k; | ||||||
|  |         } | ||||||
|  |         cbuffer[k] = '\0'; | ||||||
|  |         char* Text = U8ToU16(cbuffer); | ||||||
|  |         delete[]cbuffer; | ||||||
|  |         std::string RetStr(Text); | ||||||
|  |         delete[]Text; | ||||||
|  |         return RetStr; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     static char* ConvertAnsiToUtf8(const char* szAnsi) { | ||||||
|  |         // 第一步:将ANSI字符串转换为宽字符字符串
 | ||||||
|  |         int wcsLen = ::MultiByteToWideChar(CP_ACP, 0, szAnsi, -1, NULL, 0); | ||||||
|  |         wchar_t* wszString = new wchar_t[wcsLen]; | ||||||
|  |         ::MultiByteToWideChar(CP_ACP, 0, szAnsi, -1, wszString, wcsLen); | ||||||
|  | 
 | ||||||
|  |         // 第二步:将宽字符字符串转换回UTF-8字符串
 | ||||||
|  |         int utf8Len = ::WideCharToMultiByte(CP_UTF8, 0, wszString, wcsLen, NULL, 0, NULL, NULL); | ||||||
|  |         char* szUtf8 = new char[utf8Len]; | ||||||
|  |         ::WideCharToMultiByte(CP_UTF8, 0, wszString, wcsLen, szUtf8, utf8Len, NULL, NULL); | ||||||
|  | 
 | ||||||
|  |         delete[] wszString; // 释放宽字符字符串的内存
 | ||||||
|  | 
 | ||||||
|  |         szUtf8[utf8Len - 1] = '\0'; // 确保字符串以'\0'结尾
 | ||||||
|  |         return szUtf8; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     static  std::wstring charTowchar_t(std::string Str) | ||||||
|  |     { | ||||||
|  |         char* Sn = ConvertAnsiToUtf8(Str.c_str()); | ||||||
|  |         std::string B(Sn); | ||||||
|  |         std::wstring Ret(B.begin(), B.end()); | ||||||
|  |         delete[]Sn; | ||||||
|  |         //std::wcout << Ret << std::endl;
 | ||||||
|  |         return Ret; | ||||||
|  |     } | ||||||
|  | }; | ||||||
|  | @ -0,0 +1,178 @@ | ||||||
|  | #pragma once | ||||||
|  | 
 | ||||||
|  | #include <functional> | ||||||
|  | #include <mutex> | ||||||
|  | #include <list> | ||||||
|  | #include <thread> | ||||||
|  | #include <memory> | ||||||
|  | #include <atomic> | ||||||
|  | #include <stdio.h> | ||||||
|  | #include <map> | ||||||
|  | #include <sstream> | ||||||
|  | #include <condition_variable> | ||||||
|  | #include <assert.h> | ||||||
|  | 
 | ||||||
|  | #define WThreadPool_log(fmt, ...) {printf(fmt, ##__VA_ARGS__);printf("\n");fflush(stdout);} | ||||||
|  | 
 | ||||||
|  | #define WPOOL_MIN_THREAD_NUM 4 | ||||||
|  | #define WPOOL_MAX_THREAD_NUM 256 | ||||||
|  | #define WPOOL_MANAGE_SECONDS 20 | ||||||
|  | #define ADD_THREAD_BOUNDARY 1 | ||||||
|  | 
 | ||||||
|  | using EventFun = std::function<void ()>; | ||||||
|  | using int64 = long long int; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | template <typename T> | ||||||
|  | class LockQueue | ||||||
|  | { | ||||||
|  | public: | ||||||
|  |     LockQueue() | ||||||
|  |     { | ||||||
|  |         QueueNode* node = new QueueNode(); | ||||||
|  |         node->next = nullptr; | ||||||
|  |         // head->next is the first node, _tail point to last node, not _tail->next
 | ||||||
|  |         _head = node; | ||||||
|  |         _tail = _head; | ||||||
|  |     }; | ||||||
|  |     virtual ~LockQueue() | ||||||
|  |     { | ||||||
|  |         clear(); | ||||||
|  |         delete _head; | ||||||
|  |         _head = nullptr; | ||||||
|  |         _tail = nullptr; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     struct QueueNode | ||||||
|  |     { | ||||||
|  |         T value; | ||||||
|  |         QueueNode* next; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     bool enQueue(T data) | ||||||
|  |     { | ||||||
|  |         QueueNode* node = new (std::nothrow) QueueNode(); | ||||||
|  |         if (!node) | ||||||
|  |         { | ||||||
|  |             return false; | ||||||
|  |         } | ||||||
|  |         node->value = data; | ||||||
|  |         node->next = nullptr; | ||||||
|  | 
 | ||||||
|  |         std::unique_lock<std::mutex> locker(_mutex); | ||||||
|  |         _tail->next = node; | ||||||
|  |         _tail = node; | ||||||
|  |         _queueSize++; | ||||||
|  |         return true; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     bool deQueue(T& data) | ||||||
|  |     { | ||||||
|  |         std::unique_lock<std::mutex> locker(_mutex); | ||||||
|  |         QueueNode* currentFirstNode = _head->next; | ||||||
|  |         if (!currentFirstNode) | ||||||
|  |         { | ||||||
|  |             return false; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         _head->next = currentFirstNode->next; | ||||||
|  |         data = currentFirstNode->value; | ||||||
|  |         delete  currentFirstNode; | ||||||
|  |         _queueSize--; | ||||||
|  |         if (_queueSize == 0) | ||||||
|  |         { | ||||||
|  |             _tail = _head; | ||||||
|  |         } | ||||||
|  |         return true; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     int64_t size() | ||||||
|  |     { | ||||||
|  |         return _queueSize; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     void clear() | ||||||
|  |     { | ||||||
|  |         T data; | ||||||
|  |         while (deQueue(data)); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     bool empty() | ||||||
|  |     { | ||||||
|  |         return (_queueSize <= 0); | ||||||
|  |     } | ||||||
|  | private: | ||||||
|  |     QueueNode* _head; | ||||||
|  |     QueueNode* _tail; | ||||||
|  |     int64_t _queueSize = 0; | ||||||
|  |     std::mutex _mutex; | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | class WThreadPool | ||||||
|  | { | ||||||
|  | public: | ||||||
|  |     WThreadPool(); | ||||||
|  |     virtual ~WThreadPool(); | ||||||
|  | 
 | ||||||
|  |     static WThreadPool * globalInstance(); | ||||||
|  | 
 | ||||||
|  |     void setMaxThreadNum(int maxNum); | ||||||
|  |     bool waitForDone(int waitMs = -1); | ||||||
|  | 
 | ||||||
|  |     template<typename Func, typename ...Arguments > | ||||||
|  |     void concurrentRun(Func func, Arguments... args) { | ||||||
|  |         EventFun queunFun = std::bind(func, args...); | ||||||
|  |         enQueueEvent(queunFun); | ||||||
|  |         if (((int)_workThreadList.size() < _maxThreadNum) && | ||||||
|  |                 (_eventQueue.size() >= ((int)_workThreadList.size() - _busyThreadNum - ADD_THREAD_BOUNDARY))) | ||||||
|  |         { | ||||||
|  |            _mgrCondVar.notify_one(); | ||||||
|  |         } | ||||||
|  |         _workCondVar.notify_one(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     template<typename T> static int64_t threadIdToint64(T threadId) | ||||||
|  |     { | ||||||
|  |         std::string stid; | ||||||
|  |         stid.resize(32); | ||||||
|  |         snprintf((char *)stid.c_str(), 32, "%lld", threadId); | ||||||
|  |         long long int tid = std::stoll(stid); | ||||||
|  |         return tid; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     int _minThreadNum = WPOOL_MIN_THREAD_NUM; | ||||||
|  |     int _maxThreadNum = 8; | ||||||
|  |     std::atomic<int> _busyThreadNum = {0}; | ||||||
|  |     int _stepThreadNum = 4; | ||||||
|  |     volatile bool _exitAllFlag = false; | ||||||
|  |     std::atomic<int> _reduceThreadNum = {0}; | ||||||
|  | 
 | ||||||
|  |     std::shared_ptr<std::thread> _mgrThread; | ||||||
|  |     LockQueue<EventFun> _eventQueue; | ||||||
|  |     std::list<std::shared_ptr<std::thread>> _workThreadList; | ||||||
|  | 
 | ||||||
|  |     std::mutex _threadIsRunMutex; | ||||||
|  |     std::map<std::thread::id, bool> _threadIsRunMap; | ||||||
|  | 
 | ||||||
|  |     std::condition_variable _workCondVar; | ||||||
|  |     std::mutex _workMutex; | ||||||
|  |     std::condition_variable _mgrCondVar; | ||||||
|  |     std::mutex _mgrMutex; | ||||||
|  | 
 | ||||||
|  |     static std::shared_ptr<WThreadPool> s_threadPool; | ||||||
|  |     static std::mutex s_globleMutex; | ||||||
|  | 
 | ||||||
|  |     void enQueueEvent(EventFun fun); | ||||||
|  |     EventFun  deQueueEvent(); | ||||||
|  |     void run(); | ||||||
|  |     void managerThread(); | ||||||
|  |     void stop(); | ||||||
|  |     void startWorkThread(); | ||||||
|  |     void stopWorkThread(); | ||||||
|  |     void adjustWorkThread(); | ||||||
|  | }; | ||||||
|  | 
 | ||||||
							
								
								
									
										
											BIN
										
									
								
								logo/logo.ico
								
								
								
								
							
							
						
						| Before Width: | Height: | Size: 2.3 KiB | 
							
								
								
									
										
											BIN
										
									
								
								logo/logo.png
								
								
								
								
							
							
						
						| Before Width: | Height: | Size: 21 KiB | 
| Before Width: | Height: | Size: 42 KiB | 
| Before Width: | Height: | Size: 42 KiB | 
| Before Width: | Height: | Size: 46 KiB | 
| Before Width: | Height: | Size: 2.1 KiB | 
| Before Width: | Height: | Size: 18 KiB | 
|  | @ -1,264 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Box2D.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Collision\b2BroadPhase.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Collision\b2Collision.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Collision\b2Distance.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Collision\b2DynamicTree.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Collision\b2TimeOfImpact.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Collision\Shapes\b2ChainShape.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Collision\Shapes\b2CircleShape.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Collision\Shapes\b2EdgeShape.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Collision\Shapes\b2PolygonShape.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Collision\Shapes\b2Shape.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Common\b2BlockAllocator.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Common\b2Draw.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Common\b2GrowableStack.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Common\b2Math.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Common\b2Settings.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Common\b2StackAllocator.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Common\b2Timer.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2Body.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2ContactManager.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2Fixture.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2Island.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2TimeStep.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2World.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2WorldCallbacks.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2ChainAndCircleContact.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2ChainAndPolygonContact.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2CircleContact.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2Contact.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2ContactSolver.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2EdgeAndCircleContact.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2EdgeAndPolygonContact.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2PolygonAndCircleContact.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2PolygonContact.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2DistanceJoint.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2FrictionJoint.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2GearJoint.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2Joint.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2MotorJoint.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2MouseJoint.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2PrismaticJoint.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2PulleyJoint.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2RevoluteJoint.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2RopeJoint.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2WeldJoint.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2WheelJoint.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Rope\b2Rope.h" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\b2BroadPhase.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\b2CollideCircle.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\b2CollideEdge.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\b2CollidePolygon.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\b2Collision.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\b2Distance.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\b2DynamicTree.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\b2TimeOfImpact.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\Shapes\b2ChainShape.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\Shapes\b2CircleShape.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\Shapes\b2EdgeShape.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\Shapes\b2PolygonShape.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Common\b2BlockAllocator.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Common\b2Draw.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Common\b2Math.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Common\b2Settings.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Common\b2StackAllocator.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Common\b2Timer.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2Body.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2ContactManager.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2Fixture.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2Island.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2World.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2WorldCallbacks.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2ChainAndCircleContact.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2ChainAndPolygonContact.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2CircleContact.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2Contact.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2ContactSolver.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2EdgeAndCircleContact.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2EdgeAndPolygonContact.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2PolygonAndCircleContact.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2PolygonContact.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2DistanceJoint.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2FrictionJoint.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2GearJoint.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2Joint.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2MotorJoint.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2MouseJoint.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2PrismaticJoint.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2PulleyJoint.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2RevoluteJoint.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2RopeJoint.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2WeldJoint.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2WheelJoint.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Rope\b2Rope.cpp" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup Label="ProjectConfigurations"> |  | ||||||
|     <ProjectConfiguration Include="Debug|Win32"> |  | ||||||
|       <Configuration>Debug</Configuration> |  | ||||||
|       <Platform>Win32</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Release|Win32"> |  | ||||||
|       <Configuration>Release</Configuration> |  | ||||||
|       <Platform>Win32</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Debug|x64"> |  | ||||||
|       <Configuration>Debug</Configuration> |  | ||||||
|       <Platform>x64</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Release|x64"> |  | ||||||
|       <Configuration>Release</Configuration> |  | ||||||
|       <Platform>x64</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <PropertyGroup Label="Globals"> |  | ||||||
|     <ProjectGuid>{0CBA9295-F14D-4966-A7C4-1DD68158176C}</ProjectGuid> |  | ||||||
|     <RootNamespace>libBox2D</RootNamespace> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>true</UseDebugLibraries> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>false</UseDebugLibraries> |  | ||||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>true</UseDebugLibraries> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>false</UseDebugLibraries> |  | ||||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |  | ||||||
|   <ImportGroup Label="ExtensionSettings"> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="Shared"> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <PropertyGroup Label="UserMacros" /> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>true</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>false</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>true</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>false</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>Disabled</Optimization> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>None</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>MaxSpeed</Optimization> |  | ||||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> |  | ||||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> |  | ||||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>None</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>false</GenerateDebugInformation> |  | ||||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> |  | ||||||
|       <OptimizeReferences>true</OptimizeReferences> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>Disabled</Optimization> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>None</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>MaxSpeed</Optimization> |  | ||||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> |  | ||||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> |  | ||||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>None</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>false</GenerateDebugInformation> |  | ||||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> |  | ||||||
|       <OptimizeReferences>true</OptimizeReferences> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |  | ||||||
|   <ImportGroup Label="ExtensionTargets"> |  | ||||||
|   </ImportGroup> |  | ||||||
| </Project> |  | ||||||
|  | @ -1,307 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <Filter Include="Collision"> |  | ||||||
|       <UniqueIdentifier>{100df8bf-ec25-491c-85d3-75e498f6afb2}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="Collision\Shapes"> |  | ||||||
|       <UniqueIdentifier>{c1685b07-79ba-4fd0-bc68-167809eeac15}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="Common"> |  | ||||||
|       <UniqueIdentifier>{890e188f-6f12-4236-904d-26a9251b2fbd}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="Dynamics"> |  | ||||||
|       <UniqueIdentifier>{a32ce909-1b1c-4733-b5fc-6ec63219d303}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="Rope"> |  | ||||||
|       <UniqueIdentifier>{c0c4ea0d-0f35-4eaf-b30e-bf63dc1cb485}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="Dynamics\Joints"> |  | ||||||
|       <UniqueIdentifier>{beca7c8f-5051-4b18-a714-bcd98a3ab006}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="Dynamics\Contacts"> |  | ||||||
|       <UniqueIdentifier>{0b4fe2be-741e-4723-83ca-ed057820ee89}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Rope\b2Rope.h"> |  | ||||||
|       <Filter>Rope</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2Body.h"> |  | ||||||
|       <Filter>Dynamics</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2ContactManager.h"> |  | ||||||
|       <Filter>Dynamics</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2Fixture.h"> |  | ||||||
|       <Filter>Dynamics</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2Island.h"> |  | ||||||
|       <Filter>Dynamics</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2TimeStep.h"> |  | ||||||
|       <Filter>Dynamics</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2World.h"> |  | ||||||
|       <Filter>Dynamics</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2WorldCallbacks.h"> |  | ||||||
|       <Filter>Dynamics</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2DistanceJoint.h"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2FrictionJoint.h"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2GearJoint.h"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2Joint.h"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2MotorJoint.h"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2MouseJoint.h"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2PrismaticJoint.h"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2PulleyJoint.h"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2RevoluteJoint.h"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2RopeJoint.h"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2WeldJoint.h"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2WheelJoint.h"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2ChainAndCircleContact.h"> |  | ||||||
|       <Filter>Dynamics\Contacts</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2ChainAndPolygonContact.h"> |  | ||||||
|       <Filter>Dynamics\Contacts</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2CircleContact.h"> |  | ||||||
|       <Filter>Dynamics\Contacts</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2Contact.h"> |  | ||||||
|       <Filter>Dynamics\Contacts</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2ContactSolver.h"> |  | ||||||
|       <Filter>Dynamics\Contacts</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2EdgeAndCircleContact.h"> |  | ||||||
|       <Filter>Dynamics\Contacts</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2EdgeAndPolygonContact.h"> |  | ||||||
|       <Filter>Dynamics\Contacts</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2PolygonAndCircleContact.h"> |  | ||||||
|       <Filter>Dynamics\Contacts</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2PolygonContact.h"> |  | ||||||
|       <Filter>Dynamics\Contacts</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Common\b2BlockAllocator.h"> |  | ||||||
|       <Filter>Common</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Common\b2Draw.h"> |  | ||||||
|       <Filter>Common</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Common\b2GrowableStack.h"> |  | ||||||
|       <Filter>Common</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Common\b2Math.h"> |  | ||||||
|       <Filter>Common</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Common\b2Settings.h"> |  | ||||||
|       <Filter>Common</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Common\b2StackAllocator.h"> |  | ||||||
|       <Filter>Common</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Common\b2Timer.h"> |  | ||||||
|       <Filter>Common</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Collision\b2BroadPhase.h"> |  | ||||||
|       <Filter>Collision</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Collision\b2Collision.h"> |  | ||||||
|       <Filter>Collision</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Collision\b2Distance.h"> |  | ||||||
|       <Filter>Collision</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Collision\b2DynamicTree.h"> |  | ||||||
|       <Filter>Collision</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Collision\b2TimeOfImpact.h"> |  | ||||||
|       <Filter>Collision</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Collision\Shapes\b2ChainShape.h"> |  | ||||||
|       <Filter>Collision\Shapes</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Collision\Shapes\b2CircleShape.h"> |  | ||||||
|       <Filter>Collision\Shapes</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Collision\Shapes\b2EdgeShape.h"> |  | ||||||
|       <Filter>Collision\Shapes</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Collision\Shapes\b2PolygonShape.h"> |  | ||||||
|       <Filter>Collision\Shapes</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Collision\Shapes\b2Shape.h"> |  | ||||||
|       <Filter>Collision\Shapes</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\Box2D\Box2D.h" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Rope\b2Rope.cpp"> |  | ||||||
|       <Filter>Rope</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2Body.cpp"> |  | ||||||
|       <Filter>Dynamics</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2ContactManager.cpp"> |  | ||||||
|       <Filter>Dynamics</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2Fixture.cpp"> |  | ||||||
|       <Filter>Dynamics</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2Island.cpp"> |  | ||||||
|       <Filter>Dynamics</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2World.cpp"> |  | ||||||
|       <Filter>Dynamics</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\b2WorldCallbacks.cpp"> |  | ||||||
|       <Filter>Dynamics</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2DistanceJoint.cpp"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2FrictionJoint.cpp"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2GearJoint.cpp"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2Joint.cpp"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2MotorJoint.cpp"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2MouseJoint.cpp"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2PrismaticJoint.cpp"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2PulleyJoint.cpp"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2RevoluteJoint.cpp"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2RopeJoint.cpp"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2WeldJoint.cpp"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Joints\b2WheelJoint.cpp"> |  | ||||||
|       <Filter>Dynamics\Joints</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2ChainAndCircleContact.cpp"> |  | ||||||
|       <Filter>Dynamics\Contacts</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2ChainAndPolygonContact.cpp"> |  | ||||||
|       <Filter>Dynamics\Contacts</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2CircleContact.cpp"> |  | ||||||
|       <Filter>Dynamics\Contacts</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2Contact.cpp"> |  | ||||||
|       <Filter>Dynamics\Contacts</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2ContactSolver.cpp"> |  | ||||||
|       <Filter>Dynamics\Contacts</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2EdgeAndCircleContact.cpp"> |  | ||||||
|       <Filter>Dynamics\Contacts</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2EdgeAndPolygonContact.cpp"> |  | ||||||
|       <Filter>Dynamics\Contacts</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2PolygonAndCircleContact.cpp"> |  | ||||||
|       <Filter>Dynamics\Contacts</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Dynamics\Contacts\b2PolygonContact.cpp"> |  | ||||||
|       <Filter>Dynamics\Contacts</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Common\b2BlockAllocator.cpp"> |  | ||||||
|       <Filter>Common</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Common\b2Draw.cpp"> |  | ||||||
|       <Filter>Common</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Common\b2Math.cpp"> |  | ||||||
|       <Filter>Common</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Common\b2Settings.cpp"> |  | ||||||
|       <Filter>Common</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Common\b2StackAllocator.cpp"> |  | ||||||
|       <Filter>Common</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Common\b2Timer.cpp"> |  | ||||||
|       <Filter>Common</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\b2BroadPhase.cpp"> |  | ||||||
|       <Filter>Collision</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\b2CollideCircle.cpp"> |  | ||||||
|       <Filter>Collision</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\b2CollideEdge.cpp"> |  | ||||||
|       <Filter>Collision</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\b2CollidePolygon.cpp"> |  | ||||||
|       <Filter>Collision</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\b2Collision.cpp"> |  | ||||||
|       <Filter>Collision</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\b2Distance.cpp"> |  | ||||||
|       <Filter>Collision</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\b2DynamicTree.cpp"> |  | ||||||
|       <Filter>Collision</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\b2TimeOfImpact.cpp"> |  | ||||||
|       <Filter>Collision</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\Shapes\b2ChainShape.cpp"> |  | ||||||
|       <Filter>Collision\Shapes</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\Shapes\b2CircleShape.cpp"> |  | ||||||
|       <Filter>Collision\Shapes</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\Shapes\b2EdgeShape.cpp"> |  | ||||||
|       <Filter>Collision\Shapes</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\Box2D\Collision\Shapes\b2PolygonShape.cpp"> |  | ||||||
|       <Filter>Collision\Shapes</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|   </ItemGroup> |  | ||||||
| </Project> |  | ||||||
|  | @ -1,183 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\imgui\imconfig.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\imgui\imgui.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\imgui\imgui_internal.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\imgui\imgui_stdlib.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\imgui\imstb_rectpack.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\imgui\imstb_textedit.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\imgui\imstb_truetype.h" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\imgui\imgui.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\imgui\imgui_draw.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\imgui\imgui_stdlib.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\imgui\imgui_tables.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\imgui\imgui_widgets.cpp" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup Label="ProjectConfigurations"> |  | ||||||
|     <ProjectConfiguration Include="Debug|Win32"> |  | ||||||
|       <Configuration>Debug</Configuration> |  | ||||||
|       <Platform>Win32</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Release|Win32"> |  | ||||||
|       <Configuration>Release</Configuration> |  | ||||||
|       <Platform>Win32</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Debug|x64"> |  | ||||||
|       <Configuration>Debug</Configuration> |  | ||||||
|       <Platform>x64</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Release|x64"> |  | ||||||
|       <Configuration>Release</Configuration> |  | ||||||
|       <Platform>x64</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <PropertyGroup Label="Globals"> |  | ||||||
|     <ProjectGuid>{7FA1E56D-62AC-47D1-97D1-40B302724198}</ProjectGuid> |  | ||||||
|     <RootNamespace>libimgui</RootNamespace> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>true</UseDebugLibraries> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>false</UseDebugLibraries> |  | ||||||
|     <WholeProgramOptimization>false</WholeProgramOptimization> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>true</UseDebugLibraries> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>false</UseDebugLibraries> |  | ||||||
|     <WholeProgramOptimization>false</WholeProgramOptimization> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |  | ||||||
|   <ImportGroup Label="ExtensionSettings"> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="Shared"> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <PropertyGroup Label="UserMacros" /> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>true</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>false</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>true</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>false</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>Disabled</Optimization> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>None</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>MaxSpeed</Optimization> |  | ||||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> |  | ||||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> |  | ||||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>None</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>false</GenerateDebugInformation> |  | ||||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> |  | ||||||
|       <OptimizeReferences>true</OptimizeReferences> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>Disabled</Optimization> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>None</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>MaxSpeed</Optimization> |  | ||||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> |  | ||||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> |  | ||||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>None</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>false</GenerateDebugInformation> |  | ||||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> |  | ||||||
|       <OptimizeReferences>true</OptimizeReferences> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |  | ||||||
|   <ImportGroup Label="ExtensionTargets"> |  | ||||||
|   </ImportGroup> |  | ||||||
| </Project> |  | ||||||
|  | @ -1,51 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <Filter Include="include"> |  | ||||||
|       <UniqueIdentifier>{6160FE38-37E6-41B0-9EAC-17047E5FB604}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="src"> |  | ||||||
|       <UniqueIdentifier>{679F9030-0259-4621-87DD-08D71081C409}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\imgui\imconfig.h"> |  | ||||||
|       <Filter>include</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\imgui\imgui.h"> |  | ||||||
|       <Filter>include</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\imgui\imgui_internal.h"> |  | ||||||
|       <Filter>include</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\imgui\imstb_rectpack.h"> |  | ||||||
|       <Filter>include</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\imgui\imstb_textedit.h"> |  | ||||||
|       <Filter>include</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\imgui\imstb_truetype.h"> |  | ||||||
|       <Filter>include</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\imgui\imgui_stdlib.h"> |  | ||||||
|       <Filter>include</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\imgui\imgui.cpp"> |  | ||||||
|       <Filter>src</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\imgui\imgui_draw.cpp"> |  | ||||||
|       <Filter>src</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\imgui\imgui_widgets.cpp"> |  | ||||||
|       <Filter>src</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\imgui\imgui_tables.cpp"> |  | ||||||
|       <Filter>src</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\imgui\imgui_stdlib.cpp"> |  | ||||||
|       <Filter>src</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|   </ItemGroup> |  | ||||||
| </Project> |  | ||||||
|  | @ -1,176 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |  | ||||||
|   <ItemGroup Label="ProjectConfigurations"> |  | ||||||
|     <ProjectConfiguration Include="Debug|Win32"> |  | ||||||
|       <Configuration>Debug</Configuration> |  | ||||||
|       <Platform>Win32</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Release|Win32"> |  | ||||||
|       <Configuration>Release</Configuration> |  | ||||||
|       <Platform>Win32</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Debug|x64"> |  | ||||||
|       <Configuration>Debug</Configuration> |  | ||||||
|       <Platform>x64</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Release|x64"> |  | ||||||
|       <Configuration>Release</Configuration> |  | ||||||
|       <Platform>x64</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\ogg\bitwise.c" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\ogg\framing.c" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\ogg\crctable.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\ogg\ogg.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\ogg\os_types.h" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <PropertyGroup Label="Globals"> |  | ||||||
|     <ProjectGuid>{D8A5E8EC-3983-4028-9BA9-B1E337E75917}</ProjectGuid> |  | ||||||
|     <RootNamespace>libogg</RootNamespace> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>true</UseDebugLibraries> |  | ||||||
|     <CharacterSet>MultiByte</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>false</UseDebugLibraries> |  | ||||||
|     <WholeProgramOptimization>false</WholeProgramOptimization> |  | ||||||
|     <CharacterSet>MultiByte</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>true</UseDebugLibraries> |  | ||||||
|     <CharacterSet>MultiByte</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>false</UseDebugLibraries> |  | ||||||
|     <WholeProgramOptimization>false</WholeProgramOptimization> |  | ||||||
|     <CharacterSet>MultiByte</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |  | ||||||
|   <ImportGroup Label="ExtensionSettings"> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="Shared"> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <PropertyGroup Label="UserMacros" /> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>true</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>false</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>true</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>false</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>Disabled</Optimization> |  | ||||||
|       <DebugInformationFormat>None</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|       <DisableSpecificWarnings>4244;%(DisableSpecificWarnings)</DisableSpecificWarnings> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>MaxSpeed</Optimization> |  | ||||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> |  | ||||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> |  | ||||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> |  | ||||||
|       <DebugInformationFormat>None</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|       <DisableSpecificWarnings>4244;%(DisableSpecificWarnings)</DisableSpecificWarnings> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>false</GenerateDebugInformation> |  | ||||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> |  | ||||||
|       <OptimizeReferences>true</OptimizeReferences> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>Disabled</Optimization> |  | ||||||
|       <DebugInformationFormat>None</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|       <DisableSpecificWarnings>4244;%(DisableSpecificWarnings)</DisableSpecificWarnings> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>MaxSpeed</Optimization> |  | ||||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> |  | ||||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> |  | ||||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> |  | ||||||
|       <DebugInformationFormat>None</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|       <DisableSpecificWarnings>4244;%(DisableSpecificWarnings)</DisableSpecificWarnings> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>false</GenerateDebugInformation> |  | ||||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> |  | ||||||
|       <OptimizeReferences>true</OptimizeReferences> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |  | ||||||
|   <ImportGroup Label="ExtensionTargets"> |  | ||||||
|   </ImportGroup> |  | ||||||
| </Project> |  | ||||||
|  | @ -1,30 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <Filter Include="include"> |  | ||||||
|       <UniqueIdentifier>{6160FE38-37E6-41B0-9EAC-17047E5FB604}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="src"> |  | ||||||
|       <UniqueIdentifier>{679F9030-0259-4621-87DD-08D71081C409}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\ogg\bitwise.c"> |  | ||||||
|       <Filter>src</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\ogg\framing.c"> |  | ||||||
|       <Filter>src</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\ogg\crctable.h"> |  | ||||||
|       <Filter>include</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\ogg\ogg.h"> |  | ||||||
|       <Filter>include</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\ogg\os_types.h"> |  | ||||||
|       <Filter>include</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|   </ItemGroup> |  | ||||||
| </Project> |  | ||||||
|  | @ -1,256 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |  | ||||||
|   <ItemGroup Label="ProjectConfigurations"> |  | ||||||
|     <ProjectConfiguration Include="Debug|Win32"> |  | ||||||
|       <Configuration>Debug</Configuration> |  | ||||||
|       <Platform>Win32</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Release|Win32"> |  | ||||||
|       <Configuration>Release</Configuration> |  | ||||||
|       <Platform>Win32</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Debug|x64"> |  | ||||||
|       <Configuration>Debug</Configuration> |  | ||||||
|       <Platform>x64</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Release|x64"> |  | ||||||
|       <Configuration>Release</Configuration> |  | ||||||
|       <Platform>x64</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\codec.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\backends.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\bitrate.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\codebook.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\codec_internal.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\envelope.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\highlevel.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\lookup.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\lookup_data.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\lpc.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\lsp.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\masking.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\mdct.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\misc.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\os.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\psy.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\registry.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\scales.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\smallft.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\window.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\vorbisenc.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\vorbisfile.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\books\floor\floor_books.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\books\coupled\res_books_stereo.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\books\uncoupled\res_books_uncoupled.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\floor_all.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\psych_11.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\psych_16.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\psych_44.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\psych_8.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\residue_16.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\residue_44.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\residue_44u.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\residue_8.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\setup_11.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\setup_16.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\setup_22.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\setup_32.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\setup_44.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\setup_44u.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\setup_8.h" /> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\setup_X.h" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\analysis.c" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\barkmel.c" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\bitrate.c" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\block.c" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\codebook.c" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\envelope.c" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\floor0.c" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\floor1.c" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\info.c" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\lookup.c" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\lpc.c" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\lsp.c" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\mapping0.c" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\mdct.c" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\psy.c" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\registry.c" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\res0.c" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\sharedbook.c" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\smallft.c" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\synthesis.c" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\vorbisenc.c" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\vorbisfile.c" /> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\window.c" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <None Include="..\..\..\src\3rd-party\vorbis\lib\lookups.pl" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ProjectReference Include="..\libogg\libogg.vcxproj"> |  | ||||||
|       <Project>{d8a5e8ec-3983-4028-9ba9-b1e337e75917}</Project> |  | ||||||
|     </ProjectReference> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <PropertyGroup Label="Globals"> |  | ||||||
|     <ProjectGuid>{B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}</ProjectGuid> |  | ||||||
|     <RootNamespace>libvorbis</RootNamespace> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>true</UseDebugLibraries> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>false</UseDebugLibraries> |  | ||||||
|     <WholeProgramOptimization>false</WholeProgramOptimization> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>true</UseDebugLibraries> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>false</UseDebugLibraries> |  | ||||||
|     <WholeProgramOptimization>false</WholeProgramOptimization> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |  | ||||||
|   <ImportGroup Label="ExtensionSettings"> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="Shared"> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <PropertyGroup Label="UserMacros" /> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>true</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>false</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>true</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>false</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>Disabled</Optimization> |  | ||||||
|       <DebugInformationFormat>None</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBVORBIS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> |  | ||||||
|       <CompileAs>CompileAsC</CompileAs> |  | ||||||
|       <DisableSpecificWarnings>4244;4100;4267;4189;4305;4127;4706;%(DisableSpecificWarnings)</DisableSpecificWarnings> |  | ||||||
|       <CallingConvention>Cdecl</CallingConvention> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>MaxSpeed</Optimization> |  | ||||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> |  | ||||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> |  | ||||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> |  | ||||||
|       <DebugInformationFormat>None</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBVORBIS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> |  | ||||||
|       <CompileAs>CompileAsC</CompileAs> |  | ||||||
|       <DisableSpecificWarnings>4244;4100;4267;4189;4305;4127;4706;%(DisableSpecificWarnings)</DisableSpecificWarnings> |  | ||||||
|       <CallingConvention>Cdecl</CallingConvention> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>false</GenerateDebugInformation> |  | ||||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> |  | ||||||
|       <OptimizeReferences>true</OptimizeReferences> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>Disabled</Optimization> |  | ||||||
|       <DebugInformationFormat>None</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBVORBIS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> |  | ||||||
|       <CompileAs>CompileAsC</CompileAs> |  | ||||||
|       <DisableSpecificWarnings>4244;4100;4267;4189;4305;4127;4706;%(DisableSpecificWarnings)</DisableSpecificWarnings> |  | ||||||
|       <CallingConvention>Cdecl</CallingConvention> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>MaxSpeed</Optimization> |  | ||||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> |  | ||||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> |  | ||||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> |  | ||||||
|       <DebugInformationFormat>None</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBVORBIS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> |  | ||||||
|       <CompileAs>CompileAsC</CompileAs> |  | ||||||
|       <DisableSpecificWarnings>4244;4100;4267;4189;4305;4127;4706;%(DisableSpecificWarnings)</DisableSpecificWarnings> |  | ||||||
|       <CallingConvention>Cdecl</CallingConvention> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>false</GenerateDebugInformation> |  | ||||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> |  | ||||||
|       <OptimizeReferences>true</OptimizeReferences> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |  | ||||||
|   <ImportGroup Label="ExtensionTargets"> |  | ||||||
|   </ImportGroup> |  | ||||||
| </Project> |  | ||||||
|  | @ -1,215 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <Filter Include="include"> |  | ||||||
|       <UniqueIdentifier>{6160FE38-37E6-41B0-9EAC-17047E5FB604}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="lib"> |  | ||||||
|       <UniqueIdentifier>{679F9030-0259-4621-87DD-08D71081C409}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\codec.h"> |  | ||||||
|       <Filter>include</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\vorbisenc.h"> |  | ||||||
|       <Filter>include</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\vorbisfile.h"> |  | ||||||
|       <Filter>include</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\backends.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\bitrate.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\codebook.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\codec_internal.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\envelope.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\highlevel.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\lookup.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\lookup_data.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\lpc.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\lsp.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\masking.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\mdct.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\misc.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\os.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\psy.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\registry.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\scales.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\smallft.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\window.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\books\floor\floor_books.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\books\coupled\res_books_stereo.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\books\uncoupled\res_books_uncoupled.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\floor_all.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\psych_11.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\psych_16.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\psych_44.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\psych_8.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\residue_16.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\residue_44.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\residue_44u.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\residue_8.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\setup_11.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\setup_16.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\setup_22.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\setup_32.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\setup_44.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\setup_44u.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\setup_8.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\..\src\3rd-party\vorbis\lib\modes\setup_X.h"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\analysis.c"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\barkmel.c"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\bitrate.c"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\block.c"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\codebook.c"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\envelope.c"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\floor0.c"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\floor1.c"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\info.c"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\lookup.c"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\lpc.c"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\lsp.c"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\mapping0.c"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\mdct.c"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\psy.c"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\registry.c"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\res0.c"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\sharedbook.c"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\smallft.c"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\synthesis.c"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\vorbisenc.c"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\vorbisfile.c"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\..\src\3rd-party\vorbis\lib\window.c"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <None Include="..\..\..\src\3rd-party\vorbis\lib\lookups.pl"> |  | ||||||
|       <Filter>lib</Filter> |  | ||||||
|     </None> |  | ||||||
|   </ItemGroup> |  | ||||||
| </Project> |  | ||||||
|  | @ -1,109 +0,0 @@ | ||||||
| Microsoft Visual Studio Solution File, Format Version 12.00 |  | ||||||
| # Visual Studio Version 16 |  | ||||||
| VisualStudioVersion = 16.0.28729.10 |  | ||||||
| MinimumVisualStudioVersion = 10.0.40219.1 |  | ||||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kiwano", "kiwano\kiwano.vcxproj", "{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}" |  | ||||||
| EndProject |  | ||||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kiwano-audio", "kiwano-audio\kiwano-audio.vcxproj", "{1B97937D-8184-426C-BE71-29A163DC76C9}" |  | ||||||
| EndProject |  | ||||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kiwano-imgui", "kiwano-imgui\kiwano-imgui.vcxproj", "{A7062ED8-8910-48A5-A3BC-C1612672571F}" |  | ||||||
| EndProject |  | ||||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kiwano-physics", "kiwano-physics\kiwano-physics.vcxproj", "{DF599AFB-744F-41E5-AF0C-2146F90575C8}" |  | ||||||
| EndProject |  | ||||||
| Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3rd-party", "3rd-party", "{2D8919F2-8922-4B3F-8F68-D4127C6BCBB7}" |  | ||||||
| EndProject |  | ||||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libimgui", "3rd-party\imgui\libimgui.vcxproj", "{7FA1E56D-62AC-47D1-97D1-40B302724198}" |  | ||||||
| EndProject |  | ||||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libBox2D", "3rd-party\Box2D\libBox2D.vcxproj", "{0CBA9295-F14D-4966-A7C4-1DD68158176C}" |  | ||||||
| EndProject |  | ||||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libogg", "3rd-party\libogg\libogg.vcxproj", "{D8A5E8EC-3983-4028-9BA9-B1E337E75917}" |  | ||||||
| EndProject |  | ||||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libvorbis", "3rd-party\vorbis\libvorbis.vcxproj", "{B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}" |  | ||||||
| EndProject |  | ||||||
| Global |  | ||||||
| 	GlobalSection(SolutionConfigurationPlatforms) = preSolution |  | ||||||
| 		Debug|Win32 = Debug|Win32 |  | ||||||
| 		Debug|x64 = Debug|x64 |  | ||||||
| 		Release|Win32 = Release|Win32 |  | ||||||
| 		Release|x64 = Release|x64 |  | ||||||
| 	EndGlobalSection |  | ||||||
| 	GlobalSection(ProjectConfigurationPlatforms) = postSolution |  | ||||||
| 		{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|Win32.ActiveCfg = Debug|Win32 |  | ||||||
| 		{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|Win32.Build.0 = Debug|Win32 |  | ||||||
| 		{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|Win32.Deploy.0 = Debug|Win32 |  | ||||||
| 		{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|x64.ActiveCfg = Debug|x64 |  | ||||||
| 		{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Debug|x64.Build.0 = Debug|x64 |  | ||||||
| 		{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Release|Win32.ActiveCfg = Release|Win32 |  | ||||||
| 		{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Release|Win32.Build.0 = Release|Win32 |  | ||||||
| 		{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Release|x64.ActiveCfg = Release|x64 |  | ||||||
| 		{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}.Release|x64.Build.0 = Release|x64 |  | ||||||
| 		{1B97937D-8184-426C-BE71-29A163DC76C9}.Debug|Win32.ActiveCfg = Debug|Win32 |  | ||||||
| 		{1B97937D-8184-426C-BE71-29A163DC76C9}.Debug|Win32.Build.0 = Debug|Win32 |  | ||||||
| 		{1B97937D-8184-426C-BE71-29A163DC76C9}.Debug|x64.ActiveCfg = Debug|x64 |  | ||||||
| 		{1B97937D-8184-426C-BE71-29A163DC76C9}.Debug|x64.Build.0 = Debug|x64 |  | ||||||
| 		{1B97937D-8184-426C-BE71-29A163DC76C9}.Release|Win32.ActiveCfg = Release|Win32 |  | ||||||
| 		{1B97937D-8184-426C-BE71-29A163DC76C9}.Release|Win32.Build.0 = Release|Win32 |  | ||||||
| 		{1B97937D-8184-426C-BE71-29A163DC76C9}.Release|x64.ActiveCfg = Release|x64 |  | ||||||
| 		{1B97937D-8184-426C-BE71-29A163DC76C9}.Release|x64.Build.0 = Release|x64 |  | ||||||
| 		{A7062ED8-8910-48A5-A3BC-C1612672571F}.Debug|Win32.ActiveCfg = Debug|Win32 |  | ||||||
| 		{A7062ED8-8910-48A5-A3BC-C1612672571F}.Debug|Win32.Build.0 = Debug|Win32 |  | ||||||
| 		{A7062ED8-8910-48A5-A3BC-C1612672571F}.Debug|x64.ActiveCfg = Debug|x64 |  | ||||||
| 		{A7062ED8-8910-48A5-A3BC-C1612672571F}.Debug|x64.Build.0 = Debug|x64 |  | ||||||
| 		{A7062ED8-8910-48A5-A3BC-C1612672571F}.Release|Win32.ActiveCfg = Release|Win32 |  | ||||||
| 		{A7062ED8-8910-48A5-A3BC-C1612672571F}.Release|Win32.Build.0 = Release|Win32 |  | ||||||
| 		{A7062ED8-8910-48A5-A3BC-C1612672571F}.Release|x64.ActiveCfg = Release|x64 |  | ||||||
| 		{A7062ED8-8910-48A5-A3BC-C1612672571F}.Release|x64.Build.0 = Release|x64 |  | ||||||
| 		{DF599AFB-744F-41E5-AF0C-2146F90575C8}.Debug|Win32.ActiveCfg = Debug|Win32 |  | ||||||
| 		{DF599AFB-744F-41E5-AF0C-2146F90575C8}.Debug|Win32.Build.0 = Debug|Win32 |  | ||||||
| 		{DF599AFB-744F-41E5-AF0C-2146F90575C8}.Debug|x64.ActiveCfg = Debug|x64 |  | ||||||
| 		{DF599AFB-744F-41E5-AF0C-2146F90575C8}.Debug|x64.Build.0 = Debug|x64 |  | ||||||
| 		{DF599AFB-744F-41E5-AF0C-2146F90575C8}.Release|Win32.ActiveCfg = Release|Win32 |  | ||||||
| 		{DF599AFB-744F-41E5-AF0C-2146F90575C8}.Release|Win32.Build.0 = Release|Win32 |  | ||||||
| 		{DF599AFB-744F-41E5-AF0C-2146F90575C8}.Release|x64.ActiveCfg = Release|x64 |  | ||||||
| 		{DF599AFB-744F-41E5-AF0C-2146F90575C8}.Release|x64.Build.0 = Release|x64 |  | ||||||
| 		{7FA1E56D-62AC-47D1-97D1-40B302724198}.Debug|Win32.ActiveCfg = Debug|Win32 |  | ||||||
| 		{7FA1E56D-62AC-47D1-97D1-40B302724198}.Debug|Win32.Build.0 = Debug|Win32 |  | ||||||
| 		{7FA1E56D-62AC-47D1-97D1-40B302724198}.Debug|x64.ActiveCfg = Debug|x64 |  | ||||||
| 		{7FA1E56D-62AC-47D1-97D1-40B302724198}.Debug|x64.Build.0 = Debug|x64 |  | ||||||
| 		{7FA1E56D-62AC-47D1-97D1-40B302724198}.Release|Win32.ActiveCfg = Release|Win32 |  | ||||||
| 		{7FA1E56D-62AC-47D1-97D1-40B302724198}.Release|Win32.Build.0 = Release|Win32 |  | ||||||
| 		{7FA1E56D-62AC-47D1-97D1-40B302724198}.Release|x64.ActiveCfg = Release|x64 |  | ||||||
| 		{7FA1E56D-62AC-47D1-97D1-40B302724198}.Release|x64.Build.0 = Release|x64 |  | ||||||
| 		{0CBA9295-F14D-4966-A7C4-1DD68158176C}.Debug|Win32.ActiveCfg = Debug|Win32 |  | ||||||
| 		{0CBA9295-F14D-4966-A7C4-1DD68158176C}.Debug|Win32.Build.0 = Debug|Win32 |  | ||||||
| 		{0CBA9295-F14D-4966-A7C4-1DD68158176C}.Debug|x64.ActiveCfg = Debug|x64 |  | ||||||
| 		{0CBA9295-F14D-4966-A7C4-1DD68158176C}.Debug|x64.Build.0 = Debug|x64 |  | ||||||
| 		{0CBA9295-F14D-4966-A7C4-1DD68158176C}.Release|Win32.ActiveCfg = Release|Win32 |  | ||||||
| 		{0CBA9295-F14D-4966-A7C4-1DD68158176C}.Release|Win32.Build.0 = Release|Win32 |  | ||||||
| 		{0CBA9295-F14D-4966-A7C4-1DD68158176C}.Release|x64.ActiveCfg = Release|x64 |  | ||||||
| 		{0CBA9295-F14D-4966-A7C4-1DD68158176C}.Release|x64.Build.0 = Release|x64 |  | ||||||
| 		{D8A5E8EC-3983-4028-9BA9-B1E337E75917}.Debug|Win32.ActiveCfg = Debug|Win32 |  | ||||||
| 		{D8A5E8EC-3983-4028-9BA9-B1E337E75917}.Debug|Win32.Build.0 = Debug|Win32 |  | ||||||
| 		{D8A5E8EC-3983-4028-9BA9-B1E337E75917}.Debug|x64.ActiveCfg = Debug|x64 |  | ||||||
| 		{D8A5E8EC-3983-4028-9BA9-B1E337E75917}.Debug|x64.Build.0 = Debug|x64 |  | ||||||
| 		{D8A5E8EC-3983-4028-9BA9-B1E337E75917}.Release|Win32.ActiveCfg = Release|Win32 |  | ||||||
| 		{D8A5E8EC-3983-4028-9BA9-B1E337E75917}.Release|Win32.Build.0 = Release|Win32 |  | ||||||
| 		{D8A5E8EC-3983-4028-9BA9-B1E337E75917}.Release|x64.ActiveCfg = Release|x64 |  | ||||||
| 		{D8A5E8EC-3983-4028-9BA9-B1E337E75917}.Release|x64.Build.0 = Release|x64 |  | ||||||
| 		{B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.Debug|Win32.ActiveCfg = Debug|Win32 |  | ||||||
| 		{B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.Debug|Win32.Build.0 = Debug|Win32 |  | ||||||
| 		{B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.Debug|x64.ActiveCfg = Debug|x64 |  | ||||||
| 		{B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.Debug|x64.Build.0 = Debug|x64 |  | ||||||
| 		{B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.Release|Win32.ActiveCfg = Release|Win32 |  | ||||||
| 		{B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.Release|Win32.Build.0 = Release|Win32 |  | ||||||
| 		{B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.Release|x64.ActiveCfg = Release|x64 |  | ||||||
| 		{B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2}.Release|x64.Build.0 = Release|x64 |  | ||||||
| 	EndGlobalSection |  | ||||||
| 	GlobalSection(SolutionProperties) = preSolution |  | ||||||
| 		HideSolutionNode = FALSE |  | ||||||
| 	EndGlobalSection |  | ||||||
| 	GlobalSection(NestedProjects) = preSolution |  | ||||||
| 		{7FA1E56D-62AC-47D1-97D1-40B302724198} = {2D8919F2-8922-4B3F-8F68-D4127C6BCBB7} |  | ||||||
| 		{0CBA9295-F14D-4966-A7C4-1DD68158176C} = {2D8919F2-8922-4B3F-8F68-D4127C6BCBB7} |  | ||||||
| 		{D8A5E8EC-3983-4028-9BA9-B1E337E75917} = {2D8919F2-8922-4B3F-8F68-D4127C6BCBB7} |  | ||||||
| 		{B62E3DE6-812D-4CE6-90D9-18FD4FEA8EB2} = {2D8919F2-8922-4B3F-8F68-D4127C6BCBB7} |  | ||||||
| 	EndGlobalSection |  | ||||||
| 	GlobalSection(ExtensibilityGlobals) = postSolution |  | ||||||
| 		SolutionGuid = {FAC2BE2F-19AF-477A-8DC6-4645E66868A4} |  | ||||||
| 	EndGlobalSection |  | ||||||
| EndGlobal |  | ||||||
|  | @ -1,200 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-audio\AudioData.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-audio\AudioModule.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-audio\kiwano-audio.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-audio\libraries.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-audio\MediaFoundation\mflib.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-audio\MediaFoundation\MFTranscoder.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-audio\Ogg\OggTranscoder.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-audio\Sound.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-audio\SoundPlayer.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-audio\Transcoder.h" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup Label="ProjectConfigurations"> |  | ||||||
|     <ProjectConfiguration Include="Debug|Win32"> |  | ||||||
|       <Configuration>Debug</Configuration> |  | ||||||
|       <Platform>Win32</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Release|Win32"> |  | ||||||
|       <Configuration>Release</Configuration> |  | ||||||
|       <Platform>Win32</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Debug|x64"> |  | ||||||
|       <Configuration>Debug</Configuration> |  | ||||||
|       <Platform>x64</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Release|x64"> |  | ||||||
|       <Configuration>Release</Configuration> |  | ||||||
|       <Platform>x64</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-audio\AudioData.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-audio\AudioModule.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-audio\libraries.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-audio\MediaFoundation\mflib.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-audio\MediaFoundation\MFTranscoder.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-audio\Ogg\OggTranscoder.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-audio\Sound.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-audio\SoundPlayer.cpp" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <PropertyGroup Label="Globals"> |  | ||||||
|     <ProjectGuid>{1B97937D-8184-426C-BE71-29A163DC76C9}</ProjectGuid> |  | ||||||
|     <RootNamespace>kiwano-audio</RootNamespace> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>true</UseDebugLibraries> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>false</UseDebugLibraries> |  | ||||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>true</UseDebugLibraries> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>false</UseDebugLibraries> |  | ||||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |  | ||||||
|   <ImportGroup Label="ExtensionSettings"> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="Shared"> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <PropertyGroup Label="UserMacros" /> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>true</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>false</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>true</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>false</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>Disabled</Optimization> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>EditAndContinue</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../src;../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>MaxSpeed</Optimization> |  | ||||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> |  | ||||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> |  | ||||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../src;../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>false</GenerateDebugInformation> |  | ||||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> |  | ||||||
|       <OptimizeReferences>true</OptimizeReferences> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>Disabled</Optimization> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>EditAndContinue</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../src;../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>MaxSpeed</Optimization> |  | ||||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> |  | ||||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> |  | ||||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../src;../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>false</GenerateDebugInformation> |  | ||||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> |  | ||||||
|       <OptimizeReferences>true</OptimizeReferences> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ProjectReference Include="..\3rd-party\libogg\libogg.vcxproj"> |  | ||||||
|       <Project>{d8a5e8ec-3983-4028-9ba9-b1e337e75917}</Project> |  | ||||||
|     </ProjectReference> |  | ||||||
|     <ProjectReference Include="..\3rd-party\vorbis\libvorbis.vcxproj"> |  | ||||||
|       <Project>{b62e3de6-812d-4ce6-90d9-18fd4fea8eb2}</Project> |  | ||||||
|     </ProjectReference> |  | ||||||
|     <ProjectReference Include="..\kiwano\kiwano.vcxproj"> |  | ||||||
|       <Project>{ff7f943d-a89c-4e6c-97cf-84f7d8ff8edf}</Project> |  | ||||||
|     </ProjectReference> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |  | ||||||
|   <ImportGroup Label="ExtensionTargets"> |  | ||||||
|   </ImportGroup> |  | ||||||
| </Project> |  | ||||||
|  | @ -1,45 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-audio\kiwano-audio.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-audio\Sound.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-audio\SoundPlayer.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-audio\Transcoder.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-audio\AudioModule.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-audio\AudioData.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-audio\MediaFoundation\MFTranscoder.h"> |  | ||||||
|       <Filter>MediaFoundation</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-audio\libraries.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-audio\MediaFoundation\mflib.h"> |  | ||||||
|       <Filter>MediaFoundation</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-audio\Ogg\OggTranscoder.h"> |  | ||||||
|       <Filter>Ogg</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-audio\Sound.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-audio\SoundPlayer.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-audio\AudioModule.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-audio\AudioData.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-audio\MediaFoundation\MFTranscoder.cpp"> |  | ||||||
|       <Filter>MediaFoundation</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-audio\libraries.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-audio\MediaFoundation\mflib.cpp"> |  | ||||||
|       <Filter>MediaFoundation</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-audio\Ogg\OggTranscoder.cpp"> |  | ||||||
|       <Filter>Ogg</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <Filter Include="MediaFoundation"> |  | ||||||
|       <UniqueIdentifier>{213a58dc-8054-4bc7-bac5-456e889ae038}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="Ogg"> |  | ||||||
|       <UniqueIdentifier>{fd19f717-c321-45c3-948d-5cad830e1072}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|   </ItemGroup> |  | ||||||
| </Project> |  | ||||||
|  | @ -1,189 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-imgui\ImGuiLayer.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-imgui\ImGuiModule.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-imgui\imgui_impl\imgui_impl.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-imgui\imgui_impl\imgui_impl_dx10.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-imgui\imgui_impl\imgui_impl_dx11.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-imgui\kiwano-imgui.h" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup Label="ProjectConfigurations"> |  | ||||||
|     <ProjectConfiguration Include="Debug|Win32"> |  | ||||||
|       <Configuration>Debug</Configuration> |  | ||||||
|       <Platform>Win32</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Release|Win32"> |  | ||||||
|       <Configuration>Release</Configuration> |  | ||||||
|       <Platform>Win32</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Debug|x64"> |  | ||||||
|       <Configuration>Debug</Configuration> |  | ||||||
|       <Platform>x64</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Release|x64"> |  | ||||||
|       <Configuration>Release</Configuration> |  | ||||||
|       <Platform>x64</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-imgui\ImGuiLayer.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-imgui\ImGuiModule.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-imgui\imgui_impl\imgui_impl_dx10.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-imgui\imgui_impl\imgui_impl_dx11.cpp" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <PropertyGroup Label="Globals"> |  | ||||||
|     <ProjectGuid>{A7062ED8-8910-48A5-A3BC-C1612672571F}</ProjectGuid> |  | ||||||
|     <RootNamespace>kiwano-imgui</RootNamespace> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>true</UseDebugLibraries> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>false</UseDebugLibraries> |  | ||||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>true</UseDebugLibraries> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>false</UseDebugLibraries> |  | ||||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |  | ||||||
|   <ImportGroup Label="ExtensionSettings"> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="Shared"> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <PropertyGroup Label="UserMacros" /> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>true</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>false</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>true</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>false</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>Disabled</Optimization> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>EditAndContinue</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../src;../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>MaxSpeed</Optimization> |  | ||||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> |  | ||||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> |  | ||||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../src;../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>false</GenerateDebugInformation> |  | ||||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> |  | ||||||
|       <OptimizeReferences>true</OptimizeReferences> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>Disabled</Optimization> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>EditAndContinue</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../src;../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>MaxSpeed</Optimization> |  | ||||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> |  | ||||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> |  | ||||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../src;../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>false</GenerateDebugInformation> |  | ||||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> |  | ||||||
|       <OptimizeReferences>true</OptimizeReferences> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ProjectReference Include="..\3rd-party\imgui\libimgui.vcxproj"> |  | ||||||
|       <Project>{7fa1e56d-62ac-47d1-97d1-40b302724198}</Project> |  | ||||||
|     </ProjectReference> |  | ||||||
|     <ProjectReference Include="..\kiwano\kiwano.vcxproj"> |  | ||||||
|       <Project>{ff7f943d-a89c-4e6c-97cf-84f7d8ff8edf}</Project> |  | ||||||
|     </ProjectReference> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |  | ||||||
|   <ImportGroup Label="ExtensionTargets"> |  | ||||||
|   </ImportGroup> |  | ||||||
| </Project> |  | ||||||
|  | @ -1,32 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-imgui\kiwano-imgui.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-imgui\ImGuiLayer.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-imgui\ImGuiModule.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-imgui\imgui_impl\imgui_impl.h"> |  | ||||||
|       <Filter>imgui_impl</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-imgui\imgui_impl\imgui_impl_dx10.h"> |  | ||||||
|       <Filter>imgui_impl</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-imgui\imgui_impl\imgui_impl_dx11.h"> |  | ||||||
|       <Filter>imgui_impl</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-imgui\ImGuiLayer.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-imgui\ImGuiModule.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-imgui\imgui_impl\imgui_impl_dx10.cpp"> |  | ||||||
|       <Filter>imgui_impl</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-imgui\imgui_impl\imgui_impl_dx11.cpp"> |  | ||||||
|       <Filter>imgui_impl</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <Filter Include="imgui_impl"> |  | ||||||
|       <UniqueIdentifier>{a11036bf-f334-4e51-aef2-15dd46be924d}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|   </ItemGroup> |  | ||||||
| </Project> |  | ||||||
|  | @ -1,196 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |  | ||||||
|   <ItemGroup Label="ProjectConfigurations"> |  | ||||||
|     <ProjectConfiguration Include="Debug|Win32"> |  | ||||||
|       <Configuration>Debug</Configuration> |  | ||||||
|       <Platform>Win32</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Release|Win32"> |  | ||||||
|       <Configuration>Release</Configuration> |  | ||||||
|       <Platform>Win32</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Debug|x64"> |  | ||||||
|       <Configuration>Debug</Configuration> |  | ||||||
|       <Platform>x64</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Release|x64"> |  | ||||||
|       <Configuration>Release</Configuration> |  | ||||||
|       <Platform>x64</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-physics\PhysicBody.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-physics\Contact.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-physics\ContactEdge.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-physics\ContactEvent.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-physics\Fixture.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-physics\Global.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-physics\Joint.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-physics\kiwano-physics.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-physics\PhysicWorld.h" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-physics\PhysicBody.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-physics\Contact.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-physics\ContactEdge.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-physics\ContactEvent.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-physics\Fixture.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-physics\Global.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-physics\Joint.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-physics\PhysicWorld.cpp" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <PropertyGroup Label="Globals"> |  | ||||||
|     <ProjectGuid>{DF599AFB-744F-41E5-AF0C-2146F90575C8}</ProjectGuid> |  | ||||||
|     <RootNamespace>kiwano-physics</RootNamespace> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>true</UseDebugLibraries> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>false</UseDebugLibraries> |  | ||||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>true</UseDebugLibraries> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>false</UseDebugLibraries> |  | ||||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |  | ||||||
|   <ImportGroup Label="ExtensionSettings"> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="Shared"> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <PropertyGroup Label="UserMacros" /> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>true</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>false</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>true</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>false</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>Disabled</Optimization> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>EditAndContinue</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../src;../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>MaxSpeed</Optimization> |  | ||||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> |  | ||||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> |  | ||||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../src;../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>false</GenerateDebugInformation> |  | ||||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> |  | ||||||
|       <OptimizeReferences>true</OptimizeReferences> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>Disabled</Optimization> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>EditAndContinue</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../src;../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>MaxSpeed</Optimization> |  | ||||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> |  | ||||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> |  | ||||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <AdditionalIncludeDirectories>../../src;../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>false</GenerateDebugInformation> |  | ||||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> |  | ||||||
|       <OptimizeReferences>true</OptimizeReferences> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ProjectReference Include="..\3rd-party\Box2D\libBox2D.vcxproj"> |  | ||||||
|       <Project>{0cba9295-f14d-4966-a7c4-1dd68158176c}</Project> |  | ||||||
|     </ProjectReference> |  | ||||||
|     <ProjectReference Include="..\kiwano\kiwano.vcxproj"> |  | ||||||
|       <Project>{ff7f943d-a89c-4e6c-97cf-84f7d8ff8edf}</Project> |  | ||||||
|     </ProjectReference> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |  | ||||||
|   <ImportGroup Label="ExtensionTargets"> |  | ||||||
|   </ImportGroup> |  | ||||||
| </Project> |  | ||||||
|  | @ -1,24 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-physics\kiwano-physics.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-physics\Joint.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-physics\Fixture.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-physics\Contact.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-physics\ContactEvent.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-physics\ContactEdge.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-physics\Global.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-physics\PhysicBody.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano-physics\PhysicWorld.h" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-physics\Joint.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-physics\Fixture.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-physics\Contact.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-physics\ContactEvent.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-physics\ContactEdge.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-physics\Global.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-physics\PhysicBody.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano-physics\PhysicWorld.cpp" /> |  | ||||||
|   </ItemGroup> |  | ||||||
| </Project> |  | ||||||
|  | @ -1,382 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\Actor.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\animation\Animation.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\animation\DelayAnimation.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\animation\AnimationGroup.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\animation\Animator.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\animation\FrameSequence.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\animation\TweenAnimation.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\animation\PathAnimation.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\animation\AnimationWrapper.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\animation\CustomAnimation.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\animation\FrameAnimation.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\animation\EaseFunc.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\GifSprite.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\SpriteFrame.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\transition\BoxTransition.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\transition\FadeTransition.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\transition\MoveTransition.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\transition\RotationTransition.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\transition\Transition.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\base\component\Button.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\base\component\Component.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\base\component\ComponentManager.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\base\component\MouseSensor.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\base\Director.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\base\Module.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\base\ObjectBase.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\base\RefObject.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\base\RefPtr.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Allocator.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Any.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\BinaryData.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\BitOperator.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Cloneable.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Common.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Defer.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Duration.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Exception.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Flag.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Function.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\IntrusiveList.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Library.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Serializable.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Singleton.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\String.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Time.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\event\Event.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\event\EventDispatcher.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\event\Events.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\event\EventType.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\event\KeyEvent.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\event\listener\EventListener.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\event\listener\KeyEventListener.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\event\listener\MouseEventListener.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\event\MouseEvent.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\event\WindowEvent.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\kiwano.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\config.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\macros.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\Canvas.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\DebugActor.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\ShapeActor.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\LayerActor.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\Stage.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\Sprite.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\TextActor.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Resource.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\RefBasePtr.hpp" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\math\Constants.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\math\EaseFunctions.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\math\Interpolator.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\math\Math.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\math\Matrix.hpp" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\math\Random.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\math\Rect.hpp" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\math\Scalar.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\math\Transform.hpp" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\math\Vec2.hpp" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\platform\Application.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\platform\FileSystem.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\platform\Input.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\platform\Keys.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\platform\NativeObject.hpp" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\platform\Runner.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\platform\win32\ComPtr.hpp" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\platform\win32\libraries.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\platform\Window.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\Brush.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\Color.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\DirectX\TextDrawingEffect.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\DirectX\D2DDeviceResources.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\DirectX\D3D10DeviceResources.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\DirectX\D3D11DeviceResources.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\DirectX\D3DDeviceResources.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\DirectX\D3DDeviceResourcesBase.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\DirectX\FontCollectionLoader.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\DirectX\helper.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\DirectX\RenderContextImpl.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\DirectX\RendererImpl.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\DirectX\TextRenderer.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\Font.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\Shape.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\ShapeMaker.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\GifImage.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\Layer.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\RenderContext.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\Renderer.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\StrokeStyle.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\TextLayout.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\TextStyle.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\Texture.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\TextureCache.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\ConfigIni.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\EventTicker.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\Json.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\Logger.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\ResourceCache.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\ResourceLoader.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\Task.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\TaskScheduler.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\Ticker.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\Timer.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\UserData.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\Xml.h" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\Actor.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\animation\Animation.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\animation\DelayAnimation.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\animation\AnimationGroup.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\animation\Animator.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\animation\FrameSequence.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\animation\TweenAnimation.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\animation\PathAnimation.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\animation\CustomAnimation.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\animation\FrameAnimation.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\animation\EaseFunc.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\Canvas.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\DebugActor.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\ShapeActor.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\GifSprite.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\LayerActor.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\SpriteFrame.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\Stage.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\Sprite.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\TextActor.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\transition\BoxTransition.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\transition\FadeTransition.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\transition\MoveTransition.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\transition\RotationTransition.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\transition\Transition.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\base\component\Button.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\base\component\Component.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\base\component\ComponentManager.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\base\component\MouseSensor.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\base\Director.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\base\Module.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\base\ObjectBase.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\base\RefObject.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\core\Allocator.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\core\Duration.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\core\Exception.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\core\Library.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\core\Resource.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\core\String.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\core\Time.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\event\Event.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\event\EventDispatcher.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\event\KeyEvent.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\event\listener\EventListener.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\event\listener\KeyEventListener.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\event\listener\MouseEventListener.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\event\MouseEvent.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\event\WindowEvent.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\platform\Application.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\platform\FileSystem.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\platform\Input.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\platform\Runner.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\platform\win32\libraries.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\platform\win32\WindowImpl.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\platform\Window.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\Brush.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\Color.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\DirectX\TextDrawingEffect.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\DirectX\D2DDeviceResources.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\DirectX\D3D10DeviceResources.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\DirectX\D3D11DeviceResources.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\DirectX\FontCollectionLoader.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\DirectX\RenderContextImpl.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\DirectX\RendererImpl.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\DirectX\TextRenderer.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\Font.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\Shape.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\ShapeMaker.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\GifImage.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\Layer.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\RenderContext.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\Renderer.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\StrokeStyle.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\TextLayout.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\TextStyle.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\Texture.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\TextureCache.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\utils\ConfigIni.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\utils\EventTicker.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\utils\Logger.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\utils\ResourceCache.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\utils\ResourceLoader.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\utils\Task.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\utils\TaskScheduler.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\utils\Ticker.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\utils\Timer.cpp" /> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\utils\UserData.cpp" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup Label="ProjectConfigurations"> |  | ||||||
|     <ProjectConfiguration Include="Debug|Win32"> |  | ||||||
|       <Configuration>Debug</Configuration> |  | ||||||
|       <Platform>Win32</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Release|Win32"> |  | ||||||
|       <Configuration>Release</Configuration> |  | ||||||
|       <Platform>Win32</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Debug|x64"> |  | ||||||
|       <Configuration>Debug</Configuration> |  | ||||||
|       <Platform>x64</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|     <ProjectConfiguration Include="Release|x64"> |  | ||||||
|       <Configuration>Release</Configuration> |  | ||||||
|       <Platform>x64</Platform> |  | ||||||
|     </ProjectConfiguration> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <None Include="suppress_warning.ruleset" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <PropertyGroup Label="Globals"> |  | ||||||
|     <ProjectGuid>{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}</ProjectGuid> |  | ||||||
|     <RootNamespace>kiwano</RootNamespace> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>true</UseDebugLibraries> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>false</UseDebugLibraries> |  | ||||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>true</UseDebugLibraries> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |  | ||||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> |  | ||||||
|     <UseDebugLibraries>false</UseDebugLibraries> |  | ||||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> |  | ||||||
|     <CharacterSet>Unicode</CharacterSet> |  | ||||||
|     <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |  | ||||||
|   <ImportGroup Label="ExtensionSettings"> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |  | ||||||
|   </ImportGroup> |  | ||||||
|   <PropertyGroup Label="UserMacros" /> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>true</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>false</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>true</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <OutDir>$(SolutionDir)\output\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir> |  | ||||||
|     <IntDir>$(SolutionDir)\build\$(PlatformToolset)\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> |  | ||||||
|     <LinkIncremental>false</LinkIncremental> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>Disabled</Optimization> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>EditAndContinue</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <AdditionalIncludeDirectories>../../src;../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>MaxSpeed</Optimization> |  | ||||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> |  | ||||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> |  | ||||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <AdditionalIncludeDirectories>../../src;../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>false</GenerateDebugInformation> |  | ||||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> |  | ||||||
|       <OptimizeReferences>true</OptimizeReferences> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>Disabled</Optimization> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>EditAndContinue</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <AdditionalIncludeDirectories>../../src;../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |  | ||||||
|     <ClCompile> |  | ||||||
|       <WarningLevel>Level3</WarningLevel> |  | ||||||
|       <Optimization>MaxSpeed</Optimization> |  | ||||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> |  | ||||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> |  | ||||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> |  | ||||||
|       <TreatWarningAsError>true</TreatWarningAsError> |  | ||||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> |  | ||||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> |  | ||||||
|       <MinimalRebuild>false</MinimalRebuild> |  | ||||||
|       <AdditionalIncludeDirectories>../../src;../../src/3rd-party;</AdditionalIncludeDirectories> |  | ||||||
|       <UseFullPaths>false</UseFullPaths> |  | ||||||
|     </ClCompile> |  | ||||||
|     <Link> |  | ||||||
|       <SubSystem>Windows</SubSystem> |  | ||||||
|       <GenerateDebugInformation>false</GenerateDebugInformation> |  | ||||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> |  | ||||||
|       <OptimizeReferences>true</OptimizeReferences> |  | ||||||
|     </Link> |  | ||||||
|   </ItemDefinitionGroup> |  | ||||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |  | ||||||
|   <ImportGroup Label="ExtensionTargets"> |  | ||||||
|   </ImportGroup> |  | ||||||
| </Project> |  | ||||||
|  | @ -1,678 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <Filter Include="math"> |  | ||||||
|       <UniqueIdentifier>{80bc6386-2b70-4bae-993c-649a55163a1b}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="utils"> |  | ||||||
|       <UniqueIdentifier>{68eac919-ee87-4030-a033-c251731928f5}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="platform"> |  | ||||||
|       <UniqueIdentifier>{c2654ccc-59f6-4c17-bb6b-99b07fc78702}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="2d"> |  | ||||||
|       <UniqueIdentifier>{896bdedf-6e82-449b-9b6e-0bc69f3699b1}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="core"> |  | ||||||
|       <UniqueIdentifier>{2e18d99a-e906-499a-9e29-4e0783202644}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="platform\win32"> |  | ||||||
|       <UniqueIdentifier>{e84dcf9a-e650-473e-8c9c-193804ab9e76}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="render"> |  | ||||||
|       <UniqueIdentifier>{adb44ca9-674a-4b77-993f-d65193d8ab06}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="render\DirectX"> |  | ||||||
|       <UniqueIdentifier>{fd281702-0006-46d2-8fd1-28c502464164}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="base"> |  | ||||||
|       <UniqueIdentifier>{f514ae4f-2f6a-4d47-aa38-245628d6e01c}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="event"> |  | ||||||
|       <UniqueIdentifier>{b0d28d20-bfaf-4816-8415-28c20ecf9fac}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="base\component"> |  | ||||||
|       <UniqueIdentifier>{d15f4de1-7c2c-40d6-a3ce-68860b95a61e}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="2d\animation"> |  | ||||||
|       <UniqueIdentifier>{9314f30d-5742-48b6-94e5-e3b4284106f6}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="2d\transition"> |  | ||||||
|       <UniqueIdentifier>{f70cecd8-6d5b-405d-8466-d3ca2db9b806}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|     <Filter Include="event\listener"> |  | ||||||
|       <UniqueIdentifier>{554a3b32-ec18-4123-a12e-b176ec10fbdc}</UniqueIdentifier> |  | ||||||
|     </Filter> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\Canvas.h"> |  | ||||||
|       <Filter>2d</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\Sprite.h"> |  | ||||||
|       <Filter>2d</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Resource.h"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\math\Matrix.hpp"> |  | ||||||
|       <Filter>math</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\math\Rect.hpp"> |  | ||||||
|       <Filter>math</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\platform\Application.h"> |  | ||||||
|       <Filter>platform</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\config.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\macros.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\math\Vec2.hpp"> |  | ||||||
|       <Filter>math</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\kiwano.h" /> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\GifSprite.h"> |  | ||||||
|       <Filter>2d</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\Stage.h"> |  | ||||||
|       <Filter>2d</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\ResourceCache.h"> |  | ||||||
|       <Filter>utils</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\DebugActor.h"> |  | ||||||
|       <Filter>2d</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\ShapeActor.h"> |  | ||||||
|       <Filter>2d</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\UserData.h"> |  | ||||||
|       <Filter>utils</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Library.h"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\platform\FileSystem.h"> |  | ||||||
|       <Filter>platform</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\platform\Input.h"> |  | ||||||
|       <Filter>platform</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\platform\Window.h"> |  | ||||||
|       <Filter>platform</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\TextActor.h"> |  | ||||||
|       <Filter>2d</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\platform\win32\ComPtr.hpp"> |  | ||||||
|       <Filter>platform\win32</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\platform\win32\libraries.h"> |  | ||||||
|       <Filter>platform\win32</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Singleton.h"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Common.h"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Time.h"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Duration.h"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\Brush.h"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\Color.h"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\Font.h"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\GifImage.h"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\RenderContext.h"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\Renderer.h"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\StrokeStyle.h"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\TextLayout.h"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\Texture.h"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\TextureCache.h"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\DirectX\D2DDeviceResources.h"> |  | ||||||
|       <Filter>render\DirectX</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\DirectX\D3D10DeviceResources.h"> |  | ||||||
|       <Filter>render\DirectX</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\DirectX\D3D11DeviceResources.h"> |  | ||||||
|       <Filter>render\DirectX</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\DirectX\D3DDeviceResourcesBase.h"> |  | ||||||
|       <Filter>render\DirectX</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\DirectX\FontCollectionLoader.h"> |  | ||||||
|       <Filter>render\DirectX</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\DirectX\helper.h"> |  | ||||||
|       <Filter>render\DirectX</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\DirectX\TextRenderer.h"> |  | ||||||
|       <Filter>render\DirectX</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\Shape.h"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\math\Transform.hpp"> |  | ||||||
|       <Filter>math</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\math\Constants.h"> |  | ||||||
|       <Filter>math</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\math\EaseFunctions.h"> |  | ||||||
|       <Filter>math</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\math\Math.h"> |  | ||||||
|       <Filter>math</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\math\Random.h"> |  | ||||||
|       <Filter>math</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\math\Scalar.h"> |  | ||||||
|       <Filter>math</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\DirectX\RenderContextImpl.h"> |  | ||||||
|       <Filter>render\DirectX</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\DirectX\RendererImpl.h"> |  | ||||||
|       <Filter>render\DirectX</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Exception.h"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\LayerActor.h"> |  | ||||||
|       <Filter>2d</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\Layer.h"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\platform\Runner.h"> |  | ||||||
|       <Filter>platform</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Function.h"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\String.h"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Any.h"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\IntrusiveList.h"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\ShapeMaker.h"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Allocator.h"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Cloneable.h"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Serializable.h"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\EventTicker.h"> |  | ||||||
|       <Filter>utils</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\Json.h"> |  | ||||||
|       <Filter>utils</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\Task.h"> |  | ||||||
|       <Filter>utils</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\Ticker.h"> |  | ||||||
|       <Filter>utils</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\Timer.h"> |  | ||||||
|       <Filter>utils</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\Xml.h"> |  | ||||||
|       <Filter>utils</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\TaskScheduler.h"> |  | ||||||
|       <Filter>utils</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\DirectX\D3DDeviceResources.h"> |  | ||||||
|       <Filter>render\DirectX</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\Logger.h"> |  | ||||||
|       <Filter>utils</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\base\Director.h"> |  | ||||||
|       <Filter>base</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\base\Module.h"> |  | ||||||
|       <Filter>base</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\base\ObjectBase.h"> |  | ||||||
|       <Filter>base</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\event\Event.h"> |  | ||||||
|       <Filter>event</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\event\EventDispatcher.h"> |  | ||||||
|       <Filter>event</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\event\Events.h"> |  | ||||||
|       <Filter>event</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\event\EventType.h"> |  | ||||||
|       <Filter>event</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\event\KeyEvent.h"> |  | ||||||
|       <Filter>event</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\event\MouseEvent.h"> |  | ||||||
|       <Filter>event</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\event\WindowEvent.h"> |  | ||||||
|       <Filter>event</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\Actor.h"> |  | ||||||
|       <Filter>2d</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\base\component\Button.h"> |  | ||||||
|       <Filter>base\component</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\base\component\Component.h"> |  | ||||||
|       <Filter>base\component</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\base\component\ComponentManager.h"> |  | ||||||
|       <Filter>base\component</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\ConfigIni.h"> |  | ||||||
|       <Filter>utils</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Defer.h"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\base\RefObject.h"> |  | ||||||
|       <Filter>base</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\RefBasePtr.hpp"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\base\RefPtr.h"> |  | ||||||
|       <Filter>base</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\utils\ResourceLoader.h"> |  | ||||||
|       <Filter>utils</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\TextStyle.h"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\BitOperator.h"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Flag.h"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\animation\EaseFunc.h"> |  | ||||||
|       <Filter>2d\animation</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\animation\FrameAnimation.h"> |  | ||||||
|       <Filter>2d\animation</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\animation\CustomAnimation.h"> |  | ||||||
|       <Filter>2d\animation</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\animation\Animation.h"> |  | ||||||
|       <Filter>2d\animation</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\animation\DelayAnimation.h"> |  | ||||||
|       <Filter>2d\animation</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\animation\AnimationGroup.h"> |  | ||||||
|       <Filter>2d\animation</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\animation\TweenAnimation.h"> |  | ||||||
|       <Filter>2d\animation</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\animation\PathAnimation.h"> |  | ||||||
|       <Filter>2d\animation</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\animation\Animator.h"> |  | ||||||
|       <Filter>2d\animation</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\animation\FrameSequence.h"> |  | ||||||
|       <Filter>2d\animation</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\animation\AnimationWrapper.h"> |  | ||||||
|       <Filter>2d\animation</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\BinaryData.h"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\SpriteFrame.h"> |  | ||||||
|       <Filter>2d</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\platform\Keys.h"> |  | ||||||
|       <Filter>platform</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\transition\Transition.h"> |  | ||||||
|       <Filter>2d\transition</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\transition\FadeTransition.h"> |  | ||||||
|       <Filter>2d\transition</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\transition\MoveTransition.h"> |  | ||||||
|       <Filter>2d\transition</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\transition\RotationTransition.h"> |  | ||||||
|       <Filter>2d\transition</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\transition\BoxTransition.h"> |  | ||||||
|       <Filter>2d\transition</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\base\component\MouseSensor.h"> |  | ||||||
|       <Filter>base\component</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\event\listener\EventListener.h"> |  | ||||||
|       <Filter>event\listener</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\event\listener\MouseEventListener.h"> |  | ||||||
|       <Filter>event\listener</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\event\listener\KeyEventListener.h"> |  | ||||||
|       <Filter>event\listener</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\math\Interpolator.h"> |  | ||||||
|       <Filter>math</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\DirectX\TextDrawingEffect.h"> |  | ||||||
|       <Filter>render\DirectX</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\platform\NativeObject.hpp"> |  | ||||||
|       <Filter>platform</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\Canvas.cpp"> |  | ||||||
|       <Filter>2d</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\Sprite.cpp"> |  | ||||||
|       <Filter>2d</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\core\Resource.cpp"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\platform\Application.cpp"> |  | ||||||
|       <Filter>platform</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\GifSprite.cpp"> |  | ||||||
|       <Filter>2d</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\Stage.cpp"> |  | ||||||
|       <Filter>2d</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\utils\ResourceCache.cpp"> |  | ||||||
|       <Filter>utils</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\DebugActor.cpp"> |  | ||||||
|       <Filter>2d</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\ShapeActor.cpp"> |  | ||||||
|       <Filter>2d</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\utils\UserData.cpp"> |  | ||||||
|       <Filter>utils</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\core\Library.cpp"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\platform\FileSystem.cpp"> |  | ||||||
|       <Filter>platform</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\platform\Input.cpp"> |  | ||||||
|       <Filter>platform</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\platform\Window.cpp"> |  | ||||||
|       <Filter>platform</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\TextActor.cpp"> |  | ||||||
|       <Filter>2d</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\platform\win32\libraries.cpp"> |  | ||||||
|       <Filter>platform\win32</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\platform\win32\WindowImpl.cpp"> |  | ||||||
|       <Filter>platform\win32</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\core\Time.cpp"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\Brush.cpp"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\Color.cpp"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\Font.cpp"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\GifImage.cpp"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\RenderContext.cpp"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\Renderer.cpp"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\StrokeStyle.cpp"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\TextLayout.cpp"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\Texture.cpp"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\TextureCache.cpp"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\DirectX\D2DDeviceResources.cpp"> |  | ||||||
|       <Filter>render\DirectX</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\DirectX\D3D10DeviceResources.cpp"> |  | ||||||
|       <Filter>render\DirectX</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\DirectX\D3D11DeviceResources.cpp"> |  | ||||||
|       <Filter>render\DirectX</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\DirectX\FontCollectionLoader.cpp"> |  | ||||||
|       <Filter>render\DirectX</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\DirectX\TextRenderer.cpp"> |  | ||||||
|       <Filter>render\DirectX</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\Shape.cpp"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\DirectX\RenderContextImpl.cpp"> |  | ||||||
|       <Filter>render\DirectX</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\DirectX\RendererImpl.cpp"> |  | ||||||
|       <Filter>render\DirectX</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\core\Exception.cpp"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\LayerActor.cpp"> |  | ||||||
|       <Filter>2d</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\Layer.cpp"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\platform\Runner.cpp"> |  | ||||||
|       <Filter>platform</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\core\String.cpp"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\ShapeMaker.cpp"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\core\Allocator.cpp"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\utils\EventTicker.cpp"> |  | ||||||
|       <Filter>utils</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\utils\Task.cpp"> |  | ||||||
|       <Filter>utils</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\utils\Ticker.cpp"> |  | ||||||
|       <Filter>utils</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\utils\Timer.cpp"> |  | ||||||
|       <Filter>utils</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\utils\TaskScheduler.cpp"> |  | ||||||
|       <Filter>utils</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\utils\Logger.cpp"> |  | ||||||
|       <Filter>utils</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\base\Director.cpp"> |  | ||||||
|       <Filter>base</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\base\Module.cpp"> |  | ||||||
|       <Filter>base</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\base\ObjectBase.cpp"> |  | ||||||
|       <Filter>base</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\event\Event.cpp"> |  | ||||||
|       <Filter>event</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\event\EventDispatcher.cpp"> |  | ||||||
|       <Filter>event</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\event\KeyEvent.cpp"> |  | ||||||
|       <Filter>event</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\event\MouseEvent.cpp"> |  | ||||||
|       <Filter>event</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\event\WindowEvent.cpp"> |  | ||||||
|       <Filter>event</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\Actor.cpp"> |  | ||||||
|       <Filter>2d</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\base\component\Button.cpp"> |  | ||||||
|       <Filter>base\component</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\base\component\Component.cpp"> |  | ||||||
|       <Filter>base\component</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\base\component\ComponentManager.cpp"> |  | ||||||
|       <Filter>base\component</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\utils\ConfigIni.cpp"> |  | ||||||
|       <Filter>utils</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\base\RefObject.cpp"> |  | ||||||
|       <Filter>base</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\utils\ResourceLoader.cpp"> |  | ||||||
|       <Filter>utils</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\TextStyle.cpp"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\core\Duration.cpp"> |  | ||||||
|       <Filter>core</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\animation\EaseFunc.cpp"> |  | ||||||
|       <Filter>2d\animation</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\animation\FrameAnimation.cpp"> |  | ||||||
|       <Filter>2d\animation</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\animation\CustomAnimation.cpp"> |  | ||||||
|       <Filter>2d\animation</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\animation\Animation.cpp"> |  | ||||||
|       <Filter>2d\animation</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\animation\DelayAnimation.cpp"> |  | ||||||
|       <Filter>2d\animation</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\animation\AnimationGroup.cpp"> |  | ||||||
|       <Filter>2d\animation</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\animation\TweenAnimation.cpp"> |  | ||||||
|       <Filter>2d\animation</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\animation\PathAnimation.cpp"> |  | ||||||
|       <Filter>2d\animation</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\animation\Animator.cpp"> |  | ||||||
|       <Filter>2d\animation</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\animation\FrameSequence.cpp"> |  | ||||||
|       <Filter>2d\animation</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\SpriteFrame.cpp"> |  | ||||||
|       <Filter>2d</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\transition\Transition.cpp"> |  | ||||||
|       <Filter>2d\transition</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\transition\FadeTransition.cpp"> |  | ||||||
|       <Filter>2d\transition</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\transition\MoveTransition.cpp"> |  | ||||||
|       <Filter>2d\transition</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\transition\RotationTransition.cpp"> |  | ||||||
|       <Filter>2d\transition</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\transition\BoxTransition.cpp"> |  | ||||||
|       <Filter>2d\transition</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\base\component\MouseSensor.cpp"> |  | ||||||
|       <Filter>base\component</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\event\listener\EventListener.cpp"> |  | ||||||
|       <Filter>event\listener</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\event\listener\MouseEventListener.cpp"> |  | ||||||
|       <Filter>event\listener</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\event\listener\KeyEventListener.cpp"> |  | ||||||
|       <Filter>event\listener</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\DirectX\TextDrawingEffect.cpp"> |  | ||||||
|       <Filter>render\DirectX</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <None Include="suppress_warning.ruleset" /> |  | ||||||
|   </ItemGroup> |  | ||||||
| </Project> |  | ||||||
|  | @ -1,7 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <RuleSet Name="suppress_warning" ToolsVersion="16.0"> |  | ||||||
|   <Include Path="nativerecommendedrules.ruleset" Action="Default" /> |  | ||||||
|   <Rules AnalyzerId="Microsoft.Analyzers.NativeCodeAnalysis" RuleNamespace="Microsoft.Rules.Native"> |  | ||||||
|     <Rule Id="C26812" Action="None" /> |  | ||||||
|   </Rules> |  | ||||||
| </RuleSet> |  | ||||||
|  | @ -1,17 +0,0 @@ | ||||||
| function Get-AppVeyorArtifacts { |  | ||||||
|     param( |  | ||||||
|         [string]$Job |  | ||||||
|     ) |  | ||||||
| 
 |  | ||||||
|     if (-not ($env:APPVEYOR_API_TOKEN)) { |  | ||||||
|         throw "missing api token for AppVeyor." |  | ||||||
|     } |  | ||||||
|     if (-not ($env:APPVEYOR_ACCOUNT_NAME)) { |  | ||||||
|         throw "not an appveyor build." |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     return Invoke-RestMethod -Method GET -Uri "https://ci.appveyor.com/api/buildjobs/$Job/artifacts" -Headers @{ |  | ||||||
|         "Authorization" = "Bearer $env:APPVEYOR_API_TOKEN" |  | ||||||
|         "Content-type"  = "application/json" |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  | @ -1,15 +0,0 @@ | ||||||
| function Get-AppVeyorBuild { |  | ||||||
|     param() |  | ||||||
| 
 |  | ||||||
|     if (-not ($env:APPVEYOR_API_TOKEN)) { |  | ||||||
|         throw "missing api token for AppVeyor." |  | ||||||
|     } |  | ||||||
|     if (-not ($env:APPVEYOR_ACCOUNT_NAME)) { |  | ||||||
|         throw "not an appveyor build." |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     return Invoke-RestMethod -Method GET -Uri "https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/build/$env:APPVEYOR_BUILD_VERSION" -Headers @{ |  | ||||||
|         "Authorization" = "Bearer $env:APPVEYOR_API_TOKEN" |  | ||||||
|         "Content-type"  = "application/json" |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  | @ -1,40 +0,0 @@ | ||||||
| function Set-FileConfiguration { |  | ||||||
|     param( |  | ||||||
|         [string]$filePath |  | ||||||
|     ) |  | ||||||
| 
 |  | ||||||
|     $debugInfoReplace = "<DebugInformationFormat>(EditAndContinue|ProgramDatabase)</DebugInformationFormat>" |  | ||||||
|     $debugInfoReplaceTo = "<DebugInformationFormat>None</DebugInformationFormat>" |  | ||||||
| 
 |  | ||||||
|     $optimizationReplace = "<WholeProgramOptimization>true</WholeProgramOptimization>" |  | ||||||
|     $optimizationReplaceTo = "<WholeProgramOptimization>false</WholeProgramOptimization>" |  | ||||||
| 
 |  | ||||||
|     # Create a copy of .vcxproj file |  | ||||||
|     Copy-Item -Path $filePath -Destination ($filePath + '.template') |  | ||||||
| 
 |  | ||||||
|     # Overlay some configurations |  | ||||||
|     Get-Content ($filePath + '.template') -Encoding UTF8 | ForEach-Object { |  | ||||||
|         ( $_ -replace $debugInfoReplace, $debugInfoReplaceTo ) -replace $optimizationReplace, $optimizationReplaceTo |  | ||||||
|     } | Out-File $filePath -Encoding UTF8 |  | ||||||
| 
 |  | ||||||
|     # Delete the copy file |  | ||||||
|     Remove-Item -Path ($filePath + '.template') |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| Get-ChildItem -Path 'projects\' -Directory | ForEach-Object { |  | ||||||
|     $dirPath = "projects\$($_)" |  | ||||||
| 
 |  | ||||||
|     # Search all vcxproj files |  | ||||||
|     Get-ChildItem -Path $dirPath *.vcxproj -File | ForEach-Object { |  | ||||||
|         Set-FileConfiguration ($dirPath + '\' + $_) |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| Get-ChildItem -Path 'projects\3rd-party' -Directory | ForEach-Object { |  | ||||||
|     $dirPath = "projects\3rd-party\$($_)" |  | ||||||
| 
 |  | ||||||
|     # Search all vcxproj files |  | ||||||
|     Get-ChildItem -Path $dirPath *.vcxproj -File | ForEach-Object { |  | ||||||
|         Set-FileConfiguration ($dirPath + '\' + $_) |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  | @ -1,49 +0,0 @@ | ||||||
| . .\scripts\appveyor\appveyor_get_build.ps1 |  | ||||||
| . .\scripts\appveyor\appveyor_get_artifacts.ps1 |  | ||||||
| . .\scripts\appveyor\copy_recurse.ps1 |  | ||||||
| 
 |  | ||||||
| # get job artifacts |  | ||||||
| Write-Host "Start to download artifacts from other jobs" |  | ||||||
| 
 |  | ||||||
| (Get-AppVeyorBuild).build.jobs | foreach-object { |  | ||||||
|     $jobId = $_.jobId |  | ||||||
|     if ($jobId -ne $env:APPVEYOR_JOB_ID) { |  | ||||||
|         # Get job artifacts information |  | ||||||
|         (Get-AppVeyorArtifacts -Job $jobId) | foreach-object { |  | ||||||
|             # Create directory if not exists |  | ||||||
|             $filePath = $_.fileName.Substring(0, $_.fileName.LastIndexOf('/')) |  | ||||||
|             if (!(Test-Path -Path $filePath)) { |  | ||||||
|                 New-Item -ItemType "directory" -Path $filePath |  | ||||||
|             } |  | ||||||
|             # Download artifact from other job |  | ||||||
|             Start-FileDownload "https://ci.appveyor.com/api/buildjobs/$jobId/artifacts/$($_.fileName)" -FileName $_.fileName |  | ||||||
|         } |  | ||||||
|     }; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| Write-Host "Start to build nupkg files" |  | ||||||
| 
 |  | ||||||
| # This is the CoApp .autopkg file to create. |  | ||||||
| $autopkgFile = "scripts\coapp\kiwano.autopkg" |  | ||||||
| 
 |  | ||||||
| # Copy include files |  | ||||||
| Copy-Recurse -Path "src\" -Destination "include\" -Filter "*.h" |  | ||||||
| Copy-Recurse -Path "src\" -Destination "include\" -Filter "*.hpp" |  | ||||||
| Remove-Item -Path "include\3rd-party" -Recurse |  | ||||||
| Copy-Recurse -Path "src\3rd-party\" -Destination "include\" -Filter "*.h" |  | ||||||
| Copy-Recurse -Path "src\3rd-party\" -Destination "include\" -Filter "*.hpp" |  | ||||||
| 
 |  | ||||||
| # Create a copy of ".autopkg" file |  | ||||||
| Copy-Item -Path $autopkgFile -Destination ($autopkgFile + '.template') |  | ||||||
| 
 |  | ||||||
| # Get the ".autopkg.template" file, replace "@appveyor_version" with the Appveyor version number, then save to the ".autopkg" file. |  | ||||||
| Get-Content ($autopkgFile + ".template") -Encoding UTF8 | ForEach-Object { $_ -replace "@appveyor_version", $env:appveyor_build_version } | Out-File $autopkgFile -Encoding UTF8 |  | ||||||
| 
 |  | ||||||
| # Delete the copy file |  | ||||||
| Remove-Item -Path ($autopkgFile + '.template') |  | ||||||
| 
 |  | ||||||
| # Use the CoApp tools to create NuGet native packages from the .autopkg. |  | ||||||
| Write-NuGetPackage $autopkgFile |  | ||||||
| 
 |  | ||||||
| # Push all newly created .nupkg files as Appveyor artifacts for later deployment. |  | ||||||
| Get-ChildItem .\*.nupkg | ForEach-Object { Push-AppveyorArtifact $_.FullName -FileName $_.Name } |  | ||||||
|  | @ -1,23 +0,0 @@ | ||||||
| function Copy-Recurse { |  | ||||||
|     param( |  | ||||||
|         [string]$Path, |  | ||||||
|         [string]$Destination, |  | ||||||
|         [string]$Filter |  | ||||||
|     ) |  | ||||||
| 
 |  | ||||||
|     New-Item -ItemType Directory -Force -Path $Destination | Out-Null |  | ||||||
| 
 |  | ||||||
|     Get-ChildItem -Recurse -Path $Path -Filter $Filter | ForEach-Object { |  | ||||||
|         $relativePath = $_.FullName.Replace((Resolve-Path $Path).Path, "") |  | ||||||
|         $targetFile = Join-Path -Path $Destination -ChildPath $relativePath |  | ||||||
| 
 |  | ||||||
|         $targetFileDirectory = Split-Path -Path $targetFile -Parent |  | ||||||
|          |  | ||||||
|         if (!(Test-Path $targetFileDirectory)) |  | ||||||
|         { |  | ||||||
|             New-Item -ItemType Directory -Force -Path $targetFileDirectory | Out-Null |  | ||||||
|         } |  | ||||||
|          |  | ||||||
|         Copy-Item -Path $_.FullName -Destination $targetFile -Force |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  | @ -1,11 +0,0 @@ | ||||||
| # Download the CoApp tools. |  | ||||||
| # $msiPath = "$($env:USERPROFILE)\CoApp.Tools.Powershell.msi" |  | ||||||
| # (New-Object Net.WebClient).DownloadFile('https://coapp.github.io//files/CoApp.Tools.Powershell.msi', $msiPath) |  | ||||||
| $msiPath = "scripts\coapp\CoApp.Tools.Powershell.msi" |  | ||||||
| 
 |  | ||||||
| # Install the CoApp tools from the downloaded .msi. |  | ||||||
| Start-Process -FilePath msiexec -ArgumentList /i, $msiPath, /quiet -Wait |  | ||||||
| 
 |  | ||||||
| # Make the tools available for later PS scripts to use. |  | ||||||
| $env:PSModulePath = $env:PSModulePath + ';C:\Program Files (x86)\Outercurve Foundation\Modules' |  | ||||||
| Import-Module CoApp |  | ||||||
|  | @ -1,34 +0,0 @@ | ||||||
| . .\scripts\appveyor\appveyor_get_build.ps1 |  | ||||||
| 
 |  | ||||||
| # Ignore commits without APPVEYOR_API_TOKEN envrionment variable |  | ||||||
| if (-not ($env:APPVEYOR_API_TOKEN)) { return } |  | ||||||
| 
 |  | ||||||
| # Only deploy when commit message contains "[deploy]" |  | ||||||
| if (!(Get-AppVeyorBuild).build.message.Contains('[deploy]')) { return } |  | ||||||
| 
 |  | ||||||
| # Deploy once on last job |  | ||||||
| if ($env:APPVEYOR_JOB_NUMBER -ne $env:job_to_deploy) { return } |  | ||||||
| 
 |  | ||||||
| # Wait for other jobs complete |  | ||||||
| Write-Host "Waiting for other jobs to complete" |  | ||||||
| 
 |  | ||||||
| [datetime]$stop = ([datetime]::Now).AddMinutes($env:time_out_mins) |  | ||||||
| [bool]$success = $false |  | ||||||
| 
 |  | ||||||
| while(!$success -and ([datetime]::Now) -lt $stop) { |  | ||||||
|     $success = $true |  | ||||||
|     (Get-AppVeyorBuild).build.jobs | foreach-object { |  | ||||||
|         if (($_.jobId -ne $env:APPVEYOR_JOB_ID) -and ($_.status -ne "success")) { |  | ||||||
|             $success = $false |  | ||||||
|         } |  | ||||||
|         Write-Host "Job `"$($_.jobId)`" $($_.status)"; |  | ||||||
|     } |  | ||||||
|     if (!$success) { Start-sleep 5 } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| if (!$success) { |  | ||||||
|     throw "Test jobs were not finished in $env:time_out_mins minutes" |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| # Set flag to deploy |  | ||||||
| $env:flag_to_deploy = $success |  | ||||||
|  | @ -1,84 +0,0 @@ | ||||||
| #!/bin/bash |  | ||||||
| # |  | ||||||
| # clang-format-all: a tool to run clang-format on an entire project |  | ||||||
| # Copyright (C) 2016 Evan Klitzke <evan@eklitzke.org> |  | ||||||
| # |  | ||||||
| # This program is free software: you can redistribute it and/or modify |  | ||||||
| # it under the terms of the GNU General Public License as published by |  | ||||||
| # the Free Software Foundation, either version 3 of the License, or |  | ||||||
| # (at your option) any later version. |  | ||||||
| # |  | ||||||
| # This program is distributed in the hope that it will be useful, |  | ||||||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of |  | ||||||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the |  | ||||||
| # GNU General Public License for more details. |  | ||||||
| # |  | ||||||
| # You should have received a copy of the GNU General Public License |  | ||||||
| # along with this program.  If not, see <http://www.gnu.org/licenses/>. |  | ||||||
| 
 |  | ||||||
| function usage { |  | ||||||
|     echo "Usage: $0 DIR..." |  | ||||||
|     exit 1 |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| if [ $# -eq 0 ]; then |  | ||||||
|     usage |  | ||||||
| fi |  | ||||||
| 
 |  | ||||||
| # Variable that will hold the name of the clang-format command |  | ||||||
| FMT="" |  | ||||||
| 
 |  | ||||||
| # Some distros just call it clang-format. Others (e.g. Ubuntu) are insistent |  | ||||||
| # that the version number be part of the command. We prefer clang-format if |  | ||||||
| # that's present, otherwise we work backwards from highest version to lowest |  | ||||||
| # version. |  | ||||||
| for clangfmt in clang-format{,-{4,3}.{9,8,7,6,5,4,3,2,1,0}}; do |  | ||||||
|     if which "$clangfmt" &>/dev/null; then |  | ||||||
|         FMT="$clangfmt" |  | ||||||
|         break |  | ||||||
|     fi |  | ||||||
| done |  | ||||||
| 
 |  | ||||||
| # Check if we found a working clang-format |  | ||||||
| if [ -z "$FMT" ]; then |  | ||||||
|     echo "failed to find clang-format" |  | ||||||
|     exit 1 |  | ||||||
| fi |  | ||||||
| 
 |  | ||||||
| # Check all of the arguments first to make sure they're all directories |  | ||||||
| for dir in "$@"; do |  | ||||||
|     if [ ! -d "${dir}" ]; then |  | ||||||
|         echo "${dir} is not a directory" |  | ||||||
|         usage |  | ||||||
|     fi |  | ||||||
| done |  | ||||||
| 
 |  | ||||||
| # Find a dominating file, starting from a given directory and going up. |  | ||||||
| find-dominating-file() { |  | ||||||
|     if [ -r "$1"/"$2" ]; then |  | ||||||
|         return 0 |  | ||||||
|     fi |  | ||||||
|     if [ "$1" = "/" ]; then |  | ||||||
|         return 1 |  | ||||||
|     fi |  | ||||||
|     find-dominating-file "$(realpath "$1"/..)" "$2" |  | ||||||
|     return $? |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| # Run clang-format -i on all of the things |  | ||||||
| for dir in "$@"; do |  | ||||||
|     pushd "${dir}" &>/dev/null |  | ||||||
|     if ! find-dominating-file . .clang-format; then |  | ||||||
|         echo "Failed to find dominating .clang-format starting at $PWD" |  | ||||||
|         continue |  | ||||||
|     fi |  | ||||||
|     find . \ |  | ||||||
|          \( -name '*.c' \ |  | ||||||
|          -o -name '*.cc' \ |  | ||||||
|          -o -name '*.cpp' \ |  | ||||||
|          -o -name '*.h' \ |  | ||||||
|          -o -name '*.hh' \ |  | ||||||
|          -o -name '*.hpp' \) \ |  | ||||||
|          -exec "${FMT}" -i '{}' \; |  | ||||||
|     popd &>/dev/null |  | ||||||
| done |  | ||||||
|  | @ -1,141 +0,0 @@ | ||||||
| #defines { |  | ||||||
|     // Global variables may be added here. |  | ||||||
|     // Variables on the "value" side of each definition will be processed at access time. |  | ||||||
|     // GlobalVar1 = ""; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| configurations { |  | ||||||
|     // This node contains pivot information. |  | ||||||
|     // These are discussed in detail in the Pivots section. |  | ||||||
|     Toolset {  |  | ||||||
|         key : "PlatformToolset";  |  | ||||||
|         choices: { v143, v142, v141, v140 }; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     Platform { |  | ||||||
|         key : "Platform";  |  | ||||||
|         choices: { Win32, x64 }; |  | ||||||
|         Win32.aliases : { x86, win32, 386 }; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     Configuration { |  | ||||||
|         key : "Configuration";  |  | ||||||
|         choices: { Release, Debug }; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     Linkage { |  | ||||||
|         choices : { dynamic, static }; |  | ||||||
|         description = "Which version of the .lib file to link to this library"; |  | ||||||
| 
 |  | ||||||
|         dynamic.description = "Dynamic Library (DLL)"; |  | ||||||
|         static.description = "Static"; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     // Only really applicable to x86 |  | ||||||
|     CallingConvention { |  | ||||||
|         choices : { cdecl }; |  | ||||||
|         description = "Calling convention model to use (for x86 only)"; |  | ||||||
|         cdecl.description = "cdecl"; |  | ||||||
|     }; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| nuget { |  | ||||||
| 
 |  | ||||||
|     #defines { |  | ||||||
|         // Variable definitions specific to this node (ie. "nuget"). |  | ||||||
|         // Only available while inside this scope. |  | ||||||
|         // This metadata is not needed for most packages and is typically omitted. |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|     // The nuspec file metadata. |  | ||||||
|     nuspec { |  | ||||||
|         id = Kiwano; |  | ||||||
|         // "appveyor_version" is replaced by the current Appveyor build number in the |  | ||||||
|         // pre-deployment script. |  | ||||||
|         version: @appveyor_version; |  | ||||||
|         title: Kiwano Game Framework; |  | ||||||
|         authors: Nomango; |  | ||||||
|         owners: Nomango; |  | ||||||
|         licenseUrl: "https://github.com/KiwanoEngine/Kiwano/blob/master/LICENSE"; |  | ||||||
|         projectUrl: "https://github.com/KiwanoEngine/Kiwano"; |  | ||||||
|         iconUrl: "https://github.com/KiwanoEngine/Kiwano/raw/master/logo/logo.png"; |  | ||||||
|         description: A simple game framework for C++; |  | ||||||
|         releaseNotes: "Initial release of a Nuget package for Kiwano Game Engine"; |  | ||||||
|         copyright: Copyright 2019; |  | ||||||
|         tags: { C++, GameFramework, Kiwano }; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|     #output-packages { |  | ||||||
|         // Output file definitions.  These are covered in detail in Output Files. |  | ||||||
|         // This metadata is not needed for most packages and is typically omitted. |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|     dependencies { |  | ||||||
|         // This node defines any outside items which may be needed to consume this package. |  | ||||||
|         packages : { |  | ||||||
|             // This is a list of other NuGet packages required to use this package. |  | ||||||
|             // Each item follows the format "<pkg_name>/<version>" |  | ||||||
|             // my_pkg/1.0.0, |  | ||||||
|             // my_other_pkg/2.1.5.33 |  | ||||||
|         }; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|     files { |  | ||||||
|         #defines { |  | ||||||
|             INCLUDE_ROOT   = ..\..\include; |  | ||||||
|             SRC_ROOT   = ..\..\src; |  | ||||||
|             OUTPUT_DIR = ..\..\projects\output; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         include: { |  | ||||||
|             ${INCLUDE_ROOT}\**\*.h, |  | ||||||
|             ${INCLUDE_ROOT}\**\*.hpp, |  | ||||||
|         }; |  | ||||||
| 
 |  | ||||||
|         // third patry |  | ||||||
|         bin: { |  | ||||||
|             ${SRC_ROOT}\3rd-party\**\*.dll |  | ||||||
|         }; |  | ||||||
| 
 |  | ||||||
|         ("v140,v141,v142,v143", "Win32,x64", "Debug") => { |  | ||||||
|             [${0},${1},${2}] { |  | ||||||
|                 lib:     { ${OUTPUT_DIR}\${0}\${1}\${2}\*.lib }; |  | ||||||
|                 symbols: { ${OUTPUT_DIR}\${0}\${1}\${2}\*.pdb }; |  | ||||||
|             }; |  | ||||||
|         }; |  | ||||||
| 
 |  | ||||||
|         ("v140,v141,v142,v143", "Win32,x64", "Release") => { |  | ||||||
|             [${0},${1},${2}] { |  | ||||||
|                 lib:     { ${OUTPUT_DIR}\${0}\${1}\${2}\*.lib }; |  | ||||||
|             }; |  | ||||||
|         }; |  | ||||||
| 
 |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|     props { |  | ||||||
|         // Additional declarations to insert into consuming projects before most of the |  | ||||||
|         // project settings. (These may be modified in visual studio by a developer |  | ||||||
|         // consuming this package.) |  | ||||||
|         // This node is typically not needed for most packages and may be omitted. |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|     targets { |  | ||||||
|         // Additional declarations to insert into consuming projects after most of the |  | ||||||
|         // project settings. (These may NOT be modified in visual studio by a developer |  | ||||||
|         // consuming this package.) |  | ||||||
|         // This node is often used to set defines that are required that must be set by |  | ||||||
|         // the consuming project in order to correctly link to the libraries in this |  | ||||||
|         // package.  Such defines may be set either globally or only set under specific |  | ||||||
|         // conditions. |  | ||||||
|         //Defines += HAS_MyLib; |  | ||||||
|         //[dynamic] |  | ||||||
|         //    Defines += HAS_MyLib; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| } |  | ||||||
|  | @ -1,68 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #ifndef BOX2D_H |  | ||||||
| #define BOX2D_H |  | ||||||
| 
 |  | ||||||
| /**
 |  | ||||||
| \mainpage Box2D API Documentation |  | ||||||
| 
 |  | ||||||
| \section intro_sec Getting Started |  | ||||||
| 
 |  | ||||||
| For documentation please see http://box2d.org/documentation.html
 |  | ||||||
| 
 |  | ||||||
| For discussion please visit http://box2d.org/forum
 |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| // These include files constitute the main Box2D API
 |  | ||||||
| 
 |  | ||||||
| #include "Common/b2Settings.h" |  | ||||||
| #include "Common/b2Draw.h" |  | ||||||
| #include "Common/b2Timer.h" |  | ||||||
| 
 |  | ||||||
| #include "Collision/Shapes/b2CircleShape.h" |  | ||||||
| #include "Collision/Shapes/b2EdgeShape.h" |  | ||||||
| #include "Collision/Shapes/b2ChainShape.h" |  | ||||||
| #include "Collision/Shapes/b2PolygonShape.h" |  | ||||||
| 
 |  | ||||||
| #include "Collision/b2BroadPhase.h" |  | ||||||
| #include "Collision/b2Distance.h" |  | ||||||
| #include "Collision/b2DynamicTree.h" |  | ||||||
| #include "Collision/b2TimeOfImpact.h" |  | ||||||
| 
 |  | ||||||
| #include "Dynamics/b2Body.h" |  | ||||||
| #include "Dynamics/b2Fixture.h" |  | ||||||
| #include "Dynamics/b2WorldCallbacks.h" |  | ||||||
| #include "Dynamics/b2TimeStep.h" |  | ||||||
| #include "Dynamics/b2World.h" |  | ||||||
| 
 |  | ||||||
| #include "Dynamics/Contacts/b2Contact.h" |  | ||||||
| 
 |  | ||||||
| #include "Dynamics/Joints/b2DistanceJoint.h" |  | ||||||
| #include "Dynamics/Joints/b2FrictionJoint.h" |  | ||||||
| #include "Dynamics/Joints/b2GearJoint.h" |  | ||||||
| #include "Dynamics/Joints/b2MotorJoint.h" |  | ||||||
| #include "Dynamics/Joints/b2MouseJoint.h" |  | ||||||
| #include "Dynamics/Joints/b2PrismaticJoint.h" |  | ||||||
| #include "Dynamics/Joints/b2PulleyJoint.h" |  | ||||||
| #include "Dynamics/Joints/b2RevoluteJoint.h" |  | ||||||
| #include "Dynamics/Joints/b2RopeJoint.h" |  | ||||||
| #include "Dynamics/Joints/b2WeldJoint.h" |  | ||||||
| #include "Dynamics/Joints/b2WheelJoint.h" |  | ||||||
| 
 |  | ||||||
| #endif |  | ||||||
|  | @ -1,98 +0,0 @@ | ||||||
| include_directories(..) |  | ||||||
| 
 |  | ||||||
| set(SOURCE_FILES |  | ||||||
|         Collision/Shapes/b2ChainShape.cpp |  | ||||||
|         Collision/Shapes/b2ChainShape.h |  | ||||||
|         Collision/Shapes/b2CircleShape.cpp |  | ||||||
|         Collision/Shapes/b2CircleShape.h |  | ||||||
|         Collision/Shapes/b2EdgeShape.cpp |  | ||||||
|         Collision/Shapes/b2EdgeShape.h |  | ||||||
|         Collision/Shapes/b2PolygonShape.cpp |  | ||||||
|         Collision/Shapes/b2PolygonShape.h |  | ||||||
|         Collision/Shapes/b2Shape.h |  | ||||||
|         Collision/b2BroadPhase.cpp |  | ||||||
|         Collision/b2BroadPhase.h |  | ||||||
|         Collision/b2CollideCircle.cpp |  | ||||||
|         Collision/b2CollideEdge.cpp |  | ||||||
|         Collision/b2CollidePolygon.cpp |  | ||||||
|         Collision/b2Collision.cpp |  | ||||||
|         Collision/b2Collision.h |  | ||||||
|         Collision/b2Distance.cpp |  | ||||||
|         Collision/b2Distance.h |  | ||||||
|         Collision/b2DynamicTree.cpp |  | ||||||
|         Collision/b2DynamicTree.h |  | ||||||
|         Collision/b2TimeOfImpact.cpp |  | ||||||
|         Collision/b2TimeOfImpact.h |  | ||||||
|         Common/b2BlockAllocator.cpp |  | ||||||
|         Common/b2BlockAllocator.h |  | ||||||
|         Common/b2Draw.cpp |  | ||||||
|         Common/b2Draw.h |  | ||||||
|         Common/b2GrowableStack.h |  | ||||||
|         Common/b2Math.cpp |  | ||||||
|         Common/b2Math.h |  | ||||||
|         Common/b2Settings.cpp |  | ||||||
|         Common/b2Settings.h |  | ||||||
|         Common/b2StackAllocator.cpp |  | ||||||
|         Common/b2StackAllocator.h |  | ||||||
|         Common/b2Timer.cpp |  | ||||||
|         Common/b2Timer.h |  | ||||||
|         Dynamics/Contacts/b2ChainAndCircleContact.cpp |  | ||||||
|         Dynamics/Contacts/b2ChainAndCircleContact.h |  | ||||||
|         Dynamics/Contacts/b2ChainAndPolygonContact.cpp |  | ||||||
|         Dynamics/Contacts/b2ChainAndPolygonContact.h |  | ||||||
|         Dynamics/Contacts/b2CircleContact.cpp |  | ||||||
|         Dynamics/Contacts/b2CircleContact.h |  | ||||||
|         Dynamics/Contacts/b2Contact.cpp |  | ||||||
|         Dynamics/Contacts/b2Contact.h |  | ||||||
|         Dynamics/Contacts/b2ContactSolver.cpp |  | ||||||
|         Dynamics/Contacts/b2ContactSolver.h |  | ||||||
|         Dynamics/Contacts/b2EdgeAndCircleContact.cpp |  | ||||||
|         Dynamics/Contacts/b2EdgeAndCircleContact.h |  | ||||||
|         Dynamics/Contacts/b2EdgeAndPolygonContact.cpp |  | ||||||
|         Dynamics/Contacts/b2EdgeAndPolygonContact.h |  | ||||||
|         Dynamics/Contacts/b2PolygonAndCircleContact.cpp |  | ||||||
|         Dynamics/Contacts/b2PolygonAndCircleContact.h |  | ||||||
|         Dynamics/Contacts/b2PolygonContact.cpp |  | ||||||
|         Dynamics/Contacts/b2PolygonContact.h |  | ||||||
|         Dynamics/Joints/b2DistanceJoint.cpp |  | ||||||
|         Dynamics/Joints/b2DistanceJoint.h |  | ||||||
|         Dynamics/Joints/b2FrictionJoint.cpp |  | ||||||
|         Dynamics/Joints/b2FrictionJoint.h |  | ||||||
|         Dynamics/Joints/b2GearJoint.cpp |  | ||||||
|         Dynamics/Joints/b2GearJoint.h |  | ||||||
|         Dynamics/Joints/b2Joint.cpp |  | ||||||
|         Dynamics/Joints/b2Joint.h |  | ||||||
|         Dynamics/Joints/b2MotorJoint.cpp |  | ||||||
|         Dynamics/Joints/b2MotorJoint.h |  | ||||||
|         Dynamics/Joints/b2MouseJoint.cpp |  | ||||||
|         Dynamics/Joints/b2MouseJoint.h |  | ||||||
|         Dynamics/Joints/b2PrismaticJoint.cpp |  | ||||||
|         Dynamics/Joints/b2PrismaticJoint.h |  | ||||||
|         Dynamics/Joints/b2PulleyJoint.cpp |  | ||||||
|         Dynamics/Joints/b2PulleyJoint.h |  | ||||||
|         Dynamics/Joints/b2RevoluteJoint.cpp |  | ||||||
|         Dynamics/Joints/b2RevoluteJoint.h |  | ||||||
|         Dynamics/Joints/b2RopeJoint.cpp |  | ||||||
|         Dynamics/Joints/b2RopeJoint.h |  | ||||||
|         Dynamics/Joints/b2WeldJoint.cpp |  | ||||||
|         Dynamics/Joints/b2WeldJoint.h |  | ||||||
|         Dynamics/Joints/b2WheelJoint.cpp |  | ||||||
|         Dynamics/Joints/b2WheelJoint.h |  | ||||||
|         Dynamics/b2Body.cpp |  | ||||||
|         Dynamics/b2Body.h |  | ||||||
|         Dynamics/b2ContactManager.cpp |  | ||||||
|         Dynamics/b2ContactManager.h |  | ||||||
|         Dynamics/b2Fixture.cpp |  | ||||||
|         Dynamics/b2Fixture.h |  | ||||||
|         Dynamics/b2Island.cpp |  | ||||||
|         Dynamics/b2Island.h |  | ||||||
|         Dynamics/b2TimeStep.h |  | ||||||
|         Dynamics/b2World.cpp |  | ||||||
|         Dynamics/b2World.h |  | ||||||
|         Dynamics/b2WorldCallbacks.cpp |  | ||||||
|         Dynamics/b2WorldCallbacks.h |  | ||||||
|         Rope/b2Rope.cpp |  | ||||||
|         Rope/b2Rope.h |  | ||||||
|         Box2D.h) |  | ||||||
| 
 |  | ||||||
| add_library(libbox2d ${SOURCE_FILES}) |  | ||||||
|  | @ -1,198 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2010 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #include "Box2D/Collision/Shapes/b2ChainShape.h" |  | ||||||
| #include "Box2D/Collision/Shapes/b2EdgeShape.h" |  | ||||||
| #include <new> |  | ||||||
| #include <string.h> |  | ||||||
| 
 |  | ||||||
| b2ChainShape::~b2ChainShape() |  | ||||||
| { |  | ||||||
| 	Clear(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2ChainShape::Clear() |  | ||||||
| { |  | ||||||
| 	b2Free(m_vertices); |  | ||||||
| 	m_vertices = nullptr; |  | ||||||
| 	m_count = 0; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2ChainShape::CreateLoop(const b2Vec2* vertices, int32 count) |  | ||||||
| { |  | ||||||
| 	b2Assert(m_vertices == nullptr && m_count == 0); |  | ||||||
| 	b2Assert(count >= 3); |  | ||||||
| 	if (count < 3) |  | ||||||
| 	{ |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	for (int32 i = 1; i < count; ++i) |  | ||||||
| 	{ |  | ||||||
| 		b2Vec2 v1 = vertices[i-1]; |  | ||||||
| 		b2Vec2 v2 = vertices[i]; |  | ||||||
| 		// If the code crashes here, it means your vertices are too close together.
 |  | ||||||
| 		b2Assert(b2DistanceSquared(v1, v2) > b2_linearSlop * b2_linearSlop); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	m_count = count + 1; |  | ||||||
| 	m_vertices = (b2Vec2*)b2Alloc(m_count * sizeof(b2Vec2)); |  | ||||||
| 	memcpy(m_vertices, vertices, count * sizeof(b2Vec2)); |  | ||||||
| 	m_vertices[count] = m_vertices[0]; |  | ||||||
| 	m_prevVertex = m_vertices[m_count - 2]; |  | ||||||
| 	m_nextVertex = m_vertices[1]; |  | ||||||
| 	m_hasPrevVertex = true; |  | ||||||
| 	m_hasNextVertex = true; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2ChainShape::CreateChain(const b2Vec2* vertices, int32 count) |  | ||||||
| { |  | ||||||
| 	b2Assert(m_vertices == nullptr && m_count == 0); |  | ||||||
| 	b2Assert(count >= 2); |  | ||||||
| 	for (int32 i = 1; i < count; ++i) |  | ||||||
| 	{ |  | ||||||
| 		// If the code crashes here, it means your vertices are too close together.
 |  | ||||||
| 		b2Assert(b2DistanceSquared(vertices[i-1], vertices[i]) > b2_linearSlop * b2_linearSlop); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	m_count = count; |  | ||||||
| 	m_vertices = (b2Vec2*)b2Alloc(count * sizeof(b2Vec2)); |  | ||||||
| 	memcpy(m_vertices, vertices, m_count * sizeof(b2Vec2)); |  | ||||||
| 
 |  | ||||||
| 	m_hasPrevVertex = false; |  | ||||||
| 	m_hasNextVertex = false; |  | ||||||
| 
 |  | ||||||
| 	m_prevVertex.SetZero(); |  | ||||||
| 	m_nextVertex.SetZero(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2ChainShape::SetPrevVertex(const b2Vec2& prevVertex) |  | ||||||
| { |  | ||||||
| 	m_prevVertex = prevVertex; |  | ||||||
| 	m_hasPrevVertex = true; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2ChainShape::SetNextVertex(const b2Vec2& nextVertex) |  | ||||||
| { |  | ||||||
| 	m_nextVertex = nextVertex; |  | ||||||
| 	m_hasNextVertex = true; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| b2Shape* b2ChainShape::Clone(b2BlockAllocator* allocator) const |  | ||||||
| { |  | ||||||
| 	void* mem = allocator->Allocate(sizeof(b2ChainShape)); |  | ||||||
| 	b2ChainShape* clone = new (mem) b2ChainShape; |  | ||||||
| 	clone->CreateChain(m_vertices, m_count); |  | ||||||
| 	clone->m_prevVertex = m_prevVertex; |  | ||||||
| 	clone->m_nextVertex = m_nextVertex; |  | ||||||
| 	clone->m_hasPrevVertex = m_hasPrevVertex; |  | ||||||
| 	clone->m_hasNextVertex = m_hasNextVertex; |  | ||||||
| 	return clone; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| int32 b2ChainShape::GetChildCount() const |  | ||||||
| { |  | ||||||
| 	// edge count = vertex count - 1
 |  | ||||||
| 	return m_count - 1; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2ChainShape::GetChildEdge(b2EdgeShape* edge, int32 index) const |  | ||||||
| { |  | ||||||
| 	b2Assert(0 <= index && index < m_count - 1); |  | ||||||
| 	edge->m_type = b2Shape::e_edge; |  | ||||||
| 	edge->m_radius = m_radius; |  | ||||||
| 
 |  | ||||||
| 	edge->m_vertex1 = m_vertices[index + 0]; |  | ||||||
| 	edge->m_vertex2 = m_vertices[index + 1]; |  | ||||||
| 
 |  | ||||||
| 	if (index > 0) |  | ||||||
| 	{ |  | ||||||
| 		edge->m_vertex0 = m_vertices[index - 1]; |  | ||||||
| 		edge->m_hasVertex0 = true; |  | ||||||
| 	} |  | ||||||
| 	else |  | ||||||
| 	{ |  | ||||||
| 		edge->m_vertex0 = m_prevVertex; |  | ||||||
| 		edge->m_hasVertex0 = m_hasPrevVertex; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	if (index < m_count - 2) |  | ||||||
| 	{ |  | ||||||
| 		edge->m_vertex3 = m_vertices[index + 2]; |  | ||||||
| 		edge->m_hasVertex3 = true; |  | ||||||
| 	} |  | ||||||
| 	else |  | ||||||
| 	{ |  | ||||||
| 		edge->m_vertex3 = m_nextVertex; |  | ||||||
| 		edge->m_hasVertex3 = m_hasNextVertex; |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| bool b2ChainShape::TestPoint(const b2Transform& xf, const b2Vec2& p) const |  | ||||||
| { |  | ||||||
| 	B2_NOT_USED(xf); |  | ||||||
| 	B2_NOT_USED(p); |  | ||||||
| 	return false; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| bool b2ChainShape::RayCast(b2RayCastOutput* output, const b2RayCastInput& input, |  | ||||||
| 							const b2Transform& xf, int32 childIndex) const |  | ||||||
| { |  | ||||||
| 	b2Assert(childIndex < m_count); |  | ||||||
| 
 |  | ||||||
| 	b2EdgeShape edgeShape; |  | ||||||
| 
 |  | ||||||
| 	int32 i1 = childIndex; |  | ||||||
| 	int32 i2 = childIndex + 1; |  | ||||||
| 	if (i2 == m_count) |  | ||||||
| 	{ |  | ||||||
| 		i2 = 0; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	edgeShape.m_vertex1 = m_vertices[i1]; |  | ||||||
| 	edgeShape.m_vertex2 = m_vertices[i2]; |  | ||||||
| 
 |  | ||||||
| 	return edgeShape.RayCast(output, input, xf, 0); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2ChainShape::ComputeAABB(b2AABB* aabb, const b2Transform& xf, int32 childIndex) const |  | ||||||
| { |  | ||||||
| 	b2Assert(childIndex < m_count); |  | ||||||
| 
 |  | ||||||
| 	int32 i1 = childIndex; |  | ||||||
| 	int32 i2 = childIndex + 1; |  | ||||||
| 	if (i2 == m_count) |  | ||||||
| 	{ |  | ||||||
| 		i2 = 0; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 v1 = b2Mul(xf, m_vertices[i1]); |  | ||||||
| 	b2Vec2 v2 = b2Mul(xf, m_vertices[i2]); |  | ||||||
| 
 |  | ||||||
| 	aabb->lowerBound = b2Min(v1, v2); |  | ||||||
| 	aabb->upperBound = b2Max(v1, v2); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2ChainShape::ComputeMass(b2MassData* massData, float32 density) const |  | ||||||
| { |  | ||||||
| 	B2_NOT_USED(density); |  | ||||||
| 
 |  | ||||||
| 	massData->mass = 0.0f; |  | ||||||
| 	massData->center.SetZero(); |  | ||||||
| 	massData->I = 0.0f; |  | ||||||
| } |  | ||||||
|  | @ -1,105 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2010 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #ifndef B2_CHAIN_SHAPE_H |  | ||||||
| #define B2_CHAIN_SHAPE_H |  | ||||||
| 
 |  | ||||||
| #include "b2Shape.h" |  | ||||||
| 
 |  | ||||||
| class b2EdgeShape; |  | ||||||
| 
 |  | ||||||
| /// A chain shape is a free form sequence of line segments.
 |  | ||||||
| /// The chain has two-sided collision, so you can use inside and outside collision.
 |  | ||||||
| /// Therefore, you may use any winding order.
 |  | ||||||
| /// Since there may be many vertices, they are allocated using b2Alloc.
 |  | ||||||
| /// Connectivity information is used to create smooth collisions.
 |  | ||||||
| /// WARNING: The chain will not collide properly if there are self-intersections.
 |  | ||||||
| class b2ChainShape : public b2Shape |  | ||||||
| { |  | ||||||
| public: |  | ||||||
| 	b2ChainShape(); |  | ||||||
| 
 |  | ||||||
| 	/// The destructor frees the vertices using b2Free.
 |  | ||||||
| 	~b2ChainShape(); |  | ||||||
| 
 |  | ||||||
| 	/// Clear all data.
 |  | ||||||
| 	void Clear(); |  | ||||||
| 
 |  | ||||||
| 	/// Create a loop. This automatically adjusts connectivity.
 |  | ||||||
| 	/// @param vertices an array of vertices, these are copied
 |  | ||||||
| 	/// @param count the vertex count
 |  | ||||||
| 	void CreateLoop(const b2Vec2* vertices, int32 count); |  | ||||||
| 
 |  | ||||||
| 	/// Create a chain with isolated end vertices.
 |  | ||||||
| 	/// @param vertices an array of vertices, these are copied
 |  | ||||||
| 	/// @param count the vertex count
 |  | ||||||
| 	void CreateChain(const b2Vec2* vertices, int32 count); |  | ||||||
| 
 |  | ||||||
| 	/// Establish connectivity to a vertex that precedes the first vertex.
 |  | ||||||
| 	/// Don't call this for loops.
 |  | ||||||
| 	void SetPrevVertex(const b2Vec2& prevVertex); |  | ||||||
| 
 |  | ||||||
| 	/// Establish connectivity to a vertex that follows the last vertex.
 |  | ||||||
| 	/// Don't call this for loops.
 |  | ||||||
| 	void SetNextVertex(const b2Vec2& nextVertex); |  | ||||||
| 
 |  | ||||||
| 	/// Implement b2Shape. Vertices are cloned using b2Alloc.
 |  | ||||||
| 	b2Shape* Clone(b2BlockAllocator* allocator) const override; |  | ||||||
| 
 |  | ||||||
| 	/// @see b2Shape::GetChildCount
 |  | ||||||
| 	int32 GetChildCount() const override; |  | ||||||
| 
 |  | ||||||
| 	/// Get a child edge.
 |  | ||||||
| 	void GetChildEdge(b2EdgeShape* edge, int32 index) const; |  | ||||||
| 
 |  | ||||||
| 	/// This always return false.
 |  | ||||||
| 	/// @see b2Shape::TestPoint
 |  | ||||||
| 	bool TestPoint(const b2Transform& transform, const b2Vec2& p) const override; |  | ||||||
| 
 |  | ||||||
| 	/// Implement b2Shape.
 |  | ||||||
| 	bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input, |  | ||||||
| 					const b2Transform& transform, int32 childIndex) const override; |  | ||||||
| 
 |  | ||||||
| 	/// @see b2Shape::ComputeAABB
 |  | ||||||
| 	void ComputeAABB(b2AABB* aabb, const b2Transform& transform, int32 childIndex) const override; |  | ||||||
| 
 |  | ||||||
| 	/// Chains have zero mass.
 |  | ||||||
| 	/// @see b2Shape::ComputeMass
 |  | ||||||
| 	void ComputeMass(b2MassData* massData, float32 density) const override; |  | ||||||
| 
 |  | ||||||
| 	/// The vertices. Owned by this class.
 |  | ||||||
| 	b2Vec2* m_vertices; |  | ||||||
| 
 |  | ||||||
| 	/// The vertex count.
 |  | ||||||
| 	int32 m_count; |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 m_prevVertex, m_nextVertex; |  | ||||||
| 	bool m_hasPrevVertex, m_hasNextVertex; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| inline b2ChainShape::b2ChainShape() |  | ||||||
| { |  | ||||||
| 	m_type = e_chain; |  | ||||||
| 	m_radius = b2_polygonRadius; |  | ||||||
| 	m_vertices = nullptr; |  | ||||||
| 	m_count = 0; |  | ||||||
| 	m_hasPrevVertex = false; |  | ||||||
| 	m_hasNextVertex = false; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #endif |  | ||||||
|  | @ -1,99 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #include "Box2D/Collision/Shapes/b2CircleShape.h" |  | ||||||
| #include <new> |  | ||||||
| 
 |  | ||||||
| b2Shape* b2CircleShape::Clone(b2BlockAllocator* allocator) const |  | ||||||
| { |  | ||||||
| 	void* mem = allocator->Allocate(sizeof(b2CircleShape)); |  | ||||||
| 	b2CircleShape* clone = new (mem) b2CircleShape; |  | ||||||
| 	*clone = *this; |  | ||||||
| 	return clone; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| int32 b2CircleShape::GetChildCount() const |  | ||||||
| { |  | ||||||
| 	return 1; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| bool b2CircleShape::TestPoint(const b2Transform& transform, const b2Vec2& p) const |  | ||||||
| { |  | ||||||
| 	b2Vec2 center = transform.p + b2Mul(transform.q, m_p); |  | ||||||
| 	b2Vec2 d = p - center; |  | ||||||
| 	return b2Dot(d, d) <= m_radius * m_radius; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // Collision Detection in Interactive 3D Environments by Gino van den Bergen
 |  | ||||||
| // From Section 3.1.2
 |  | ||||||
| // x = s + a * r
 |  | ||||||
| // norm(x) = radius
 |  | ||||||
| bool b2CircleShape::RayCast(b2RayCastOutput* output, const b2RayCastInput& input, |  | ||||||
| 							const b2Transform& transform, int32 childIndex) const |  | ||||||
| { |  | ||||||
| 	B2_NOT_USED(childIndex); |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 position = transform.p + b2Mul(transform.q, m_p); |  | ||||||
| 	b2Vec2 s = input.p1 - position; |  | ||||||
| 	float32 b = b2Dot(s, s) - m_radius * m_radius; |  | ||||||
| 
 |  | ||||||
| 	// Solve quadratic equation.
 |  | ||||||
| 	b2Vec2 r = input.p2 - input.p1; |  | ||||||
| 	float32 c =  b2Dot(s, r); |  | ||||||
| 	float32 rr = b2Dot(r, r); |  | ||||||
| 	float32 sigma = c * c - rr * b; |  | ||||||
| 
 |  | ||||||
| 	// Check for negative discriminant and short segment.
 |  | ||||||
| 	if (sigma < 0.0f || rr < b2_epsilon) |  | ||||||
| 	{ |  | ||||||
| 		return false; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// Find the point of intersection of the line with the circle.
 |  | ||||||
| 	float32 a = -(c + b2Sqrt(sigma)); |  | ||||||
| 
 |  | ||||||
| 	// Is the intersection point on the segment?
 |  | ||||||
| 	if (0.0f <= a && a <= input.maxFraction * rr) |  | ||||||
| 	{ |  | ||||||
| 		a /= rr; |  | ||||||
| 		output->fraction = a; |  | ||||||
| 		output->normal = s + a * r; |  | ||||||
| 		output->normal.Normalize(); |  | ||||||
| 		return true; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	return false; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2CircleShape::ComputeAABB(b2AABB* aabb, const b2Transform& transform, int32 childIndex) const |  | ||||||
| { |  | ||||||
| 	B2_NOT_USED(childIndex); |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 p = transform.p + b2Mul(transform.q, m_p); |  | ||||||
| 	aabb->lowerBound.Set(p.x - m_radius, p.y - m_radius); |  | ||||||
| 	aabb->upperBound.Set(p.x + m_radius, p.y + m_radius); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2CircleShape::ComputeMass(b2MassData* massData, float32 density) const |  | ||||||
| { |  | ||||||
| 	massData->mass = density * b2_pi * m_radius * m_radius; |  | ||||||
| 	massData->center = m_p; |  | ||||||
| 
 |  | ||||||
| 	// inertia about the local origin
 |  | ||||||
| 	massData->I = massData->mass * (0.5f * m_radius * m_radius + b2Dot(m_p, m_p)); |  | ||||||
| } |  | ||||||
|  | @ -1,60 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #ifndef B2_CIRCLE_SHAPE_H |  | ||||||
| #define B2_CIRCLE_SHAPE_H |  | ||||||
| 
 |  | ||||||
| #include "b2Shape.h" |  | ||||||
| 
 |  | ||||||
| /// A circle shape.
 |  | ||||||
| class b2CircleShape : public b2Shape |  | ||||||
| { |  | ||||||
| public: |  | ||||||
| 	b2CircleShape(); |  | ||||||
| 
 |  | ||||||
| 	/// Implement b2Shape.
 |  | ||||||
| 	b2Shape* Clone(b2BlockAllocator* allocator) const override; |  | ||||||
| 
 |  | ||||||
| 	/// @see b2Shape::GetChildCount
 |  | ||||||
| 	int32 GetChildCount() const override; |  | ||||||
| 
 |  | ||||||
| 	/// Implement b2Shape.
 |  | ||||||
| 	bool TestPoint(const b2Transform& transform, const b2Vec2& p) const override; |  | ||||||
| 
 |  | ||||||
| 	/// Implement b2Shape.
 |  | ||||||
| 	bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input, |  | ||||||
| 				const b2Transform& transform, int32 childIndex) const override; |  | ||||||
| 
 |  | ||||||
| 	/// @see b2Shape::ComputeAABB
 |  | ||||||
| 	void ComputeAABB(b2AABB* aabb, const b2Transform& transform, int32 childIndex) const override; |  | ||||||
| 
 |  | ||||||
| 	/// @see b2Shape::ComputeMass
 |  | ||||||
| 	void ComputeMass(b2MassData* massData, float32 density) const override; |  | ||||||
| 
 |  | ||||||
| 	/// Position
 |  | ||||||
| 	b2Vec2 m_p; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| inline b2CircleShape::b2CircleShape() |  | ||||||
| { |  | ||||||
| 	m_type = e_circle; |  | ||||||
| 	m_radius = 0.0f; |  | ||||||
| 	m_p.SetZero(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #endif |  | ||||||
|  | @ -1,138 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2010 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #include "Box2D/Collision/Shapes/b2EdgeShape.h" |  | ||||||
| #include <new> |  | ||||||
| 
 |  | ||||||
| void b2EdgeShape::Set(const b2Vec2& v1, const b2Vec2& v2) |  | ||||||
| { |  | ||||||
| 	m_vertex1 = v1; |  | ||||||
| 	m_vertex2 = v2; |  | ||||||
| 	m_hasVertex0 = false; |  | ||||||
| 	m_hasVertex3 = false; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| b2Shape* b2EdgeShape::Clone(b2BlockAllocator* allocator) const |  | ||||||
| { |  | ||||||
| 	void* mem = allocator->Allocate(sizeof(b2EdgeShape)); |  | ||||||
| 	b2EdgeShape* clone = new (mem) b2EdgeShape; |  | ||||||
| 	*clone = *this; |  | ||||||
| 	return clone; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| int32 b2EdgeShape::GetChildCount() const |  | ||||||
| { |  | ||||||
| 	return 1; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| bool b2EdgeShape::TestPoint(const b2Transform& xf, const b2Vec2& p) const |  | ||||||
| { |  | ||||||
| 	B2_NOT_USED(xf); |  | ||||||
| 	B2_NOT_USED(p); |  | ||||||
| 	return false; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // p = p1 + t * d
 |  | ||||||
| // v = v1 + s * e
 |  | ||||||
| // p1 + t * d = v1 + s * e
 |  | ||||||
| // s * e - t * d = p1 - v1
 |  | ||||||
| bool b2EdgeShape::RayCast(b2RayCastOutput* output, const b2RayCastInput& input, |  | ||||||
| 							const b2Transform& xf, int32 childIndex) const |  | ||||||
| { |  | ||||||
| 	B2_NOT_USED(childIndex); |  | ||||||
| 
 |  | ||||||
| 	// Put the ray into the edge's frame of reference.
 |  | ||||||
| 	b2Vec2 p1 = b2MulT(xf.q, input.p1 - xf.p); |  | ||||||
| 	b2Vec2 p2 = b2MulT(xf.q, input.p2 - xf.p); |  | ||||||
| 	b2Vec2 d = p2 - p1; |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 v1 = m_vertex1; |  | ||||||
| 	b2Vec2 v2 = m_vertex2; |  | ||||||
| 	b2Vec2 e = v2 - v1; |  | ||||||
| 	b2Vec2 normal(e.y, -e.x); |  | ||||||
| 	normal.Normalize(); |  | ||||||
| 
 |  | ||||||
| 	// q = p1 + t * d
 |  | ||||||
| 	// dot(normal, q - v1) = 0
 |  | ||||||
| 	// dot(normal, p1 - v1) + t * dot(normal, d) = 0
 |  | ||||||
| 	float32 numerator = b2Dot(normal, v1 - p1); |  | ||||||
| 	float32 denominator = b2Dot(normal, d); |  | ||||||
| 
 |  | ||||||
| 	if (denominator == 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		return false; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	float32 t = numerator / denominator; |  | ||||||
| 	if (t < 0.0f || input.maxFraction < t) |  | ||||||
| 	{ |  | ||||||
| 		return false; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 q = p1 + t * d; |  | ||||||
| 
 |  | ||||||
| 	// q = v1 + s * r
 |  | ||||||
| 	// s = dot(q - v1, r) / dot(r, r)
 |  | ||||||
| 	b2Vec2 r = v2 - v1; |  | ||||||
| 	float32 rr = b2Dot(r, r); |  | ||||||
| 	if (rr == 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		return false; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	float32 s = b2Dot(q - v1, r) / rr; |  | ||||||
| 	if (s < 0.0f || 1.0f < s) |  | ||||||
| 	{ |  | ||||||
| 		return false; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	output->fraction = t; |  | ||||||
| 	if (numerator > 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		output->normal = -b2Mul(xf.q, normal); |  | ||||||
| 	} |  | ||||||
| 	else |  | ||||||
| 	{ |  | ||||||
| 		output->normal = b2Mul(xf.q, normal); |  | ||||||
| 	} |  | ||||||
| 	return true; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2EdgeShape::ComputeAABB(b2AABB* aabb, const b2Transform& xf, int32 childIndex) const |  | ||||||
| { |  | ||||||
| 	B2_NOT_USED(childIndex); |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 v1 = b2Mul(xf, m_vertex1); |  | ||||||
| 	b2Vec2 v2 = b2Mul(xf, m_vertex2); |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 lower = b2Min(v1, v2); |  | ||||||
| 	b2Vec2 upper = b2Max(v1, v2); |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 r(m_radius, m_radius); |  | ||||||
| 	aabb->lowerBound = lower - r; |  | ||||||
| 	aabb->upperBound = upper + r; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2EdgeShape::ComputeMass(b2MassData* massData, float32 density) const |  | ||||||
| { |  | ||||||
| 	B2_NOT_USED(density); |  | ||||||
| 
 |  | ||||||
| 	massData->mass = 0.0f; |  | ||||||
| 	massData->center = 0.5f * (m_vertex1 + m_vertex2); |  | ||||||
| 	massData->I = 0.0f; |  | ||||||
| } |  | ||||||
|  | @ -1,74 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2010 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #ifndef B2_EDGE_SHAPE_H |  | ||||||
| #define B2_EDGE_SHAPE_H |  | ||||||
| 
 |  | ||||||
| #include "b2Shape.h" |  | ||||||
| 
 |  | ||||||
| /// A line segment (edge) shape. These can be connected in chains or loops
 |  | ||||||
| /// to other edge shapes. The connectivity information is used to ensure
 |  | ||||||
| /// correct contact normals.
 |  | ||||||
| class b2EdgeShape : public b2Shape |  | ||||||
| { |  | ||||||
| public: |  | ||||||
| 	b2EdgeShape(); |  | ||||||
| 
 |  | ||||||
| 	/// Set this as an isolated edge.
 |  | ||||||
| 	void Set(const b2Vec2& v1, const b2Vec2& v2); |  | ||||||
| 
 |  | ||||||
| 	/// Implement b2Shape.
 |  | ||||||
| 	b2Shape* Clone(b2BlockAllocator* allocator) const override; |  | ||||||
| 
 |  | ||||||
| 	/// @see b2Shape::GetChildCount
 |  | ||||||
| 	int32 GetChildCount() const override; |  | ||||||
| 
 |  | ||||||
| 	/// @see b2Shape::TestPoint
 |  | ||||||
| 	bool TestPoint(const b2Transform& transform, const b2Vec2& p) const override; |  | ||||||
| 
 |  | ||||||
| 	/// Implement b2Shape.
 |  | ||||||
| 	bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input, |  | ||||||
| 				const b2Transform& transform, int32 childIndex) const override; |  | ||||||
| 
 |  | ||||||
| 	/// @see b2Shape::ComputeAABB
 |  | ||||||
| 	void ComputeAABB(b2AABB* aabb, const b2Transform& transform, int32 childIndex) const override; |  | ||||||
| 
 |  | ||||||
| 	/// @see b2Shape::ComputeMass
 |  | ||||||
| 	void ComputeMass(b2MassData* massData, float32 density) const override; |  | ||||||
| 	 |  | ||||||
| 	/// These are the edge vertices
 |  | ||||||
| 	b2Vec2 m_vertex1, m_vertex2; |  | ||||||
| 
 |  | ||||||
| 	/// Optional adjacent vertices. These are used for smooth collision.
 |  | ||||||
| 	b2Vec2 m_vertex0, m_vertex3; |  | ||||||
| 	bool m_hasVertex0, m_hasVertex3; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| inline b2EdgeShape::b2EdgeShape() |  | ||||||
| { |  | ||||||
| 	m_type = e_edge; |  | ||||||
| 	m_radius = b2_polygonRadius; |  | ||||||
| 	m_vertex0.x = 0.0f; |  | ||||||
| 	m_vertex0.y = 0.0f; |  | ||||||
| 	m_vertex3.x = 0.0f; |  | ||||||
| 	m_vertex3.y = 0.0f; |  | ||||||
| 	m_hasVertex0 = false; |  | ||||||
| 	m_hasVertex3 = false; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #endif |  | ||||||
|  | @ -1,468 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #include "Box2D/Collision/Shapes/b2PolygonShape.h" |  | ||||||
| #include <new> |  | ||||||
| 
 |  | ||||||
| b2Shape* b2PolygonShape::Clone(b2BlockAllocator* allocator) const |  | ||||||
| { |  | ||||||
| 	void* mem = allocator->Allocate(sizeof(b2PolygonShape)); |  | ||||||
| 	b2PolygonShape* clone = new (mem) b2PolygonShape; |  | ||||||
| 	*clone = *this; |  | ||||||
| 	return clone; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2PolygonShape::SetAsBox(float32 hx, float32 hy) |  | ||||||
| { |  | ||||||
| 	m_count = 4; |  | ||||||
| 	m_vertices[0].Set(-hx, -hy); |  | ||||||
| 	m_vertices[1].Set( hx, -hy); |  | ||||||
| 	m_vertices[2].Set( hx,  hy); |  | ||||||
| 	m_vertices[3].Set(-hx,  hy); |  | ||||||
| 	m_normals[0].Set(0.0f, -1.0f); |  | ||||||
| 	m_normals[1].Set(1.0f, 0.0f); |  | ||||||
| 	m_normals[2].Set(0.0f, 1.0f); |  | ||||||
| 	m_normals[3].Set(-1.0f, 0.0f); |  | ||||||
| 	m_centroid.SetZero(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2PolygonShape::SetAsBox(float32 hx, float32 hy, const b2Vec2& center, float32 angle) |  | ||||||
| { |  | ||||||
| 	m_count = 4; |  | ||||||
| 	m_vertices[0].Set(-hx, -hy); |  | ||||||
| 	m_vertices[1].Set( hx, -hy); |  | ||||||
| 	m_vertices[2].Set( hx,  hy); |  | ||||||
| 	m_vertices[3].Set(-hx,  hy); |  | ||||||
| 	m_normals[0].Set(0.0f, -1.0f); |  | ||||||
| 	m_normals[1].Set(1.0f, 0.0f); |  | ||||||
| 	m_normals[2].Set(0.0f, 1.0f); |  | ||||||
| 	m_normals[3].Set(-1.0f, 0.0f); |  | ||||||
| 	m_centroid = center; |  | ||||||
| 
 |  | ||||||
| 	b2Transform xf; |  | ||||||
| 	xf.p = center; |  | ||||||
| 	xf.q.Set(angle); |  | ||||||
| 
 |  | ||||||
| 	// Transform vertices and normals.
 |  | ||||||
| 	for (int32 i = 0; i < m_count; ++i) |  | ||||||
| 	{ |  | ||||||
| 		m_vertices[i] = b2Mul(xf, m_vertices[i]); |  | ||||||
| 		m_normals[i] = b2Mul(xf.q, m_normals[i]); |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| int32 b2PolygonShape::GetChildCount() const |  | ||||||
| { |  | ||||||
| 	return 1; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static b2Vec2 ComputeCentroid(const b2Vec2* vs, int32 count) |  | ||||||
| { |  | ||||||
| 	b2Assert(count >= 3); |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 c; c.Set(0.0f, 0.0f); |  | ||||||
| 	float32 area = 0.0f; |  | ||||||
| 
 |  | ||||||
| 	// pRef is the reference point for forming triangles.
 |  | ||||||
| 	// It's location doesn't change the result (except for rounding error).
 |  | ||||||
| 	b2Vec2 pRef(0.0f, 0.0f); |  | ||||||
| #if 0 |  | ||||||
| 	// This code would put the reference point inside the polygon.
 |  | ||||||
| 	for (int32 i = 0; i < count; ++i) |  | ||||||
| 	{ |  | ||||||
| 		pRef += vs[i]; |  | ||||||
| 	} |  | ||||||
| 	pRef *= 1.0f / count; |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| 	const float32 inv3 = 1.0f / 3.0f; |  | ||||||
| 
 |  | ||||||
| 	for (int32 i = 0; i < count; ++i) |  | ||||||
| 	{ |  | ||||||
| 		// Triangle vertices.
 |  | ||||||
| 		b2Vec2 p1 = pRef; |  | ||||||
| 		b2Vec2 p2 = vs[i]; |  | ||||||
| 		b2Vec2 p3 = i + 1 < count ? vs[i+1] : vs[0]; |  | ||||||
| 
 |  | ||||||
| 		b2Vec2 e1 = p2 - p1; |  | ||||||
| 		b2Vec2 e2 = p3 - p1; |  | ||||||
| 
 |  | ||||||
| 		float32 D = b2Cross(e1, e2); |  | ||||||
| 
 |  | ||||||
| 		float32 triangleArea = 0.5f * D; |  | ||||||
| 		area += triangleArea; |  | ||||||
| 
 |  | ||||||
| 		// Area weighted centroid
 |  | ||||||
| 		c += triangleArea * inv3 * (p1 + p2 + p3); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// Centroid
 |  | ||||||
| 	b2Assert(area > b2_epsilon); |  | ||||||
| 	c *= 1.0f / area; |  | ||||||
| 	return c; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2PolygonShape::Set(const b2Vec2* vertices, int32 count) |  | ||||||
| { |  | ||||||
| 	b2Assert(3 <= count && count <= b2_maxPolygonVertices); |  | ||||||
| 	if (count < 3) |  | ||||||
| 	{ |  | ||||||
| 		SetAsBox(1.0f, 1.0f); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	int32 n = b2Min(count, b2_maxPolygonVertices); |  | ||||||
| 
 |  | ||||||
| 	// Perform welding and copy vertices into local buffer.
 |  | ||||||
| 	b2Vec2 ps[b2_maxPolygonVertices]; |  | ||||||
| 	int32 tempCount = 0; |  | ||||||
| 	for (int32 i = 0; i < n; ++i) |  | ||||||
| 	{ |  | ||||||
| 		b2Vec2 v = vertices[i]; |  | ||||||
| 
 |  | ||||||
| 		bool unique = true; |  | ||||||
| 		for (int32 j = 0; j < tempCount; ++j) |  | ||||||
| 		{ |  | ||||||
| 			if (b2DistanceSquared(v, ps[j]) < ((0.5f * b2_linearSlop) * (0.5f * b2_linearSlop))) |  | ||||||
| 			{ |  | ||||||
| 				unique = false; |  | ||||||
| 				break; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		if (unique) |  | ||||||
| 		{ |  | ||||||
| 			ps[tempCount++] = v; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	n = tempCount; |  | ||||||
| 	if (n < 3) |  | ||||||
| 	{ |  | ||||||
| 		// Polygon is degenerate.
 |  | ||||||
| 		b2Assert(false); |  | ||||||
| 		SetAsBox(1.0f, 1.0f); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// Create the convex hull using the Gift wrapping algorithm
 |  | ||||||
| 	// http://en.wikipedia.org/wiki/Gift_wrapping_algorithm
 |  | ||||||
| 
 |  | ||||||
| 	// Find the right most point on the hull
 |  | ||||||
| 	int32 i0 = 0; |  | ||||||
| 	float32 x0 = ps[0].x; |  | ||||||
| 	for (int32 i = 1; i < n; ++i) |  | ||||||
| 	{ |  | ||||||
| 		float32 x = ps[i].x; |  | ||||||
| 		if (x > x0 || (x == x0 && ps[i].y < ps[i0].y)) |  | ||||||
| 		{ |  | ||||||
| 			i0 = i; |  | ||||||
| 			x0 = x; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	int32 hull[b2_maxPolygonVertices]; |  | ||||||
| 	int32 m = 0; |  | ||||||
| 	int32 ih = i0; |  | ||||||
| 
 |  | ||||||
| 	for (;;) |  | ||||||
| 	{ |  | ||||||
| 		b2Assert(m < b2_maxPolygonVertices); |  | ||||||
| 		hull[m] = ih; |  | ||||||
| 
 |  | ||||||
| 		int32 ie = 0; |  | ||||||
| 		for (int32 j = 1; j < n; ++j) |  | ||||||
| 		{ |  | ||||||
| 			if (ie == ih) |  | ||||||
| 			{ |  | ||||||
| 				ie = j; |  | ||||||
| 				continue; |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			b2Vec2 r = ps[ie] - ps[hull[m]]; |  | ||||||
| 			b2Vec2 v = ps[j] - ps[hull[m]]; |  | ||||||
| 			float32 c = b2Cross(r, v); |  | ||||||
| 			if (c < 0.0f) |  | ||||||
| 			{ |  | ||||||
| 				ie = j; |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			// Collinearity check
 |  | ||||||
| 			if (c == 0.0f && v.LengthSquared() > r.LengthSquared()) |  | ||||||
| 			{ |  | ||||||
| 				ie = j; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		++m; |  | ||||||
| 		ih = ie; |  | ||||||
| 
 |  | ||||||
| 		if (ie == i0) |  | ||||||
| 		{ |  | ||||||
| 			break; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	if (m < 3) |  | ||||||
| 	{ |  | ||||||
| 		// Polygon is degenerate.
 |  | ||||||
| 		b2Assert(false); |  | ||||||
| 		SetAsBox(1.0f, 1.0f); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	m_count = m; |  | ||||||
| 
 |  | ||||||
| 	// Copy vertices.
 |  | ||||||
| 	for (int32 i = 0; i < m; ++i) |  | ||||||
| 	{ |  | ||||||
| 		m_vertices[i] = ps[hull[i]]; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// Compute normals. Ensure the edges have non-zero length.
 |  | ||||||
| 	for (int32 i = 0; i < m; ++i) |  | ||||||
| 	{ |  | ||||||
| 		int32 i1 = i; |  | ||||||
| 		int32 i2 = i + 1 < m ? i + 1 : 0; |  | ||||||
| 		b2Vec2 edge = m_vertices[i2] - m_vertices[i1]; |  | ||||||
| 		b2Assert(edge.LengthSquared() > b2_epsilon * b2_epsilon); |  | ||||||
| 		m_normals[i] = b2Cross(edge, 1.0f); |  | ||||||
| 		m_normals[i].Normalize(); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// Compute the polygon centroid.
 |  | ||||||
| 	m_centroid = ComputeCentroid(m_vertices, m); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| bool b2PolygonShape::TestPoint(const b2Transform& xf, const b2Vec2& p) const |  | ||||||
| { |  | ||||||
| 	b2Vec2 pLocal = b2MulT(xf.q, p - xf.p); |  | ||||||
| 
 |  | ||||||
| 	for (int32 i = 0; i < m_count; ++i) |  | ||||||
| 	{ |  | ||||||
| 		float32 dot = b2Dot(m_normals[i], pLocal - m_vertices[i]); |  | ||||||
| 		if (dot > 0.0f) |  | ||||||
| 		{ |  | ||||||
| 			return false; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	return true; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| bool b2PolygonShape::RayCast(b2RayCastOutput* output, const b2RayCastInput& input, |  | ||||||
| 								const b2Transform& xf, int32 childIndex) const |  | ||||||
| { |  | ||||||
| 	B2_NOT_USED(childIndex); |  | ||||||
| 
 |  | ||||||
| 	// Put the ray into the polygon's frame of reference.
 |  | ||||||
| 	b2Vec2 p1 = b2MulT(xf.q, input.p1 - xf.p); |  | ||||||
| 	b2Vec2 p2 = b2MulT(xf.q, input.p2 - xf.p); |  | ||||||
| 	b2Vec2 d = p2 - p1; |  | ||||||
| 
 |  | ||||||
| 	float32 lower = 0.0f, upper = input.maxFraction; |  | ||||||
| 
 |  | ||||||
| 	int32 index = -1; |  | ||||||
| 
 |  | ||||||
| 	for (int32 i = 0; i < m_count; ++i) |  | ||||||
| 	{ |  | ||||||
| 		// p = p1 + a * d
 |  | ||||||
| 		// dot(normal, p - v) = 0
 |  | ||||||
| 		// dot(normal, p1 - v) + a * dot(normal, d) = 0
 |  | ||||||
| 		float32 numerator = b2Dot(m_normals[i], m_vertices[i] - p1); |  | ||||||
| 		float32 denominator = b2Dot(m_normals[i], d); |  | ||||||
| 
 |  | ||||||
| 		if (denominator == 0.0f) |  | ||||||
| 		{	 |  | ||||||
| 			if (numerator < 0.0f) |  | ||||||
| 			{ |  | ||||||
| 				return false; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			// Note: we want this predicate without division:
 |  | ||||||
| 			// lower < numerator / denominator, where denominator < 0
 |  | ||||||
| 			// Since denominator < 0, we have to flip the inequality:
 |  | ||||||
| 			// lower < numerator / denominator <==> denominator * lower > numerator.
 |  | ||||||
| 			if (denominator < 0.0f && numerator < lower * denominator) |  | ||||||
| 			{ |  | ||||||
| 				// Increase lower.
 |  | ||||||
| 				// The segment enters this half-space.
 |  | ||||||
| 				lower = numerator / denominator; |  | ||||||
| 				index = i; |  | ||||||
| 			} |  | ||||||
| 			else if (denominator > 0.0f && numerator < upper * denominator) |  | ||||||
| 			{ |  | ||||||
| 				// Decrease upper.
 |  | ||||||
| 				// The segment exits this half-space.
 |  | ||||||
| 				upper = numerator / denominator; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		// The use of epsilon here causes the assert on lower to trip
 |  | ||||||
| 		// in some cases. Apparently the use of epsilon was to make edge
 |  | ||||||
| 		// shapes work, but now those are handled separately.
 |  | ||||||
| 		//if (upper < lower - b2_epsilon)
 |  | ||||||
| 		if (upper < lower) |  | ||||||
| 		{ |  | ||||||
| 			return false; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	b2Assert(0.0f <= lower && lower <= input.maxFraction); |  | ||||||
| 
 |  | ||||||
| 	if (index >= 0) |  | ||||||
| 	{ |  | ||||||
| 		output->fraction = lower; |  | ||||||
| 		output->normal = b2Mul(xf.q, m_normals[index]); |  | ||||||
| 		return true; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	return false; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2PolygonShape::ComputeAABB(b2AABB* aabb, const b2Transform& xf, int32 childIndex) const |  | ||||||
| { |  | ||||||
| 	B2_NOT_USED(childIndex); |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 lower = b2Mul(xf, m_vertices[0]); |  | ||||||
| 	b2Vec2 upper = lower; |  | ||||||
| 
 |  | ||||||
| 	for (int32 i = 1; i < m_count; ++i) |  | ||||||
| 	{ |  | ||||||
| 		b2Vec2 v = b2Mul(xf, m_vertices[i]); |  | ||||||
| 		lower = b2Min(lower, v); |  | ||||||
| 		upper = b2Max(upper, v); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 r(m_radius, m_radius); |  | ||||||
| 	aabb->lowerBound = lower - r; |  | ||||||
| 	aabb->upperBound = upper + r; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2PolygonShape::ComputeMass(b2MassData* massData, float32 density) const |  | ||||||
| { |  | ||||||
| 	// Polygon mass, centroid, and inertia.
 |  | ||||||
| 	// Let rho be the polygon density in mass per unit area.
 |  | ||||||
| 	// Then:
 |  | ||||||
| 	// mass = rho * int(dA)
 |  | ||||||
| 	// centroid.x = (1/mass) * rho * int(x * dA)
 |  | ||||||
| 	// centroid.y = (1/mass) * rho * int(y * dA)
 |  | ||||||
| 	// I = rho * int((x*x + y*y) * dA)
 |  | ||||||
| 	//
 |  | ||||||
| 	// We can compute these integrals by summing all the integrals
 |  | ||||||
| 	// for each triangle of the polygon. To evaluate the integral
 |  | ||||||
| 	// for a single triangle, we make a change of variables to
 |  | ||||||
| 	// the (u,v) coordinates of the triangle:
 |  | ||||||
| 	// x = x0 + e1x * u + e2x * v
 |  | ||||||
| 	// y = y0 + e1y * u + e2y * v
 |  | ||||||
| 	// where 0 <= u && 0 <= v && u + v <= 1.
 |  | ||||||
| 	//
 |  | ||||||
| 	// We integrate u from [0,1-v] and then v from [0,1].
 |  | ||||||
| 	// We also need to use the Jacobian of the transformation:
 |  | ||||||
| 	// D = cross(e1, e2)
 |  | ||||||
| 	//
 |  | ||||||
| 	// Simplification: triangle centroid = (1/3) * (p1 + p2 + p3)
 |  | ||||||
| 	//
 |  | ||||||
| 	// The rest of the derivation is handled by computer algebra.
 |  | ||||||
| 
 |  | ||||||
| 	b2Assert(m_count >= 3); |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 center; center.Set(0.0f, 0.0f); |  | ||||||
| 	float32 area = 0.0f; |  | ||||||
| 	float32 I = 0.0f; |  | ||||||
| 
 |  | ||||||
| 	// s is the reference point for forming triangles.
 |  | ||||||
| 	// It's location doesn't change the result (except for rounding error).
 |  | ||||||
| 	b2Vec2 s(0.0f, 0.0f); |  | ||||||
| 
 |  | ||||||
| 	// This code would put the reference point inside the polygon.
 |  | ||||||
| 	for (int32 i = 0; i < m_count; ++i) |  | ||||||
| 	{ |  | ||||||
| 		s += m_vertices[i]; |  | ||||||
| 	} |  | ||||||
| 	s *= 1.0f / m_count; |  | ||||||
| 
 |  | ||||||
| 	const float32 k_inv3 = 1.0f / 3.0f; |  | ||||||
| 
 |  | ||||||
| 	for (int32 i = 0; i < m_count; ++i) |  | ||||||
| 	{ |  | ||||||
| 		// Triangle vertices.
 |  | ||||||
| 		b2Vec2 e1 = m_vertices[i] - s; |  | ||||||
| 		b2Vec2 e2 = i + 1 < m_count ? m_vertices[i+1] - s : m_vertices[0] - s; |  | ||||||
| 
 |  | ||||||
| 		float32 D = b2Cross(e1, e2); |  | ||||||
| 
 |  | ||||||
| 		float32 triangleArea = 0.5f * D; |  | ||||||
| 		area += triangleArea; |  | ||||||
| 
 |  | ||||||
| 		// Area weighted centroid
 |  | ||||||
| 		center += triangleArea * k_inv3 * (e1 + e2); |  | ||||||
| 
 |  | ||||||
| 		float32 ex1 = e1.x, ey1 = e1.y; |  | ||||||
| 		float32 ex2 = e2.x, ey2 = e2.y; |  | ||||||
| 
 |  | ||||||
| 		float32 intx2 = ex1*ex1 + ex2*ex1 + ex2*ex2; |  | ||||||
| 		float32 inty2 = ey1*ey1 + ey2*ey1 + ey2*ey2; |  | ||||||
| 
 |  | ||||||
| 		I += (0.25f * k_inv3 * D) * (intx2 + inty2); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// Total mass
 |  | ||||||
| 	massData->mass = density * area; |  | ||||||
| 
 |  | ||||||
| 	// Center of mass
 |  | ||||||
| 	b2Assert(area > b2_epsilon); |  | ||||||
| 	center *= 1.0f / area; |  | ||||||
| 	massData->center = center + s; |  | ||||||
| 
 |  | ||||||
| 	// Inertia tensor relative to the local origin (point s).
 |  | ||||||
| 	massData->I = density * I; |  | ||||||
| 	 |  | ||||||
| 	// Shift to center of mass then to original body origin.
 |  | ||||||
| 	massData->I += massData->mass * (b2Dot(massData->center, massData->center) - b2Dot(center, center)); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| bool b2PolygonShape::Validate() const |  | ||||||
| { |  | ||||||
| 	for (int32 i = 0; i < m_count; ++i) |  | ||||||
| 	{ |  | ||||||
| 		int32 i1 = i; |  | ||||||
| 		int32 i2 = i < m_count - 1 ? i1 + 1 : 0; |  | ||||||
| 		b2Vec2 p = m_vertices[i1]; |  | ||||||
| 		b2Vec2 e = m_vertices[i2] - p; |  | ||||||
| 
 |  | ||||||
| 		for (int32 j = 0; j < m_count; ++j) |  | ||||||
| 		{ |  | ||||||
| 			if (j == i1 || j == i2) |  | ||||||
| 			{ |  | ||||||
| 				continue; |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			b2Vec2 v = m_vertices[j] - p; |  | ||||||
| 			float32 c = b2Cross(e, v); |  | ||||||
| 			if (c < 0.0f) |  | ||||||
| 			{ |  | ||||||
| 				return false; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	return true; |  | ||||||
| } |  | ||||||
|  | @ -1,89 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #ifndef B2_POLYGON_SHAPE_H |  | ||||||
| #define B2_POLYGON_SHAPE_H |  | ||||||
| 
 |  | ||||||
| #include "b2Shape.h" |  | ||||||
| 
 |  | ||||||
| /// A convex polygon. It is assumed that the interior of the polygon is to
 |  | ||||||
| /// the left of each edge.
 |  | ||||||
| /// Polygons have a maximum number of vertices equal to b2_maxPolygonVertices.
 |  | ||||||
| /// In most cases you should not need many vertices for a convex polygon.
 |  | ||||||
| class b2PolygonShape : public b2Shape |  | ||||||
| { |  | ||||||
| public: |  | ||||||
| 	b2PolygonShape(); |  | ||||||
| 
 |  | ||||||
| 	/// Implement b2Shape.
 |  | ||||||
| 	b2Shape* Clone(b2BlockAllocator* allocator) const override; |  | ||||||
| 
 |  | ||||||
| 	/// @see b2Shape::GetChildCount
 |  | ||||||
| 	int32 GetChildCount() const override; |  | ||||||
| 
 |  | ||||||
| 	/// Create a convex hull from the given array of local points.
 |  | ||||||
| 	/// The count must be in the range [3, b2_maxPolygonVertices].
 |  | ||||||
| 	/// @warning the points may be re-ordered, even if they form a convex polygon
 |  | ||||||
| 	/// @warning collinear points are handled but not removed. Collinear points
 |  | ||||||
| 	/// may lead to poor stacking behavior.
 |  | ||||||
| 	void Set(const b2Vec2* points, int32 count); |  | ||||||
| 
 |  | ||||||
| 	/// Build vertices to represent an axis-aligned box centered on the local origin.
 |  | ||||||
| 	/// @param hx the half-width.
 |  | ||||||
| 	/// @param hy the half-height.
 |  | ||||||
| 	void SetAsBox(float32 hx, float32 hy); |  | ||||||
| 
 |  | ||||||
| 	/// Build vertices to represent an oriented box.
 |  | ||||||
| 	/// @param hx the half-width.
 |  | ||||||
| 	/// @param hy the half-height.
 |  | ||||||
| 	/// @param center the center of the box in local coordinates.
 |  | ||||||
| 	/// @param angle the rotation of the box in local coordinates.
 |  | ||||||
| 	void SetAsBox(float32 hx, float32 hy, const b2Vec2& center, float32 angle); |  | ||||||
| 
 |  | ||||||
| 	/// @see b2Shape::TestPoint
 |  | ||||||
| 	bool TestPoint(const b2Transform& transform, const b2Vec2& p) const override; |  | ||||||
| 
 |  | ||||||
| 	/// Implement b2Shape.
 |  | ||||||
| 	bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input, |  | ||||||
| 					const b2Transform& transform, int32 childIndex) const override; |  | ||||||
| 
 |  | ||||||
| 	/// @see b2Shape::ComputeAABB
 |  | ||||||
| 	void ComputeAABB(b2AABB* aabb, const b2Transform& transform, int32 childIndex) const override; |  | ||||||
| 
 |  | ||||||
| 	/// @see b2Shape::ComputeMass
 |  | ||||||
| 	void ComputeMass(b2MassData* massData, float32 density) const override; |  | ||||||
| 
 |  | ||||||
| 	/// Validate convexity. This is a very time consuming operation.
 |  | ||||||
| 	/// @returns true if valid
 |  | ||||||
| 	bool Validate() const; |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 m_centroid; |  | ||||||
| 	b2Vec2 m_vertices[b2_maxPolygonVertices]; |  | ||||||
| 	b2Vec2 m_normals[b2_maxPolygonVertices]; |  | ||||||
| 	int32 m_count; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| inline b2PolygonShape::b2PolygonShape() |  | ||||||
| { |  | ||||||
| 	m_type = e_polygon; |  | ||||||
| 	m_radius = b2_polygonRadius; |  | ||||||
| 	m_count = 0; |  | ||||||
| 	m_centroid.SetZero(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #endif |  | ||||||
|  | @ -1,104 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #ifndef B2_SHAPE_H |  | ||||||
| #define B2_SHAPE_H |  | ||||||
| 
 |  | ||||||
| #include "../../Common/b2BlockAllocator.h" |  | ||||||
| #include "../../Common/b2Math.h" |  | ||||||
| #include "../../Collision/b2Collision.h" |  | ||||||
| 
 |  | ||||||
| /// This holds the mass data computed for a shape.
 |  | ||||||
| struct b2MassData |  | ||||||
| { |  | ||||||
| 	/// The mass of the shape, usually in kilograms.
 |  | ||||||
| 	float32 mass; |  | ||||||
| 
 |  | ||||||
| 	/// The position of the shape's centroid relative to the shape's origin.
 |  | ||||||
| 	b2Vec2 center; |  | ||||||
| 
 |  | ||||||
| 	/// The rotational inertia of the shape about the local origin.
 |  | ||||||
| 	float32 I; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// A shape is used for collision detection. You can create a shape however you like.
 |  | ||||||
| /// Shapes used for simulation in b2World are created automatically when a b2Fixture
 |  | ||||||
| /// is created. Shapes may encapsulate a one or more child shapes.
 |  | ||||||
| class b2Shape |  | ||||||
| { |  | ||||||
| public: |  | ||||||
| 	 |  | ||||||
| 	enum Type |  | ||||||
| 	{ |  | ||||||
| 		e_circle = 0, |  | ||||||
| 		e_edge = 1, |  | ||||||
| 		e_polygon = 2, |  | ||||||
| 		e_chain = 3, |  | ||||||
| 		e_typeCount = 4 |  | ||||||
| 	}; |  | ||||||
| 
 |  | ||||||
| 	virtual ~b2Shape() {} |  | ||||||
| 
 |  | ||||||
| 	/// Clone the concrete shape using the provided allocator.
 |  | ||||||
| 	virtual b2Shape* Clone(b2BlockAllocator* allocator) const = 0; |  | ||||||
| 
 |  | ||||||
| 	/// Get the type of this shape. You can use this to down cast to the concrete shape.
 |  | ||||||
| 	/// @return the shape type.
 |  | ||||||
| 	Type GetType() const; |  | ||||||
| 
 |  | ||||||
| 	/// Get the number of child primitives.
 |  | ||||||
| 	virtual int32 GetChildCount() const = 0; |  | ||||||
| 
 |  | ||||||
| 	/// Test a point for containment in this shape. This only works for convex shapes.
 |  | ||||||
| 	/// @param xf the shape world transform.
 |  | ||||||
| 	/// @param p a point in world coordinates.
 |  | ||||||
| 	virtual bool TestPoint(const b2Transform& xf, const b2Vec2& p) const = 0; |  | ||||||
| 
 |  | ||||||
| 	/// Cast a ray against a child shape.
 |  | ||||||
| 	/// @param output the ray-cast results.
 |  | ||||||
| 	/// @param input the ray-cast input parameters.
 |  | ||||||
| 	/// @param transform the transform to be applied to the shape.
 |  | ||||||
| 	/// @param childIndex the child shape index
 |  | ||||||
| 	virtual bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input, |  | ||||||
| 						const b2Transform& transform, int32 childIndex) const = 0; |  | ||||||
| 
 |  | ||||||
| 	/// Given a transform, compute the associated axis aligned bounding box for a child shape.
 |  | ||||||
| 	/// @param aabb returns the axis aligned box.
 |  | ||||||
| 	/// @param xf the world transform of the shape.
 |  | ||||||
| 	/// @param childIndex the child shape
 |  | ||||||
| 	virtual void ComputeAABB(b2AABB* aabb, const b2Transform& xf, int32 childIndex) const = 0; |  | ||||||
| 
 |  | ||||||
| 	/// Compute the mass properties of this shape using its dimensions and density.
 |  | ||||||
| 	/// The inertia tensor is computed about the local origin.
 |  | ||||||
| 	/// @param massData returns the mass data for this shape.
 |  | ||||||
| 	/// @param density the density in kilograms per meter squared.
 |  | ||||||
| 	virtual void ComputeMass(b2MassData* massData, float32 density) const = 0; |  | ||||||
| 
 |  | ||||||
| 	Type m_type; |  | ||||||
| 
 |  | ||||||
| 	/// Radius of a shape. For polygonal shapes this must be b2_polygonRadius. There is no support for
 |  | ||||||
| 	/// making rounded polygons.
 |  | ||||||
| 	float32 m_radius; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| inline b2Shape::Type b2Shape::GetType() const |  | ||||||
| { |  | ||||||
| 	return m_type; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #endif |  | ||||||
|  | @ -1,119 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #include "Box2D/Collision/b2BroadPhase.h" |  | ||||||
| 
 |  | ||||||
| b2BroadPhase::b2BroadPhase() |  | ||||||
| { |  | ||||||
| 	m_proxyCount = 0; |  | ||||||
| 
 |  | ||||||
| 	m_pairCapacity = 16; |  | ||||||
| 	m_pairCount = 0; |  | ||||||
| 	m_pairBuffer = (b2Pair*)b2Alloc(m_pairCapacity * sizeof(b2Pair)); |  | ||||||
| 
 |  | ||||||
| 	m_moveCapacity = 16; |  | ||||||
| 	m_moveCount = 0; |  | ||||||
| 	m_moveBuffer = (int32*)b2Alloc(m_moveCapacity * sizeof(int32)); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| b2BroadPhase::~b2BroadPhase() |  | ||||||
| { |  | ||||||
| 	b2Free(m_moveBuffer); |  | ||||||
| 	b2Free(m_pairBuffer); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| int32 b2BroadPhase::CreateProxy(const b2AABB& aabb, void* userData) |  | ||||||
| { |  | ||||||
| 	int32 proxyId = m_tree.CreateProxy(aabb, userData); |  | ||||||
| 	++m_proxyCount; |  | ||||||
| 	BufferMove(proxyId); |  | ||||||
| 	return proxyId; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2BroadPhase::DestroyProxy(int32 proxyId) |  | ||||||
| { |  | ||||||
| 	UnBufferMove(proxyId); |  | ||||||
| 	--m_proxyCount; |  | ||||||
| 	m_tree.DestroyProxy(proxyId); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2BroadPhase::MoveProxy(int32 proxyId, const b2AABB& aabb, const b2Vec2& displacement) |  | ||||||
| { |  | ||||||
| 	bool buffer = m_tree.MoveProxy(proxyId, aabb, displacement); |  | ||||||
| 	if (buffer) |  | ||||||
| 	{ |  | ||||||
| 		BufferMove(proxyId); |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2BroadPhase::TouchProxy(int32 proxyId) |  | ||||||
| { |  | ||||||
| 	BufferMove(proxyId); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2BroadPhase::BufferMove(int32 proxyId) |  | ||||||
| { |  | ||||||
| 	if (m_moveCount == m_moveCapacity) |  | ||||||
| 	{ |  | ||||||
| 		int32* oldBuffer = m_moveBuffer; |  | ||||||
| 		m_moveCapacity *= 2; |  | ||||||
| 		m_moveBuffer = (int32*)b2Alloc(m_moveCapacity * sizeof(int32)); |  | ||||||
| 		memcpy(m_moveBuffer, oldBuffer, m_moveCount * sizeof(int32)); |  | ||||||
| 		b2Free(oldBuffer); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	m_moveBuffer[m_moveCount] = proxyId; |  | ||||||
| 	++m_moveCount; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2BroadPhase::UnBufferMove(int32 proxyId) |  | ||||||
| { |  | ||||||
| 	for (int32 i = 0; i < m_moveCount; ++i) |  | ||||||
| 	{ |  | ||||||
| 		if (m_moveBuffer[i] == proxyId) |  | ||||||
| 		{ |  | ||||||
| 			m_moveBuffer[i] = e_nullProxy; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // This is called from b2DynamicTree::Query when we are gathering pairs.
 |  | ||||||
| bool b2BroadPhase::QueryCallback(int32 proxyId) |  | ||||||
| { |  | ||||||
| 	// A proxy cannot form a pair with itself.
 |  | ||||||
| 	if (proxyId == m_queryProxyId) |  | ||||||
| 	{ |  | ||||||
| 		return true; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// Grow the pair buffer as needed.
 |  | ||||||
| 	if (m_pairCount == m_pairCapacity) |  | ||||||
| 	{ |  | ||||||
| 		b2Pair* oldBuffer = m_pairBuffer; |  | ||||||
| 		m_pairCapacity *= 2; |  | ||||||
| 		m_pairBuffer = (b2Pair*)b2Alloc(m_pairCapacity * sizeof(b2Pair)); |  | ||||||
| 		memcpy(m_pairBuffer, oldBuffer, m_pairCount * sizeof(b2Pair)); |  | ||||||
| 		b2Free(oldBuffer); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	m_pairBuffer[m_pairCount].proxyIdA = b2Min(proxyId, m_queryProxyId); |  | ||||||
| 	m_pairBuffer[m_pairCount].proxyIdB = b2Max(proxyId, m_queryProxyId); |  | ||||||
| 	++m_pairCount; |  | ||||||
| 
 |  | ||||||
| 	return true; |  | ||||||
| } |  | ||||||
|  | @ -1,257 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #ifndef B2_BROAD_PHASE_H |  | ||||||
| #define B2_BROAD_PHASE_H |  | ||||||
| 
 |  | ||||||
| #include "../Common/b2Settings.h" |  | ||||||
| #include "b2Collision.h" |  | ||||||
| #include "b2DynamicTree.h" |  | ||||||
| #include <algorithm> |  | ||||||
| 
 |  | ||||||
| struct b2Pair |  | ||||||
| { |  | ||||||
| 	int32 proxyIdA; |  | ||||||
| 	int32 proxyIdB; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// The broad-phase is used for computing pairs and performing volume queries and ray casts.
 |  | ||||||
| /// This broad-phase does not persist pairs. Instead, this reports potentially new pairs.
 |  | ||||||
| /// It is up to the client to consume the new pairs and to track subsequent overlap.
 |  | ||||||
| class b2BroadPhase |  | ||||||
| { |  | ||||||
| public: |  | ||||||
| 
 |  | ||||||
| 	enum |  | ||||||
| 	{ |  | ||||||
| 		e_nullProxy = -1 |  | ||||||
| 	}; |  | ||||||
| 
 |  | ||||||
| 	b2BroadPhase(); |  | ||||||
| 	~b2BroadPhase(); |  | ||||||
| 
 |  | ||||||
| 	/// Create a proxy with an initial AABB. Pairs are not reported until
 |  | ||||||
| 	/// UpdatePairs is called.
 |  | ||||||
| 	int32 CreateProxy(const b2AABB& aabb, void* userData); |  | ||||||
| 
 |  | ||||||
| 	/// Destroy a proxy. It is up to the client to remove any pairs.
 |  | ||||||
| 	void DestroyProxy(int32 proxyId); |  | ||||||
| 
 |  | ||||||
| 	/// Call MoveProxy as many times as you like, then when you are done
 |  | ||||||
| 	/// call UpdatePairs to finalized the proxy pairs (for your time step).
 |  | ||||||
| 	void MoveProxy(int32 proxyId, const b2AABB& aabb, const b2Vec2& displacement); |  | ||||||
| 
 |  | ||||||
| 	/// Call to trigger a re-processing of it's pairs on the next call to UpdatePairs.
 |  | ||||||
| 	void TouchProxy(int32 proxyId); |  | ||||||
| 
 |  | ||||||
| 	/// Get the fat AABB for a proxy.
 |  | ||||||
| 	const b2AABB& GetFatAABB(int32 proxyId) const; |  | ||||||
| 
 |  | ||||||
| 	/// Get user data from a proxy. Returns nullptr if the id is invalid.
 |  | ||||||
| 	void* GetUserData(int32 proxyId) const; |  | ||||||
| 
 |  | ||||||
| 	/// Test overlap of fat AABBs.
 |  | ||||||
| 	bool TestOverlap(int32 proxyIdA, int32 proxyIdB) const; |  | ||||||
| 
 |  | ||||||
| 	/// Get the number of proxies.
 |  | ||||||
| 	int32 GetProxyCount() const; |  | ||||||
| 
 |  | ||||||
| 	/// Update the pairs. This results in pair callbacks. This can only add pairs.
 |  | ||||||
| 	template <typename T> |  | ||||||
| 	void UpdatePairs(T* callback); |  | ||||||
| 
 |  | ||||||
| 	/// Query an AABB for overlapping proxies. The callback class
 |  | ||||||
| 	/// is called for each proxy that overlaps the supplied AABB.
 |  | ||||||
| 	template <typename T> |  | ||||||
| 	void Query(T* callback, const b2AABB& aabb) const; |  | ||||||
| 
 |  | ||||||
| 	/// Ray-cast against the proxies in the tree. This relies on the callback
 |  | ||||||
| 	/// to perform a exact ray-cast in the case were the proxy contains a shape.
 |  | ||||||
| 	/// The callback also performs the any collision filtering. This has performance
 |  | ||||||
| 	/// roughly equal to k * log(n), where k is the number of collisions and n is the
 |  | ||||||
| 	/// number of proxies in the tree.
 |  | ||||||
| 	/// @param input the ray-cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1).
 |  | ||||||
| 	/// @param callback a callback class that is called for each proxy that is hit by the ray.
 |  | ||||||
| 	template <typename T> |  | ||||||
| 	void RayCast(T* callback, const b2RayCastInput& input) const; |  | ||||||
| 
 |  | ||||||
| 	/// Get the height of the embedded tree.
 |  | ||||||
| 	int32 GetTreeHeight() const; |  | ||||||
| 
 |  | ||||||
| 	/// Get the balance of the embedded tree.
 |  | ||||||
| 	int32 GetTreeBalance() const; |  | ||||||
| 
 |  | ||||||
| 	/// Get the quality metric of the embedded tree.
 |  | ||||||
| 	float32 GetTreeQuality() const; |  | ||||||
| 
 |  | ||||||
| 	/// Shift the world origin. Useful for large worlds.
 |  | ||||||
| 	/// The shift formula is: position -= newOrigin
 |  | ||||||
| 	/// @param newOrigin the new origin with respect to the old origin
 |  | ||||||
| 	void ShiftOrigin(const b2Vec2& newOrigin); |  | ||||||
| 
 |  | ||||||
| private: |  | ||||||
| 
 |  | ||||||
| 	friend class b2DynamicTree; |  | ||||||
| 
 |  | ||||||
| 	void BufferMove(int32 proxyId); |  | ||||||
| 	void UnBufferMove(int32 proxyId); |  | ||||||
| 
 |  | ||||||
| 	bool QueryCallback(int32 proxyId); |  | ||||||
| 
 |  | ||||||
| 	b2DynamicTree m_tree; |  | ||||||
| 
 |  | ||||||
| 	int32 m_proxyCount; |  | ||||||
| 
 |  | ||||||
| 	int32* m_moveBuffer; |  | ||||||
| 	int32 m_moveCapacity; |  | ||||||
| 	int32 m_moveCount; |  | ||||||
| 
 |  | ||||||
| 	b2Pair* m_pairBuffer; |  | ||||||
| 	int32 m_pairCapacity; |  | ||||||
| 	int32 m_pairCount; |  | ||||||
| 
 |  | ||||||
| 	int32 m_queryProxyId; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// This is used to sort pairs.
 |  | ||||||
| inline bool b2PairLessThan(const b2Pair& pair1, const b2Pair& pair2) |  | ||||||
| { |  | ||||||
| 	if (pair1.proxyIdA < pair2.proxyIdA) |  | ||||||
| 	{ |  | ||||||
| 		return true; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	if (pair1.proxyIdA == pair2.proxyIdA) |  | ||||||
| 	{ |  | ||||||
| 		return pair1.proxyIdB < pair2.proxyIdB; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	return false; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline void* b2BroadPhase::GetUserData(int32 proxyId) const |  | ||||||
| { |  | ||||||
| 	return m_tree.GetUserData(proxyId); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline bool b2BroadPhase::TestOverlap(int32 proxyIdA, int32 proxyIdB) const |  | ||||||
| { |  | ||||||
| 	const b2AABB& aabbA = m_tree.GetFatAABB(proxyIdA); |  | ||||||
| 	const b2AABB& aabbB = m_tree.GetFatAABB(proxyIdB); |  | ||||||
| 	return b2TestOverlap(aabbA, aabbB); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline const b2AABB& b2BroadPhase::GetFatAABB(int32 proxyId) const |  | ||||||
| { |  | ||||||
| 	return m_tree.GetFatAABB(proxyId); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline int32 b2BroadPhase::GetProxyCount() const |  | ||||||
| { |  | ||||||
| 	return m_proxyCount; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline int32 b2BroadPhase::GetTreeHeight() const |  | ||||||
| { |  | ||||||
| 	return m_tree.GetHeight(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline int32 b2BroadPhase::GetTreeBalance() const |  | ||||||
| { |  | ||||||
| 	return m_tree.GetMaxBalance(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline float32 b2BroadPhase::GetTreeQuality() const |  | ||||||
| { |  | ||||||
| 	return m_tree.GetAreaRatio(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| template <typename T> |  | ||||||
| void b2BroadPhase::UpdatePairs(T* callback) |  | ||||||
| { |  | ||||||
| 	// Reset pair buffer
 |  | ||||||
| 	m_pairCount = 0; |  | ||||||
| 
 |  | ||||||
| 	// Perform tree queries for all moving proxies.
 |  | ||||||
| 	for (int32 i = 0; i < m_moveCount; ++i) |  | ||||||
| 	{ |  | ||||||
| 		m_queryProxyId = m_moveBuffer[i]; |  | ||||||
| 		if (m_queryProxyId == e_nullProxy) |  | ||||||
| 		{ |  | ||||||
| 			continue; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		// We have to query the tree with the fat AABB so that
 |  | ||||||
| 		// we don't fail to create a pair that may touch later.
 |  | ||||||
| 		const b2AABB& fatAABB = m_tree.GetFatAABB(m_queryProxyId); |  | ||||||
| 
 |  | ||||||
| 		// Query tree, create pairs and add them pair buffer.
 |  | ||||||
| 		m_tree.Query(this, fatAABB); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// Reset move buffer
 |  | ||||||
| 	m_moveCount = 0; |  | ||||||
| 
 |  | ||||||
| 	// Sort the pair buffer to expose duplicates.
 |  | ||||||
| 	std::sort(m_pairBuffer, m_pairBuffer + m_pairCount, b2PairLessThan); |  | ||||||
| 
 |  | ||||||
| 	// Send the pairs back to the client.
 |  | ||||||
| 	int32 i = 0; |  | ||||||
| 	while (i < m_pairCount) |  | ||||||
| 	{ |  | ||||||
| 		b2Pair* primaryPair = m_pairBuffer + i; |  | ||||||
| 		void* userDataA = m_tree.GetUserData(primaryPair->proxyIdA); |  | ||||||
| 		void* userDataB = m_tree.GetUserData(primaryPair->proxyIdB); |  | ||||||
| 
 |  | ||||||
| 		callback->AddPair(userDataA, userDataB); |  | ||||||
| 		++i; |  | ||||||
| 
 |  | ||||||
| 		// Skip any duplicate pairs.
 |  | ||||||
| 		while (i < m_pairCount) |  | ||||||
| 		{ |  | ||||||
| 			b2Pair* pair = m_pairBuffer + i; |  | ||||||
| 			if (pair->proxyIdA != primaryPair->proxyIdA || pair->proxyIdB != primaryPair->proxyIdB) |  | ||||||
| 			{ |  | ||||||
| 				break; |  | ||||||
| 			} |  | ||||||
| 			++i; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// Try to keep the tree balanced.
 |  | ||||||
| 	//m_tree.Rebalance(4);
 |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| template <typename T> |  | ||||||
| inline void b2BroadPhase::Query(T* callback, const b2AABB& aabb) const |  | ||||||
| { |  | ||||||
| 	m_tree.Query(callback, aabb); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| template <typename T> |  | ||||||
| inline void b2BroadPhase::RayCast(T* callback, const b2RayCastInput& input) const |  | ||||||
| { |  | ||||||
| 	m_tree.RayCast(callback, input); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline void b2BroadPhase::ShiftOrigin(const b2Vec2& newOrigin) |  | ||||||
| { |  | ||||||
| 	m_tree.ShiftOrigin(newOrigin); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #endif |  | ||||||
|  | @ -1,154 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2007-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #include "Box2D/Collision/b2Collision.h" |  | ||||||
| #include "Box2D/Collision/Shapes/b2CircleShape.h" |  | ||||||
| #include "Box2D/Collision/Shapes/b2PolygonShape.h" |  | ||||||
| 
 |  | ||||||
| void b2CollideCircles( |  | ||||||
| 	b2Manifold* manifold, |  | ||||||
| 	const b2CircleShape* circleA, const b2Transform& xfA, |  | ||||||
| 	const b2CircleShape* circleB, const b2Transform& xfB) |  | ||||||
| { |  | ||||||
| 	manifold->pointCount = 0; |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 pA = b2Mul(xfA, circleA->m_p); |  | ||||||
| 	b2Vec2 pB = b2Mul(xfB, circleB->m_p); |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 d = pB - pA; |  | ||||||
| 	float32 distSqr = b2Dot(d, d); |  | ||||||
| 	float32 rA = circleA->m_radius, rB = circleB->m_radius; |  | ||||||
| 	float32 radius = rA + rB; |  | ||||||
| 	if (distSqr > radius * radius) |  | ||||||
| 	{ |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	manifold->type = b2Manifold::e_circles; |  | ||||||
| 	manifold->localPoint = circleA->m_p; |  | ||||||
| 	manifold->localNormal.SetZero(); |  | ||||||
| 	manifold->pointCount = 1; |  | ||||||
| 
 |  | ||||||
| 	manifold->points[0].localPoint = circleB->m_p; |  | ||||||
| 	manifold->points[0].id.key = 0; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2CollidePolygonAndCircle( |  | ||||||
| 	b2Manifold* manifold, |  | ||||||
| 	const b2PolygonShape* polygonA, const b2Transform& xfA, |  | ||||||
| 	const b2CircleShape* circleB, const b2Transform& xfB) |  | ||||||
| { |  | ||||||
| 	manifold->pointCount = 0; |  | ||||||
| 
 |  | ||||||
| 	// Compute circle position in the frame of the polygon.
 |  | ||||||
| 	b2Vec2 c = b2Mul(xfB, circleB->m_p); |  | ||||||
| 	b2Vec2 cLocal = b2MulT(xfA, c); |  | ||||||
| 
 |  | ||||||
| 	// Find the min separating edge.
 |  | ||||||
| 	int32 normalIndex = 0; |  | ||||||
| 	float32 separation = -b2_maxFloat; |  | ||||||
| 	float32 radius = polygonA->m_radius + circleB->m_radius; |  | ||||||
| 	int32 vertexCount = polygonA->m_count; |  | ||||||
| 	const b2Vec2* vertices = polygonA->m_vertices; |  | ||||||
| 	const b2Vec2* normals = polygonA->m_normals; |  | ||||||
| 
 |  | ||||||
| 	for (int32 i = 0; i < vertexCount; ++i) |  | ||||||
| 	{ |  | ||||||
| 		float32 s = b2Dot(normals[i], cLocal - vertices[i]); |  | ||||||
| 
 |  | ||||||
| 		if (s > radius) |  | ||||||
| 		{ |  | ||||||
| 			// Early out.
 |  | ||||||
| 			return; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		if (s > separation) |  | ||||||
| 		{ |  | ||||||
| 			separation = s; |  | ||||||
| 			normalIndex = i; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// Vertices that subtend the incident face.
 |  | ||||||
| 	int32 vertIndex1 = normalIndex; |  | ||||||
| 	int32 vertIndex2 = vertIndex1 + 1 < vertexCount ? vertIndex1 + 1 : 0; |  | ||||||
| 	b2Vec2 v1 = vertices[vertIndex1]; |  | ||||||
| 	b2Vec2 v2 = vertices[vertIndex2]; |  | ||||||
| 
 |  | ||||||
| 	// If the center is inside the polygon ...
 |  | ||||||
| 	if (separation < b2_epsilon) |  | ||||||
| 	{ |  | ||||||
| 		manifold->pointCount = 1; |  | ||||||
| 		manifold->type = b2Manifold::e_faceA; |  | ||||||
| 		manifold->localNormal = normals[normalIndex]; |  | ||||||
| 		manifold->localPoint = 0.5f * (v1 + v2); |  | ||||||
| 		manifold->points[0].localPoint = circleB->m_p; |  | ||||||
| 		manifold->points[0].id.key = 0; |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// Compute barycentric coordinates
 |  | ||||||
| 	float32 u1 = b2Dot(cLocal - v1, v2 - v1); |  | ||||||
| 	float32 u2 = b2Dot(cLocal - v2, v1 - v2); |  | ||||||
| 	if (u1 <= 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		if (b2DistanceSquared(cLocal, v1) > radius * radius) |  | ||||||
| 		{ |  | ||||||
| 			return; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		manifold->pointCount = 1; |  | ||||||
| 		manifold->type = b2Manifold::e_faceA; |  | ||||||
| 		manifold->localNormal = cLocal - v1; |  | ||||||
| 		manifold->localNormal.Normalize(); |  | ||||||
| 		manifold->localPoint = v1; |  | ||||||
| 		manifold->points[0].localPoint = circleB->m_p; |  | ||||||
| 		manifold->points[0].id.key = 0; |  | ||||||
| 	} |  | ||||||
| 	else if (u2 <= 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		if (b2DistanceSquared(cLocal, v2) > radius * radius) |  | ||||||
| 		{ |  | ||||||
| 			return; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		manifold->pointCount = 1; |  | ||||||
| 		manifold->type = b2Manifold::e_faceA; |  | ||||||
| 		manifold->localNormal = cLocal - v2; |  | ||||||
| 		manifold->localNormal.Normalize(); |  | ||||||
| 		manifold->localPoint = v2; |  | ||||||
| 		manifold->points[0].localPoint = circleB->m_p; |  | ||||||
| 		manifold->points[0].id.key = 0; |  | ||||||
| 	} |  | ||||||
| 	else |  | ||||||
| 	{ |  | ||||||
| 		b2Vec2 faceCenter = 0.5f * (v1 + v2); |  | ||||||
| 		float32 s = b2Dot(cLocal - faceCenter, normals[vertIndex1]); |  | ||||||
| 		if (s > radius) |  | ||||||
| 		{ |  | ||||||
| 			return; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		manifold->pointCount = 1; |  | ||||||
| 		manifold->type = b2Manifold::e_faceA; |  | ||||||
| 		manifold->localNormal = normals[vertIndex1]; |  | ||||||
| 		manifold->localPoint = faceCenter; |  | ||||||
| 		manifold->points[0].localPoint = circleB->m_p; |  | ||||||
| 		manifold->points[0].id.key = 0; |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  | @ -1,698 +0,0 @@ | ||||||
| /*
 |  | ||||||
|  * Copyright (c) 2007-2009 Erin Catto http://www.box2d.org
 |  | ||||||
|  * |  | ||||||
|  * This software is provided 'as-is', without any express or implied |  | ||||||
|  * warranty.  In no event will the authors be held liable for any damages |  | ||||||
|  * arising from the use of this software. |  | ||||||
|  * Permission is granted to anyone to use this software for any purpose, |  | ||||||
|  * including commercial applications, and to alter it and redistribute it |  | ||||||
|  * freely, subject to the following restrictions: |  | ||||||
|  * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
|  * claim that you wrote the original software. If you use this software |  | ||||||
|  * in a product, an acknowledgment in the product documentation would be |  | ||||||
|  * appreciated but is not required. |  | ||||||
|  * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
|  * misrepresented as being the original software. |  | ||||||
|  * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
|  */ |  | ||||||
| 
 |  | ||||||
| #include "Box2D/Collision/b2Collision.h" |  | ||||||
| #include "Box2D/Collision/Shapes/b2CircleShape.h" |  | ||||||
| #include "Box2D/Collision/Shapes/b2EdgeShape.h" |  | ||||||
| #include "Box2D/Collision/Shapes/b2PolygonShape.h" |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| // Compute contact points for edge versus circle.
 |  | ||||||
| // This accounts for edge connectivity.
 |  | ||||||
| void b2CollideEdgeAndCircle(b2Manifold* manifold, |  | ||||||
| 							const b2EdgeShape* edgeA, const b2Transform& xfA, |  | ||||||
| 							const b2CircleShape* circleB, const b2Transform& xfB) |  | ||||||
| { |  | ||||||
| 	manifold->pointCount = 0; |  | ||||||
| 	 |  | ||||||
| 	// Compute circle in frame of edge
 |  | ||||||
| 	b2Vec2 Q = b2MulT(xfA, b2Mul(xfB, circleB->m_p)); |  | ||||||
| 	 |  | ||||||
| 	b2Vec2 A = edgeA->m_vertex1, B = edgeA->m_vertex2; |  | ||||||
| 	b2Vec2 e = B - A; |  | ||||||
| 	 |  | ||||||
| 	// Barycentric coordinates
 |  | ||||||
| 	float32 u = b2Dot(e, B - Q); |  | ||||||
| 	float32 v = b2Dot(e, Q - A); |  | ||||||
| 	 |  | ||||||
| 	float32 radius = edgeA->m_radius + circleB->m_radius; |  | ||||||
| 	 |  | ||||||
| 	b2ContactFeature cf; |  | ||||||
| 	cf.indexB = 0; |  | ||||||
| 	cf.typeB = b2ContactFeature::e_vertex; |  | ||||||
| 	 |  | ||||||
| 	// Region A
 |  | ||||||
| 	if (v <= 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		b2Vec2 P = A; |  | ||||||
| 		b2Vec2 d = Q - P; |  | ||||||
| 		float32 dd = b2Dot(d, d); |  | ||||||
| 		if (dd > radius * radius) |  | ||||||
| 		{ |  | ||||||
| 			return; |  | ||||||
| 		} |  | ||||||
| 		 |  | ||||||
| 		// Is there an edge connected to A?
 |  | ||||||
| 		if (edgeA->m_hasVertex0) |  | ||||||
| 		{ |  | ||||||
| 			b2Vec2 A1 = edgeA->m_vertex0; |  | ||||||
| 			b2Vec2 B1 = A; |  | ||||||
| 			b2Vec2 e1 = B1 - A1; |  | ||||||
| 			float32 u1 = b2Dot(e1, B1 - Q); |  | ||||||
| 			 |  | ||||||
| 			// Is the circle in Region AB of the previous edge?
 |  | ||||||
| 			if (u1 > 0.0f) |  | ||||||
| 			{ |  | ||||||
| 				return; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		 |  | ||||||
| 		cf.indexA = 0; |  | ||||||
| 		cf.typeA = b2ContactFeature::e_vertex; |  | ||||||
| 		manifold->pointCount = 1; |  | ||||||
| 		manifold->type = b2Manifold::e_circles; |  | ||||||
| 		manifold->localNormal.SetZero(); |  | ||||||
| 		manifold->localPoint = P; |  | ||||||
| 		manifold->points[0].id.key = 0; |  | ||||||
| 		manifold->points[0].id.cf = cf; |  | ||||||
| 		manifold->points[0].localPoint = circleB->m_p; |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	// Region B
 |  | ||||||
| 	if (u <= 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		b2Vec2 P = B; |  | ||||||
| 		b2Vec2 d = Q - P; |  | ||||||
| 		float32 dd = b2Dot(d, d); |  | ||||||
| 		if (dd > radius * radius) |  | ||||||
| 		{ |  | ||||||
| 			return; |  | ||||||
| 		} |  | ||||||
| 		 |  | ||||||
| 		// Is there an edge connected to B?
 |  | ||||||
| 		if (edgeA->m_hasVertex3) |  | ||||||
| 		{ |  | ||||||
| 			b2Vec2 B2 = edgeA->m_vertex3; |  | ||||||
| 			b2Vec2 A2 = B; |  | ||||||
| 			b2Vec2 e2 = B2 - A2; |  | ||||||
| 			float32 v2 = b2Dot(e2, Q - A2); |  | ||||||
| 			 |  | ||||||
| 			// Is the circle in Region AB of the next edge?
 |  | ||||||
| 			if (v2 > 0.0f) |  | ||||||
| 			{ |  | ||||||
| 				return; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		 |  | ||||||
| 		cf.indexA = 1; |  | ||||||
| 		cf.typeA = b2ContactFeature::e_vertex; |  | ||||||
| 		manifold->pointCount = 1; |  | ||||||
| 		manifold->type = b2Manifold::e_circles; |  | ||||||
| 		manifold->localNormal.SetZero(); |  | ||||||
| 		manifold->localPoint = P; |  | ||||||
| 		manifold->points[0].id.key = 0; |  | ||||||
| 		manifold->points[0].id.cf = cf; |  | ||||||
| 		manifold->points[0].localPoint = circleB->m_p; |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	// Region AB
 |  | ||||||
| 	float32 den = b2Dot(e, e); |  | ||||||
| 	b2Assert(den > 0.0f); |  | ||||||
| 	b2Vec2 P = (1.0f / den) * (u * A + v * B); |  | ||||||
| 	b2Vec2 d = Q - P; |  | ||||||
| 	float32 dd = b2Dot(d, d); |  | ||||||
| 	if (dd > radius * radius) |  | ||||||
| 	{ |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	b2Vec2 n(-e.y, e.x); |  | ||||||
| 	if (b2Dot(n, Q - A) < 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		n.Set(-n.x, -n.y); |  | ||||||
| 	} |  | ||||||
| 	n.Normalize(); |  | ||||||
| 	 |  | ||||||
| 	cf.indexA = 0; |  | ||||||
| 	cf.typeA = b2ContactFeature::e_face; |  | ||||||
| 	manifold->pointCount = 1; |  | ||||||
| 	manifold->type = b2Manifold::e_faceA; |  | ||||||
| 	manifold->localNormal = n; |  | ||||||
| 	manifold->localPoint = A; |  | ||||||
| 	manifold->points[0].id.key = 0; |  | ||||||
| 	manifold->points[0].id.cf = cf; |  | ||||||
| 	manifold->points[0].localPoint = circleB->m_p; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // This structure is used to keep track of the best separating axis.
 |  | ||||||
| struct b2EPAxis |  | ||||||
| { |  | ||||||
| 	enum Type |  | ||||||
| 	{ |  | ||||||
| 		e_unknown, |  | ||||||
| 		e_edgeA, |  | ||||||
| 		e_edgeB |  | ||||||
| 	}; |  | ||||||
| 	 |  | ||||||
| 	Type type; |  | ||||||
| 	int32 index; |  | ||||||
| 	float32 separation; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| // This holds polygon B expressed in frame A.
 |  | ||||||
| struct b2TempPolygon |  | ||||||
| { |  | ||||||
| 	b2Vec2 vertices[b2_maxPolygonVertices]; |  | ||||||
| 	b2Vec2 normals[b2_maxPolygonVertices]; |  | ||||||
| 	int32 count; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| // Reference face used for clipping
 |  | ||||||
| struct b2ReferenceFace |  | ||||||
| { |  | ||||||
| 	int32 i1, i2; |  | ||||||
| 	 |  | ||||||
| 	b2Vec2 v1, v2; |  | ||||||
| 	 |  | ||||||
| 	b2Vec2 normal; |  | ||||||
| 	 |  | ||||||
| 	b2Vec2 sideNormal1; |  | ||||||
| 	float32 sideOffset1; |  | ||||||
| 	 |  | ||||||
| 	b2Vec2 sideNormal2; |  | ||||||
| 	float32 sideOffset2; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| // This class collides and edge and a polygon, taking into account edge adjacency.
 |  | ||||||
| struct b2EPCollider |  | ||||||
| { |  | ||||||
| 	void Collide(b2Manifold* manifold, const b2EdgeShape* edgeA, const b2Transform& xfA, |  | ||||||
| 				 const b2PolygonShape* polygonB, const b2Transform& xfB); |  | ||||||
| 	b2EPAxis ComputeEdgeSeparation(); |  | ||||||
| 	b2EPAxis ComputePolygonSeparation(); |  | ||||||
| 	 |  | ||||||
| 	enum VertexType |  | ||||||
| 	{ |  | ||||||
| 		e_isolated, |  | ||||||
| 		e_concave, |  | ||||||
| 		e_convex |  | ||||||
| 	}; |  | ||||||
| 	 |  | ||||||
| 	b2TempPolygon m_polygonB; |  | ||||||
| 	 |  | ||||||
| 	b2Transform m_xf; |  | ||||||
| 	b2Vec2 m_centroidB; |  | ||||||
| 	b2Vec2 m_v0, m_v1, m_v2, m_v3; |  | ||||||
| 	b2Vec2 m_normal0, m_normal1, m_normal2; |  | ||||||
| 	b2Vec2 m_normal; |  | ||||||
| 	VertexType m_type1, m_type2; |  | ||||||
| 	b2Vec2 m_lowerLimit, m_upperLimit; |  | ||||||
| 	float32 m_radius; |  | ||||||
| 	bool m_front; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| // Algorithm:
 |  | ||||||
| // 1. Classify v1 and v2
 |  | ||||||
| // 2. Classify polygon centroid as front or back
 |  | ||||||
| // 3. Flip normal if necessary
 |  | ||||||
| // 4. Initialize normal range to [-pi, pi] about face normal
 |  | ||||||
| // 5. Adjust normal range according to adjacent edges
 |  | ||||||
| // 6. Visit each separating axes, only accept axes within the range
 |  | ||||||
| // 7. Return if _any_ axis indicates separation
 |  | ||||||
| // 8. Clip
 |  | ||||||
| void b2EPCollider::Collide(b2Manifold* manifold, const b2EdgeShape* edgeA, const b2Transform& xfA, |  | ||||||
| 						   const b2PolygonShape* polygonB, const b2Transform& xfB) |  | ||||||
| { |  | ||||||
| 	m_xf = b2MulT(xfA, xfB); |  | ||||||
| 	 |  | ||||||
| 	m_centroidB = b2Mul(m_xf, polygonB->m_centroid); |  | ||||||
| 	 |  | ||||||
| 	m_v0 = edgeA->m_vertex0; |  | ||||||
| 	m_v1 = edgeA->m_vertex1; |  | ||||||
| 	m_v2 = edgeA->m_vertex2; |  | ||||||
| 	m_v3 = edgeA->m_vertex3; |  | ||||||
| 	 |  | ||||||
| 	bool hasVertex0 = edgeA->m_hasVertex0; |  | ||||||
| 	bool hasVertex3 = edgeA->m_hasVertex3; |  | ||||||
| 	 |  | ||||||
| 	b2Vec2 edge1 = m_v2 - m_v1; |  | ||||||
| 	edge1.Normalize(); |  | ||||||
| 	m_normal1.Set(edge1.y, -edge1.x); |  | ||||||
| 	float32 offset1 = b2Dot(m_normal1, m_centroidB - m_v1); |  | ||||||
| 	float32 offset0 = 0.0f, offset2 = 0.0f; |  | ||||||
| 	bool convex1 = false, convex2 = false; |  | ||||||
| 	 |  | ||||||
| 	// Is there a preceding edge?
 |  | ||||||
| 	if (hasVertex0) |  | ||||||
| 	{ |  | ||||||
| 		b2Vec2 edge0 = m_v1 - m_v0; |  | ||||||
| 		edge0.Normalize(); |  | ||||||
| 		m_normal0.Set(edge0.y, -edge0.x); |  | ||||||
| 		convex1 = b2Cross(edge0, edge1) >= 0.0f; |  | ||||||
| 		offset0 = b2Dot(m_normal0, m_centroidB - m_v0); |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	// Is there a following edge?
 |  | ||||||
| 	if (hasVertex3) |  | ||||||
| 	{ |  | ||||||
| 		b2Vec2 edge2 = m_v3 - m_v2; |  | ||||||
| 		edge2.Normalize(); |  | ||||||
| 		m_normal2.Set(edge2.y, -edge2.x); |  | ||||||
| 		convex2 = b2Cross(edge1, edge2) > 0.0f; |  | ||||||
| 		offset2 = b2Dot(m_normal2, m_centroidB - m_v2); |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	// Determine front or back collision. Determine collision normal limits.
 |  | ||||||
| 	if (hasVertex0 && hasVertex3) |  | ||||||
| 	{ |  | ||||||
| 		if (convex1 && convex2) |  | ||||||
| 		{ |  | ||||||
| 			m_front = offset0 >= 0.0f || offset1 >= 0.0f || offset2 >= 0.0f; |  | ||||||
| 			if (m_front) |  | ||||||
| 			{ |  | ||||||
| 				m_normal = m_normal1; |  | ||||||
| 				m_lowerLimit = m_normal0; |  | ||||||
| 				m_upperLimit = m_normal2; |  | ||||||
| 			} |  | ||||||
| 			else |  | ||||||
| 			{ |  | ||||||
| 				m_normal = -m_normal1; |  | ||||||
| 				m_lowerLimit = -m_normal1; |  | ||||||
| 				m_upperLimit = -m_normal1; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		else if (convex1) |  | ||||||
| 		{ |  | ||||||
| 			m_front = offset0 >= 0.0f || (offset1 >= 0.0f && offset2 >= 0.0f); |  | ||||||
| 			if (m_front) |  | ||||||
| 			{ |  | ||||||
| 				m_normal = m_normal1; |  | ||||||
| 				m_lowerLimit = m_normal0; |  | ||||||
| 				m_upperLimit = m_normal1; |  | ||||||
| 			} |  | ||||||
| 			else |  | ||||||
| 			{ |  | ||||||
| 				m_normal = -m_normal1; |  | ||||||
| 				m_lowerLimit = -m_normal2; |  | ||||||
| 				m_upperLimit = -m_normal1; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		else if (convex2) |  | ||||||
| 		{ |  | ||||||
| 			m_front = offset2 >= 0.0f || (offset0 >= 0.0f && offset1 >= 0.0f); |  | ||||||
| 			if (m_front) |  | ||||||
| 			{ |  | ||||||
| 				m_normal = m_normal1; |  | ||||||
| 				m_lowerLimit = m_normal1; |  | ||||||
| 				m_upperLimit = m_normal2; |  | ||||||
| 			} |  | ||||||
| 			else |  | ||||||
| 			{ |  | ||||||
| 				m_normal = -m_normal1; |  | ||||||
| 				m_lowerLimit = -m_normal1; |  | ||||||
| 				m_upperLimit = -m_normal0; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			m_front = offset0 >= 0.0f && offset1 >= 0.0f && offset2 >= 0.0f; |  | ||||||
| 			if (m_front) |  | ||||||
| 			{ |  | ||||||
| 				m_normal = m_normal1; |  | ||||||
| 				m_lowerLimit = m_normal1; |  | ||||||
| 				m_upperLimit = m_normal1; |  | ||||||
| 			} |  | ||||||
| 			else |  | ||||||
| 			{ |  | ||||||
| 				m_normal = -m_normal1; |  | ||||||
| 				m_lowerLimit = -m_normal2; |  | ||||||
| 				m_upperLimit = -m_normal0; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	else if (hasVertex0) |  | ||||||
| 	{ |  | ||||||
| 		if (convex1) |  | ||||||
| 		{ |  | ||||||
| 			m_front = offset0 >= 0.0f || offset1 >= 0.0f; |  | ||||||
| 			if (m_front) |  | ||||||
| 			{ |  | ||||||
| 				m_normal = m_normal1; |  | ||||||
| 				m_lowerLimit = m_normal0; |  | ||||||
| 				m_upperLimit = -m_normal1; |  | ||||||
| 			} |  | ||||||
| 			else |  | ||||||
| 			{ |  | ||||||
| 				m_normal = -m_normal1; |  | ||||||
| 				m_lowerLimit = m_normal1; |  | ||||||
| 				m_upperLimit = -m_normal1; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			m_front = offset0 >= 0.0f && offset1 >= 0.0f; |  | ||||||
| 			if (m_front) |  | ||||||
| 			{ |  | ||||||
| 				m_normal = m_normal1; |  | ||||||
| 				m_lowerLimit = m_normal1; |  | ||||||
| 				m_upperLimit = -m_normal1; |  | ||||||
| 			} |  | ||||||
| 			else |  | ||||||
| 			{ |  | ||||||
| 				m_normal = -m_normal1; |  | ||||||
| 				m_lowerLimit = m_normal1; |  | ||||||
| 				m_upperLimit = -m_normal0; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	else if (hasVertex3) |  | ||||||
| 	{ |  | ||||||
| 		if (convex2) |  | ||||||
| 		{ |  | ||||||
| 			m_front = offset1 >= 0.0f || offset2 >= 0.0f; |  | ||||||
| 			if (m_front) |  | ||||||
| 			{ |  | ||||||
| 				m_normal = m_normal1; |  | ||||||
| 				m_lowerLimit = -m_normal1; |  | ||||||
| 				m_upperLimit = m_normal2; |  | ||||||
| 			} |  | ||||||
| 			else |  | ||||||
| 			{ |  | ||||||
| 				m_normal = -m_normal1; |  | ||||||
| 				m_lowerLimit = -m_normal1; |  | ||||||
| 				m_upperLimit = m_normal1; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			m_front = offset1 >= 0.0f && offset2 >= 0.0f; |  | ||||||
| 			if (m_front) |  | ||||||
| 			{ |  | ||||||
| 				m_normal = m_normal1; |  | ||||||
| 				m_lowerLimit = -m_normal1; |  | ||||||
| 				m_upperLimit = m_normal1; |  | ||||||
| 			} |  | ||||||
| 			else |  | ||||||
| 			{ |  | ||||||
| 				m_normal = -m_normal1; |  | ||||||
| 				m_lowerLimit = -m_normal2; |  | ||||||
| 				m_upperLimit = m_normal1; |  | ||||||
| 			} |  | ||||||
| 		}		 |  | ||||||
| 	} |  | ||||||
| 	else |  | ||||||
| 	{ |  | ||||||
| 		m_front = offset1 >= 0.0f; |  | ||||||
| 		if (m_front) |  | ||||||
| 		{ |  | ||||||
| 			m_normal = m_normal1; |  | ||||||
| 			m_lowerLimit = -m_normal1; |  | ||||||
| 			m_upperLimit = -m_normal1; |  | ||||||
| 		} |  | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			m_normal = -m_normal1; |  | ||||||
| 			m_lowerLimit = m_normal1; |  | ||||||
| 			m_upperLimit = m_normal1; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	// Get polygonB in frameA
 |  | ||||||
| 	m_polygonB.count = polygonB->m_count; |  | ||||||
| 	for (int32 i = 0; i < polygonB->m_count; ++i) |  | ||||||
| 	{ |  | ||||||
| 		m_polygonB.vertices[i] = b2Mul(m_xf, polygonB->m_vertices[i]); |  | ||||||
| 		m_polygonB.normals[i] = b2Mul(m_xf.q, polygonB->m_normals[i]); |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	m_radius = polygonB->m_radius + edgeA->m_radius; |  | ||||||
| 	 |  | ||||||
| 	manifold->pointCount = 0; |  | ||||||
| 	 |  | ||||||
| 	b2EPAxis edgeAxis = ComputeEdgeSeparation(); |  | ||||||
| 	 |  | ||||||
| 	// If no valid normal can be found than this edge should not collide.
 |  | ||||||
| 	if (edgeAxis.type == b2EPAxis::e_unknown) |  | ||||||
| 	{ |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	if (edgeAxis.separation > m_radius) |  | ||||||
| 	{ |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	b2EPAxis polygonAxis = ComputePolygonSeparation(); |  | ||||||
| 	if (polygonAxis.type != b2EPAxis::e_unknown && polygonAxis.separation > m_radius) |  | ||||||
| 	{ |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	// Use hysteresis for jitter reduction.
 |  | ||||||
| 	const float32 k_relativeTol = 0.98f; |  | ||||||
| 	const float32 k_absoluteTol = 0.001f; |  | ||||||
| 	 |  | ||||||
| 	b2EPAxis primaryAxis; |  | ||||||
| 	if (polygonAxis.type == b2EPAxis::e_unknown) |  | ||||||
| 	{ |  | ||||||
| 		primaryAxis = edgeAxis; |  | ||||||
| 	} |  | ||||||
| 	else if (polygonAxis.separation > k_relativeTol * edgeAxis.separation + k_absoluteTol) |  | ||||||
| 	{ |  | ||||||
| 		primaryAxis = polygonAxis; |  | ||||||
| 	} |  | ||||||
| 	else |  | ||||||
| 	{ |  | ||||||
| 		primaryAxis = edgeAxis; |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	b2ClipVertex ie[2]; |  | ||||||
| 	b2ReferenceFace rf; |  | ||||||
| 	if (primaryAxis.type == b2EPAxis::e_edgeA) |  | ||||||
| 	{ |  | ||||||
| 		manifold->type = b2Manifold::e_faceA; |  | ||||||
| 		 |  | ||||||
| 		// Search for the polygon normal that is most anti-parallel to the edge normal.
 |  | ||||||
| 		int32 bestIndex = 0; |  | ||||||
| 		float32 bestValue = b2Dot(m_normal, m_polygonB.normals[0]); |  | ||||||
| 		for (int32 i = 1; i < m_polygonB.count; ++i) |  | ||||||
| 		{ |  | ||||||
| 			float32 value = b2Dot(m_normal, m_polygonB.normals[i]); |  | ||||||
| 			if (value < bestValue) |  | ||||||
| 			{ |  | ||||||
| 				bestValue = value; |  | ||||||
| 				bestIndex = i; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		 |  | ||||||
| 		int32 i1 = bestIndex; |  | ||||||
| 		int32 i2 = i1 + 1 < m_polygonB.count ? i1 + 1 : 0; |  | ||||||
| 		 |  | ||||||
| 		ie[0].v = m_polygonB.vertices[i1]; |  | ||||||
| 		ie[0].id.cf.indexA = 0; |  | ||||||
| 		ie[0].id.cf.indexB = static_cast<uint8>(i1); |  | ||||||
| 		ie[0].id.cf.typeA = b2ContactFeature::e_face; |  | ||||||
| 		ie[0].id.cf.typeB = b2ContactFeature::e_vertex; |  | ||||||
| 		 |  | ||||||
| 		ie[1].v = m_polygonB.vertices[i2]; |  | ||||||
| 		ie[1].id.cf.indexA = 0; |  | ||||||
| 		ie[1].id.cf.indexB = static_cast<uint8>(i2); |  | ||||||
| 		ie[1].id.cf.typeA = b2ContactFeature::e_face; |  | ||||||
| 		ie[1].id.cf.typeB = b2ContactFeature::e_vertex; |  | ||||||
| 		 |  | ||||||
| 		if (m_front) |  | ||||||
| 		{ |  | ||||||
| 			rf.i1 = 0; |  | ||||||
| 			rf.i2 = 1; |  | ||||||
| 			rf.v1 = m_v1; |  | ||||||
| 			rf.v2 = m_v2; |  | ||||||
| 			rf.normal = m_normal1; |  | ||||||
| 		} |  | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			rf.i1 = 1; |  | ||||||
| 			rf.i2 = 0; |  | ||||||
| 			rf.v1 = m_v2; |  | ||||||
| 			rf.v2 = m_v1; |  | ||||||
| 			rf.normal = -m_normal1; |  | ||||||
| 		}		 |  | ||||||
| 	} |  | ||||||
| 	else |  | ||||||
| 	{ |  | ||||||
| 		manifold->type = b2Manifold::e_faceB; |  | ||||||
| 		 |  | ||||||
| 		ie[0].v = m_v1; |  | ||||||
| 		ie[0].id.cf.indexA = 0; |  | ||||||
| 		ie[0].id.cf.indexB = static_cast<uint8>(primaryAxis.index); |  | ||||||
| 		ie[0].id.cf.typeA = b2ContactFeature::e_vertex; |  | ||||||
| 		ie[0].id.cf.typeB = b2ContactFeature::e_face; |  | ||||||
| 		 |  | ||||||
| 		ie[1].v = m_v2; |  | ||||||
| 		ie[1].id.cf.indexA = 0; |  | ||||||
| 		ie[1].id.cf.indexB = static_cast<uint8>(primaryAxis.index);		 |  | ||||||
| 		ie[1].id.cf.typeA = b2ContactFeature::e_vertex; |  | ||||||
| 		ie[1].id.cf.typeB = b2ContactFeature::e_face; |  | ||||||
| 		 |  | ||||||
| 		rf.i1 = primaryAxis.index; |  | ||||||
| 		rf.i2 = rf.i1 + 1 < m_polygonB.count ? rf.i1 + 1 : 0; |  | ||||||
| 		rf.v1 = m_polygonB.vertices[rf.i1]; |  | ||||||
| 		rf.v2 = m_polygonB.vertices[rf.i2]; |  | ||||||
| 		rf.normal = m_polygonB.normals[rf.i1]; |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	rf.sideNormal1.Set(rf.normal.y, -rf.normal.x); |  | ||||||
| 	rf.sideNormal2 = -rf.sideNormal1; |  | ||||||
| 	rf.sideOffset1 = b2Dot(rf.sideNormal1, rf.v1); |  | ||||||
| 	rf.sideOffset2 = b2Dot(rf.sideNormal2, rf.v2); |  | ||||||
| 	 |  | ||||||
| 	// Clip incident edge against extruded edge1 side edges.
 |  | ||||||
| 	b2ClipVertex clipPoints1[2]; |  | ||||||
| 	b2ClipVertex clipPoints2[2]; |  | ||||||
| 	int32 np; |  | ||||||
| 	 |  | ||||||
| 	// Clip to box side 1
 |  | ||||||
| 	np = b2ClipSegmentToLine(clipPoints1, ie, rf.sideNormal1, rf.sideOffset1, rf.i1); |  | ||||||
| 	 |  | ||||||
| 	if (np < b2_maxManifoldPoints) |  | ||||||
| 	{ |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	// Clip to negative box side 1
 |  | ||||||
| 	np = b2ClipSegmentToLine(clipPoints2, clipPoints1, rf.sideNormal2, rf.sideOffset2, rf.i2); |  | ||||||
| 	 |  | ||||||
| 	if (np < b2_maxManifoldPoints) |  | ||||||
| 	{ |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	// Now clipPoints2 contains the clipped points.
 |  | ||||||
| 	if (primaryAxis.type == b2EPAxis::e_edgeA) |  | ||||||
| 	{ |  | ||||||
| 		manifold->localNormal = rf.normal; |  | ||||||
| 		manifold->localPoint = rf.v1; |  | ||||||
| 	} |  | ||||||
| 	else |  | ||||||
| 	{ |  | ||||||
| 		manifold->localNormal = polygonB->m_normals[rf.i1]; |  | ||||||
| 		manifold->localPoint = polygonB->m_vertices[rf.i1]; |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	int32 pointCount = 0; |  | ||||||
| 	for (int32 i = 0; i < b2_maxManifoldPoints; ++i) |  | ||||||
| 	{ |  | ||||||
| 		float32 separation; |  | ||||||
| 		 |  | ||||||
| 		separation = b2Dot(rf.normal, clipPoints2[i].v - rf.v1); |  | ||||||
| 		 |  | ||||||
| 		if (separation <= m_radius) |  | ||||||
| 		{ |  | ||||||
| 			b2ManifoldPoint* cp = manifold->points + pointCount; |  | ||||||
| 			 |  | ||||||
| 			if (primaryAxis.type == b2EPAxis::e_edgeA) |  | ||||||
| 			{ |  | ||||||
| 				cp->localPoint = b2MulT(m_xf, clipPoints2[i].v); |  | ||||||
| 				cp->id = clipPoints2[i].id; |  | ||||||
| 			} |  | ||||||
| 			else |  | ||||||
| 			{ |  | ||||||
| 				cp->localPoint = clipPoints2[i].v; |  | ||||||
| 				cp->id.cf.typeA = clipPoints2[i].id.cf.typeB; |  | ||||||
| 				cp->id.cf.typeB = clipPoints2[i].id.cf.typeA; |  | ||||||
| 				cp->id.cf.indexA = clipPoints2[i].id.cf.indexB; |  | ||||||
| 				cp->id.cf.indexB = clipPoints2[i].id.cf.indexA; |  | ||||||
| 			} |  | ||||||
| 			 |  | ||||||
| 			++pointCount; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	manifold->pointCount = pointCount; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| b2EPAxis b2EPCollider::ComputeEdgeSeparation() |  | ||||||
| { |  | ||||||
| 	b2EPAxis axis; |  | ||||||
| 	axis.type = b2EPAxis::e_edgeA; |  | ||||||
| 	axis.index = m_front ? 0 : 1; |  | ||||||
| 	axis.separation = FLT_MAX; |  | ||||||
| 	 |  | ||||||
| 	for (int32 i = 0; i < m_polygonB.count; ++i) |  | ||||||
| 	{ |  | ||||||
| 		float32 s = b2Dot(m_normal, m_polygonB.vertices[i] - m_v1); |  | ||||||
| 		if (s < axis.separation) |  | ||||||
| 		{ |  | ||||||
| 			axis.separation = s; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	return axis; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| b2EPAxis b2EPCollider::ComputePolygonSeparation() |  | ||||||
| { |  | ||||||
| 	b2EPAxis axis; |  | ||||||
| 	axis.type = b2EPAxis::e_unknown; |  | ||||||
| 	axis.index = -1; |  | ||||||
| 	axis.separation = -FLT_MAX; |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 perp(-m_normal.y, m_normal.x); |  | ||||||
| 
 |  | ||||||
| 	for (int32 i = 0; i < m_polygonB.count; ++i) |  | ||||||
| 	{ |  | ||||||
| 		b2Vec2 n = -m_polygonB.normals[i]; |  | ||||||
| 		 |  | ||||||
| 		float32 s1 = b2Dot(n, m_polygonB.vertices[i] - m_v1); |  | ||||||
| 		float32 s2 = b2Dot(n, m_polygonB.vertices[i] - m_v2); |  | ||||||
| 		float32 s = b2Min(s1, s2); |  | ||||||
| 		 |  | ||||||
| 		if (s > m_radius) |  | ||||||
| 		{ |  | ||||||
| 			// No collision
 |  | ||||||
| 			axis.type = b2EPAxis::e_edgeB; |  | ||||||
| 			axis.index = i; |  | ||||||
| 			axis.separation = s; |  | ||||||
| 			return axis; |  | ||||||
| 		} |  | ||||||
| 		 |  | ||||||
| 		// Adjacency
 |  | ||||||
| 		if (b2Dot(n, perp) >= 0.0f) |  | ||||||
| 		{ |  | ||||||
| 			if (b2Dot(n - m_upperLimit, m_normal) < -b2_angularSlop) |  | ||||||
| 			{ |  | ||||||
| 				continue; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			if (b2Dot(n - m_lowerLimit, m_normal) < -b2_angularSlop) |  | ||||||
| 			{ |  | ||||||
| 				continue; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		 |  | ||||||
| 		if (s > axis.separation) |  | ||||||
| 		{ |  | ||||||
| 			axis.type = b2EPAxis::e_edgeB; |  | ||||||
| 			axis.index = i; |  | ||||||
| 			axis.separation = s; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	return axis; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2CollideEdgeAndPolygon(	b2Manifold* manifold, |  | ||||||
| 							 const b2EdgeShape* edgeA, const b2Transform& xfA, |  | ||||||
| 							 const b2PolygonShape* polygonB, const b2Transform& xfB) |  | ||||||
| { |  | ||||||
| 	b2EPCollider collider; |  | ||||||
| 	collider.Collide(manifold, edgeA, xfA, polygonB, xfB); |  | ||||||
| } |  | ||||||
|  | @ -1,239 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #include "Box2D/Collision/b2Collision.h" |  | ||||||
| #include "Box2D/Collision/Shapes/b2PolygonShape.h" |  | ||||||
| 
 |  | ||||||
| // Find the max separation between poly1 and poly2 using edge normals from poly1.
 |  | ||||||
| static float32 b2FindMaxSeparation(int32* edgeIndex, |  | ||||||
| 								 const b2PolygonShape* poly1, const b2Transform& xf1, |  | ||||||
| 								 const b2PolygonShape* poly2, const b2Transform& xf2) |  | ||||||
| { |  | ||||||
| 	int32 count1 = poly1->m_count; |  | ||||||
| 	int32 count2 = poly2->m_count; |  | ||||||
| 	const b2Vec2* n1s = poly1->m_normals; |  | ||||||
| 	const b2Vec2* v1s = poly1->m_vertices; |  | ||||||
| 	const b2Vec2* v2s = poly2->m_vertices; |  | ||||||
| 	b2Transform xf = b2MulT(xf2, xf1); |  | ||||||
| 
 |  | ||||||
| 	int32 bestIndex = 0; |  | ||||||
| 	float32 maxSeparation = -b2_maxFloat; |  | ||||||
| 	for (int32 i = 0; i < count1; ++i) |  | ||||||
| 	{ |  | ||||||
| 		// Get poly1 normal in frame2.
 |  | ||||||
| 		b2Vec2 n = b2Mul(xf.q, n1s[i]); |  | ||||||
| 		b2Vec2 v1 = b2Mul(xf, v1s[i]); |  | ||||||
| 
 |  | ||||||
| 		// Find deepest point for normal i.
 |  | ||||||
| 		float32 si = b2_maxFloat; |  | ||||||
| 		for (int32 j = 0; j < count2; ++j) |  | ||||||
| 		{ |  | ||||||
| 			float32 sij = b2Dot(n, v2s[j] - v1); |  | ||||||
| 			if (sij < si) |  | ||||||
| 			{ |  | ||||||
| 				si = sij; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		if (si > maxSeparation) |  | ||||||
| 		{ |  | ||||||
| 			maxSeparation = si; |  | ||||||
| 			bestIndex = i; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	*edgeIndex = bestIndex; |  | ||||||
| 	return maxSeparation; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static void b2FindIncidentEdge(b2ClipVertex c[2], |  | ||||||
| 							 const b2PolygonShape* poly1, const b2Transform& xf1, int32 edge1, |  | ||||||
| 							 const b2PolygonShape* poly2, const b2Transform& xf2) |  | ||||||
| { |  | ||||||
| 	const b2Vec2* normals1 = poly1->m_normals; |  | ||||||
| 
 |  | ||||||
| 	int32 count2 = poly2->m_count; |  | ||||||
| 	const b2Vec2* vertices2 = poly2->m_vertices; |  | ||||||
| 	const b2Vec2* normals2 = poly2->m_normals; |  | ||||||
| 
 |  | ||||||
| 	b2Assert(0 <= edge1 && edge1 < poly1->m_count); |  | ||||||
| 
 |  | ||||||
| 	// Get the normal of the reference edge in poly2's frame.
 |  | ||||||
| 	b2Vec2 normal1 = b2MulT(xf2.q, b2Mul(xf1.q, normals1[edge1])); |  | ||||||
| 
 |  | ||||||
| 	// Find the incident edge on poly2.
 |  | ||||||
| 	int32 index = 0; |  | ||||||
| 	float32 minDot = b2_maxFloat; |  | ||||||
| 	for (int32 i = 0; i < count2; ++i) |  | ||||||
| 	{ |  | ||||||
| 		float32 dot = b2Dot(normal1, normals2[i]); |  | ||||||
| 		if (dot < minDot) |  | ||||||
| 		{ |  | ||||||
| 			minDot = dot; |  | ||||||
| 			index = i; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// Build the clip vertices for the incident edge.
 |  | ||||||
| 	int32 i1 = index; |  | ||||||
| 	int32 i2 = i1 + 1 < count2 ? i1 + 1 : 0; |  | ||||||
| 
 |  | ||||||
| 	c[0].v = b2Mul(xf2, vertices2[i1]); |  | ||||||
| 	c[0].id.cf.indexA = (uint8)edge1; |  | ||||||
| 	c[0].id.cf.indexB = (uint8)i1; |  | ||||||
| 	c[0].id.cf.typeA = b2ContactFeature::e_face; |  | ||||||
| 	c[0].id.cf.typeB = b2ContactFeature::e_vertex; |  | ||||||
| 
 |  | ||||||
| 	c[1].v = b2Mul(xf2, vertices2[i2]); |  | ||||||
| 	c[1].id.cf.indexA = (uint8)edge1; |  | ||||||
| 	c[1].id.cf.indexB = (uint8)i2; |  | ||||||
| 	c[1].id.cf.typeA = b2ContactFeature::e_face; |  | ||||||
| 	c[1].id.cf.typeB = b2ContactFeature::e_vertex; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // Find edge normal of max separation on A - return if separating axis is found
 |  | ||||||
| // Find edge normal of max separation on B - return if separation axis is found
 |  | ||||||
| // Choose reference edge as min(minA, minB)
 |  | ||||||
| // Find incident edge
 |  | ||||||
| // Clip
 |  | ||||||
| 
 |  | ||||||
| // The normal points from 1 to 2
 |  | ||||||
| void b2CollidePolygons(b2Manifold* manifold, |  | ||||||
| 					  const b2PolygonShape* polyA, const b2Transform& xfA, |  | ||||||
| 					  const b2PolygonShape* polyB, const b2Transform& xfB) |  | ||||||
| { |  | ||||||
| 	manifold->pointCount = 0; |  | ||||||
| 	float32 totalRadius = polyA->m_radius + polyB->m_radius; |  | ||||||
| 
 |  | ||||||
| 	int32 edgeA = 0; |  | ||||||
| 	float32 separationA = b2FindMaxSeparation(&edgeA, polyA, xfA, polyB, xfB); |  | ||||||
| 	if (separationA > totalRadius) |  | ||||||
| 		return; |  | ||||||
| 
 |  | ||||||
| 	int32 edgeB = 0; |  | ||||||
| 	float32 separationB = b2FindMaxSeparation(&edgeB, polyB, xfB, polyA, xfA); |  | ||||||
| 	if (separationB > totalRadius) |  | ||||||
| 		return; |  | ||||||
| 
 |  | ||||||
| 	const b2PolygonShape* poly1;	// reference polygon
 |  | ||||||
| 	const b2PolygonShape* poly2;	// incident polygon
 |  | ||||||
| 	b2Transform xf1, xf2; |  | ||||||
| 	int32 edge1;					// reference edge
 |  | ||||||
| 	uint8 flip; |  | ||||||
| 	const float32 k_tol = 0.1f * b2_linearSlop; |  | ||||||
| 
 |  | ||||||
| 	if (separationB > separationA + k_tol) |  | ||||||
| 	{ |  | ||||||
| 		poly1 = polyB; |  | ||||||
| 		poly2 = polyA; |  | ||||||
| 		xf1 = xfB; |  | ||||||
| 		xf2 = xfA; |  | ||||||
| 		edge1 = edgeB; |  | ||||||
| 		manifold->type = b2Manifold::e_faceB; |  | ||||||
| 		flip = 1; |  | ||||||
| 	} |  | ||||||
| 	else |  | ||||||
| 	{ |  | ||||||
| 		poly1 = polyA; |  | ||||||
| 		poly2 = polyB; |  | ||||||
| 		xf1 = xfA; |  | ||||||
| 		xf2 = xfB; |  | ||||||
| 		edge1 = edgeA; |  | ||||||
| 		manifold->type = b2Manifold::e_faceA; |  | ||||||
| 		flip = 0; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	b2ClipVertex incidentEdge[2]; |  | ||||||
| 	b2FindIncidentEdge(incidentEdge, poly1, xf1, edge1, poly2, xf2); |  | ||||||
| 
 |  | ||||||
| 	int32 count1 = poly1->m_count; |  | ||||||
| 	const b2Vec2* vertices1 = poly1->m_vertices; |  | ||||||
| 
 |  | ||||||
| 	int32 iv1 = edge1; |  | ||||||
| 	int32 iv2 = edge1 + 1 < count1 ? edge1 + 1 : 0; |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 v11 = vertices1[iv1]; |  | ||||||
| 	b2Vec2 v12 = vertices1[iv2]; |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 localTangent = v12 - v11; |  | ||||||
| 	localTangent.Normalize(); |  | ||||||
| 	 |  | ||||||
| 	b2Vec2 localNormal = b2Cross(localTangent, 1.0f); |  | ||||||
| 	b2Vec2 planePoint = 0.5f * (v11 + v12); |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 tangent = b2Mul(xf1.q, localTangent); |  | ||||||
| 	b2Vec2 normal = b2Cross(tangent, 1.0f); |  | ||||||
| 	 |  | ||||||
| 	v11 = b2Mul(xf1, v11); |  | ||||||
| 	v12 = b2Mul(xf1, v12); |  | ||||||
| 
 |  | ||||||
| 	// Face offset.
 |  | ||||||
| 	float32 frontOffset = b2Dot(normal, v11); |  | ||||||
| 
 |  | ||||||
| 	// Side offsets, extended by polytope skin thickness.
 |  | ||||||
| 	float32 sideOffset1 = -b2Dot(tangent, v11) + totalRadius; |  | ||||||
| 	float32 sideOffset2 = b2Dot(tangent, v12) + totalRadius; |  | ||||||
| 
 |  | ||||||
| 	// Clip incident edge against extruded edge1 side edges.
 |  | ||||||
| 	b2ClipVertex clipPoints1[2]; |  | ||||||
| 	b2ClipVertex clipPoints2[2]; |  | ||||||
| 	int np; |  | ||||||
| 
 |  | ||||||
| 	// Clip to box side 1
 |  | ||||||
| 	np = b2ClipSegmentToLine(clipPoints1, incidentEdge, -tangent, sideOffset1, iv1); |  | ||||||
| 
 |  | ||||||
| 	if (np < 2) |  | ||||||
| 		return; |  | ||||||
| 
 |  | ||||||
| 	// Clip to negative box side 1
 |  | ||||||
| 	np = b2ClipSegmentToLine(clipPoints2, clipPoints1,  tangent, sideOffset2, iv2); |  | ||||||
| 
 |  | ||||||
| 	if (np < 2) |  | ||||||
| 	{ |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// Now clipPoints2 contains the clipped points.
 |  | ||||||
| 	manifold->localNormal = localNormal; |  | ||||||
| 	manifold->localPoint = planePoint; |  | ||||||
| 
 |  | ||||||
| 	int32 pointCount = 0; |  | ||||||
| 	for (int32 i = 0; i < b2_maxManifoldPoints; ++i) |  | ||||||
| 	{ |  | ||||||
| 		float32 separation = b2Dot(normal, clipPoints2[i].v) - frontOffset; |  | ||||||
| 
 |  | ||||||
| 		if (separation <= totalRadius) |  | ||||||
| 		{ |  | ||||||
| 			b2ManifoldPoint* cp = manifold->points + pointCount; |  | ||||||
| 			cp->localPoint = b2MulT(xf2, clipPoints2[i].v); |  | ||||||
| 			cp->id = clipPoints2[i].id; |  | ||||||
| 			if (flip) |  | ||||||
| 			{ |  | ||||||
| 				// Swap features
 |  | ||||||
| 				b2ContactFeature cf = cp->id.cf; |  | ||||||
| 				cp->id.cf.indexA = cf.indexB; |  | ||||||
| 				cp->id.cf.indexB = cf.indexA; |  | ||||||
| 				cp->id.cf.typeA = cf.typeB; |  | ||||||
| 				cp->id.cf.typeB = cf.typeA; |  | ||||||
| 			} |  | ||||||
| 			++pointCount; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	manifold->pointCount = pointCount; |  | ||||||
| } |  | ||||||
|  | @ -1,252 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2007-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #include "Box2D/Collision/b2Collision.h" |  | ||||||
| #include "Box2D/Collision/b2Distance.h" |  | ||||||
| 
 |  | ||||||
| void b2WorldManifold::Initialize(const b2Manifold* manifold, |  | ||||||
| 						  const b2Transform& xfA, float32 radiusA, |  | ||||||
| 						  const b2Transform& xfB, float32 radiusB) |  | ||||||
| { |  | ||||||
| 	if (manifold->pointCount == 0) |  | ||||||
| 	{ |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	switch (manifold->type) |  | ||||||
| 	{ |  | ||||||
| 	case b2Manifold::e_circles: |  | ||||||
| 		{ |  | ||||||
| 			normal.Set(1.0f, 0.0f); |  | ||||||
| 			b2Vec2 pointA = b2Mul(xfA, manifold->localPoint); |  | ||||||
| 			b2Vec2 pointB = b2Mul(xfB, manifold->points[0].localPoint); |  | ||||||
| 			if (b2DistanceSquared(pointA, pointB) > b2_epsilon * b2_epsilon) |  | ||||||
| 			{ |  | ||||||
| 				normal = pointB - pointA; |  | ||||||
| 				normal.Normalize(); |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			b2Vec2 cA = pointA + radiusA * normal; |  | ||||||
| 			b2Vec2 cB = pointB - radiusB * normal; |  | ||||||
| 			points[0] = 0.5f * (cA + cB); |  | ||||||
| 			separations[0] = b2Dot(cB - cA, normal); |  | ||||||
| 		} |  | ||||||
| 		break; |  | ||||||
| 
 |  | ||||||
| 	case b2Manifold::e_faceA: |  | ||||||
| 		{ |  | ||||||
| 			normal = b2Mul(xfA.q, manifold->localNormal); |  | ||||||
| 			b2Vec2 planePoint = b2Mul(xfA, manifold->localPoint); |  | ||||||
| 			 |  | ||||||
| 			for (int32 i = 0; i < manifold->pointCount; ++i) |  | ||||||
| 			{ |  | ||||||
| 				b2Vec2 clipPoint = b2Mul(xfB, manifold->points[i].localPoint); |  | ||||||
| 				b2Vec2 cA = clipPoint + (radiusA - b2Dot(clipPoint - planePoint, normal)) * normal; |  | ||||||
| 				b2Vec2 cB = clipPoint - radiusB * normal; |  | ||||||
| 				points[i] = 0.5f * (cA + cB); |  | ||||||
| 				separations[i] = b2Dot(cB - cA, normal); |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		break; |  | ||||||
| 
 |  | ||||||
| 	case b2Manifold::e_faceB: |  | ||||||
| 		{ |  | ||||||
| 			normal = b2Mul(xfB.q, manifold->localNormal); |  | ||||||
| 			b2Vec2 planePoint = b2Mul(xfB, manifold->localPoint); |  | ||||||
| 
 |  | ||||||
| 			for (int32 i = 0; i < manifold->pointCount; ++i) |  | ||||||
| 			{ |  | ||||||
| 				b2Vec2 clipPoint = b2Mul(xfA, manifold->points[i].localPoint); |  | ||||||
| 				b2Vec2 cB = clipPoint + (radiusB - b2Dot(clipPoint - planePoint, normal)) * normal; |  | ||||||
| 				b2Vec2 cA = clipPoint - radiusA * normal; |  | ||||||
| 				points[i] = 0.5f * (cA + cB); |  | ||||||
| 				separations[i] = b2Dot(cA - cB, normal); |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			// Ensure normal points from A to B.
 |  | ||||||
| 			normal = -normal; |  | ||||||
| 		} |  | ||||||
| 		break; |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2GetPointStates(b2PointState state1[b2_maxManifoldPoints], b2PointState state2[b2_maxManifoldPoints], |  | ||||||
| 					  const b2Manifold* manifold1, const b2Manifold* manifold2) |  | ||||||
| { |  | ||||||
| 	for (int32 i = 0; i < b2_maxManifoldPoints; ++i) |  | ||||||
| 	{ |  | ||||||
| 		state1[i] = b2_nullState; |  | ||||||
| 		state2[i] = b2_nullState; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// Detect persists and removes.
 |  | ||||||
| 	for (int32 i = 0; i < manifold1->pointCount; ++i) |  | ||||||
| 	{ |  | ||||||
| 		b2ContactID id = manifold1->points[i].id; |  | ||||||
| 
 |  | ||||||
| 		state1[i] = b2_removeState; |  | ||||||
| 
 |  | ||||||
| 		for (int32 j = 0; j < manifold2->pointCount; ++j) |  | ||||||
| 		{ |  | ||||||
| 			if (manifold2->points[j].id.key == id.key) |  | ||||||
| 			{ |  | ||||||
| 				state1[i] = b2_persistState; |  | ||||||
| 				break; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// Detect persists and adds.
 |  | ||||||
| 	for (int32 i = 0; i < manifold2->pointCount; ++i) |  | ||||||
| 	{ |  | ||||||
| 		b2ContactID id = manifold2->points[i].id; |  | ||||||
| 
 |  | ||||||
| 		state2[i] = b2_addState; |  | ||||||
| 
 |  | ||||||
| 		for (int32 j = 0; j < manifold1->pointCount; ++j) |  | ||||||
| 		{ |  | ||||||
| 			if (manifold1->points[j].id.key == id.key) |  | ||||||
| 			{ |  | ||||||
| 				state2[i] = b2_persistState; |  | ||||||
| 				break; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // From Real-time Collision Detection, p179.
 |  | ||||||
| bool b2AABB::RayCast(b2RayCastOutput* output, const b2RayCastInput& input) const |  | ||||||
| { |  | ||||||
| 	float32 tmin = -b2_maxFloat; |  | ||||||
| 	float32 tmax = b2_maxFloat; |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 p = input.p1; |  | ||||||
| 	b2Vec2 d = input.p2 - input.p1; |  | ||||||
| 	b2Vec2 absD = b2Abs(d); |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 normal; |  | ||||||
| 
 |  | ||||||
| 	for (int32 i = 0; i < 2; ++i) |  | ||||||
| 	{ |  | ||||||
| 		if (absD(i) < b2_epsilon) |  | ||||||
| 		{ |  | ||||||
| 			// Parallel.
 |  | ||||||
| 			if (p(i) < lowerBound(i) || upperBound(i) < p(i)) |  | ||||||
| 			{ |  | ||||||
| 				return false; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			float32 inv_d = 1.0f / d(i); |  | ||||||
| 			float32 t1 = (lowerBound(i) - p(i)) * inv_d; |  | ||||||
| 			float32 t2 = (upperBound(i) - p(i)) * inv_d; |  | ||||||
| 
 |  | ||||||
| 			// Sign of the normal vector.
 |  | ||||||
| 			float32 s = -1.0f; |  | ||||||
| 
 |  | ||||||
| 			if (t1 > t2) |  | ||||||
| 			{ |  | ||||||
| 				b2Swap(t1, t2); |  | ||||||
| 				s = 1.0f; |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			// Push the min up
 |  | ||||||
| 			if (t1 > tmin) |  | ||||||
| 			{ |  | ||||||
| 				normal.SetZero(); |  | ||||||
| 				normal(i) = s; |  | ||||||
| 				tmin = t1; |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			// Pull the max down
 |  | ||||||
| 			tmax = b2Min(tmax, t2); |  | ||||||
| 
 |  | ||||||
| 			if (tmin > tmax) |  | ||||||
| 			{ |  | ||||||
| 				return false; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// Does the ray start inside the box?
 |  | ||||||
| 	// Does the ray intersect beyond the max fraction?
 |  | ||||||
| 	if (tmin < 0.0f || input.maxFraction < tmin) |  | ||||||
| 	{ |  | ||||||
| 		return false; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// Intersection.
 |  | ||||||
| 	output->fraction = tmin; |  | ||||||
| 	output->normal = normal; |  | ||||||
| 	return true; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // Sutherland-Hodgman clipping.
 |  | ||||||
| int32 b2ClipSegmentToLine(b2ClipVertex vOut[2], const b2ClipVertex vIn[2], |  | ||||||
| 						const b2Vec2& normal, float32 offset, int32 vertexIndexA) |  | ||||||
| { |  | ||||||
| 	// Start with no output points
 |  | ||||||
| 	int32 numOut = 0; |  | ||||||
| 
 |  | ||||||
| 	// Calculate the distance of end points to the line
 |  | ||||||
| 	float32 distance0 = b2Dot(normal, vIn[0].v) - offset; |  | ||||||
| 	float32 distance1 = b2Dot(normal, vIn[1].v) - offset; |  | ||||||
| 
 |  | ||||||
| 	// If the points are behind the plane
 |  | ||||||
| 	if (distance0 <= 0.0f) vOut[numOut++] = vIn[0]; |  | ||||||
| 	if (distance1 <= 0.0f) vOut[numOut++] = vIn[1]; |  | ||||||
| 
 |  | ||||||
| 	// If the points are on different sides of the plane
 |  | ||||||
| 	if (distance0 * distance1 < 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		// Find intersection point of edge and plane
 |  | ||||||
| 		float32 interp = distance0 / (distance0 - distance1); |  | ||||||
| 		vOut[numOut].v = vIn[0].v + interp * (vIn[1].v - vIn[0].v); |  | ||||||
| 
 |  | ||||||
| 		// VertexA is hitting edgeB.
 |  | ||||||
| 		vOut[numOut].id.cf.indexA = static_cast<uint8>(vertexIndexA); |  | ||||||
| 		vOut[numOut].id.cf.indexB = vIn[0].id.cf.indexB; |  | ||||||
| 		vOut[numOut].id.cf.typeA = b2ContactFeature::e_vertex; |  | ||||||
| 		vOut[numOut].id.cf.typeB = b2ContactFeature::e_face; |  | ||||||
| 		++numOut; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	return numOut; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| bool b2TestOverlap(	const b2Shape* shapeA, int32 indexA, |  | ||||||
| 					const b2Shape* shapeB, int32 indexB, |  | ||||||
| 					const b2Transform& xfA, const b2Transform& xfB) |  | ||||||
| { |  | ||||||
| 	b2DistanceInput input; |  | ||||||
| 	input.proxyA.Set(shapeA, indexA); |  | ||||||
| 	input.proxyB.Set(shapeB, indexB); |  | ||||||
| 	input.transformA = xfA; |  | ||||||
| 	input.transformB = xfB; |  | ||||||
| 	input.useRadii = true; |  | ||||||
| 
 |  | ||||||
| 	b2SimplexCache cache; |  | ||||||
| 	cache.count = 0; |  | ||||||
| 
 |  | ||||||
| 	b2DistanceOutput output; |  | ||||||
| 
 |  | ||||||
| 	b2Distance(&output, &cache, &input); |  | ||||||
| 
 |  | ||||||
| 	return output.distance < 10.0f * b2_epsilon; |  | ||||||
| } |  | ||||||
|  | @ -1,277 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #ifndef B2_COLLISION_H |  | ||||||
| #define B2_COLLISION_H |  | ||||||
| 
 |  | ||||||
| #include "../Common/b2Math.h" |  | ||||||
| #include <limits.h> |  | ||||||
| 
 |  | ||||||
| /// @file
 |  | ||||||
| /// Structures and functions used for computing contact points, distance
 |  | ||||||
| /// queries, and TOI queries.
 |  | ||||||
| 
 |  | ||||||
| class b2Shape; |  | ||||||
| class b2CircleShape; |  | ||||||
| class b2EdgeShape; |  | ||||||
| class b2PolygonShape; |  | ||||||
| 
 |  | ||||||
| const uint8 b2_nullFeature = UCHAR_MAX; |  | ||||||
| 
 |  | ||||||
| /// The features that intersect to form the contact point
 |  | ||||||
| /// This must be 4 bytes or less.
 |  | ||||||
| struct b2ContactFeature |  | ||||||
| { |  | ||||||
| 	enum Type |  | ||||||
| 	{ |  | ||||||
| 		e_vertex = 0, |  | ||||||
| 		e_face = 1 |  | ||||||
| 	}; |  | ||||||
| 
 |  | ||||||
| 	uint8 indexA;		///< Feature index on shapeA
 |  | ||||||
| 	uint8 indexB;		///< Feature index on shapeB
 |  | ||||||
| 	uint8 typeA;		///< The feature type on shapeA
 |  | ||||||
| 	uint8 typeB;		///< The feature type on shapeB
 |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// Contact ids to facilitate warm starting.
 |  | ||||||
| union b2ContactID |  | ||||||
| { |  | ||||||
| 	b2ContactFeature cf; |  | ||||||
| 	uint32 key;					///< Used to quickly compare contact ids.
 |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// A manifold point is a contact point belonging to a contact
 |  | ||||||
| /// manifold. It holds details related to the geometry and dynamics
 |  | ||||||
| /// of the contact points.
 |  | ||||||
| /// The local point usage depends on the manifold type:
 |  | ||||||
| /// -e_circles: the local center of circleB
 |  | ||||||
| /// -e_faceA: the local center of cirlceB or the clip point of polygonB
 |  | ||||||
| /// -e_faceB: the clip point of polygonA
 |  | ||||||
| /// This structure is stored across time steps, so we keep it small.
 |  | ||||||
| /// Note: the impulses are used for internal caching and may not
 |  | ||||||
| /// provide reliable contact forces, especially for high speed collisions.
 |  | ||||||
| struct b2ManifoldPoint |  | ||||||
| { |  | ||||||
| 	b2Vec2 localPoint;		///< usage depends on manifold type
 |  | ||||||
| 	float32 normalImpulse;	///< the non-penetration impulse
 |  | ||||||
| 	float32 tangentImpulse;	///< the friction impulse
 |  | ||||||
| 	b2ContactID id;			///< uniquely identifies a contact point between two shapes
 |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// A manifold for two touching convex shapes.
 |  | ||||||
| /// Box2D supports multiple types of contact:
 |  | ||||||
| /// - clip point versus plane with radius
 |  | ||||||
| /// - point versus point with radius (circles)
 |  | ||||||
| /// The local point usage depends on the manifold type:
 |  | ||||||
| /// -e_circles: the local center of circleA
 |  | ||||||
| /// -e_faceA: the center of faceA
 |  | ||||||
| /// -e_faceB: the center of faceB
 |  | ||||||
| /// Similarly the local normal usage:
 |  | ||||||
| /// -e_circles: not used
 |  | ||||||
| /// -e_faceA: the normal on polygonA
 |  | ||||||
| /// -e_faceB: the normal on polygonB
 |  | ||||||
| /// We store contacts in this way so that position correction can
 |  | ||||||
| /// account for movement, which is critical for continuous physics.
 |  | ||||||
| /// All contact scenarios must be expressed in one of these types.
 |  | ||||||
| /// This structure is stored across time steps, so we keep it small.
 |  | ||||||
| struct b2Manifold |  | ||||||
| { |  | ||||||
| 	enum Type |  | ||||||
| 	{ |  | ||||||
| 		e_circles, |  | ||||||
| 		e_faceA, |  | ||||||
| 		e_faceB |  | ||||||
| 	}; |  | ||||||
| 
 |  | ||||||
| 	b2ManifoldPoint points[b2_maxManifoldPoints];	///< the points of contact
 |  | ||||||
| 	b2Vec2 localNormal;								///< not use for Type::e_points
 |  | ||||||
| 	b2Vec2 localPoint;								///< usage depends on manifold type
 |  | ||||||
| 	Type type; |  | ||||||
| 	int32 pointCount;								///< the number of manifold points
 |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// This is used to compute the current state of a contact manifold.
 |  | ||||||
| struct b2WorldManifold |  | ||||||
| { |  | ||||||
| 	/// Evaluate the manifold with supplied transforms. This assumes
 |  | ||||||
| 	/// modest motion from the original state. This does not change the
 |  | ||||||
| 	/// point count, impulses, etc. The radii must come from the shapes
 |  | ||||||
| 	/// that generated the manifold.
 |  | ||||||
| 	void Initialize(const b2Manifold* manifold, |  | ||||||
| 					const b2Transform& xfA, float32 radiusA, |  | ||||||
| 					const b2Transform& xfB, float32 radiusB); |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 normal;								///< world vector pointing from A to B
 |  | ||||||
| 	b2Vec2 points[b2_maxManifoldPoints];		///< world contact point (point of intersection)
 |  | ||||||
| 	float32 separations[b2_maxManifoldPoints];	///< a negative value indicates overlap, in meters
 |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// This is used for determining the state of contact points.
 |  | ||||||
| enum b2PointState |  | ||||||
| { |  | ||||||
| 	b2_nullState,		///< point does not exist
 |  | ||||||
| 	b2_addState,		///< point was added in the update
 |  | ||||||
| 	b2_persistState,	///< point persisted across the update
 |  | ||||||
| 	b2_removeState		///< point was removed in the update
 |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// Compute the point states given two manifolds. The states pertain to the transition from manifold1
 |  | ||||||
| /// to manifold2. So state1 is either persist or remove while state2 is either add or persist.
 |  | ||||||
| void b2GetPointStates(b2PointState state1[b2_maxManifoldPoints], b2PointState state2[b2_maxManifoldPoints], |  | ||||||
| 					  const b2Manifold* manifold1, const b2Manifold* manifold2); |  | ||||||
| 
 |  | ||||||
| /// Used for computing contact manifolds.
 |  | ||||||
| struct b2ClipVertex |  | ||||||
| { |  | ||||||
| 	b2Vec2 v; |  | ||||||
| 	b2ContactID id; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// Ray-cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1).
 |  | ||||||
| struct b2RayCastInput |  | ||||||
| { |  | ||||||
| 	b2Vec2 p1, p2; |  | ||||||
| 	float32 maxFraction; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// Ray-cast output data. The ray hits at p1 + fraction * (p2 - p1), where p1 and p2
 |  | ||||||
| /// come from b2RayCastInput.
 |  | ||||||
| struct b2RayCastOutput |  | ||||||
| { |  | ||||||
| 	b2Vec2 normal; |  | ||||||
| 	float32 fraction; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// An axis aligned bounding box.
 |  | ||||||
| struct b2AABB |  | ||||||
| { |  | ||||||
| 	/// Verify that the bounds are sorted.
 |  | ||||||
| 	bool IsValid() const; |  | ||||||
| 
 |  | ||||||
| 	/// Get the center of the AABB.
 |  | ||||||
| 	b2Vec2 GetCenter() const |  | ||||||
| 	{ |  | ||||||
| 		return 0.5f * (lowerBound + upperBound); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Get the extents of the AABB (half-widths).
 |  | ||||||
| 	b2Vec2 GetExtents() const |  | ||||||
| 	{ |  | ||||||
| 		return 0.5f * (upperBound - lowerBound); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Get the perimeter length
 |  | ||||||
| 	float32 GetPerimeter() const |  | ||||||
| 	{ |  | ||||||
| 		float32 wx = upperBound.x - lowerBound.x; |  | ||||||
| 		float32 wy = upperBound.y - lowerBound.y; |  | ||||||
| 		return 2.0f * (wx + wy); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Combine an AABB into this one.
 |  | ||||||
| 	void Combine(const b2AABB& aabb) |  | ||||||
| 	{ |  | ||||||
| 		lowerBound = b2Min(lowerBound, aabb.lowerBound); |  | ||||||
| 		upperBound = b2Max(upperBound, aabb.upperBound); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Combine two AABBs into this one.
 |  | ||||||
| 	void Combine(const b2AABB& aabb1, const b2AABB& aabb2) |  | ||||||
| 	{ |  | ||||||
| 		lowerBound = b2Min(aabb1.lowerBound, aabb2.lowerBound); |  | ||||||
| 		upperBound = b2Max(aabb1.upperBound, aabb2.upperBound); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Does this aabb contain the provided AABB.
 |  | ||||||
| 	bool Contains(const b2AABB& aabb) const |  | ||||||
| 	{ |  | ||||||
| 		bool result = true; |  | ||||||
| 		result = result && lowerBound.x <= aabb.lowerBound.x; |  | ||||||
| 		result = result && lowerBound.y <= aabb.lowerBound.y; |  | ||||||
| 		result = result && aabb.upperBound.x <= upperBound.x; |  | ||||||
| 		result = result && aabb.upperBound.y <= upperBound.y; |  | ||||||
| 		return result; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input) const; |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 lowerBound;	///< the lower vertex
 |  | ||||||
| 	b2Vec2 upperBound;	///< the upper vertex
 |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// Compute the collision manifold between two circles.
 |  | ||||||
| void b2CollideCircles(b2Manifold* manifold, |  | ||||||
| 					  const b2CircleShape* circleA, const b2Transform& xfA, |  | ||||||
| 					  const b2CircleShape* circleB, const b2Transform& xfB); |  | ||||||
| 
 |  | ||||||
| /// Compute the collision manifold between a polygon and a circle.
 |  | ||||||
| void b2CollidePolygonAndCircle(b2Manifold* manifold, |  | ||||||
| 							   const b2PolygonShape* polygonA, const b2Transform& xfA, |  | ||||||
| 							   const b2CircleShape* circleB, const b2Transform& xfB); |  | ||||||
| 
 |  | ||||||
| /// Compute the collision manifold between two polygons.
 |  | ||||||
| void b2CollidePolygons(b2Manifold* manifold, |  | ||||||
| 					   const b2PolygonShape* polygonA, const b2Transform& xfA, |  | ||||||
| 					   const b2PolygonShape* polygonB, const b2Transform& xfB); |  | ||||||
| 
 |  | ||||||
| /// Compute the collision manifold between an edge and a circle.
 |  | ||||||
| void b2CollideEdgeAndCircle(b2Manifold* manifold, |  | ||||||
| 							   const b2EdgeShape* polygonA, const b2Transform& xfA, |  | ||||||
| 							   const b2CircleShape* circleB, const b2Transform& xfB); |  | ||||||
| 
 |  | ||||||
| /// Compute the collision manifold between an edge and a circle.
 |  | ||||||
| void b2CollideEdgeAndPolygon(b2Manifold* manifold, |  | ||||||
| 							   const b2EdgeShape* edgeA, const b2Transform& xfA, |  | ||||||
| 							   const b2PolygonShape* circleB, const b2Transform& xfB); |  | ||||||
| 
 |  | ||||||
| /// Clipping for contact manifolds.
 |  | ||||||
| int32 b2ClipSegmentToLine(b2ClipVertex vOut[2], const b2ClipVertex vIn[2], |  | ||||||
| 							const b2Vec2& normal, float32 offset, int32 vertexIndexA); |  | ||||||
| 
 |  | ||||||
| /// Determine if two generic shapes overlap.
 |  | ||||||
| bool b2TestOverlap(	const b2Shape* shapeA, int32 indexA, |  | ||||||
| 					const b2Shape* shapeB, int32 indexB, |  | ||||||
| 					const b2Transform& xfA, const b2Transform& xfB); |  | ||||||
| 
 |  | ||||||
| // ---------------- Inline Functions ------------------------------------------
 |  | ||||||
| 
 |  | ||||||
| inline bool b2AABB::IsValid() const |  | ||||||
| { |  | ||||||
| 	b2Vec2 d = upperBound - lowerBound; |  | ||||||
| 	bool valid = d.x >= 0.0f && d.y >= 0.0f; |  | ||||||
| 	valid = valid && lowerBound.IsValid() && upperBound.IsValid(); |  | ||||||
| 	return valid; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline bool b2TestOverlap(const b2AABB& a, const b2AABB& b) |  | ||||||
| { |  | ||||||
| 	b2Vec2 d1, d2; |  | ||||||
| 	d1 = b.lowerBound - a.upperBound; |  | ||||||
| 	d2 = a.lowerBound - b.upperBound; |  | ||||||
| 
 |  | ||||||
| 	if (d1.x > 0.0f || d1.y > 0.0f) |  | ||||||
| 		return false; |  | ||||||
| 
 |  | ||||||
| 	if (d2.x > 0.0f || d2.y > 0.0f) |  | ||||||
| 		return false; |  | ||||||
| 
 |  | ||||||
| 	return true; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #endif |  | ||||||
|  | @ -1,737 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2007-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #include "Box2D/Collision/b2Distance.h" |  | ||||||
| #include "Box2D/Collision/Shapes/b2CircleShape.h" |  | ||||||
| #include "Box2D/Collision/Shapes/b2EdgeShape.h" |  | ||||||
| #include "Box2D/Collision/Shapes/b2ChainShape.h" |  | ||||||
| #include "Box2D/Collision/Shapes/b2PolygonShape.h" |  | ||||||
| 
 |  | ||||||
| // GJK using Voronoi regions (Christer Ericson) and Barycentric coordinates.
 |  | ||||||
| int32 b2_gjkCalls, b2_gjkIters, b2_gjkMaxIters; |  | ||||||
| 
 |  | ||||||
| void b2DistanceProxy::Set(const b2Shape* shape, int32 index) |  | ||||||
| { |  | ||||||
| 	switch (shape->GetType()) |  | ||||||
| 	{ |  | ||||||
| 	case b2Shape::e_circle: |  | ||||||
| 		{ |  | ||||||
| 			const b2CircleShape* circle = static_cast<const b2CircleShape*>(shape); |  | ||||||
| 			m_vertices = &circle->m_p; |  | ||||||
| 			m_count = 1; |  | ||||||
| 			m_radius = circle->m_radius; |  | ||||||
| 		} |  | ||||||
| 		break; |  | ||||||
| 
 |  | ||||||
| 	case b2Shape::e_polygon: |  | ||||||
| 		{ |  | ||||||
| 			const b2PolygonShape* polygon = static_cast<const b2PolygonShape*>(shape); |  | ||||||
| 			m_vertices = polygon->m_vertices; |  | ||||||
| 			m_count = polygon->m_count; |  | ||||||
| 			m_radius = polygon->m_radius; |  | ||||||
| 		} |  | ||||||
| 		break; |  | ||||||
| 
 |  | ||||||
| 	case b2Shape::e_chain: |  | ||||||
| 		{ |  | ||||||
| 			const b2ChainShape* chain = static_cast<const b2ChainShape*>(shape); |  | ||||||
| 			b2Assert(0 <= index && index < chain->m_count); |  | ||||||
| 
 |  | ||||||
| 			m_buffer[0] = chain->m_vertices[index]; |  | ||||||
| 			if (index + 1 < chain->m_count) |  | ||||||
| 			{ |  | ||||||
| 				m_buffer[1] = chain->m_vertices[index + 1]; |  | ||||||
| 			} |  | ||||||
| 			else |  | ||||||
| 			{ |  | ||||||
| 				m_buffer[1] = chain->m_vertices[0]; |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			m_vertices = m_buffer; |  | ||||||
| 			m_count = 2; |  | ||||||
| 			m_radius = chain->m_radius; |  | ||||||
| 		} |  | ||||||
| 		break; |  | ||||||
| 
 |  | ||||||
| 	case b2Shape::e_edge: |  | ||||||
| 		{ |  | ||||||
| 			const b2EdgeShape* edge = static_cast<const b2EdgeShape*>(shape); |  | ||||||
| 			m_vertices = &edge->m_vertex1; |  | ||||||
| 			m_count = 2; |  | ||||||
| 			m_radius = edge->m_radius; |  | ||||||
| 		} |  | ||||||
| 		break; |  | ||||||
| 
 |  | ||||||
| 	default: |  | ||||||
| 		b2Assert(false); |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2DistanceProxy::Set(const b2Vec2* vertices, int32 count, float32 radius) |  | ||||||
| { |  | ||||||
|     m_vertices = vertices; |  | ||||||
|     m_count = count; |  | ||||||
|     m_radius = radius; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| struct b2SimplexVertex |  | ||||||
| { |  | ||||||
| 	b2Vec2 wA;		// support point in proxyA
 |  | ||||||
| 	b2Vec2 wB;		// support point in proxyB
 |  | ||||||
| 	b2Vec2 w;		// wB - wA
 |  | ||||||
| 	float32 a;		// barycentric coordinate for closest point
 |  | ||||||
| 	int32 indexA;	// wA index
 |  | ||||||
| 	int32 indexB;	// wB index
 |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| struct b2Simplex |  | ||||||
| { |  | ||||||
| 	void ReadCache(	const b2SimplexCache* cache, |  | ||||||
| 					const b2DistanceProxy* proxyA, const b2Transform& transformA, |  | ||||||
| 					const b2DistanceProxy* proxyB, const b2Transform& transformB) |  | ||||||
| 	{ |  | ||||||
| 		b2Assert(cache->count <= 3); |  | ||||||
| 		 |  | ||||||
| 		// Copy data from cache.
 |  | ||||||
| 		m_count = cache->count; |  | ||||||
| 		b2SimplexVertex* vertices = &m_v1; |  | ||||||
| 		for (int32 i = 0; i < m_count; ++i) |  | ||||||
| 		{ |  | ||||||
| 			b2SimplexVertex* v = vertices + i; |  | ||||||
| 			v->indexA = cache->indexA[i]; |  | ||||||
| 			v->indexB = cache->indexB[i]; |  | ||||||
| 			b2Vec2 wALocal = proxyA->GetVertex(v->indexA); |  | ||||||
| 			b2Vec2 wBLocal = proxyB->GetVertex(v->indexB); |  | ||||||
| 			v->wA = b2Mul(transformA, wALocal); |  | ||||||
| 			v->wB = b2Mul(transformB, wBLocal); |  | ||||||
| 			v->w = v->wB - v->wA; |  | ||||||
| 			v->a = 0.0f; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		// Compute the new simplex metric, if it is substantially different than
 |  | ||||||
| 		// old metric then flush the simplex.
 |  | ||||||
| 		if (m_count > 1) |  | ||||||
| 		{ |  | ||||||
| 			float32 metric1 = cache->metric; |  | ||||||
| 			float32 metric2 = GetMetric(); |  | ||||||
| 			if (metric2 < 0.5f * metric1 || 2.0f * metric1 < metric2 || metric2 < b2_epsilon) |  | ||||||
| 			{ |  | ||||||
| 				// Reset the simplex.
 |  | ||||||
| 				m_count = 0; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		// If the cache is empty or invalid ...
 |  | ||||||
| 		if (m_count == 0) |  | ||||||
| 		{ |  | ||||||
| 			b2SimplexVertex* v = vertices + 0; |  | ||||||
| 			v->indexA = 0; |  | ||||||
| 			v->indexB = 0; |  | ||||||
| 			b2Vec2 wALocal = proxyA->GetVertex(0); |  | ||||||
| 			b2Vec2 wBLocal = proxyB->GetVertex(0); |  | ||||||
| 			v->wA = b2Mul(transformA, wALocal); |  | ||||||
| 			v->wB = b2Mul(transformB, wBLocal); |  | ||||||
| 			v->w = v->wB - v->wA; |  | ||||||
| 			v->a = 1.0f; |  | ||||||
| 			m_count = 1; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	void WriteCache(b2SimplexCache* cache) const |  | ||||||
| 	{ |  | ||||||
| 		cache->metric = GetMetric(); |  | ||||||
| 		cache->count = uint16(m_count); |  | ||||||
| 		const b2SimplexVertex* vertices = &m_v1; |  | ||||||
| 		for (int32 i = 0; i < m_count; ++i) |  | ||||||
| 		{ |  | ||||||
| 			cache->indexA[i] = uint8(vertices[i].indexA); |  | ||||||
| 			cache->indexB[i] = uint8(vertices[i].indexB); |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 GetSearchDirection() const |  | ||||||
| 	{ |  | ||||||
| 		switch (m_count) |  | ||||||
| 		{ |  | ||||||
| 		case 1: |  | ||||||
| 			return -m_v1.w; |  | ||||||
| 
 |  | ||||||
| 		case 2: |  | ||||||
| 			{ |  | ||||||
| 				b2Vec2 e12 = m_v2.w - m_v1.w; |  | ||||||
| 				float32 sgn = b2Cross(e12, -m_v1.w); |  | ||||||
| 				if (sgn > 0.0f) |  | ||||||
| 				{ |  | ||||||
| 					// Origin is left of e12.
 |  | ||||||
| 					return b2Cross(1.0f, e12); |  | ||||||
| 				} |  | ||||||
| 				else |  | ||||||
| 				{ |  | ||||||
| 					// Origin is right of e12.
 |  | ||||||
| 					return b2Cross(e12, 1.0f); |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 		default: |  | ||||||
| 			b2Assert(false); |  | ||||||
| 			return b2Vec2_zero; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 GetClosestPoint() const |  | ||||||
| 	{ |  | ||||||
| 		switch (m_count) |  | ||||||
| 		{ |  | ||||||
| 		case 0: |  | ||||||
| 			b2Assert(false); |  | ||||||
| 			return b2Vec2_zero; |  | ||||||
| 
 |  | ||||||
| 		case 1: |  | ||||||
| 			return m_v1.w; |  | ||||||
| 
 |  | ||||||
| 		case 2: |  | ||||||
| 			return m_v1.a * m_v1.w + m_v2.a * m_v2.w; |  | ||||||
| 
 |  | ||||||
| 		case 3: |  | ||||||
| 			return b2Vec2_zero; |  | ||||||
| 
 |  | ||||||
| 		default: |  | ||||||
| 			b2Assert(false); |  | ||||||
| 			return b2Vec2_zero; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	void GetWitnessPoints(b2Vec2* pA, b2Vec2* pB) const |  | ||||||
| 	{ |  | ||||||
| 		switch (m_count) |  | ||||||
| 		{ |  | ||||||
| 		case 0: |  | ||||||
| 			b2Assert(false); |  | ||||||
| 			break; |  | ||||||
| 
 |  | ||||||
| 		case 1: |  | ||||||
| 			*pA = m_v1.wA; |  | ||||||
| 			*pB = m_v1.wB; |  | ||||||
| 			break; |  | ||||||
| 
 |  | ||||||
| 		case 2: |  | ||||||
| 			*pA = m_v1.a * m_v1.wA + m_v2.a * m_v2.wA; |  | ||||||
| 			*pB = m_v1.a * m_v1.wB + m_v2.a * m_v2.wB; |  | ||||||
| 			break; |  | ||||||
| 
 |  | ||||||
| 		case 3: |  | ||||||
| 			*pA = m_v1.a * m_v1.wA + m_v2.a * m_v2.wA + m_v3.a * m_v3.wA; |  | ||||||
| 			*pB = *pA; |  | ||||||
| 			break; |  | ||||||
| 
 |  | ||||||
| 		default: |  | ||||||
| 			b2Assert(false); |  | ||||||
| 			break; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	float32 GetMetric() const |  | ||||||
| 	{ |  | ||||||
| 		switch (m_count) |  | ||||||
| 		{ |  | ||||||
| 		case 0: |  | ||||||
| 			b2Assert(false); |  | ||||||
| 			return 0.0f; |  | ||||||
| 
 |  | ||||||
| 		case 1: |  | ||||||
| 			return 0.0f; |  | ||||||
| 
 |  | ||||||
| 		case 2: |  | ||||||
| 			return b2Distance(m_v1.w, m_v2.w); |  | ||||||
| 
 |  | ||||||
| 		case 3: |  | ||||||
| 			return b2Cross(m_v2.w - m_v1.w, m_v3.w - m_v1.w); |  | ||||||
| 
 |  | ||||||
| 		default: |  | ||||||
| 			b2Assert(false); |  | ||||||
| 			return 0.0f; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	void Solve2(); |  | ||||||
| 	void Solve3(); |  | ||||||
| 
 |  | ||||||
| 	b2SimplexVertex m_v1, m_v2, m_v3; |  | ||||||
| 	int32 m_count; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| // Solve a line segment using barycentric coordinates.
 |  | ||||||
| //
 |  | ||||||
| // p = a1 * w1 + a2 * w2
 |  | ||||||
| // a1 + a2 = 1
 |  | ||||||
| //
 |  | ||||||
| // The vector from the origin to the closest point on the line is
 |  | ||||||
| // perpendicular to the line.
 |  | ||||||
| // e12 = w2 - w1
 |  | ||||||
| // dot(p, e) = 0
 |  | ||||||
| // a1 * dot(w1, e) + a2 * dot(w2, e) = 0
 |  | ||||||
| //
 |  | ||||||
| // 2-by-2 linear system
 |  | ||||||
| // [1      1     ][a1] = [1]
 |  | ||||||
| // [w1.e12 w2.e12][a2] = [0]
 |  | ||||||
| //
 |  | ||||||
| // Define
 |  | ||||||
| // d12_1 =  dot(w2, e12)
 |  | ||||||
| // d12_2 = -dot(w1, e12)
 |  | ||||||
| // d12 = d12_1 + d12_2
 |  | ||||||
| //
 |  | ||||||
| // Solution
 |  | ||||||
| // a1 = d12_1 / d12
 |  | ||||||
| // a2 = d12_2 / d12
 |  | ||||||
| void b2Simplex::Solve2() |  | ||||||
| { |  | ||||||
| 	b2Vec2 w1 = m_v1.w; |  | ||||||
| 	b2Vec2 w2 = m_v2.w; |  | ||||||
| 	b2Vec2 e12 = w2 - w1; |  | ||||||
| 
 |  | ||||||
| 	// w1 region
 |  | ||||||
| 	float32 d12_2 = -b2Dot(w1, e12); |  | ||||||
| 	if (d12_2 <= 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		// a2 <= 0, so we clamp it to 0
 |  | ||||||
| 		m_v1.a = 1.0f; |  | ||||||
| 		m_count = 1; |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// w2 region
 |  | ||||||
| 	float32 d12_1 = b2Dot(w2, e12); |  | ||||||
| 	if (d12_1 <= 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		// a1 <= 0, so we clamp it to 0
 |  | ||||||
| 		m_v2.a = 1.0f; |  | ||||||
| 		m_count = 1; |  | ||||||
| 		m_v1 = m_v2; |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// Must be in e12 region.
 |  | ||||||
| 	float32 inv_d12 = 1.0f / (d12_1 + d12_2); |  | ||||||
| 	m_v1.a = d12_1 * inv_d12; |  | ||||||
| 	m_v2.a = d12_2 * inv_d12; |  | ||||||
| 	m_count = 2; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // Possible regions:
 |  | ||||||
| // - points[2]
 |  | ||||||
| // - edge points[0]-points[2]
 |  | ||||||
| // - edge points[1]-points[2]
 |  | ||||||
| // - inside the triangle
 |  | ||||||
| void b2Simplex::Solve3() |  | ||||||
| { |  | ||||||
| 	b2Vec2 w1 = m_v1.w; |  | ||||||
| 	b2Vec2 w2 = m_v2.w; |  | ||||||
| 	b2Vec2 w3 = m_v3.w; |  | ||||||
| 
 |  | ||||||
| 	// Edge12
 |  | ||||||
| 	// [1      1     ][a1] = [1]
 |  | ||||||
| 	// [w1.e12 w2.e12][a2] = [0]
 |  | ||||||
| 	// a3 = 0
 |  | ||||||
| 	b2Vec2 e12 = w2 - w1; |  | ||||||
| 	float32 w1e12 = b2Dot(w1, e12); |  | ||||||
| 	float32 w2e12 = b2Dot(w2, e12); |  | ||||||
| 	float32 d12_1 = w2e12; |  | ||||||
| 	float32 d12_2 = -w1e12; |  | ||||||
| 
 |  | ||||||
| 	// Edge13
 |  | ||||||
| 	// [1      1     ][a1] = [1]
 |  | ||||||
| 	// [w1.e13 w3.e13][a3] = [0]
 |  | ||||||
| 	// a2 = 0
 |  | ||||||
| 	b2Vec2 e13 = w3 - w1; |  | ||||||
| 	float32 w1e13 = b2Dot(w1, e13); |  | ||||||
| 	float32 w3e13 = b2Dot(w3, e13); |  | ||||||
| 	float32 d13_1 = w3e13; |  | ||||||
| 	float32 d13_2 = -w1e13; |  | ||||||
| 
 |  | ||||||
| 	// Edge23
 |  | ||||||
| 	// [1      1     ][a2] = [1]
 |  | ||||||
| 	// [w2.e23 w3.e23][a3] = [0]
 |  | ||||||
| 	// a1 = 0
 |  | ||||||
| 	b2Vec2 e23 = w3 - w2; |  | ||||||
| 	float32 w2e23 = b2Dot(w2, e23); |  | ||||||
| 	float32 w3e23 = b2Dot(w3, e23); |  | ||||||
| 	float32 d23_1 = w3e23; |  | ||||||
| 	float32 d23_2 = -w2e23; |  | ||||||
| 	 |  | ||||||
| 	// Triangle123
 |  | ||||||
| 	float32 n123 = b2Cross(e12, e13); |  | ||||||
| 
 |  | ||||||
| 	float32 d123_1 = n123 * b2Cross(w2, w3); |  | ||||||
| 	float32 d123_2 = n123 * b2Cross(w3, w1); |  | ||||||
| 	float32 d123_3 = n123 * b2Cross(w1, w2); |  | ||||||
| 
 |  | ||||||
| 	// w1 region
 |  | ||||||
| 	if (d12_2 <= 0.0f && d13_2 <= 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		m_v1.a = 1.0f; |  | ||||||
| 		m_count = 1; |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// e12
 |  | ||||||
| 	if (d12_1 > 0.0f && d12_2 > 0.0f && d123_3 <= 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		float32 inv_d12 = 1.0f / (d12_1 + d12_2); |  | ||||||
| 		m_v1.a = d12_1 * inv_d12; |  | ||||||
| 		m_v2.a = d12_2 * inv_d12; |  | ||||||
| 		m_count = 2; |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// e13
 |  | ||||||
| 	if (d13_1 > 0.0f && d13_2 > 0.0f && d123_2 <= 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		float32 inv_d13 = 1.0f / (d13_1 + d13_2); |  | ||||||
| 		m_v1.a = d13_1 * inv_d13; |  | ||||||
| 		m_v3.a = d13_2 * inv_d13; |  | ||||||
| 		m_count = 2; |  | ||||||
| 		m_v2 = m_v3; |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// w2 region
 |  | ||||||
| 	if (d12_1 <= 0.0f && d23_2 <= 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		m_v2.a = 1.0f; |  | ||||||
| 		m_count = 1; |  | ||||||
| 		m_v1 = m_v2; |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// w3 region
 |  | ||||||
| 	if (d13_1 <= 0.0f && d23_1 <= 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		m_v3.a = 1.0f; |  | ||||||
| 		m_count = 1; |  | ||||||
| 		m_v1 = m_v3; |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// e23
 |  | ||||||
| 	if (d23_1 > 0.0f && d23_2 > 0.0f && d123_1 <= 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		float32 inv_d23 = 1.0f / (d23_1 + d23_2); |  | ||||||
| 		m_v2.a = d23_1 * inv_d23; |  | ||||||
| 		m_v3.a = d23_2 * inv_d23; |  | ||||||
| 		m_count = 2; |  | ||||||
| 		m_v1 = m_v3; |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// Must be in triangle123
 |  | ||||||
| 	float32 inv_d123 = 1.0f / (d123_1 + d123_2 + d123_3); |  | ||||||
| 	m_v1.a = d123_1 * inv_d123; |  | ||||||
| 	m_v2.a = d123_2 * inv_d123; |  | ||||||
| 	m_v3.a = d123_3 * inv_d123; |  | ||||||
| 	m_count = 3; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2Distance(b2DistanceOutput* output, |  | ||||||
| 				b2SimplexCache* cache, |  | ||||||
| 				const b2DistanceInput* input) |  | ||||||
| { |  | ||||||
| 	++b2_gjkCalls; |  | ||||||
| 
 |  | ||||||
| 	const b2DistanceProxy* proxyA = &input->proxyA; |  | ||||||
| 	const b2DistanceProxy* proxyB = &input->proxyB; |  | ||||||
| 
 |  | ||||||
| 	b2Transform transformA = input->transformA; |  | ||||||
| 	b2Transform transformB = input->transformB; |  | ||||||
| 
 |  | ||||||
| 	// Initialize the simplex.
 |  | ||||||
| 	b2Simplex simplex; |  | ||||||
| 	simplex.ReadCache(cache, proxyA, transformA, proxyB, transformB); |  | ||||||
| 
 |  | ||||||
| 	// Get simplex vertices as an array.
 |  | ||||||
| 	b2SimplexVertex* vertices = &simplex.m_v1; |  | ||||||
| 	const int32 k_maxIters = 20; |  | ||||||
| 
 |  | ||||||
| 	// These store the vertices of the last simplex so that we
 |  | ||||||
| 	// can check for duplicates and prevent cycling.
 |  | ||||||
| 	int32 saveA[3], saveB[3]; |  | ||||||
| 	int32 saveCount = 0; |  | ||||||
| 
 |  | ||||||
| 	// Main iteration loop.
 |  | ||||||
| 	int32 iter = 0; |  | ||||||
| 	while (iter < k_maxIters) |  | ||||||
| 	{ |  | ||||||
| 		// Copy simplex so we can identify duplicates.
 |  | ||||||
| 		saveCount = simplex.m_count; |  | ||||||
| 		for (int32 i = 0; i < saveCount; ++i) |  | ||||||
| 		{ |  | ||||||
| 			saveA[i] = vertices[i].indexA; |  | ||||||
| 			saveB[i] = vertices[i].indexB; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		switch (simplex.m_count) |  | ||||||
| 		{ |  | ||||||
| 		case 1: |  | ||||||
| 			break; |  | ||||||
| 
 |  | ||||||
| 		case 2: |  | ||||||
| 			simplex.Solve2(); |  | ||||||
| 			break; |  | ||||||
| 
 |  | ||||||
| 		case 3: |  | ||||||
| 			simplex.Solve3(); |  | ||||||
| 			break; |  | ||||||
| 
 |  | ||||||
| 		default: |  | ||||||
| 			b2Assert(false); |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		// If we have 3 points, then the origin is in the corresponding triangle.
 |  | ||||||
| 		if (simplex.m_count == 3) |  | ||||||
| 		{ |  | ||||||
| 			break; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		// Get search direction.
 |  | ||||||
| 		b2Vec2 d = simplex.GetSearchDirection(); |  | ||||||
| 
 |  | ||||||
| 		// Ensure the search direction is numerically fit.
 |  | ||||||
| 		if (d.LengthSquared() < b2_epsilon * b2_epsilon) |  | ||||||
| 		{ |  | ||||||
| 			// The origin is probably contained by a line segment
 |  | ||||||
| 			// or triangle. Thus the shapes are overlapped.
 |  | ||||||
| 
 |  | ||||||
| 			// We can't return zero here even though there may be overlap.
 |  | ||||||
| 			// In case the simplex is a point, segment, or triangle it is difficult
 |  | ||||||
| 			// to determine if the origin is contained in the CSO or very close to it.
 |  | ||||||
| 			break; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		// Compute a tentative new simplex vertex using support points.
 |  | ||||||
| 		b2SimplexVertex* vertex = vertices + simplex.m_count; |  | ||||||
| 		vertex->indexA = proxyA->GetSupport(b2MulT(transformA.q, -d)); |  | ||||||
| 		vertex->wA = b2Mul(transformA, proxyA->GetVertex(vertex->indexA)); |  | ||||||
| 		b2Vec2 wBLocal; |  | ||||||
| 		vertex->indexB = proxyB->GetSupport(b2MulT(transformB.q, d)); |  | ||||||
| 		vertex->wB = b2Mul(transformB, proxyB->GetVertex(vertex->indexB)); |  | ||||||
| 		vertex->w = vertex->wB - vertex->wA; |  | ||||||
| 
 |  | ||||||
| 		// Iteration count is equated to the number of support point calls.
 |  | ||||||
| 		++iter; |  | ||||||
| 		++b2_gjkIters; |  | ||||||
| 
 |  | ||||||
| 		// Check for duplicate support points. This is the main termination criteria.
 |  | ||||||
| 		bool duplicate = false; |  | ||||||
| 		for (int32 i = 0; i < saveCount; ++i) |  | ||||||
| 		{ |  | ||||||
| 			if (vertex->indexA == saveA[i] && vertex->indexB == saveB[i]) |  | ||||||
| 			{ |  | ||||||
| 				duplicate = true; |  | ||||||
| 				break; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		// If we found a duplicate support point we must exit to avoid cycling.
 |  | ||||||
| 		if (duplicate) |  | ||||||
| 		{ |  | ||||||
| 			break; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		// New vertex is ok and needed.
 |  | ||||||
| 		++simplex.m_count; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	b2_gjkMaxIters = b2Max(b2_gjkMaxIters, iter); |  | ||||||
| 
 |  | ||||||
| 	// Prepare output.
 |  | ||||||
| 	simplex.GetWitnessPoints(&output->pointA, &output->pointB); |  | ||||||
| 	output->distance = b2Distance(output->pointA, output->pointB); |  | ||||||
| 	output->iterations = iter; |  | ||||||
| 
 |  | ||||||
| 	// Cache the simplex.
 |  | ||||||
| 	simplex.WriteCache(cache); |  | ||||||
| 
 |  | ||||||
| 	// Apply radii if requested.
 |  | ||||||
| 	if (input->useRadii) |  | ||||||
| 	{ |  | ||||||
| 		float32 rA = proxyA->m_radius; |  | ||||||
| 		float32 rB = proxyB->m_radius; |  | ||||||
| 
 |  | ||||||
| 		if (output->distance > rA + rB && output->distance > b2_epsilon) |  | ||||||
| 		{ |  | ||||||
| 			// Shapes are still no overlapped.
 |  | ||||||
| 			// Move the witness points to the outer surface.
 |  | ||||||
| 			output->distance -= rA + rB; |  | ||||||
| 			b2Vec2 normal = output->pointB - output->pointA; |  | ||||||
| 			normal.Normalize(); |  | ||||||
| 			output->pointA += rA * normal; |  | ||||||
| 			output->pointB -= rB * normal; |  | ||||||
| 		} |  | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			// Shapes are overlapped when radii are considered.
 |  | ||||||
| 			// Move the witness points to the middle.
 |  | ||||||
| 			b2Vec2 p = 0.5f * (output->pointA + output->pointB); |  | ||||||
| 			output->pointA = p; |  | ||||||
| 			output->pointB = p; |  | ||||||
| 			output->distance = 0.0f; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // GJK-raycast
 |  | ||||||
| // Algorithm by Gino van den Bergen.
 |  | ||||||
| // "Smooth Mesh Contacts with GJK" in Game Physics Pearls. 2010
 |  | ||||||
| bool b2ShapeCast(b2ShapeCastOutput * output, const b2ShapeCastInput * input) |  | ||||||
| { |  | ||||||
|     output->iterations = 0; |  | ||||||
|     output->lambda = 1.0f; |  | ||||||
|     output->normal.SetZero(); |  | ||||||
|     output->point.SetZero(); |  | ||||||
| 
 |  | ||||||
| 	const b2DistanceProxy* proxyA = &input->proxyA; |  | ||||||
| 	const b2DistanceProxy* proxyB = &input->proxyB; |  | ||||||
| 
 |  | ||||||
|     float32 radiusA = b2Max(proxyA->m_radius, b2_polygonRadius); |  | ||||||
|     float32 radiusB = b2Max(proxyB->m_radius, b2_polygonRadius); |  | ||||||
|     float32 radius = radiusA + radiusB; |  | ||||||
| 
 |  | ||||||
| 	b2Transform xfA = input->transformA; |  | ||||||
| 	b2Transform xfB = input->transformB; |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 r = input->translationB; |  | ||||||
| 	b2Vec2 n(0.0f, 0.0f); |  | ||||||
| 	float32 lambda = 0.0f; |  | ||||||
| 
 |  | ||||||
| 	// Initial simplex
 |  | ||||||
| 	b2Simplex simplex; |  | ||||||
| 	simplex.m_count = 0; |  | ||||||
| 
 |  | ||||||
| 	// Get simplex vertices as an array.
 |  | ||||||
| 	b2SimplexVertex* vertices = &simplex.m_v1; |  | ||||||
| 
 |  | ||||||
| 	// Get support point in -r direction
 |  | ||||||
| 	int32 indexA = proxyA->GetSupport(b2MulT(xfA.q, -r)); |  | ||||||
| 	b2Vec2 wA = b2Mul(xfA, proxyA->GetVertex(indexA)); |  | ||||||
| 	int32 indexB = proxyB->GetSupport(b2MulT(xfB.q, r)); |  | ||||||
| 	b2Vec2 wB = b2Mul(xfB, proxyB->GetVertex(indexB)); |  | ||||||
|     b2Vec2 v = wA - wB; |  | ||||||
| 
 |  | ||||||
|     // Sigma is the target distance between polygons
 |  | ||||||
|     float32 sigma = b2Max(b2_polygonRadius, radius - b2_polygonRadius); |  | ||||||
| 	const float32 tolerance = 0.5f * b2_linearSlop; |  | ||||||
| 
 |  | ||||||
| 	// Main iteration loop.
 |  | ||||||
| 	const int32 k_maxIters = 20; |  | ||||||
| 	int32 iter = 0; |  | ||||||
| 	while (iter < k_maxIters && b2Abs(v.Length() - sigma) > tolerance) |  | ||||||
| 	{ |  | ||||||
| 		b2Assert(simplex.m_count < 3); |  | ||||||
| 
 |  | ||||||
|         output->iterations += 1; |  | ||||||
| 
 |  | ||||||
| 		// Support in direction -v (A - B)
 |  | ||||||
| 		indexA = proxyA->GetSupport(b2MulT(xfA.q, -v)); |  | ||||||
| 		wA = b2Mul(xfA, proxyA->GetVertex(indexA)); |  | ||||||
| 		indexB = proxyB->GetSupport(b2MulT(xfB.q, v)); |  | ||||||
| 		wB = b2Mul(xfB, proxyB->GetVertex(indexB)); |  | ||||||
|         b2Vec2 p = wA - wB; |  | ||||||
| 
 |  | ||||||
|         // -v is a normal at p
 |  | ||||||
|         v.Normalize(); |  | ||||||
| 
 |  | ||||||
|         // Intersect ray with plane
 |  | ||||||
| 		float32 vp = b2Dot(v, p); |  | ||||||
|         float32 vr = b2Dot(v, r); |  | ||||||
| 		if (vp - sigma > lambda * vr) |  | ||||||
| 		{ |  | ||||||
| 			if (vr <= 0.0f) |  | ||||||
| 			{ |  | ||||||
| 				return false; |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			lambda = (vp - sigma) / vr; |  | ||||||
| 			if (lambda > 1.0f) |  | ||||||
| 			{ |  | ||||||
| 				return false; |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
|             n = -v; |  | ||||||
|             simplex.m_count = 0; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
|         // Reverse simplex since it works with B - A.
 |  | ||||||
|         // Shift by lambda * r because we want the closest point to the current clip point.
 |  | ||||||
|         // Note that the support point p is not shifted because we want the plane equation
 |  | ||||||
|         // to be formed in unshifted space.
 |  | ||||||
| 		b2SimplexVertex* vertex = vertices + simplex.m_count; |  | ||||||
| 		vertex->indexA = indexB; |  | ||||||
| 		vertex->wA = wB + lambda * r; |  | ||||||
| 		vertex->indexB = indexA; |  | ||||||
| 		vertex->wB = wA; |  | ||||||
| 		vertex->w = vertex->wB - vertex->wA; |  | ||||||
| 		vertex->a = 1.0f; |  | ||||||
| 		simplex.m_count += 1; |  | ||||||
| 
 |  | ||||||
| 		switch (simplex.m_count) |  | ||||||
| 		{ |  | ||||||
| 		case 1: |  | ||||||
| 			break; |  | ||||||
| 
 |  | ||||||
| 		case 2: |  | ||||||
| 			simplex.Solve2(); |  | ||||||
| 			break; |  | ||||||
| 
 |  | ||||||
| 		case 3: |  | ||||||
| 			simplex.Solve3(); |  | ||||||
| 			break; |  | ||||||
| 
 |  | ||||||
| 		default: |  | ||||||
| 			b2Assert(false); |  | ||||||
| 		} |  | ||||||
| 		 |  | ||||||
| 		// If we have 3 points, then the origin is in the corresponding triangle.
 |  | ||||||
| 		if (simplex.m_count == 3) |  | ||||||
| 		{ |  | ||||||
| 			// Overlap
 |  | ||||||
| 			return false; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		// Get search direction.
 |  | ||||||
| 		v = simplex.GetClosestPoint(); |  | ||||||
| 
 |  | ||||||
| 		// Iteration count is equated to the number of support point calls.
 |  | ||||||
| 		++iter; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// Prepare output.
 |  | ||||||
| 	b2Vec2 pointA, pointB; |  | ||||||
| 	simplex.GetWitnessPoints(&pointB, &pointA); |  | ||||||
| 
 |  | ||||||
| 	if (v.LengthSquared() > 0.0f) |  | ||||||
| 	{ |  | ||||||
|         n = -v; |  | ||||||
| 		n.Normalize(); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
|     output->point = pointA + radiusA * n; |  | ||||||
| 	output->normal = n; |  | ||||||
| 	output->lambda = lambda; |  | ||||||
| 	output->iterations = iter; |  | ||||||
| 	return true; |  | ||||||
| } |  | ||||||
|  | @ -1,166 +0,0 @@ | ||||||
| 
 |  | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #ifndef B2_DISTANCE_H |  | ||||||
| #define B2_DISTANCE_H |  | ||||||
| 
 |  | ||||||
| #include "../Common/b2Math.h" |  | ||||||
| 
 |  | ||||||
| class b2Shape; |  | ||||||
| 
 |  | ||||||
| /// A distance proxy is used by the GJK algorithm.
 |  | ||||||
| /// It encapsulates any shape.
 |  | ||||||
| struct b2DistanceProxy |  | ||||||
| { |  | ||||||
| 	b2DistanceProxy() : m_vertices(nullptr), m_count(0), m_radius(0.0f) {} |  | ||||||
| 
 |  | ||||||
| 	/// Initialize the proxy using the given shape. The shape
 |  | ||||||
| 	/// must remain in scope while the proxy is in use.
 |  | ||||||
| 	void Set(const b2Shape* shape, int32 index); |  | ||||||
| 
 |  | ||||||
|     /// Initialize the proxy using a vertex cloud and radius. The vertices
 |  | ||||||
|     /// must remain in scope while the proxy is in use.
 |  | ||||||
|     void Set(const b2Vec2* vertices, int32 count, float32 radius); |  | ||||||
| 
 |  | ||||||
| 	/// Get the supporting vertex index in the given direction.
 |  | ||||||
| 	int32 GetSupport(const b2Vec2& d) const; |  | ||||||
| 
 |  | ||||||
| 	/// Get the supporting vertex in the given direction.
 |  | ||||||
| 	const b2Vec2& GetSupportVertex(const b2Vec2& d) const; |  | ||||||
| 
 |  | ||||||
| 	/// Get the vertex count.
 |  | ||||||
| 	int32 GetVertexCount() const; |  | ||||||
| 
 |  | ||||||
| 	/// Get a vertex by index. Used by b2Distance.
 |  | ||||||
| 	const b2Vec2& GetVertex(int32 index) const; |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 m_buffer[2]; |  | ||||||
| 	const b2Vec2* m_vertices; |  | ||||||
| 	int32 m_count; |  | ||||||
| 	float32 m_radius; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// Used to warm start b2Distance.
 |  | ||||||
| /// Set count to zero on first call.
 |  | ||||||
| struct b2SimplexCache |  | ||||||
| { |  | ||||||
| 	float32 metric;		///< length or area
 |  | ||||||
| 	uint16 count; |  | ||||||
| 	uint8 indexA[3];	///< vertices on shape A
 |  | ||||||
| 	uint8 indexB[3];	///< vertices on shape B
 |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// Input for b2Distance.
 |  | ||||||
| /// You have to option to use the shape radii
 |  | ||||||
| /// in the computation. Even 
 |  | ||||||
| struct b2DistanceInput |  | ||||||
| { |  | ||||||
| 	b2DistanceProxy proxyA; |  | ||||||
| 	b2DistanceProxy proxyB; |  | ||||||
| 	b2Transform transformA; |  | ||||||
| 	b2Transform transformB; |  | ||||||
| 	bool useRadii; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// Output for b2Distance.
 |  | ||||||
| struct b2DistanceOutput |  | ||||||
| { |  | ||||||
| 	b2Vec2 pointA;		///< closest point on shapeA
 |  | ||||||
| 	b2Vec2 pointB;		///< closest point on shapeB
 |  | ||||||
| 	float32 distance; |  | ||||||
| 	int32 iterations;	///< number of GJK iterations used
 |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// Compute the closest points between two shapes. Supports any combination of:
 |  | ||||||
| /// b2CircleShape, b2PolygonShape, b2EdgeShape. The simplex cache is input/output.
 |  | ||||||
| /// On the first call set b2SimplexCache.count to zero.
 |  | ||||||
| void b2Distance(b2DistanceOutput* output, |  | ||||||
| 				b2SimplexCache* cache,  |  | ||||||
| 				const b2DistanceInput* input); |  | ||||||
| 
 |  | ||||||
| /// Input parameters for b2ShapeCast
 |  | ||||||
| struct b2ShapeCastInput |  | ||||||
| { |  | ||||||
| 	b2DistanceProxy proxyA; |  | ||||||
| 	b2DistanceProxy proxyB; |  | ||||||
| 	b2Transform transformA; |  | ||||||
| 	b2Transform transformB; |  | ||||||
| 	b2Vec2 translationB; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// Output results for b2ShapeCast
 |  | ||||||
| struct b2ShapeCastOutput |  | ||||||
| { |  | ||||||
| 	b2Vec2 point; |  | ||||||
| 	b2Vec2 normal; |  | ||||||
| 	float32 lambda; |  | ||||||
| 	int32 iterations; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// Perform a linear shape cast of shape B moving and shape A fixed. Determines the hit point, normal, and translation fraction.
 |  | ||||||
| bool b2ShapeCast(b2ShapeCastOutput* output, const b2ShapeCastInput* input); |  | ||||||
| 
 |  | ||||||
| //////////////////////////////////////////////////////////////////////////
 |  | ||||||
| 
 |  | ||||||
| inline int32 b2DistanceProxy::GetVertexCount() const |  | ||||||
| { |  | ||||||
| 	return m_count; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline const b2Vec2& b2DistanceProxy::GetVertex(int32 index) const |  | ||||||
| { |  | ||||||
| 	b2Assert(0 <= index && index < m_count); |  | ||||||
| 	return m_vertices[index]; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline int32 b2DistanceProxy::GetSupport(const b2Vec2& d) const |  | ||||||
| { |  | ||||||
| 	int32 bestIndex = 0; |  | ||||||
| 	float32 bestValue = b2Dot(m_vertices[0], d); |  | ||||||
| 	for (int32 i = 1; i < m_count; ++i) |  | ||||||
| 	{ |  | ||||||
| 		float32 value = b2Dot(m_vertices[i], d); |  | ||||||
| 		if (value > bestValue) |  | ||||||
| 		{ |  | ||||||
| 			bestIndex = i; |  | ||||||
| 			bestValue = value; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	return bestIndex; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline const b2Vec2& b2DistanceProxy::GetSupportVertex(const b2Vec2& d) const |  | ||||||
| { |  | ||||||
| 	int32 bestIndex = 0; |  | ||||||
| 	float32 bestValue = b2Dot(m_vertices[0], d); |  | ||||||
| 	for (int32 i = 1; i < m_count; ++i) |  | ||||||
| 	{ |  | ||||||
| 		float32 value = b2Dot(m_vertices[i], d); |  | ||||||
| 		if (value > bestValue) |  | ||||||
| 		{ |  | ||||||
| 			bestIndex = i; |  | ||||||
| 			bestValue = value; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	return m_vertices[bestIndex]; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #endif |  | ||||||
|  | @ -1,780 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #include "Box2D/Collision/b2DynamicTree.h" |  | ||||||
| #include <string.h> |  | ||||||
| 
 |  | ||||||
| b2DynamicTree::b2DynamicTree() |  | ||||||
| { |  | ||||||
| 	m_root = b2_nullNode; |  | ||||||
| 
 |  | ||||||
| 	m_nodeCapacity = 16; |  | ||||||
| 	m_nodeCount = 0; |  | ||||||
| 	m_nodes = (b2TreeNode*)b2Alloc(m_nodeCapacity * sizeof(b2TreeNode)); |  | ||||||
| 	memset(m_nodes, 0, m_nodeCapacity * sizeof(b2TreeNode)); |  | ||||||
| 
 |  | ||||||
| 	// Build a linked list for the free list.
 |  | ||||||
| 	for (int32 i = 0; i < m_nodeCapacity - 1; ++i) |  | ||||||
| 	{ |  | ||||||
| 		m_nodes[i].next = i + 1; |  | ||||||
| 		m_nodes[i].height = -1; |  | ||||||
| 	} |  | ||||||
| 	m_nodes[m_nodeCapacity-1].next = b2_nullNode; |  | ||||||
| 	m_nodes[m_nodeCapacity-1].height = -1; |  | ||||||
| 	m_freeList = 0; |  | ||||||
| 
 |  | ||||||
| 	m_path = 0; |  | ||||||
| 
 |  | ||||||
| 	m_insertionCount = 0; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| b2DynamicTree::~b2DynamicTree() |  | ||||||
| { |  | ||||||
| 	// This frees the entire tree in one shot.
 |  | ||||||
| 	b2Free(m_nodes); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // Allocate a node from the pool. Grow the pool if necessary.
 |  | ||||||
| int32 b2DynamicTree::AllocateNode() |  | ||||||
| { |  | ||||||
| 	// Expand the node pool as needed.
 |  | ||||||
| 	if (m_freeList == b2_nullNode) |  | ||||||
| 	{ |  | ||||||
| 		b2Assert(m_nodeCount == m_nodeCapacity); |  | ||||||
| 
 |  | ||||||
| 		// The free list is empty. Rebuild a bigger pool.
 |  | ||||||
| 		b2TreeNode* oldNodes = m_nodes; |  | ||||||
| 		m_nodeCapacity *= 2; |  | ||||||
| 		m_nodes = (b2TreeNode*)b2Alloc(m_nodeCapacity * sizeof(b2TreeNode)); |  | ||||||
| 		memcpy(m_nodes, oldNodes, m_nodeCount * sizeof(b2TreeNode)); |  | ||||||
| 		b2Free(oldNodes); |  | ||||||
| 
 |  | ||||||
| 		// Build a linked list for the free list. The parent
 |  | ||||||
| 		// pointer becomes the "next" pointer.
 |  | ||||||
| 		for (int32 i = m_nodeCount; i < m_nodeCapacity - 1; ++i) |  | ||||||
| 		{ |  | ||||||
| 			m_nodes[i].next = i + 1; |  | ||||||
| 			m_nodes[i].height = -1; |  | ||||||
| 		} |  | ||||||
| 		m_nodes[m_nodeCapacity-1].next = b2_nullNode; |  | ||||||
| 		m_nodes[m_nodeCapacity-1].height = -1; |  | ||||||
| 		m_freeList = m_nodeCount; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// Peel a node off the free list.
 |  | ||||||
| 	int32 nodeId = m_freeList; |  | ||||||
| 	m_freeList = m_nodes[nodeId].next; |  | ||||||
| 	m_nodes[nodeId].parent = b2_nullNode; |  | ||||||
| 	m_nodes[nodeId].child1 = b2_nullNode; |  | ||||||
| 	m_nodes[nodeId].child2 = b2_nullNode; |  | ||||||
| 	m_nodes[nodeId].height = 0; |  | ||||||
| 	m_nodes[nodeId].userData = nullptr; |  | ||||||
| 	++m_nodeCount; |  | ||||||
| 	return nodeId; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // Return a node to the pool.
 |  | ||||||
| void b2DynamicTree::FreeNode(int32 nodeId) |  | ||||||
| { |  | ||||||
| 	b2Assert(0 <= nodeId && nodeId < m_nodeCapacity); |  | ||||||
| 	b2Assert(0 < m_nodeCount); |  | ||||||
| 	m_nodes[nodeId].next = m_freeList; |  | ||||||
| 	m_nodes[nodeId].height = -1; |  | ||||||
| 	m_freeList = nodeId; |  | ||||||
| 	--m_nodeCount; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // Create a proxy in the tree as a leaf node. We return the index
 |  | ||||||
| // of the node instead of a pointer so that we can grow
 |  | ||||||
| // the node pool.
 |  | ||||||
| int32 b2DynamicTree::CreateProxy(const b2AABB& aabb, void* userData) |  | ||||||
| { |  | ||||||
| 	int32 proxyId = AllocateNode(); |  | ||||||
| 
 |  | ||||||
| 	// Fatten the aabb.
 |  | ||||||
| 	b2Vec2 r(b2_aabbExtension, b2_aabbExtension); |  | ||||||
| 	m_nodes[proxyId].aabb.lowerBound = aabb.lowerBound - r; |  | ||||||
| 	m_nodes[proxyId].aabb.upperBound = aabb.upperBound + r; |  | ||||||
| 	m_nodes[proxyId].userData = userData; |  | ||||||
| 	m_nodes[proxyId].height = 0; |  | ||||||
| 
 |  | ||||||
| 	InsertLeaf(proxyId); |  | ||||||
| 
 |  | ||||||
| 	return proxyId; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2DynamicTree::DestroyProxy(int32 proxyId) |  | ||||||
| { |  | ||||||
| 	b2Assert(0 <= proxyId && proxyId < m_nodeCapacity); |  | ||||||
| 	b2Assert(m_nodes[proxyId].IsLeaf()); |  | ||||||
| 
 |  | ||||||
| 	RemoveLeaf(proxyId); |  | ||||||
| 	FreeNode(proxyId); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| bool b2DynamicTree::MoveProxy(int32 proxyId, const b2AABB& aabb, const b2Vec2& displacement) |  | ||||||
| { |  | ||||||
| 	b2Assert(0 <= proxyId && proxyId < m_nodeCapacity); |  | ||||||
| 
 |  | ||||||
| 	b2Assert(m_nodes[proxyId].IsLeaf()); |  | ||||||
| 
 |  | ||||||
| 	if (m_nodes[proxyId].aabb.Contains(aabb)) |  | ||||||
| 	{ |  | ||||||
| 		return false; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	RemoveLeaf(proxyId); |  | ||||||
| 
 |  | ||||||
| 	// Extend AABB.
 |  | ||||||
| 	b2AABB b = aabb; |  | ||||||
| 	b2Vec2 r(b2_aabbExtension, b2_aabbExtension); |  | ||||||
| 	b.lowerBound = b.lowerBound - r; |  | ||||||
| 	b.upperBound = b.upperBound + r; |  | ||||||
| 
 |  | ||||||
| 	// Predict AABB displacement.
 |  | ||||||
| 	b2Vec2 d = b2_aabbMultiplier * displacement; |  | ||||||
| 
 |  | ||||||
| 	if (d.x < 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		b.lowerBound.x += d.x; |  | ||||||
| 	} |  | ||||||
| 	else |  | ||||||
| 	{ |  | ||||||
| 		b.upperBound.x += d.x; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	if (d.y < 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		b.lowerBound.y += d.y; |  | ||||||
| 	} |  | ||||||
| 	else |  | ||||||
| 	{ |  | ||||||
| 		b.upperBound.y += d.y; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	m_nodes[proxyId].aabb = b; |  | ||||||
| 
 |  | ||||||
| 	InsertLeaf(proxyId); |  | ||||||
| 	return true; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2DynamicTree::InsertLeaf(int32 leaf) |  | ||||||
| { |  | ||||||
| 	++m_insertionCount; |  | ||||||
| 
 |  | ||||||
| 	if (m_root == b2_nullNode) |  | ||||||
| 	{ |  | ||||||
| 		m_root = leaf; |  | ||||||
| 		m_nodes[m_root].parent = b2_nullNode; |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// Find the best sibling for this node
 |  | ||||||
| 	b2AABB leafAABB = m_nodes[leaf].aabb; |  | ||||||
| 	int32 index = m_root; |  | ||||||
| 	while (m_nodes[index].IsLeaf() == false) |  | ||||||
| 	{ |  | ||||||
| 		int32 child1 = m_nodes[index].child1; |  | ||||||
| 		int32 child2 = m_nodes[index].child2; |  | ||||||
| 
 |  | ||||||
| 		float32 area = m_nodes[index].aabb.GetPerimeter(); |  | ||||||
| 
 |  | ||||||
| 		b2AABB combinedAABB; |  | ||||||
| 		combinedAABB.Combine(m_nodes[index].aabb, leafAABB); |  | ||||||
| 		float32 combinedArea = combinedAABB.GetPerimeter(); |  | ||||||
| 
 |  | ||||||
| 		// Cost of creating a new parent for this node and the new leaf
 |  | ||||||
| 		float32 cost = 2.0f * combinedArea; |  | ||||||
| 
 |  | ||||||
| 		// Minimum cost of pushing the leaf further down the tree
 |  | ||||||
| 		float32 inheritanceCost = 2.0f * (combinedArea - area); |  | ||||||
| 
 |  | ||||||
| 		// Cost of descending into child1
 |  | ||||||
| 		float32 cost1; |  | ||||||
| 		if (m_nodes[child1].IsLeaf()) |  | ||||||
| 		{ |  | ||||||
| 			b2AABB aabb; |  | ||||||
| 			aabb.Combine(leafAABB, m_nodes[child1].aabb); |  | ||||||
| 			cost1 = aabb.GetPerimeter() + inheritanceCost; |  | ||||||
| 		} |  | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			b2AABB aabb; |  | ||||||
| 			aabb.Combine(leafAABB, m_nodes[child1].aabb); |  | ||||||
| 			float32 oldArea = m_nodes[child1].aabb.GetPerimeter(); |  | ||||||
| 			float32 newArea = aabb.GetPerimeter(); |  | ||||||
| 			cost1 = (newArea - oldArea) + inheritanceCost; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		// Cost of descending into child2
 |  | ||||||
| 		float32 cost2; |  | ||||||
| 		if (m_nodes[child2].IsLeaf()) |  | ||||||
| 		{ |  | ||||||
| 			b2AABB aabb; |  | ||||||
| 			aabb.Combine(leafAABB, m_nodes[child2].aabb); |  | ||||||
| 			cost2 = aabb.GetPerimeter() + inheritanceCost; |  | ||||||
| 		} |  | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			b2AABB aabb; |  | ||||||
| 			aabb.Combine(leafAABB, m_nodes[child2].aabb); |  | ||||||
| 			float32 oldArea = m_nodes[child2].aabb.GetPerimeter(); |  | ||||||
| 			float32 newArea = aabb.GetPerimeter(); |  | ||||||
| 			cost2 = newArea - oldArea + inheritanceCost; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		// Descend according to the minimum cost.
 |  | ||||||
| 		if (cost < cost1 && cost < cost2) |  | ||||||
| 		{ |  | ||||||
| 			break; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		// Descend
 |  | ||||||
| 		if (cost1 < cost2) |  | ||||||
| 		{ |  | ||||||
| 			index = child1; |  | ||||||
| 		} |  | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			index = child2; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	int32 sibling = index; |  | ||||||
| 
 |  | ||||||
| 	// Create a new parent.
 |  | ||||||
| 	int32 oldParent = m_nodes[sibling].parent; |  | ||||||
| 	int32 newParent = AllocateNode(); |  | ||||||
| 	m_nodes[newParent].parent = oldParent; |  | ||||||
| 	m_nodes[newParent].userData = nullptr; |  | ||||||
| 	m_nodes[newParent].aabb.Combine(leafAABB, m_nodes[sibling].aabb); |  | ||||||
| 	m_nodes[newParent].height = m_nodes[sibling].height + 1; |  | ||||||
| 
 |  | ||||||
| 	if (oldParent != b2_nullNode) |  | ||||||
| 	{ |  | ||||||
| 		// The sibling was not the root.
 |  | ||||||
| 		if (m_nodes[oldParent].child1 == sibling) |  | ||||||
| 		{ |  | ||||||
| 			m_nodes[oldParent].child1 = newParent; |  | ||||||
| 		} |  | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			m_nodes[oldParent].child2 = newParent; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		m_nodes[newParent].child1 = sibling; |  | ||||||
| 		m_nodes[newParent].child2 = leaf; |  | ||||||
| 		m_nodes[sibling].parent = newParent; |  | ||||||
| 		m_nodes[leaf].parent = newParent; |  | ||||||
| 	} |  | ||||||
| 	else |  | ||||||
| 	{ |  | ||||||
| 		// The sibling was the root.
 |  | ||||||
| 		m_nodes[newParent].child1 = sibling; |  | ||||||
| 		m_nodes[newParent].child2 = leaf; |  | ||||||
| 		m_nodes[sibling].parent = newParent; |  | ||||||
| 		m_nodes[leaf].parent = newParent; |  | ||||||
| 		m_root = newParent; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// Walk back up the tree fixing heights and AABBs
 |  | ||||||
| 	index = m_nodes[leaf].parent; |  | ||||||
| 	while (index != b2_nullNode) |  | ||||||
| 	{ |  | ||||||
| 		index = Balance(index); |  | ||||||
| 
 |  | ||||||
| 		int32 child1 = m_nodes[index].child1; |  | ||||||
| 		int32 child2 = m_nodes[index].child2; |  | ||||||
| 
 |  | ||||||
| 		b2Assert(child1 != b2_nullNode); |  | ||||||
| 		b2Assert(child2 != b2_nullNode); |  | ||||||
| 
 |  | ||||||
| 		m_nodes[index].height = 1 + b2Max(m_nodes[child1].height, m_nodes[child2].height); |  | ||||||
| 		m_nodes[index].aabb.Combine(m_nodes[child1].aabb, m_nodes[child2].aabb); |  | ||||||
| 
 |  | ||||||
| 		index = m_nodes[index].parent; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	//Validate();
 |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2DynamicTree::RemoveLeaf(int32 leaf) |  | ||||||
| { |  | ||||||
| 	if (leaf == m_root) |  | ||||||
| 	{ |  | ||||||
| 		m_root = b2_nullNode; |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	int32 parent = m_nodes[leaf].parent; |  | ||||||
| 	int32 grandParent = m_nodes[parent].parent; |  | ||||||
| 	int32 sibling; |  | ||||||
| 	if (m_nodes[parent].child1 == leaf) |  | ||||||
| 	{ |  | ||||||
| 		sibling = m_nodes[parent].child2; |  | ||||||
| 	} |  | ||||||
| 	else |  | ||||||
| 	{ |  | ||||||
| 		sibling = m_nodes[parent].child1; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	if (grandParent != b2_nullNode) |  | ||||||
| 	{ |  | ||||||
| 		// Destroy parent and connect sibling to grandParent.
 |  | ||||||
| 		if (m_nodes[grandParent].child1 == parent) |  | ||||||
| 		{ |  | ||||||
| 			m_nodes[grandParent].child1 = sibling; |  | ||||||
| 		} |  | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			m_nodes[grandParent].child2 = sibling; |  | ||||||
| 		} |  | ||||||
| 		m_nodes[sibling].parent = grandParent; |  | ||||||
| 		FreeNode(parent); |  | ||||||
| 
 |  | ||||||
| 		// Adjust ancestor bounds.
 |  | ||||||
| 		int32 index = grandParent; |  | ||||||
| 		while (index != b2_nullNode) |  | ||||||
| 		{ |  | ||||||
| 			index = Balance(index); |  | ||||||
| 
 |  | ||||||
| 			int32 child1 = m_nodes[index].child1; |  | ||||||
| 			int32 child2 = m_nodes[index].child2; |  | ||||||
| 
 |  | ||||||
| 			m_nodes[index].aabb.Combine(m_nodes[child1].aabb, m_nodes[child2].aabb); |  | ||||||
| 			m_nodes[index].height = 1 + b2Max(m_nodes[child1].height, m_nodes[child2].height); |  | ||||||
| 
 |  | ||||||
| 			index = m_nodes[index].parent; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	else |  | ||||||
| 	{ |  | ||||||
| 		m_root = sibling; |  | ||||||
| 		m_nodes[sibling].parent = b2_nullNode; |  | ||||||
| 		FreeNode(parent); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	//Validate();
 |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // Perform a left or right rotation if node A is imbalanced.
 |  | ||||||
| // Returns the new root index.
 |  | ||||||
| int32 b2DynamicTree::Balance(int32 iA) |  | ||||||
| { |  | ||||||
| 	b2Assert(iA != b2_nullNode); |  | ||||||
| 
 |  | ||||||
| 	b2TreeNode* A = m_nodes + iA; |  | ||||||
| 	if (A->IsLeaf() || A->height < 2) |  | ||||||
| 	{ |  | ||||||
| 		return iA; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	int32 iB = A->child1; |  | ||||||
| 	int32 iC = A->child2; |  | ||||||
| 	b2Assert(0 <= iB && iB < m_nodeCapacity); |  | ||||||
| 	b2Assert(0 <= iC && iC < m_nodeCapacity); |  | ||||||
| 
 |  | ||||||
| 	b2TreeNode* B = m_nodes + iB; |  | ||||||
| 	b2TreeNode* C = m_nodes + iC; |  | ||||||
| 
 |  | ||||||
| 	int32 balance = C->height - B->height; |  | ||||||
| 
 |  | ||||||
| 	// Rotate C up
 |  | ||||||
| 	if (balance > 1) |  | ||||||
| 	{ |  | ||||||
| 		int32 iF = C->child1; |  | ||||||
| 		int32 iG = C->child2; |  | ||||||
| 		b2TreeNode* F = m_nodes + iF; |  | ||||||
| 		b2TreeNode* G = m_nodes + iG; |  | ||||||
| 		b2Assert(0 <= iF && iF < m_nodeCapacity); |  | ||||||
| 		b2Assert(0 <= iG && iG < m_nodeCapacity); |  | ||||||
| 
 |  | ||||||
| 		// Swap A and C
 |  | ||||||
| 		C->child1 = iA; |  | ||||||
| 		C->parent = A->parent; |  | ||||||
| 		A->parent = iC; |  | ||||||
| 
 |  | ||||||
| 		// A's old parent should point to C
 |  | ||||||
| 		if (C->parent != b2_nullNode) |  | ||||||
| 		{ |  | ||||||
| 			if (m_nodes[C->parent].child1 == iA) |  | ||||||
| 			{ |  | ||||||
| 				m_nodes[C->parent].child1 = iC; |  | ||||||
| 			} |  | ||||||
| 			else |  | ||||||
| 			{ |  | ||||||
| 				b2Assert(m_nodes[C->parent].child2 == iA); |  | ||||||
| 				m_nodes[C->parent].child2 = iC; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			m_root = iC; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		// Rotate
 |  | ||||||
| 		if (F->height > G->height) |  | ||||||
| 		{ |  | ||||||
| 			C->child2 = iF; |  | ||||||
| 			A->child2 = iG; |  | ||||||
| 			G->parent = iA; |  | ||||||
| 			A->aabb.Combine(B->aabb, G->aabb); |  | ||||||
| 			C->aabb.Combine(A->aabb, F->aabb); |  | ||||||
| 
 |  | ||||||
| 			A->height = 1 + b2Max(B->height, G->height); |  | ||||||
| 			C->height = 1 + b2Max(A->height, F->height); |  | ||||||
| 		} |  | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			C->child2 = iG; |  | ||||||
| 			A->child2 = iF; |  | ||||||
| 			F->parent = iA; |  | ||||||
| 			A->aabb.Combine(B->aabb, F->aabb); |  | ||||||
| 			C->aabb.Combine(A->aabb, G->aabb); |  | ||||||
| 
 |  | ||||||
| 			A->height = 1 + b2Max(B->height, F->height); |  | ||||||
| 			C->height = 1 + b2Max(A->height, G->height); |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		return iC; |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	// Rotate B up
 |  | ||||||
| 	if (balance < -1) |  | ||||||
| 	{ |  | ||||||
| 		int32 iD = B->child1; |  | ||||||
| 		int32 iE = B->child2; |  | ||||||
| 		b2TreeNode* D = m_nodes + iD; |  | ||||||
| 		b2TreeNode* E = m_nodes + iE; |  | ||||||
| 		b2Assert(0 <= iD && iD < m_nodeCapacity); |  | ||||||
| 		b2Assert(0 <= iE && iE < m_nodeCapacity); |  | ||||||
| 
 |  | ||||||
| 		// Swap A and B
 |  | ||||||
| 		B->child1 = iA; |  | ||||||
| 		B->parent = A->parent; |  | ||||||
| 		A->parent = iB; |  | ||||||
| 
 |  | ||||||
| 		// A's old parent should point to B
 |  | ||||||
| 		if (B->parent != b2_nullNode) |  | ||||||
| 		{ |  | ||||||
| 			if (m_nodes[B->parent].child1 == iA) |  | ||||||
| 			{ |  | ||||||
| 				m_nodes[B->parent].child1 = iB; |  | ||||||
| 			} |  | ||||||
| 			else |  | ||||||
| 			{ |  | ||||||
| 				b2Assert(m_nodes[B->parent].child2 == iA); |  | ||||||
| 				m_nodes[B->parent].child2 = iB; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			m_root = iB; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		// Rotate
 |  | ||||||
| 		if (D->height > E->height) |  | ||||||
| 		{ |  | ||||||
| 			B->child2 = iD; |  | ||||||
| 			A->child1 = iE; |  | ||||||
| 			E->parent = iA; |  | ||||||
| 			A->aabb.Combine(C->aabb, E->aabb); |  | ||||||
| 			B->aabb.Combine(A->aabb, D->aabb); |  | ||||||
| 
 |  | ||||||
| 			A->height = 1 + b2Max(C->height, E->height); |  | ||||||
| 			B->height = 1 + b2Max(A->height, D->height); |  | ||||||
| 		} |  | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			B->child2 = iE; |  | ||||||
| 			A->child1 = iD; |  | ||||||
| 			D->parent = iA; |  | ||||||
| 			A->aabb.Combine(C->aabb, D->aabb); |  | ||||||
| 			B->aabb.Combine(A->aabb, E->aabb); |  | ||||||
| 
 |  | ||||||
| 			A->height = 1 + b2Max(C->height, D->height); |  | ||||||
| 			B->height = 1 + b2Max(A->height, E->height); |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		return iB; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	return iA; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| int32 b2DynamicTree::GetHeight() const |  | ||||||
| { |  | ||||||
| 	if (m_root == b2_nullNode) |  | ||||||
| 	{ |  | ||||||
| 		return 0; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	return m_nodes[m_root].height; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| //
 |  | ||||||
| float32 b2DynamicTree::GetAreaRatio() const |  | ||||||
| { |  | ||||||
| 	if (m_root == b2_nullNode) |  | ||||||
| 	{ |  | ||||||
| 		return 0.0f; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	const b2TreeNode* root = m_nodes + m_root; |  | ||||||
| 	float32 rootArea = root->aabb.GetPerimeter(); |  | ||||||
| 
 |  | ||||||
| 	float32 totalArea = 0.0f; |  | ||||||
| 	for (int32 i = 0; i < m_nodeCapacity; ++i) |  | ||||||
| 	{ |  | ||||||
| 		const b2TreeNode* node = m_nodes + i; |  | ||||||
| 		if (node->height < 0) |  | ||||||
| 		{ |  | ||||||
| 			// Free node in pool
 |  | ||||||
| 			continue; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		totalArea += node->aabb.GetPerimeter(); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	return totalArea / rootArea; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // Compute the height of a sub-tree.
 |  | ||||||
| int32 b2DynamicTree::ComputeHeight(int32 nodeId) const |  | ||||||
| { |  | ||||||
| 	b2Assert(0 <= nodeId && nodeId < m_nodeCapacity); |  | ||||||
| 	b2TreeNode* node = m_nodes + nodeId; |  | ||||||
| 
 |  | ||||||
| 	if (node->IsLeaf()) |  | ||||||
| 	{ |  | ||||||
| 		return 0; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	int32 height1 = ComputeHeight(node->child1); |  | ||||||
| 	int32 height2 = ComputeHeight(node->child2); |  | ||||||
| 	return 1 + b2Max(height1, height2); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| int32 b2DynamicTree::ComputeHeight() const |  | ||||||
| { |  | ||||||
| 	int32 height = ComputeHeight(m_root); |  | ||||||
| 	return height; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2DynamicTree::ValidateStructure(int32 index) const |  | ||||||
| { |  | ||||||
| 	if (index == b2_nullNode) |  | ||||||
| 	{ |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	if (index == m_root) |  | ||||||
| 	{ |  | ||||||
| 		b2Assert(m_nodes[index].parent == b2_nullNode); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	const b2TreeNode* node = m_nodes + index; |  | ||||||
| 
 |  | ||||||
| 	int32 child1 = node->child1; |  | ||||||
| 	int32 child2 = node->child2; |  | ||||||
| 
 |  | ||||||
| 	if (node->IsLeaf()) |  | ||||||
| 	{ |  | ||||||
| 		b2Assert(child1 == b2_nullNode); |  | ||||||
| 		b2Assert(child2 == b2_nullNode); |  | ||||||
| 		b2Assert(node->height == 0); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	b2Assert(0 <= child1 && child1 < m_nodeCapacity); |  | ||||||
| 	b2Assert(0 <= child2 && child2 < m_nodeCapacity); |  | ||||||
| 
 |  | ||||||
| 	b2Assert(m_nodes[child1].parent == index); |  | ||||||
| 	b2Assert(m_nodes[child2].parent == index); |  | ||||||
| 
 |  | ||||||
| 	ValidateStructure(child1); |  | ||||||
| 	ValidateStructure(child2); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2DynamicTree::ValidateMetrics(int32 index) const |  | ||||||
| { |  | ||||||
| 	if (index == b2_nullNode) |  | ||||||
| 	{ |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	const b2TreeNode* node = m_nodes + index; |  | ||||||
| 
 |  | ||||||
| 	int32 child1 = node->child1; |  | ||||||
| 	int32 child2 = node->child2; |  | ||||||
| 
 |  | ||||||
| 	if (node->IsLeaf()) |  | ||||||
| 	{ |  | ||||||
| 		b2Assert(child1 == b2_nullNode); |  | ||||||
| 		b2Assert(child2 == b2_nullNode); |  | ||||||
| 		b2Assert(node->height == 0); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	b2Assert(0 <= child1 && child1 < m_nodeCapacity); |  | ||||||
| 	b2Assert(0 <= child2 && child2 < m_nodeCapacity); |  | ||||||
| 
 |  | ||||||
| 	int32 height1 = m_nodes[child1].height; |  | ||||||
| 	int32 height2 = m_nodes[child2].height; |  | ||||||
| 	int32 height; |  | ||||||
| 	height = 1 + b2Max(height1, height2); |  | ||||||
| 	b2Assert(node->height == height); |  | ||||||
| 
 |  | ||||||
| 	b2AABB aabb; |  | ||||||
| 	aabb.Combine(m_nodes[child1].aabb, m_nodes[child2].aabb); |  | ||||||
| 
 |  | ||||||
| 	b2Assert(aabb.lowerBound == node->aabb.lowerBound); |  | ||||||
| 	b2Assert(aabb.upperBound == node->aabb.upperBound); |  | ||||||
| 
 |  | ||||||
| 	ValidateMetrics(child1); |  | ||||||
| 	ValidateMetrics(child2); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2DynamicTree::Validate() const |  | ||||||
| { |  | ||||||
| #if defined(b2DEBUG) |  | ||||||
| 	ValidateStructure(m_root); |  | ||||||
| 	ValidateMetrics(m_root); |  | ||||||
| 
 |  | ||||||
| 	int32 freeCount = 0; |  | ||||||
| 	int32 freeIndex = m_freeList; |  | ||||||
| 	while (freeIndex != b2_nullNode) |  | ||||||
| 	{ |  | ||||||
| 		b2Assert(0 <= freeIndex && freeIndex < m_nodeCapacity); |  | ||||||
| 		freeIndex = m_nodes[freeIndex].next; |  | ||||||
| 		++freeCount; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	b2Assert(GetHeight() == ComputeHeight()); |  | ||||||
| 
 |  | ||||||
| 	b2Assert(m_nodeCount + freeCount == m_nodeCapacity); |  | ||||||
| #endif |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| int32 b2DynamicTree::GetMaxBalance() const |  | ||||||
| { |  | ||||||
| 	int32 maxBalance = 0; |  | ||||||
| 	for (int32 i = 0; i < m_nodeCapacity; ++i) |  | ||||||
| 	{ |  | ||||||
| 		const b2TreeNode* node = m_nodes + i; |  | ||||||
| 		if (node->height <= 1) |  | ||||||
| 		{ |  | ||||||
| 			continue; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		b2Assert(node->IsLeaf() == false); |  | ||||||
| 
 |  | ||||||
| 		int32 child1 = node->child1; |  | ||||||
| 		int32 child2 = node->child2; |  | ||||||
| 		int32 balance = b2Abs(m_nodes[child2].height - m_nodes[child1].height); |  | ||||||
| 		maxBalance = b2Max(maxBalance, balance); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	return maxBalance; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2DynamicTree::RebuildBottomUp() |  | ||||||
| { |  | ||||||
| 	int32* nodes = (int32*)b2Alloc(m_nodeCount * sizeof(int32)); |  | ||||||
| 	int32 count = 0; |  | ||||||
| 
 |  | ||||||
| 	// Build array of leaves. Free the rest.
 |  | ||||||
| 	for (int32 i = 0; i < m_nodeCapacity; ++i) |  | ||||||
| 	{ |  | ||||||
| 		if (m_nodes[i].height < 0) |  | ||||||
| 		{ |  | ||||||
| 			// free node in pool
 |  | ||||||
| 			continue; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		if (m_nodes[i].IsLeaf()) |  | ||||||
| 		{ |  | ||||||
| 			m_nodes[i].parent = b2_nullNode; |  | ||||||
| 			nodes[count] = i; |  | ||||||
| 			++count; |  | ||||||
| 		} |  | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			FreeNode(i); |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	while (count > 1) |  | ||||||
| 	{ |  | ||||||
| 		float32 minCost = b2_maxFloat; |  | ||||||
| 		int32 iMin = -1, jMin = -1; |  | ||||||
| 		for (int32 i = 0; i < count; ++i) |  | ||||||
| 		{ |  | ||||||
| 			b2AABB aabbi = m_nodes[nodes[i]].aabb; |  | ||||||
| 
 |  | ||||||
| 			for (int32 j = i + 1; j < count; ++j) |  | ||||||
| 			{ |  | ||||||
| 				b2AABB aabbj = m_nodes[nodes[j]].aabb; |  | ||||||
| 				b2AABB b; |  | ||||||
| 				b.Combine(aabbi, aabbj); |  | ||||||
| 				float32 cost = b.GetPerimeter(); |  | ||||||
| 				if (cost < minCost) |  | ||||||
| 				{ |  | ||||||
| 					iMin = i; |  | ||||||
| 					jMin = j; |  | ||||||
| 					minCost = cost; |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		int32 index1 = nodes[iMin]; |  | ||||||
| 		int32 index2 = nodes[jMin]; |  | ||||||
| 		b2TreeNode* child1 = m_nodes + index1; |  | ||||||
| 		b2TreeNode* child2 = m_nodes + index2; |  | ||||||
| 
 |  | ||||||
| 		int32 parentIndex = AllocateNode(); |  | ||||||
| 		b2TreeNode* parent = m_nodes + parentIndex; |  | ||||||
| 		parent->child1 = index1; |  | ||||||
| 		parent->child2 = index2; |  | ||||||
| 		parent->height = 1 + b2Max(child1->height, child2->height); |  | ||||||
| 		parent->aabb.Combine(child1->aabb, child2->aabb); |  | ||||||
| 		parent->parent = b2_nullNode; |  | ||||||
| 
 |  | ||||||
| 		child1->parent = parentIndex; |  | ||||||
| 		child2->parent = parentIndex; |  | ||||||
| 
 |  | ||||||
| 		nodes[jMin] = nodes[count-1]; |  | ||||||
| 		nodes[iMin] = parentIndex; |  | ||||||
| 		--count; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	m_root = nodes[0]; |  | ||||||
| 	b2Free(nodes); |  | ||||||
| 
 |  | ||||||
| 	Validate(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2DynamicTree::ShiftOrigin(const b2Vec2& newOrigin) |  | ||||||
| { |  | ||||||
| 	// Build array of leaves. Free the rest.
 |  | ||||||
| 	for (int32 i = 0; i < m_nodeCapacity; ++i) |  | ||||||
| 	{ |  | ||||||
| 		m_nodes[i].aabb.lowerBound -= newOrigin; |  | ||||||
| 		m_nodes[i].aabb.upperBound -= newOrigin; |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  | @ -1,289 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #ifndef B2_DYNAMIC_TREE_H |  | ||||||
| #define B2_DYNAMIC_TREE_H |  | ||||||
| 
 |  | ||||||
| #include "b2Collision.h" |  | ||||||
| #include "../Common/b2GrowableStack.h" |  | ||||||
| 
 |  | ||||||
| #define b2_nullNode (-1) |  | ||||||
| 
 |  | ||||||
| /// A node in the dynamic tree. The client does not interact with this directly.
 |  | ||||||
| struct b2TreeNode |  | ||||||
| { |  | ||||||
| 	bool IsLeaf() const |  | ||||||
| 	{ |  | ||||||
| 		return child1 == b2_nullNode; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Enlarged AABB
 |  | ||||||
| 	b2AABB aabb; |  | ||||||
| 
 |  | ||||||
| 	void* userData; |  | ||||||
| 
 |  | ||||||
| 	union |  | ||||||
| 	{ |  | ||||||
| 		int32 parent; |  | ||||||
| 		int32 next; |  | ||||||
| 	}; |  | ||||||
| 
 |  | ||||||
| 	int32 child1; |  | ||||||
| 	int32 child2; |  | ||||||
| 
 |  | ||||||
| 	// leaf = 0, free node = -1
 |  | ||||||
| 	int32 height; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// A dynamic AABB tree broad-phase, inspired by Nathanael Presson's btDbvt.
 |  | ||||||
| /// A dynamic tree arranges data in a binary tree to accelerate
 |  | ||||||
| /// queries such as volume queries and ray casts. Leafs are proxies
 |  | ||||||
| /// with an AABB. In the tree we expand the proxy AABB by b2_fatAABBFactor
 |  | ||||||
| /// so that the proxy AABB is bigger than the client object. This allows the client
 |  | ||||||
| /// object to move by small amounts without triggering a tree update.
 |  | ||||||
| ///
 |  | ||||||
| /// Nodes are pooled and relocatable, so we use node indices rather than pointers.
 |  | ||||||
| class b2DynamicTree |  | ||||||
| { |  | ||||||
| public: |  | ||||||
| 	/// Constructing the tree initializes the node pool.
 |  | ||||||
| 	b2DynamicTree(); |  | ||||||
| 
 |  | ||||||
| 	/// Destroy the tree, freeing the node pool.
 |  | ||||||
| 	~b2DynamicTree(); |  | ||||||
| 
 |  | ||||||
| 	/// Create a proxy. Provide a tight fitting AABB and a userData pointer.
 |  | ||||||
| 	int32 CreateProxy(const b2AABB& aabb, void* userData); |  | ||||||
| 
 |  | ||||||
| 	/// Destroy a proxy. This asserts if the id is invalid.
 |  | ||||||
| 	void DestroyProxy(int32 proxyId); |  | ||||||
| 
 |  | ||||||
| 	/// Move a proxy with a swepted AABB. If the proxy has moved outside of its fattened AABB,
 |  | ||||||
| 	/// then the proxy is removed from the tree and re-inserted. Otherwise
 |  | ||||||
| 	/// the function returns immediately.
 |  | ||||||
| 	/// @return true if the proxy was re-inserted.
 |  | ||||||
| 	bool MoveProxy(int32 proxyId, const b2AABB& aabb1, const b2Vec2& displacement); |  | ||||||
| 
 |  | ||||||
| 	/// Get proxy user data.
 |  | ||||||
| 	/// @return the proxy user data or 0 if the id is invalid.
 |  | ||||||
| 	void* GetUserData(int32 proxyId) const; |  | ||||||
| 
 |  | ||||||
| 	/// Get the fat AABB for a proxy.
 |  | ||||||
| 	const b2AABB& GetFatAABB(int32 proxyId) const; |  | ||||||
| 
 |  | ||||||
| 	/// Query an AABB for overlapping proxies. The callback class
 |  | ||||||
| 	/// is called for each proxy that overlaps the supplied AABB.
 |  | ||||||
| 	template <typename T> |  | ||||||
| 	void Query(T* callback, const b2AABB& aabb) const; |  | ||||||
| 
 |  | ||||||
| 	/// Ray-cast against the proxies in the tree. This relies on the callback
 |  | ||||||
| 	/// to perform a exact ray-cast in the case were the proxy contains a shape.
 |  | ||||||
| 	/// The callback also performs the any collision filtering. This has performance
 |  | ||||||
| 	/// roughly equal to k * log(n), where k is the number of collisions and n is the
 |  | ||||||
| 	/// number of proxies in the tree.
 |  | ||||||
| 	/// @param input the ray-cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1).
 |  | ||||||
| 	/// @param callback a callback class that is called for each proxy that is hit by the ray.
 |  | ||||||
| 	template <typename T> |  | ||||||
| 	void RayCast(T* callback, const b2RayCastInput& input) const; |  | ||||||
| 
 |  | ||||||
| 	/// Validate this tree. For testing.
 |  | ||||||
| 	void Validate() const; |  | ||||||
| 
 |  | ||||||
| 	/// Compute the height of the binary tree in O(N) time. Should not be
 |  | ||||||
| 	/// called often.
 |  | ||||||
| 	int32 GetHeight() const; |  | ||||||
| 
 |  | ||||||
| 	/// Get the maximum balance of an node in the tree. The balance is the difference
 |  | ||||||
| 	/// in height of the two children of a node.
 |  | ||||||
| 	int32 GetMaxBalance() const; |  | ||||||
| 
 |  | ||||||
| 	/// Get the ratio of the sum of the node areas to the root area.
 |  | ||||||
| 	float32 GetAreaRatio() const; |  | ||||||
| 
 |  | ||||||
| 	/// Build an optimal tree. Very expensive. For testing.
 |  | ||||||
| 	void RebuildBottomUp(); |  | ||||||
| 
 |  | ||||||
| 	/// Shift the world origin. Useful for large worlds.
 |  | ||||||
| 	/// The shift formula is: position -= newOrigin
 |  | ||||||
| 	/// @param newOrigin the new origin with respect to the old origin
 |  | ||||||
| 	void ShiftOrigin(const b2Vec2& newOrigin); |  | ||||||
| 
 |  | ||||||
| private: |  | ||||||
| 
 |  | ||||||
| 	int32 AllocateNode(); |  | ||||||
| 	void FreeNode(int32 node); |  | ||||||
| 
 |  | ||||||
| 	void InsertLeaf(int32 node); |  | ||||||
| 	void RemoveLeaf(int32 node); |  | ||||||
| 
 |  | ||||||
| 	int32 Balance(int32 index); |  | ||||||
| 
 |  | ||||||
| 	int32 ComputeHeight() const; |  | ||||||
| 	int32 ComputeHeight(int32 nodeId) const; |  | ||||||
| 
 |  | ||||||
| 	void ValidateStructure(int32 index) const; |  | ||||||
| 	void ValidateMetrics(int32 index) const; |  | ||||||
| 
 |  | ||||||
| 	int32 m_root; |  | ||||||
| 
 |  | ||||||
| 	b2TreeNode* m_nodes; |  | ||||||
| 	int32 m_nodeCount; |  | ||||||
| 	int32 m_nodeCapacity; |  | ||||||
| 
 |  | ||||||
| 	int32 m_freeList; |  | ||||||
| 
 |  | ||||||
| 	/// This is used to incrementally traverse the tree for re-balancing.
 |  | ||||||
| 	uint32 m_path; |  | ||||||
| 
 |  | ||||||
| 	int32 m_insertionCount; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| inline void* b2DynamicTree::GetUserData(int32 proxyId) const |  | ||||||
| { |  | ||||||
| 	b2Assert(0 <= proxyId && proxyId < m_nodeCapacity); |  | ||||||
| 	return m_nodes[proxyId].userData; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline const b2AABB& b2DynamicTree::GetFatAABB(int32 proxyId) const |  | ||||||
| { |  | ||||||
| 	b2Assert(0 <= proxyId && proxyId < m_nodeCapacity); |  | ||||||
| 	return m_nodes[proxyId].aabb; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| template <typename T> |  | ||||||
| inline void b2DynamicTree::Query(T* callback, const b2AABB& aabb) const |  | ||||||
| { |  | ||||||
| 	b2GrowableStack<int32, 256> stack; |  | ||||||
| 	stack.Push(m_root); |  | ||||||
| 
 |  | ||||||
| 	while (stack.GetCount() > 0) |  | ||||||
| 	{ |  | ||||||
| 		int32 nodeId = stack.Pop(); |  | ||||||
| 		if (nodeId == b2_nullNode) |  | ||||||
| 		{ |  | ||||||
| 			continue; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		const b2TreeNode* node = m_nodes + nodeId; |  | ||||||
| 
 |  | ||||||
| 		if (b2TestOverlap(node->aabb, aabb)) |  | ||||||
| 		{ |  | ||||||
| 			if (node->IsLeaf()) |  | ||||||
| 			{ |  | ||||||
| 				bool proceed = callback->QueryCallback(nodeId); |  | ||||||
| 				if (proceed == false) |  | ||||||
| 				{ |  | ||||||
| 					return; |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 			else |  | ||||||
| 			{ |  | ||||||
| 				stack.Push(node->child1); |  | ||||||
| 				stack.Push(node->child2); |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| template <typename T> |  | ||||||
| inline void b2DynamicTree::RayCast(T* callback, const b2RayCastInput& input) const |  | ||||||
| { |  | ||||||
| 	b2Vec2 p1 = input.p1; |  | ||||||
| 	b2Vec2 p2 = input.p2; |  | ||||||
| 	b2Vec2 r = p2 - p1; |  | ||||||
| 	b2Assert(r.LengthSquared() > 0.0f); |  | ||||||
| 	r.Normalize(); |  | ||||||
| 
 |  | ||||||
| 	// v is perpendicular to the segment.
 |  | ||||||
| 	b2Vec2 v = b2Cross(1.0f, r); |  | ||||||
| 	b2Vec2 abs_v = b2Abs(v); |  | ||||||
| 
 |  | ||||||
| 	// Separating axis for segment (Gino, p80).
 |  | ||||||
| 	// |dot(v, p1 - c)| > dot(|v|, h)
 |  | ||||||
| 
 |  | ||||||
| 	float32 maxFraction = input.maxFraction; |  | ||||||
| 
 |  | ||||||
| 	// Build a bounding box for the segment.
 |  | ||||||
| 	b2AABB segmentAABB; |  | ||||||
| 	{ |  | ||||||
| 		b2Vec2 t = p1 + maxFraction * (p2 - p1); |  | ||||||
| 		segmentAABB.lowerBound = b2Min(p1, t); |  | ||||||
| 		segmentAABB.upperBound = b2Max(p1, t); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	b2GrowableStack<int32, 256> stack; |  | ||||||
| 	stack.Push(m_root); |  | ||||||
| 
 |  | ||||||
| 	while (stack.GetCount() > 0) |  | ||||||
| 	{ |  | ||||||
| 		int32 nodeId = stack.Pop(); |  | ||||||
| 		if (nodeId == b2_nullNode) |  | ||||||
| 		{ |  | ||||||
| 			continue; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		const b2TreeNode* node = m_nodes + nodeId; |  | ||||||
| 
 |  | ||||||
| 		if (b2TestOverlap(node->aabb, segmentAABB) == false) |  | ||||||
| 		{ |  | ||||||
| 			continue; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		// Separating axis for segment (Gino, p80).
 |  | ||||||
| 		// |dot(v, p1 - c)| > dot(|v|, h)
 |  | ||||||
| 		b2Vec2 c = node->aabb.GetCenter(); |  | ||||||
| 		b2Vec2 h = node->aabb.GetExtents(); |  | ||||||
| 		float32 separation = b2Abs(b2Dot(v, p1 - c)) - b2Dot(abs_v, h); |  | ||||||
| 		if (separation > 0.0f) |  | ||||||
| 		{ |  | ||||||
| 			continue; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		if (node->IsLeaf()) |  | ||||||
| 		{ |  | ||||||
| 			b2RayCastInput subInput; |  | ||||||
| 			subInput.p1 = input.p1; |  | ||||||
| 			subInput.p2 = input.p2; |  | ||||||
| 			subInput.maxFraction = maxFraction; |  | ||||||
| 
 |  | ||||||
| 			float32 value = callback->RayCastCallback(subInput, nodeId); |  | ||||||
| 
 |  | ||||||
| 			if (value == 0.0f) |  | ||||||
| 			{ |  | ||||||
| 				// The client has terminated the ray cast.
 |  | ||||||
| 				return; |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			if (value > 0.0f) |  | ||||||
| 			{ |  | ||||||
| 				// Update segment bounding box.
 |  | ||||||
| 				maxFraction = value; |  | ||||||
| 				b2Vec2 t = p1 + maxFraction * (p2 - p1); |  | ||||||
| 				segmentAABB.lowerBound = b2Min(p1, t); |  | ||||||
| 				segmentAABB.upperBound = b2Max(p1, t); |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			stack.Push(node->child1); |  | ||||||
| 			stack.Push(node->child2); |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #endif |  | ||||||
|  | @ -1,486 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2007-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #include "Box2D/Collision/b2Collision.h" |  | ||||||
| #include "Box2D/Collision/b2Distance.h" |  | ||||||
| #include "Box2D/Collision/b2TimeOfImpact.h" |  | ||||||
| #include "Box2D/Collision/Shapes/b2CircleShape.h" |  | ||||||
| #include "Box2D/Collision/Shapes/b2PolygonShape.h" |  | ||||||
| #include "Box2D/Common/b2Timer.h" |  | ||||||
| 
 |  | ||||||
| #include <stdio.h> |  | ||||||
| 
 |  | ||||||
| float32 b2_toiTime, b2_toiMaxTime; |  | ||||||
| int32 b2_toiCalls, b2_toiIters, b2_toiMaxIters; |  | ||||||
| int32 b2_toiRootIters, b2_toiMaxRootIters; |  | ||||||
| 
 |  | ||||||
| //
 |  | ||||||
| struct b2SeparationFunction |  | ||||||
| { |  | ||||||
| 	enum Type |  | ||||||
| 	{ |  | ||||||
| 		e_points, |  | ||||||
| 		e_faceA, |  | ||||||
| 		e_faceB |  | ||||||
| 	}; |  | ||||||
| 
 |  | ||||||
| 	// TODO_ERIN might not need to return the separation
 |  | ||||||
| 
 |  | ||||||
| 	float32 Initialize(const b2SimplexCache* cache, |  | ||||||
| 		const b2DistanceProxy* proxyA, const b2Sweep& sweepA, |  | ||||||
| 		const b2DistanceProxy* proxyB, const b2Sweep& sweepB, |  | ||||||
| 		float32 t1) |  | ||||||
| 	{ |  | ||||||
| 		m_proxyA = proxyA; |  | ||||||
| 		m_proxyB = proxyB; |  | ||||||
| 		int32 count = cache->count; |  | ||||||
| 		b2Assert(0 < count && count < 3); |  | ||||||
| 
 |  | ||||||
| 		m_sweepA = sweepA; |  | ||||||
| 		m_sweepB = sweepB; |  | ||||||
| 
 |  | ||||||
| 		b2Transform xfA, xfB; |  | ||||||
| 		m_sweepA.GetTransform(&xfA, t1); |  | ||||||
| 		m_sweepB.GetTransform(&xfB, t1); |  | ||||||
| 
 |  | ||||||
| 		if (count == 1) |  | ||||||
| 		{ |  | ||||||
| 			m_type = e_points; |  | ||||||
| 			b2Vec2 localPointA = m_proxyA->GetVertex(cache->indexA[0]); |  | ||||||
| 			b2Vec2 localPointB = m_proxyB->GetVertex(cache->indexB[0]); |  | ||||||
| 			b2Vec2 pointA = b2Mul(xfA, localPointA); |  | ||||||
| 			b2Vec2 pointB = b2Mul(xfB, localPointB); |  | ||||||
| 			m_axis = pointB - pointA; |  | ||||||
| 			float32 s = m_axis.Normalize(); |  | ||||||
| 			return s; |  | ||||||
| 		} |  | ||||||
| 		else if (cache->indexA[0] == cache->indexA[1]) |  | ||||||
| 		{ |  | ||||||
| 			// Two points on B and one on A.
 |  | ||||||
| 			m_type = e_faceB; |  | ||||||
| 			b2Vec2 localPointB1 = proxyB->GetVertex(cache->indexB[0]); |  | ||||||
| 			b2Vec2 localPointB2 = proxyB->GetVertex(cache->indexB[1]); |  | ||||||
| 
 |  | ||||||
| 			m_axis = b2Cross(localPointB2 - localPointB1, 1.0f); |  | ||||||
| 			m_axis.Normalize(); |  | ||||||
| 			b2Vec2 normal = b2Mul(xfB.q, m_axis); |  | ||||||
| 
 |  | ||||||
| 			m_localPoint = 0.5f * (localPointB1 + localPointB2); |  | ||||||
| 			b2Vec2 pointB = b2Mul(xfB, m_localPoint); |  | ||||||
| 
 |  | ||||||
| 			b2Vec2 localPointA = proxyA->GetVertex(cache->indexA[0]); |  | ||||||
| 			b2Vec2 pointA = b2Mul(xfA, localPointA); |  | ||||||
| 
 |  | ||||||
| 			float32 s = b2Dot(pointA - pointB, normal); |  | ||||||
| 			if (s < 0.0f) |  | ||||||
| 			{ |  | ||||||
| 				m_axis = -m_axis; |  | ||||||
| 				s = -s; |  | ||||||
| 			} |  | ||||||
| 			return s; |  | ||||||
| 		} |  | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			// Two points on A and one or two points on B.
 |  | ||||||
| 			m_type = e_faceA; |  | ||||||
| 			b2Vec2 localPointA1 = m_proxyA->GetVertex(cache->indexA[0]); |  | ||||||
| 			b2Vec2 localPointA2 = m_proxyA->GetVertex(cache->indexA[1]); |  | ||||||
| 			 |  | ||||||
| 			m_axis = b2Cross(localPointA2 - localPointA1, 1.0f); |  | ||||||
| 			m_axis.Normalize(); |  | ||||||
| 			b2Vec2 normal = b2Mul(xfA.q, m_axis); |  | ||||||
| 
 |  | ||||||
| 			m_localPoint = 0.5f * (localPointA1 + localPointA2); |  | ||||||
| 			b2Vec2 pointA = b2Mul(xfA, m_localPoint); |  | ||||||
| 
 |  | ||||||
| 			b2Vec2 localPointB = m_proxyB->GetVertex(cache->indexB[0]); |  | ||||||
| 			b2Vec2 pointB = b2Mul(xfB, localPointB); |  | ||||||
| 
 |  | ||||||
| 			float32 s = b2Dot(pointB - pointA, normal); |  | ||||||
| 			if (s < 0.0f) |  | ||||||
| 			{ |  | ||||||
| 				m_axis = -m_axis; |  | ||||||
| 				s = -s; |  | ||||||
| 			} |  | ||||||
| 			return s; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	//
 |  | ||||||
| 	float32 FindMinSeparation(int32* indexA, int32* indexB, float32 t) const |  | ||||||
| 	{ |  | ||||||
| 		b2Transform xfA, xfB; |  | ||||||
| 		m_sweepA.GetTransform(&xfA, t); |  | ||||||
| 		m_sweepB.GetTransform(&xfB, t); |  | ||||||
| 
 |  | ||||||
| 		switch (m_type) |  | ||||||
| 		{ |  | ||||||
| 		case e_points: |  | ||||||
| 			{ |  | ||||||
| 				b2Vec2 axisA = b2MulT(xfA.q,  m_axis); |  | ||||||
| 				b2Vec2 axisB = b2MulT(xfB.q, -m_axis); |  | ||||||
| 
 |  | ||||||
| 				*indexA = m_proxyA->GetSupport(axisA); |  | ||||||
| 				*indexB = m_proxyB->GetSupport(axisB); |  | ||||||
| 
 |  | ||||||
| 				b2Vec2 localPointA = m_proxyA->GetVertex(*indexA); |  | ||||||
| 				b2Vec2 localPointB = m_proxyB->GetVertex(*indexB); |  | ||||||
| 				 |  | ||||||
| 				b2Vec2 pointA = b2Mul(xfA, localPointA); |  | ||||||
| 				b2Vec2 pointB = b2Mul(xfB, localPointB); |  | ||||||
| 
 |  | ||||||
| 				float32 separation = b2Dot(pointB - pointA, m_axis); |  | ||||||
| 				return separation; |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 		case e_faceA: |  | ||||||
| 			{ |  | ||||||
| 				b2Vec2 normal = b2Mul(xfA.q, m_axis); |  | ||||||
| 				b2Vec2 pointA = b2Mul(xfA, m_localPoint); |  | ||||||
| 
 |  | ||||||
| 				b2Vec2 axisB = b2MulT(xfB.q, -normal); |  | ||||||
| 				 |  | ||||||
| 				*indexA = -1; |  | ||||||
| 				*indexB = m_proxyB->GetSupport(axisB); |  | ||||||
| 
 |  | ||||||
| 				b2Vec2 localPointB = m_proxyB->GetVertex(*indexB); |  | ||||||
| 				b2Vec2 pointB = b2Mul(xfB, localPointB); |  | ||||||
| 
 |  | ||||||
| 				float32 separation = b2Dot(pointB - pointA, normal); |  | ||||||
| 				return separation; |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 		case e_faceB: |  | ||||||
| 			{ |  | ||||||
| 				b2Vec2 normal = b2Mul(xfB.q, m_axis); |  | ||||||
| 				b2Vec2 pointB = b2Mul(xfB, m_localPoint); |  | ||||||
| 
 |  | ||||||
| 				b2Vec2 axisA = b2MulT(xfA.q, -normal); |  | ||||||
| 
 |  | ||||||
| 				*indexB = -1; |  | ||||||
| 				*indexA = m_proxyA->GetSupport(axisA); |  | ||||||
| 
 |  | ||||||
| 				b2Vec2 localPointA = m_proxyA->GetVertex(*indexA); |  | ||||||
| 				b2Vec2 pointA = b2Mul(xfA, localPointA); |  | ||||||
| 
 |  | ||||||
| 				float32 separation = b2Dot(pointA - pointB, normal); |  | ||||||
| 				return separation; |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 		default: |  | ||||||
| 			b2Assert(false); |  | ||||||
| 			*indexA = -1; |  | ||||||
| 			*indexB = -1; |  | ||||||
| 			return 0.0f; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	//
 |  | ||||||
| 	float32 Evaluate(int32 indexA, int32 indexB, float32 t) const |  | ||||||
| 	{ |  | ||||||
| 		b2Transform xfA, xfB; |  | ||||||
| 		m_sweepA.GetTransform(&xfA, t); |  | ||||||
| 		m_sweepB.GetTransform(&xfB, t); |  | ||||||
| 
 |  | ||||||
| 		switch (m_type) |  | ||||||
| 		{ |  | ||||||
| 		case e_points: |  | ||||||
| 			{ |  | ||||||
| 				b2Vec2 localPointA = m_proxyA->GetVertex(indexA); |  | ||||||
| 				b2Vec2 localPointB = m_proxyB->GetVertex(indexB); |  | ||||||
| 
 |  | ||||||
| 				b2Vec2 pointA = b2Mul(xfA, localPointA); |  | ||||||
| 				b2Vec2 pointB = b2Mul(xfB, localPointB); |  | ||||||
| 				float32 separation = b2Dot(pointB - pointA, m_axis); |  | ||||||
| 
 |  | ||||||
| 				return separation; |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 		case e_faceA: |  | ||||||
| 			{ |  | ||||||
| 				b2Vec2 normal = b2Mul(xfA.q, m_axis); |  | ||||||
| 				b2Vec2 pointA = b2Mul(xfA, m_localPoint); |  | ||||||
| 
 |  | ||||||
| 				b2Vec2 localPointB = m_proxyB->GetVertex(indexB); |  | ||||||
| 				b2Vec2 pointB = b2Mul(xfB, localPointB); |  | ||||||
| 
 |  | ||||||
| 				float32 separation = b2Dot(pointB - pointA, normal); |  | ||||||
| 				return separation; |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 		case e_faceB: |  | ||||||
| 			{ |  | ||||||
| 				b2Vec2 normal = b2Mul(xfB.q, m_axis); |  | ||||||
| 				b2Vec2 pointB = b2Mul(xfB, m_localPoint); |  | ||||||
| 
 |  | ||||||
| 				b2Vec2 localPointA = m_proxyA->GetVertex(indexA); |  | ||||||
| 				b2Vec2 pointA = b2Mul(xfA, localPointA); |  | ||||||
| 
 |  | ||||||
| 				float32 separation = b2Dot(pointA - pointB, normal); |  | ||||||
| 				return separation; |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 		default: |  | ||||||
| 			b2Assert(false); |  | ||||||
| 			return 0.0f; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	const b2DistanceProxy* m_proxyA; |  | ||||||
| 	const b2DistanceProxy* m_proxyB; |  | ||||||
| 	b2Sweep m_sweepA, m_sweepB; |  | ||||||
| 	Type m_type; |  | ||||||
| 	b2Vec2 m_localPoint; |  | ||||||
| 	b2Vec2 m_axis; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| // CCD via the local separating axis method. This seeks progression
 |  | ||||||
| // by computing the largest time at which separation is maintained.
 |  | ||||||
| void b2TimeOfImpact(b2TOIOutput* output, const b2TOIInput* input) |  | ||||||
| { |  | ||||||
| 	b2Timer timer; |  | ||||||
| 
 |  | ||||||
| 	++b2_toiCalls; |  | ||||||
| 
 |  | ||||||
| 	output->state = b2TOIOutput::e_unknown; |  | ||||||
| 	output->t = input->tMax; |  | ||||||
| 
 |  | ||||||
| 	const b2DistanceProxy* proxyA = &input->proxyA; |  | ||||||
| 	const b2DistanceProxy* proxyB = &input->proxyB; |  | ||||||
| 
 |  | ||||||
| 	b2Sweep sweepA = input->sweepA; |  | ||||||
| 	b2Sweep sweepB = input->sweepB; |  | ||||||
| 
 |  | ||||||
| 	// Large rotations can make the root finder fail, so we normalize the
 |  | ||||||
| 	// sweep angles.
 |  | ||||||
| 	sweepA.Normalize(); |  | ||||||
| 	sweepB.Normalize(); |  | ||||||
| 
 |  | ||||||
| 	float32 tMax = input->tMax; |  | ||||||
| 
 |  | ||||||
| 	float32 totalRadius = proxyA->m_radius + proxyB->m_radius; |  | ||||||
| 	float32 target = b2Max(b2_linearSlop, totalRadius - 3.0f * b2_linearSlop); |  | ||||||
| 	float32 tolerance = 0.25f * b2_linearSlop; |  | ||||||
| 	b2Assert(target > tolerance); |  | ||||||
| 
 |  | ||||||
| 	float32 t1 = 0.0f; |  | ||||||
| 	const int32 k_maxIterations = 20;	// TODO_ERIN b2Settings
 |  | ||||||
| 	int32 iter = 0; |  | ||||||
| 
 |  | ||||||
| 	// Prepare input for distance query.
 |  | ||||||
| 	b2SimplexCache cache; |  | ||||||
| 	cache.count = 0; |  | ||||||
| 	b2DistanceInput distanceInput; |  | ||||||
| 	distanceInput.proxyA = input->proxyA; |  | ||||||
| 	distanceInput.proxyB = input->proxyB; |  | ||||||
| 	distanceInput.useRadii = false; |  | ||||||
| 
 |  | ||||||
| 	// The outer loop progressively attempts to compute new separating axes.
 |  | ||||||
| 	// This loop terminates when an axis is repeated (no progress is made).
 |  | ||||||
| 	for(;;) |  | ||||||
| 	{ |  | ||||||
| 		b2Transform xfA, xfB; |  | ||||||
| 		sweepA.GetTransform(&xfA, t1); |  | ||||||
| 		sweepB.GetTransform(&xfB, t1); |  | ||||||
| 
 |  | ||||||
| 		// Get the distance between shapes. We can also use the results
 |  | ||||||
| 		// to get a separating axis.
 |  | ||||||
| 		distanceInput.transformA = xfA; |  | ||||||
| 		distanceInput.transformB = xfB; |  | ||||||
| 		b2DistanceOutput distanceOutput; |  | ||||||
| 		b2Distance(&distanceOutput, &cache, &distanceInput); |  | ||||||
| 
 |  | ||||||
| 		// If the shapes are overlapped, we give up on continuous collision.
 |  | ||||||
| 		if (distanceOutput.distance <= 0.0f) |  | ||||||
| 		{ |  | ||||||
| 			// Failure!
 |  | ||||||
| 			output->state = b2TOIOutput::e_overlapped; |  | ||||||
| 			output->t = 0.0f; |  | ||||||
| 			break; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		if (distanceOutput.distance < target + tolerance) |  | ||||||
| 		{ |  | ||||||
| 			// Victory!
 |  | ||||||
| 			output->state = b2TOIOutput::e_touching; |  | ||||||
| 			output->t = t1; |  | ||||||
| 			break; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		// Initialize the separating axis.
 |  | ||||||
| 		b2SeparationFunction fcn; |  | ||||||
| 		fcn.Initialize(&cache, proxyA, sweepA, proxyB, sweepB, t1); |  | ||||||
| #if 0 |  | ||||||
| 		// Dump the curve seen by the root finder
 |  | ||||||
| 		{ |  | ||||||
| 			const int32 N = 100; |  | ||||||
| 			float32 dx = 1.0f / N; |  | ||||||
| 			float32 xs[N+1]; |  | ||||||
| 			float32 fs[N+1]; |  | ||||||
| 
 |  | ||||||
| 			float32 x = 0.0f; |  | ||||||
| 
 |  | ||||||
| 			for (int32 i = 0; i <= N; ++i) |  | ||||||
| 			{ |  | ||||||
| 				sweepA.GetTransform(&xfA, x); |  | ||||||
| 				sweepB.GetTransform(&xfB, x); |  | ||||||
| 				float32 f = fcn.Evaluate(xfA, xfB) - target; |  | ||||||
| 
 |  | ||||||
| 				printf("%g %g\n", x, f); |  | ||||||
| 
 |  | ||||||
| 				xs[i] = x; |  | ||||||
| 				fs[i] = f; |  | ||||||
| 
 |  | ||||||
| 				x += dx; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| 		// Compute the TOI on the separating axis. We do this by successively
 |  | ||||||
| 		// resolving the deepest point. This loop is bounded by the number of vertices.
 |  | ||||||
| 		bool done = false; |  | ||||||
| 		float32 t2 = tMax; |  | ||||||
| 		int32 pushBackIter = 0; |  | ||||||
| 		for (;;) |  | ||||||
| 		{ |  | ||||||
| 			// Find the deepest point at t2. Store the witness point indices.
 |  | ||||||
| 			int32 indexA, indexB; |  | ||||||
| 			float32 s2 = fcn.FindMinSeparation(&indexA, &indexB, t2); |  | ||||||
| 
 |  | ||||||
| 			// Is the final configuration separated?
 |  | ||||||
| 			if (s2 > target + tolerance) |  | ||||||
| 			{ |  | ||||||
| 				// Victory!
 |  | ||||||
| 				output->state = b2TOIOutput::e_separated; |  | ||||||
| 				output->t = tMax; |  | ||||||
| 				done = true; |  | ||||||
| 				break; |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			// Has the separation reached tolerance?
 |  | ||||||
| 			if (s2 > target - tolerance) |  | ||||||
| 			{ |  | ||||||
| 				// Advance the sweeps
 |  | ||||||
| 				t1 = t2; |  | ||||||
| 				break; |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			// Compute the initial separation of the witness points.
 |  | ||||||
| 			float32 s1 = fcn.Evaluate(indexA, indexB, t1); |  | ||||||
| 
 |  | ||||||
| 			// Check for initial overlap. This might happen if the root finder
 |  | ||||||
| 			// runs out of iterations.
 |  | ||||||
| 			if (s1 < target - tolerance) |  | ||||||
| 			{ |  | ||||||
| 				output->state = b2TOIOutput::e_failed; |  | ||||||
| 				output->t = t1; |  | ||||||
| 				done = true; |  | ||||||
| 				break; |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			// Check for touching
 |  | ||||||
| 			if (s1 <= target + tolerance) |  | ||||||
| 			{ |  | ||||||
| 				// Victory! t1 should hold the TOI (could be 0.0).
 |  | ||||||
| 				output->state = b2TOIOutput::e_touching; |  | ||||||
| 				output->t = t1; |  | ||||||
| 				done = true; |  | ||||||
| 				break; |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			// Compute 1D root of: f(x) - target = 0
 |  | ||||||
| 			int32 rootIterCount = 0; |  | ||||||
| 			float32 a1 = t1, a2 = t2; |  | ||||||
| 			for (;;) |  | ||||||
| 			{ |  | ||||||
| 				// Use a mix of the secant rule and bisection.
 |  | ||||||
| 				float32 t; |  | ||||||
| 				if (rootIterCount & 1) |  | ||||||
| 				{ |  | ||||||
| 					// Secant rule to improve convergence.
 |  | ||||||
| 					t = a1 + (target - s1) * (a2 - a1) / (s2 - s1); |  | ||||||
| 				} |  | ||||||
| 				else |  | ||||||
| 				{ |  | ||||||
| 					// Bisection to guarantee progress.
 |  | ||||||
| 					t = 0.5f * (a1 + a2); |  | ||||||
| 				} |  | ||||||
| 
 |  | ||||||
| 				++rootIterCount; |  | ||||||
| 				++b2_toiRootIters; |  | ||||||
| 
 |  | ||||||
| 				float32 s = fcn.Evaluate(indexA, indexB, t); |  | ||||||
| 
 |  | ||||||
| 				if (b2Abs(s - target) < tolerance) |  | ||||||
| 				{ |  | ||||||
| 					// t2 holds a tentative value for t1
 |  | ||||||
| 					t2 = t; |  | ||||||
| 					break; |  | ||||||
| 				} |  | ||||||
| 
 |  | ||||||
| 				// Ensure we continue to bracket the root.
 |  | ||||||
| 				if (s > target) |  | ||||||
| 				{ |  | ||||||
| 					a1 = t; |  | ||||||
| 					s1 = s; |  | ||||||
| 				} |  | ||||||
| 				else |  | ||||||
| 				{ |  | ||||||
| 					a2 = t; |  | ||||||
| 					s2 = s; |  | ||||||
| 				} |  | ||||||
| 				 |  | ||||||
| 				if (rootIterCount == 50) |  | ||||||
| 				{ |  | ||||||
| 					break; |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			b2_toiMaxRootIters = b2Max(b2_toiMaxRootIters, rootIterCount); |  | ||||||
| 
 |  | ||||||
| 			++pushBackIter; |  | ||||||
| 
 |  | ||||||
| 			if (pushBackIter == b2_maxPolygonVertices) |  | ||||||
| 			{ |  | ||||||
| 				break; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		++iter; |  | ||||||
| 		++b2_toiIters; |  | ||||||
| 
 |  | ||||||
| 		if (done) |  | ||||||
| 		{ |  | ||||||
| 			break; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		if (iter == k_maxIterations) |  | ||||||
| 		{ |  | ||||||
| 			// Root finder got stuck. Semi-victory.
 |  | ||||||
| 			output->state = b2TOIOutput::e_failed; |  | ||||||
| 			output->t = t1; |  | ||||||
| 			break; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	b2_toiMaxIters = b2Max(b2_toiMaxIters, iter); |  | ||||||
| 
 |  | ||||||
| 	float32 time = timer.GetMilliseconds(); |  | ||||||
| 	b2_toiMaxTime = b2Max(b2_toiMaxTime, time); |  | ||||||
| 	b2_toiTime += time; |  | ||||||
| } |  | ||||||
|  | @ -1,58 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #ifndef B2_TIME_OF_IMPACT_H |  | ||||||
| #define B2_TIME_OF_IMPACT_H |  | ||||||
| 
 |  | ||||||
| #include "../Common/b2Math.h" |  | ||||||
| #include "b2Distance.h" |  | ||||||
| 
 |  | ||||||
| /// Input parameters for b2TimeOfImpact
 |  | ||||||
| struct b2TOIInput |  | ||||||
| { |  | ||||||
| 	b2DistanceProxy proxyA; |  | ||||||
| 	b2DistanceProxy proxyB; |  | ||||||
| 	b2Sweep sweepA; |  | ||||||
| 	b2Sweep sweepB; |  | ||||||
| 	float32 tMax;		// defines sweep interval [0, tMax]
 |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// Output parameters for b2TimeOfImpact.
 |  | ||||||
| struct b2TOIOutput |  | ||||||
| { |  | ||||||
| 	enum State |  | ||||||
| 	{ |  | ||||||
| 		e_unknown, |  | ||||||
| 		e_failed, |  | ||||||
| 		e_overlapped, |  | ||||||
| 		e_touching, |  | ||||||
| 		e_separated |  | ||||||
| 	}; |  | ||||||
| 
 |  | ||||||
| 	State state; |  | ||||||
| 	float32 t; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// Compute the upper bound on time before two shapes penetrate. Time is represented as
 |  | ||||||
| /// a fraction between [0,tMax]. This uses a swept separating axis and may miss some intermediate,
 |  | ||||||
| /// non-tunneling collisions. If you change the time interval, you should call this function
 |  | ||||||
| /// again.
 |  | ||||||
| /// Note: use b2Distance to compute the contact point and normal at the time of impact.
 |  | ||||||
| void b2TimeOfImpact(b2TOIOutput* output, const b2TOIInput* input); |  | ||||||
| 
 |  | ||||||
| #endif |  | ||||||
|  | @ -1,215 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #include "Box2D/Common/b2BlockAllocator.h" |  | ||||||
| #include <limits.h> |  | ||||||
| #include <string.h> |  | ||||||
| #include <stddef.h> |  | ||||||
| 
 |  | ||||||
| int32 b2BlockAllocator::s_blockSizes[b2_blockSizes] =  |  | ||||||
| { |  | ||||||
| 	16,		// 0
 |  | ||||||
| 	32,		// 1
 |  | ||||||
| 	64,		// 2
 |  | ||||||
| 	96,		// 3
 |  | ||||||
| 	128,	// 4
 |  | ||||||
| 	160,	// 5
 |  | ||||||
| 	192,	// 6
 |  | ||||||
| 	224,	// 7
 |  | ||||||
| 	256,	// 8
 |  | ||||||
| 	320,	// 9
 |  | ||||||
| 	384,	// 10
 |  | ||||||
| 	448,	// 11
 |  | ||||||
| 	512,	// 12
 |  | ||||||
| 	640,	// 13
 |  | ||||||
| }; |  | ||||||
| uint8 b2BlockAllocator::s_blockSizeLookup[b2_maxBlockSize + 1]; |  | ||||||
| bool b2BlockAllocator::s_blockSizeLookupInitialized; |  | ||||||
| 
 |  | ||||||
| struct b2Chunk |  | ||||||
| { |  | ||||||
| 	int32 blockSize; |  | ||||||
| 	b2Block* blocks; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| struct b2Block |  | ||||||
| { |  | ||||||
| 	b2Block* next; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| b2BlockAllocator::b2BlockAllocator() |  | ||||||
| { |  | ||||||
| 	b2Assert(b2_blockSizes < UCHAR_MAX); |  | ||||||
| 
 |  | ||||||
| 	m_chunkSpace = b2_chunkArrayIncrement; |  | ||||||
| 	m_chunkCount = 0; |  | ||||||
| 	m_chunks = (b2Chunk*)b2Alloc(m_chunkSpace * sizeof(b2Chunk)); |  | ||||||
| 	 |  | ||||||
| 	memset(m_chunks, 0, m_chunkSpace * sizeof(b2Chunk)); |  | ||||||
| 	memset(m_freeLists, 0, sizeof(m_freeLists)); |  | ||||||
| 
 |  | ||||||
| 	if (s_blockSizeLookupInitialized == false) |  | ||||||
| 	{ |  | ||||||
| 		int32 j = 0; |  | ||||||
| 		for (int32 i = 1; i <= b2_maxBlockSize; ++i) |  | ||||||
| 		{ |  | ||||||
| 			b2Assert(j < b2_blockSizes); |  | ||||||
| 			if (i <= s_blockSizes[j]) |  | ||||||
| 			{ |  | ||||||
| 				s_blockSizeLookup[i] = (uint8)j; |  | ||||||
| 			} |  | ||||||
| 			else |  | ||||||
| 			{ |  | ||||||
| 				++j; |  | ||||||
| 				s_blockSizeLookup[i] = (uint8)j; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		s_blockSizeLookupInitialized = true; |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| b2BlockAllocator::~b2BlockAllocator() |  | ||||||
| { |  | ||||||
| 	for (int32 i = 0; i < m_chunkCount; ++i) |  | ||||||
| 	{ |  | ||||||
| 		b2Free(m_chunks[i].blocks); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	b2Free(m_chunks); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void* b2BlockAllocator::Allocate(int32 size) |  | ||||||
| { |  | ||||||
| 	if (size == 0) |  | ||||||
| 		return nullptr; |  | ||||||
| 
 |  | ||||||
| 	b2Assert(0 < size); |  | ||||||
| 
 |  | ||||||
| 	if (size > b2_maxBlockSize) |  | ||||||
| 	{ |  | ||||||
| 		return b2Alloc(size); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	int32 index = s_blockSizeLookup[size]; |  | ||||||
| 	b2Assert(0 <= index && index < b2_blockSizes); |  | ||||||
| 
 |  | ||||||
| 	if (m_freeLists[index]) |  | ||||||
| 	{ |  | ||||||
| 		b2Block* block = m_freeLists[index]; |  | ||||||
| 		m_freeLists[index] = block->next; |  | ||||||
| 		return block; |  | ||||||
| 	} |  | ||||||
| 	else |  | ||||||
| 	{ |  | ||||||
| 		if (m_chunkCount == m_chunkSpace) |  | ||||||
| 		{ |  | ||||||
| 			b2Chunk* oldChunks = m_chunks; |  | ||||||
| 			m_chunkSpace += b2_chunkArrayIncrement; |  | ||||||
| 			m_chunks = (b2Chunk*)b2Alloc(m_chunkSpace * sizeof(b2Chunk)); |  | ||||||
| 			memcpy(m_chunks, oldChunks, m_chunkCount * sizeof(b2Chunk)); |  | ||||||
| 			memset(m_chunks + m_chunkCount, 0, b2_chunkArrayIncrement * sizeof(b2Chunk)); |  | ||||||
| 			b2Free(oldChunks); |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		b2Chunk* chunk = m_chunks + m_chunkCount; |  | ||||||
| 		chunk->blocks = (b2Block*)b2Alloc(b2_chunkSize); |  | ||||||
| #if defined(_DEBUG) |  | ||||||
| 		memset(chunk->blocks, 0xcd, b2_chunkSize); |  | ||||||
| #endif |  | ||||||
| 		int32 blockSize = s_blockSizes[index]; |  | ||||||
| 		chunk->blockSize = blockSize; |  | ||||||
| 		int32 blockCount = b2_chunkSize / blockSize; |  | ||||||
| 		b2Assert(blockCount * blockSize <= b2_chunkSize); |  | ||||||
| 		for (int32 i = 0; i < blockCount - 1; ++i) |  | ||||||
| 		{ |  | ||||||
| 			b2Block* block = (b2Block*)((int8*)chunk->blocks + blockSize * i); |  | ||||||
| 			b2Block* next = (b2Block*)((int8*)chunk->blocks + blockSize * (i + 1)); |  | ||||||
| 			block->next = next; |  | ||||||
| 		} |  | ||||||
| 		b2Block* last = (b2Block*)((int8*)chunk->blocks + blockSize * (blockCount - 1)); |  | ||||||
| 		last->next = nullptr; |  | ||||||
| 
 |  | ||||||
| 		m_freeLists[index] = chunk->blocks->next; |  | ||||||
| 		++m_chunkCount; |  | ||||||
| 
 |  | ||||||
| 		return chunk->blocks; |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2BlockAllocator::Free(void* p, int32 size) |  | ||||||
| { |  | ||||||
| 	if (size == 0) |  | ||||||
| 	{ |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	b2Assert(0 < size); |  | ||||||
| 
 |  | ||||||
| 	if (size > b2_maxBlockSize) |  | ||||||
| 	{ |  | ||||||
| 		b2Free(p); |  | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	int32 index = s_blockSizeLookup[size]; |  | ||||||
| 	b2Assert(0 <= index && index < b2_blockSizes); |  | ||||||
| 
 |  | ||||||
| #ifdef _DEBUG |  | ||||||
| 	// Verify the memory address and size is valid.
 |  | ||||||
| 	int32 blockSize = s_blockSizes[index]; |  | ||||||
| 	bool found = false; |  | ||||||
| 	for (int32 i = 0; i < m_chunkCount; ++i) |  | ||||||
| 	{ |  | ||||||
| 		b2Chunk* chunk = m_chunks + i; |  | ||||||
| 		if (chunk->blockSize != blockSize) |  | ||||||
| 		{ |  | ||||||
| 			b2Assert(	(int8*)p + blockSize <= (int8*)chunk->blocks || |  | ||||||
| 						(int8*)chunk->blocks + b2_chunkSize <= (int8*)p); |  | ||||||
| 		} |  | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			if ((int8*)chunk->blocks <= (int8*)p && (int8*)p + blockSize <= (int8*)chunk->blocks + b2_chunkSize) |  | ||||||
| 			{ |  | ||||||
| 				found = true; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	b2Assert(found); |  | ||||||
| 
 |  | ||||||
| 	memset(p, 0xfd, blockSize); |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| 	b2Block* block = (b2Block*)p; |  | ||||||
| 	block->next = m_freeLists[index]; |  | ||||||
| 	m_freeLists[index] = block; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2BlockAllocator::Clear() |  | ||||||
| { |  | ||||||
| 	for (int32 i = 0; i < m_chunkCount; ++i) |  | ||||||
| 	{ |  | ||||||
| 		b2Free(m_chunks[i].blocks); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	m_chunkCount = 0; |  | ||||||
| 	memset(m_chunks, 0, m_chunkSpace * sizeof(b2Chunk)); |  | ||||||
| 
 |  | ||||||
| 	memset(m_freeLists, 0, sizeof(m_freeLists)); |  | ||||||
| } |  | ||||||
|  | @ -1,62 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #ifndef B2_BLOCK_ALLOCATOR_H |  | ||||||
| #define B2_BLOCK_ALLOCATOR_H |  | ||||||
| 
 |  | ||||||
| #include "b2Settings.h" |  | ||||||
| 
 |  | ||||||
| const int32 b2_chunkSize = 16 * 1024; |  | ||||||
| const int32 b2_maxBlockSize = 640; |  | ||||||
| const int32 b2_blockSizes = 14; |  | ||||||
| const int32 b2_chunkArrayIncrement = 128; |  | ||||||
| 
 |  | ||||||
| struct b2Block; |  | ||||||
| struct b2Chunk; |  | ||||||
| 
 |  | ||||||
| /// This is a small object allocator used for allocating small
 |  | ||||||
| /// objects that persist for more than one time step.
 |  | ||||||
| /// See: http://www.codeproject.com/useritems/Small_Block_Allocator.asp
 |  | ||||||
| class b2BlockAllocator |  | ||||||
| { |  | ||||||
| public: |  | ||||||
| 	b2BlockAllocator(); |  | ||||||
| 	~b2BlockAllocator(); |  | ||||||
| 
 |  | ||||||
| 	/// Allocate memory. This will use b2Alloc if the size is larger than b2_maxBlockSize.
 |  | ||||||
| 	void* Allocate(int32 size); |  | ||||||
| 
 |  | ||||||
| 	/// Free memory. This will use b2Free if the size is larger than b2_maxBlockSize.
 |  | ||||||
| 	void Free(void* p, int32 size); |  | ||||||
| 
 |  | ||||||
| 	void Clear(); |  | ||||||
| 
 |  | ||||||
| private: |  | ||||||
| 
 |  | ||||||
| 	b2Chunk* m_chunks; |  | ||||||
| 	int32 m_chunkCount; |  | ||||||
| 	int32 m_chunkSpace; |  | ||||||
| 
 |  | ||||||
| 	b2Block* m_freeLists[b2_blockSizes]; |  | ||||||
| 
 |  | ||||||
| 	static int32 s_blockSizes[b2_blockSizes]; |  | ||||||
| 	static uint8 s_blockSizeLookup[b2_maxBlockSize + 1]; |  | ||||||
| 	static bool s_blockSizeLookupInitialized; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| #endif |  | ||||||
|  | @ -1,44 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2011 Erin Catto http://box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #include "Box2D/Common/b2Draw.h" |  | ||||||
| 
 |  | ||||||
| b2Draw::b2Draw() |  | ||||||
| { |  | ||||||
| 	m_drawFlags = 0; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2Draw::SetFlags(uint32 flags) |  | ||||||
| { |  | ||||||
| 	m_drawFlags = flags; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| uint32 b2Draw::GetFlags() const |  | ||||||
| { |  | ||||||
| 	return m_drawFlags; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2Draw::AppendFlags(uint32 flags) |  | ||||||
| { |  | ||||||
| 	m_drawFlags |= flags; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2Draw::ClearFlags(uint32 flags) |  | ||||||
| { |  | ||||||
| 	m_drawFlags &= ~flags; |  | ||||||
| } |  | ||||||
|  | @ -1,97 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2011 Erin Catto http://box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #ifndef B2_DRAW_H |  | ||||||
| #define B2_DRAW_H |  | ||||||
| 
 |  | ||||||
| #include "b2Math.h" |  | ||||||
| 
 |  | ||||||
| /// Color for debug drawing. Each value has the range [0,1].
 |  | ||||||
| struct b2Color |  | ||||||
| { |  | ||||||
| 	b2Color() {} |  | ||||||
| 	b2Color(float32 rIn, float32 gIn, float32 bIn, float32 aIn = 1.0f) |  | ||||||
| 	{ |  | ||||||
| 		r = rIn; g = gIn; b = bIn; a = aIn; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	void Set(float32 rIn, float32 gIn, float32 bIn, float32 aIn = 1.0f) |  | ||||||
| 	{ |  | ||||||
| 		r = rIn; g = gIn; b = bIn; a = aIn; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	float32 r, g, b, a; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// Implement and register this class with a b2World to provide debug drawing of physics
 |  | ||||||
| /// entities in your game.
 |  | ||||||
| class b2Draw |  | ||||||
| { |  | ||||||
| public: |  | ||||||
| 	b2Draw(); |  | ||||||
| 
 |  | ||||||
| 	virtual ~b2Draw() {} |  | ||||||
| 
 |  | ||||||
| 	enum |  | ||||||
| 	{ |  | ||||||
| 		e_shapeBit				= 0x0001,	///< draw shapes
 |  | ||||||
| 		e_jointBit				= 0x0002,	///< draw joint connections
 |  | ||||||
| 		e_aabbBit				= 0x0004,	///< draw axis aligned bounding boxes
 |  | ||||||
| 		e_pairBit				= 0x0008,	///< draw broad-phase pairs
 |  | ||||||
| 		e_centerOfMassBit		= 0x0010	///< draw center of mass frame
 |  | ||||||
| 	}; |  | ||||||
| 
 |  | ||||||
| 	/// Set the drawing flags.
 |  | ||||||
| 	void SetFlags(uint32 flags); |  | ||||||
| 
 |  | ||||||
| 	/// Get the drawing flags.
 |  | ||||||
| 	uint32 GetFlags() const; |  | ||||||
| 	 |  | ||||||
| 	/// Append flags to the current flags.
 |  | ||||||
| 	void AppendFlags(uint32 flags); |  | ||||||
| 
 |  | ||||||
| 	/// Clear flags from the current flags.
 |  | ||||||
| 	void ClearFlags(uint32 flags); |  | ||||||
| 
 |  | ||||||
| 	/// Draw a closed polygon provided in CCW order.
 |  | ||||||
| 	virtual void DrawPolygon(const b2Vec2* vertices, int32 vertexCount, const b2Color& color) = 0; |  | ||||||
| 
 |  | ||||||
| 	/// Draw a solid closed polygon provided in CCW order.
 |  | ||||||
| 	virtual void DrawSolidPolygon(const b2Vec2* vertices, int32 vertexCount, const b2Color& color) = 0; |  | ||||||
| 
 |  | ||||||
| 	/// Draw a circle.
 |  | ||||||
| 	virtual void DrawCircle(const b2Vec2& center, float32 radius, const b2Color& color) = 0; |  | ||||||
| 	 |  | ||||||
| 	/// Draw a solid circle.
 |  | ||||||
| 	virtual void DrawSolidCircle(const b2Vec2& center, float32 radius, const b2Vec2& axis, const b2Color& color) = 0; |  | ||||||
| 	 |  | ||||||
| 	/// Draw a line segment.
 |  | ||||||
| 	virtual void DrawSegment(const b2Vec2& p1, const b2Vec2& p2, const b2Color& color) = 0; |  | ||||||
| 
 |  | ||||||
| 	/// Draw a transform. Choose your own length scale.
 |  | ||||||
| 	/// @param xf a transform.
 |  | ||||||
| 	virtual void DrawTransform(const b2Transform& xf) = 0; |  | ||||||
| 
 |  | ||||||
| 	/// Draw a point.
 |  | ||||||
| 	virtual void DrawPoint(const b2Vec2& p, float32 size, const b2Color& color) = 0; |  | ||||||
| 
 |  | ||||||
| protected: |  | ||||||
| 	uint32 m_drawFlags; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| #endif |  | ||||||
|  | @ -1,85 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2010 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #ifndef B2_GROWABLE_STACK_H |  | ||||||
| #define B2_GROWABLE_STACK_H |  | ||||||
| #include "b2Settings.h" |  | ||||||
| #include <string.h> |  | ||||||
| 
 |  | ||||||
| /// This is a growable LIFO stack with an initial capacity of N.
 |  | ||||||
| /// If the stack size exceeds the initial capacity, the heap is used
 |  | ||||||
| /// to increase the size of the stack.
 |  | ||||||
| template <typename T, int32 N> |  | ||||||
| class b2GrowableStack |  | ||||||
| { |  | ||||||
| public: |  | ||||||
| 	b2GrowableStack() |  | ||||||
| 	{ |  | ||||||
| 		m_stack = m_array; |  | ||||||
| 		m_count = 0; |  | ||||||
| 		m_capacity = N; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	~b2GrowableStack() |  | ||||||
| 	{ |  | ||||||
| 		if (m_stack != m_array) |  | ||||||
| 		{ |  | ||||||
| 			b2Free(m_stack); |  | ||||||
| 			m_stack = nullptr; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	void Push(const T& element) |  | ||||||
| 	{ |  | ||||||
| 		if (m_count == m_capacity) |  | ||||||
| 		{ |  | ||||||
| 			T* old = m_stack; |  | ||||||
| 			m_capacity *= 2; |  | ||||||
| 			m_stack = (T*)b2Alloc(m_capacity * sizeof(T)); |  | ||||||
| 			memcpy(m_stack, old, m_count * sizeof(T)); |  | ||||||
| 			if (old != m_array) |  | ||||||
| 			{ |  | ||||||
| 				b2Free(old); |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		m_stack[m_count] = element; |  | ||||||
| 		++m_count; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	T Pop() |  | ||||||
| 	{ |  | ||||||
| 		b2Assert(m_count > 0); |  | ||||||
| 		--m_count; |  | ||||||
| 		return m_stack[m_count]; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	int32 GetCount() |  | ||||||
| 	{ |  | ||||||
| 		return m_count; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| private: |  | ||||||
| 	T* m_stack; |  | ||||||
| 	T m_array[N]; |  | ||||||
| 	int32 m_count; |  | ||||||
| 	int32 m_capacity; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| #endif |  | ||||||
|  | @ -1,94 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2007-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #include "Box2D/Common/b2Math.h" |  | ||||||
| 
 |  | ||||||
| const b2Vec2 b2Vec2_zero(0.0f, 0.0f); |  | ||||||
| 
 |  | ||||||
| /// Solve A * x = b, where b is a column vector. This is more efficient
 |  | ||||||
| /// than computing the inverse in one-shot cases.
 |  | ||||||
| b2Vec3 b2Mat33::Solve33(const b2Vec3& b) const |  | ||||||
| { |  | ||||||
| 	float32 det = b2Dot(ex, b2Cross(ey, ez)); |  | ||||||
| 	if (det != 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		det = 1.0f / det; |  | ||||||
| 	} |  | ||||||
| 	b2Vec3 x; |  | ||||||
| 	x.x = det * b2Dot(b, b2Cross(ey, ez)); |  | ||||||
| 	x.y = det * b2Dot(ex, b2Cross(b, ez)); |  | ||||||
| 	x.z = det * b2Dot(ex, b2Cross(ey, b)); |  | ||||||
| 	return x; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// Solve A * x = b, where b is a column vector. This is more efficient
 |  | ||||||
| /// than computing the inverse in one-shot cases.
 |  | ||||||
| b2Vec2 b2Mat33::Solve22(const b2Vec2& b) const |  | ||||||
| { |  | ||||||
| 	float32 a11 = ex.x, a12 = ey.x, a21 = ex.y, a22 = ey.y; |  | ||||||
| 	float32 det = a11 * a22 - a12 * a21; |  | ||||||
| 	if (det != 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		det = 1.0f / det; |  | ||||||
| 	} |  | ||||||
| 	b2Vec2 x; |  | ||||||
| 	x.x = det * (a22 * b.x - a12 * b.y); |  | ||||||
| 	x.y = det * (a11 * b.y - a21 * b.x); |  | ||||||
| 	return x; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| ///
 |  | ||||||
| void b2Mat33::GetInverse22(b2Mat33* M) const |  | ||||||
| { |  | ||||||
| 	float32 a = ex.x, b = ey.x, c = ex.y, d = ey.y; |  | ||||||
| 	float32 det = a * d - b * c; |  | ||||||
| 	if (det != 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		det = 1.0f / det; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	M->ex.x =  det * d;	M->ey.x = -det * b; M->ex.z = 0.0f; |  | ||||||
| 	M->ex.y = -det * c;	M->ey.y =  det * a; M->ey.z = 0.0f; |  | ||||||
| 	M->ez.x = 0.0f; M->ez.y = 0.0f; M->ez.z = 0.0f; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// Returns the zero matrix if singular.
 |  | ||||||
| void b2Mat33::GetSymInverse33(b2Mat33* M) const |  | ||||||
| { |  | ||||||
| 	float32 det = b2Dot(ex, b2Cross(ey, ez)); |  | ||||||
| 	if (det != 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		det = 1.0f / det; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	float32 a11 = ex.x, a12 = ey.x, a13 = ez.x; |  | ||||||
| 	float32 a22 = ey.y, a23 = ez.y; |  | ||||||
| 	float32 a33 = ez.z; |  | ||||||
| 
 |  | ||||||
| 	M->ex.x = det * (a22 * a33 - a23 * a23); |  | ||||||
| 	M->ex.y = det * (a13 * a23 - a12 * a33); |  | ||||||
| 	M->ex.z = det * (a12 * a23 - a13 * a22); |  | ||||||
| 
 |  | ||||||
| 	M->ey.x = M->ex.y; |  | ||||||
| 	M->ey.y = det * (a11 * a33 - a13 * a13); |  | ||||||
| 	M->ey.z = det * (a13 * a12 - a11 * a23); |  | ||||||
| 
 |  | ||||||
| 	M->ez.x = M->ex.z; |  | ||||||
| 	M->ez.y = M->ey.z; |  | ||||||
| 	M->ez.z = det * (a11 * a22 - a12 * a12); |  | ||||||
| } |  | ||||||
|  | @ -1,707 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #ifndef B2_MATH_H |  | ||||||
| #define B2_MATH_H |  | ||||||
| 
 |  | ||||||
| #include "b2Settings.h" |  | ||||||
| #include <cmath> |  | ||||||
| 
 |  | ||||||
| /// This function is used to ensure that a floating point number is not a NaN or infinity.
 |  | ||||||
| inline bool b2IsValid(float32 x) |  | ||||||
| { |  | ||||||
| 	return isfinite(x); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #define	b2Sqrt(x)	sqrtf(x) |  | ||||||
| #define	b2Atan2(y, x)	atan2f(y, x) |  | ||||||
| 
 |  | ||||||
| /// A 2D column vector.
 |  | ||||||
| struct b2Vec2 |  | ||||||
| { |  | ||||||
| 	/// Default constructor does nothing (for performance).
 |  | ||||||
| 	b2Vec2() {} |  | ||||||
| 
 |  | ||||||
| 	/// Construct using coordinates.
 |  | ||||||
| 	b2Vec2(float32 xIn, float32 yIn) : x(xIn), y(yIn) {} |  | ||||||
| 
 |  | ||||||
| 	/// Set this vector to all zeros.
 |  | ||||||
| 	void SetZero() { x = 0.0f; y = 0.0f; } |  | ||||||
| 
 |  | ||||||
| 	/// Set this vector to some specified coordinates.
 |  | ||||||
| 	void Set(float32 x_, float32 y_) { x = x_; y = y_; } |  | ||||||
| 
 |  | ||||||
| 	/// Negate this vector.
 |  | ||||||
| 	b2Vec2 operator -() const { b2Vec2 v; v.Set(-x, -y); return v; } |  | ||||||
| 	 |  | ||||||
| 	/// Read from and indexed element.
 |  | ||||||
| 	float32 operator () (int32 i) const |  | ||||||
| 	{ |  | ||||||
| 		return (&x)[i]; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Write to an indexed element.
 |  | ||||||
| 	float32& operator () (int32 i) |  | ||||||
| 	{ |  | ||||||
| 		return (&x)[i]; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Add a vector to this vector.
 |  | ||||||
| 	void operator += (const b2Vec2& v) |  | ||||||
| 	{ |  | ||||||
| 		x += v.x; y += v.y; |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	/// Subtract a vector from this vector.
 |  | ||||||
| 	void operator -= (const b2Vec2& v) |  | ||||||
| 	{ |  | ||||||
| 		x -= v.x; y -= v.y; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Multiply this vector by a scalar.
 |  | ||||||
| 	void operator *= (float32 a) |  | ||||||
| 	{ |  | ||||||
| 		x *= a; y *= a; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Get the length of this vector (the norm).
 |  | ||||||
| 	float32 Length() const |  | ||||||
| 	{ |  | ||||||
| 		return b2Sqrt(x * x + y * y); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Get the length squared. For performance, use this instead of
 |  | ||||||
| 	/// b2Vec2::Length (if possible).
 |  | ||||||
| 	float32 LengthSquared() const |  | ||||||
| 	{ |  | ||||||
| 		return x * x + y * y; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Convert this vector into a unit vector. Returns the length.
 |  | ||||||
| 	float32 Normalize() |  | ||||||
| 	{ |  | ||||||
| 		float32 length = Length(); |  | ||||||
| 		if (length < b2_epsilon) |  | ||||||
| 		{ |  | ||||||
| 			return 0.0f; |  | ||||||
| 		} |  | ||||||
| 		float32 invLength = 1.0f / length; |  | ||||||
| 		x *= invLength; |  | ||||||
| 		y *= invLength; |  | ||||||
| 
 |  | ||||||
| 		return length; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Does this vector contain finite coordinates?
 |  | ||||||
| 	bool IsValid() const |  | ||||||
| 	{ |  | ||||||
| 		return b2IsValid(x) && b2IsValid(y); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Get the skew vector such that dot(skew_vec, other) == cross(vec, other)
 |  | ||||||
| 	b2Vec2 Skew() const |  | ||||||
| 	{ |  | ||||||
| 		return b2Vec2(-y, x); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	float32 x, y; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// A 2D column vector with 3 elements.
 |  | ||||||
| struct b2Vec3 |  | ||||||
| { |  | ||||||
| 	/// Default constructor does nothing (for performance).
 |  | ||||||
| 	b2Vec3() {} |  | ||||||
| 
 |  | ||||||
| 	/// Construct using coordinates.
 |  | ||||||
| 	b2Vec3(float32 xIn, float32 yIn, float32 zIn) : x(xIn), y(yIn), z(zIn) {} |  | ||||||
| 
 |  | ||||||
| 	/// Set this vector to all zeros.
 |  | ||||||
| 	void SetZero() { x = 0.0f; y = 0.0f; z = 0.0f; } |  | ||||||
| 
 |  | ||||||
| 	/// Set this vector to some specified coordinates.
 |  | ||||||
| 	void Set(float32 x_, float32 y_, float32 z_) { x = x_; y = y_; z = z_; } |  | ||||||
| 
 |  | ||||||
| 	/// Negate this vector.
 |  | ||||||
| 	b2Vec3 operator -() const { b2Vec3 v; v.Set(-x, -y, -z); return v; } |  | ||||||
| 
 |  | ||||||
| 	/// Add a vector to this vector.
 |  | ||||||
| 	void operator += (const b2Vec3& v) |  | ||||||
| 	{ |  | ||||||
| 		x += v.x; y += v.y; z += v.z; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Subtract a vector from this vector.
 |  | ||||||
| 	void operator -= (const b2Vec3& v) |  | ||||||
| 	{ |  | ||||||
| 		x -= v.x; y -= v.y; z -= v.z; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Multiply this vector by a scalar.
 |  | ||||||
| 	void operator *= (float32 s) |  | ||||||
| 	{ |  | ||||||
| 		x *= s; y *= s; z *= s; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	float32 x, y, z; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// A 2-by-2 matrix. Stored in column-major order.
 |  | ||||||
| struct b2Mat22 |  | ||||||
| { |  | ||||||
| 	/// The default constructor does nothing (for performance).
 |  | ||||||
| 	b2Mat22() {} |  | ||||||
| 
 |  | ||||||
| 	/// Construct this matrix using columns.
 |  | ||||||
| 	b2Mat22(const b2Vec2& c1, const b2Vec2& c2) |  | ||||||
| 	{ |  | ||||||
| 		ex = c1; |  | ||||||
| 		ey = c2; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Construct this matrix using scalars.
 |  | ||||||
| 	b2Mat22(float32 a11, float32 a12, float32 a21, float32 a22) |  | ||||||
| 	{ |  | ||||||
| 		ex.x = a11; ex.y = a21; |  | ||||||
| 		ey.x = a12; ey.y = a22; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Initialize this matrix using columns.
 |  | ||||||
| 	void Set(const b2Vec2& c1, const b2Vec2& c2) |  | ||||||
| 	{ |  | ||||||
| 		ex = c1; |  | ||||||
| 		ey = c2; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Set this to the identity matrix.
 |  | ||||||
| 	void SetIdentity() |  | ||||||
| 	{ |  | ||||||
| 		ex.x = 1.0f; ey.x = 0.0f; |  | ||||||
| 		ex.y = 0.0f; ey.y = 1.0f; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Set this matrix to all zeros.
 |  | ||||||
| 	void SetZero() |  | ||||||
| 	{ |  | ||||||
| 		ex.x = 0.0f; ey.x = 0.0f; |  | ||||||
| 		ex.y = 0.0f; ey.y = 0.0f; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	b2Mat22 GetInverse() const |  | ||||||
| 	{ |  | ||||||
| 		float32 a = ex.x, b = ey.x, c = ex.y, d = ey.y; |  | ||||||
| 		b2Mat22 B; |  | ||||||
| 		float32 det = a * d - b * c; |  | ||||||
| 		if (det != 0.0f) |  | ||||||
| 		{ |  | ||||||
| 			det = 1.0f / det; |  | ||||||
| 		} |  | ||||||
| 		B.ex.x =  det * d;	B.ey.x = -det * b; |  | ||||||
| 		B.ex.y = -det * c;	B.ey.y =  det * a; |  | ||||||
| 		return B; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Solve A * x = b, where b is a column vector. This is more efficient
 |  | ||||||
| 	/// than computing the inverse in one-shot cases.
 |  | ||||||
| 	b2Vec2 Solve(const b2Vec2& b) const |  | ||||||
| 	{ |  | ||||||
| 		float32 a11 = ex.x, a12 = ey.x, a21 = ex.y, a22 = ey.y; |  | ||||||
| 		float32 det = a11 * a22 - a12 * a21; |  | ||||||
| 		if (det != 0.0f) |  | ||||||
| 		{ |  | ||||||
| 			det = 1.0f / det; |  | ||||||
| 		} |  | ||||||
| 		b2Vec2 x; |  | ||||||
| 		x.x = det * (a22 * b.x - a12 * b.y); |  | ||||||
| 		x.y = det * (a11 * b.y - a21 * b.x); |  | ||||||
| 		return x; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 ex, ey; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// A 3-by-3 matrix. Stored in column-major order.
 |  | ||||||
| struct b2Mat33 |  | ||||||
| { |  | ||||||
| 	/// The default constructor does nothing (for performance).
 |  | ||||||
| 	b2Mat33() {} |  | ||||||
| 
 |  | ||||||
| 	/// Construct this matrix using columns.
 |  | ||||||
| 	b2Mat33(const b2Vec3& c1, const b2Vec3& c2, const b2Vec3& c3) |  | ||||||
| 	{ |  | ||||||
| 		ex = c1; |  | ||||||
| 		ey = c2; |  | ||||||
| 		ez = c3; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Set this matrix to all zeros.
 |  | ||||||
| 	void SetZero() |  | ||||||
| 	{ |  | ||||||
| 		ex.SetZero(); |  | ||||||
| 		ey.SetZero(); |  | ||||||
| 		ez.SetZero(); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Solve A * x = b, where b is a column vector. This is more efficient
 |  | ||||||
| 	/// than computing the inverse in one-shot cases.
 |  | ||||||
| 	b2Vec3 Solve33(const b2Vec3& b) const; |  | ||||||
| 
 |  | ||||||
| 	/// Solve A * x = b, where b is a column vector. This is more efficient
 |  | ||||||
| 	/// than computing the inverse in one-shot cases. Solve only the upper
 |  | ||||||
| 	/// 2-by-2 matrix equation.
 |  | ||||||
| 	b2Vec2 Solve22(const b2Vec2& b) const; |  | ||||||
| 
 |  | ||||||
| 	/// Get the inverse of this matrix as a 2-by-2.
 |  | ||||||
| 	/// Returns the zero matrix if singular.
 |  | ||||||
| 	void GetInverse22(b2Mat33* M) const; |  | ||||||
| 
 |  | ||||||
| 	/// Get the symmetric inverse of this matrix as a 3-by-3.
 |  | ||||||
| 	/// Returns the zero matrix if singular.
 |  | ||||||
| 	void GetSymInverse33(b2Mat33* M) const; |  | ||||||
| 
 |  | ||||||
| 	b2Vec3 ex, ey, ez; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// Rotation
 |  | ||||||
| struct b2Rot |  | ||||||
| { |  | ||||||
| 	b2Rot() {} |  | ||||||
| 
 |  | ||||||
| 	/// Initialize from an angle in radians
 |  | ||||||
| 	explicit b2Rot(float32 angle) |  | ||||||
| 	{ |  | ||||||
| 		/// TODO_ERIN optimize
 |  | ||||||
| 		s = sinf(angle); |  | ||||||
| 		c = cosf(angle); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Set using an angle in radians.
 |  | ||||||
| 	void Set(float32 angle) |  | ||||||
| 	{ |  | ||||||
| 		/// TODO_ERIN optimize
 |  | ||||||
| 		s = sinf(angle); |  | ||||||
| 		c = cosf(angle); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Set to the identity rotation
 |  | ||||||
| 	void SetIdentity() |  | ||||||
| 	{ |  | ||||||
| 		s = 0.0f; |  | ||||||
| 		c = 1.0f; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Get the angle in radians
 |  | ||||||
| 	float32 GetAngle() const |  | ||||||
| 	{ |  | ||||||
| 		return b2Atan2(s, c); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Get the x-axis
 |  | ||||||
| 	b2Vec2 GetXAxis() const |  | ||||||
| 	{ |  | ||||||
| 		return b2Vec2(c, s); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Get the u-axis
 |  | ||||||
| 	b2Vec2 GetYAxis() const |  | ||||||
| 	{ |  | ||||||
| 		return b2Vec2(-s, c); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Sine and cosine
 |  | ||||||
| 	float32 s, c; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// A transform contains translation and rotation. It is used to represent
 |  | ||||||
| /// the position and orientation of rigid frames.
 |  | ||||||
| struct b2Transform |  | ||||||
| { |  | ||||||
| 	/// The default constructor does nothing.
 |  | ||||||
| 	b2Transform() {} |  | ||||||
| 
 |  | ||||||
| 	/// Initialize using a position vector and a rotation.
 |  | ||||||
| 	b2Transform(const b2Vec2& position, const b2Rot& rotation) : p(position), q(rotation) {} |  | ||||||
| 
 |  | ||||||
| 	/// Set this to the identity transform.
 |  | ||||||
| 	void SetIdentity() |  | ||||||
| 	{ |  | ||||||
| 		p.SetZero(); |  | ||||||
| 		q.SetIdentity(); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/// Set this based on the position and angle.
 |  | ||||||
| 	void Set(const b2Vec2& position, float32 angle) |  | ||||||
| 	{ |  | ||||||
| 		p = position; |  | ||||||
| 		q.Set(angle); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 p; |  | ||||||
| 	b2Rot q; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// This describes the motion of a body/shape for TOI computation.
 |  | ||||||
| /// Shapes are defined with respect to the body origin, which may
 |  | ||||||
| /// no coincide with the center of mass. However, to support dynamics
 |  | ||||||
| /// we must interpolate the center of mass position.
 |  | ||||||
| struct b2Sweep |  | ||||||
| { |  | ||||||
| 	/// Get the interpolated transform at a specific time.
 |  | ||||||
| 	/// @param beta is a factor in [0,1], where 0 indicates alpha0.
 |  | ||||||
| 	void GetTransform(b2Transform* xfb, float32 beta) const; |  | ||||||
| 
 |  | ||||||
| 	/// Advance the sweep forward, yielding a new initial state.
 |  | ||||||
| 	/// @param alpha the new initial time.
 |  | ||||||
| 	void Advance(float32 alpha); |  | ||||||
| 
 |  | ||||||
| 	/// Normalize the angles.
 |  | ||||||
| 	void Normalize(); |  | ||||||
| 
 |  | ||||||
| 	b2Vec2 localCenter;	///< local center of mass position
 |  | ||||||
| 	b2Vec2 c0, c;		///< center world positions
 |  | ||||||
| 	float32 a0, a;		///< world angles
 |  | ||||||
| 
 |  | ||||||
| 	/// Fraction of the current time step in the range [0,1]
 |  | ||||||
| 	/// c0 and a0 are the positions at alpha0.
 |  | ||||||
| 	float32 alpha0; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// Useful constant
 |  | ||||||
| extern const b2Vec2 b2Vec2_zero; |  | ||||||
| 
 |  | ||||||
| /// Perform the dot product on two vectors.
 |  | ||||||
| inline float32 b2Dot(const b2Vec2& a, const b2Vec2& b) |  | ||||||
| { |  | ||||||
| 	return a.x * b.x + a.y * b.y; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// Perform the cross product on two vectors. In 2D this produces a scalar.
 |  | ||||||
| inline float32 b2Cross(const b2Vec2& a, const b2Vec2& b) |  | ||||||
| { |  | ||||||
| 	return a.x * b.y - a.y * b.x; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// Perform the cross product on a vector and a scalar. In 2D this produces
 |  | ||||||
| /// a vector.
 |  | ||||||
| inline b2Vec2 b2Cross(const b2Vec2& a, float32 s) |  | ||||||
| { |  | ||||||
| 	return b2Vec2(s * a.y, -s * a.x); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// Perform the cross product on a scalar and a vector. In 2D this produces
 |  | ||||||
| /// a vector.
 |  | ||||||
| inline b2Vec2 b2Cross(float32 s, const b2Vec2& a) |  | ||||||
| { |  | ||||||
| 	return b2Vec2(-s * a.y, s * a.x); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// Multiply a matrix times a vector. If a rotation matrix is provided,
 |  | ||||||
| /// then this transforms the vector from one frame to another.
 |  | ||||||
| inline b2Vec2 b2Mul(const b2Mat22& A, const b2Vec2& v) |  | ||||||
| { |  | ||||||
| 	return b2Vec2(A.ex.x * v.x + A.ey.x * v.y, A.ex.y * v.x + A.ey.y * v.y); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// Multiply a matrix transpose times a vector. If a rotation matrix is provided,
 |  | ||||||
| /// then this transforms the vector from one frame to another (inverse transform).
 |  | ||||||
| inline b2Vec2 b2MulT(const b2Mat22& A, const b2Vec2& v) |  | ||||||
| { |  | ||||||
| 	return b2Vec2(b2Dot(v, A.ex), b2Dot(v, A.ey)); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// Add two vectors component-wise.
 |  | ||||||
| inline b2Vec2 operator + (const b2Vec2& a, const b2Vec2& b) |  | ||||||
| { |  | ||||||
| 	return b2Vec2(a.x + b.x, a.y + b.y); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// Subtract two vectors component-wise.
 |  | ||||||
| inline b2Vec2 operator - (const b2Vec2& a, const b2Vec2& b) |  | ||||||
| { |  | ||||||
| 	return b2Vec2(a.x - b.x, a.y - b.y); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline b2Vec2 operator * (float32 s, const b2Vec2& a) |  | ||||||
| { |  | ||||||
| 	return b2Vec2(s * a.x, s * a.y); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline bool operator == (const b2Vec2& a, const b2Vec2& b) |  | ||||||
| { |  | ||||||
| 	return a.x == b.x && a.y == b.y; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline bool operator != (const b2Vec2& a, const b2Vec2& b) |  | ||||||
| { |  | ||||||
| 	return a.x != b.x || a.y != b.y; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline float32 b2Distance(const b2Vec2& a, const b2Vec2& b) |  | ||||||
| { |  | ||||||
| 	b2Vec2 c = a - b; |  | ||||||
| 	return c.Length(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline float32 b2DistanceSquared(const b2Vec2& a, const b2Vec2& b) |  | ||||||
| { |  | ||||||
| 	b2Vec2 c = a - b; |  | ||||||
| 	return b2Dot(c, c); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline b2Vec3 operator * (float32 s, const b2Vec3& a) |  | ||||||
| { |  | ||||||
| 	return b2Vec3(s * a.x, s * a.y, s * a.z); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// Add two vectors component-wise.
 |  | ||||||
| inline b2Vec3 operator + (const b2Vec3& a, const b2Vec3& b) |  | ||||||
| { |  | ||||||
| 	return b2Vec3(a.x + b.x, a.y + b.y, a.z + b.z); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// Subtract two vectors component-wise.
 |  | ||||||
| inline b2Vec3 operator - (const b2Vec3& a, const b2Vec3& b) |  | ||||||
| { |  | ||||||
| 	return b2Vec3(a.x - b.x, a.y - b.y, a.z - b.z); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// Perform the dot product on two vectors.
 |  | ||||||
| inline float32 b2Dot(const b2Vec3& a, const b2Vec3& b) |  | ||||||
| { |  | ||||||
| 	return a.x * b.x + a.y * b.y + a.z * b.z; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// Perform the cross product on two vectors.
 |  | ||||||
| inline b2Vec3 b2Cross(const b2Vec3& a, const b2Vec3& b) |  | ||||||
| { |  | ||||||
| 	return b2Vec3(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline b2Mat22 operator + (const b2Mat22& A, const b2Mat22& B) |  | ||||||
| { |  | ||||||
| 	return b2Mat22(A.ex + B.ex, A.ey + B.ey); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // A * B
 |  | ||||||
| inline b2Mat22 b2Mul(const b2Mat22& A, const b2Mat22& B) |  | ||||||
| { |  | ||||||
| 	return b2Mat22(b2Mul(A, B.ex), b2Mul(A, B.ey)); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // A^T * B
 |  | ||||||
| inline b2Mat22 b2MulT(const b2Mat22& A, const b2Mat22& B) |  | ||||||
| { |  | ||||||
| 	b2Vec2 c1(b2Dot(A.ex, B.ex), b2Dot(A.ey, B.ex)); |  | ||||||
| 	b2Vec2 c2(b2Dot(A.ex, B.ey), b2Dot(A.ey, B.ey)); |  | ||||||
| 	return b2Mat22(c1, c2); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// Multiply a matrix times a vector.
 |  | ||||||
| inline b2Vec3 b2Mul(const b2Mat33& A, const b2Vec3& v) |  | ||||||
| { |  | ||||||
| 	return v.x * A.ex + v.y * A.ey + v.z * A.ez; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// Multiply a matrix times a vector.
 |  | ||||||
| inline b2Vec2 b2Mul22(const b2Mat33& A, const b2Vec2& v) |  | ||||||
| { |  | ||||||
| 	return b2Vec2(A.ex.x * v.x + A.ey.x * v.y, A.ex.y * v.x + A.ey.y * v.y); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// Multiply two rotations: q * r
 |  | ||||||
| inline b2Rot b2Mul(const b2Rot& q, const b2Rot& r) |  | ||||||
| { |  | ||||||
| 	// [qc -qs] * [rc -rs] = [qc*rc-qs*rs -qc*rs-qs*rc]
 |  | ||||||
| 	// [qs  qc]   [rs  rc]   [qs*rc+qc*rs -qs*rs+qc*rc]
 |  | ||||||
| 	// s = qs * rc + qc * rs
 |  | ||||||
| 	// c = qc * rc - qs * rs
 |  | ||||||
| 	b2Rot qr; |  | ||||||
| 	qr.s = q.s * r.c + q.c * r.s; |  | ||||||
| 	qr.c = q.c * r.c - q.s * r.s; |  | ||||||
| 	return qr; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// Transpose multiply two rotations: qT * r
 |  | ||||||
| inline b2Rot b2MulT(const b2Rot& q, const b2Rot& r) |  | ||||||
| { |  | ||||||
| 	// [ qc qs] * [rc -rs] = [qc*rc+qs*rs -qc*rs+qs*rc]
 |  | ||||||
| 	// [-qs qc]   [rs  rc]   [-qs*rc+qc*rs qs*rs+qc*rc]
 |  | ||||||
| 	// s = qc * rs - qs * rc
 |  | ||||||
| 	// c = qc * rc + qs * rs
 |  | ||||||
| 	b2Rot qr; |  | ||||||
| 	qr.s = q.c * r.s - q.s * r.c; |  | ||||||
| 	qr.c = q.c * r.c + q.s * r.s; |  | ||||||
| 	return qr; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// Rotate a vector
 |  | ||||||
| inline b2Vec2 b2Mul(const b2Rot& q, const b2Vec2& v) |  | ||||||
| { |  | ||||||
| 	return b2Vec2(q.c * v.x - q.s * v.y, q.s * v.x + q.c * v.y); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// Inverse rotate a vector
 |  | ||||||
| inline b2Vec2 b2MulT(const b2Rot& q, const b2Vec2& v) |  | ||||||
| { |  | ||||||
| 	return b2Vec2(q.c * v.x + q.s * v.y, -q.s * v.x + q.c * v.y); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline b2Vec2 b2Mul(const b2Transform& T, const b2Vec2& v) |  | ||||||
| { |  | ||||||
| 	float32 x = (T.q.c * v.x - T.q.s * v.y) + T.p.x; |  | ||||||
| 	float32 y = (T.q.s * v.x + T.q.c * v.y) + T.p.y; |  | ||||||
| 
 |  | ||||||
| 	return b2Vec2(x, y); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline b2Vec2 b2MulT(const b2Transform& T, const b2Vec2& v) |  | ||||||
| { |  | ||||||
| 	float32 px = v.x - T.p.x; |  | ||||||
| 	float32 py = v.y - T.p.y; |  | ||||||
| 	float32 x = (T.q.c * px + T.q.s * py); |  | ||||||
| 	float32 y = (-T.q.s * px + T.q.c * py); |  | ||||||
| 
 |  | ||||||
| 	return b2Vec2(x, y); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // v2 = A.q.Rot(B.q.Rot(v1) + B.p) + A.p
 |  | ||||||
| //    = (A.q * B.q).Rot(v1) + A.q.Rot(B.p) + A.p
 |  | ||||||
| inline b2Transform b2Mul(const b2Transform& A, const b2Transform& B) |  | ||||||
| { |  | ||||||
| 	b2Transform C; |  | ||||||
| 	C.q = b2Mul(A.q, B.q); |  | ||||||
| 	C.p = b2Mul(A.q, B.p) + A.p; |  | ||||||
| 	return C; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // v2 = A.q' * (B.q * v1 + B.p - A.p)
 |  | ||||||
| //    = A.q' * B.q * v1 + A.q' * (B.p - A.p)
 |  | ||||||
| inline b2Transform b2MulT(const b2Transform& A, const b2Transform& B) |  | ||||||
| { |  | ||||||
| 	b2Transform C; |  | ||||||
| 	C.q = b2MulT(A.q, B.q); |  | ||||||
| 	C.p = b2MulT(A.q, B.p - A.p); |  | ||||||
| 	return C; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| template <typename T> |  | ||||||
| inline T b2Abs(T a) |  | ||||||
| { |  | ||||||
| 	return a > T(0) ? a : -a; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline b2Vec2 b2Abs(const b2Vec2& a) |  | ||||||
| { |  | ||||||
| 	return b2Vec2(b2Abs(a.x), b2Abs(a.y)); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline b2Mat22 b2Abs(const b2Mat22& A) |  | ||||||
| { |  | ||||||
| 	return b2Mat22(b2Abs(A.ex), b2Abs(A.ey)); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| template <typename T> |  | ||||||
| inline T b2Min(T a, T b) |  | ||||||
| { |  | ||||||
| 	return a < b ? a : b; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline b2Vec2 b2Min(const b2Vec2& a, const b2Vec2& b) |  | ||||||
| { |  | ||||||
| 	return b2Vec2(b2Min(a.x, b.x), b2Min(a.y, b.y)); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| template <typename T> |  | ||||||
| inline T b2Max(T a, T b) |  | ||||||
| { |  | ||||||
| 	return a > b ? a : b; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline b2Vec2 b2Max(const b2Vec2& a, const b2Vec2& b) |  | ||||||
| { |  | ||||||
| 	return b2Vec2(b2Max(a.x, b.x), b2Max(a.y, b.y)); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| template <typename T> |  | ||||||
| inline T b2Clamp(T a, T low, T high) |  | ||||||
| { |  | ||||||
| 	return b2Max(low, b2Min(a, high)); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline b2Vec2 b2Clamp(const b2Vec2& a, const b2Vec2& low, const b2Vec2& high) |  | ||||||
| { |  | ||||||
| 	return b2Max(low, b2Min(a, high)); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| template<typename T> inline void b2Swap(T& a, T& b) |  | ||||||
| { |  | ||||||
| 	T tmp = a; |  | ||||||
| 	a = b; |  | ||||||
| 	b = tmp; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// "Next Largest Power of 2
 |  | ||||||
| /// Given a binary integer value x, the next largest power of 2 can be computed by a SWAR algorithm
 |  | ||||||
| /// that recursively "folds" the upper bits into the lower bits. This process yields a bit vector with
 |  | ||||||
| /// the same most significant 1 as x, but all 1's below it. Adding 1 to that value yields the next
 |  | ||||||
| /// largest power of 2. For a 32-bit value:"
 |  | ||||||
| inline uint32 b2NextPowerOfTwo(uint32 x) |  | ||||||
| { |  | ||||||
| 	x |= (x >> 1); |  | ||||||
| 	x |= (x >> 2); |  | ||||||
| 	x |= (x >> 4); |  | ||||||
| 	x |= (x >> 8); |  | ||||||
| 	x |= (x >> 16); |  | ||||||
| 	return x + 1; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline bool b2IsPowerOfTwo(uint32 x) |  | ||||||
| { |  | ||||||
| 	bool result = x > 0 && (x & (x - 1)) == 0; |  | ||||||
| 	return result; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline void b2Sweep::GetTransform(b2Transform* xf, float32 beta) const |  | ||||||
| { |  | ||||||
| 	xf->p = (1.0f - beta) * c0 + beta * c; |  | ||||||
| 	float32 angle = (1.0f - beta) * a0 + beta * a; |  | ||||||
| 	xf->q.Set(angle); |  | ||||||
| 
 |  | ||||||
| 	// Shift to origin
 |  | ||||||
| 	xf->p -= b2Mul(xf->q, localCenter); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline void b2Sweep::Advance(float32 alpha) |  | ||||||
| { |  | ||||||
| 	b2Assert(alpha0 < 1.0f); |  | ||||||
| 	float32 beta = (alpha - alpha0) / (1.0f - alpha0); |  | ||||||
| 	c0 += beta * (c - c0); |  | ||||||
| 	a0 += beta * (a - a0); |  | ||||||
| 	alpha0 = alpha; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// Normalize an angle in radians to be between -pi and pi
 |  | ||||||
| inline void b2Sweep::Normalize() |  | ||||||
| { |  | ||||||
| 	float32 twoPi = 2.0f * b2_pi; |  | ||||||
| 	float32 d =  twoPi * floorf(a0 / twoPi); |  | ||||||
| 	a0 -= d; |  | ||||||
| 	a -= d; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #endif |  | ||||||
|  | @ -1,44 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #include "Box2D/Common/b2Settings.h" |  | ||||||
| #include <stdio.h> |  | ||||||
| #include <stdarg.h> |  | ||||||
| #include <stdlib.h> |  | ||||||
| 
 |  | ||||||
| b2Version b2_version = {2, 3, 2}; |  | ||||||
| 
 |  | ||||||
| // Memory allocators. Modify these to use your own allocator.
 |  | ||||||
| void* b2Alloc(int32 size) |  | ||||||
| { |  | ||||||
| 	return malloc(size); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2Free(void* mem) |  | ||||||
| { |  | ||||||
| 	free(mem); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // You can modify this to use your logging facility.
 |  | ||||||
| void b2Log(const char* string, ...) |  | ||||||
| { |  | ||||||
| 	va_list args; |  | ||||||
| 	va_start(args, string); |  | ||||||
| 	vprintf(string, args); |  | ||||||
| 	va_end(args); |  | ||||||
| } |  | ||||||
|  | @ -1,155 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #ifndef B2_SETTINGS_H |  | ||||||
| #define B2_SETTINGS_H |  | ||||||
| 
 |  | ||||||
| #include <stddef.h> |  | ||||||
| #include <assert.h> |  | ||||||
| #include <float.h> |  | ||||||
| 
 |  | ||||||
| #if !defined(NDEBUG) |  | ||||||
| 	#define b2DEBUG |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| #define B2_NOT_USED(x) ((void)(x)) |  | ||||||
| #define b2Assert(A) assert(A) |  | ||||||
| 
 |  | ||||||
| typedef signed char	int8; |  | ||||||
| typedef signed short int16; |  | ||||||
| typedef signed int int32; |  | ||||||
| typedef unsigned char uint8; |  | ||||||
| typedef unsigned short uint16; |  | ||||||
| typedef unsigned int uint32; |  | ||||||
| typedef float float32; |  | ||||||
| typedef double float64; |  | ||||||
| 
 |  | ||||||
| #define	b2_maxFloat		FLT_MAX |  | ||||||
| #define	b2_epsilon		FLT_EPSILON |  | ||||||
| #define b2_pi			3.14159265359f |  | ||||||
| 
 |  | ||||||
| /// @file
 |  | ||||||
| /// Global tuning constants based on meters-kilograms-seconds (MKS) units.
 |  | ||||||
| ///
 |  | ||||||
| 
 |  | ||||||
| // Collision
 |  | ||||||
| 
 |  | ||||||
| /// The maximum number of contact points between two convex shapes. Do
 |  | ||||||
| /// not change this value.
 |  | ||||||
| #define b2_maxManifoldPoints	2 |  | ||||||
| 
 |  | ||||||
| /// The maximum number of vertices on a convex polygon. You cannot increase
 |  | ||||||
| /// this too much because b2BlockAllocator has a maximum object size.
 |  | ||||||
| #define b2_maxPolygonVertices	8 |  | ||||||
| 
 |  | ||||||
| /// This is used to fatten AABBs in the dynamic tree. This allows proxies
 |  | ||||||
| /// to move by a small amount without triggering a tree adjustment.
 |  | ||||||
| /// This is in meters.
 |  | ||||||
| #define b2_aabbExtension		0.1f |  | ||||||
| 
 |  | ||||||
| /// This is used to fatten AABBs in the dynamic tree. This is used to predict
 |  | ||||||
| /// the future position based on the current displacement.
 |  | ||||||
| /// This is a dimensionless multiplier.
 |  | ||||||
| #define b2_aabbMultiplier		2.0f |  | ||||||
| 
 |  | ||||||
| /// A small length used as a collision and constraint tolerance. Usually it is
 |  | ||||||
| /// chosen to be numerically significant, but visually insignificant.
 |  | ||||||
| #define b2_linearSlop			0.005f |  | ||||||
| 
 |  | ||||||
| /// A small angle used as a collision and constraint tolerance. Usually it is
 |  | ||||||
| /// chosen to be numerically significant, but visually insignificant.
 |  | ||||||
| #define b2_angularSlop			(2.0f / 180.0f * b2_pi) |  | ||||||
| 
 |  | ||||||
| /// The radius of the polygon/edge shape skin. This should not be modified. Making
 |  | ||||||
| /// this smaller means polygons will have an insufficient buffer for continuous collision.
 |  | ||||||
| /// Making it larger may create artifacts for vertex collision.
 |  | ||||||
| #define b2_polygonRadius		(2.0f * b2_linearSlop) |  | ||||||
| 
 |  | ||||||
| /// Maximum number of sub-steps per contact in continuous physics simulation.
 |  | ||||||
| #define b2_maxSubSteps			8 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| // Dynamics
 |  | ||||||
| 
 |  | ||||||
| /// Maximum number of contacts to be handled to solve a TOI impact.
 |  | ||||||
| #define b2_maxTOIContacts			32 |  | ||||||
| 
 |  | ||||||
| /// A velocity threshold for elastic collisions. Any collision with a relative linear
 |  | ||||||
| /// velocity below this threshold will be treated as inelastic.
 |  | ||||||
| #define b2_velocityThreshold		1.0f |  | ||||||
| 
 |  | ||||||
| /// The maximum linear position correction used when solving constraints. This helps to
 |  | ||||||
| /// prevent overshoot.
 |  | ||||||
| #define b2_maxLinearCorrection		0.2f |  | ||||||
| 
 |  | ||||||
| /// The maximum angular position correction used when solving constraints. This helps to
 |  | ||||||
| /// prevent overshoot.
 |  | ||||||
| #define b2_maxAngularCorrection		(8.0f / 180.0f * b2_pi) |  | ||||||
| 
 |  | ||||||
| /// The maximum linear velocity of a body. This limit is very large and is used
 |  | ||||||
| /// to prevent numerical problems. You shouldn't need to adjust this.
 |  | ||||||
| #define b2_maxTranslation			2.0f |  | ||||||
| #define b2_maxTranslationSquared	(b2_maxTranslation * b2_maxTranslation) |  | ||||||
| 
 |  | ||||||
| /// The maximum angular velocity of a body. This limit is very large and is used
 |  | ||||||
| /// to prevent numerical problems. You shouldn't need to adjust this.
 |  | ||||||
| #define b2_maxRotation				(0.5f * b2_pi) |  | ||||||
| #define b2_maxRotationSquared		(b2_maxRotation * b2_maxRotation) |  | ||||||
| 
 |  | ||||||
| /// This scale factor controls how fast overlap is resolved. Ideally this would be 1 so
 |  | ||||||
| /// that overlap is removed in one time step. However using values close to 1 often lead
 |  | ||||||
| /// to overshoot.
 |  | ||||||
| #define b2_baumgarte				0.2f |  | ||||||
| #define b2_toiBaugarte				0.75f |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| // Sleep
 |  | ||||||
| 
 |  | ||||||
| /// The time that a body must be still before it will go to sleep.
 |  | ||||||
| #define b2_timeToSleep				0.5f |  | ||||||
| 
 |  | ||||||
| /// A body cannot sleep if its linear velocity is above this tolerance.
 |  | ||||||
| #define b2_linearSleepTolerance		0.01f |  | ||||||
| 
 |  | ||||||
| /// A body cannot sleep if its angular velocity is above this tolerance.
 |  | ||||||
| #define b2_angularSleepTolerance	(2.0f / 180.0f * b2_pi) |  | ||||||
| 
 |  | ||||||
| // Memory Allocation
 |  | ||||||
| 
 |  | ||||||
| /// Implement this function to use your own memory allocator.
 |  | ||||||
| void* b2Alloc(int32 size); |  | ||||||
| 
 |  | ||||||
| /// If you implement b2Alloc, you should also implement this function.
 |  | ||||||
| void b2Free(void* mem); |  | ||||||
| 
 |  | ||||||
| /// Logging function.
 |  | ||||||
| void b2Log(const char* string, ...); |  | ||||||
| 
 |  | ||||||
| /// Version numbering scheme.
 |  | ||||||
| /// See http://en.wikipedia.org/wiki/Software_versioning
 |  | ||||||
| struct b2Version |  | ||||||
| { |  | ||||||
| 	int32 major;		///< significant changes
 |  | ||||||
| 	int32 minor;		///< incremental changes
 |  | ||||||
| 	int32 revision;		///< bug fixes
 |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /// Current version.
 |  | ||||||
| extern b2Version b2_version; |  | ||||||
| 
 |  | ||||||
| #endif |  | ||||||
|  | @ -1,83 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #include "Box2D/Common/b2StackAllocator.h" |  | ||||||
| #include "Box2D/Common/b2Math.h" |  | ||||||
| 
 |  | ||||||
| b2StackAllocator::b2StackAllocator() |  | ||||||
| { |  | ||||||
| 	m_index = 0; |  | ||||||
| 	m_allocation = 0; |  | ||||||
| 	m_maxAllocation = 0; |  | ||||||
| 	m_entryCount = 0; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| b2StackAllocator::~b2StackAllocator() |  | ||||||
| { |  | ||||||
| 	b2Assert(m_index == 0); |  | ||||||
| 	b2Assert(m_entryCount == 0); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void* b2StackAllocator::Allocate(int32 size) |  | ||||||
| { |  | ||||||
| 	b2Assert(m_entryCount < b2_maxStackEntries); |  | ||||||
| 
 |  | ||||||
| 	b2StackEntry* entry = m_entries + m_entryCount; |  | ||||||
| 	entry->size = size; |  | ||||||
| 	if (m_index + size > b2_stackSize) |  | ||||||
| 	{ |  | ||||||
| 		entry->data = (char*)b2Alloc(size); |  | ||||||
| 		entry->usedMalloc = true; |  | ||||||
| 	} |  | ||||||
| 	else |  | ||||||
| 	{ |  | ||||||
| 		entry->data = m_data + m_index; |  | ||||||
| 		entry->usedMalloc = false; |  | ||||||
| 		m_index += size; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	m_allocation += size; |  | ||||||
| 	m_maxAllocation = b2Max(m_maxAllocation, m_allocation); |  | ||||||
| 	++m_entryCount; |  | ||||||
| 
 |  | ||||||
| 	return entry->data; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2StackAllocator::Free(void* p) |  | ||||||
| { |  | ||||||
| 	b2Assert(m_entryCount > 0); |  | ||||||
| 	b2StackEntry* entry = m_entries + m_entryCount - 1; |  | ||||||
| 	b2Assert(p == entry->data); |  | ||||||
| 	if (entry->usedMalloc) |  | ||||||
| 	{ |  | ||||||
| 		b2Free(p); |  | ||||||
| 	} |  | ||||||
| 	else |  | ||||||
| 	{ |  | ||||||
| 		m_index -= entry->size; |  | ||||||
| 	} |  | ||||||
| 	m_allocation -= entry->size; |  | ||||||
| 	--m_entryCount; |  | ||||||
| 
 |  | ||||||
| 	p = nullptr; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| int32 b2StackAllocator::GetMaxAllocation() const |  | ||||||
| { |  | ||||||
| 	return m_maxAllocation; |  | ||||||
| } |  | ||||||
|  | @ -1,60 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #ifndef B2_STACK_ALLOCATOR_H |  | ||||||
| #define B2_STACK_ALLOCATOR_H |  | ||||||
| 
 |  | ||||||
| #include "b2Settings.h" |  | ||||||
| 
 |  | ||||||
| const int32 b2_stackSize = 100 * 1024;	// 100k
 |  | ||||||
| const int32 b2_maxStackEntries = 32; |  | ||||||
| 
 |  | ||||||
| struct b2StackEntry |  | ||||||
| { |  | ||||||
| 	char* data; |  | ||||||
| 	int32 size; |  | ||||||
| 	bool usedMalloc; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| // This is a stack allocator used for fast per step allocations.
 |  | ||||||
| // You must nest allocate/free pairs. The code will assert
 |  | ||||||
| // if you try to interleave multiple allocate/free pairs.
 |  | ||||||
| class b2StackAllocator |  | ||||||
| { |  | ||||||
| public: |  | ||||||
| 	b2StackAllocator(); |  | ||||||
| 	~b2StackAllocator(); |  | ||||||
| 
 |  | ||||||
| 	void* Allocate(int32 size); |  | ||||||
| 	void Free(void* p); |  | ||||||
| 
 |  | ||||||
| 	int32 GetMaxAllocation() const; |  | ||||||
| 
 |  | ||||||
| private: |  | ||||||
| 
 |  | ||||||
| 	char m_data[b2_stackSize]; |  | ||||||
| 	int32 m_index; |  | ||||||
| 
 |  | ||||||
| 	int32 m_allocation; |  | ||||||
| 	int32 m_maxAllocation; |  | ||||||
| 
 |  | ||||||
| 	b2StackEntry m_entries[b2_maxStackEntries]; |  | ||||||
| 	int32 m_entryCount; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| #endif |  | ||||||
|  | @ -1,121 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2011 Erin Catto http://box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #include "Box2D/Common/b2Timer.h" |  | ||||||
| 
 |  | ||||||
| #if defined(_WIN32) |  | ||||||
| 
 |  | ||||||
| float64 b2Timer::s_invFrequency = 0.0f; |  | ||||||
| 
 |  | ||||||
| #ifndef WIN32_LEAN_AND_MEAN |  | ||||||
| #define WIN32_LEAN_AND_MEAN |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| #include <windows.h> |  | ||||||
| 
 |  | ||||||
| b2Timer::b2Timer() |  | ||||||
| { |  | ||||||
| 	LARGE_INTEGER largeInteger; |  | ||||||
| 
 |  | ||||||
| 	if (s_invFrequency == 0.0f) |  | ||||||
| 	{ |  | ||||||
| 		QueryPerformanceFrequency(&largeInteger); |  | ||||||
| 		s_invFrequency = float64(largeInteger.QuadPart); |  | ||||||
| 		if (s_invFrequency > 0.0f) |  | ||||||
| 		{ |  | ||||||
| 			s_invFrequency = 1000.0f / s_invFrequency; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	QueryPerformanceCounter(&largeInteger); |  | ||||||
| 	m_start = float64(largeInteger.QuadPart); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2Timer::Reset() |  | ||||||
| { |  | ||||||
| 	LARGE_INTEGER largeInteger; |  | ||||||
| 	QueryPerformanceCounter(&largeInteger); |  | ||||||
| 	m_start = float64(largeInteger.QuadPart); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| float32 b2Timer::GetMilliseconds() const |  | ||||||
| { |  | ||||||
| 	LARGE_INTEGER largeInteger; |  | ||||||
| 	QueryPerformanceCounter(&largeInteger); |  | ||||||
| 	float64 count = float64(largeInteger.QuadPart); |  | ||||||
| 	float32 ms = float32(s_invFrequency * (count - m_start)); |  | ||||||
| 	return ms; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #elif defined(__linux__) || defined (__APPLE__) |  | ||||||
| 
 |  | ||||||
| #include <sys/time.h> |  | ||||||
| 
 |  | ||||||
| b2Timer::b2Timer() |  | ||||||
| { |  | ||||||
|     Reset(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2Timer::Reset() |  | ||||||
| { |  | ||||||
|     timeval t; |  | ||||||
|     gettimeofday(&t, 0); |  | ||||||
|     m_start_sec = t.tv_sec; |  | ||||||
|     m_start_usec = t.tv_usec; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| float32 b2Timer::GetMilliseconds() const |  | ||||||
| { |  | ||||||
|     timeval t; |  | ||||||
|     gettimeofday(&t, 0); |  | ||||||
| 	time_t start_sec = m_start_sec; |  | ||||||
| 	suseconds_t start_usec = m_start_usec; |  | ||||||
| 	 |  | ||||||
| 	// http://www.gnu.org/software/libc/manual/html_node/Elapsed-Time.html
 |  | ||||||
| 	if (t.tv_usec < start_usec) |  | ||||||
| 	{ |  | ||||||
| 		int nsec = (start_usec - t.tv_usec) / 1000000 + 1; |  | ||||||
| 		start_usec -= 1000000 * nsec; |  | ||||||
| 		start_sec += nsec; |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	if (t.tv_usec - start_usec > 1000000) |  | ||||||
| 	{ |  | ||||||
| 		int nsec = (t.tv_usec - start_usec) / 1000000; |  | ||||||
| 		start_usec += 1000000 * nsec; |  | ||||||
| 		start_sec -= nsec; |  | ||||||
| 	} |  | ||||||
| 	return 1000.0f * (t.tv_sec - start_sec) + 0.001f * (t.tv_usec - start_usec); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #else |  | ||||||
| 
 |  | ||||||
| b2Timer::b2Timer() |  | ||||||
| { |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2Timer::Reset() |  | ||||||
| { |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| float32 b2Timer::GetMilliseconds() const |  | ||||||
| { |  | ||||||
| 	return 0.0f; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #endif |  | ||||||
|  | @ -1,50 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2011 Erin Catto http://box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #ifndef B2_TIMER_H |  | ||||||
| #define B2_TIMER_H |  | ||||||
| 
 |  | ||||||
| #include "b2Settings.h" |  | ||||||
| 
 |  | ||||||
| /// Timer for profiling. This has platform specific code and may
 |  | ||||||
| /// not work on every platform.
 |  | ||||||
| class b2Timer |  | ||||||
| { |  | ||||||
| public: |  | ||||||
| 
 |  | ||||||
| 	/// Constructor
 |  | ||||||
| 	b2Timer(); |  | ||||||
| 
 |  | ||||||
| 	/// Reset the timer.
 |  | ||||||
| 	void Reset(); |  | ||||||
| 
 |  | ||||||
| 	/// Get the time since construction or the last reset.
 |  | ||||||
| 	float32 GetMilliseconds() const; |  | ||||||
| 
 |  | ||||||
| private: |  | ||||||
| 
 |  | ||||||
| #if defined(_WIN32) |  | ||||||
| 	float64 m_start; |  | ||||||
| 	static float64 s_invFrequency; |  | ||||||
| #elif defined(__linux__) || defined (__APPLE__) |  | ||||||
| 	unsigned long long m_start_sec; |  | ||||||
| 	unsigned long long m_start_usec; |  | ||||||
| #endif |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| #endif |  | ||||||
|  | @ -1,53 +0,0 @@ | ||||||
| /*
 |  | ||||||
| * Copyright (c) 2006-2010 Erin Catto http://www.box2d.org
 |  | ||||||
| * |  | ||||||
| * This software is provided 'as-is', without any express or implied |  | ||||||
| * warranty.  In no event will the authors be held liable for any damages |  | ||||||
| * arising from the use of this software. |  | ||||||
| * Permission is granted to anyone to use this software for any purpose, |  | ||||||
| * including commercial applications, and to alter it and redistribute it |  | ||||||
| * freely, subject to the following restrictions: |  | ||||||
| * 1. The origin of this software must not be misrepresented; you must not |  | ||||||
| * claim that you wrote the original software. If you use this software |  | ||||||
| * in a product, an acknowledgment in the product documentation would be |  | ||||||
| * appreciated but is not required. |  | ||||||
| * 2. Altered source versions must be plainly marked as such, and must not be |  | ||||||
| * misrepresented as being the original software. |  | ||||||
| * 3. This notice may not be removed or altered from any source distribution. |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #include "Box2D/Dynamics/Contacts/b2ChainAndCircleContact.h" |  | ||||||
| #include "Box2D/Common/b2BlockAllocator.h" |  | ||||||
| #include "Box2D/Dynamics/b2Fixture.h" |  | ||||||
| #include "Box2D/Collision/Shapes/b2ChainShape.h" |  | ||||||
| #include "Box2D/Collision/Shapes/b2EdgeShape.h" |  | ||||||
| 
 |  | ||||||
| #include <new> |  | ||||||
| 
 |  | ||||||
| b2Contact* b2ChainAndCircleContact::Create(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator) |  | ||||||
| { |  | ||||||
| 	void* mem = allocator->Allocate(sizeof(b2ChainAndCircleContact)); |  | ||||||
| 	return new (mem) b2ChainAndCircleContact(fixtureA, indexA, fixtureB, indexB); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2ChainAndCircleContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator) |  | ||||||
| { |  | ||||||
| 	((b2ChainAndCircleContact*)contact)->~b2ChainAndCircleContact(); |  | ||||||
| 	allocator->Free(contact, sizeof(b2ChainAndCircleContact)); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| b2ChainAndCircleContact::b2ChainAndCircleContact(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB) |  | ||||||
| : b2Contact(fixtureA, indexA, fixtureB, indexB) |  | ||||||
| { |  | ||||||
| 	b2Assert(m_fixtureA->GetType() == b2Shape::e_chain); |  | ||||||
| 	b2Assert(m_fixtureB->GetType() == b2Shape::e_circle); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void b2ChainAndCircleContact::Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB) |  | ||||||
| { |  | ||||||
| 	b2ChainShape* chain = (b2ChainShape*)m_fixtureA->GetShape(); |  | ||||||
| 	b2EdgeShape edge; |  | ||||||
| 	chain->GetChildEdge(&edge, m_indexA); |  | ||||||
| 	b2CollideEdgeAndCircle(	manifold, &edge, xfA, |  | ||||||
| 							(b2CircleShape*)m_fixtureB->GetShape(), xfB); |  | ||||||
| } |  | ||||||