make the source code compile with older compilers again (Visual Studio 2006 in particular)
renamed btDbvt::Volume to btDbvtVolume and btDbvt::Node to btDbvtNode to distinguish from btSoftBody::Node
This commit is contained in:
@@ -28,65 +28,36 @@ CFG=appAllBulletDemos - Win32 Release
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "appAllBulletDemos - Win32 Release"
|
||||
!IF "$(CFG)" == "appAllBulletDemos - Win32 DebugDoublePrecision"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "release"
|
||||
# PROP BASE Intermediate_Dir "release"
|
||||
# PROP BASE Output_Dir "debug_dbl"
|
||||
# PROP BASE Intermediate_Dir "debug_dbl"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\..\out\release6\build\appAllBulletDemos\"
|
||||
# PROP Intermediate_Dir "..\..\out\release6\build\appAllBulletDemos\"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Output_Dir "..\..\out\debug_dbl6\build\appAllBulletDemos\"
|
||||
# PROP Intermediate_Dir "..\..\out\debug_dbl6\build\appAllBulletDemos\"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /vmb /vms /W3 /Gm /G5 /D "WIN32" /FD /c
|
||||
# ADD CPP /nologo /vmb /vms /W3 /Gm /G5 /FD /c /Gy /GF /MD /Ob2 /Og /Oi /Ot /Oy /D "_MT" /D "_MBCS" /D "NDEBUG" /D "_CONSOLE" /D "_CRT_SECURE_NO_DEPRECATE" /D "_CRT_NONSTDC_NO_DEPRECATE" /D "WIN32" /I "." /I "..\.." /I "..\..\src" /I "..\..\Glut" /I "..\..\Extras" /I "..\..\Extras\ConvexHull" /I "..\..\Demos\OpenGL" /I "..\..\Extras\ConvexDecomposition" /I "..\..\Extras\GIMPACT\include" /I "..\..\Extras\GIMPACTUtils"
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
MTL=midl.exe
|
||||
# ADD BASE MTL /nologo /mktyplib203 /o "NUL" /win32
|
||||
# ADD MTL /nologo /mktyplib203 /o "NUL" /win32 /D "NDEBUG" /D "_CONSOLE" /D "_CRT_SECURE_NO_DEPRECATE" /D "_CRT_NONSTDC_NO_DEPRECATE"
|
||||
# ADD MTL /nologo /mktyplib203 /o "NUL" /win32 /D "_DEBUG" /D "BT_USE_DOUBLE_PRECISION" /D "_CONSOLE" /D "_CRT_SECURE_NO_DEPRECATE" /D "_CRT_NONSTDC_NO_DEPRECATE"
|
||||
# ADD BASE CPP /nologo /G5 /W3 /D "WIN32" /FD /c
|
||||
# ADD CPP /nologo /G5 /W3 /I "." /I "..\.." /I "..\..\src" /I "..\..\Glut" /I "..\..\Extras" /I "..\..\Extras\ConvexHull" /I "..\..\Demos\OpenGL" /I "..\..\Extras\ConvexDecomposition" /I "..\..\Extras\GIMPACT\include" /I "..\..\Extras\GIMPACTUtils" /D "_MT" /D "_MBCS" /D "_DEBUG" /D "BT_USE_DOUBLE_PRECISION" /D "_CONSOLE" /D "_CRT_SECURE_NO_DEPRECATE" /D "_CRT_NONSTDC_NO_DEPRECATE" /D "WIN32" /FD /c
|
||||
# ADD BASE RSC /l 0x409
|
||||
# ADD RSC /l 0x409 /fo".\..\..\out\release6\build\appAllBulletDemos\appAllBulletDemos.res" /i "." /i "..\.." /i "..\..\src" /i "..\..\Glut" /i "..\..\Extras" /i "..\..\Extras\ConvexHull" /i "..\..\Demos\OpenGL" /i "..\..\Extras\ConvexDecomposition" /i "..\..\Extras\GIMPACT\include" /i "..\..\Extras\GIMPACTUtils"
|
||||
# ADD RSC /l 0x409 /fo".\..\..\out\debug_dbl6\build\appAllBulletDemos\appAllBulletDemos.res" /i "." /i "..\.." /i "..\..\src" /i "..\..\Glut" /i "..\..\Extras" /i "..\..\Extras\ConvexHull" /i "..\..\Demos\OpenGL" /i "..\..\Extras\ConvexDecomposition" /i "..\..\Extras\GIMPACT\include" /i "..\..\Extras\GIMPACTUtils"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 user32.lib gdi32.lib advapi32.lib /nologo /machine:I386
|
||||
# ADD LINK32 shell32.lib user32.lib gdi32.lib advapi32.lib glut32.lib /nologo /version:4.0 /machine:I386 /OPT:NOREF /out:"..\..\AllBulletDemos.exe" /subsystem:console /libpath:"..\..\Glut"
|
||||
|
||||
!ELSEIF "$(CFG)" == "appAllBulletDemos - Win32 ReleaseDoublePrecision"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries
|
||||
# PROP BASE Output_Dir "release_dbl"
|
||||
# PROP BASE Intermediate_Dir "release_dbl"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries
|
||||
# PROP Output_Dir "..\..\out\release_dbl6\build\appAllBulletDemos\"
|
||||
# PROP Intermediate_Dir "..\..\out\release_dbl6\build\appAllBulletDemos\"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /vmb /vms /W3 /Gm /G5 /D "WIN32" /FD /c
|
||||
# ADD CPP /nologo /vmb /vms /W3 /Gm /G5 /FD /c /D "_MT" /D "_MBCS" /D "NDEBUG" /D "BT_USE_DOUBLE_PRECISION" /D "_CONSOLE" /D "_CRT_SECURE_NO_DEPRECATE" /D "_CRT_NONSTDC_NO_DEPRECATE" /D "WIN32" /I "." /I "..\.." /I "..\..\src" /I "..\..\Glut" /I "..\..\Extras" /I "..\..\Extras\ConvexHull" /I "..\..\Demos\OpenGL" /I "..\..\Extras\ConvexDecomposition" /I "..\..\Extras\GIMPACT\include" /I "..\..\Extras\GIMPACTUtils"
|
||||
# ADD BASE MTL /nologo /mktyplib203 /o "NUL" /win32
|
||||
# ADD MTL /nologo /mktyplib203 /o "NUL" /win32 /D "NDEBUG" /D "BT_USE_DOUBLE_PRECISION" /D "_CONSOLE" /D "_CRT_SECURE_NO_DEPRECATE" /D "_CRT_NONSTDC_NO_DEPRECATE"
|
||||
# ADD BASE RSC /l 0x409
|
||||
# ADD RSC /l 0x409 /fo".\..\..\out\release_dbl6\build\appAllBulletDemos\appAllBulletDemos.res" /i "." /i "..\.." /i "..\..\src" /i "..\..\Glut" /i "..\..\Extras" /i "..\..\Extras\ConvexHull" /i "..\..\Demos\OpenGL" /i "..\..\Extras\ConvexDecomposition" /i "..\..\Extras\GIMPACT\include" /i "..\..\Extras\GIMPACTUtils"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 user32.lib gdi32.lib advapi32.lib /nologo /machine:I386
|
||||
# ADD LINK32 shell32.lib user32.lib gdi32.lib advapi32.lib glut32.lib /nologo /version:4.0 /machine:I386 /out:"..\..\AllBulletDemos.exe" /subsystem:console /libpath:"..\..\Glut"
|
||||
# ADD LINK32 shell32.lib user32.lib gdi32.lib advapi32.lib glut32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /out:"..\..\AllBulletDemos.exe" /libpath:"..\..\Glut"
|
||||
|
||||
!ELSEIF "$(CFG)" == "appAllBulletDemos - Win32 Debug"
|
||||
|
||||
@@ -101,58 +72,90 @@ LINK32=link.exe
|
||||
# PROP Intermediate_Dir "..\..\out\debug6\build\appAllBulletDemos\"
|
||||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /vmb /vms /W3 /Gm /G5 /D "WIN32" /FD /c
|
||||
# ADD CPP /nologo /vmb /vms /W3 /Gm /G5 /FD /c /GR /MDd /ZI /Od /D "_MT" /D "_MBCS" /D "_DEBUG" /D "_CONSOLE" /D "_CRT_SECURE_NO_DEPRECATE" /D "_CRT_NONSTDC_NO_DEPRECATE" /D "WIN32" /I "." /I "..\.." /I "..\..\src" /I "..\..\Glut" /I "..\..\Extras" /I "..\..\Extras\ConvexHull" /I "..\..\Demos\OpenGL" /I "..\..\Extras\ConvexDecomposition" /I "..\..\Extras\GIMPACT\include" /I "..\..\Extras\GIMPACTUtils"
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
MTL=midl.exe
|
||||
# ADD BASE MTL /nologo /mktyplib203 /o "NUL" /win32
|
||||
# ADD MTL /nologo /mktyplib203 /o "NUL" /win32 /D "_DEBUG" /D "_CONSOLE" /D "_CRT_SECURE_NO_DEPRECATE" /D "_CRT_NONSTDC_NO_DEPRECATE"
|
||||
# ADD BASE CPP /nologo /G5 /W3 /D "WIN32" /FD /c
|
||||
# ADD CPP /nologo /G5 /MDd /W3 /Gm /GR /ZI /Od /I "." /I "..\.." /I "..\..\src" /I "..\..\Glut" /I "..\..\Extras" /I "..\..\Extras\ConvexHull" /I "..\..\Demos\OpenGL" /I "..\..\Extras\ConvexDecomposition" /I "..\..\Extras\GIMPACT\include" /I "..\..\Extras\GIMPACTUtils" /D "_MT" /D "_MBCS" /D "_DEBUG" /D "_CONSOLE" /D "_CRT_SECURE_NO_DEPRECATE" /D "_CRT_NONSTDC_NO_DEPRECATE" /D "WIN32" /FD /Zm1000 /c
|
||||
# ADD BASE RSC /l 0x409
|
||||
# ADD RSC /l 0x409 /fo".\..\..\out\debug6\build\appAllBulletDemos\appAllBulletDemos.res" /i "." /i "..\.." /i "..\..\src" /i "..\..\Glut" /i "..\..\Extras" /i "..\..\Extras\ConvexHull" /i "..\..\Demos\OpenGL" /i "..\..\Extras\ConvexDecomposition" /i "..\..\Extras\GIMPACT\include" /i "..\..\Extras\GIMPACTUtils"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 user32.lib gdi32.lib advapi32.lib /nologo /machine:I386
|
||||
# ADD LINK32 shell32.lib user32.lib gdi32.lib advapi32.lib glut32.lib /nologo /version:4.0 /machine:I386 /debug /pdbtype:sept /out:"..\..\AllBulletDemos.exe" /subsystem:console /libpath:"..\..\Glut"
|
||||
# ADD LINK32 shell32.lib user32.lib gdi32.lib advapi32.lib glut32.lib /nologo /version:4.0 /subsystem:console /debug /machine:I386 /out:"..\..\AllBulletDemos.exe" /pdbtype:sept /libpath:"..\..\Glut"
|
||||
|
||||
!ELSEIF "$(CFG)" == "appAllBulletDemos - Win32 DebugDoublePrecision"
|
||||
!ELSEIF "$(CFG)" == "appAllBulletDemos - Win32 ReleaseDoublePrecision"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries
|
||||
# PROP BASE Output_Dir "debug_dbl"
|
||||
# PROP BASE Intermediate_Dir "debug_dbl"
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "release_dbl"
|
||||
# PROP BASE Intermediate_Dir "release_dbl"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries
|
||||
# PROP Output_Dir "..\..\out\debug_dbl6\build\appAllBulletDemos\"
|
||||
# PROP Intermediate_Dir "..\..\out\debug_dbl6\build\appAllBulletDemos\"
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\..\out\release_dbl6\build\appAllBulletDemos\"
|
||||
# PROP Intermediate_Dir "..\..\out\release_dbl6\build\appAllBulletDemos\"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /vmb /vms /W3 /Gm /G5 /D "WIN32" /FD /c
|
||||
# ADD CPP /nologo /vmb /vms /W3 /Gm /G5 /FD /c /D "_MT" /D "_MBCS" /D "_DEBUG" /D "BT_USE_DOUBLE_PRECISION" /D "_CONSOLE" /D "_CRT_SECURE_NO_DEPRECATE" /D "_CRT_NONSTDC_NO_DEPRECATE" /D "WIN32" /I "." /I "..\.." /I "..\..\src" /I "..\..\Glut" /I "..\..\Extras" /I "..\..\Extras\ConvexHull" /I "..\..\Demos\OpenGL" /I "..\..\Extras\ConvexDecomposition" /I "..\..\Extras\GIMPACT\include" /I "..\..\Extras\GIMPACTUtils"
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
MTL=midl.exe
|
||||
# ADD BASE MTL /nologo /mktyplib203 /o "NUL" /win32
|
||||
# ADD MTL /nologo /mktyplib203 /o "NUL" /win32 /D "_DEBUG" /D "BT_USE_DOUBLE_PRECISION" /D "_CONSOLE" /D "_CRT_SECURE_NO_DEPRECATE" /D "_CRT_NONSTDC_NO_DEPRECATE"
|
||||
# ADD MTL /nologo /mktyplib203 /o "NUL" /win32 /D "NDEBUG" /D "BT_USE_DOUBLE_PRECISION" /D "_CONSOLE" /D "_CRT_SECURE_NO_DEPRECATE" /D "_CRT_NONSTDC_NO_DEPRECATE"
|
||||
# ADD BASE CPP /nologo /G5 /W3 /D "WIN32" /FD /c
|
||||
# ADD CPP /nologo /G5 /W3 /I "." /I "..\.." /I "..\..\src" /I "..\..\Glut" /I "..\..\Extras" /I "..\..\Extras\ConvexHull" /I "..\..\Demos\OpenGL" /I "..\..\Extras\ConvexDecomposition" /I "..\..\Extras\GIMPACT\include" /I "..\..\Extras\GIMPACTUtils" /D "_MT" /D "_MBCS" /D "NDEBUG" /D "BT_USE_DOUBLE_PRECISION" /D "_CONSOLE" /D "_CRT_SECURE_NO_DEPRECATE" /D "_CRT_NONSTDC_NO_DEPRECATE" /D "WIN32" /FD /c
|
||||
# ADD BASE RSC /l 0x409
|
||||
# ADD RSC /l 0x409 /fo".\..\..\out\debug_dbl6\build\appAllBulletDemos\appAllBulletDemos.res" /i "." /i "..\.." /i "..\..\src" /i "..\..\Glut" /i "..\..\Extras" /i "..\..\Extras\ConvexHull" /i "..\..\Demos\OpenGL" /i "..\..\Extras\ConvexDecomposition" /i "..\..\Extras\GIMPACT\include" /i "..\..\Extras\GIMPACTUtils"
|
||||
# ADD RSC /l 0x409 /fo".\..\..\out\release_dbl6\build\appAllBulletDemos\appAllBulletDemos.res" /i "." /i "..\.." /i "..\..\src" /i "..\..\Glut" /i "..\..\Extras" /i "..\..\Extras\ConvexHull" /i "..\..\Demos\OpenGL" /i "..\..\Extras\ConvexDecomposition" /i "..\..\Extras\GIMPACT\include" /i "..\..\Extras\GIMPACTUtils"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 user32.lib gdi32.lib advapi32.lib /nologo /machine:I386
|
||||
# ADD LINK32 shell32.lib user32.lib gdi32.lib advapi32.lib glut32.lib /nologo /version:4.0 /machine:I386 /out:"..\..\AllBulletDemos.exe" /subsystem:console /libpath:"..\..\Glut"
|
||||
# ADD LINK32 shell32.lib user32.lib gdi32.lib advapi32.lib glut32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /out:"..\..\AllBulletDemos.exe" /libpath:"..\..\Glut"
|
||||
|
||||
!ELSEIF "$(CFG)" == "appAllBulletDemos - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "release"
|
||||
# PROP BASE Intermediate_Dir "release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\..\out\release6\build\appAllBulletDemos\"
|
||||
# PROP Intermediate_Dir "..\..\out\release6\build\appAllBulletDemos\"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
MTL=midl.exe
|
||||
# ADD BASE MTL /nologo /mktyplib203 /o "NUL" /win32
|
||||
# ADD MTL /nologo /mktyplib203 /o "NUL" /win32 /D "NDEBUG" /D "_CONSOLE" /D "_CRT_SECURE_NO_DEPRECATE" /D "_CRT_NONSTDC_NO_DEPRECATE"
|
||||
# ADD BASE CPP /nologo /G5 /W3 /D "WIN32" /FD /c
|
||||
# ADD CPP /nologo /G5 /MD /W3 /Ot /Og /Oi /Oy /Ob2 /Gy /I "." /I "..\.." /I "..\..\src" /I "..\..\Glut" /I "..\..\Extras" /I "..\..\Extras\ConvexHull" /I "..\..\Demos\OpenGL" /I "..\..\Extras\ConvexDecomposition" /I "..\..\Extras\GIMPACT\include" /I "..\..\Extras\GIMPACTUtils" /D "_MT" /D "_MBCS" /D "NDEBUG" /D "_CONSOLE" /D "_CRT_SECURE_NO_DEPRECATE" /D "_CRT_NONSTDC_NO_DEPRECATE" /D "WIN32" /FR /FD /GF /Zm1000 /c
|
||||
# ADD BASE RSC /l 0x409
|
||||
# ADD RSC /l 0x409 /fo".\..\..\out\release6\build\appAllBulletDemos\appAllBulletDemos.res" /i "." /i "..\.." /i "..\..\src" /i "..\..\Glut" /i "..\..\Extras" /i "..\..\Extras\ConvexHull" /i "..\..\Demos\OpenGL" /i "..\..\Extras\ConvexDecomposition" /i "..\..\Extras\GIMPACT\include" /i "..\..\Extras\GIMPACTUtils"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 user32.lib gdi32.lib advapi32.lib /nologo /machine:I386
|
||||
# ADD LINK32 shell32.lib user32.lib gdi32.lib advapi32.lib glut32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /out:"..\..\AllBulletDemos.exe" /libpath:"..\..\Glut" /OPT:NOREF
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "appAllBulletDemos - Win32 Release"
|
||||
# Name "appAllBulletDemos - Win32 ReleaseDoublePrecision"
|
||||
# Name "appAllBulletDemos - Win32 Debug"
|
||||
# Name "appAllBulletDemos - Win32 DebugDoublePrecision"
|
||||
# Name "appAllBulletDemos - Win32 Debug"
|
||||
# Name "appAllBulletDemos - Win32 ReleaseDoublePrecision"
|
||||
# Name "appAllBulletDemos - Win32 Release"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
@@ -202,7 +205,7 @@ SOURCE=..\..\Demos\AllBulletDemos\..\ConvexDecompositionDemo\ConvexDecomposition
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Demos\AllBulletDemos\..\DynamicControlDemo\MotorDemo.cpp
|
||||
SOURCE=..\..\Demos\AllBulletDemos\DemoEntries.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -214,6 +217,14 @@ SOURCE=..\..\Demos\AllBulletDemos\..\GjkConvexCastDemo\LinearConvexCastDemo.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Demos\AllBulletDemos\Main.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Demos\AllBulletDemos\..\DynamicControlDemo\MotorDemo.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Demos\AllBulletDemos\..\RagdollDemo\RagdollDemo.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -232,14 +243,6 @@ SOURCE=..\..\Demos\AllBulletDemos\..\SoftDemo\SoftDemo.cpp
|
||||
|
||||
SOURCE=..\..\Demos\AllBulletDemos\..\VehicleDemo\VehicleDemo.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Demos\AllBulletDemos\DemoEntries.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Demos\AllBulletDemos\Main.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -26,8 +26,13 @@ subject to the following restrictions:
|
||||
//
|
||||
|
||||
#ifdef WIN32
|
||||
//only define templates for visual studio 2005 and later, it just causes headaches for other compilers
|
||||
#if (defined (_MSC_VER) && _MSC_VER >= 1400)
|
||||
#define DBVT_USE_TEMPLATE 1 // Enable template for ICollide
|
||||
#else
|
||||
#define DBVT_USE_TEMPLATE 0 // Don't
|
||||
#endif
|
||||
#else
|
||||
#define DBVT_USE_TEMPLATE 0 // Enable template for ICollide
|
||||
#endif
|
||||
|
||||
@@ -117,51 +122,55 @@ private:
|
||||
btVector3 mi,mx;
|
||||
};
|
||||
|
||||
// Types
|
||||
typedef btDbvtAabbMm btDbvtVolume;
|
||||
|
||||
/* btDbvtNode */
|
||||
struct btDbvtNode
|
||||
{
|
||||
btDbvtVolume volume;
|
||||
btDbvtNode* parent;
|
||||
bool isleaf() const { return(childs[1]==0); }
|
||||
bool isinternal() const { return(!isleaf()); }
|
||||
union {
|
||||
btDbvtNode* childs[2];
|
||||
void* data;
|
||||
};
|
||||
};
|
||||
|
||||
//
|
||||
// Dynamic bounding volume tree
|
||||
//
|
||||
struct btDbvt
|
||||
{
|
||||
// Types
|
||||
typedef btDbvtAabbMm Volume;
|
||||
/* Node */
|
||||
struct Node
|
||||
{
|
||||
Volume volume;
|
||||
Node* parent;
|
||||
bool isleaf() const { return(childs[1]==0); }
|
||||
bool isinternal() const { return(!isleaf()); }
|
||||
union {
|
||||
Node* childs[2];
|
||||
void* data;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/* Stack element */
|
||||
struct sStkNN
|
||||
{
|
||||
const Node* a;
|
||||
const Node* b;
|
||||
sStkNN(const Node* na,const Node* nb) : a(na),b(nb) {}
|
||||
const btDbvtNode* a;
|
||||
const btDbvtNode* b;
|
||||
sStkNN(const btDbvtNode* na,const btDbvtNode* nb) : a(na),b(nb) {}
|
||||
};
|
||||
struct sStkNP
|
||||
{
|
||||
const Node* node;
|
||||
const btDbvtNode* node;
|
||||
int mask;
|
||||
sStkNP(const Node* n,unsigned m) : node(n),mask(m) {}
|
||||
sStkNP(const btDbvtNode* n,unsigned m) : node(n),mask(m) {}
|
||||
};
|
||||
struct sStkNPS
|
||||
{
|
||||
const Node* node;
|
||||
const btDbvtNode* node;
|
||||
int mask;
|
||||
btScalar value;
|
||||
sStkNPS() {}
|
||||
sStkNPS(const Node* n,unsigned m,btScalar v) : node(n),mask(m),value(v) {}
|
||||
sStkNPS(const btDbvtNode* n,unsigned m,btScalar v) : node(n),mask(m),value(v) {}
|
||||
};
|
||||
struct sStkCLN
|
||||
{
|
||||
const Node* node;
|
||||
Node* parent;
|
||||
sStkCLN(const Node* n,Node* p) : node(n),parent(p) {}
|
||||
const btDbvtNode* node;
|
||||
btDbvtNode* parent;
|
||||
sStkCLN(const btDbvtNode* n,btDbvtNode* p) : node(n),parent(p) {}
|
||||
};
|
||||
// Policies/Interfaces
|
||||
|
||||
@@ -169,25 +178,25 @@ struct btDbvt
|
||||
struct ICollide
|
||||
{
|
||||
DBVT_VIRTUAL_DTOR(ICollide)
|
||||
DBVT_VIRTUAL void Process(const Node*,const Node*) {}
|
||||
DBVT_VIRTUAL void Process(const Node*) {}
|
||||
DBVT_VIRTUAL void Process(const Node* n,btScalar) { Process(n); }
|
||||
DBVT_VIRTUAL bool Descent(const Node*) { return(true); }
|
||||
DBVT_VIRTUAL bool AllLeaves(const Node*) { return(true); }
|
||||
DBVT_VIRTUAL void Process(const btDbvtNode*,const btDbvtNode*) {}
|
||||
DBVT_VIRTUAL void Process(const btDbvtNode*) {}
|
||||
DBVT_VIRTUAL void Process(const btDbvtNode* n,btScalar) { Process(n); }
|
||||
DBVT_VIRTUAL bool Descent(const btDbvtNode*) { return(true); }
|
||||
DBVT_VIRTUAL bool AllLeaves(const btDbvtNode*) { return(true); }
|
||||
};
|
||||
/* IWriter */
|
||||
struct IWriter
|
||||
{
|
||||
virtual ~IWriter() {}
|
||||
virtual void Prepare(const Node* root,int numnodes)=0;
|
||||
virtual void WriteNode(const Node*,int index,int parent,int child0,int child1)=0;
|
||||
virtual void WriteLeaf(const Node*,int index,int parent)=0;
|
||||
virtual void Prepare(const btDbvtNode* root,int numnodes)=0;
|
||||
virtual void WriteNode(const btDbvtNode*,int index,int parent,int child0,int child1)=0;
|
||||
virtual void WriteLeaf(const btDbvtNode*,int index,int parent)=0;
|
||||
};
|
||||
/* IClone */
|
||||
struct IClone
|
||||
{
|
||||
virtual ~IClone() {}
|
||||
virtual void CloneLeaf(Node*) {}
|
||||
virtual void CloneLeaf(btDbvtNode*) {}
|
||||
};
|
||||
|
||||
// Constants
|
||||
@@ -197,8 +206,8 @@ struct btDbvt
|
||||
};
|
||||
|
||||
// Fields
|
||||
Node* m_root;
|
||||
Node* m_free;
|
||||
btDbvtNode* m_root;
|
||||
btDbvtNode* m_free;
|
||||
int m_lkhd;
|
||||
int m_leaves;
|
||||
unsigned m_opath;
|
||||
@@ -210,17 +219,17 @@ struct btDbvt
|
||||
void optimizeBottomUp();
|
||||
void optimizeTopDown(int bu_treshold=128);
|
||||
void optimizeIncremental(int passes);
|
||||
Node* insert(const Volume& box,void* data);
|
||||
void update(Node* leaf,int lookahead=-1);
|
||||
void update(Node* leaf,const Volume& volume);
|
||||
bool update(Node* leaf,Volume volume,const btVector3& velocity,btScalar margin);
|
||||
bool update(Node* leaf,Volume volume,const btVector3& velocity);
|
||||
bool update(Node* leaf,Volume volume,btScalar margin);
|
||||
void remove(Node* leaf);
|
||||
btDbvtNode* insert(const btDbvtVolume& box,void* data);
|
||||
void update(btDbvtNode* leaf,int lookahead=-1);
|
||||
void update(btDbvtNode* leaf,const btDbvtVolume& volume);
|
||||
bool update(btDbvtNode* leaf,btDbvtVolume volume,const btVector3& velocity,btScalar margin);
|
||||
bool update(btDbvtNode* leaf,btDbvtVolume volume,const btVector3& velocity);
|
||||
bool update(btDbvtNode* leaf,btDbvtVolume volume,btScalar margin);
|
||||
void remove(btDbvtNode* leaf);
|
||||
void write(IWriter* iwriter) const;
|
||||
void clone(btDbvt& dest,IClone* iclone=0) const;
|
||||
static int countLeaves(const Node* node);
|
||||
static void extractLeaves(const Node* node,btAlignedObjectArray<const Node*>& leaves);
|
||||
static int countLeaves(const btDbvtNode* node);
|
||||
static void extractLeaves(const btDbvtNode* node,btAlignedObjectArray<const btDbvtNode*>& leaves);
|
||||
#if DBVT_ENABLE_BENCHMARK
|
||||
static void benchmark();
|
||||
#else
|
||||
@@ -228,43 +237,43 @@ struct btDbvt
|
||||
#endif
|
||||
// DBVT_IPOLICY must support ICollide policy/interface
|
||||
DBVT_PREFIX
|
||||
static void enumNodes( const Node* root,
|
||||
static void enumNodes( const btDbvtNode* root,
|
||||
DBVT_IPOLICY);
|
||||
DBVT_PREFIX
|
||||
static void enumLeaves( const Node* root,
|
||||
static void enumLeaves( const btDbvtNode* root,
|
||||
DBVT_IPOLICY);
|
||||
DBVT_PREFIX
|
||||
static void collideTT( const Node* root0,
|
||||
const Node* root1,
|
||||
static void collideTT( const btDbvtNode* root0,
|
||||
const btDbvtNode* root1,
|
||||
DBVT_IPOLICY);
|
||||
DBVT_PREFIX
|
||||
static void collideTT( const Node* root0,
|
||||
const Node* root1,
|
||||
static void collideTT( const btDbvtNode* root0,
|
||||
const btDbvtNode* root1,
|
||||
const btTransform& xform,
|
||||
DBVT_IPOLICY);
|
||||
DBVT_PREFIX
|
||||
static void collideTT( const Node* root0,
|
||||
static void collideTT( const btDbvtNode* root0,
|
||||
const btTransform& xform0,
|
||||
const Node* root1,
|
||||
const btDbvtNode* root1,
|
||||
const btTransform& xform1,
|
||||
DBVT_IPOLICY);
|
||||
DBVT_PREFIX
|
||||
static void collideTV( const Node* root,
|
||||
const Volume& volume,
|
||||
static void collideTV( const btDbvtNode* root,
|
||||
const btDbvtVolume& volume,
|
||||
DBVT_IPOLICY);
|
||||
DBVT_PREFIX
|
||||
static void collideRAY( const Node* root,
|
||||
static void collideRAY( const btDbvtNode* root,
|
||||
const btVector3& origin,
|
||||
const btVector3& direction,
|
||||
DBVT_IPOLICY);
|
||||
DBVT_PREFIX
|
||||
static void collideKDOP(const Node* root,
|
||||
static void collideKDOP(const btDbvtNode* root,
|
||||
const btVector3* normals,
|
||||
const btScalar* offsets,
|
||||
int count,
|
||||
DBVT_IPOLICY);
|
||||
DBVT_PREFIX
|
||||
static void collideOCL( const Node* root,
|
||||
static void collideOCL( const btDbvtNode* root,
|
||||
const btVector3* normals,
|
||||
const btScalar* offsets,
|
||||
const btVector3& sortaxis,
|
||||
@@ -272,7 +281,7 @@ struct btDbvt
|
||||
DBVT_IPOLICY,
|
||||
bool fullsort=true);
|
||||
DBVT_PREFIX
|
||||
static void collideTU( const Node* root,
|
||||
static void collideTU( const btDbvtNode* root,
|
||||
DBVT_IPOLICY);
|
||||
// Helpers
|
||||
static inline int nearest(const int* i,const btDbvt::sStkNPS* a,btScalar v,int l,int h)
|
||||
@@ -286,8 +295,8 @@ struct btDbvt
|
||||
return(h);
|
||||
}
|
||||
static inline int allocate( btAlignedObjectArray<int>& ifree,
|
||||
btAlignedObjectArray<btDbvt::sStkNPS>& stock,
|
||||
const btDbvt::sStkNPS& value)
|
||||
btAlignedObjectArray<sStkNPS>& stock,
|
||||
const sStkNPS& value)
|
||||
{
|
||||
int i;
|
||||
if(ifree.size()>0)
|
||||
@@ -528,7 +537,7 @@ return( (a.mi.x()!=b.mi.x())||
|
||||
|
||||
//
|
||||
DBVT_PREFIX
|
||||
inline void btDbvt::enumNodes( const Node* root,
|
||||
inline void btDbvt::enumNodes( const btDbvtNode* root,
|
||||
DBVT_IPOLICY)
|
||||
{
|
||||
DBVT_CHECKTYPE
|
||||
@@ -542,7 +551,7 @@ if(root->isinternal())
|
||||
|
||||
//
|
||||
DBVT_PREFIX
|
||||
inline void btDbvt::enumLeaves( const Node* root,
|
||||
inline void btDbvt::enumLeaves( const btDbvtNode* root,
|
||||
DBVT_IPOLICY)
|
||||
{
|
||||
DBVT_CHECKTYPE
|
||||
@@ -559,8 +568,8 @@ if(root->isinternal())
|
||||
|
||||
//
|
||||
DBVT_PREFIX
|
||||
inline void btDbvt::collideTT( const Node* root0,
|
||||
const Node* root1,
|
||||
inline void btDbvt::collideTT( const btDbvtNode* root0,
|
||||
const btDbvtNode* root1,
|
||||
DBVT_IPOLICY)
|
||||
{
|
||||
DBVT_CHECKTYPE
|
||||
@@ -617,8 +626,8 @@ if(root0&&root1)
|
||||
|
||||
//
|
||||
DBVT_PREFIX
|
||||
inline void btDbvt::collideTT( const Node* root0,
|
||||
const Node* root1,
|
||||
inline void btDbvt::collideTT( const btDbvtNode* root0,
|
||||
const btDbvtNode* root1,
|
||||
const btTransform& xform,
|
||||
DBVT_IPOLICY)
|
||||
{
|
||||
@@ -667,9 +676,9 @@ if(root0&&root1)
|
||||
|
||||
//
|
||||
DBVT_PREFIX
|
||||
inline void btDbvt::collideTT( const Node* root0,
|
||||
inline void btDbvt::collideTT( const btDbvtNode* root0,
|
||||
const btTransform& xform0,
|
||||
const Node* root1,
|
||||
const btDbvtNode* root1,
|
||||
const btTransform& xform1,
|
||||
DBVT_IPOLICY)
|
||||
{
|
||||
@@ -679,18 +688,18 @@ collideTT(root0,root1,xform,policy);
|
||||
|
||||
//
|
||||
DBVT_PREFIX
|
||||
inline void btDbvt::collideTV( const Node* root,
|
||||
const Volume& volume,
|
||||
inline void btDbvt::collideTV( const btDbvtNode* root,
|
||||
const btDbvtVolume& volume,
|
||||
DBVT_IPOLICY)
|
||||
{
|
||||
DBVT_CHECKTYPE
|
||||
if(root)
|
||||
{
|
||||
btAlignedObjectArray<const Node*> stack;
|
||||
btAlignedObjectArray<const btDbvtNode*> stack;
|
||||
stack.reserve(SIMPLE_STACKSIZE);
|
||||
stack.push_back(root);
|
||||
do {
|
||||
const Node* n=stack[stack.size()-1];
|
||||
const btDbvtNode* n=stack[stack.size()-1];
|
||||
stack.pop_back();
|
||||
if(Intersect(n->volume,volume))
|
||||
{
|
||||
@@ -710,7 +719,7 @@ if(root)
|
||||
|
||||
//
|
||||
DBVT_PREFIX
|
||||
inline void btDbvt::collideRAY( const Node* root,
|
||||
inline void btDbvt::collideRAY( const btDbvtNode* root,
|
||||
const btVector3& origin,
|
||||
const btVector3& direction,
|
||||
DBVT_IPOLICY)
|
||||
@@ -725,11 +734,11 @@ if(root)
|
||||
const unsigned signs[]={ direction.x()<0,
|
||||
direction.y()<0,
|
||||
direction.z()<0};
|
||||
btAlignedObjectArray<const Node*> stack;
|
||||
btAlignedObjectArray<const btDbvtNode*> stack;
|
||||
stack.reserve(SIMPLE_STACKSIZE);
|
||||
stack.push_back(root);
|
||||
do {
|
||||
const Node* node=stack[stack.size()-1];
|
||||
const btDbvtNode* node=stack[stack.size()-1];
|
||||
stack.pop_back();
|
||||
if(Intersect(node->volume,origin,invdir,signs))
|
||||
{
|
||||
@@ -749,7 +758,7 @@ if(root)
|
||||
|
||||
//
|
||||
DBVT_PREFIX
|
||||
inline void btDbvt::collideKDOP(const Node* root,
|
||||
inline void btDbvt::collideKDOP(const btDbvtNode* root,
|
||||
const btVector3* normals,
|
||||
const btScalar* offsets,
|
||||
int count,
|
||||
@@ -804,7 +813,7 @@ if(root)
|
||||
|
||||
//
|
||||
DBVT_PREFIX
|
||||
inline void btDbvt::collideOCL( const Node* root,
|
||||
inline void btDbvt::collideOCL( const btDbvtNode* root,
|
||||
const btVector3* normals,
|
||||
const btScalar* offsets,
|
||||
const btVector3& sortaxis,
|
||||
@@ -859,7 +868,7 @@ if(root)
|
||||
{
|
||||
if(se.node->isinternal())
|
||||
{
|
||||
const Node* pns[]={ se.node->childs[0],se.node->childs[1]};
|
||||
const btDbvtNode* pns[]={ se.node->childs[0],se.node->childs[1]};
|
||||
sStkNPS nes[]={ sStkNPS(pns[0],se.mask,pns[0]->volume.ProjectMinimum(sortaxis,srtsgns)),
|
||||
sStkNPS(pns[1],se.mask,pns[1]->volume.ProjectMinimum(sortaxis,srtsgns))};
|
||||
const int q=nes[0].value<nes[1].value?1:0;
|
||||
@@ -902,17 +911,17 @@ if(root)
|
||||
|
||||
//
|
||||
DBVT_PREFIX
|
||||
inline void btDbvt::collideTU( const Node* root,
|
||||
inline void btDbvt::collideTU( const btDbvtNode* root,
|
||||
DBVT_IPOLICY)
|
||||
{
|
||||
DBVT_CHECKTYPE
|
||||
if(root)
|
||||
{
|
||||
btAlignedObjectArray<const Node*> stack;
|
||||
btAlignedObjectArray<const btDbvtNode*> stack;
|
||||
stack.reserve(SIMPLE_STACKSIZE);
|
||||
stack.push_back(root);
|
||||
do {
|
||||
const Node* n=stack[stack.size()-1];
|
||||
const btDbvtNode* n=stack[stack.size()-1];
|
||||
stack.pop_back();
|
||||
if(policy.Descent(n))
|
||||
{
|
||||
|
||||
@@ -92,9 +92,9 @@ struct btDbvtLeafCollider : btDbvt::ICollide
|
||||
btDbvtBroadphase* pbp;
|
||||
btDbvtProxy* ppx;
|
||||
btDbvtLeafCollider(btDbvtBroadphase* p,btDbvtProxy* px) : pbp(p),ppx(px) {}
|
||||
void Process(const btDbvt::Node* na)
|
||||
void Process(const btDbvtNode* na)
|
||||
{
|
||||
const btDbvt::Node* nb=ppx->leaf;
|
||||
const btDbvtNode* nb=ppx->leaf;
|
||||
if(nb!=na)
|
||||
{
|
||||
btDbvtProxy* pa=(btDbvtProxy*)na->data;
|
||||
@@ -115,7 +115,7 @@ struct btDbvtTreeCollider : btDbvt::ICollide
|
||||
{
|
||||
btDbvtBroadphase* pbp;
|
||||
btDbvtTreeCollider(btDbvtBroadphase* p) : pbp(p) {}
|
||||
void Process(const btDbvt::Node* na,const btDbvt::Node* nb)
|
||||
void Process(const btDbvtNode* na,const btDbvtNode* nb)
|
||||
{
|
||||
btDbvtProxy* pa=(btDbvtProxy*)na->data;
|
||||
btDbvtProxy* pb=(btDbvtProxy*)nb->data;
|
||||
|
||||
@@ -39,7 +39,7 @@ struct btDbvtProxy : btBroadphaseProxy
|
||||
{
|
||||
/* Fields */
|
||||
btDbvtAabbMm aabb;
|
||||
btDbvt::Node* leaf;
|
||||
btDbvtNode* leaf;
|
||||
btDbvtProxy* links[2];
|
||||
int stage;
|
||||
/* ctor */
|
||||
|
||||
@@ -209,8 +209,9 @@ void btMultiSapBroadphase::setAabb(btBroadphaseProxy* proxy,const btVector3& aab
|
||||
|
||||
|
||||
m_optimizedAabbTree->reportAabbOverlappingNodex(&myNodeCallback,aabbMin,aabbMax);
|
||||
int i;
|
||||
|
||||
for (int i=0;i<multiProxy->m_bridgeProxies.size();i++)
|
||||
for ( i=0;i<multiProxy->m_bridgeProxies.size();i++)
|
||||
{
|
||||
btVector3 worldAabbMin,worldAabbMax;
|
||||
multiProxy->m_bridgeProxies[i]->m_childBroadphase->getBroadphaseAabb(worldAabbMin,worldAabbMax);
|
||||
@@ -307,7 +308,7 @@ void btMultiSapBroadphase::setAabb(btBroadphaseProxy* proxy,const btVector3& aab
|
||||
|
||||
|
||||
//update
|
||||
for (int i=0;i<multiProxy->m_bridgeProxies.size();i++)
|
||||
for ( i=0;i<multiProxy->m_bridgeProxies.size();i++)
|
||||
{
|
||||
btBridgeProxy* bridgeProxyRef = multiProxy->m_bridgeProxies[i];
|
||||
bridgeProxyRef->m_childBroadphase->setAabb(bridgeProxyRef->m_childProxy,aabbMin,aabbMax,dispatcher);
|
||||
|
||||
@@ -83,7 +83,6 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
void addToChildBroadphase(btMultiSapProxy* parentMultiSapProxy, btBroadphaseProxy* childProxy, btBroadphaseInterface* childBroadphase);
|
||||
|
||||
btAlignedObjectArray<btMultiSapProxy*> m_multiSapProxies;
|
||||
|
||||
@@ -107,7 +106,9 @@ public:
|
||||
virtual btBroadphaseProxy* createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask, btDispatcher* dispatcher,void* multiSapProxy);
|
||||
virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher);
|
||||
virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax, btDispatcher* dispatcher);
|
||||
|
||||
|
||||
void addToChildBroadphase(btMultiSapProxy* parentMultiSapProxy, btBroadphaseProxy* childProxy, btBroadphaseInterface* childBroadphase);
|
||||
|
||||
///calculateOverlappingPairs is optional: incremental algorithms (sweep and prune) might do it during the set aabb
|
||||
virtual void calculateOverlappingPairs(btDispatcher* dispatcher);
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ static int intersectRectQuad2 (btScalar h[2], btScalar p[8], btScalar ret[16])
|
||||
return nr;
|
||||
}
|
||||
|
||||
#define dAtan2(y,x) ((float)atan2f((y),(x))) /* arc tangent with 2 args */
|
||||
|
||||
#define M__PI 3.14159265f
|
||||
|
||||
// given n points in the plane (array p, of size 2*n), generate m points that
|
||||
@@ -214,7 +214,7 @@ void cullPoints2 (int n, btScalar p[], int m, int i0, int iret[])
|
||||
|
||||
// compute the angle of each point w.r.t. the centroid
|
||||
btScalar A[8];
|
||||
for (i=0; i<n; i++) A[i] = dAtan2(p[i*2+1]-cy,p[i*2]-cx);
|
||||
for (i=0; i<n; i++) A[i] = btAtan2(p[i*2+1]-cy,p[i*2]-cx);
|
||||
|
||||
// search for points that have angles closest to A[i0] + i*(2*pi/m).
|
||||
int avail[8];
|
||||
@@ -231,7 +231,7 @@ void cullPoints2 (int n, btScalar p[], int m, int i0, int iret[])
|
||||
#endif
|
||||
for (i=0; i<n; i++) {
|
||||
if (avail[i]) {
|
||||
diff = fabsf (A[i]-a);
|
||||
diff = btFabs (A[i]-a);
|
||||
if (diff > M__PI) diff = 2*M__PI - diff;
|
||||
if (diff < maxdiff) {
|
||||
maxdiff = diff;
|
||||
@@ -284,9 +284,9 @@ int dBoxBox2 (const btVector3& p1, const dMatrix3 R1,
|
||||
R21 = dDOT44(R1+1,R2+0); R22 = dDOT44(R1+1,R2+1); R23 = dDOT44(R1+1,R2+2);
|
||||
R31 = dDOT44(R1+2,R2+0); R32 = dDOT44(R1+2,R2+1); R33 = dDOT44(R1+2,R2+2);
|
||||
|
||||
Q11 = fabsf(R11); Q12 = fabsf(R12); Q13 = fabsf(R13);
|
||||
Q21 = fabsf(R21); Q22 = fabsf(R22); Q23 = fabsf(R23);
|
||||
Q31 = fabsf(R31); Q32 = fabsf(R32); Q33 = fabsf(R33);
|
||||
Q11 = btFabs(R11); Q12 = btFabs(R12); Q13 = btFabs(R13);
|
||||
Q21 = btFabs(R21); Q22 = btFabs(R22); Q23 = btFabs(R23);
|
||||
Q31 = btFabs(R31); Q32 = btFabs(R32); Q33 = btFabs(R33);
|
||||
|
||||
// for all 15 possible separating axes:
|
||||
// * see if the axis separates the boxes. if so, return 0.
|
||||
@@ -299,7 +299,7 @@ int dBoxBox2 (const btVector3& p1, const dMatrix3 R1,
|
||||
// the normal should be flipped.
|
||||
|
||||
#define TST(expr1,expr2,norm,cc) \
|
||||
s2 = fabsf(expr1) - (expr2); \
|
||||
s2 = btFabs(expr1) - (expr2); \
|
||||
if (s2 > 0) return 0; \
|
||||
if (s2 > s) { \
|
||||
s = s2; \
|
||||
@@ -326,9 +326,9 @@ int dBoxBox2 (const btVector3& p1, const dMatrix3 R1,
|
||||
// normal (n1,n2,n3) is relative to box 1.
|
||||
#undef TST
|
||||
#define TST(expr1,expr2,n1,n2,n3,cc) \
|
||||
s2 = fabsf(expr1) - (expr2); \
|
||||
s2 = btFabs(expr1) - (expr2); \
|
||||
if (s2 > 0) return 0; \
|
||||
l = sqrtf((n1)*(n1) + (n2)*(n2) + (n3)*(n3)); \
|
||||
l = btSqrt((n1)*(n1) + (n2)*(n2) + (n3)*(n3)); \
|
||||
if (l > 0) { \
|
||||
s2 /= l; \
|
||||
if (s2*fudge_factor > s) { \
|
||||
@@ -461,9 +461,9 @@ int dBoxBox2 (const btVector3& p1, const dMatrix3 R1,
|
||||
normal2[2] = -normal[2];
|
||||
}
|
||||
dMULTIPLY1_331 (nr,Rb,normal2);
|
||||
anr[0] = fabsf (nr[0]);
|
||||
anr[1] = fabsf (nr[1]);
|
||||
anr[2] = fabsf (nr[2]);
|
||||
anr[0] = btFabs (nr[0]);
|
||||
anr[1] = btFabs (nr[1]);
|
||||
anr[2] = btFabs (nr[2]);
|
||||
|
||||
// find the largest compontent of anr: this corresponds to the normal
|
||||
// for the indident face. the other axis numbers of the indicent face
|
||||
|
||||
@@ -283,7 +283,7 @@ void* btCollisionDispatcher::allocateCollisionAlgorithm(int size)
|
||||
}
|
||||
|
||||
//warn user for overflow?
|
||||
return btAlignedAlloc(static_cast<std::size_t>(size), 16);
|
||||
return btAlignedAlloc(static_cast<size_t>(size), 16);
|
||||
}
|
||||
|
||||
void btCollisionDispatcher::freeCollisionAlgorithm(void* ptr)
|
||||
|
||||
@@ -99,6 +99,7 @@ struct MinkowskiDiff
|
||||
|
||||
typedef MinkowskiDiff tShape;
|
||||
|
||||
|
||||
// GJK
|
||||
struct GJK
|
||||
{
|
||||
@@ -515,6 +516,30 @@ sList m_stock;
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
|
||||
static inline void bind(sFace* fa,U ea,sFace* fb,U eb)
|
||||
{
|
||||
fa->e[ea]=(U1)eb;fa->f[ea]=fb;
|
||||
fb->e[eb]=(U1)ea;fb->f[eb]=fa;
|
||||
}
|
||||
static inline void append(sList& list,sFace* face)
|
||||
{
|
||||
face->l[0] = 0;
|
||||
face->l[1] = list.root;
|
||||
if(list.root) list.root->l[0]=face;
|
||||
list.root = face;
|
||||
++list.count;
|
||||
}
|
||||
static inline void remove(sList& list,sFace* face)
|
||||
{
|
||||
if(face->l[1]) face->l[1]->l[0]=face->l[0];
|
||||
if(face->l[0]) face->l[0]->l[1]=face->l[1];
|
||||
if(face==list.root) list.root=face->l[1];
|
||||
--list.count;
|
||||
}
|
||||
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
m_status = eStatus::Failed;
|
||||
@@ -531,10 +556,11 @@ eStatus::_ Evaluate(GJK& gjk,const btVector3& guess)
|
||||
GJK::sSimplex& simplex=*gjk.m_simplex;
|
||||
if((simplex.rank>1)&&gjk.EncloseOrigin())
|
||||
{
|
||||
|
||||
/* Clean up */
|
||||
while(m_hull.root)
|
||||
{
|
||||
sFace* f(m_hull.root);
|
||||
sFace* f = m_hull.root;
|
||||
remove(m_hull,f);
|
||||
append(m_stock,f);
|
||||
}
|
||||
@@ -716,26 +742,7 @@ bool expand(U pass,sSV* w,sFace* f,U e,sHorizon& horizon)
|
||||
}
|
||||
return(false);
|
||||
}
|
||||
static inline void bind(sFace* fa,U ea,sFace* fb,U eb)
|
||||
{
|
||||
fa->e[ea]=(U1)eb;fa->f[ea]=fb;
|
||||
fb->e[eb]=(U1)ea;fb->f[eb]=fa;
|
||||
}
|
||||
static inline void append(sList& list,sFace* face)
|
||||
{
|
||||
face->l[0] = 0;
|
||||
face->l[1] = list.root;
|
||||
if(list.root) list.root->l[0]=face;
|
||||
list.root = face;
|
||||
++list.count;
|
||||
}
|
||||
static inline void remove(sList& list,sFace* face)
|
||||
{
|
||||
if(face->l[1]) face->l[1]->l[0]=face->l[0];
|
||||
if(face->l[0]) face->l[0]->l[1]=face->l[1];
|
||||
if(face==list.root) list.root=face->l[1];
|
||||
--list.count;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
@@ -131,8 +131,8 @@ typedef btScalar *dRealMutablePtr;
|
||||
//#define dRealAllocaArray(name,size) btScalar *name = (btScalar*) stackAlloc->allocate(dEFFICIENT_SIZE(size)*sizeof(btScalar));
|
||||
#define dRealAllocaArray(name,size) btScalar *name = NULL; \
|
||||
unsigned int memNeeded_##name = dEFFICIENT_SIZE(size)*sizeof(btScalar); \
|
||||
if (memNeeded_##name < static_cast<std::size_t>(stackAlloc->getAvailableMemory())) name = (btScalar*) stackAlloc->allocate(memNeeded_##name); \
|
||||
else{ btAssert(memNeeded_##name < static_cast<std::size_t>(stackAlloc->getAvailableMemory())); name = (btScalar*) alloca(memNeeded_##name); }
|
||||
if (memNeeded_##name < static_cast<size_t>(stackAlloc->getAvailableMemory())) name = (btScalar*) stackAlloc->allocate(memNeeded_##name); \
|
||||
else{ btAssert(memNeeded_##name < static_cast<size_t>(stackAlloc->getAvailableMemory())); name = (btScalar*) alloca(memNeeded_##name); }
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -716,7 +716,7 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(btCol
|
||||
|
||||
rel_vel = cp.m_normalWorldOnB.dot(vel);
|
||||
|
||||
solverConstraint.m_penetration = btMin(cp.getDistance()+infoGlobal.m_linearSlop,0.f);
|
||||
solverConstraint.m_penetration = btMin(cp.getDistance()+infoGlobal.m_linearSlop,btScalar(0.));
|
||||
//solverConstraint.m_penetration = cp.getDistance();
|
||||
|
||||
solverConstraint.m_friction = cp.m_combinedFriction;
|
||||
|
||||
@@ -421,19 +421,21 @@ static void PointersToIndices(btSoftBody* psb)
|
||||
{
|
||||
#define PTR2IDX(_p_,_b_) reinterpret_cast<btSoftBody::Node*>((_p_)-(_b_))
|
||||
btSoftBody::Node* base=&psb->m_nodes[0];
|
||||
for(int i=0,ni=psb->m_nodes.size();i<ni;++i)
|
||||
int i,ni;
|
||||
|
||||
for(i=0,ni=psb->m_nodes.size();i<ni;++i)
|
||||
{
|
||||
if(psb->m_nodes[i].m_leaf)
|
||||
{
|
||||
psb->m_nodes[i].m_leaf->data=*(void**)&i;
|
||||
}
|
||||
}
|
||||
for(int i=0,ni=psb->m_links.size();i<ni;++i)
|
||||
for(i=0,ni=psb->m_links.size();i<ni;++i)
|
||||
{
|
||||
psb->m_links[i].m_n[0]=PTR2IDX(psb->m_links[i].m_n[0],base);
|
||||
psb->m_links[i].m_n[1]=PTR2IDX(psb->m_links[i].m_n[1],base);
|
||||
}
|
||||
for(int i=0,ni=psb->m_faces.size();i<ni;++i)
|
||||
for(i=0,ni=psb->m_faces.size();i<ni;++i)
|
||||
{
|
||||
psb->m_faces[i].m_n[0]=PTR2IDX(psb->m_faces[i].m_n[0],base);
|
||||
psb->m_faces[i].m_n[1]=PTR2IDX(psb->m_faces[i].m_n[1],base);
|
||||
@@ -443,11 +445,11 @@ static void PointersToIndices(btSoftBody* psb)
|
||||
psb->m_faces[i].m_leaf->data=*(void**)&i;
|
||||
}
|
||||
}
|
||||
for(int i=0,ni=psb->m_anchors.size();i<ni;++i)
|
||||
for(i=0,ni=psb->m_anchors.size();i<ni;++i)
|
||||
{
|
||||
psb->m_anchors[i].m_node=PTR2IDX(psb->m_anchors[i].m_node,base);
|
||||
}
|
||||
for(int i=0,ni=psb->m_notes.size();i<ni;++i)
|
||||
for(i=0,ni=psb->m_notes.size();i<ni;++i)
|
||||
{
|
||||
for(int j=0;j<psb->m_notes[i].m_rank;++j)
|
||||
{
|
||||
@@ -463,19 +465,21 @@ static void IndicesToPointers(btSoftBody* psb,const int* map=0)
|
||||
#define IDX2PTR(_p_,_b_) map?(&(_b_)[map[(((char*)_p_)-(char*)0)]]): \
|
||||
(&(_b_)[(((char*)_p_)-(char*)0)])
|
||||
btSoftBody::Node* base=&psb->m_nodes[0];
|
||||
for(int i=0,ni=psb->m_nodes.size();i<ni;++i)
|
||||
int i,ni;
|
||||
|
||||
for(i=0,ni=psb->m_nodes.size();i<ni;++i)
|
||||
{
|
||||
if(psb->m_nodes[i].m_leaf)
|
||||
{
|
||||
psb->m_nodes[i].m_leaf->data=&psb->m_nodes[i];
|
||||
}
|
||||
}
|
||||
for(int i=0,ni=psb->m_links.size();i<ni;++i)
|
||||
for(i=0,ni=psb->m_links.size();i<ni;++i)
|
||||
{
|
||||
psb->m_links[i].m_n[0]=IDX2PTR(psb->m_links[i].m_n[0],base);
|
||||
psb->m_links[i].m_n[1]=IDX2PTR(psb->m_links[i].m_n[1],base);
|
||||
}
|
||||
for(int i=0,ni=psb->m_faces.size();i<ni;++i)
|
||||
for(i=0,ni=psb->m_faces.size();i<ni;++i)
|
||||
{
|
||||
psb->m_faces[i].m_n[0]=IDX2PTR(psb->m_faces[i].m_n[0],base);
|
||||
psb->m_faces[i].m_n[1]=IDX2PTR(psb->m_faces[i].m_n[1],base);
|
||||
@@ -485,11 +489,11 @@ static void IndicesToPointers(btSoftBody* psb,const int* map=0)
|
||||
psb->m_faces[i].m_leaf->data=&psb->m_faces[i];
|
||||
}
|
||||
}
|
||||
for(int i=0,ni=psb->m_anchors.size();i<ni;++i)
|
||||
for(i=0,ni=psb->m_anchors.size();i<ni;++i)
|
||||
{
|
||||
psb->m_anchors[i].m_node=IDX2PTR(psb->m_anchors[i].m_node,base);
|
||||
}
|
||||
for(int i=0,ni=psb->m_notes.size();i<ni;++i)
|
||||
for(i=0,ni=psb->m_notes.size();i<ni;++i)
|
||||
{
|
||||
for(int j=0;j<psb->m_notes[i].m_rank;++j)
|
||||
{
|
||||
@@ -500,13 +504,13 @@ static void IndicesToPointers(btSoftBody* psb,const int* map=0)
|
||||
}
|
||||
|
||||
//
|
||||
static inline btDbvt::Volume VolumeOf( const btSoftBody::Face& f,
|
||||
static inline btDbvtVolume VolumeOf( const btSoftBody::Face& f,
|
||||
btScalar margin)
|
||||
{
|
||||
const btVector3* pts[]={ &f.m_n[0]->m_x,
|
||||
&f.m_n[1]->m_x,
|
||||
&f.m_n[2]->m_x};
|
||||
btDbvt::Volume vol=btDbvt::Volume::FromPoints(pts,3);
|
||||
btDbvtVolume vol=btDbvtVolume::FromPoints(pts,3);
|
||||
vol.Expand(btVector3(margin,margin,margin));
|
||||
return(vol);
|
||||
}
|
||||
@@ -585,7 +589,7 @@ struct RayCaster : btDbvt::ICollide
|
||||
face = 0;
|
||||
tests = 0;
|
||||
}
|
||||
void Process(const btDbvt::Node* leaf)
|
||||
void Process(const btDbvtNode* leaf)
|
||||
{
|
||||
btSoftBody::Face& f=*(btSoftBody::Face*)leaf->data;
|
||||
const btScalar t=RayTriangle( o,d,
|
||||
@@ -723,11 +727,13 @@ static bool CheckContact( btSoftBody* psb,
|
||||
static void UpdateNormals(btSoftBody* psb)
|
||||
{
|
||||
const btVector3 zv(0,0,0);
|
||||
for(int i=0,ni=psb->m_nodes.size();i<ni;++i)
|
||||
int i,ni;
|
||||
|
||||
for(i=0,ni=psb->m_nodes.size();i<ni;++i)
|
||||
{
|
||||
psb->m_nodes[i].m_n=zv;
|
||||
}
|
||||
for(int i=0,ni=psb->m_faces.size();i<ni;++i)
|
||||
for(i=0,ni=psb->m_faces.size();i<ni;++i)
|
||||
{
|
||||
btSoftBody::Face& f=psb->m_faces[i];
|
||||
const btVector3 n=cross(f.m_n[1]->m_x-f.m_n[0]->m_x,
|
||||
@@ -737,7 +743,7 @@ static void UpdateNormals(btSoftBody* psb)
|
||||
f.m_n[1]->m_n+=n;
|
||||
f.m_n[2]->m_n+=n;
|
||||
}
|
||||
for(int i=0,ni=psb->m_nodes.size();i<ni;++i)
|
||||
for(i=0,ni=psb->m_nodes.size();i<ni;++i)
|
||||
{
|
||||
psb->m_nodes[i].m_n.normalize();
|
||||
}
|
||||
@@ -811,8 +817,10 @@ static void UpdatePose(btSoftBody* psb)
|
||||
//
|
||||
static void UpdateConstants(btSoftBody* psb)
|
||||
{
|
||||
int i,ni;
|
||||
|
||||
/* Links */
|
||||
for(int i=0,ni=psb->m_links.size();i<ni;++i)
|
||||
for(i=0,ni=psb->m_links.size();i<ni;++i)
|
||||
{
|
||||
btSoftBody::Link& l=psb->m_links[i];
|
||||
btSoftBody::Material& m=*l.m_material;
|
||||
@@ -821,7 +829,7 @@ static void UpdateConstants(btSoftBody* psb)
|
||||
l.m_c1 = l.m_rl*l.m_rl;
|
||||
}
|
||||
/* Faces */
|
||||
for(int i=0,ni=psb->m_faces.size();i<ni;++i)
|
||||
for(i=0,ni=psb->m_faces.size();i<ni;++i)
|
||||
{
|
||||
btSoftBody::Face& f=psb->m_faces[i];
|
||||
f.m_ra = AreaOf(f.m_n[0]->m_x,f.m_n[1]->m_x,f.m_n[2]->m_x);
|
||||
@@ -829,11 +837,11 @@ static void UpdateConstants(btSoftBody* psb)
|
||||
/* Area's */
|
||||
btAlignedObjectArray<int> counts;
|
||||
counts.resize(psb->m_nodes.size(),0);
|
||||
for(int i=0,ni=psb->m_nodes.size();i<ni;++i)
|
||||
for(i=0,ni=psb->m_nodes.size();i<ni;++i)
|
||||
{
|
||||
psb->m_nodes[i].m_area = 0;
|
||||
}
|
||||
for(int i=0,ni=psb->m_faces.size();i<ni;++i)
|
||||
for(i=0,ni=psb->m_faces.size();i<ni;++i)
|
||||
{
|
||||
btSoftBody::Face& f=psb->m_faces[i];
|
||||
for(int j=0;j<3;++j)
|
||||
@@ -843,7 +851,7 @@ static void UpdateConstants(btSoftBody* psb)
|
||||
f.m_n[j]->m_area+=btFabs(f.m_ra);
|
||||
}
|
||||
}
|
||||
for(int i=0,ni=psb->m_nodes.size();i<ni;++i)
|
||||
for(i=0,ni=psb->m_nodes.size();i<ni;++i)
|
||||
{
|
||||
if(counts[i]>0)
|
||||
psb->m_nodes[i].m_area/=(btScalar)counts[i];
|
||||
@@ -872,6 +880,7 @@ static inline void ApplyClampedForce( btSoftBody::Node& n,
|
||||
static void ApplyForces(btSoftBody* psb,btScalar dt)
|
||||
{
|
||||
BT_PROFILE("SoftBody applyForces");
|
||||
int i,ni;
|
||||
const btScalar kLF=psb->m_cfg.kLF;
|
||||
const btScalar kDG=psb->m_cfg.kDG;
|
||||
const btScalar kPR=psb->m_cfg.kPR;
|
||||
@@ -900,7 +909,7 @@ static void ApplyForces(btSoftBody* psb,btScalar dt)
|
||||
dvolumetv = (psb->m_pose.m_volume-volume)*kVC;
|
||||
}
|
||||
/* Per vertex forces */
|
||||
for(int i=0,ni=psb->m_nodes.size();i<ni;++i)
|
||||
for(i=0,ni=psb->m_nodes.size();i<ni;++i)
|
||||
{
|
||||
btSoftBody::Node& n=psb->m_nodes[i];
|
||||
if(n.m_im>0)
|
||||
@@ -951,7 +960,7 @@ static void ApplyForces(btSoftBody* psb,btScalar dt)
|
||||
}
|
||||
}
|
||||
/* Per face forces */
|
||||
for(int i=0,ni=psb->m_faces.size();i<ni;++i)
|
||||
for(i=0,ni=psb->m_faces.size();i<ni;++i)
|
||||
{
|
||||
btSoftBody::Face& f=psb->m_faces[i];
|
||||
if(as_faero)
|
||||
@@ -1171,7 +1180,7 @@ btSoftBody::btSoftBody(btSoftBody::btSoftBodyWorldInfo* worldInfo,int node_count
|
||||
n.m_q = n.m_x;
|
||||
n.m_im = m?*m++:1;
|
||||
n.m_im = n.m_im>0?1/n.m_im:0;
|
||||
n.m_leaf = m_ndbvt.insert(btDbvt::Volume::FromCR(n.m_x,margin),&n);
|
||||
n.m_leaf = m_ndbvt.insert(btDbvtVolume::FromCR(n.m_x,margin),&n);
|
||||
n.m_material= pm;
|
||||
}
|
||||
UpdateBounds(this);
|
||||
@@ -1313,7 +1322,7 @@ n.m_x = x;
|
||||
n.m_q = n.m_x;
|
||||
n.m_im = m>0?1/m:0;
|
||||
n.m_material = m_materials[0];
|
||||
n.m_leaf = m_ndbvt.insert(btDbvt::Volume::FromCR(n.m_x,margin),&n);
|
||||
n.m_leaf = m_ndbvt.insert(btDbvtVolume::FromCR(n.m_x,margin),&n);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1448,13 +1457,16 @@ btScalar btSoftBody::getTotalMass() const
|
||||
//
|
||||
void btSoftBody::setTotalMass(btScalar mass,bool fromfaces)
|
||||
{
|
||||
int i;
|
||||
if(fromfaces)
|
||||
{
|
||||
for(int i=0;i<m_nodes.size();++i)
|
||||
|
||||
|
||||
for(i=0;i<m_nodes.size();++i)
|
||||
{
|
||||
m_nodes[i].m_im=0;
|
||||
}
|
||||
for(int i=0;i<m_faces.size();++i)
|
||||
for(i=0;i<m_faces.size();++i)
|
||||
{
|
||||
const Face& f=m_faces[i];
|
||||
const btScalar twicearea=AreaOf( f.m_n[0]->m_x,
|
||||
@@ -1465,14 +1477,14 @@ void btSoftBody::setTotalMass(btScalar mass,bool fromfaces)
|
||||
f.m_n[j]->m_im+=twicearea;
|
||||
}
|
||||
}
|
||||
for(int i=0;i<m_nodes.size();++i)
|
||||
for(i=0;i<m_nodes.size();++i)
|
||||
{
|
||||
m_nodes[i].m_im=1/m_nodes[i].m_im;
|
||||
}
|
||||
}
|
||||
const btScalar tm=getTotalMass();
|
||||
const btScalar itm=1/tm;
|
||||
for(int i=0;i<m_nodes.size();++i)
|
||||
for( i=0;i<m_nodes.size();++i)
|
||||
{
|
||||
m_nodes[i].m_im/=itm*mass;
|
||||
}
|
||||
@@ -1495,7 +1507,7 @@ void btSoftBody::transform(const btTransform& trs)
|
||||
n.m_x=trs*n.m_x;
|
||||
n.m_q=trs*n.m_q;
|
||||
n.m_n=trs.getBasis()*n.m_n;
|
||||
m_ndbvt.update(n.m_leaf,btDbvt::Volume::FromCR(n.m_x,margin));
|
||||
m_ndbvt.update(n.m_leaf,btDbvtVolume::FromCR(n.m_x,margin));
|
||||
}
|
||||
UpdateNormals(this);
|
||||
UpdateBounds(this);
|
||||
@@ -1529,7 +1541,7 @@ void btSoftBody::scale(const btVector3& scl)
|
||||
Node& n=m_nodes[i];
|
||||
n.m_x*=scl;
|
||||
n.m_q*=scl;
|
||||
m_ndbvt.update(n.m_leaf,btDbvt::Volume::FromCR(n.m_x,margin));
|
||||
m_ndbvt.update(n.m_leaf,btDbvtVolume::FromCR(n.m_x,margin));
|
||||
}
|
||||
UpdateNormals(this);
|
||||
UpdateBounds(this);
|
||||
@@ -1546,11 +1558,13 @@ void btSoftBody::setPose(bool bvolume,bool bframe)
|
||||
const btScalar kmass=omass*m_nodes.size()*1000;
|
||||
btScalar tmass=omass;
|
||||
m_pose.m_wgh.resize(m_nodes.size());
|
||||
for(int i=0,ni=m_nodes.size();i<ni;++i)
|
||||
int i,ni;
|
||||
|
||||
for(i=0,ni=m_nodes.size();i<ni;++i)
|
||||
{
|
||||
if(m_nodes[i].m_im<=0) tmass+=kmass;
|
||||
}
|
||||
for(int i=0,ni=m_nodes.size();i<ni;++i)
|
||||
for(i=0,ni=m_nodes.size();i<ni;++i)
|
||||
{
|
||||
Node& n=m_nodes[i];
|
||||
m_pose.m_wgh[i]= n.m_im>0 ?
|
||||
@@ -1560,7 +1574,7 @@ void btSoftBody::setPose(bool bvolume,bool bframe)
|
||||
/* Pos */
|
||||
const btVector3 com=EvaluateCom(this);
|
||||
m_pose.m_pos.resize(m_nodes.size());
|
||||
for(int i=0,ni=m_nodes.size();i<ni;++i)
|
||||
for(i=0,ni=m_nodes.size();i<ni;++i)
|
||||
{
|
||||
m_pose.m_pos[i]=m_nodes[i].m_x-com;
|
||||
}
|
||||
@@ -1572,7 +1586,7 @@ void btSoftBody::setPose(bool bvolume,bool bframe)
|
||||
m_pose.m_aqq[0] =
|
||||
m_pose.m_aqq[1] =
|
||||
m_pose.m_aqq[2] = btVector3(0,0,0);
|
||||
for(int i=0,ni=m_nodes.size();i<ni;++i)
|
||||
for(i=0,ni=m_nodes.size();i<ni;++i)
|
||||
{
|
||||
const btVector3& q=m_pose.m_pos[i];
|
||||
const btVector3 mq=m_pose.m_wgh[i]*q;
|
||||
@@ -1611,7 +1625,10 @@ int btSoftBody::generateBendingConstraints(int distance,Material* mat)
|
||||
const unsigned inf=(~(unsigned)0)>>1;
|
||||
unsigned* adj=new unsigned[n*n];
|
||||
#define IDX(_x_,_y_) ((_y_)*n+(_x_))
|
||||
for(int j=0;j<n;++j)
|
||||
|
||||
int i,j;
|
||||
|
||||
for( j=0;j<n;++j)
|
||||
{
|
||||
for(int i=0;i<n;++i)
|
||||
{
|
||||
@@ -1620,7 +1637,7 @@ int btSoftBody::generateBendingConstraints(int distance,Material* mat)
|
||||
adj[IDX(i,j)]=adj[IDX(j,i)]=0;
|
||||
}
|
||||
}
|
||||
for(int i=0;i<m_links.size();++i)
|
||||
for(i=0;i<m_links.size();++i)
|
||||
{
|
||||
const int ia=(int)(m_links[i].m_n[0]-&m_nodes[0]);
|
||||
const int ib=(int)(m_links[i].m_n[1]-&m_nodes[0]);
|
||||
@@ -1629,7 +1646,7 @@ int btSoftBody::generateBendingConstraints(int distance,Material* mat)
|
||||
}
|
||||
for(int k=0;k<n;++k)
|
||||
{
|
||||
for(int j=0;j<n;++j)
|
||||
for(j=0;j<n;++j)
|
||||
{
|
||||
for(int i=j+1;i<n;++i)
|
||||
{
|
||||
@@ -1643,7 +1660,7 @@ int btSoftBody::generateBendingConstraints(int distance,Material* mat)
|
||||
}
|
||||
/* Build links */
|
||||
int nlinks=0;
|
||||
for(int j=0;j<n;++j)
|
||||
for(j=0;j<n;++j)
|
||||
{
|
||||
for(int i=j+1;i<n;++i)
|
||||
{
|
||||
@@ -1666,11 +1683,14 @@ void btSoftBody::randomizeConstraints()
|
||||
{
|
||||
unsigned long seed=243703;
|
||||
#define NEXTRAND (seed=(1664525L*seed+1013904223L)&0xffffffff)
|
||||
for(int i=0,ni=m_links.size();i<ni;++i)
|
||||
int i,ni;
|
||||
|
||||
|
||||
for(i=0,ni=m_links.size();i<ni;++i)
|
||||
{
|
||||
btSwap(m_links[i],m_links[NEXTRAND%ni]);
|
||||
}
|
||||
for(int i=0,ni=m_faces.size();i<ni;++i)
|
||||
for(i=0,ni=m_faces.size();i<ni;++i)
|
||||
{
|
||||
btSwap(m_faces[i],m_faces[NEXTRAND%ni]);
|
||||
}
|
||||
@@ -1680,12 +1700,14 @@ unsigned long seed=243703;
|
||||
//
|
||||
void btSoftBody::refine(ImplicitFn* ifn,btScalar accurary,bool cut)
|
||||
{
|
||||
const Node* nbase(&m_nodes[0]);
|
||||
Node* nbase = &m_nodes[0];
|
||||
int ncount(m_nodes.size());
|
||||
btSymMatrix<int> edges(ncount,-2);
|
||||
int newnodes=0;
|
||||
int i,ni;
|
||||
|
||||
/* Filter out */
|
||||
for(int i=0;i<m_links.size();++i)
|
||||
for(i=0;i<m_links.size();++i)
|
||||
{
|
||||
Link& l=m_links[i];
|
||||
if(l.m_bbending)
|
||||
@@ -1698,12 +1720,12 @@ for(int i=0;i<m_links.size();++i)
|
||||
}
|
||||
}
|
||||
/* Fill edges */
|
||||
for(int i=0;i<m_links.size();++i)
|
||||
for(i=0;i<m_links.size();++i)
|
||||
{
|
||||
Link& l=m_links[i];
|
||||
edges(int(l.m_n[0]-nbase),int(l.m_n[1]-nbase))=-1;
|
||||
}
|
||||
for(int i=0;i<m_faces.size();++i)
|
||||
for(i=0;i<m_faces.size();++i)
|
||||
{
|
||||
Face& f=m_faces[i];
|
||||
edges(int(f.m_n[0]-nbase),int(f.m_n[1]-nbase))=-1;
|
||||
@@ -1711,7 +1733,7 @@ for(int i=0;i<m_faces.size();++i)
|
||||
edges(int(f.m_n[2]-nbase),int(f.m_n[0]-nbase))=-1;
|
||||
}
|
||||
/* Intersect */
|
||||
for(int i=0;i<ncount;++i)
|
||||
for(i=0;i<ncount;++i)
|
||||
{
|
||||
for(int j=i+1;j<ncount;++j)
|
||||
{
|
||||
@@ -1757,7 +1779,7 @@ for(int i=0;i<ncount;++i)
|
||||
}
|
||||
nbase=&m_nodes[0];
|
||||
/* Refine links */
|
||||
for(int i=0,ni=m_links.size();i<ni;++i)
|
||||
for(i=0,ni=m_links.size();i<ni;++i)
|
||||
{
|
||||
Link& feat=m_links[i];
|
||||
const int idx[]={ int(feat.m_n[0]-nbase),
|
||||
@@ -1778,7 +1800,7 @@ for(int i=0,ni=m_links.size();i<ni;++i)
|
||||
}
|
||||
}
|
||||
/* Refine faces */
|
||||
for(int i=0;i<m_faces.size();++i)
|
||||
for(i=0;i<m_faces.size();++i)
|
||||
{
|
||||
const Face& feat=m_faces[i];
|
||||
const int idx[]={ int(feat.m_n[0]-nbase),
|
||||
@@ -1815,7 +1837,7 @@ if(cut)
|
||||
ncount=m_nodes.size();
|
||||
cnodes.resize(ncount,0);
|
||||
/* Nodes */
|
||||
for(int i=0;i<ncount;++i)
|
||||
for(i=0;i<ncount;++i)
|
||||
{
|
||||
const btVector3 x=m_nodes[i].m_x;
|
||||
if((i>=pcount)||(btFabs(ifn->Eval(x))<accurary))
|
||||
@@ -1830,7 +1852,7 @@ if(cut)
|
||||
}
|
||||
nbase=&m_nodes[0];
|
||||
/* Links */
|
||||
for(int i=0,ni=m_links.size();i<ni;++i)
|
||||
for(i=0,ni=m_links.size();i<ni;++i)
|
||||
{
|
||||
const int id[]={ int(m_links[i].m_n[0]-nbase),
|
||||
int(m_links[i].m_n[1]-nbase)};
|
||||
@@ -1857,7 +1879,7 @@ if(cut)
|
||||
}
|
||||
}
|
||||
/* Faces */
|
||||
for(int i=0,ni=m_faces.size();i<ni;++i)
|
||||
for( i=0,ni=m_faces.size();i<ni;++i)
|
||||
{
|
||||
Node** n= m_faces[i].m_n;
|
||||
if( (ifn->Eval(n[0]->m_x)<accurary)&&
|
||||
@@ -1876,15 +1898,15 @@ if(cut)
|
||||
btAlignedObjectArray<int> ranks;
|
||||
btAlignedObjectArray<int> todelete;
|
||||
ranks.resize(nnodes,0);
|
||||
for(int i=0,ni=m_links.size();i<ni;++i)
|
||||
for(i=0,ni=m_links.size();i<ni;++i)
|
||||
{
|
||||
for(int j=0;j<2;++j) ranks[int(m_links[i].m_n[j]-nbase)]++;
|
||||
}
|
||||
for(int i=0,ni=m_faces.size();i<ni;++i)
|
||||
for(i=0,ni=m_faces.size();i<ni;++i)
|
||||
{
|
||||
for(int j=0;j<3;++j) ranks[int(m_faces[i].m_n[j]-nbase)]++;
|
||||
}
|
||||
for(int i=0;i<m_links.size();++i)
|
||||
for(i=0;i<m_links.size();++i)
|
||||
{
|
||||
const int id[]={ int(m_links[i].m_n[0]-nbase),
|
||||
int(m_links[i].m_n[1]-nbase)};
|
||||
@@ -1899,7 +1921,7 @@ if(cut)
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
for(int i=nnodes-1;i>=0;--i)
|
||||
for(i=nnodes-1;i>=0;--i)
|
||||
{
|
||||
if(!ranks[i]) todelete.push_back(i);
|
||||
}
|
||||
@@ -1957,7 +1979,9 @@ Node* pn[2]={ &m_nodes[m_nodes.size()-2],
|
||||
&m_nodes[m_nodes.size()-1]};
|
||||
pn[0]->m_v=v;
|
||||
pn[1]->m_v=v;
|
||||
for(int i=0,ni=m_links.size();i<ni;++i)
|
||||
int i,ni;
|
||||
|
||||
for(i=0,ni=m_links.size();i<ni;++i)
|
||||
{
|
||||
const int mtch=MatchEdge(m_links[i].m_n[0],m_links[i].m_n[1],pa,pb);
|
||||
if(mtch!=-1)
|
||||
@@ -1969,7 +1993,7 @@ for(int i=0,ni=m_links.size();i<ni;++i)
|
||||
done=true;
|
||||
}
|
||||
}
|
||||
for(int i=0,ni=m_faces.size();i<ni;++i)
|
||||
for(i=0,ni=m_faces.size();i<ni;++i)
|
||||
{
|
||||
for(int k=2,l=0;l<3;k=l++)
|
||||
{
|
||||
@@ -2070,7 +2094,7 @@ void btSoftBody::predictMotion(btScalar dt)
|
||||
n.m_v += n.m_f*n.m_im*m_sst.sdt;
|
||||
n.m_x += n.m_v*m_sst.sdt;
|
||||
m_ndbvt.update( n.m_leaf,
|
||||
btDbvt::Volume::FromCR(n.m_x,m_sst.radmrg),
|
||||
btDbvtVolume::FromCR(n.m_x,m_sst.radmrg),
|
||||
n.m_v*m_sst.velmrg,
|
||||
m_sst.updmrg);
|
||||
}
|
||||
@@ -2116,15 +2140,17 @@ void btSoftBody::predictMotion(btScalar dt)
|
||||
//
|
||||
void btSoftBody::solveConstraints()
|
||||
{
|
||||
int i,ni;
|
||||
|
||||
/* Prepare links */
|
||||
for(int i=0,ni=m_links.size();i<ni;++i)
|
||||
for(i=0,ni=m_links.size();i<ni;++i)
|
||||
{
|
||||
Link& l=m_links[i];
|
||||
l.m_c3 = l.m_n[1]->m_x-l.m_n[0]->m_x;
|
||||
l.m_c2 = 1/(l.m_c3.length2()*l.m_c0);
|
||||
}
|
||||
/* Prepare anchors */
|
||||
for(int i=0,ni=m_anchors.size();i<ni;++i)
|
||||
for(i=0,ni=m_anchors.size();i<ni;++i)
|
||||
{
|
||||
Anchor& a=m_anchors[i];
|
||||
const btVector3 ra=a.m_body->getWorldTransform().getBasis()*a.m_local;
|
||||
@@ -2177,7 +2203,7 @@ if(m_cfg.piterations>0)
|
||||
if(m_cfg.diterations>0)
|
||||
{
|
||||
const btScalar vcf=m_cfg.kVCF*m_sst.isdt;
|
||||
for(int i=0,ni=m_nodes.size();i<ni;++i)
|
||||
for(i=0,ni=m_nodes.size();i<ni;++i)
|
||||
{
|
||||
Node& n=m_nodes[i];
|
||||
n.m_q = n.m_x;
|
||||
@@ -2189,7 +2215,7 @@ if(m_cfg.diterations>0)
|
||||
PSolvers[m_cfg.m_dsequence[iseq]](this,1);
|
||||
}
|
||||
}
|
||||
for(int i=0,ni=m_nodes.size();i<ni;++i)
|
||||
for(i=0,ni=m_nodes.size();i<ni;++i)
|
||||
{
|
||||
Node& n=m_nodes[i];
|
||||
n.m_v += (n.m_x-n.m_q)*vcf;
|
||||
@@ -2231,15 +2257,15 @@ switch(m_cfg.collisions&fCollision::RVSmask)
|
||||
{
|
||||
struct DoCollide : btDbvt::ICollide
|
||||
{
|
||||
void Process(const btDbvt::Node* leaf)
|
||||
void Process(const btDbvtNode* leaf)
|
||||
{
|
||||
Node* node=(Node*)leaf->data;
|
||||
btSoftBody::Node* node=(btSoftBody::Node*)leaf->data;
|
||||
DoNode(*node);
|
||||
}
|
||||
void DoNode(Node& n) const
|
||||
void DoNode(btSoftBody::Node& n) const
|
||||
{
|
||||
const btScalar m=n.m_im>0?dynmargin:stamargin;
|
||||
RContact c;
|
||||
btSoftBody::RContact c;
|
||||
if( (!n.m_battach)&&
|
||||
CheckContact(psb,prb,n.m_x,m,c.m_cti))
|
||||
{
|
||||
@@ -2280,11 +2306,11 @@ switch(m_cfg.collisions&fCollision::RVSmask)
|
||||
const btScalar basemargin=getCollisionShape()->getMargin();
|
||||
btVector3 mins;
|
||||
btVector3 maxs;
|
||||
btDbvt::Volume volume;
|
||||
btDbvtVolume volume;
|
||||
pco->getCollisionShape()->getAabb( pco->getInterpolationWorldTransform(),
|
||||
mins,
|
||||
maxs);
|
||||
volume=btDbvt::Volume::FromMM(mins,maxs);
|
||||
volume=btDbvtVolume::FromMM(mins,maxs);
|
||||
volume.Expand(btVector3(basemargin,basemargin,basemargin));
|
||||
docollide.psb = this;
|
||||
docollide.prb = prb;
|
||||
@@ -2306,11 +2332,11 @@ switch(cf&fCollision::SVSmask)
|
||||
{
|
||||
struct DoCollide : btDbvt::ICollide
|
||||
{
|
||||
void Process(const btDbvt::Node* lnode,
|
||||
const btDbvt::Node* lface)
|
||||
void Process(const btDbvtNode* lnode,
|
||||
const btDbvtNode* lface)
|
||||
{
|
||||
Node* node=(Node*)lnode->data;
|
||||
Face* face=(Face*)lface->data;
|
||||
btSoftBody::Node* node=(btSoftBody::Node*)lnode->data;
|
||||
btSoftBody::Face* face=(btSoftBody::Face*)lface->data;
|
||||
btVector3 o=node->m_x;
|
||||
btVector3 p;
|
||||
btScalar d=SIMD_INFINITY;
|
||||
@@ -2321,7 +2347,7 @@ switch(cf&fCollision::SVSmask)
|
||||
const btScalar m=mrg+(o-node->m_q).length()*2;
|
||||
if(d<(m*m))
|
||||
{
|
||||
const Node* n[]={face->m_n[0],face->m_n[1],face->m_n[2]};
|
||||
const btSoftBody::Node* n[]={face->m_n[0],face->m_n[1],face->m_n[2]};
|
||||
const btVector3 w=BaryCoord(n[0]->m_x,n[1]->m_x,n[2]->m_x,p+o);
|
||||
const btScalar ma=node->m_im;
|
||||
btScalar mb=BaryEval(n[0]->m_im,n[1]->m_im,n[2]->m_im,w);
|
||||
@@ -2334,7 +2360,7 @@ switch(cf&fCollision::SVSmask)
|
||||
const btScalar ms=ma+mb;
|
||||
if(ms>0)
|
||||
{
|
||||
SContact c;
|
||||
btSoftBody::SContact c;
|
||||
c.m_normal = p/-btSqrt(d);
|
||||
c.m_margin = m;
|
||||
c.m_node = node;
|
||||
|
||||
@@ -192,7 +192,7 @@ public:
|
||||
btVector3 m_n; // Normal
|
||||
btScalar m_im; // 1/mass
|
||||
btScalar m_area; // Area
|
||||
btDbvt::Node* m_leaf; // Leaf data
|
||||
btDbvtNode* m_leaf; // Leaf data
|
||||
int m_battach:1; // Attached
|
||||
};
|
||||
/* Link */
|
||||
@@ -212,12 +212,12 @@ public:
|
||||
Node* m_n[3]; // Node pointers
|
||||
btVector3 m_normal; // Normal
|
||||
btScalar m_ra; // Rest area
|
||||
btDbvt::Node* m_leaf; // Leaf data
|
||||
btDbvtNode* m_leaf; // Leaf data
|
||||
};
|
||||
/* RContact */
|
||||
struct RContact
|
||||
{
|
||||
btSoftBody::sCti m_cti; // Contact infos
|
||||
sCti m_cti; // Contact infos
|
||||
Node* m_node; // Owner node
|
||||
btMatrix3x3 m_c0; // Impulse matrix
|
||||
btVector3 m_c1; // Relative anchor
|
||||
@@ -310,7 +310,7 @@ public:
|
||||
|
||||
typedef btAlignedObjectArray<Note> tNoteArray;
|
||||
typedef btAlignedObjectArray<Node> tNodeArray;
|
||||
typedef btAlignedObjectArray<btDbvt::Node*> tLeafArray;
|
||||
typedef btAlignedObjectArray<btDbvtNode*> tLeafArray;
|
||||
typedef btAlignedObjectArray<Link> tLinkArray;
|
||||
typedef btAlignedObjectArray<Face> tFaceArray;
|
||||
typedef btAlignedObjectArray<Anchor> tAnchorArray;
|
||||
@@ -346,7 +346,7 @@ public:
|
||||
//
|
||||
|
||||
/* ctor */
|
||||
btSoftBody( btSoftBody::btSoftBodyWorldInfo* worldInfo,int node_count,
|
||||
btSoftBody( btSoftBodyWorldInfo* worldInfo,int node_count,
|
||||
const btVector3* x,
|
||||
const btScalar* m);
|
||||
/* dtor */
|
||||
|
||||
@@ -53,7 +53,7 @@ idraw->drawLine(c[2],c[6],color);idraw->drawLine(c[3],c[7],color);
|
||||
|
||||
//
|
||||
static void drawTree( btIDebugDraw* idraw,
|
||||
const btDbvt::Node* node,
|
||||
const btDbvtNode* node,
|
||||
int depth,
|
||||
const btVector3& ncolor,
|
||||
const btVector3& lcolor,
|
||||
@@ -175,7 +175,9 @@ void btSoftBodyHelpers::Draw( btSoftBody* psb,
|
||||
/* Anchors */
|
||||
if(0!=(drawflags&fDrawFlags::Anchors))
|
||||
{
|
||||
for(int i=0;i<psb->m_anchors.size();++i)
|
||||
int i;
|
||||
|
||||
for(i=0;i<psb->m_anchors.size();++i)
|
||||
{
|
||||
const btSoftBody::Anchor& a=psb->m_anchors[i];
|
||||
const btVector3 q=a.m_body->getWorldTransform()*a.m_local;
|
||||
@@ -183,7 +185,7 @@ void btSoftBodyHelpers::Draw( btSoftBody* psb,
|
||||
drawVertex(idraw,q,0.25,btVector3(0,1,0));
|
||||
idraw->drawLine(a.m_node->m_x,q,btVector3(1,1,1));
|
||||
}
|
||||
for(int i=0;i<psb->m_nodes.size();++i)
|
||||
for(i=0;i<psb->m_nodes.size();++i)
|
||||
{
|
||||
const btSoftBody::Node& n=psb->m_nodes[i];
|
||||
if(0==(n.m_material->m_flags&btSoftBody::fMaterial::DebugDraw)) continue;
|
||||
@@ -313,7 +315,9 @@ btSoftBody* btSoftBodyHelpers::CreateRope( btSoftBody::btSoftBodyWorldInfo& wor
|
||||
const int r=res+2;
|
||||
btVector3* x=new btVector3[r];
|
||||
btScalar* m=new btScalar[r];
|
||||
for(int i=0;i<r;++i)
|
||||
int i;
|
||||
|
||||
for(i=0;i<r;++i)
|
||||
{
|
||||
const btScalar t=i/(btScalar)(r-1);
|
||||
x[i]=lerp(from,to,t);
|
||||
@@ -325,7 +329,7 @@ btSoftBody* btSoftBodyHelpers::CreateRope( btSoftBody::btSoftBodyWorldInfo& wor
|
||||
delete[] x;
|
||||
delete[] m;
|
||||
/* Create links */
|
||||
for(int i=1;i<r;++i)
|
||||
for(i=1;i<r;++i)
|
||||
{
|
||||
psb->appendLink(i-1,i);
|
||||
}
|
||||
@@ -351,7 +355,9 @@ btSoftBody* btSoftBodyHelpers::CreatePatch(btSoftBody::btSoftBodyWorldInfo& wor
|
||||
const int tot=rx*ry;
|
||||
btVector3* x=new btVector3[tot];
|
||||
btScalar* m=new btScalar[tot];
|
||||
for(int iy=0;iy<ry;++iy)
|
||||
int iy;
|
||||
|
||||
for(iy=0;iy<ry;++iy)
|
||||
{
|
||||
const btScalar ty=iy/(btScalar)(ry-1);
|
||||
const btVector3 py0=lerp(corner00,corner01,ty);
|
||||
@@ -371,7 +377,7 @@ btSoftBody* btSoftBodyHelpers::CreatePatch(btSoftBody::btSoftBodyWorldInfo& wor
|
||||
delete[] x;
|
||||
delete[] m;
|
||||
/* Create links and faces */
|
||||
for(int iy=0;iy<ry;++iy)
|
||||
for(iy=0;iy<ry;++iy)
|
||||
{
|
||||
for(int ix=0;ix<rx;++ix)
|
||||
{
|
||||
@@ -446,7 +452,10 @@ btSoftBody* btSoftBodyHelpers::CreateFromTriMesh(btSoftBody::btSoftBodyWorldInf
|
||||
int ntriangles)
|
||||
{
|
||||
int maxidx=0;
|
||||
for(int i=0,ni=ntriangles*3;i<ni;++i)
|
||||
int i,j;
|
||||
int ni;
|
||||
|
||||
for( i=0,ni=ntriangles*3;i<ni;++i)
|
||||
{
|
||||
maxidx=btMax(triangles[i],maxidx);
|
||||
}
|
||||
@@ -455,12 +464,12 @@ btSoftBody* btSoftBodyHelpers::CreateFromTriMesh(btSoftBody::btSoftBodyWorldInf
|
||||
btAlignedObjectArray<btVector3> vtx;
|
||||
chks.resize(maxidx*maxidx,false);
|
||||
vtx.resize(maxidx);
|
||||
for(int i=0,j=0,ni=maxidx*3;i<ni;++j,i+=3)
|
||||
for( i=0,j=0,ni=maxidx*3;i<ni;++j,i+=3)
|
||||
{
|
||||
vtx[j]=btVector3(vertices[i],vertices[i+1],vertices[i+2]);
|
||||
}
|
||||
btSoftBody* psb=new btSoftBody(&worldInfo,vtx.size(),&vtx[0],0);
|
||||
for(int i=0,ni=ntriangles*3;i<ni;i+=3)
|
||||
for(i=0,ni=ntriangles*3;i<ni;i+=3)
|
||||
{
|
||||
const int idx[]={triangles[i],triangles[i+1],triangles[i+2]};
|
||||
#define IDX(_x_,_y_) ((_y_)*maxidx+(_x_))
|
||||
|
||||
@@ -20,6 +20,26 @@ subject to the following restrictions:
|
||||
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
|
||||
#include "BulletCollision/NarrowPhaseCollision/btGjkEpa2.h"
|
||||
|
||||
// Modified Paul Hsieh hash
|
||||
template <const int DWORDLEN>
|
||||
unsigned int HsiehHash(const void* pdata)
|
||||
{
|
||||
const unsigned short* data=(const unsigned short*)pdata;
|
||||
unsigned hash=DWORDLEN<<2,tmp;
|
||||
for(int i=0;i<DWORDLEN;++i)
|
||||
{
|
||||
hash += data[0];
|
||||
tmp = (data[1]<<11)^hash;
|
||||
hash = (hash<<16)^tmp;
|
||||
data += 2;
|
||||
hash += hash>>11;
|
||||
}
|
||||
hash^=hash<<3;hash+=hash>>5;
|
||||
hash^=hash<<4;hash+=hash>>17;
|
||||
hash^=hash<<25;hash+=hash>>6;
|
||||
return(hash);
|
||||
}
|
||||
|
||||
template <const int CELLSIZE>
|
||||
struct btSparseSdf
|
||||
{
|
||||
@@ -258,32 +278,29 @@ struct btSparseSdf
|
||||
{
|
||||
return(a+(b-a)*t);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
static inline unsigned Hash(int x,int y,int z,btCollisionShape* shape)
|
||||
static inline unsigned int Hash(int x,int y,int z,btCollisionShape* shape)
|
||||
{
|
||||
struct { int x,y,z;void* p; } set;
|
||||
set.x=x;set.y=y;set.z=z;set.p=shape;
|
||||
return(HsiehHash<sizeof(set)/4>(&set));
|
||||
struct btS
|
||||
{
|
||||
int x,y,z;
|
||||
void* p;
|
||||
};
|
||||
|
||||
btS myset;
|
||||
|
||||
myset.x=x;myset.y=y;myset.z=z;myset.p=shape;
|
||||
const void* ptr = &myset;
|
||||
|
||||
unsigned int result = HsiehHash<sizeof(btS)/4> (ptr);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
// Modified Paul Hsieh hash
|
||||
template <const int DWORDLEN>
|
||||
static inline unsigned HsiehHash(const void* pdata)
|
||||
{
|
||||
const unsigned short* data=(const unsigned short*)pdata;
|
||||
unsigned hash=DWORDLEN<<2,tmp;
|
||||
for(int i=0;i<DWORDLEN;++i)
|
||||
{
|
||||
hash += data[0];
|
||||
tmp = (data[1]<<11)^hash;
|
||||
hash = (hash<<16)^tmp;
|
||||
data += 2;
|
||||
hash += hash>>11;
|
||||
}
|
||||
hash^=hash<<3;hash+=hash>>5;
|
||||
hash^=hash<<4;hash+=hash>>17;
|
||||
hash^=hash<<25;hash+=hash>>6;
|
||||
return(hash);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -18,6 +18,7 @@ subject to the following restrictions:
|
||||
#define SIMD___SCALAR_H
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>//size_t for MSVC 6.0
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cfloat>
|
||||
@@ -144,9 +145,9 @@ typedef float btScalar;
|
||||
|
||||
|
||||
#define BT_DECLARE_ALIGNED_ALLOCATOR() \
|
||||
SIMD_FORCE_INLINE void* operator new(std::size_t sizeInBytes) { return btAlignedAlloc(sizeInBytes,16); } \
|
||||
SIMD_FORCE_INLINE void* operator new(size_t sizeInBytes) { return btAlignedAlloc(sizeInBytes,16); } \
|
||||
SIMD_FORCE_INLINE void operator delete(void* ptr) { btAlignedFree(ptr); } \
|
||||
SIMD_FORCE_INLINE void* operator new(std::size_t, void* ptr) { return ptr; } \
|
||||
SIMD_FORCE_INLINE void* operator new(size_t, void* ptr) { return ptr; } \
|
||||
SIMD_FORCE_INLINE void operator delete(void*, void*) { } \
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user