Selaa lähdekoodia

Added Location modifier in URO.

Added BtPhystest for Bullet Physics test project.
legacy
Benjamin ‘Touky’ Huet touky 12 vuotta sitten
vanhempi
commit
6c4d4bdf5f
7 muutettua tiedostoa jossa 529 lisäystä ja 14 poistoa
  1. +4
    -4
      build/vs2010/Lol.Core.Rules.props
  2. +11
    -0
      build/vs2010/Lol.Core.Vars.props
  3. +71
    -10
      build/vs2010/Lol.sln
  4. +310
    -0
      test/BtPhysTest.cpp
  5. +46
    -0
      test/BtPhysTest.h
  6. +73
    -0
      test/BtPhysTest.vcxproj
  7. +14
    -0
      test/BtPhysTest.vcxproj.filters

+ 4
- 4
build/vs2010/Lol.Core.Rules.props Näytä tiedosto

@@ -10,8 +10,8 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<FloatingPointModel>Fast</FloatingPointModel>
<AdditionalIncludeDirectories>$(SolutionDir)\..\..\src;$(FlexIncludes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Platform)'=='Win32'">$(GlIncludes);$(SdlIncludes);$(D3d9Includes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Platform)'=='x64'">$(GlIncludes);$(SdlIncludes);$(D3d9Includes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Platform)'=='Win32'">$(GlIncludes);$(SdlIncludes);$(BtPhysIncludes);$(D3d9Includes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Platform)'=='x64'">$(GlIncludes);$(SdlIncludes);$(BtPhysIncludes);$(D3d9Includes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NOMINMAX;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='Win32'">WIN32;$(Win32Defines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='x64'">WIN32;$(Win32Defines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -36,10 +36,10 @@
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<!-- FIXME: not for the static library! -->
<AdditionalDependencies Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;$(SdlDeps);$(GdiDeps);%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;$(SdlDeps);$(BtPhysDeps);$(GdiDeps);%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies Condition="'$(UseOpenGL)'=='true' And ('$(Platform)'=='Win32' Or '$(Platform)'=='x64')">$(GlDeps);%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies Condition="'$(UseOpenGL)'=='false' And ('$(Platform)'=='Win32' Or '$(Platform)'=='x64')">$(D3d9Deps);%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">$(SdlLibs);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">$(SdlLibs);$(BtPhysLibs);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories Condition="'$(UseOpenGL)'=='true' And ('$(Platform)'=='Win32' Or '$(Platform)'=='x64')">$(GlLibs);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories Condition="'$(UseOpenGL)'=='false' And ('$(Platform)'=='Win32' Or '$(Platform)'=='x64')">$(D3d9Libs);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Debug|Xbox 360'">xapilibd.lib;d3d9d.lib;d3dx9d.lib;xgraphicsd.lib;xboxkrnl.lib;xnetd.lib;xaudiod2.lib;xactd3.lib;x3daudiod.lib;xmcored.lib;xbdm.lib;vcompd.lib;%(AdditionalDependencies)</AdditionalDependencies>


+ 11
- 0
build/vs2010/Lol.Core.Vars.props Näytä tiedosto

@@ -19,6 +19,13 @@
<SdlDeps Condition="'$(Platform)'=='x64'">libSDL.a;libSDLmain.a</SdlDeps>
<Win32Defines>HAVE_SDL_H;USE_SDL;$(Win32Defines)</Win32Defines>

<!-- BulletPhysics -->
<BtPhysDir>$(ContribDir)\bullet-2.80-rev2531</BtPhysDir>
<BtPhysIncludes>$(BtPhysDir)\src</BtPhysIncludes>
<BtPhysLibs Condition="'$(Platform)'=='Win32'">$(BtPhysDir)\lib</BtPhysLibs>
<BtPhysDeps Condition="'$(Platform)'=='Win32'">BulletCollision.lib;BulletDynamics.lib;BulletSoftBody.lib;ConvexDecomposition.lib;HACD.lib;LinearMath.lib;OpenGLSupport.lib</BtPhysDeps>
<Win32Defines>$(Win32Defines)</Win32Defines>

<!-- GTK+ & GtkGl -->
<GtkDir>$(ContribDir)\gtk-2.22.1</GtkDir>
<GtkGlDir>$(ContribDir)\gtkglarea-2.0.1</GtkGlDir>
@@ -78,6 +85,10 @@
<BuildMacro Include="SdlIncludes"><Value>$(SdlIncludes)</Value></BuildMacro>
<BuildMacro Include="SdlLibs"><Value>$(SdlLibs)</Value></BuildMacro>
<BuildMacro Include="SdlDeps"><Value>$(SdlDeps)</Value></BuildMacro>
<BuildMacro Include="BtPhysDir"><Value>$(BtPhysDir)</Value></BuildMacro>
<BuildMacro Include="BtPhysIncludes"><Value>$(BtPhysIncludes)</Value></BuildMacro>
<BuildMacro Include="BtPhysLibs"><Value>$(BtPhysLibs)</Value></BuildMacro>
<BuildMacro Include="BtPhysDeps"><Value>$(BtPhysDeps)</Value></BuildMacro>
<BuildMacro Include="GtkDir"><Value>$(GtkDir)</Value></BuildMacro>
<BuildMacro Include="GtkGlDir"><Value>$(GtkGlDir)</Value></BuildMacro>
<BuildMacro Include="GtkIncludes"><Value>$(GtkIncludes)</Value></BuildMacro>


+ 71
- 10
build/vs2010/Lol.sln Näytä tiedosto

@@ -84,15 +84,19 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Touky", "Touky", "{9EA99B18
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ToukyDemo", "..\..\games\ToukyDemo\ToukyDemo.vcxproj", "{EE203B88-44CF-4859-9D42-7A5F43FECB52}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BtPhysTest", "..\..\test\BtPhysTest.vcxproj", "{EE203B88-44CF-4859-9D42-7A1F43FECB52}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|PlayStation 3 = Debug|PlayStation 3
Debug|Windows (32-bit) = Debug|Windows (32-bit)
Debug|Windows (64-bit) = Debug|Windows (64-bit)
Debug|x64 = Debug|x64
Debug|Xbox 360 = Debug|Xbox 360
Release|PlayStation 3 = Release|PlayStation 3
Release|Windows (32-bit) = Release|Windows (32-bit)
Release|Windows (64-bit) = Release|Windows (64-bit)
Release|x64 = Release|x64
Release|Xbox 360 = Release|Xbox 360
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
@@ -102,6 +106,7 @@ Global
{EF1A4E80-63FA-4EB0-B834-12B6C500F31C}.Debug|Windows (32-bit).Build.0 = Debug|Win32
{EF1A4E80-63FA-4EB0-B834-12B6C500F31C}.Debug|Windows (64-bit).ActiveCfg = Debug|x64
{EF1A4E80-63FA-4EB0-B834-12B6C500F31C}.Debug|Windows (64-bit).Build.0 = Debug|x64
{EF1A4E80-63FA-4EB0-B834-12B6C500F31C}.Debug|x64.ActiveCfg = Debug|x64
{EF1A4E80-63FA-4EB0-B834-12B6C500F31C}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360
{EF1A4E80-63FA-4EB0-B834-12B6C500F31C}.Debug|Xbox 360.Build.0 = Debug|Xbox 360
{EF1A4E80-63FA-4EB0-B834-12B6C500F31C}.Debug|Xbox 360.Deploy.0 = Debug|Xbox 360
@@ -111,6 +116,7 @@ Global
{EF1A4E80-63FA-4EB0-B834-12B6C500F31C}.Release|Windows (32-bit).Build.0 = Release|Win32
{EF1A4E80-63FA-4EB0-B834-12B6C500F31C}.Release|Windows (64-bit).ActiveCfg = Release|x64
{EF1A4E80-63FA-4EB0-B834-12B6C500F31C}.Release|Windows (64-bit).Build.0 = Release|x64
{EF1A4E80-63FA-4EB0-B834-12B6C500F31C}.Release|x64.ActiveCfg = Release|x64
{EF1A4E80-63FA-4EB0-B834-12B6C500F31C}.Release|Xbox 360.ActiveCfg = Release|Xbox 360
{EF1A4E80-63FA-4EB0-B834-12B6C500F31C}.Release|Xbox 360.Build.0 = Release|Xbox 360
{EF1A4E80-63FA-4EB0-B834-12B6C500F31C}.Release|Xbox 360.Deploy.0 = Release|Xbox 360
@@ -120,6 +126,8 @@ Global
{17F0F184-4436-4D08-B8AA-16572EA238DB}.Debug|Windows (32-bit).Build.0 = Debug|Win32
{17F0F184-4436-4D08-B8AA-16572EA238DB}.Debug|Windows (64-bit).ActiveCfg = Debug|x64
{17F0F184-4436-4D08-B8AA-16572EA238DB}.Debug|Windows (64-bit).Build.0 = Debug|x64
{17F0F184-4436-4D08-B8AA-16572EA238DB}.Debug|x64.ActiveCfg = Debug|x64
{17F0F184-4436-4D08-B8AA-16572EA238DB}.Debug|x64.Build.0 = Debug|x64
{17F0F184-4436-4D08-B8AA-16572EA238DB}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360
{17F0F184-4436-4D08-B8AA-16572EA238DB}.Debug|Xbox 360.Build.0 = Debug|Xbox 360
{17F0F184-4436-4D08-B8AA-16572EA238DB}.Debug|Xbox 360.Deploy.0 = Debug|Xbox 360
@@ -128,17 +136,20 @@ Global
{17F0F184-4436-4D08-B8AA-16572EA238DB}.Release|Windows (32-bit).ActiveCfg = Release|Win32
{17F0F184-4436-4D08-B8AA-16572EA238DB}.Release|Windows (32-bit).Build.0 = Release|Win32
{17F0F184-4436-4D08-B8AA-16572EA238DB}.Release|Windows (64-bit).ActiveCfg = Release|x64
{17F0F184-4436-4D08-B8AA-16572EA238DB}.Release|Windows (64-bit).Build.0 = Release|x64
{17F0F184-4436-4D08-B8AA-16572EA238DB}.Release|x64.ActiveCfg = Release|x64
{17F0F184-4436-4D08-B8AA-16572EA238DB}.Release|x64.Build.0 = Release|x64
{17F0F184-4436-4D08-B8AA-16572EA238DB}.Release|Xbox 360.ActiveCfg = Release|Xbox 360
{17F0F184-4436-4D08-B8AA-16572EA238DB}.Release|Xbox 360.Build.0 = Release|Xbox 360
{17F0F184-4436-4D08-B8AA-16572EA238DB}.Release|Xbox 360.Deploy.0 = Release|Xbox 360
{9C66B179-0737-4BDA-AB42-2ADE478A9008}.Debug|PlayStation 3.ActiveCfg = Debug|PS3
{9C66B179-0737-4BDA-AB42-2ADE478A9008}.Debug|Windows (32-bit).ActiveCfg = Debug|Win32
{9C66B179-0737-4BDA-AB42-2ADE478A9008}.Debug|Windows (64-bit).ActiveCfg = Debug|x64
{9C66B179-0737-4BDA-AB42-2ADE478A9008}.Debug|x64.ActiveCfg = Debug|x64
{9C66B179-0737-4BDA-AB42-2ADE478A9008}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360
{9C66B179-0737-4BDA-AB42-2ADE478A9008}.Release|PlayStation 3.ActiveCfg = Release|PS3
{9C66B179-0737-4BDA-AB42-2ADE478A9008}.Release|Windows (32-bit).ActiveCfg = Release|Win32
{9C66B179-0737-4BDA-AB42-2ADE478A9008}.Release|Windows (64-bit).ActiveCfg = Release|x64
{9C66B179-0737-4BDA-AB42-2ADE478A9008}.Release|x64.ActiveCfg = Release|x64
{9C66B179-0737-4BDA-AB42-2ADE478A9008}.Release|Xbox 360.ActiveCfg = Release|Xbox 360
{9E62F2FE-3408-4EAE-8238-FD84238CEEDA}.Debug|PlayStation 3.ActiveCfg = Debug|PS3
{9E62F2FE-3408-4EAE-8238-FD84238CEEDA}.Debug|PlayStation 3.Build.0 = Debug|PS3
@@ -146,6 +157,8 @@ Global
{9E62F2FE-3408-4EAE-8238-FD84238CEEDA}.Debug|Windows (32-bit).Build.0 = Debug|Win32
{9E62F2FE-3408-4EAE-8238-FD84238CEEDA}.Debug|Windows (64-bit).ActiveCfg = Debug|x64
{9E62F2FE-3408-4EAE-8238-FD84238CEEDA}.Debug|Windows (64-bit).Build.0 = Debug|x64
{9E62F2FE-3408-4EAE-8238-FD84238CEEDA}.Debug|x64.ActiveCfg = Debug|x64
{9E62F2FE-3408-4EAE-8238-FD84238CEEDA}.Debug|x64.Build.0 = Debug|x64
{9E62F2FE-3408-4EAE-8238-FD84238CEEDA}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360
{9E62F2FE-3408-4EAE-8238-FD84238CEEDA}.Debug|Xbox 360.Build.0 = Debug|Xbox 360
{9E62F2FE-3408-4EAE-8238-FD84238CEEDA}.Debug|Xbox 360.Deploy.0 = Debug|Xbox 360
@@ -155,6 +168,8 @@ Global
{9E62F2FE-3408-4EAE-8238-FD84238CEEDA}.Release|Windows (32-bit).Build.0 = Release|Win32
{9E62F2FE-3408-4EAE-8238-FD84238CEEDA}.Release|Windows (64-bit).ActiveCfg = Release|x64
{9E62F2FE-3408-4EAE-8238-FD84238CEEDA}.Release|Windows (64-bit).Build.0 = Release|x64
{9E62F2FE-3408-4EAE-8238-FD84238CEEDA}.Release|x64.ActiveCfg = Release|x64
{9E62F2FE-3408-4EAE-8238-FD84238CEEDA}.Release|x64.Build.0 = Release|x64
{9E62F2FE-3408-4EAE-8238-FD84238CEEDA}.Release|Xbox 360.ActiveCfg = Release|Xbox 360
{9E62F2FE-3408-4EAE-8238-FD84238CEEDA}.Release|Xbox 360.Build.0 = Release|Xbox 360
{9E62F2FE-3408-4EAE-8238-FD84238CEEDA}.Release|Xbox 360.Deploy.0 = Release|Xbox 360
@@ -164,6 +179,8 @@ Global
{53D9D96F-55C0-4044-BDB1-4A5E8EDBDF0E}.Debug|Windows (32-bit).Build.0 = Debug|Win32
{53D9D96F-55C0-4044-BDB1-4A5E8EDBDF0E}.Debug|Windows (64-bit).ActiveCfg = Debug|x64
{53D9D96F-55C0-4044-BDB1-4A5E8EDBDF0E}.Debug|Windows (64-bit).Build.0 = Debug|x64
{53D9D96F-55C0-4044-BDB1-4A5E8EDBDF0E}.Debug|x64.ActiveCfg = Debug|x64
{53D9D96F-55C0-4044-BDB1-4A5E8EDBDF0E}.Debug|x64.Build.0 = Debug|x64
{53D9D96F-55C0-4044-BDB1-4A5E8EDBDF0E}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360
{53D9D96F-55C0-4044-BDB1-4A5E8EDBDF0E}.Debug|Xbox 360.Build.0 = Debug|Xbox 360
{53D9D96F-55C0-4044-BDB1-4A5E8EDBDF0E}.Debug|Xbox 360.Deploy.0 = Debug|Xbox 360
@@ -172,7 +189,8 @@ Global
{53D9D96F-55C0-4044-BDB1-4A5E8EDBDF0E}.Release|Windows (32-bit).ActiveCfg = Release|Win32
{53D9D96F-55C0-4044-BDB1-4A5E8EDBDF0E}.Release|Windows (32-bit).Build.0 = Release|Win32
{53D9D96F-55C0-4044-BDB1-4A5E8EDBDF0E}.Release|Windows (64-bit).ActiveCfg = Release|x64
{53D9D96F-55C0-4044-BDB1-4A5E8EDBDF0E}.Release|Windows (64-bit).Build.0 = Release|x64
{53D9D96F-55C0-4044-BDB1-4A5E8EDBDF0E}.Release|x64.ActiveCfg = Release|x64
{53D9D96F-55C0-4044-BDB1-4A5E8EDBDF0E}.Release|x64.Build.0 = Release|x64
{53D9D96F-55C0-4044-BDB1-4A5E8EDBDF0E}.Release|Xbox 360.ActiveCfg = Release|Xbox 360
{53D9D96F-55C0-4044-BDB1-4A5E8EDBDF0E}.Release|Xbox 360.Build.0 = Release|Xbox 360
{53D9D96F-55C0-4044-BDB1-4A5E8EDBDF0E}.Release|Xbox 360.Deploy.0 = Release|Xbox 360
@@ -182,6 +200,8 @@ Global
{B1E10086-A1DA-401A-834D-969C9DBB5CC1}.Debug|Windows (32-bit).Build.0 = Debug|Win32
{B1E10086-A1DA-401A-834D-969C9DBB5CC1}.Debug|Windows (64-bit).ActiveCfg = Debug|x64
{B1E10086-A1DA-401A-834D-969C9DBB5CC1}.Debug|Windows (64-bit).Build.0 = Debug|x64
{B1E10086-A1DA-401A-834D-969C9DBB5CC1}.Debug|x64.ActiveCfg = Debug|x64
{B1E10086-A1DA-401A-834D-969C9DBB5CC1}.Debug|x64.Build.0 = Debug|x64
{B1E10086-A1DA-401A-834D-969C9DBB5CC1}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360
{B1E10086-A1DA-401A-834D-969C9DBB5CC1}.Debug|Xbox 360.Build.0 = Debug|Xbox 360
{B1E10086-A1DA-401A-834D-969C9DBB5CC1}.Debug|Xbox 360.Deploy.0 = Debug|Xbox 360
@@ -190,7 +210,8 @@ Global
{B1E10086-A1DA-401A-834D-969C9DBB5CC1}.Release|Windows (32-bit).ActiveCfg = Release|Win32
{B1E10086-A1DA-401A-834D-969C9DBB5CC1}.Release|Windows (32-bit).Build.0 = Release|Win32
{B1E10086-A1DA-401A-834D-969C9DBB5CC1}.Release|Windows (64-bit).ActiveCfg = Release|x64
{B1E10086-A1DA-401A-834D-969C9DBB5CC1}.Release|Windows (64-bit).Build.0 = Release|x64
{B1E10086-A1DA-401A-834D-969C9DBB5CC1}.Release|x64.ActiveCfg = Release|x64
{B1E10086-A1DA-401A-834D-969C9DBB5CC1}.Release|x64.Build.0 = Release|x64
{B1E10086-A1DA-401A-834D-969C9DBB5CC1}.Release|Xbox 360.ActiveCfg = Release|Xbox 360
{B1E10086-A1DA-401A-834D-969C9DBB5CC1}.Release|Xbox 360.Build.0 = Release|Xbox 360
{B1E10086-A1DA-401A-834D-969C9DBB5CC1}.Release|Xbox 360.Deploy.0 = Release|Xbox 360
@@ -200,6 +221,8 @@ Global
{80F81C11-8DA2-4990-91CB-9807783BA46E}.Debug|Windows (32-bit).Build.0 = Debug|Win32
{80F81C11-8DA2-4990-91CB-9807783BA46E}.Debug|Windows (64-bit).ActiveCfg = Debug|x64
{80F81C11-8DA2-4990-91CB-9807783BA46E}.Debug|Windows (64-bit).Build.0 = Debug|x64
{80F81C11-8DA2-4990-91CB-9807783BA46E}.Debug|x64.ActiveCfg = Debug|x64
{80F81C11-8DA2-4990-91CB-9807783BA46E}.Debug|x64.Build.0 = Debug|x64
{80F81C11-8DA2-4990-91CB-9807783BA46E}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360
{80F81C11-8DA2-4990-91CB-9807783BA46E}.Debug|Xbox 360.Build.0 = Debug|Xbox 360
{80F81C11-8DA2-4990-91CB-9807783BA46E}.Debug|Xbox 360.Deploy.0 = Debug|Xbox 360
@@ -208,7 +231,8 @@ Global
{80F81C11-8DA2-4990-91CB-9807783BA46E}.Release|Windows (32-bit).ActiveCfg = Release|Win32
{80F81C11-8DA2-4990-91CB-9807783BA46E}.Release|Windows (32-bit).Build.0 = Release|Win32
{80F81C11-8DA2-4990-91CB-9807783BA46E}.Release|Windows (64-bit).ActiveCfg = Release|x64
{80F81C11-8DA2-4990-91CB-9807783BA46E}.Release|Windows (64-bit).Build.0 = Release|x64
{80F81C11-8DA2-4990-91CB-9807783BA46E}.Release|x64.ActiveCfg = Release|x64
{80F81C11-8DA2-4990-91CB-9807783BA46E}.Release|x64.Build.0 = Release|x64
{80F81C11-8DA2-4990-91CB-9807783BA46E}.Release|Xbox 360.ActiveCfg = Release|Xbox 360
{80F81C11-8DA2-4990-91CB-9807783BA46E}.Release|Xbox 360.Build.0 = Release|Xbox 360
{80F81C11-8DA2-4990-91CB-9807783BA46E}.Release|Xbox 360.Deploy.0 = Release|Xbox 360
@@ -218,6 +242,8 @@ Global
{B92ABADC-45BE-4CC5-B724-9426053123A1}.Debug|Windows (32-bit).Build.0 = Debug|Win32
{B92ABADC-45BE-4CC5-B724-9426053123A1}.Debug|Windows (64-bit).ActiveCfg = Debug|x64
{B92ABADC-45BE-4CC5-B724-9426053123A1}.Debug|Windows (64-bit).Build.0 = Debug|x64
{B92ABADC-45BE-4CC5-B724-9426053123A1}.Debug|x64.ActiveCfg = Debug|x64
{B92ABADC-45BE-4CC5-B724-9426053123A1}.Debug|x64.Build.0 = Debug|x64
{B92ABADC-45BE-4CC5-B724-9426053123A1}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360
{B92ABADC-45BE-4CC5-B724-9426053123A1}.Debug|Xbox 360.Build.0 = Debug|Xbox 360
{B92ABADC-45BE-4CC5-B724-9426053123A1}.Debug|Xbox 360.Deploy.0 = Debug|Xbox 360
@@ -226,7 +252,8 @@ Global
{B92ABADC-45BE-4CC5-B724-9426053123A1}.Release|Windows (32-bit).ActiveCfg = Release|Win32
{B92ABADC-45BE-4CC5-B724-9426053123A1}.Release|Windows (32-bit).Build.0 = Release|Win32
{B92ABADC-45BE-4CC5-B724-9426053123A1}.Release|Windows (64-bit).ActiveCfg = Release|x64
{B92ABADC-45BE-4CC5-B724-9426053123A1}.Release|Windows (64-bit).Build.0 = Release|x64
{B92ABADC-45BE-4CC5-B724-9426053123A1}.Release|x64.ActiveCfg = Release|x64
{B92ABADC-45BE-4CC5-B724-9426053123A1}.Release|x64.Build.0 = Release|x64
{B92ABADC-45BE-4CC5-B724-9426053123A1}.Release|Xbox 360.ActiveCfg = Release|Xbox 360
{B92ABADC-45BE-4CC5-B724-9426053123A1}.Release|Xbox 360.Build.0 = Release|Xbox 360
{B92ABADC-45BE-4CC5-B724-9426053123A1}.Release|Xbox 360.Deploy.0 = Release|Xbox 360
@@ -236,6 +263,8 @@ Global
{7B083DA2-FE08-4F6D-BFDD-195D5C2783EB}.Debug|Windows (32-bit).Build.0 = Debug|Win32
{7B083DA2-FE08-4F6D-BFDD-195D5C2783EB}.Debug|Windows (64-bit).ActiveCfg = Debug|x64
{7B083DA2-FE08-4F6D-BFDD-195D5C2783EB}.Debug|Windows (64-bit).Build.0 = Debug|x64
{7B083DA2-FE08-4F6D-BFDD-195D5C2783EB}.Debug|x64.ActiveCfg = Debug|x64
{7B083DA2-FE08-4F6D-BFDD-195D5C2783EB}.Debug|x64.Build.0 = Debug|x64
{7B083DA2-FE08-4F6D-BFDD-195D5C2783EB}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360
{7B083DA2-FE08-4F6D-BFDD-195D5C2783EB}.Debug|Xbox 360.Build.0 = Debug|Xbox 360
{7B083DA2-FE08-4F6D-BFDD-195D5C2783EB}.Debug|Xbox 360.Deploy.0 = Debug|Xbox 360
@@ -244,7 +273,8 @@ Global
{7B083DA2-FE08-4F6D-BFDD-195D5C2783EB}.Release|Windows (32-bit).ActiveCfg = Release|Win32
{7B083DA2-FE08-4F6D-BFDD-195D5C2783EB}.Release|Windows (32-bit).Build.0 = Release|Win32
{7B083DA2-FE08-4F6D-BFDD-195D5C2783EB}.Release|Windows (64-bit).ActiveCfg = Release|x64
{7B083DA2-FE08-4F6D-BFDD-195D5C2783EB}.Release|Windows (64-bit).Build.0 = Release|x64
{7B083DA2-FE08-4F6D-BFDD-195D5C2783EB}.Release|x64.ActiveCfg = Release|x64
{7B083DA2-FE08-4F6D-BFDD-195D5C2783EB}.Release|x64.Build.0 = Release|x64
{7B083DA2-FE08-4F6D-BFDD-195D5C2783EB}.Release|Xbox 360.ActiveCfg = Release|Xbox 360
{7B083DA2-FE08-4F6D-BFDD-195D5C2783EB}.Release|Xbox 360.Build.0 = Release|Xbox 360
{7B083DA2-FE08-4F6D-BFDD-195D5C2783EB}.Release|Xbox 360.Deploy.0 = Release|Xbox 360
@@ -254,6 +284,8 @@ Global
{6BF81B39-EDC2-4227-9992-C2D8ABEA95AF}.Debug|Windows (32-bit).Build.0 = Debug|Win32
{6BF81B39-EDC2-4227-9992-C2D8ABEA95AF}.Debug|Windows (64-bit).ActiveCfg = Debug|x64
{6BF81B39-EDC2-4227-9992-C2D8ABEA95AF}.Debug|Windows (64-bit).Build.0 = Debug|x64
{6BF81B39-EDC2-4227-9992-C2D8ABEA95AF}.Debug|x64.ActiveCfg = Debug|x64
{6BF81B39-EDC2-4227-9992-C2D8ABEA95AF}.Debug|x64.Build.0 = Debug|x64
{6BF81B39-EDC2-4227-9992-C2D8ABEA95AF}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360
{6BF81B39-EDC2-4227-9992-C2D8ABEA95AF}.Debug|Xbox 360.Build.0 = Debug|Xbox 360
{6BF81B39-EDC2-4227-9992-C2D8ABEA95AF}.Debug|Xbox 360.Deploy.0 = Debug|Xbox 360
@@ -262,7 +294,8 @@ Global
{6BF81B39-EDC2-4227-9992-C2D8ABEA95AF}.Release|Windows (32-bit).ActiveCfg = Release|Win32
{6BF81B39-EDC2-4227-9992-C2D8ABEA95AF}.Release|Windows (32-bit).Build.0 = Release|Win32
{6BF81B39-EDC2-4227-9992-C2D8ABEA95AF}.Release|Windows (64-bit).ActiveCfg = Release|x64
{6BF81B39-EDC2-4227-9992-C2D8ABEA95AF}.Release|Windows (64-bit).Build.0 = Release|x64
{6BF81B39-EDC2-4227-9992-C2D8ABEA95AF}.Release|x64.ActiveCfg = Release|x64
{6BF81B39-EDC2-4227-9992-C2D8ABEA95AF}.Release|x64.Build.0 = Release|x64
{6BF81B39-EDC2-4227-9992-C2D8ABEA95AF}.Release|Xbox 360.ActiveCfg = Release|Xbox 360
{6BF81B39-EDC2-4227-9992-C2D8ABEA95AF}.Release|Xbox 360.Build.0 = Release|Xbox 360
{6BF81B39-EDC2-4227-9992-C2D8ABEA95AF}.Release|Xbox 360.Deploy.0 = Release|Xbox 360
@@ -272,6 +305,8 @@ Global
{32F3F8CF-D22E-45E4-BEB8-AD909E8C5515}.Debug|Windows (32-bit).Build.0 = Debug|Win32
{32F3F8CF-D22E-45E4-BEB8-AD909E8C5515}.Debug|Windows (64-bit).ActiveCfg = Debug|x64
{32F3F8CF-D22E-45E4-BEB8-AD909E8C5515}.Debug|Windows (64-bit).Build.0 = Debug|x64
{32F3F8CF-D22E-45E4-BEB8-AD909E8C5515}.Debug|x64.ActiveCfg = Debug|x64
{32F3F8CF-D22E-45E4-BEB8-AD909E8C5515}.Debug|x64.Build.0 = Debug|x64
{32F3F8CF-D22E-45E4-BEB8-AD909E8C5515}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360
{32F3F8CF-D22E-45E4-BEB8-AD909E8C5515}.Debug|Xbox 360.Build.0 = Debug|Xbox 360
{32F3F8CF-D22E-45E4-BEB8-AD909E8C5515}.Debug|Xbox 360.Deploy.0 = Debug|Xbox 360
@@ -280,7 +315,8 @@ Global
{32F3F8CF-D22E-45E4-BEB8-AD909E8C5515}.Release|Windows (32-bit).ActiveCfg = Release|Win32
{32F3F8CF-D22E-45E4-BEB8-AD909E8C5515}.Release|Windows (32-bit).Build.0 = Release|Win32
{32F3F8CF-D22E-45E4-BEB8-AD909E8C5515}.Release|Windows (64-bit).ActiveCfg = Release|x64
{32F3F8CF-D22E-45E4-BEB8-AD909E8C5515}.Release|Windows (64-bit).Build.0 = Release|x64
{32F3F8CF-D22E-45E4-BEB8-AD909E8C5515}.Release|x64.ActiveCfg = Release|x64
{32F3F8CF-D22E-45E4-BEB8-AD909E8C5515}.Release|x64.Build.0 = Release|x64
{32F3F8CF-D22E-45E4-BEB8-AD909E8C5515}.Release|Xbox 360.ActiveCfg = Release|Xbox 360
{32F3F8CF-D22E-45E4-BEB8-AD909E8C5515}.Release|Xbox 360.Build.0 = Release|Xbox 360
{32F3F8CF-D22E-45E4-BEB8-AD909E8C5515}.Release|Xbox 360.Deploy.0 = Release|Xbox 360
@@ -290,6 +326,8 @@ Global
{EE203B88-44CF-4859-9D42-7A5F40FECB52}.Debug|Windows (32-bit).Build.0 = Debug|Win32
{EE203B88-44CF-4859-9D42-7A5F40FECB52}.Debug|Windows (64-bit).ActiveCfg = Debug|x64
{EE203B88-44CF-4859-9D42-7A5F40FECB52}.Debug|Windows (64-bit).Build.0 = Debug|x64
{EE203B88-44CF-4859-9D42-7A5F40FECB52}.Debug|x64.ActiveCfg = Debug|x64
{EE203B88-44CF-4859-9D42-7A5F40FECB52}.Debug|x64.Build.0 = Debug|x64
{EE203B88-44CF-4859-9D42-7A5F40FECB52}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360
{EE203B88-44CF-4859-9D42-7A5F40FECB52}.Debug|Xbox 360.Build.0 = Debug|Xbox 360
{EE203B88-44CF-4859-9D42-7A5F40FECB52}.Debug|Xbox 360.Deploy.0 = Debug|Xbox 360
@@ -298,7 +336,8 @@ Global
{EE203B88-44CF-4859-9D42-7A5F40FECB52}.Release|Windows (32-bit).ActiveCfg = Release|Win32
{EE203B88-44CF-4859-9D42-7A5F40FECB52}.Release|Windows (32-bit).Build.0 = Release|Win32
{EE203B88-44CF-4859-9D42-7A5F40FECB52}.Release|Windows (64-bit).ActiveCfg = Release|x64
{EE203B88-44CF-4859-9D42-7A5F40FECB52}.Release|Windows (64-bit).Build.0 = Release|x64
{EE203B88-44CF-4859-9D42-7A5F40FECB52}.Release|x64.ActiveCfg = Release|x64
{EE203B88-44CF-4859-9D42-7A5F40FECB52}.Release|x64.Build.0 = Release|x64
{EE203B88-44CF-4859-9D42-7A5F40FECB52}.Release|Xbox 360.ActiveCfg = Release|Xbox 360
{EE203B88-44CF-4859-9D42-7A5F40FECB52}.Release|Xbox 360.Build.0 = Release|Xbox 360
{EE203B88-44CF-4859-9D42-7A5F40FECB52}.Release|Xbox 360.Deploy.0 = Release|Xbox 360
@@ -307,12 +346,15 @@ Global
{587FCCE9-1D8D-4398-B8B6-E8F4E9A92233}.Debug|Windows (32-bit).Build.0 = Debug|Win32
{587FCCE9-1D8D-4398-B8B6-E8F4E9A92233}.Debug|Windows (64-bit).ActiveCfg = Debug|x64
{587FCCE9-1D8D-4398-B8B6-E8F4E9A92233}.Debug|Windows (64-bit).Build.0 = Debug|x64
{587FCCE9-1D8D-4398-B8B6-E8F4E9A92233}.Debug|x64.ActiveCfg = Debug|x64
{587FCCE9-1D8D-4398-B8B6-E8F4E9A92233}.Debug|x64.Build.0 = Debug|x64
{587FCCE9-1D8D-4398-B8B6-E8F4E9A92233}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360
{587FCCE9-1D8D-4398-B8B6-E8F4E9A92233}.Release|PlayStation 3.ActiveCfg = Release|PS3
{587FCCE9-1D8D-4398-B8B6-E8F4E9A92233}.Release|Windows (32-bit).ActiveCfg = Release|Win32
{587FCCE9-1D8D-4398-B8B6-E8F4E9A92233}.Release|Windows (32-bit).Build.0 = Release|Win32
{587FCCE9-1D8D-4398-B8B6-E8F4E9A92233}.Release|Windows (64-bit).ActiveCfg = Release|x64
{587FCCE9-1D8D-4398-B8B6-E8F4E9A92233}.Release|Windows (64-bit).Build.0 = Release|x64
{587FCCE9-1D8D-4398-B8B6-E8F4E9A92233}.Release|x64.ActiveCfg = Release|x64
{587FCCE9-1D8D-4398-B8B6-E8F4E9A92233}.Release|x64.Build.0 = Release|x64
{587FCCE9-1D8D-4398-B8B6-E8F4E9A92233}.Release|Xbox 360.ActiveCfg = Release|Xbox 360
{EE203B88-44CF-4859-9D42-7A5F43FECB52}.Debug|PlayStation 3.ActiveCfg = Debug|PS3
{EE203B88-44CF-4859-9D42-7A5F43FECB52}.Debug|PlayStation 3.Build.0 = Debug|PS3
@@ -320,6 +362,8 @@ Global
{EE203B88-44CF-4859-9D42-7A5F43FECB52}.Debug|Windows (32-bit).Build.0 = Debug|Win32
{EE203B88-44CF-4859-9D42-7A5F43FECB52}.Debug|Windows (64-bit).ActiveCfg = Debug|x64
{EE203B88-44CF-4859-9D42-7A5F43FECB52}.Debug|Windows (64-bit).Build.0 = Debug|x64
{EE203B88-44CF-4859-9D42-7A5F43FECB52}.Debug|x64.ActiveCfg = Debug|x64
{EE203B88-44CF-4859-9D42-7A5F43FECB52}.Debug|x64.Build.0 = Debug|x64
{EE203B88-44CF-4859-9D42-7A5F43FECB52}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360
{EE203B88-44CF-4859-9D42-7A5F43FECB52}.Debug|Xbox 360.Build.0 = Debug|Xbox 360
{EE203B88-44CF-4859-9D42-7A5F43FECB52}.Debug|Xbox 360.Deploy.0 = Debug|Xbox 360
@@ -329,9 +373,25 @@ Global
{EE203B88-44CF-4859-9D42-7A5F43FECB52}.Release|Windows (32-bit).Build.0 = Release|Win32
{EE203B88-44CF-4859-9D42-7A5F43FECB52}.Release|Windows (64-bit).ActiveCfg = Release|x64
{EE203B88-44CF-4859-9D42-7A5F43FECB52}.Release|Windows (64-bit).Build.0 = Release|x64
{EE203B88-44CF-4859-9D42-7A5F43FECB52}.Release|x64.ActiveCfg = Release|x64
{EE203B88-44CF-4859-9D42-7A5F43FECB52}.Release|x64.Build.0 = Release|x64
{EE203B88-44CF-4859-9D42-7A5F43FECB52}.Release|Xbox 360.ActiveCfg = Release|Xbox 360
{EE203B88-44CF-4859-9D42-7A5F43FECB52}.Release|Xbox 360.Build.0 = Release|Xbox 360
{EE203B88-44CF-4859-9D42-7A5F43FECB52}.Release|Xbox 360.Deploy.0 = Release|Xbox 360
{EE203B88-44CF-4859-9D42-7A1F43FECB52}.Debug|PlayStation 3.ActiveCfg = Debug|x64
{EE203B88-44CF-4859-9D42-7A1F43FECB52}.Debug|Windows (32-bit).ActiveCfg = Debug|Win32
{EE203B88-44CF-4859-9D42-7A1F43FECB52}.Debug|Windows (32-bit).Build.0 = Debug|Win32
{EE203B88-44CF-4859-9D42-7A1F43FECB52}.Debug|Windows (64-bit).ActiveCfg = Debug|Win32
{EE203B88-44CF-4859-9D42-7A1F43FECB52}.Debug|x64.ActiveCfg = Debug|x64
{EE203B88-44CF-4859-9D42-7A1F43FECB52}.Debug|x64.Build.0 = Debug|x64
{EE203B88-44CF-4859-9D42-7A1F43FECB52}.Debug|Xbox 360.ActiveCfg = Debug|x64
{EE203B88-44CF-4859-9D42-7A1F43FECB52}.Release|PlayStation 3.ActiveCfg = Release|x64
{EE203B88-44CF-4859-9D42-7A1F43FECB52}.Release|Windows (32-bit).ActiveCfg = Release|Win32
{EE203B88-44CF-4859-9D42-7A1F43FECB52}.Release|Windows (32-bit).Build.0 = Release|Win32
{EE203B88-44CF-4859-9D42-7A1F43FECB52}.Release|Windows (64-bit).ActiveCfg = Release|Win32
{EE203B88-44CF-4859-9D42-7A1F43FECB52}.Release|x64.ActiveCfg = Release|x64
{EE203B88-44CF-4859-9D42-7A1F43FECB52}.Release|x64.Build.0 = Release|x64
{EE203B88-44CF-4859-9D42-7A1F43FECB52}.Release|Xbox 360.ActiveCfg = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -349,6 +409,7 @@ Global
{53D9D96F-55C0-4044-BDB1-4A5E8EDBDF0E} = {E0491194-35E3-4513-9D31-608EA3165ECF}
{B1E10086-A1DA-401A-834D-969C9DBB5CC1} = {E0491194-35E3-4513-9D31-608EA3165ECF}
{80F81C11-8DA2-4990-91CB-9807783BA46E} = {E0491194-35E3-4513-9D31-608EA3165ECF}
{EE203B88-44CF-4859-9D42-7A1F43FECB52} = {E0491194-35E3-4513-9D31-608EA3165ECF}
{B92ABADC-45BE-4CC5-B724-9426053123A1} = {E74CF679-CA2A-47E9-B1F4-3779D6AC6B04}
{7B083DA2-FE08-4F6D-BFDD-195D5C2783EB} = {E74CF679-CA2A-47E9-B1F4-3779D6AC6B04}
{6BF81B39-EDC2-4227-9992-C2D8ABEA95AF} = {E74CF679-CA2A-47E9-B1F4-3779D6AC6B04}


+ 310
- 0
test/BtPhysTest.cpp Näytä tiedosto

@@ -0,0 +1,310 @@
//
// BtPhysTest
//
// Copyright: (c) 2009-2012 Benjamin Huet <huet.benjamin@gmail.com>
// (c) 2012 Sam Hocevar <sam@hocevar.net>
//

#if defined HAVE_CONFIG_H
# include "config.h"
#endif

#if defined _WIN32
# include <direct.h>
#endif

#if defined _XBOX
# define _USE_MATH_DEFINES /* for M_PI */
# include <xtl.h>
# undef near /* Fuck Microsoft */
# undef far /* Fuck Microsoft again */
#elif defined _WIN32
# define _USE_MATH_DEFINES /* for M_PI */
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# undef near /* Fuck Microsoft */
# undef far /* Fuck Microsoft again */
#else
# include <cmath>
#endif

#if USE_SDL && defined __APPLE__
# include <SDL_main.h>
#endif

#include "core.h"
#include "loldebug.h"
#include <cstdio>

using namespace lol;

#include "btBulletDynamicsCommon.h"
#include "btBulletCollisionCommon.h"
#include "BtPhysTest.h"

#define CUBE_HALF_EXTENTS .5f
#define EXTRA_HEIGHT 1.f

int gNumObjects = 8;

BtPhysTest::BtPhysTest(bool editor)
{
/* Create a camera that matches the settings of XNA BtPhysTest */
m_camera = new Camera(vec3(0.f, 600.f, 0.f),
vec3(0.f, 0.f, 0.f),
vec3(0, 0, -1));
m_camera->SetRotation(quat::fromeuler_yxz(0.f, -30.f, 0.f));
//m_camera->SetPerspective(120.f, 1280.f, 960.f, -1000.f, 1000.f);
m_camera->SetOrtho(1280.f / 6, 960.f / 6, -1000.f, 1000.f);
Ticker::Ref(m_camera);

m_ready = false;

//init Physics
{
m_bt_ccd_mode = USE_CCD;

//collision configuration contains default setup for memory, collision setup
m_bt_collision_config = new btDefaultCollisionConfiguration();

//use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded)
m_bt_dispatcher = new btCollisionDispatcher(m_bt_collision_config);
m_bt_dispatcher->registerCollisionCreateFunc(BOX_SHAPE_PROXYTYPE,BOX_SHAPE_PROXYTYPE,m_bt_collision_config->getCollisionAlgorithmCreateFunc(CONVEX_SHAPE_PROXYTYPE,CONVEX_SHAPE_PROXYTYPE));

m_bt_broadphase = new btDbvtBroadphase();

///the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
m_bt_solver = new btSequentialImpulseConstraintSolver;

m_bt_world = new btDiscreteDynamicsWorld(m_bt_dispatcher, m_bt_broadphase, m_bt_solver, m_bt_collision_config);
//m_bt_world->setDebugDrawer(&sDebugDrawer);
m_bt_world->getSolverInfo().m_splitImpulse = true;
m_bt_world->getSolverInfo().m_numIterations = 20;

m_bt_world->getDispatchInfo().m_useContinuous = (m_bt_ccd_mode == USE_CCD);
m_bt_world->setGravity(btVector3(0,-10,0));

///create a few basic rigid bodies
btBoxShape* box = new btBoxShape(btVector3(btScalar(110.),btScalar(1.),btScalar(110.)));
btCollisionShape* groundShape = box;
m_bt_collision_shapes << groundShape;
m_ground_mesh.Compile("[sc#ddd afcb110 1 110 -1]");
m_rigid_mesh.Compile("[sc#ada afcb1 1 1 -.1]");

//m_bt_collision_shapes << new btCylinderShape(btVector3(.5f,.5f,.5f));

btTransform groundTransform;
groundTransform.setIdentity();

//We can also use DemoApplication::localCreateRigidBody, but for clarity it is provided here:
{
btScalar mass(0.);

//rigidbody is dynamic if and only if mass is non zero, otherwise static
bool isDynamic = (mass != 0.f);

btVector3 localInertia(0,0,0);
if (isDynamic)
groundShape->calculateLocalInertia(mass,localInertia);

//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
btDefaultMotionState* myMotionState = new btDefaultMotionState(groundTransform);
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,groundShape,localInertia);
btRigidBody* body = new btRigidBody(rbInfo);

//add the body to the dynamics world
m_bt_world->addRigidBody(body);
}

//Adding Shapes
{
//create a few dynamic rigidbodies
// Re-using the same collision is better for memory usage and performance
btCollisionShape* colShape = new btBoxShape(btVector3(1,1,1));
m_bt_collision_shapes << colShape;
m_bt_dynamic_shapes << colShape;

/// Create Dynamic Objects
btTransform startTransform;
startTransform.setIdentity();
btScalar mass(1.f);

//rigidbody is dynamic if and only if mass is non zero, otherwise static
bool isDynamic = (mass != 0.f);

btVector3 localInertia(0,0,0);
if (isDynamic)
colShape->calculateLocalInertia(mass,localInertia);

int i;
for (i=0;i<gNumObjects;i++)
{
btCollisionShape* shape = colShape;
btTransform trans;
trans.setIdentity();

//stack them
int colsize = 10;
int row = (i*CUBE_HALF_EXTENTS*2)/(colsize*2*CUBE_HALF_EXTENTS);
int row2 = row;
int col = (i)%(colsize)-colsize/2;

if (col>3)
{
col=11;
row2 |=1;
}

btVector3 pos(col*2*CUBE_HALF_EXTENTS + (row2%2)*CUBE_HALF_EXTENTS,
row*2*CUBE_HALF_EXTENTS+CUBE_HALF_EXTENTS+EXTRA_HEIGHT,0);

trans.setOrigin(pos);
float mass = 1.f;


btAssert((!shape || shape->getShapeType() != INVALID_SHAPE_PROXYTYPE));

//rigidbody is dynamic if and only if mass is non zero, otherwise static
bool isDynamic = (mass != 0.f);

btVector3 localInertia(0,0,0);
if (isDynamic)
shape->calculateLocalInertia(mass,localInertia);

//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects

btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform);

btRigidBody::btRigidBodyConstructionInfo cInfo(mass,myMotionState,shape,localInertia);

btRigidBody* body = new btRigidBody(cInfo);
body->setContactProcessingThreshold(BT_LARGE_FLOAT);

m_bt_world->addRigidBody(body);

///when using m_ccdMode
if (m_bt_ccd_mode == USE_CCD)
{
body->setCcdMotionThreshold(CUBE_HALF_EXTENTS);
body->setCcdSweptSphereRadius(0.9*CUBE_HALF_EXTENTS);
}
}
}
}
}

void BtPhysTest::TickGame(float seconds)
{
WorldEntity::TickGame(seconds);

if (Input::GetButtonState(27 /*SDLK_ESCAPE*/))
Ticker::Shutdown();

///step the simulation
if (m_bt_world)
{
m_bt_world->stepSimulation(seconds);
//optional but useful: debug drawing
//m_bt_world->debugDrawWorld();
}
}

void BtPhysTest::TickDraw(float seconds)
{
WorldEntity::TickDraw(seconds);

if (!m_ready)
{
m_ground_mesh.MeshConvert();
m_rigid_mesh.MeshConvert();
/* FIXME: this object never cleans up */
m_ready = true;
}

Video::SetClearColor(vec4(0.0f, 0.0f, 0.12f, 1.0f));

m_ground_mesh.Render(mat4(1.0f));

for(int i=0;i<gNumObjects;i++)
{
btScalar m[16];
btMatrix3x3 rot;rot.setIdentity();
btCollisionObject* colObj=m_bt_world->getCollisionObjectArray()[i];
btRigidBody* body=btRigidBody::upcast(colObj);
if(body&&body->getMotionState())
{
btDefaultMotionState* myMotionState = (btDefaultMotionState*)body->getMotionState();
myMotionState->m_graphicsWorldTrans.getOpenGLMatrix(m);
rot=myMotionState->m_graphicsWorldTrans.getBasis();
}
else
{
colObj->getWorldTransform().getOpenGLMatrix(m);
rot=colObj->getWorldTransform().getBasis();
}
mat4 NewMx = mat4(1.0f);
for (int i = 0; i < 16; ++i)
NewMx[i / 4][i % 4] = (float)m[i];
m_rigid_mesh.Render(NewMx);
}
}

BtPhysTest::~BtPhysTest()
{
Ticker::Unref(m_camera);

//Exit Physics
{
//cleanup in the reverse order of creation/initialization
//remove the rigidbodies from the dynamics world and delete them
int i;
for (i = m_bt_world->getNumCollisionObjects() - 1; i >= 0 ;i--)
{
btCollisionObject* obj = m_bt_world->getCollisionObjectArray()[i];
btRigidBody* body = btRigidBody::upcast(obj);
if (body && body->getMotionState())
delete body->getMotionState();

m_bt_world->removeCollisionObject(obj);
delete obj;
}

//delete collision shapes
for (int j = 0; j < m_bt_collision_shapes.Count(); j++)
{
btCollisionShape* shape = m_bt_collision_shapes[j];
delete shape;
}
m_bt_collision_shapes.Empty();

delete m_bt_world;
delete m_bt_solver;
delete m_bt_broadphase;
delete m_bt_dispatcher;

delete m_bt_collision_config;
}
}

int main(int argc, char **argv)
{
Application app("BtPhysTest", ivec2(800, 600), 60.0f);

#if defined _MSC_VER && !defined _XBOX
_chdir("..");
#elif defined _WIN32 && !defined _XBOX
_chdir("../..");
#endif

new BtPhysTest(argc > 1);
app.ShowPointer(false);

app.Run();

return EXIT_SUCCESS;
}


+ 46
- 0
test/BtPhysTest.h Näytä tiedosto

@@ -0,0 +1,46 @@
//
// BtPhysTest
//
// Copyright: (c) 2009-2012 Benjamin Huet <huet.benjamin@gmail.com>
// (c) 2012 Sam Hocevar <sam@hocevar.net>
//

#if !defined __BTPHYSTEST_H__
#define __BTPHYSTEST_H__

class BtPhysTest : public WorldEntity
{
public:
BtPhysTest(bool editor = false);
virtual ~BtPhysTest();

char const *GetName() { return "<BtPhysTest>"; }

protected:
virtual void TickGame(float seconds);
virtual void TickDraw(float seconds);

private:
Camera* m_camera;
bool m_ready;
EasyMesh m_ground_mesh;
EasyMesh m_rigid_mesh;

//Bullet Physics Datas
enum
{
USE_CCD=1,
USE_NO_CCD
};
int m_bt_ccd_mode;
btDefaultCollisionConfiguration* m_bt_collision_config;
btCollisionDispatcher* m_bt_dispatcher;
btDbvtBroadphase* m_bt_broadphase;
btSequentialImpulseConstraintSolver* m_bt_solver;
btDiscreteDynamicsWorld* m_bt_world;
Array<btCollisionShape*> m_bt_collision_shapes;
Array<btCollisionShape*> m_bt_dynamic_shapes;
};

#endif // __BTPHYSTEST_H__


+ 73
- 0
test/BtPhysTest.vcxproj Näytä tiedosto

@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|PS3">
<Configuration>Debug</Configuration>
<Platform>PS3</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Xbox 360">
<Configuration>Debug</Configuration>
<Platform>Xbox 360</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|PS3">
<Configuration>Release</Configuration>
<Platform>PS3</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Xbox 360">
<Configuration>Release</Configuration>
<Platform>Xbox 360</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="BtPhysTest.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="BtPhysTest.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(SolutionDir)\..\..\src\lolcore.vcxproj">
<Project>{9e62f2fe-3408-4eae-8238-fd84238ceeda}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{ee203b88-44cf-4859-9d42-7a1f43fecb52}</ProjectGuid>
<ConfigurationType>Application</ConfigurationType>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(SolutionDir)\Lol.Core.Config.props" />
<PropertyGroup Condition="'$(Platform)'=='PS3'" Label="Configuration">
<PlatformToolset>SNC</PlatformToolset>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
<Import Project="$(SolutionDir)\Lol.Fx.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(SolutionDir)\Lol.Core.Vars.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<Import Project="$(SolutionDir)\Lol.Core.Rules.props" />
<ItemDefinitionGroup />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="$(SolutionDir)\Lol.Fx.targets" />
</ImportGroup>
</Project>

+ 14
- 0
test/BtPhysTest.vcxproj.filters Näytä tiedosto

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClInclude Include="BtPhysTest.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="BtPhysTest.cpp" />
</ItemGroup>
<ItemGroup>
<Filter Include="generated">
<UniqueIdentifier>{4fc7662b-b17a-49b9-acd1-0cf767183b06}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>

Ladataan…
Peruuta
Tallenna