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