physx: remove support for NVIDIA PhysX

Our support was stuck on an ancient version that has not been available for a while.  If we were to continue support it should be done around the new PhysX 5.0 API, not 2.8.4.
This commit is contained in:
rdb
2020-01-07 21:57:22 +01:00
parent da8ba5de17
commit 09bddf4315
392 changed files with 1 additions and 36523 deletions

View File

@@ -146,7 +146,6 @@ it will show you the available command-line options:
--use-swscale --no-swscale (enable/disable use of SWSCALE)
--use-swresample --no-swresample (enable/disable use of SWRESAMPLE)
--use-ode --no-ode (enable/disable use of ODE)
--use-physx --no-physx (enable/disable use of PHYSX)
--use-bullet --no-bullet (enable/disable use of BULLET)
--use-pandaphysics --no-pandaphysics (enable/disable use of PANDAPHYSICS)
--use-speedtree --no-speedtree (enable/disable use of SPEEDTREE)

View File

@@ -78,7 +78,6 @@ LangString DESC_SecFMOD ${LANG_ENGLISH} "Support for decoding and playing audio
LangString DESC_SecFFMpeg ${LANG_ENGLISH} "Support for decoding video and audio via the FFMpeg library. Without this option, Panda3D will only be able to play .wav and .ogg audio files."
LangString DESC_SecBullet ${LANG_ENGLISH} "Support for the Bullet physics engine."
LangString DESC_SecODE ${LANG_ENGLISH} "Support for the Open Dynamics Engine to implement physics."
LangString DESC_SecPhysX ${LANG_ENGLISH} "Support for NVIDIA PhysX to implement physics."
LangString DESC_SecTools ${LANG_ENGLISH} "Useful tools and model converters to help with Panda3D development. Recommended."
LangString DESC_SecGroupPython ${LANG_ENGLISH} "Contains modules that provide Python support for Panda3D."
LangString DESC_SecPyShared ${LANG_ENGLISH} "Contains the common Python code used by the Panda3D Python bindings."
@@ -114,7 +113,6 @@ var MANPAGE
!insertmacro !defineifexist HAVE_FFMPEG "${BUILT}\bin\libp3ffmpeg.dll"
!insertmacro !defineifexist HAVE_BULLET "${BUILT}\bin\libpandabullet.dll"
!insertmacro !defineifexist HAVE_ODE "${BUILT}\bin\libpandaode.dll"
!insertmacro !defineifexist HAVE_PHYSX "${BUILT}\bin\libpandaphysx.dll"
!insertmacro !defineifexist HAVE_SAMPLES "${SOURCE}\samples"
!insertmacro !defineifexist HAVE_MAX_PLUGINS "${BUILT}\plugins\*.dlo"
!insertmacro !defineifexist HAVE_MAYA_PLUGINS "${BUILT}\plugins\*.mll"
@@ -172,14 +170,6 @@ var MANPAGE
SkipODEPyd:
!endif
!ifdef HAVE_PHYSX
SectionGetFlags ${SecPhysX} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} 0 SkipPhysXPyd
File /nonfatal /r "${BUILT}\panda3d\physx${EXT_SUFFIX}"
SkipPhysXPyd:
!endif
SetOutPath $INSTDIR\pandac\input
File /r "${BUILT}\pandac\input\*"
SetOutPath $INSTDIR\Pmw
@@ -319,19 +309,6 @@ SectionGroup "Panda3D Libraries"
File "${BUILT}\bin\libpandaode.dll"
SectionEnd
!endif
!ifdef HAVE_PHYSX
Section "NVIDIA PhysX" SecPhysX
; Only enable in "Full"
SectionIn 2
SetOutPath "$INSTDIR\bin"
File "${BUILT}\bin\libpandaphysx.dll"
File /nonfatal /r "${BUILT}\bin\PhysX*.dll"
File /nonfatal /r "${BUILT}\bin\NxCharacter*.dll"
File /nonfatal /r "${BUILT}\bin\cudart*.dll"
SectionEnd
!endif
SectionGroupEnd
Section "Tools and utilities" SecTools
@@ -892,9 +869,6 @@ SectionEnd
!ifdef HAVE_ODE
!insertmacro MUI_DESCRIPTION_TEXT ${SecODE} $(DESC_SecODE)
!endif
!ifdef HAVE_PHYSX
!insertmacro MUI_DESCRIPTION_TEXT ${SecPhysX} $(DESC_SecPhysX)
!endif
!insertmacro MUI_DESCRIPTION_TEXT ${SecTools} $(DESC_SecTools)
!insertmacro MUI_DESCRIPTION_TEXT ${SecGroupPython} $(DESC_SecGroupPython)
!insertmacro MUI_DESCRIPTION_TEXT ${SecPyShared} $(DESC_SecPyShared)

View File

@@ -75,7 +75,7 @@ PkgListSet(["PYTHON", "DIRECT", # Python support
"EIGEN", # Linear algebra acceleration
"OPENAL", "FMODEX", # Audio playback
"VORBIS", "OPUS", "FFMPEG", "SWSCALE", "SWRESAMPLE", # Audio decoding
"ODE", "PHYSX", "BULLET", "PANDAPHYSICS", # Physics
"ODE", "BULLET", "PANDAPHYSICS", # Physics
"SPEEDTREE", # SpeedTree
"ZLIB", "PNG", "JPEG", "TIFF", "OPENEXR", "SQUISH", # 2D Formats support
] + MAYAVERSIONS + MAXVERSIONS + [ "FCOLLADA", "ASSIMP", "EGG", # 3D Formats support
@@ -464,14 +464,12 @@ SdkLocateMax()
SdkLocateMacOSX(OSXTARGET)
SdkLocatePython(False)
SdkLocateWindows(WINDOWS_SDK)
SdkLocatePhysX()
SdkLocateSpeedTree()
SdkLocateAndroid()
SdkAutoDisableDirectX()
SdkAutoDisableMaya()
SdkAutoDisableMax()
SdkAutoDisablePhysX()
SdkAutoDisableSpeedTree()
if not PkgSkip("PYTHON") and SDK["PYTHONVERSION"] == "python2.7":
@@ -707,20 +705,6 @@ if (COMPILER == "MSVC"):
LibName(pkg, SDK[pkg] + '/lib/mesh.lib')
LibName(pkg, SDK[pkg] + '/lib/maxutil.lib')
LibName(pkg, SDK[pkg] + '/lib/paramblk2.lib')
if (PkgSkip("PHYSX")==0):
if GetTargetArch() == 'x64':
LibName("PHYSX", SDK["PHYSXLIBS"] + "/PhysXLoader64.lib")
LibName("PHYSX", SDK["PHYSXLIBS"] + "/NxCharacter64.lib")
else:
LibName("PHYSX", SDK["PHYSXLIBS"] + "/PhysXLoader.lib")
LibName("PHYSX", SDK["PHYSXLIBS"] + "/NxCharacter.lib")
IncDirectory("PHYSX", SDK["PHYSX"] + "/Physics/include")
IncDirectory("PHYSX", SDK["PHYSX"] + "/PhysXLoader/include")
IncDirectory("PHYSX", SDK["PHYSX"] + "/NxCharacter/include")
IncDirectory("PHYSX", SDK["PHYSX"] + "/NxExtensions/include")
IncDirectory("PHYSX", SDK["PHYSX"] + "/Foundation/include")
IncDirectory("PHYSX", SDK["PHYSX"] + "/Cooking/include")
if (PkgSkip("SPEEDTREE")==0):
if GetTargetArch() == 'x64':
@@ -959,21 +943,6 @@ if (COMPILER=="GCC"):
else:
LibName(pkg, "-dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib")
if (PkgSkip("PHYSX")==0):
IncDirectory("PHYSX", SDK["PHYSX"] + "/Physics/include")
IncDirectory("PHYSX", SDK["PHYSX"] + "/PhysXLoader/include")
IncDirectory("PHYSX", SDK["PHYSX"] + "/NxCharacter/include")
IncDirectory("PHYSX", SDK["PHYSX"] + "/NxExtensions/include")
IncDirectory("PHYSX", SDK["PHYSX"] + "/Foundation/include")
IncDirectory("PHYSX", SDK["PHYSX"] + "/Cooking/include")
LibDirectory("PHYSX", SDK["PHYSXLIBS"])
if (GetHost() == "darwin"):
LibName("PHYSX", SDK["PHYSXLIBS"] + "/osxstatic/PhysXCooking.a")
LibName("PHYSX", SDK["PHYSXLIBS"] + "/osxstatic/PhysXCore.a")
else:
LibName("PHYSX", "-lPhysXLoader")
LibName("PHYSX", "-lNxCharacter")
DefSymbol("WITHINPANDA", "WITHIN_PANDA", "1")
if GetLinkAllStatic():
DefSymbol("ALWAYS", "LINK_ALL_STATIC")
@@ -3045,10 +3014,6 @@ CopyAllHeaders('panda/metalibs/pandagles2')
CopyAllHeaders('panda/metalibs/pandaphysics')
CopyAllHeaders('panda/src/testbed')
if (PkgSkip("PHYSX")==0):
CopyAllHeaders('panda/src/physx')
CopyAllHeaders('panda/metalibs/pandaphysx')
if (PkgSkip("BULLET")==0):
CopyAllHeaders('panda/src/bullet')
CopyAllHeaders('panda/metalibs/pandabullet')
@@ -4562,44 +4527,6 @@ if (PkgSkip("BULLET")==0):
PyTargetAdd('bullet.pyd', input=COMMON_PANDA_LIBS)
PyTargetAdd('bullet.pyd', opts=['WINUSER', 'BULLET'])
#
# DIRECTORY: panda/src/physx/
#
if (PkgSkip("PHYSX")==0):
OPTS=['DIR:panda/src/physx', 'BUILDING:PANDAPHYSX', 'PHYSX']
TargetAdd('p3physx_composite.obj', opts=OPTS, input='p3physx_composite.cxx')
OPTS=['DIR:panda/src/physx', 'PHYSX']
IGATEFILES=GetDirectoryContents('panda/src/physx', ["*.h", "*_composite*.cxx"])
TargetAdd('libpandaphysx.in', opts=OPTS, input=IGATEFILES)
TargetAdd('libpandaphysx.in', opts=['IMOD:panda3d.physx', 'ILIB:libpandaphysx', 'SRCDIR:panda/src/physx'])
#
# DIRECTORY: panda/metalibs/pandaphysx/
#
if (PkgSkip("PHYSX")==0):
OPTS=['DIR:panda/metalibs/pandaphysx', 'BUILDING:PANDAPHYSX', 'PHYSX', 'PYTHON']
TargetAdd('pandaphysx_pandaphysx.obj', opts=OPTS, input='pandaphysx.cxx')
TargetAdd('libpandaphysx.dll', input='pandaphysx_pandaphysx.obj')
TargetAdd('libpandaphysx.dll', input='p3physx_composite.obj')
TargetAdd('libpandaphysx.dll', input=COMMON_PANDA_LIBS)
TargetAdd('libpandaphysx.dll', opts=['WINUSER', 'PHYSX', 'PYTHON'])
OPTS=['DIR:panda/metalibs/pandaphysx', 'PHYSX']
PyTargetAdd('physx_module.obj', input='libpandaphysx.in')
PyTargetAdd('physx_module.obj', opts=OPTS)
PyTargetAdd('physx_module.obj', opts=['IMOD:panda3d.physx', 'ILIB:physx', 'IMPORT:panda3d.core'])
PyTargetAdd('physx.pyd', input='physx_module.obj')
PyTargetAdd('physx.pyd', input='libpandaphysx_igate.obj')
PyTargetAdd('physx.pyd', input='libpandaphysx.dll')
PyTargetAdd('physx.pyd', input='libp3interrogatedb.dll')
PyTargetAdd('physx.pyd', input=COMMON_PANDA_LIBS)
PyTargetAdd('physx.pyd', opts=['WINUSER', 'PHYSX'])
#
# DIRECTORY: panda/src/physics/
#

View File

@@ -3125,362 +3125,6 @@
<File RelativePath="..\panda\src\vrpn\vrpnClient.cxx"></File>
<File RelativePath="..\panda\src\vrpn\vrpnClient.I"></File>
</Filter>
<Filter Name="physx">
<File RelativePath="..\panda\src\physx\physxMask.cxx"></File>
<File RelativePath="..\panda\src\physx\physxDistanceJointDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxConvexShapeDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxHeightFieldShapeDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxSphereShapeDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxPlaneShape.h"></File>
<File RelativePath="..\panda\src\physx\physxConstraintDominance.h"></File>
<File RelativePath="..\panda\src\physx\physxConvexMeshDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxFileStream.cxx"></File>
<File RelativePath="..\panda\src\physx\physxContactPoint.cxx"></File>
<File RelativePath="..\panda\src\physx\physxSphericalJoint.cxx"></File>
<File RelativePath="..\panda\src\physx\physxJointLimitSoftDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxSphericalJoint.h"></File>
<File RelativePath="..\panda\src\physx\physxPointOnLineJointDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxHeightFieldShapeDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxBox.I"></File>
<File RelativePath="..\panda\src\physx\physxBoxForceFieldShape.cxx"></File>
<File RelativePath="..\panda\src\physx\physxBoxForceFieldShapeDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxCapsuleForceFieldShapeDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxPlaneShapeDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxD6JointDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxWheelDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxHeightFieldShape.cxx"></File>
<File RelativePath="..\panda\src\physx\physxForceField.cxx"></File>
<File RelativePath="..\panda\src\physx\physxVehicleDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxObject.h"></File>
<File RelativePath="..\panda\src\physx\physxClothNode.I"></File>
<File RelativePath="..\panda\src\physx\physxPrismaticJointDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxShape.h"></File>
<File RelativePath="..\panda\src\physx\physxControllerReport.h"></File>
<File RelativePath="..\panda\src\physx\physxClothMesh.I"></File>
<File RelativePath="..\panda\src\physx\physxBoxController.cxx"></File>
<File RelativePath="..\panda\src\physx\physxVehicleDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxTriangleMesh.I"></File>
<File RelativePath="..\panda\src\physx\physxCapsuleShape.h"></File>
<File RelativePath="..\panda\src\physx\physxHeightField.I"></File>
<File RelativePath="..\panda\src\physx\physxOverlapReport.I"></File>
<File RelativePath="..\panda\src\physx\physxContactReport.cxx"></File>
<File RelativePath="..\panda\src\physx\physxJointDriveDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxPointInPlaneJointDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxKitchen.cxx"></File>
<File RelativePath="..\panda\src\physx\physxUtilLib.cxx"></File>
<File RelativePath="..\panda\src\physx\physxBoxForceFieldShape.h"></File>
<File RelativePath="..\panda\src\physx\physxPrismaticJoint.cxx"></File>
<File RelativePath="..\panda\src\physx\physxMeshPool.cxx"></File>
<File RelativePath="..\panda\src\physx\physxSphere.h"></File>
<File RelativePath="..\panda\src\physx\physxObject.I"></File>
<File RelativePath="..\panda\src\physx\physxPointOnLineJoint.h"></File>
<File RelativePath="..\panda\src\physx\physxCapsuleForceFieldShape.I"></File>
<File RelativePath="..\panda\src\physx\physxCapsuleShape.cxx"></File>
<File RelativePath="..\panda\src\physx\physxRevoluteJoint.cxx"></File>
<File RelativePath="..\panda\src\physx\physxRaycastReport.cxx"></File>
<File RelativePath="..\panda\src\physx\physxFixedJoint.I"></File>
<File RelativePath="..\panda\src\physx\physxSphericalJointDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxD6JointDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxConstraintDominance.I"></File>
<File RelativePath="..\panda\src\physx\physxJointDriveDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxShapeDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxConvexShape.h"></File>
<File RelativePath="..\panda\src\physx\physxHeightField.cxx"></File>
<File RelativePath="..\panda\src\physx\physxDistanceJoint.cxx"></File>
<File RelativePath="..\panda\src\physx\physxClothDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxController.h"></File>
<File RelativePath="..\panda\src\physx\physxPointOnLineJointDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxJointLimitSoftDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxTriangleMeshShapeDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxSceneDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxRaycastHit.cxx"></File>
<File RelativePath="..\panda\src\physx\physxForceFieldShapeGroup.I"></File>
<File RelativePath="..\panda\src\physx\physxSegment.cxx"></File>
<File RelativePath="..\panda\src\physx\physxBoxForceFieldShapeDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxDistanceJoint.h"></File>
<File RelativePath="..\panda\src\physx\physxRay.I"></File>
<File RelativePath="..\panda\src\physx\physxActor.h"></File>
<File RelativePath="..\panda\src\physx\physxTriangleMeshShape.I"></File>
<File RelativePath="..\panda\src\physx\physxRevoluteJointDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxDistanceJointDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxPointInPlaneJoint.h"></File>
<File RelativePath="..\panda\src\physx\physxShape.cxx"></File>
<File RelativePath="..\panda\src\physx\physxCapsuleForceFieldShape.cxx"></File>
<File RelativePath="..\panda\src\physx\physxOverlapReport.h"></File>
<File RelativePath="..\panda\src\physx\physxForceFieldShapeGroup.h"></File>
<File RelativePath="..\panda\src\physx\physxForceFieldDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxForceFieldShape.h"></File>
<File RelativePath="..\panda\src\physx\physxSceneDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxJoint.h"></File>
<File RelativePath="..\panda\src\physx\physxActor.I"></File>
<File RelativePath="..\panda\src\physx\physxForceFieldShape.cxx"></File>
<File RelativePath="..\panda\src\physx\physxCylindricalJoint.cxx"></File>
<File RelativePath="..\panda\src\physx\physxWheelShape.I"></File>
<File RelativePath="..\panda\src\physx\physxPlane.I"></File>
<File RelativePath="..\panda\src\physx\physxContactPair.I"></File>
<File RelativePath="..\panda\src\physx\physxUtilLib.h"></File>
<File RelativePath="..\panda\src\physx\physxBodyDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxControllerReport.I"></File>
<File RelativePath="..\panda\src\physx\physxMeshPool.h"></File>
<File RelativePath="..\panda\src\physx\physxCapsuleForceFieldShapeDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxCylindricalJointDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxForceFieldShapeGroupDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxSpringDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxContactReport.I"></File>
<File RelativePath="..\panda\src\physx\physxPulleyJointDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxHeightFieldDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxBoxController.I"></File>
<File RelativePath="..\panda\src\physx\physxKitchen.h"></File>
<File RelativePath="..\panda\src\physx\physxMemoryReadBuffer.h"></File>
<File RelativePath="..\panda\src\physx\physxManager.cxx"></File>
<File RelativePath="..\panda\src\physx\physxSceneStats2.I"></File>
<File RelativePath="..\panda\src\physx\physxFileStream.h"></File>
<File RelativePath="..\panda\src\physx\physxConvexForceFieldShapeDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxControllerDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxLinearInterpolationValues.I"></File>
<File RelativePath="..\panda\src\physx\physxRaycastReport.h"></File>
<File RelativePath="..\panda\src\physx\physxD6Joint.I"></File>
<File RelativePath="..\panda\src\physx\physxCapsuleShape.I"></File>
<File RelativePath="..\panda\src\physx\physxClothMesh.h"></File>
<File RelativePath="..\panda\src\physx\physxObjectCollection.I"></File>
<File RelativePath="..\panda\src\physx\physxControllerDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxPlaneShape.I"></File>
<File RelativePath="..\panda\src\physx\physxMaterialDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxControllerReport.cxx"></File>
<File RelativePath="..\panda\src\physx\physxClothNode.cxx"></File>
<File RelativePath="..\panda\src\physx\physxConvexMesh.cxx"></File>
<File RelativePath="..\panda\src\physx\physxForceFieldShapeDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxPulleyJoint.h"></File>
<File RelativePath="..\panda\src\physx\physxShapeDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxMaterial.h"></File>
<File RelativePath="..\panda\src\physx\config_physx.h"></File>
<File RelativePath="..\panda\src\physx\physxHeightFieldShapeDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxVehicle.cxx"></File>
<File RelativePath="..\panda\src\physx\physxRaycastHit.h"></File>
<File RelativePath="..\panda\src\physx\physxTriangleMesh.h"></File>
<File RelativePath="..\panda\src\physx\physxForceFieldDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxClothMeshDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxPointInPlaneJointDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxTriangleMeshDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxSphereForceFieldShapeDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxJointLimitDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxScene.h"></File>
<File RelativePath="..\panda\src\physx\physxSphericalJoint.I"></File>
<File RelativePath="..\panda\src\physx\physxSegment.I"></File>
<File RelativePath="..\panda\src\physx\physxRaycastReport.I"></File>
<File RelativePath="..\panda\src\physx\physxRay.h"></File>
<File RelativePath="..\panda\src\physx\physxSphereShape.h"></File>
<File RelativePath="..\panda\src\physx\physxSphericalJointDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxBoxForceFieldShape.I"></File>
<File RelativePath="..\panda\src\physx\physxPrismaticJoint.h"></File>
<File RelativePath="..\panda\src\physx\physxBoxControllerDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxBoxController.h"></File>
<File RelativePath="..\panda\src\physx\physxBox.cxx"></File>
<File RelativePath="..\panda\src\physx\physxPulleyJointDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxActor.cxx"></File>
<File RelativePath="..\panda\src\physx\physxConvexShape.cxx"></File>
<File RelativePath="..\panda\src\physx\physxClothMeshDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxPointOnLineJointDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxClothMeshDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxObject.cxx"></File>
<File RelativePath="..\panda\src\physx\physxSpringDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxBoxControllerDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxContactReport.h"></File>
<File RelativePath="..\panda\src\physx\physxPrismaticJointDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxForceFieldShapeGroupDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxTriggerReport.h"></File>
<File RelativePath="..\panda\src\physx\physxForceField.I"></File>
<File RelativePath="..\panda\src\physx\physxCapsuleShapeDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxBounds3.h"></File>
<File RelativePath="..\panda\src\physx\physxWheel.I"></File>
<File RelativePath="..\panda\src\physx\physxSphereShapeDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxConvexMesh.h"></File>
<File RelativePath="..\panda\src\physx\physxCapsule.cxx"></File>
<File RelativePath="..\panda\src\physx\physxGroupsMask.cxx"></File>
<File RelativePath="..\panda\src\physx\physxCylindricalJoint.h"></File>
<File RelativePath="..\panda\src\physx\physxCloth.I"></File>
<File RelativePath="..\panda\src\physx\physxConvexMeshDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxFixedJointDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxCapsuleControllerDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxBoxControllerDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxBodyDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxGroupsMask.I"></File>
<File RelativePath="..\panda\src\physx\physxRaycastHit.I"></File>
<File RelativePath="..\panda\src\physx\physxHeightFieldShape.h"></File>
<File RelativePath="..\panda\src\physx\physxSphereForceFieldShape.I"></File>
<File RelativePath="..\panda\src\physx\physxDebugGeomNode.h"></File>
<File RelativePath="..\panda\src\physx\physxBoxShapeDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxCapsuleForceFieldShapeDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxControllerDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxConvexMeshDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxCloth.h"></File>
<File RelativePath="..\panda\src\physx\physxCapsuleController.h"></File>
<File RelativePath="..\panda\src\physx\physxCapsuleControllerDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxHeightField.h"></File>
<File RelativePath="..\panda\src\physx\physxContactPoint.h"></File>
<File RelativePath="..\panda\src\physx\physxObjectCollection.h"></File>
<File RelativePath="..\panda\src\physx\physxSphereForceFieldShape.h"></File>
<File RelativePath="..\panda\src\physx\physxWheelDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxCylindricalJoint.I"></File>
<File RelativePath="..\panda\src\physx\physxCapsuleForceFieldShape.h"></File>
<File RelativePath="..\panda\src\physx\physxConvexMesh.I"></File>
<File RelativePath="..\panda\src\physx\physxPointInPlaneJoint.I"></File>
<File RelativePath="..\panda\src\physx\physxBoxShape.h"></File>
<File RelativePath="..\panda\src\physx\physxContactPair.cxx"></File>
<File RelativePath="..\panda\src\physx\physxClothDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxActorDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxMotorDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxDebugGeomNode.cxx"></File>
<File RelativePath="..\panda\src\physx\physxDistanceJointDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxBounds3.I"></File>
<File RelativePath="..\panda\src\physx\physxActorDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxJointDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxSphere.I"></File>
<File RelativePath="..\panda\src\physx\physxShapeDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxMeshPool.I"></File>
<File RelativePath="..\panda\src\physx\physxMemoryReadBuffer.cxx"></File>
<File RelativePath="..\panda\src\physx\physxPlaneShapeDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxFixedJoint.cxx"></File>
<File RelativePath="..\panda\src\physx\physxSphereShapeDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxSphericalJointDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxRevoluteJointDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxForceFieldShapeGroupDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxVehicle.h"></File>
<File RelativePath="..\panda\src\physx\physxWheel.cxx"></File>
<File RelativePath="..\panda\src\physx\physxHeightFieldShape.I"></File>
<File RelativePath="..\panda\src\physx\physxJoint.I"></File>
<File RelativePath="..\panda\src\physx\physxForceFieldShapeDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxForceFieldShape.I"></File>
<File RelativePath="..\panda\src\physx\physxGroupsMask.h"></File>
<File RelativePath="..\panda\src\physx\physxJointLimitSoftDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxTriangleMeshShapeDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxVehicle.I"></File>
<File RelativePath="..\panda\src\physx\physxJointLimitDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxTriangleMeshShape.h"></File>
<File RelativePath="..\panda\src\physx\physx_composite.cxx"></File>
<File RelativePath="..\panda\src\physx\physxCapsule.I"></File>
<File RelativePath="..\panda\src\physx\physxTriangleMeshShapeDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxPlaneShapeDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxLinearInterpolationValues.h"></File>
<File RelativePath="..\panda\src\physx\physxActorDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxTriangleMeshDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxPulleyJoint.cxx"></File>
<File RelativePath="..\panda\src\physx\physxConvexForceFieldShape.I"></File>
<File RelativePath="..\panda\src\physx\physxMaterial.I"></File>
<File RelativePath="..\panda\src\physx\physxKitchen.I"></File>
<File RelativePath="..\panda\src\physx\physxSphereShape.cxx"></File>
<File RelativePath="..\panda\src\physx\physxFixedJointDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxSpringDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxBox.h"></File>
<File RelativePath="..\panda\src\physx\physxSceneStats2.h"></File>
<File RelativePath="..\panda\src\physx\physxShape.I"></File>
<File RelativePath="..\panda\src\physx\physxForceFieldDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxSphereForceFieldShapeDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxRevoluteJointDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxVehicleDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\config_physx.cxx"></File>
<File RelativePath="..\panda\src\physx\physxTriggerReport.I"></File>
<File RelativePath="..\panda\src\physx\physxD6Joint.cxx"></File>
<File RelativePath="..\panda\src\physx\physxLinearInterpolationValues.cxx"></File>
<File RelativePath="..\panda\src\physx\physxRay.cxx"></File>
<File RelativePath="..\panda\src\physx\physxCylindricalJointDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxJointLimitDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxTriggerReport.cxx"></File>
<File RelativePath="..\panda\src\physx\physxHeightFieldDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxConvexForceFieldShapeDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxDebugGeomNode.I"></File>
<File RelativePath="..\panda\src\physx\physxHeightFieldDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxMotorDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxWheelShapeDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxMemoryWriteBuffer.cxx"></File>
<File RelativePath="..\panda\src\physx\physxScene.I"></File>
<File RelativePath="..\panda\src\physx\physxClothNode.h"></File>
<File RelativePath="..\panda\src\physx\physxJointDriveDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxSceneStats2.cxx"></File>
<File RelativePath="..\panda\src\physx\physxBoxShapeDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxConvexForceFieldShape.cxx"></File>
<File RelativePath="..\panda\src\physx\physxSphere.cxx"></File>
<File RelativePath="..\panda\src\physx\physxMask.I"></File>
<File RelativePath="..\panda\src\physx\physxCapsuleControllerDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxManager.h"></File>
<File RelativePath="..\panda\src\physx\physxTriangleMeshDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxPointOnLineJoint.I"></File>
<File RelativePath="..\panda\src\physx\physxConvexShapeDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxOverlapReport.cxx"></File>
<File RelativePath="..\panda\src\physx\physxClothMesh.cxx"></File>
<File RelativePath="..\panda\src\physx\physxEnums.cxx"></File>
<File RelativePath="..\panda\src\physx\physxJointDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxSphereShape.I"></File>
<File RelativePath="..\panda\src\physx\physxClothDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxPlane.cxx"></File>
<File RelativePath="..\panda\src\physx\physxPrismaticJointDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxPointOnLineJoint.cxx"></File>
<File RelativePath="..\panda\src\physx\physxFixedJointDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxScene.cxx"></File>
<File RelativePath="..\panda\src\physx\physxCloth.cxx"></File>
<File RelativePath="..\panda\src\physx\physxBoxForceFieldShapeDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxCapsuleController.cxx"></File>
<File RelativePath="..\panda\src\physx\physxForceField.h"></File>
<File RelativePath="..\panda\src\physx\physxWheelShapeDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxController.cxx"></File>
<File RelativePath="..\panda\src\physx\physxTriangleMesh.cxx"></File>
<File RelativePath="..\panda\src\physx\physxConvexShape.I"></File>
<File RelativePath="..\panda\src\physx\physxContactPoint.I"></File>
<File RelativePath="..\panda\src\physx\physxObjectCollection.cxx"></File>
<File RelativePath="..\panda\src\physx\physxWheelShapeDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxPlane.h"></File>
<File RelativePath="..\panda\src\physx\physxPulleyJoint.I"></File>
<File RelativePath="..\panda\src\physx\physxCylindricalJointDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxBodyDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxTriangleMeshShape.cxx"></File>
<File RelativePath="..\panda\src\physx\physxMask.h"></File>
<File RelativePath="..\panda\src\physx\physxBoxShape.I"></File>
<File RelativePath="..\panda\src\physx\physxPrismaticJoint.I"></File>
<File RelativePath="..\panda\src\physx\physxBoxShapeDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxManager.I"></File>
<File RelativePath="..\panda\src\physx\physxCapsuleController.I"></File>
<File RelativePath="..\panda\src\physx\physxWheelShape.h"></File>
<File RelativePath="..\panda\src\physx\physxCapsuleShapeDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxMotorDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxSceneDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxConvexForceFieldShape.h"></File>
<File RelativePath="..\panda\src\physx\physxDistanceJoint.I"></File>
<File RelativePath="..\panda\src\physx\physxBoxShape.cxx"></File>
<File RelativePath="..\panda\src\physx\physxConstraintDominance.cxx"></File>
<File RelativePath="..\panda\src\physx\physxCapsuleShapeDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxController.I"></File>
<File RelativePath="..\panda\src\physx\physxFixedJoint.h"></File>
<File RelativePath="..\panda\src\physx\physxJoint.cxx"></File>
<File RelativePath="..\panda\src\physx\physxPointInPlaneJointDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxWheelShape.cxx"></File>
<File RelativePath="..\panda\src\physx\physxForceFieldShapeGroup.cxx"></File>
<File RelativePath="..\panda\src\physx\physxMaterialDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxContactPair.h"></File>
<File RelativePath="..\panda\src\physx\physxForceFieldShapeDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxCapsule.h"></File>
<File RelativePath="..\panda\src\physx\physxPulleyJointDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxConvexForceFieldShapeDesc.h"></File>
<File RelativePath="..\panda\src\physx\physxMemoryWriteBuffer.h"></File>
<File RelativePath="..\panda\src\physx\physxSphereForceFieldShapeDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxWheel.h"></File>
<File RelativePath="..\panda\src\physx\physxPointInPlaneJoint.cxx"></File>
<File RelativePath="..\panda\src\physx\physxRevoluteJoint.h"></File>
<File RelativePath="..\panda\src\physx\physxUtilLib.I"></File>
<File RelativePath="..\panda\src\physx\physxSphereForceFieldShape.cxx"></File>
<File RelativePath="..\panda\src\physx\physxMaterial.cxx"></File>
<File RelativePath="..\panda\src\physx\physxWheelDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxD6Joint.h"></File>
<File RelativePath="..\panda\src\physx\physxSegment.h"></File>
<File RelativePath="..\panda\src\physx\physxRevoluteJoint.I"></File>
<File RelativePath="..\panda\src\physx\physxJointDesc.cxx"></File>
<File RelativePath="..\panda\src\physx\physxD6JointDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxEnums.h"></File>
<File RelativePath="..\panda\src\physx\physx_includes.h"></File>
<File RelativePath="..\panda\src\physx\physxBounds3.cxx"></File>
<File RelativePath="..\panda\src\physx\physxPlaneShape.cxx"></File>
<File RelativePath="..\panda\src\physx\physxConvexShapeDesc.I"></File>
<File RelativePath="..\panda\src\physx\physxMaterialDesc.h"></File>
</Filter>
<Filter Name="net">
<File RelativePath="..\panda\src\net\queuedConnectionReader.cxx"></File>
<File RelativePath="..\panda\src\net\datagramGeneratorNet.I"></File>

View File

@@ -2407,50 +2407,6 @@ def SdkLocateMacOSX(osxtarget = None):
else:
SDK["MACOSX"] = ""
# Latest first
PHYSXVERSIONINFO = [
("PHYSX284", "v2.8.4"),
("PHYSX283", "v2.8.3"),
("PHYSX281", "v2.8.1"),
]
def SdkLocatePhysX():
# First check for a physx directory in sdks.
dir = GetSdkDir("physx")
if (dir and os.path.isdir(dir)):
SDK["PHYSX"] = dir
SDK["PHYSXLIBS"] = dir + "/lib"
return
if CrossCompiling():
return
# Try to find a PhysX installation on the system.
for (ver, key) in PHYSXVERSIONINFO:
if (GetHost() == "windows"):
folders = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\Folders"
for folder in ListRegistryValues(folders):
if folder.endswith("NVIDIA PhysX SDK\\%s\\SDKs\\" % key) or \
folder.endswith("NVIDIA PhysX SDK\\%s_win\\SDKs\\" % key):
SDK["PHYSX"] = folder
if GetTargetArch() == 'x64':
SDK["PHYSXLIBS"] = folder + "/lib/win64"
AddToPathEnv("PATH", folder + "/../Bin/win64/")
else:
SDK["PHYSXLIBS"] = folder + "/lib/win32"
AddToPathEnv("PATH", folder + "/../Bin/win32/")
return
elif (GetHost() == "linux"):
incpath = "/usr/include/PhysX/%s/SDKs" % key
libpath = "/usr/lib/PhysX/%s" % key
if (os.path.isdir(incpath) and os.path.isdir(libpath)):
SDK["PHYSX"] = incpath
SDK["PHYSXLIBS"] = libpath
return
def SdkLocateSpeedTree():
# Look for all of the SpeedTree SDK directories within the
# sdks/win32/speedtree dir, and pick the highest-numbered one.
@@ -2661,12 +2617,6 @@ def SdkAutoDisableMax():
WARNINGS.append("I have automatically added this command-line option: --no-"+version.lower())
PkgDisable(version)
def SdkAutoDisablePhysX():
if ("PHYSX" not in SDK) and (PkgSkip("PHYSX")==0):
PkgDisable("PHYSX")
WARNINGS.append("I cannot locate SDK for PhysX")
WARNINGS.append("I have automatically added this command-line option: --no-physx")
def SdkAutoDisableSpeedTree():
if ("SPEEDTREE" not in SDK) and (PkgSkip("SPEEDTREE")==0):
PkgDisable("SPEEDTREE")

View File

@@ -1,19 +0,0 @@
/**
* @file pandaphysx.cxx
* @author pratt
* @date 2006-04-20
*/
#include "pandaphysx.h"
#include "config_physx.h"
/**
* Initializes the library. This must be called at least once before any of
* the functions or classes in this library can be used. Normally it will be
* called by the static initializers and need not be called explicitly, but
* special cases exist.
*/
void
init_libpandaphysx() {
init_libphysx();
}

View File

@@ -1,14 +0,0 @@
/**
* @file pandaphysx.h
* @author pratt
* @date 2006-04-20
*/
#ifndef PANDAPHYSX_H
#define PANDAPHYSX_H
#include "pandabase.h"
EXPCL_PANDAPHYSX void init_libpandaphysx();
#endif

View File

@@ -531,14 +531,6 @@
#define EXPTP_PANDAPHYSICS IMPORT_TEMPL
#endif
#ifdef BUILDING_PANDAPHYSX
#define EXPCL_PANDAPHYSX EXPORT_CLASS
#define EXPTP_PANDAPHYSX EXPORT_TEMPL
#else
#define EXPCL_PANDAPHYSX IMPORT_CLASS
#define EXPTP_PANDAPHYSX IMPORT_TEMPL
#endif
#ifdef BUILDING_PANDASKEL
#define EXPCL_PANDASKEL EXPORT_CLASS
#define EXPTP_PANDASKEL EXPORT_TEMPL

View File

@@ -1,178 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file config_physx.cxx
* @author enn0x
* @date 2009-09-01
*/
#include "config_physx.h"
#include "pandaSystem.h"
#include "physxActor.h"
#include "physxBoxController.h"
#include "physxBoxForceFieldShape.h"
#include "physxBoxShape.h"
#include "physxCapsuleController.h"
#include "physxCapsuleForceFieldShape.h"
#include "physxCapsuleShape.h"
#include "physxCcdSkeleton.h"
#include "physxCloth.h"
#include "physxClothMesh.h"
#include "physxClothNode.h"
#include "physxContactPair.h"
#include "physxContactPoint.h"
#include "physxController.h"
#include "physxControllerReport.h"
#include "physxControllerShapeHit.h"
#include "physxControllersHit.h"
#include "physxConvexMesh.h"
#include "physxConvexForceFieldShape.h"
#include "physxConvexShape.h"
#include "physxCylindricalJoint.h"
#include "physxD6Joint.h"
#include "physxDebugGeomNode.h"
#include "physxDistanceJoint.h"
#include "physxFixedJoint.h"
#include "physxForceField.h"
#include "physxForceFieldShape.h"
#include "physxForceFieldShapeGroup.h"
#include "physxHeightField.h"
#include "physxHeightFieldShape.h"
#include "physxJoint.h"
#include "physxMaterial.h"
#include "physxObject.h"
#include "physxPlaneShape.h"
#include "physxPointInPlaneJoint.h"
#include "physxPointOnLineJoint.h"
#include "physxPrismaticJoint.h"
#include "physxPulleyJoint.h"
#include "physxRevoluteJoint.h"
#include "physxScene.h"
#include "physxShape.h"
#include "physxSoftBody.h"
#include "physxSoftBodyMesh.h"
#include "physxSoftBodyNode.h"
#include "physxSphereForceFieldShape.h"
#include "physxSphereShape.h"
#include "physxSphericalJoint.h"
#include "physxTriangleMesh.h"
#include "physxTriangleMeshShape.h"
#include "physxVehicle.h"
#include "physxWheel.h"
#include "physxWheelShape.h"
#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDAPHYSX)
#error Buildsystem error: BUILDING_PANDAPHYSX not defined
#endif
ConfigureDef(config_physx);
NotifyCategoryDef(physx, "");
ConfigureFn(config_physx) {
init_libphysx();
}
ConfigVariableBool physx_want_vrd
("physx-want-vrd", false,
PRC_DESC("Specified wether the manager should try to connect to the NVIDIA "
"PhysX visual debugger or not. Connection is established when "
"the first instance of PhysxManager is created."));
ConfigVariableString physx_vrd_host
("physx-vrd-host", "localhost",
PRC_DESC("Specified the host where the NVIDIA PhysX visual debugger is running "
"on. Only used if the config-varibale 'physx-want-visual-debugger' "
"is set to 'true'."));
ConfigVariableInt physx_vrd_port
("physx-visual-debugger-port", 5425,
PRC_DESC("Specified the port where the NVIDIA PhysX visual debugger is running "
"on. Only used if the config-varibale 'physx-want-visual-debugger' "
"is set to 'true'."));
ConfigVariableEnum<PhysxEnums::PhysxUpAxis> physx_up_axis
("physx-up-axis", PhysxEnums::Z_up,
PRC_DESC("Set the up direction for controllers and heightfields."));
ConfigVariableInt physx_internal_threads
("physx-internal-threads", 0,
PRC_DESC("Specified the number of internal threads to be created by the "
"PhysX engine. The threads will be moved to different cores, if "
"possible. Default value is '0'. PhysX then runs in an external "
"thread, but no additional internal threads will be created."));
/**
* Initializes the library. This must be called at least once before any of
* the functions or classes in this library can be used. Normally it will be
* called by the static initializers and need not be called explicitly, but
* special cases exist.
*/
void
init_libphysx() {
static bool initialized = false;
if (initialized) {
return;
}
initialized = true;
PhysxActor::init_type();
PhysxBoxController::init_type();
PhysxBoxForceFieldShape::init_type();
PhysxBoxShape::init_type();
PhysxCapsuleController::init_type();
PhysxCapsuleForceFieldShape::init_type();
PhysxCapsuleShape::init_type();
PhysxCcdSkeleton::init_type();
PhysxCloth::init_type();
PhysxClothMesh::init_type();
PhysxClothNode::init_type();
PhysxContactPair::init_type();
PhysxContactPoint::init_type();
PhysxController::init_type();
PhysxControllerShapeHit::init_type();
PhysxControllersHit::init_type();
PhysxConvexMesh::init_type();
PhysxConvexForceFieldShape::init_type();
PhysxConvexShape::init_type();
PhysxCylindricalJoint::init_type();
PhysxD6Joint::init_type();
PhysxDebugGeomNode::init_type();
PhysxDistanceJoint::init_type();
PhysxFixedJoint::init_type();
PhysxForceField::init_type();
PhysxForceFieldShape::init_type();
PhysxForceFieldShapeGroup::init_type();
PhysxHeightField::init_type();
PhysxHeightFieldShape::init_type();
PhysxJoint::init_type();
PhysxMaterial::init_type();
PhysxObject::init_type();
PhysxPlaneShape::init_type();
PhysxPointInPlaneJoint::init_type();
PhysxPointOnLineJoint::init_type();
PhysxPrismaticJoint::init_type();
PhysxPulleyJoint::init_type();
PhysxRevoluteJoint::init_type();
PhysxScene::init_type();
PhysxShape::init_type();
PhysxSoftBody::init_type();
PhysxSoftBodyMesh::init_type();
PhysxSoftBodyNode::init_type();
PhysxSphereForceFieldShape::init_type();
PhysxSphereShape::init_type();
PhysxSphericalJoint::init_type();
PhysxTriangleMesh::init_type();
PhysxTriangleMeshShape::init_type();
PhysxVehicle::init_type();
PhysxWheel::init_type();
PhysxWheelShape::init_type();
PandaSystem *ps = PandaSystem::get_global_ptr();
ps->add_system("PhysX");
}

View File

@@ -1,38 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file config_physx.h
* @author enn0x
* @date 2009-09-01
*/
#ifndef CONFIG_PHYSX_H
#define CONFIG_PHYSX_H
#include "pandabase.h"
#include "notifyCategoryProxy.h"
#include "configVariableBool.h"
#include "configVariableEnum.h"
#include "configVariableInt.h"
#include "configVariableString.h"
#include "dconfig.h"
#include "physxEnums.h"
ConfigureDecl(config_physx, EXPCL_PANDAPHYSX, EXPTP_PANDAPHYSX);
NotifyCategoryDecl(physx, EXPCL_PANDAPHYSX, EXPTP_PANDAPHYSX);
extern EXPCL_PANDAPHYSX ConfigVariableBool physx_want_vrd;
extern EXPCL_PANDAPHYSX ConfigVariableString physx_vrd_host;
extern EXPCL_PANDAPHYSX ConfigVariableInt physx_vrd_port;
extern EXPCL_PANDAPHYSX ConfigVariableInt physx_internal_threads;
extern EXPCL_PANDAPHYSX ConfigVariableEnum<PhysxEnums::PhysxUpAxis> physx_up_axis;
extern EXPCL_PANDAPHYSX void init_libphysx();
#endif // CONFIG_PHYSX_H

View File

@@ -1,129 +0,0 @@
#include "config_physx.cxx"
#include "physxActor.cxx"
#include "physxActorDesc.cxx"
#include "physxBodyDesc.cxx"
#include "physxBounds3.cxx"
#include "physxBox.cxx"
#include "physxBoxController.cxx"
#include "physxBoxControllerDesc.cxx"
#include "physxBoxForceFieldShape.cxx"
#include "physxBoxForceFieldShapeDesc.cxx"
#include "physxBoxShape.cxx"
#include "physxBoxShapeDesc.cxx"
#include "physxCapsule.cxx"
#include "physxCapsuleController.cxx"
#include "physxCapsuleControllerDesc.cxx"
#include "physxCapsuleForceFieldShape.cxx"
#include "physxCapsuleForceFieldShapeDesc.cxx"
#include "physxCapsuleShape.cxx"
#include "physxCapsuleShapeDesc.cxx"
#include "physxCcdSkeleton.cxx"
#include "physxCcdSkeletonDesc.cxx"
#include "physxCloth.cxx"
#include "physxClothDesc.cxx"
#include "physxClothMesh.cxx"
#include "physxClothMeshDesc.cxx"
#include "physxClothNode.cxx"
#include "physxContactPair.cxx"
#include "physxContactPoint.cxx"
#include "physxContactReport.cxx"
#include "physxController.cxx"
#include "physxControllerDesc.cxx"
#include "physxControllerReport.cxx"
#include "physxControllerShapeHit.cxx"
#include "physxControllersHit.cxx"
#include "physxConstraintDominance.cxx"
#include "physxConvexForceFieldShape.cxx"
#include "physxConvexForceFieldShapeDesc.cxx"
#include "physxConvexMesh.cxx"
#include "physxConvexMeshDesc.cxx"
#include "physxConvexShape.cxx"
#include "physxConvexShapeDesc.cxx"
#include "physxCylindricalJoint.cxx"
#include "physxCylindricalJointDesc.cxx"
#include "physxD6Joint.cxx"
#include "physxD6JointDesc.cxx"
#include "physxDebugGeomNode.cxx"
#include "physxDistanceJoint.cxx"
#include "physxDistanceJointDesc.cxx"
#include "physxEnums.cxx"
#include "physxFileStream.cxx"
#include "physxFixedJoint.cxx"
#include "physxFixedJointDesc.cxx"
#include "physxForceField.cxx"
#include "physxForceFieldDesc.cxx"
#include "physxForceFieldShape.cxx"
#include "physxForceFieldShapeDesc.cxx"
#include "physxForceFieldShapeGroup.cxx"
#include "physxForceFieldShapeGroupDesc.cxx"
#include "physxGroupsMask.cxx"
#include "physxHeightField.cxx"
#include "physxHeightFieldDesc.cxx"
#include "physxHeightFieldShape.cxx"
#include "physxHeightFieldShapeDesc.cxx"
#include "physxJoint.cxx"
#include "physxJointDesc.cxx"
#include "physxJointDriveDesc.cxx"
#include "physxJointLimitDesc.cxx"
#include "physxJointLimitSoftDesc.cxx"
#include "physxKitchen.cxx"
#include "physxLinearInterpolationValues.cxx"
#include "physxManager.cxx"
#include "physxMask.cxx"
#include "physxMaterial.cxx"
#include "physxMaterialDesc.cxx"
#include "physxMemoryReadBuffer.cxx"
#include "physxMemoryWriteBuffer.cxx"
#include "physxMeshHash.cxx"
#include "physxMeshPool.cxx"
#include "physxMotorDesc.cxx"
#include "physxObject.cxx"
#include "physxObjectCollection.cxx"
#include "physxOverlapReport.cxx"
#include "physxPlane.cxx"
#include "physxPlaneShape.cxx"
#include "physxPlaneShapeDesc.cxx"
#include "physxPointInPlaneJoint.cxx"
#include "physxPointInPlaneJointDesc.cxx"
#include "physxPointOnLineJoint.cxx"
#include "physxPointOnLineJointDesc.cxx"
#include "physxPrismaticJoint.cxx"
#include "physxPrismaticJointDesc.cxx"
#include "physxPulleyJoint.cxx"
#include "physxPulleyJointDesc.cxx"
#include "physxRay.cxx"
#include "physxRaycastHit.cxx"
#include "physxRaycastReport.cxx"
#include "physxRevoluteJoint.cxx"
#include "physxRevoluteJointDesc.cxx"
#include "physxScene.cxx"
#include "physxSceneDesc.cxx"
#include "physxSceneStats2.cxx"
#include "physxSegment.cxx"
#include "physxShape.cxx"
#include "physxShapeDesc.cxx"
#include "physxSoftBody.cxx"
#include "physxSoftBodyDesc.cxx"
#include "physxSoftBodyMesh.cxx"
#include "physxSoftBodyMeshDesc.cxx"
#include "physxSoftBodyNode.cxx"
#include "physxSphere.cxx"
#include "physxSphereForceFieldShape.cxx"
#include "physxSphereForceFieldShapeDesc.cxx"
#include "physxSphereShape.cxx"
#include "physxSphereShapeDesc.cxx"
#include "physxSphericalJoint.cxx"
#include "physxSphericalJointDesc.cxx"
#include "physxSpringDesc.cxx"
#include "physxTriangleMesh.cxx"
#include "physxTriangleMeshDesc.cxx"
#include "physxTriangleMeshShape.cxx"
#include "physxTriangleMeshShapeDesc.cxx"
#include "physxTriggerReport.cxx"
#include "physxUtilLib.cxx"
#include "physxVehicle.cxx"
#include "physxVehicleDesc.cxx"
#include "physxWheel.cxx"
#include "physxWheelDesc.cxx"
#include "physxWheelShape.cxx"
#include "physxWheelShapeDesc.cxx"

View File

@@ -1,60 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxActor.I
* @author enn0x
* @date 2009-09-14
*/
/**
*
*/
INLINE PhysxActor::
PhysxActor() : PhysxObject() {
}
/**
*
*/
INLINE PhysxActor::
~PhysxActor() {
}
/**
*
*/
INLINE void PhysxActor::
ls() const {
ls(nout);
}
/**
*
*/
INLINE void PhysxActor::
ls(std::ostream &out, int indent_level) const {
indent(out, indent_level) << get_type().get_name()
<< " " << _name
<< " (at 0x" << this << ")";
if (!_np.is_empty()) {
out << " NP:" << _np;
}
if (_controller) {
out << " C:0x" << _controller;
}
out << "\n";
_shapes.ls(out, indent_level);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,222 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxActor.h
* @author enn0x
* @date 2009-09-14
*/
#ifndef PHYSXACTOR_H
#define PHYSXACTOR_H
#include "pandabase.h"
#include "nodePath.h"
#include "luse.h"
#include "physxObject.h"
#include "physxObjectCollection.h"
#include "physxEnums.h"
#include "physx_includes.h"
class PhysxController;
class PhysxScene;
class PhysxShape;
class PhysxShapeDesc;
class PhysxActorDesc;
class PhysxBodyDesc;
/**
* Actors are the main simulation objects. Actors are owned by a scene
* (PhysxScene).
*
* An actor may optionally encapsulate a dynamic rigid body by setting the
* body member of the actor's descriptor when it is created. Otherwise the
* actor will be static (fixed in the world).
*
* Instances of PhysxActor are created by calling PhysxScene::create_actor()
* and destroyed by calling PhysxActor::release().
*/
class EXPCL_PANDAPHYSX PhysxActor : public PhysxObject, public PhysxEnums {
PUBLISHED:
INLINE PhysxActor();
INLINE ~PhysxActor();
bool save_body_to_desc(PhysxBodyDesc &bodyDesc) const;
void save_to_desc(PhysxActorDesc &actorDesc) const;
void set_name(const char *name);
void set_global_pos(const LPoint3f &pos);
void set_global_mat(const LMatrix4f &mat);
void set_global_hpr(float h, float p, float r);
void set_body_flag(PhysxBodyFlag flag, bool value);
void set_actor_flag(PhysxActorFlag flag, bool value);
void set_contact_report_flag(PhysxContactPairFlag flag, bool value);
void set_contact_report_threshold(float threshold);
void set_group(unsigned int group);
void set_dominance_group(unsigned int group);
void set_shape_group( unsigned int group );
const char *get_name() const;
LPoint3f get_global_pos() const;
LMatrix4f get_global_mat() const;
LQuaternionf get_global_quat() const;
bool get_body_flag(PhysxBodyFlag flag) const;
bool get_actor_flag(PhysxActorFlag flag) const;
unsigned int get_group() const;
unsigned int get_dominance_group() const;
bool is_dynamic() const;
float compute_kinetic_energy() const;
bool update_mass_from_shapes(float density, float totalMass);
PhysxScene *get_scene() const;
// NodePath
void attach_node_path(const NodePath &np);
void detach_node_path();
NodePath get_node_path() const;
// Shapes
unsigned int get_num_shapes() const;
PhysxShape *create_shape(PhysxShapeDesc &desc);
PhysxShape *get_shape(unsigned int idx) const;
PhysxShape *get_shape_by_name(const char *name) const;
MAKE_SEQ(get_shapes, get_num_shapes, get_shape);
// Forces
void add_force(const LVector3f force,
PhysxForceMode mode=FM_force, bool wakeup=true);
void add_force_at_pos(const LVector3f force, const LPoint3f &pos,
PhysxForceMode mode=FM_force, bool wakeup=true);
void add_force_at_local_pos(const LVector3f force, const LPoint3f &pos,
PhysxForceMode mode=FM_force, bool wakeup=true);
void add_torque(const LVector3f torque,
PhysxForceMode mode=FM_force, bool wakeup=true);
void add_local_force(const LVector3f force,
PhysxForceMode mode=FM_force, bool wakeup=true);
void add_local_force_at_pos(const LVector3f force, const LPoint3f &pos,
PhysxForceMode mode=FM_force, bool wakeup=true);
void add_local_force_at_local_pos(const LVector3f force, const LPoint3f &pos,
PhysxForceMode mode=FM_force, bool wakeup=true);
void add_local_torque(const LVector3f torque,
PhysxForceMode mode=FM_force, bool wakeup=true);
// Mass manipulation
void set_mass(float mass);
void set_c_mass_offset_local_mat(const LMatrix4f &mat);
void set_c_mass_offset_local_pos(const LPoint3f &pos);
void set_c_mass_offset_local_orientation(const LMatrix3f &mat);
void set_c_mass_offset_global_mat(const LMatrix4f &mat);
void set_c_mass_offset_global_pos(const LPoint3f &pos);
void set_c_mass_offset_global_orientation(const LMatrix3f &mat);
void set_c_mass_global_mat(const LMatrix4f &mat);
void set_c_mass_global_pos(const LPoint3f &pos);
void set_c_mass_global_orientation(const LMatrix3f &mat);
void set_mass_space_inertia_tensor(const LVector3f &m);
float get_mass() const;
LMatrix4f get_c_mass_global_mat() const;
LPoint3f get_c_mass_global_pos() const;
LMatrix3f get_c_mass_global_orientation() const;
LMatrix4f get_c_mass_local_mat() const;
LPoint3f get_c_mass_local_pos() const;
LMatrix3f get_c_mass_local_orientation() const;
LVector3f get_mass_space_inertia_tensor() const;
LMatrix3f get_global_inertia_tensor() const;
LMatrix3f get_global_inertia_tensor_inverse() const;
// Damping
void set_linear_damping(float linDamp);
void set_angular_damping(float angDamp);
float get_linear_damping() const;
float get_angular_damping() const;
// Velocity
void set_linear_velocity(const LVector3f &linVel);
void set_angular_velocity(const LVector3f &angVel);
void set_max_angular_velocity(float maxAngVel);
LVector3f get_linear_velocity() const;
LVector3f get_angular_velocity() const;
float get_max_angular_velocity() const;
// Point Velocity
LVector3f get_point_velocity(const LPoint3f &point) const;
LVector3f get_local_point_velocity(const LPoint3f &point) const;
// Momentum
void set_linear_momentum(const LVector3f &momentum);
void set_angular_momentum(const LVector3f &momentum);
LVector3f get_linear_momentum() const;
LVector3f get_angular_momentum() const;
// Sleeping
void set_sleep_linear_velocity(float threshold);
void set_sleep_angular_velocity(float threshold);
void set_sleep_energy_threshold(float threshold);
float get_sleep_linear_velocity() const;
float get_sleep_angular_velocity() const;
float get_sleep_energy_threshold() const;
bool is_sleeping() const;
void wake_up(float wakeCounterValue=NX_SLEEP_INTERVAL);
void put_to_sleep();
// Kinematic
void move_global_pos(const LPoint3f &pos);
void move_global_mat(const LMatrix4f &mat);
void move_global_hpr(float h, float p, float r);
INLINE void ls() const;
INLINE void ls(std::ostream &out, int indent_level=0) const;
public:
void update_transform(const LMatrix4f &m);
PUBLISHED:
void release();
public:
INLINE NxActor *ptr() const { return _ptr; };
void link_controller(PhysxController *controller);
void link(NxActor *ptr);
void unlink();
PhysxObjectCollection<PhysxShape> _shapes;
private:
NxActor *_ptr;
NodePath _np;
PT(PhysxController) _controller;
std::string _name;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
PhysxObject::init_type();
register_type(_type_handle, "PhysxActor",
PhysxObject::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {
init_type();
return get_class_type();
}
private:
static TypeHandle _type_handle;
};
#include "physxActor.I"
#endif // PHYSXACTOR_H

View File

@@ -1,48 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxActorDesc.I
* @author enn0x
* @date 2009-09-05
*/
/**
*
*/
INLINE PhysxActorDesc::
PhysxActorDesc() {
set_to_default();
}
/**
*
*/
INLINE PhysxActorDesc::
~PhysxActorDesc() {
}
/**
* (re)sets the structure to the default.
*/
INLINE void PhysxActorDesc::
set_to_default() {
_desc.setToDefault();
set_name("");
}
/**
* Returns true if the descriptor is valid.
*/
INLINE bool PhysxActorDesc::
is_valid() const {
return _desc.isValid();
}

View File

@@ -1,138 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxActorDesc.cxx
* @author enn0x
* @date 2009-09-05
*/
#include "physxActorDesc.h"
#include "physxBodyDesc.h"
#include "physxManager.h"
/**
* Adds a shape to the list of collision shapes composing this actor.
*/
void PhysxActorDesc::
add_shape(PhysxShapeDesc &desc) {
_desc.shapes.push_back(desc.ptr());
}
/**
* Sets the optional debug name for the actor.
*/
void PhysxActorDesc::
set_name(const char *name) {
_name = name ? name : "";
_desc.name = _name.c_str();
}
/**
* Set the density used during mass/intertia computation. This value is used
* if the actor's shapes do not have a mass asigned.
*/
void PhysxActorDesc::
set_density(float density) {
_desc.density = density;
}
/**
* Set the position of the actor in global space.
*/
void PhysxActorDesc::
set_global_pos(const LPoint3f &pos) {
_desc.globalPose.t = PhysxManager::point3_to_nxVec3(pos);
}
/**
* Set the position and orientation of the actor in global space. Scaling and
* shear arenot supported, even if the matrix contains a scale or shear.
*/
void PhysxActorDesc::
set_global_mat(const LMatrix4f &mat) {
_desc.globalPose = PhysxManager::mat4_to_nxMat34(mat);
}
/**
* Sets the orientation of the actor in global space by providing angles for
* heading, pitch and roll.
*/
void PhysxActorDesc::
set_global_hpr(float h, float p, float r) {
LQuaternionf q;
LMatrix3f rot;
NxMat34 m;
q.set_hpr(LVector3f(h, p, r));
q.extract_to_matrix(rot);
_desc.globalPose.M = PhysxManager::mat3_to_nxMat33(rot);
}
/**
* Sets the body descriptor for this actor. The actor will be dynmaic if a
* body descriptor is set, and static if no body descriptor is set.
*/
void PhysxActorDesc::
set_body(PhysxBodyDesc &desc) {
_desc.body = &(desc._desc);
}
/**
* Gets the body descriptor for this actor.
*/
PhysxBodyDesc PhysxActorDesc::
get_body() const {
assert(false /* Not implemented */);
// PhysxBodyDesc value; value._desc = *(_desc.body); return value;
return PhysxBodyDesc();
}
/**
* Returns the optional debug name for this actor.
*/
const char *PhysxActorDesc::
get_name() const {
return _desc.name;
}
/**
* Returns the actor's density.
*/
float PhysxActorDesc::
get_density() const {
return _desc.density;
}
/**
* Returns the actor's position in global space.
*/
LPoint3f PhysxActorDesc::
get_global_pos() const {
return PhysxManager::nxVec3_to_point3(_desc.globalPose.t);
}
/**
* Returns the actor's transform in global space.
*/
LMatrix4f PhysxActorDesc::
get_global_mat() const {
return PhysxManager::nxMat34_to_mat4(_desc.globalPose);
}

View File

@@ -1,61 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxActorDesc.h
* @author enn0x
* @date 2009-09-05
*/
#ifndef PHYSXACTORDESC_H
#define PHYSXACTORDESC_H
#include "pandabase.h"
#include "luse.h"
#include "physx_includes.h"
class PhysxBodyDesc;
class PhysxShapeDesc;
/**
* Descriptor for PhysxActor.
*/
class EXPCL_PANDAPHYSX PhysxActorDesc {
PUBLISHED:
INLINE PhysxActorDesc();
INLINE ~PhysxActorDesc();
INLINE void set_to_default();
INLINE bool is_valid() const;
void add_shape(PhysxShapeDesc &desc);
void set_name(const char *name);
void set_density(float density);
void set_global_pos(const LPoint3f &pos);
void set_global_mat(const LMatrix4f &mat);
void set_global_hpr(float h, float p, float r);
void set_body(PhysxBodyDesc &desc);
const char *get_name() const;
float get_density() const;
LPoint3f get_global_pos() const;
LMatrix4f get_global_mat() const;
PhysxBodyDesc get_body() const;
public:
NxActorDesc _desc;
private:
std::string _name;
};
#include "physxActorDesc.I"
#endif // PHYSXACTORDESC_H

View File

@@ -1,46 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBodyDesc.I
* @author enn0x
* @date 2009-09-05
*/
/**
*
*/
INLINE PhysxBodyDesc::
PhysxBodyDesc() {
}
/**
*
*/
INLINE PhysxBodyDesc::
~PhysxBodyDesc() {
}
/**
* (re)sets the structure to the default.
*/
INLINE void PhysxBodyDesc::
set_to_default() {
_desc.setToDefault();
}
/**
* Returns true if the descriptor is valid.
*/
INLINE bool PhysxBodyDesc::
is_valid() const {
return _desc.isValid();
}

View File

@@ -1,330 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBodyDesc.cxx
* @author enn0x
* @date 2009-09-05
*/
#include "physxBodyDesc.h"
/**
* Set the mass of body.
*/
void PhysxBodyDesc::
set_mass(float mass) {
_desc.mass = mass;
}
/**
* Get the mass of body.
*/
float PhysxBodyDesc::
get_mass() const {
return _desc.mass;
}
/**
* Set the linear damping applied to the body.
*/
void PhysxBodyDesc::
set_linear_damping(float damping) {
_desc.linearDamping = damping;
}
/**
* Get the linear damping applied to the body.
*/
float PhysxBodyDesc::
get_linear_damping() const {
return _desc.linearDamping;
}
/**
* Set the angular damping applied to the body.
*/
void PhysxBodyDesc::
set_angular_damping(float damping) {
_desc.angularDamping = damping;
}
/**
* Get the angular damping applied to the body.
*/
float PhysxBodyDesc::
get_angular_damping() const {
return _desc.angularDamping;
}
/**
* Set the linear Velocity of the body.
*/
void PhysxBodyDesc::
set_linear_velocity(const LVector3f &velocity) {
_desc.linearVelocity = PhysxManager::vec3_to_nxVec3(velocity);
}
/**
* Get the linear Velocity of the body.
*/
LVector3f PhysxBodyDesc::
get_linear_velocity() const {
return PhysxManager::nxVec3_to_vec3(_desc.linearVelocity);
}
/**
* Set the angular velocity of the body.
*/
void PhysxBodyDesc::
set_angular_velocity(const LVector3f &velocity) {
_desc.angularVelocity = PhysxManager::vec3_to_nxVec3(velocity);
}
/**
* Get the angular velocity of the body.
*/
LVector3f PhysxBodyDesc::
get_angular_velocity() const {
return PhysxManager::nxVec3_to_vec3(_desc.angularVelocity);
}
/**
* Set the maximum allowed angular velocity for this body.
*/
void PhysxBodyDesc::
set_max_angular_velocity(float maximum) {
_desc.maxAngularVelocity = maximum;
}
/**
* Get the maximum allowed angular velocity for this body.
*/
float PhysxBodyDesc::
get_max_angular_velocity() const {
return _desc.maxAngularVelocity;
}
/**
* Set the maximum linear velocity at which the body can go to sleep.
*/
void PhysxBodyDesc::
set_sleep_linear_velocity(float velocity) {
_desc.sleepLinearVelocity = velocity;
}
/**
* Get the maximum linear velocity at which the body can go to sleep.
*/
float PhysxBodyDesc::
get_sleep_linear_velocity() const {
return _desc.sleepLinearVelocity;
}
/**
* Set the maximum angular velocity at which body can go to sleep.
*/
void PhysxBodyDesc::
set_sleep_angular_velocity(float velocity) {
_desc.sleepAngularVelocity = velocity;
}
/**
* Get the maximum angular velocity at which body can go to sleep.
*/
float PhysxBodyDesc::
get_sleep_angular_velocity() const {
return _desc.sleepAngularVelocity;
}
/**
* Set the number of solver iterations performed when processing
* joint/contacts connected to this body.
*/
void PhysxBodyDesc::
set_solver_iteration_count(unsigned int count) {
_desc.solverIterationCount = count;
}
/**
* Get the number of solver iterations performed when processing
* joint/contacts connected to this body.
*/
unsigned int PhysxBodyDesc::
get_solver_iteration_count() const {
return _desc.solverIterationCount;
}
/**
* Set the threshold for the energy-based sleeping algorithm. Only used when
* the BF_energy_sleep_test flag is set.
*/
void PhysxBodyDesc::
set_sleep_energy_threshold(float threshold) {
_desc.sleepEnergyThreshold = threshold;
}
/**
* Get the threshold for the energy-based sleeping algorithm. Only used when
* the BF_energy_sleep_test flag is set.
*/
float PhysxBodyDesc::
get_sleep_energy_threshold() const {
return _desc.sleepEnergyThreshold;
}
/**
* Set the damping factor for bodies that are about to sleep.
*/
void PhysxBodyDesc::
set_sleep_damping(float damping) {
_desc.sleepDamping = damping;
}
/**
* Get the damping factor for bodies that are about to sleep.
*/
float PhysxBodyDesc::
get_sleep_damping() const {
return _desc.sleepDamping;
}
/**
* Set the position and orientation of the center of mass.
*/
void PhysxBodyDesc::
set_mass_local_mat(const LMatrix4f &mat) {
_desc.massLocalPose = PhysxManager::mat4_to_nxMat34(mat);
}
/**
* Get the position and orientation of the center of mass.
*/
LMatrix4f PhysxBodyDesc::
get_mass_local_mat() const {
return PhysxManager::nxMat34_to_mat4(_desc.massLocalPose);
}
/**
* Set the diagonal mass space inertia tensor in bodies mass frame.
*/
void PhysxBodyDesc::
set_mass_space_inertia(const LVector3f &inertia) {
_desc.massSpaceInertia = PhysxManager::vec3_to_nxVec3(inertia);
}
/**
* Get the diagonal mass space inertia tensor in bodies mass frame.
*/
LVector3f PhysxBodyDesc::
get_mass_space_inertia() const {
return PhysxManager::nxVec3_to_vec3(_desc.massSpaceInertia);
}
/**
* Raise or lower individual body flags.
*/
void PhysxBodyDesc::
set_flag(const PhysxBodyFlag flag, bool value) {
if (value == true) {
_desc.flags |= flag;
}
else {
_desc.flags &= ~(flag);
}
}
/**
* Returns the specified body flag.
*/
bool PhysxBodyDesc::
get_flag(const PhysxBodyFlag flag) const {
return (_desc.flags & flag) ? true : false;
}
/**
* When CCD is globally enabled, it is still not performed if the motion
* distance of all points on the body is below this threshold.
*/
void PhysxBodyDesc::
set_ccd_motion_threshold(float threshold) {
_desc.CCDMotionThreshold = threshold;
}
/**
*
*/
float PhysxBodyDesc::
get_ccd_motion_threshold() const {
return _desc.CCDMotionThreshold;
}
/**
* Set the body's initial wake up counter.
*/
void PhysxBodyDesc::
set_wake_up_counter(float value) {
_desc.wakeUpCounter = value;
}
/**
*
*/
float PhysxBodyDesc::
get_wake_up_counter() const {
return _desc.wakeUpCounter;
}
/**
* Set The force threshold for contact reports.
*/
void PhysxBodyDesc::
set_contact_report_threshold(float threshold) {
_desc.contactReportThreshold = threshold;
}
/**
*
*/
float PhysxBodyDesc::
get_contact_report_threshold() const {
return _desc.contactReportThreshold;
}

View File

@@ -1,77 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBodyDesc.h
* @author enn0x
* @date 2009-09-05
*/
#ifndef PHYSXBODYDESC_H
#define PHYSXBODYDESC_H
#include "pandabase.h"
#include "luse.h"
#include "physxEnums.h"
#include "physx_includes.h"
/**
* Descriptor for the optional rigid body dynamic state of PhysxActor.
*/
class EXPCL_PANDAPHYSX PhysxBodyDesc : public PhysxEnums {
PUBLISHED:
INLINE PhysxBodyDesc();
INLINE ~PhysxBodyDesc();
INLINE void set_to_default();
INLINE bool is_valid() const;
void set_mass(float mass);
void set_linear_damping(float damping);
void set_angular_damping(float damping);
void set_linear_velocity(const LVector3f &velocity);
void set_angular_velocity(const LVector3f &velocity);
void set_max_angular_velocity(float maximum);
void set_sleep_linear_velocity(float velocity);
void set_sleep_angular_velocity(float velocity);
void set_solver_iteration_count(unsigned int count);
void set_sleep_energy_threshold(float threshold);
void set_sleep_damping(float damping);
void set_mass_local_mat(const LMatrix4f &mat);
void set_mass_space_inertia(const LVector3f &inertia);
void set_flag(PhysxBodyFlag flag, bool value);
void set_ccd_motion_threshold(float threshold);
void set_wake_up_counter(float value);
void set_contact_report_threshold(float threshold);
float get_mass() const;
float get_linear_damping() const;
float get_angular_damping() const;
LVector3f get_linear_velocity() const;
LVector3f get_angular_velocity() const;
float get_max_angular_velocity() const;
float get_sleep_linear_velocity() const;
float get_sleep_angular_velocity() const;
unsigned int get_solver_iteration_count() const;
float get_sleep_energy_threshold() const;
float get_sleep_damping() const;
LMatrix4f get_mass_local_mat() const;
LVector3f get_mass_space_inertia() const;
bool get_flag(PhysxBodyFlag flag) const;
float get_ccd_motion_threshold() const;
float get_wake_up_counter() const;
float get_contact_report_threshold() const;
public:
NxBodyDesc _desc;
};
#include "physxBodyDesc.I"
#endif // PHYSXBODYDESC_H

View File

@@ -1,28 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBounds3.I
* @author enn0x
* @date 2009-10-31
*/
/**
*
*/
INLINE PhysxBounds3::
PhysxBounds3() {
}
/**
*
*/
INLINE PhysxBounds3::
~PhysxBounds3() {
}

View File

@@ -1,229 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBounds3.cxx
* @author enn0x
* @date 2009-10-31
*/
#include "physxBounds3.h"
#include "physxManager.h"
/**
* Returns the minimum corner of the bounding box.
*/
LPoint3f PhysxBounds3::
get_max() const {
return PhysxManager::nxVec3_to_point3(_bounds.max);
}
/**
* Returns the maximum corner of the bounding box.
*/
LPoint3f PhysxBounds3::
get_min() const {
return PhysxManager::nxVec3_to_point3(_bounds.min);
}
/**
* Returns the center of the bounding box.
*/
LPoint3f PhysxBounds3::
get_center() const {
NxVec3 center;
_bounds.getCenter(center);
return PhysxManager::nxVec3_to_point3(center);
}
/**
* Returns the extents of the bounding box.
*/
LVector3f PhysxBounds3::
get_dimensions() const {
NxVec3 dims;
_bounds.getDimensions(dims);
return PhysxManager::nxVec3_to_vec3(dims);
}
/**
* Sets the maximum corner of the bounding box.
*/
void PhysxBounds3::
set_max(LPoint3f value) {
nassertv(!value.is_nan());
_bounds.max = PhysxManager::point3_to_nxVec3(value);
}
/**
* Sets the minimum corner of the bounding box.
*/
void PhysxBounds3::
set_min(LPoint3f value) {
nassertv(!value.is_nan());
_bounds.min = PhysxManager::point3_to_nxVec3(value);
}
/**
* Sets this to the AABB (axis ligned bounding box) of the OBB (oriented
* bounding box). The OBB is described by orientation, translation and half
* dimensions.
*/
void PhysxBounds3::
bounds_of_obb(const LMatrix3f &orientation, const LPoint3f &translation, const LVector3f &half_dims) {
nassertv(!orientation.is_nan());
nassertv(!translation.is_nan());
nassertv(!half_dims.is_nan());
_bounds.boundsOfOBB(PhysxManager::mat3_to_nxMat33(orientation),
PhysxManager::point3_to_nxVec3(translation),
PhysxManager::vec3_to_nxVec3(half_dims));
}
/**
* Sets this to the union of this and b2.
*/
void PhysxBounds3::
combine(const PhysxBounds3 &b2) {
_bounds.combine(b2._bounds);
}
/**
* Returns TRUE if these bounds contain the point v.
*/
bool PhysxBounds3::
contain(const LPoint3f &p) const {
nassertr(!p.is_nan(), false);
return _bounds.contain(PhysxManager::point3_to_nxVec3(p));
}
/**
* Fattens the AABB in all three dimensions by the given distance.
*/
void PhysxBounds3::
fatten(float distance) {
_bounds.fatten(distance);
}
/**
* Expands the volume to include the point v.
*/
void PhysxBounds3::
include(const LPoint3f &p) {
nassertv(!p.is_nan());
_bounds.include(PhysxManager::point3_to_nxVec3(p));
}
/**
* Returns TRUE if the intersection of this and b is is not empty.
*/
bool PhysxBounds3::
intersects(const PhysxBounds3 &b) const {
return _bounds.intersects(b._bounds);
}
/**
* Indicates whether the intersection of this and b is empty or not in the
* plane orthogonal to the axis passed (X = 0, Y = 1 or Z = 2).
*/
bool PhysxBounds3::
intersects2d(const PhysxBounds3 &b, unsigned axis_to_ignore) const {
return _bounds.intersects2D(b._bounds, axis_to_ignore);
}
/**
* Returns TRUE if the bounding box is empty.
*/
bool PhysxBounds3::
is_empty() const {
return _bounds.isEmpty();
}
/**
* Scales the AABB by the given factor.
*/
void PhysxBounds3::
scale(float scale) {
_bounds.scale(scale);
}
/**
* Setup this AABB from minimum corner and maximum corner.
*/
void PhysxBounds3::
set(const LPoint3f &min, const LPoint3f &max) {
nassertv(!min.is_nan());
nassertv(!max.is_nan());
_bounds.set(PhysxManager::point3_to_nxVec3(min),
PhysxManager::point3_to_nxVec3(max));
}
/**
* Setup this AABB from center point and extents vector.
*/
void PhysxBounds3::
set_center_extents(const LPoint3f &center, const LVector3f &extents) {
nassertv(!center.is_nan());
nassertv(!extents.is_nan());
_bounds.setCenterExtents(PhysxManager::point3_to_nxVec3(center),
PhysxManager::vec3_to_nxVec3(extents));
}
/**
* Sets empty to TRUE.
*/
void PhysxBounds3::
set_empty() {
_bounds.setEmpty();
}
/**
* Sets infinite bounds.
*/
void PhysxBounds3::
set_infinite() {
_bounds.setInfinite();
}
/**
* Transforms this volume as if it was an axis aligned bounding box, and then
* assigns the results' bounds to this. The orientation is applied first,
* then the translation.
*/
void PhysxBounds3::
transform(const LMatrix3f &orientation, const LPoint3f &translation) {
nassertv(!orientation.is_nan());
nassertv(!translation.is_nan());
_bounds.transform(PhysxManager::mat3_to_nxMat33(orientation),
PhysxManager::point3_to_nxVec3(translation));
}

View File

@@ -1,64 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBounds3.h
* @author enn0x
* @date 2009-10-31
*/
#ifndef PHYSXBOUNDS3_H
#define PHYSXBOUNDS3_H
#include "pandabase.h"
#include "luse.h"
#include "config_physx.h"
#include "physx_includes.h"
/**
* Represention of a axis aligned bounding box. The box is stored as minimum
* and maximum extent corners. Alternate representation would be center and
* dimensions. May be empty or nonempty. If not empty, min <= max has to
* hold.
*/
class EXPCL_PANDAPHYSX PhysxBounds3 {
PUBLISHED:
INLINE PhysxBounds3();
INLINE ~PhysxBounds3();
void bounds_of_obb(const LMatrix3f &orientation, const LPoint3f &translation, const LVector3f &half_dims);
void combine(const PhysxBounds3 &b2);
bool contain(const LPoint3f &p) const;
void fatten(float distance);
void include(const LPoint3f &v);
bool intersects(const PhysxBounds3 &b) const;
bool intersects2d(const PhysxBounds3 &b, unsigned axis_to_ignore) const;
bool is_empty() const;
void scale(float scale);
void set(const LPoint3f &min, const LPoint3f &max);
void set_center_extents(const LPoint3f &center, const LVector3f &extents);
void set_empty();
void set_infinite();
void transform(const LMatrix3f &orientation, const LPoint3f &translation);
LPoint3f get_max() const;
LPoint3f get_min() const;
LPoint3f get_center() const;
LVector3f get_dimensions() const;
void set_max(LPoint3f value);
void set_min(LPoint3f value);
public:
NxBounds3 _bounds;
};
#include "physxBounds3.I"
#endif // PHYSBOUNDS3_H

View File

@@ -1,28 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBox.I
* @author enn0x
* @date 2009-10-31
*/
/**
*
*/
INLINE PhysxBox::
PhysxBox() {
}
/**
*
*/
INLINE PhysxBox::
~PhysxBox() {
}

View File

@@ -1,115 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBox.cxx
* @author enn0x
* @date 2009-10-31
*/
#include "physxBox.h"
#include "physxManager.h"
/**
*
*/
PhysxBox::
PhysxBox(const LPoint3f &center, const LVector3f &extents, const LMatrix3f &rot) {
_box = NxBox(PhysxManager::point3_to_nxVec3(center),
PhysxManager::vec3_to_nxVec3(extents),
PhysxManager::mat3_to_nxMat33(rot));
}
/**
* Returns TRUE if the box is valid.
*/
bool PhysxBox::
is_valid() const {
return _box.isValid();
}
/**
* Recomputes the box after an arbitrary transform by a 4x4 matrix.
*/
void PhysxBox::
rotate(const LMatrix4f &m, PhysxBox &obb) const {
nassertv(!m.is_nan());
_box.rotate(PhysxManager::mat4_to_nxMat34(m), obb._box);
}
/**
* Setups an empty box.
*/
void PhysxBox::
set_empty() {
_box.setEmpty();
}
/**
* Return center of the box.
*/
LPoint3f PhysxBox::
get_center() const {
return PhysxManager::nxVec3_to_point3(_box.GetCenter());
}
/**
* Returns the extents (radii) of the box.
*/
LVector3f PhysxBox::
get_extents() const {
return PhysxManager::nxVec3_to_vec3(_box.GetExtents());
}
/**
* Return the rotation of the box.
*/
LMatrix3f PhysxBox::
get_rot() const {
return PhysxManager::nxMat33_to_mat3(_box.GetRot());
}
/**
* Sets the center of the box.
*/
void PhysxBox::
set_center(LPoint3f center) {
nassertv(!center.is_nan());
_box.center = PhysxManager::vec3_to_nxVec3(center);
}
/**
* Sets the extents of the box.
*/
void PhysxBox::
set_extents(LVector3f extents) {
nassertv(!extents.is_nan());
_box.extents = PhysxManager::vec3_to_nxVec3(extents);
}
/**
* Sets the rotation of the box.
*/
void PhysxBox::
set_rot(LMatrix3f rot) {
nassertv(!rot.is_nan());
_box.rot = PhysxManager::mat3_to_nxMat33(rot);
}

View File

@@ -1,54 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBox.h
* @author enn0x
* @date 2009-10-31
*/
#ifndef PHYSXBOX_H
#define PHYSXBOX_H
#include "pandabase.h"
#include "luse.h"
#include "config_physx.h"
#include "physx_includes.h"
/**
* Represents an oriented bounding box, as a center point, extents(radii) and
* a rotation. i.e. the center of the box is at the center point, the box is
* rotated around this point with the rotation and it is 2*extents in width,
* height and depth.
*/
class EXPCL_PANDAPHYSX PhysxBox {
PUBLISHED:
INLINE PhysxBox();
INLINE ~PhysxBox();
PhysxBox(const LPoint3f &center, const LVector3f &extents, const LMatrix3f &rot);
bool is_valid() const;
void rotate(const LMatrix4f &m, PhysxBox &obb) const;
void set_empty();
LPoint3f get_center() const;
LVector3f get_extents() const;
LMatrix3f get_rot() const;
void set_center(LPoint3f center);
void set_extents(LVector3f extents);
void set_rot(LMatrix3f rot);
public:
NxBox _box;
};
#include "physxBox.I"
#endif // PHYSBOX_H

View File

@@ -1,28 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBoxController.I
* @author enn0x
* @date 2009-09-24
*/
/**
*
*/
INLINE PhysxBoxController::
PhysxBoxController() : PhysxController() {
}
/**
*
*/
INLINE PhysxBoxController::
~PhysxBoxController() {
}

View File

@@ -1,75 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBoxController.cxx
* @author enn0x
* @date 2009-09-24
*/
#include "physxBoxController.h"
#include "physxManager.h"
TypeHandle PhysxBoxController::_type_handle;
/**
*
*/
void PhysxBoxController::
link(NxController *controllerPtr) {
nassertv(controllerPtr->getType() == NX_CONTROLLER_BOX);
// Link self
_ptr = (NxBoxController *)controllerPtr;
_error_type = ET_ok;
PhysxScene *scene = (PhysxScene *)_ptr->getActor()->getScene().userData;
scene->_controllers.add(this);
// Link actor
PT(PhysxActor) actor = new PhysxActor();
actor->link(_ptr->getActor());
actor->link_controller(this);
}
/**
*
*/
void PhysxBoxController::
unlink() {
// Unlink actor
PT(PhysxActor) actor = (PhysxActor *)ptr()->getActor()->userData;
actor->unlink();
// Unlink self
_error_type = ET_released;
PhysxScene *scene = (PhysxScene *)_ptr->getActor()->getScene().userData;
scene->_controllers.remove(this);
}
/**
* Sets controller's extents.
*/
void PhysxBoxController::
set_extents(const LVector3f &extents) {
nassertv(_error_type == ET_ok);
_ptr->setExtents(PhysxManager::vec3_to_nxVec3(extents));
}
/**
* Returns controller's extents.
*/
LVector3f PhysxBoxController::
get_extents() const {
nassertr(_error_type == ET_ok, LVector3f::zero());
return PhysxManager::nxVec3_to_vec3(_ptr->getExtents());
}

View File

@@ -1,67 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBoxController.h
* @author enn0x
* @date 2009-09-24
*/
#ifndef PHYSXBOXCONTROLLER_H
#define PHYSXBOXCONTROLLER_H
#include "pandabase.h"
#include "luse.h"
#include "physxController.h"
#include "physx_includes.h"
/**
* Box character controller.
*/
class EXPCL_PANDAPHYSX PhysxBoxController : public PhysxController {
PUBLISHED:
INLINE PhysxBoxController();
INLINE ~PhysxBoxController();
void set_extents(const LVector3f &extents);
LVector3f get_extents() const;
public:
INLINE NxController *ptr() const { return (NxController *)_ptr; };
void link(NxController *controllerPtr);
void unlink();
private:
NxBoxController *_ptr;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
PhysxController::init_type();
register_type(_type_handle, "PhysxBoxController",
PhysxController::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {
init_type();
return get_class_type();
}
private:
static TypeHandle _type_handle;
};
#include "physxBoxController.I"
#endif // PHYSXBOXCONTROLLER_H

View File

@@ -1,47 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBoxControllerDesc.I
* @author enn0x
* @date 2009-09-22
*/
/**
*
*/
INLINE PhysxBoxControllerDesc::
PhysxBoxControllerDesc() : PhysxControllerDesc() {
_desc.upDirection = (NxHeightFieldAxis)physx_up_axis.get_value();
}
/**
*
*/
INLINE PhysxBoxControllerDesc::
~PhysxBoxControllerDesc() {
}
/**
* (re)sets the structure to the default.
*/
INLINE void PhysxBoxControllerDesc::
set_to_default() {
_desc.setToDefault();
}
/**
* Returns true if the descriptor is valid.
*/
INLINE bool PhysxBoxControllerDesc::
is_valid() const {
return _desc.isValid();
}

View File

@@ -1,36 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBoxControllerDesc.cxx
* @author enn0x
* @date 2009-09-22
*/
#include "physxBoxControllerDesc.h"
#include "physxManager.h"
/**
* Sets the dimensions of the box.
*
* The dimensions are the 'radii' of the box, meaning 1/2 extents in x
* dimension, 1/2 extents in y dimension, 1/2 extents in z dimension.
*/
void PhysxBoxControllerDesc::
set_extents(const LVector3f &extents) {
_desc.extents = PhysxManager::vec3_to_nxVec3(extents);
}
/**
* Returns the dimensions of the box.
*/
LVector3f PhysxBoxControllerDesc::
get_extents() const {
return PhysxManager::nxVec3_to_vec3(_desc.extents);
}

View File

@@ -1,46 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBoxControllerDesc.h
* @author enn0x
* @date 2009-09-22
*/
#ifndef PHYSXBOXCONTROLLERDESC_H
#define PHYSXBOXCONTROLLERDESC_H
#include "pandabase.h"
#include "luse.h"
#include "physxControllerDesc.h"
#include "physx_includes.h"
/**
* Descriptor class for PhysxBoxController.
*/
class EXPCL_PANDAPHYSX PhysxBoxControllerDesc : public PhysxControllerDesc {
PUBLISHED:
INLINE PhysxBoxControllerDesc();
INLINE ~PhysxBoxControllerDesc();
INLINE void set_to_default();
INLINE bool is_valid() const;
void set_extents(const LVector3f &extents);
LVector3f get_extents() const;
public:
NxControllerDesc *ptr() const { return (NxControllerDesc *)&_desc; };
NxBoxControllerDesc _desc;
};
#include "physxBoxControllerDesc.I"
#endif // PHYSXBOXCONTROLLERDESC_H

View File

@@ -1,28 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBoxForceFieldShape.I
* @author enn0x
* @date 2009-11-15
*/
/**
*
*/
INLINE PhysxBoxForceFieldShape::
PhysxBoxForceFieldShape() : PhysxForceFieldShape() {
}
/**
*
*/
INLINE PhysxBoxForceFieldShape::
~PhysxBoxForceFieldShape() {
}

View File

@@ -1,83 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBoxForceFieldShape.cxx
* @author enn0x
* @date 2009-11-15
*/
#include "physxBoxForceFieldShape.h"
#include "physxBoxForceFieldShapeDesc.h"
#include "physxManager.h"
TypeHandle PhysxBoxForceFieldShape::_type_handle;
/**
*
*/
void PhysxBoxForceFieldShape::
link(NxForceFieldShape *shapePtr) {
_ptr = shapePtr->isBox();
_ptr->userData = this;
_error_type = ET_ok;
set_name(shapePtr->getName());
PhysxForceFieldShapeGroup *group = (PhysxForceFieldShapeGroup *)_ptr->getShapeGroup().userData;
group->_shapes.add(this);
}
/**
*
*/
void PhysxBoxForceFieldShape::
unlink() {
_ptr->userData = nullptr;
_error_type = ET_released;
PhysxForceFieldShapeGroup *group = (PhysxForceFieldShapeGroup *)_ptr->getShapeGroup().userData;
group->_shapes.remove(this);
}
/**
* Saves the state of the shape object to a descriptor.
*/
void PhysxBoxForceFieldShape::
save_to_desc(PhysxBoxForceFieldShapeDesc &shapeDesc) const {
nassertv(_error_type == ET_ok);
_ptr->saveToDesc(shapeDesc._desc);
}
/**
* Sets the box dimensions.
*
* The dimensions are the 'radii' of the box, meaning 1/2 extents in x
* dimension, 1/2 extents in y dimension, 1/2 extents in z dimension.
*/
void PhysxBoxForceFieldShape::
set_dimensions(const LVector3f &vec) {
nassertv(_error_type == ET_ok);
_ptr->setDimensions(PhysxManager::vec3_to_nxVec3(vec));
}
/**
* Retrieves the dimensions of the box.
*
* The dimensions are the 'radii' of the box, meaning 1/2 extents in x
* dimension, 1/2 extents in y dimension, 1/2 extents in z dimension.
*/
LVector3f PhysxBoxForceFieldShape::
get_dimensions() const {
nassertr(_error_type == ET_ok, LVector3f::zero());
return PhysxManager::nxVec3_to_vec3(_ptr->getDimensions());
}

View File

@@ -1,70 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBoxForceFieldShape.h
* @author enn0x
* @date 2009-11-15
*/
#ifndef PHYSXBOXFORCEFIELDSHAPE_H
#define PHYSXBOXFORCEFIELDSHAPE_H
#include "pandabase.h"
#include "luse.h"
#include "physxForceFieldShape.h"
#include "physx_includes.h"
class PhysxBoxForceFieldShapeDesc;
/**
* A box shaped region used to define a force field.
*/
class EXPCL_PANDAPHYSX PhysxBoxForceFieldShape : public PhysxForceFieldShape {
PUBLISHED:
INLINE PhysxBoxForceFieldShape();
INLINE ~PhysxBoxForceFieldShape();
void save_to_desc(PhysxBoxForceFieldShapeDesc &shapeDesc) const;
void set_dimensions(const LVector3f &dimensions);
LVector3f get_dimensions() const;
public:
INLINE NxForceFieldShape *ptr() const { return (NxForceFieldShape *)_ptr; };
void link(NxForceFieldShape *shapePtr);
void unlink();
private:
NxBoxForceFieldShape *_ptr;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
PhysxForceFieldShape::init_type();
register_type(_type_handle, "PhysxBoxForceFieldShape",
PhysxForceFieldShape::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {
init_type();
return get_class_type();
}
private:
static TypeHandle _type_handle;
};
#include "physxBoxForceFieldShape.I"
#endif // PHYSXBOXFORCEFIELDSHAPE_H

View File

@@ -1,48 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBoxForceFieldShapeDesc.I
* @author enn0x
* @date 2009-11-06
*/
/**
*
*/
INLINE PhysxBoxForceFieldShapeDesc::
PhysxBoxForceFieldShapeDesc() : PhysxForceFieldShapeDesc() {
set_to_default();
}
/**
*
*/
INLINE PhysxBoxForceFieldShapeDesc::
~PhysxBoxForceFieldShapeDesc() {
}
/**
* (re)sets the structure to the default.
*/
INLINE void PhysxBoxForceFieldShapeDesc::
set_to_default() {
_desc.setToDefault();
set_name("");
}
/**
* Returns true if the descriptor is valid.
*/
INLINE bool PhysxBoxForceFieldShapeDesc::
is_valid() const {
return _desc.isValid();
}

View File

@@ -1,37 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBoxForceFieldShapeDesc.cxx
* @author enn0x
* @date 2009-11-06
*/
#include "physxBoxForceFieldShapeDesc.h"
#include "physxManager.h"
/**
* Sets the dimensions of the box.
*
* The dimensions are the 'radii' of the box, meaning 1/2 extents in x
* dimension, 1/2 extents in y dimension, 1/2 extents in z dimension.
*/
void PhysxBoxForceFieldShapeDesc::
set_dimensions(const LVector3f &dimensions) {
nassertv(!dimensions.is_nan());
_desc.dimensions = PhysxManager::vec3_to_nxVec3(dimensions);
}
/**
* Returns the dimensions of the box.
*/
LVector3f PhysxBoxForceFieldShapeDesc::
get_dimensions() const {
return PhysxManager::nxVec3_to_vec3(_desc.dimensions);
}

View File

@@ -1,46 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBoxForceFieldShapeDesc.h
* @author enn0x
* @date 2009-11-06
*/
#ifndef PHYSXBOXFORCEFIELDSHAPEDESC_H
#define PHYSXBOXFORCEFIELDSHAPEDESC_H
#include "pandabase.h"
#include "luse.h"
#include "physxForceFieldShapeDesc.h"
#include "physx_includes.h"
/**
* Descriptor for a box force field shape.
*/
class EXPCL_PANDAPHYSX PhysxBoxForceFieldShapeDesc : public PhysxForceFieldShapeDesc {
PUBLISHED:
INLINE PhysxBoxForceFieldShapeDesc();
INLINE ~PhysxBoxForceFieldShapeDesc();
INLINE void set_to_default();
INLINE bool is_valid() const;
void set_dimensions(const LVector3f &dimensions);
LVector3f get_dimensions() const;
public:
NxForceFieldShapeDesc *ptr() const { return (NxForceFieldShapeDesc *)&_desc; };
NxBoxForceFieldShapeDesc _desc;
};
#include "physxBoxForceFieldShapeDesc.I"
#endif // PHYSXBOXFORCEFIELDSHAPEDESC_H

View File

@@ -1,28 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBoxShape.I
* @author enn0x
* @date 2009-09-16
*/
/**
*
*/
INLINE PhysxBoxShape::
PhysxBoxShape() : PhysxShape() {
}
/**
*
*/
INLINE PhysxBoxShape::
~PhysxBoxShape() {
}

View File

@@ -1,83 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBoxShape.cxx
* @author enn0x
* @date 2009-09-16
*/
#include "physxBoxShape.h"
#include "physxBoxShapeDesc.h"
#include "physxManager.h"
TypeHandle PhysxBoxShape::_type_handle;
/**
*
*/
void PhysxBoxShape::
link(NxShape *shapePtr) {
_ptr = shapePtr->isBox();
_ptr->userData = this;
_error_type = ET_ok;
set_name(shapePtr->getName());
PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData;
actor->_shapes.add(this);
}
/**
*
*/
void PhysxBoxShape::
unlink() {
_ptr->userData = nullptr;
_error_type = ET_released;
PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData;
actor->_shapes.remove(this);
}
/**
* Saves the state of the shape object to a descriptor.
*/
void PhysxBoxShape::
save_to_desc(PhysxBoxShapeDesc &shapeDesc) const {
nassertv(_error_type == ET_ok);
_ptr->saveToDesc(shapeDesc._desc);
}
/**
* Sets the box dimensions.
*
* The dimensions are the 'radii' of the box, meaning 1/2 extents in x
* dimension, 1/2 extents in y dimension, 1/2 extents in z dimension.
*/
void PhysxBoxShape::
set_dimensions(const LVector3f &vec) {
nassertv(_error_type == ET_ok);
_ptr->setDimensions(PhysxManager::vec3_to_nxVec3(vec));
}
/**
* Retrieves the dimensions of the box.
*
* The dimensions are the 'radii' of the box, meaning 1/2 extents in x
* dimension, 1/2 extents in y dimension, 1/2 extents in z dimension.
*/
LVector3f PhysxBoxShape::
get_dimensions() const {
nassertr(_error_type == ET_ok, LVector3f::zero());
return PhysxManager::nxVec3_to_vec3(_ptr->getDimensions());
}

View File

@@ -1,79 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBoxShape.h
* @author enn0x
* @date 2009-09-16
*/
#ifndef PHYSXBOXSHAPE_H
#define PHYSXBOXSHAPE_H
#include "pandabase.h"
#include "luse.h"
#include "physxShape.h"
#include "physx_includes.h"
class PhysxBoxShapeDesc;
/**
* A box shaped collision detection primitive. Each shape is owned by the
* actor which it is attached to.
*
* An instance can be created by calling the createShape() method of the
* PhysxActor object that will own it, with a PhysxBoxShapeDesc object as the
* parameter, or by adding the shape descriptor to the PhysxActorDesc class
* before creating the actor.
*
* The shape is deleted by calling release() on the shape itself.
*/
class EXPCL_PANDAPHYSX PhysxBoxShape : public PhysxShape {
PUBLISHED:
INLINE PhysxBoxShape();
INLINE ~PhysxBoxShape();
void save_to_desc(PhysxBoxShapeDesc &shapeDesc) const;
void set_dimensions(const LVector3f &dimensions);
LVector3f get_dimensions() const;
public:
INLINE NxShape *ptr() const { return (NxShape *)_ptr; };
void link(NxShape *shapePtr);
void unlink();
private:
NxBoxShape *_ptr;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
PhysxShape::init_type();
register_type(_type_handle, "PhysxBoxShape",
PhysxShape::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {
init_type();
return get_class_type();
}
private:
static TypeHandle _type_handle;
};
#include "physxBoxShape.I"
#endif // PHYSXBOXSHAPE_H

View File

@@ -1,48 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBoxShapeDesc.I
* @author enn0x
* @date 2009-09-08
*/
/**
*
*/
INLINE PhysxBoxShapeDesc::
PhysxBoxShapeDesc() : PhysxShapeDesc() {
set_to_default();
}
/**
*
*/
INLINE PhysxBoxShapeDesc::
~PhysxBoxShapeDesc() {
}
/**
* (re)sets the structure to the default.
*/
INLINE void PhysxBoxShapeDesc::
set_to_default() {
_desc.setToDefault();
set_name("");
}
/**
* Returns true if the descriptor is valid.
*/
INLINE bool PhysxBoxShapeDesc::
is_valid() const {
return _desc.isValid();
}

View File

@@ -1,37 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBoxShapeDesc.cxx
* @author enn0x
* @date 2009-09-08
*/
#include "physxBoxShapeDesc.h"
#include "physxManager.h"
/**
* Sets the dimensions of the box.
*
* The dimensions are the 'radii' of the box, meaning 1/2 extents in x
* dimension, 1/2 extents in y dimension, 1/2 extents in z dimension.
*/
void PhysxBoxShapeDesc::
set_dimensions(const LVector3f &dimensions) {
nassertv(!dimensions.is_nan());
_desc.dimensions = PhysxManager::vec3_to_nxVec3(dimensions);
}
/**
* Returns the dimensions of the box.
*/
LVector3f PhysxBoxShapeDesc::
get_dimensions() const {
return PhysxManager::nxVec3_to_vec3(_desc.dimensions);
}

View File

@@ -1,46 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxBoxShapeDesc.h
* @author enn0x
* @date 2009-09-08
*/
#ifndef PHYSXBOXSHAPEDESC_H
#define PHYSXBOXSHAPEDESC_H
#include "pandabase.h"
#include "luse.h"
#include "physxShapeDesc.h"
#include "physx_includes.h"
/**
* Descriptor class for PhysxBoxShape.
*/
class EXPCL_PANDAPHYSX PhysxBoxShapeDesc : public PhysxShapeDesc {
PUBLISHED:
INLINE PhysxBoxShapeDesc();
INLINE ~PhysxBoxShapeDesc();
INLINE void set_to_default();
INLINE bool is_valid() const;
void set_dimensions(const LVector3f &dimensions);
LVector3f get_dimensions() const;
public:
NxShapeDesc *ptr() const { return (NxShapeDesc *)&_desc; };
NxBoxShapeDesc _desc;
};
#include "physxBoxShapeDesc.I"
#endif // PHYSXBOXSHAPEDESC_H

View File

@@ -1,37 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCapsule.I
* @author enn0x
* @date 2009-10-31
*/
/**
*
*/
INLINE PhysxCapsule::
PhysxCapsule() {
}
/**
*
*/
INLINE PhysxCapsule::
PhysxCapsule(const PhysxSegment &segment, float radius) {
_capsule = NxCapsule(segment._segment, radius);
}
/**
*
*/
INLINE PhysxCapsule::
~PhysxCapsule() {
}

View File

@@ -1,141 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCapsule.cxx
* @author enn0x
* @date 2009-10-31
*/
#include "physxCapsule.h"
#include "physxManager.h"
/**
* Returns the capsule's radius.
*/
float PhysxCapsule::
get_radius() const {
return _capsule.radius;
}
/**
* Sets the capsule's radius.
*/
void PhysxCapsule::
set_radius(float radius) {
_capsule.radius = radius;
}
/**
* Returns the start point of the segment.
*/
LPoint3f PhysxCapsule::
get_p0() const {
return PhysxManager::nxVec3_to_vec3(_capsule.p0);
}
/**
* Sets the start point of the segment.
*/
void PhysxCapsule::
set_p0(LPoint3f p) {
nassertv(!p.is_nan());
_capsule.p0 = PhysxManager::vec3_to_nxVec3(p);
}
/**
* Returns the end point of the segment.
*/
LPoint3f PhysxCapsule::
get_p1() const {
return PhysxManager::nxVec3_to_vec3(_capsule.p1);
}
/**
* Sets the end point of the segment.
*/
void PhysxCapsule::
set_p1(LPoint3f p) {
nassertv(!p.is_nan());
_capsule.p1 = PhysxManager::vec3_to_nxVec3(p);
}
/**
* Returns the start point of the segment.
*/
LPoint3f PhysxCapsule::
get_origin() const {
return PhysxManager::nxVec3_to_point3(_capsule.getOrigin());
}
/**
* Returns the direction vector from the segment's start point to it's end
* point.
*/
void PhysxCapsule::
compute_direction(LPoint3f &dir) const {
nassertv(!dir.is_nan());
NxVec3 nDir = PhysxManager::point3_to_nxVec3(dir);
_capsule.computeDirection(nDir);
PhysxManager::update_point3_from_nxVec3(dir, nDir);
}
/**
* Returns the distance from the segment's start point to it's end point.
*/
float PhysxCapsule::
compute_length() const {
return _capsule.computeLength();
}
/**
* Computes a point on the segment.
*/
void PhysxCapsule::
compute_point(LPoint3f &p, float t) const {
nassertv(!p.is_nan());
NxVec3 nP = PhysxManager::point3_to_nxVec3(p);
_capsule.computePoint(nP, t);
PhysxManager::update_point3_from_nxVec3(p, nP);
}
/**
* Returns the square distance from the segment's start point to it's end
* point.
*/
float PhysxCapsule::
compute_square_length() const {
return _capsule.computeSquareLength();
}
/**
* Setup this capsule from origin (start point) and direction vector.
*/
void PhysxCapsule::
set_origin_direction(const LPoint3f &origin, const LVector3f &direction) {
nassertv(!origin.is_nan());
nassertv(!direction.is_nan());
_capsule.setOriginDirection(PhysxManager::point3_to_nxVec3(origin),
PhysxManager::vec3_to_nxVec3(direction));
}

View File

@@ -1,53 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCapsule.h
* @author enn0x
* @date 2009-10-31
*/
#ifndef PHYSXCAPSULE_H
#define PHYSXCAPSULE_H
#include "pandabase.h"
#include "config_physx.h"
#include "physxSegment.h"
/**
* Represents a capsule.
*/
class EXPCL_PANDAPHYSX PhysxCapsule {
PUBLISHED:
INLINE PhysxCapsule();
INLINE PhysxCapsule(const PhysxSegment &segment, float radius);
INLINE ~PhysxCapsule();
void compute_direction(LPoint3f &dir) const;
float compute_length() const;
void compute_point(LPoint3f &p, float t) const;
float compute_square_length() const;
LPoint3f get_origin() const;
void set_origin_direction(const LPoint3f &origin, const LVector3f &direction);
float get_radius() const;
LPoint3f get_p0() const;
LPoint3f get_p1() const;
void set_radius(float value);
void set_p0(LPoint3f p);
void set_p1(LPoint3f p);
public:
NxCapsule _capsule;
};
#include "physxCapsule.I"
#endif // PHYSCAPSULE_H

View File

@@ -1,28 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCapsuleController.I
* @author enn0x
* @date 2009-09-24
*/
/**
*
*/
INLINE PhysxCapsuleController::
PhysxCapsuleController() : PhysxController() {
}
/**
*
*/
INLINE PhysxCapsuleController::
~PhysxCapsuleController() {
}

View File

@@ -1,94 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCapsuleController.cxx
* @author enn0x
* @date 2009-09-24
*/
#include "physxCapsuleController.h"
TypeHandle PhysxCapsuleController::_type_handle;
/**
*
*/
void PhysxCapsuleController::
link(NxController *controllerPtr) {
nassertv(controllerPtr->getType() == NX_CONTROLLER_CAPSULE);
// Link self
_ptr = (NxCapsuleController *)controllerPtr;
_error_type = ET_ok;
PhysxScene *scene = (PhysxScene *)_ptr->getActor()->getScene().userData;
scene->_controllers.add(this);
// Link actor
PT(PhysxActor) actor = new PhysxActor();
actor->link(_ptr->getActor());
actor->link_controller(this);
}
/**
*
*/
void PhysxCapsuleController::
unlink() {
// Unlink actor
PT(PhysxActor) actor = (PhysxActor *)ptr()->getActor()->userData;
actor->unlink();
// Unlink self
_error_type = ET_released;
PhysxScene *scene = (PhysxScene *)_ptr->getActor()->getScene().userData;
scene->_controllers.remove(this);
}
/**
* Resets the controller's radius.
*/
void PhysxCapsuleController::
set_radius(float radius) {
nassertv(_error_type == ET_ok);
_ptr->setRadius(radius);
}
/**
* Resets the controller's height.
*/
void PhysxCapsuleController::
set_height(float height) {
nassertv(_error_type == ET_ok);
_ptr->setHeight(height);
}
/**
* Returns the controller's radius.
*/
float PhysxCapsuleController::
get_radius() const {
nassertr(_error_type == ET_ok, 0.0f);
return _ptr->getRadius();
}
/**
* Returns the controller's height.
*/
float PhysxCapsuleController::
get_height() const {
nassertr(_error_type == ET_ok, 0.0f);
return _ptr->getHeight();
}

View File

@@ -1,80 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCapsuleController.h
* @author enn0x
* @date 2009-09-24
*/
#ifndef PHYSXCAPSULECONTROLLER_H
#define PHYSXCAPSULECONTROLLER_H
#include "pandabase.h"
#include "luse.h"
#include "physxController.h"
#include "physx_includes.h"
/**
* A capsule character controller.
*
* The capsule is defined as a position, a vertical height, and a radius. The
* height is the same height as for PhysxCapsuleShape objects, i.e. the
* distance between the two sphere centers at the end of the capsule. In
* other words:
*
* p = pos (returned by controller) h = height r = radius
*
* p = center of capsule top sphere center = p.y + h*0.5 bottom sphere center
* = p.y - h*0.5 top capsule point = p.y + h*0.5 + r bottom capsule point =
* p.y - h*0.5 - r
*/
class EXPCL_PANDAPHYSX PhysxCapsuleController : public PhysxController {
PUBLISHED:
INLINE PhysxCapsuleController();
INLINE ~PhysxCapsuleController();
void set_radius(float radius);
void set_height(float height);
float get_radius() const;
float get_height() const;
public:
INLINE NxController *ptr() const { return (NxController *)_ptr; };
void link(NxController *controllerPtr);
void unlink();
private:
NxCapsuleController *_ptr;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
PhysxController::init_type();
register_type(_type_handle, "PhysxCapsuleController",
PhysxController::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {
init_type();
return get_class_type();
}
private:
static TypeHandle _type_handle;
};
#include "physxCapsuleController.I"
#endif // PHYSXCAPSULECONTROLLER_H

View File

@@ -1,47 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCapsuleControllerDesc.I
* @author enn0x
* @date 2009-09-22
*/
/**
*
*/
INLINE PhysxCapsuleControllerDesc::
PhysxCapsuleControllerDesc() : PhysxControllerDesc() {
_desc.upDirection = (NxHeightFieldAxis)physx_up_axis.get_value();
}
/**
*
*/
INLINE PhysxCapsuleControllerDesc::
~PhysxCapsuleControllerDesc() {
}
/**
* (re)sets the structure to the default.
*/
INLINE void PhysxCapsuleControllerDesc::
set_to_default() {
_desc.setToDefault();
}
/**
* Returns true if the descriptor is valid.
*/
INLINE bool PhysxCapsuleControllerDesc::
is_valid() const {
return _desc.isValid();
}

View File

@@ -1,50 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCapsuleControllerDesc.cxx
* @author enn0x
* @date 2009-09-22
*/
#include "physxCapsuleControllerDesc.h"
/**
* Sets the radius of the capsule's hemispherical ends and its trunk.
*/
void PhysxCapsuleControllerDesc::
set_radius(float radius) {
_desc.radius = radius;
}
/**
* Sets the distance between the two hemispherical ends of the capsule.
*/
void PhysxCapsuleControllerDesc::
set_height(float height) {
_desc.height = height;
}
/**
* The radius of the capsule's hemispherical ends and its trunk.
*/
float PhysxCapsuleControllerDesc::
get_radius() const {
return _desc.radius;
}
/**
* The distance between the two hemispherical ends of the capsule.
*/
float PhysxCapsuleControllerDesc::
get_height() const {
return _desc.height;
}

View File

@@ -1,47 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCapsuleControllerDesc.h
* @author enn0x
* @date 2009-09-22
*/
#ifndef PHYSXCAPSULECONTROLLERDESC_H
#define PHYSXCAPSULECONTROLLERDESC_H
#include "pandabase.h"
#include "physxControllerDesc.h"
#include "physx_includes.h"
/**
* Descriptor class for PhysxCapsuleController.
*/
class EXPCL_PANDAPHYSX PhysxCapsuleControllerDesc : public PhysxControllerDesc {
PUBLISHED:
INLINE PhysxCapsuleControllerDesc();
INLINE ~PhysxCapsuleControllerDesc();
INLINE void set_to_default();
INLINE bool is_valid() const;
void set_radius(float radius);
void set_height(float height);
float get_radius() const;
float get_height() const;
public:
NxControllerDesc *ptr() const { return (NxControllerDesc *)&_desc; };
NxCapsuleControllerDesc _desc;
};
#include "physxCapsuleControllerDesc.I"
#endif // PHYSXCAPSULECONTROLLERDESC_H

View File

@@ -1,28 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCapsuleForceFieldShape.I
* @author enn0x
* @date 2009-11-15
*/
/**
*
*/
INLINE PhysxCapsuleForceFieldShape::
PhysxCapsuleForceFieldShape() : PhysxForceFieldShape() {
}
/**
*
*/
INLINE PhysxCapsuleForceFieldShape::
~PhysxCapsuleForceFieldShape() {
}

View File

@@ -1,96 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCapsuleForceFieldShape.cxx
* @author enn0x
* @date 2009-11-15
*/
#include "physxCapsuleForceFieldShape.h"
#include "physxCapsuleForceFieldShapeDesc.h"
TypeHandle PhysxCapsuleForceFieldShape::_type_handle;
/**
*
*/
void PhysxCapsuleForceFieldShape::
link(NxForceFieldShape *shapePtr) {
_ptr = shapePtr->isCapsule();
_ptr->userData = this;
_error_type = ET_ok;
set_name(shapePtr->getName());
PhysxForceFieldShapeGroup *group = (PhysxForceFieldShapeGroup *)_ptr->getShapeGroup().userData;
group->_shapes.add(this);
}
/**
*
*/
void PhysxCapsuleForceFieldShape::
unlink() {
_ptr->userData = nullptr;
_error_type = ET_released;
PhysxForceFieldShapeGroup *group = (PhysxForceFieldShapeGroup *)_ptr->getShapeGroup().userData;
group->_shapes.remove(this);
}
/**
* Saves the state of the shape object to a descriptor.
*/
void PhysxCapsuleForceFieldShape::
save_to_desc(PhysxCapsuleForceFieldShapeDesc &shapeDesc) const {
nassertv(_error_type == ET_ok);
_ptr->saveToDesc(shapeDesc._desc);
}
/**
* Alters the radius of the capsule.
*/
void PhysxCapsuleForceFieldShape::
set_radius(float radius) {
nassertv(_error_type == ET_ok);
_ptr->setRadius(radius);
}
/**
* Alters the height of the capsule.
*/
void PhysxCapsuleForceFieldShape::
set_height(float height) {
nassertv(_error_type == ET_ok);
_ptr->setHeight(height);
}
/**
* Retrieves the radius of the capsule.
*/
float PhysxCapsuleForceFieldShape::
get_radius() const {
nassertr(_error_type == ET_ok, 0.0f);
return _ptr->getRadius();
}
/**
* Retrieves the height of the capsule.
*/
float PhysxCapsuleForceFieldShape::
get_height() const {
nassertr(_error_type == ET_ok, 0.0f);
return _ptr->getHeight();
}

View File

@@ -1,74 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCapsuleForceFieldShape.h
* @author enn0x
* @date 2009-11-15
*/
#ifndef PHYSXCAPSULEFORCEFIELDSHAPE_H
#define PHYSXCAPSULEFORCEFIELDSHAPE_H
#include "pandabase.h"
#include "luse.h"
#include "physxForceFieldShape.h"
#include "physx_includes.h"
class PhysxCapsuleForceFieldShapeDesc;
/**
* A capsule shaped region used to define a force field.
*/
class EXPCL_PANDAPHYSX PhysxCapsuleForceFieldShape : public PhysxForceFieldShape {
PUBLISHED:
INLINE PhysxCapsuleForceFieldShape();
INLINE ~PhysxCapsuleForceFieldShape();
void save_to_desc(PhysxCapsuleForceFieldShapeDesc &shapeDesc) const;
void set_radius(float radius);
void set_height(float height);
float get_radius() const;
float get_height() const;
public:
INLINE NxForceFieldShape *ptr() const { return (NxForceFieldShape *)_ptr; };
void link(NxForceFieldShape *shapePtr);
void unlink();
private:
NxCapsuleForceFieldShape *_ptr;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
PhysxForceFieldShape::init_type();
register_type(_type_handle, "PhysxCapsuleForceFieldShape",
PhysxForceFieldShape::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {
init_type();
return get_class_type();
}
private:
static TypeHandle _type_handle;
};
#include "physxCapsuleForceFieldShape.I"
#endif // PHYSXCAPSULEFORCEFIELDSHAPE_H

View File

@@ -1,48 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCapsuleForceFieldShapeDesc.I
* @author enn0x
* @date 2009-11-06
*/
/**
*
*/
INLINE PhysxCapsuleForceFieldShapeDesc::
PhysxCapsuleForceFieldShapeDesc() : PhysxForceFieldShapeDesc() {
set_to_default();
}
/**
*
*/
INLINE PhysxCapsuleForceFieldShapeDesc::
~PhysxCapsuleForceFieldShapeDesc() {
}
/**
* (re)sets the structure to the default.
*/
INLINE void PhysxCapsuleForceFieldShapeDesc::
set_to_default() {
_desc.setToDefault();
set_name("");
}
/**
* Returns true if the descriptor is valid.
*/
INLINE bool PhysxCapsuleForceFieldShapeDesc::
is_valid() const {
return _desc.isValid();
}

View File

@@ -1,50 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCapsuleForceFieldShapeDesc.cxx
* @author enn0x
* @date 2009-11-06
*/
#include "physxCapsuleForceFieldShapeDesc.h"
/**
* Sets the radius of the capsule's hemispherical ends and its trunk.
*/
void PhysxCapsuleForceFieldShapeDesc::
set_radius(float radius) {
_desc.radius = radius;
}
/**
* Sets the distance between the two hemispherical ends of the capsule.
*/
void PhysxCapsuleForceFieldShapeDesc::
set_height(float height) {
_desc.height = height;
}
/**
* The radius of the capsule's hemispherical ends and its trunk.
*/
float PhysxCapsuleForceFieldShapeDesc::
get_radius() const {
return _desc.radius;
}
/**
* The distance between the two hemispherical ends of the capsule.
*/
float PhysxCapsuleForceFieldShapeDesc::
get_height() const {
return _desc.height;
}

View File

@@ -1,47 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCapsuleForceFieldShapeDesc.h
* @author enn0x
* @date 2009-11-06
*/
#ifndef PHYSXCAPSULEFORCEFIELDSHAPEDESC_H
#define PHYSXCAPSULEFORCEFIELDSHAPEDESC_H
#include "pandabase.h"
#include "physxForceFieldShapeDesc.h"
#include "physx_includes.h"
/**
* Descriptor for a capsule force field shape.
*/
class EXPCL_PANDAPHYSX PhysxCapsuleForceFieldShapeDesc : public PhysxForceFieldShapeDesc {
PUBLISHED:
INLINE PhysxCapsuleForceFieldShapeDesc();
INLINE ~PhysxCapsuleForceFieldShapeDesc();
INLINE void set_to_default();
INLINE bool is_valid() const;
void set_radius(float radius);
void set_height(float height);
float get_radius() const;
float get_height() const;
public:
NxForceFieldShapeDesc *ptr() const { return (NxForceFieldShapeDesc *)&_desc; };
NxCapsuleForceFieldShapeDesc _desc;
};
#include "physxCapsuleForceFieldShapeDesc.I"
#endif // PHYSXCAPSULEFORCEFIELDSHAPEDESC_H

View File

@@ -1,28 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCapsuleShape.I
* @author enn0x
* @date 2009-09-16
*/
/**
*
*/
INLINE PhysxCapsuleShape::
PhysxCapsuleShape() : PhysxShape() {
}
/**
*
*/
INLINE PhysxCapsuleShape::
~PhysxCapsuleShape() {
}

View File

@@ -1,96 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCapsuleShape.cxx
* @author enn0x
* @date 2009-09-16
*/
#include "physxCapsuleShape.h"
#include "physxCapsuleShapeDesc.h"
TypeHandle PhysxCapsuleShape::_type_handle;
/**
*
*/
void PhysxCapsuleShape::
link(NxShape *shapePtr) {
_ptr = shapePtr->isCapsule();
_ptr->userData = this;
_error_type = ET_ok;
set_name(shapePtr->getName());
PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData;
actor->_shapes.add(this);
}
/**
*
*/
void PhysxCapsuleShape::
unlink() {
_ptr->userData = nullptr;
_error_type = ET_released;
PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData;
actor->_shapes.remove(this);
}
/**
* Saves the state of the shape object to a descriptor.
*/
void PhysxCapsuleShape::
save_to_desc(PhysxCapsuleShapeDesc &shapeDesc) const {
nassertv(_error_type == ET_ok);
_ptr->saveToDesc(shapeDesc._desc);
}
/**
* Alters the radius of the capsule.
*/
void PhysxCapsuleShape::
set_radius(float radius) {
nassertv(_error_type == ET_ok);
_ptr->setRadius(radius);
}
/**
* Alters the height of the capsule.
*/
void PhysxCapsuleShape::
set_height(float height) {
nassertv(_error_type == ET_ok);
_ptr->setHeight(height);
}
/**
* Retrieves the radius of the capsule.
*/
float PhysxCapsuleShape::
get_radius() const {
nassertr(_error_type == ET_ok, 0.0f);
return _ptr->getRadius();
}
/**
* Retrieves the height of the capsule.
*/
float PhysxCapsuleShape::
get_height() const {
nassertr(_error_type == ET_ok, 0.0f);
return _ptr->getHeight();
}

View File

@@ -1,85 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCapsuleShape.h
* @author enn0x
* @date 2009-09-16
*/
#ifndef PHYSXCAPSULESHAPE_H
#define PHYSXCAPSULESHAPE_H
#include "pandabase.h"
#include "luse.h"
#include "physxShape.h"
#include "physx_includes.h"
class PhysxCapsuleShapeDesc;
/**
* A capsule shaped collision detection primitive, also known as a line swept
* sphere. 'radius' is the radius of the capsule's hemispherical ends and its
* trunk. 'height' is the distance between the two hemispherical ends of the
* capsule. The height is along the capsule's Y axis. Each shape is owned by
* an actor that it is attached to.
*
* An instance can be created by calling the createShape() method of the
* PhysxActor object that should own it, with a PhysxCapsuleShapeDesc object
* as the parameter, or by adding the shape descriptor into the PhysxActorDesc
* class before creating the actor.
*
* The shape is deleted by calling release() on the shape itself.
*/
class EXPCL_PANDAPHYSX PhysxCapsuleShape : public PhysxShape {
PUBLISHED:
INLINE PhysxCapsuleShape();
INLINE ~PhysxCapsuleShape();
void save_to_desc(PhysxCapsuleShapeDesc &shapeDesc) const;
void set_radius(float radius);
void set_height(float height);
float get_radius() const;
float get_height() const;
public:
INLINE NxShape *ptr() const { return (NxShape *)_ptr; };
void link(NxShape *shapePtr);
void unlink();
private:
NxCapsuleShape *_ptr;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
PhysxShape::init_type();
register_type(_type_handle, "PhysxCapsuleShape",
PhysxShape::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {
init_type();
return get_class_type();
}
private:
static TypeHandle _type_handle;
};
#include "physxCapsuleShape.I"
#endif // PHYSXCAPSULESHAPE_H

View File

@@ -1,48 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCapsuleShapeDesc.I
* @author enn0x
* @date 2009-09-11
*/
/**
*
*/
INLINE PhysxCapsuleShapeDesc::
PhysxCapsuleShapeDesc() : PhysxShapeDesc() {
set_to_default();
}
/**
*
*/
INLINE PhysxCapsuleShapeDesc::
~PhysxCapsuleShapeDesc() {
}
/**
* (re)sets the structure to the default.
*/
INLINE void PhysxCapsuleShapeDesc::
set_to_default() {
_desc.setToDefault();
set_name("");
}
/**
* Returns true if the descriptor is valid.
*/
INLINE bool PhysxCapsuleShapeDesc::
is_valid() const {
return _desc.isValid();
}

View File

@@ -1,50 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCapsuleShapeDesc.cxx
* @author enn0x
* @date 2009-09-11
*/
#include "physxCapsuleShapeDesc.h"
/**
* Sets the radius of the capsule's hemispherical ends and its trunk.
*/
void PhysxCapsuleShapeDesc::
set_radius(float radius) {
_desc.radius = radius;
}
/**
* Sets the distance between the two hemispherical ends of the capsule.
*/
void PhysxCapsuleShapeDesc::
set_height(float height) {
_desc.height = height;
}
/**
* The radius of the capsule's hemispherical ends and its trunk.
*/
float PhysxCapsuleShapeDesc::
get_radius() const {
return _desc.radius;
}
/**
* The distance between the two hemispherical ends of the capsule.
*/
float PhysxCapsuleShapeDesc::
get_height() const {
return _desc.height;
}

View File

@@ -1,47 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCapsuleShapeDesc.h
* @author enn0x
* @date 2009-09-11
*/
#ifndef PHYSXCAPSULESHAPEDESC_H
#define PHYSXCAPSULESHAPEDESC_H
#include "pandabase.h"
#include "physxShapeDesc.h"
#include "physx_includes.h"
/**
* Descriptor class for PhysxCapsuleShape.
*/
class EXPCL_PANDAPHYSX PhysxCapsuleShapeDesc : public PhysxShapeDesc {
PUBLISHED:
INLINE PhysxCapsuleShapeDesc();
INLINE ~PhysxCapsuleShapeDesc();
INLINE void set_to_default();
INLINE bool is_valid() const;
void set_radius(float radius);
void set_height(float height);
float get_radius() const;
float get_height() const;
public:
NxShapeDesc *ptr() const { return (NxShapeDesc *)&_desc; };
NxCapsuleShapeDesc _desc;
};
#include "physxCapsuleShapeDesc.I"
#endif // PHYSXCAPSULESHAPEDESC_H

View File

@@ -1,47 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCcdSkeleton.I
* @author enn0x
* @date 2012-05-01
*/
/**
*
*/
INLINE PhysxCcdSkeleton::
PhysxCcdSkeleton() : PhysxObject() {
}
/**
*
*/
INLINE PhysxCcdSkeleton::
~PhysxCcdSkeleton() {
}
/**
*
*/
INLINE void PhysxCcdSkeleton::
ls() const {
ls(nout);
}
/**
*
*/
INLINE void PhysxCcdSkeleton::
ls(std::ostream &out, int indent_level) const {
indent(out, indent_level) << get_type().get_name()
<< " (at 0x" << this << ")\n";
}

View File

@@ -1,66 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCcdSkeleton.cxx
* @author enn0x
* @date 2012-05-01
*/
#include "physxCcdSkeleton.h"
#include "physxMeshPool.h"
TypeHandle PhysxCcdSkeleton::_type_handle;
/**
*
*/
void PhysxCcdSkeleton::
link(NxCCDSkeleton *skeletonPtr) {
// Link self
PhysxManager::get_global_ptr()->_ccd_skeletons.add(this);
_ptr = skeletonPtr;
_error_type = ET_ok;
}
/**
*
*/
void PhysxCcdSkeleton::
unlink() {
// Unlink self
_error_type = ET_released;
PhysxManager::get_global_ptr()->_ccd_skeletons.remove(this);
}
/**
*
*/
void PhysxCcdSkeleton::
release() {
nassertv(_error_type == ET_ok);
unlink();
NxGetPhysicsSDK()->releaseCCDSkeleton(*_ptr);
_ptr = nullptr;
// TODO PhysxMeshPool::release_ccd_skeleton(this);
}
/**
* Returns the reference count for shared meshes.
*/
unsigned int PhysxCcdSkeleton::
get_reference_count() const {
nassertr(_error_type == ET_ok, 0);
return _ptr->getReferenceCount();
}

View File

@@ -1,72 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCcdSkeleton.h
* @author enn0x
* @date 2012-05-01
*/
#ifndef PHYSXCCDSKELETON_H
#define PHYSXCCDSKELETON_H
#include "pandabase.h"
#include "physxObject.h"
#include "physx_includes.h"
/**
* A Convex Mesh. Internally represented as a list of convex polygons. The
* number of polygons is limited to 256.
*/
class EXPCL_PANDAPHYSX PhysxCcdSkeleton : public PhysxObject {
PUBLISHED:
unsigned int get_reference_count() const;
PUBLISHED:
void release();
INLINE void ls() const;
INLINE void ls(std::ostream &out, int indent_level=0) const;
public:
INLINE PhysxCcdSkeleton();
INLINE ~PhysxCcdSkeleton();
INLINE NxCCDSkeleton *ptr() const { return _ptr; };
void link(NxCCDSkeleton *meshPtr);
void unlink();
private:
NxCCDSkeleton *_ptr;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
PhysxObject::init_type();
register_type(_type_handle, "PhysxCcdSkeleton",
PhysxObject::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {
init_type();
return get_class_type();
}
private:
static TypeHandle _type_handle;
};
#include "physxCcdSkeleton.I"
#endif // PHYSXCCDSKELETON_H

View File

@@ -1,52 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCcdSkeletonDesc.I
* @author enn0x
* @date 2012-05-01
*/
/**
*
*/
INLINE PhysxCcdSkeletonDesc::
PhysxCcdSkeletonDesc() {
_desc.flags = 0;
_desc.pointStrideBytes = sizeof(NxVec3);
_desc.triangleStrideBytes = 3*sizeof(NxU32);
_desc.points = nullptr;
_desc.triangles = nullptr;
_vertices = nullptr;
_triangles = nullptr;
}
/**
*
*/
INLINE PhysxCcdSkeletonDesc::
~PhysxCcdSkeletonDesc() {
if (_vertices) {
delete [] _vertices;
}
if (_triangles) {
delete [] _triangles;
}
}
/**
* Returns true if the descriptor is valid.
*/
INLINE bool PhysxCcdSkeletonDesc::
is_valid() const {
return _desc.isValid();
}

View File

@@ -1,177 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCcdSkeletonDesc.cxx
* @author enn0x
* @date 2012-05-01
*/
#include "physxCcdSkeletonDesc.h"
#include "physxManager.h"
#include "nodePathCollection.h"
#include "geomNode.h"
#include "geomVertexReader.h"
/**
* Sets the number of vertices to be stored within this triangle mesh. The
* function allocates memory for the vertices, but it does not set any
* vertices.
*
* This method must be called before any calls to set_vertex are done!
*/
void PhysxCcdSkeletonDesc::
set_num_vertices(unsigned int numVertices) {
if (_desc.points) {
delete [] _vertices;
}
_vertices = new NxVec3[numVertices];
_desc.numVertices = numVertices;
_desc.points = _vertices;
}
/**
* Sets a single vertex. You have to call the function set_num_vertices
* before you can call this function.
*/
void PhysxCcdSkeletonDesc::
set_vertex(unsigned int idx, const LPoint3f &vert) {
nassertv(_desc.numVertices > idx);
_vertices[idx] = PhysxManager::point3_to_nxVec3(vert);
}
/**
* Sets the number of triangles to be stored in this triangle mesh.
*
* This method must be called before any calls to set_triangle are done!
*/
void PhysxCcdSkeletonDesc::
set_num_triangles(unsigned int numTriangles) {
if (_desc.triangles) {
delete [] _triangles;
}
_triangles = new NxU32[3 * numTriangles];
_desc.numTriangles = numTriangles;
_desc.triangles = _triangles;
}
/**
* Sets a single triangle, by providing the three indices i1, i2, i3.
*/
void PhysxCcdSkeletonDesc::
set_triangle(unsigned int idx,
unsigned int i1, unsigned int i2, unsigned int i3) {
nassertv(_desc.numTriangles > idx);
idx = 3 * idx;
_triangles[idx] = i1;
_triangles[idx + 1] = i2;
_triangles[idx + 2] = i3;
}
/**
*
*/
const NxSimpleTriangleMesh &PhysxCcdSkeletonDesc::
get_desc() const {
return _desc;
}
/**
* A convenience method to set the mesh data from a NodePath in a single call.
* The method iterates over the NodePath geoms and collects data for the
* triangle mesh.
*
* Do not use the following function when using this one: - set_num_vertices -
* set_vertex - set_num_triangles - set_triangle
*/
void PhysxCcdSkeletonDesc::
set_from_node_path(const NodePath &np) {
pvector<LPoint3f> dataVertices;
pvector<int> dataIndices;
// Collect data from NodePath
NodePathCollection npc = np.find_all_matches( "**/+GeomNode" );
for (int i=0; i<npc.get_num_paths(); i++) {
NodePath gnp = npc.get_path(i);
GeomNode *gnode = DCAST(GeomNode, gnp.node());
for (int j=0; j<gnode->get_num_geoms(); j++) {
CPT(Geom) geom = gnode->get_geom(j);
// Vertices
CPT(GeomVertexData) vdata = geom->get_vertex_data();
GeomVertexReader reader = GeomVertexReader(vdata, InternalName::get_vertex());
while (!reader.is_at_end()) {
dataVertices.push_back(reader.get_data3f());
}
// Indices
for (int k=0; k<geom->get_num_primitives(); k++) {
CPT(GeomPrimitive) prim = geom->get_primitive(k);
prim = prim->decompose();
for (int l=0; l<prim->get_num_primitives(); l++) {
int s = prim->get_primitive_start(l);
int e = prim->get_primitive_end(l);
for (int l=s; l<e; l++) {
dataIndices.push_back(prim->get_vertex(l));
}
}
}
}
}
// Set descriptor members
int i;
NxU32 numVertices = dataVertices.size();
NxU32 numTriangles = dataIndices.size() / 3;
_vertices = new NxVec3[numVertices];
_triangles = new NxU32[3 * numTriangles];
i = 0;
pvector<LPoint3f>::const_iterator vit;
for (vit=dataVertices.begin(); vit!=dataVertices.end(); vit++) {
LPoint3f v = *vit;
_vertices[i].x = v.get_x();
_vertices[i].y = v.get_y();
_vertices[i].z = v.get_z();
i++;
}
i = 0;
pvector<int>::const_iterator iit;
for(iit=dataIndices.begin(); iit!=dataIndices.end(); iit++) {
NxU32 idx = *iit;
_triangles[i] = idx;
i++;
}
_desc.numVertices = numVertices;
_desc.points = _vertices;
_desc.numTriangles = numTriangles;
_desc.triangles = _triangles;
}

View File

@@ -1,54 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCcdSkeletonDesc.h
* @author enn0x
* @date 2012-05-01
*/
#ifndef PHYSXCCDSKELETONDESC_H
#define PHYSXCCDSKELETONDESC_H
#include "pandabase.h"
#include "nodePath.h"
#include "luse.h"
#include "physx_includes.h"
/**
*
*/
class EXPCL_PANDAPHYSX PhysxCcdSkeletonDesc {
PUBLISHED:
INLINE PhysxCcdSkeletonDesc();
INLINE ~PhysxCcdSkeletonDesc();
INLINE bool is_valid() const;
void set_num_vertices(unsigned int n);
void set_vertex(unsigned int idx, const LPoint3f &vert);
void set_num_triangles(unsigned int n);
void set_triangle(unsigned int idx,
unsigned int i1, unsigned int i2, unsigned int i3);
void set_from_node_path(const NodePath &np);
public:
const NxSimpleTriangleMesh &get_desc() const;
private:
NxVec3 *_vertices;
NxU32 *_triangles;
NxSimpleTriangleMesh _desc;
};
#include "physxCcdSkeletonDesc.I"
#endif // PHYSXCCDSKELETONDESC_H

View File

@@ -1,54 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCloth.I
* @author enn0x
* @date 2010-03-30
*/
/**
*
*/
INLINE PhysxCloth::
PhysxCloth() : PhysxObject() {
}
/**
*
*/
INLINE PhysxCloth::
~PhysxCloth() {
}
/**
*
*/
INLINE void PhysxCloth::
ls() const {
ls(nout);
}
/**
*
*/
INLINE void PhysxCloth::
ls(std::ostream &out, int indent_level) const {
indent(out, indent_level) << get_type().get_name()
<< " " << _name
<< " (at 0x" << this << ")";
if (_node) {
out << " N:0x" << _node;
}
out << "\n";
}

View File

@@ -1,568 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCloth.cxx
* @author enn0x
* @date 2010-03-30
*/
#include "physxCloth.h"
#include "physxClothDesc.h"
#include "physxScene.h"
#include "physxGroupsMask.h"
#include "physxShape.h"
#include "physxManager.h"
#include "boundingBox.h"
TypeHandle PhysxCloth::_type_handle;
/**
*
*/
void PhysxCloth::
link(NxCloth *clothPtr) {
// Link self
_ptr = clothPtr;
_error_type = ET_ok;
_ptr->userData = this;
set_name(clothPtr->getName());
PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData;
scene->_cloths.add(this);
}
/**
*
*/
void PhysxCloth::
unlink() {
// Unlink self
_ptr->userData = nullptr;
_error_type = ET_released;
PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData;
scene->_cloths.remove(this);
_node = nullptr;
}
/**
*
*/
void PhysxCloth::
release() {
nassertv(_error_type == ET_ok);
unlink();
_ptr->getScene().releaseCloth(*_ptr);
_ptr = nullptr;
}
/**
*
*/
void PhysxCloth::
update() {
if (_node) {
// Update node mesh data
_node->update();
// Update node bounding volume
NxBounds3 bounds;
_ptr->getWorldBounds(bounds);
BoundingBox bb(PhysxManager::nxVec3_to_point3(bounds.min),
PhysxManager::nxVec3_to_point3(bounds.max));
_node->set_bounds(&bb);
}
}
/**
* Returns the scene which this cloth belongs to.
*/
PhysxScene *PhysxCloth::
get_scene() const {
nassertr(_error_type == ET_ok, nullptr);
return (PhysxScene *)_ptr->getScene().userData;
}
/**
*
*/
PhysxClothNode *PhysxCloth::
get_cloth_node() const {
nassertr(_error_type == ET_ok, nullptr);
return _node;
}
/**
*
*/
PhysxClothNode *PhysxCloth::
create_cloth_node(const char *name) {
nassertr(_error_type == ET_ok, nullptr);
_node = new PhysxClothNode(name);
_node->allocate(this);
return _node;
}
/**
* Sets a name string for the object that can be retrieved with get_name().
* This is for debugging and is not used by the engine.
*/
void PhysxCloth::
set_name(const char *name) {
nassertv(_error_type == ET_ok);
_name = name ? name : "";
_ptr->setName(_name.c_str());
}
/**
* Retrieves the name string.
*/
const char *PhysxCloth::
get_name() const {
nassertr(_error_type == ET_ok, "");
return _ptr->getName();
}
/**
* Sets which collision group this cloth is part of. Collision group must be
* between 0 and 31.
*/
void PhysxCloth::
set_group(unsigned int group) {
nassertv(_error_type == ET_ok);
nassertv(group >= 0 && group < 32);
_ptr->setGroup(group);
}
/**
* Retrieves the collision group this cloth is part of.
*/
unsigned int PhysxCloth::
get_group() const {
nassertr(_error_type == ET_ok, 0);
return _ptr->getGroup();
}
/**
* Sets the cloth thickness (must be positive).
*/
void PhysxCloth::
set_thickness(float thickness) {
nassertv(_error_type == ET_ok);
_ptr->setThickness(thickness);
}
/**
* Gets the cloth thickness.
*/
float PhysxCloth::
get_thickness() const {
nassertr(_error_type == ET_ok, 0.0f);
return _ptr->getThickness();
}
/**
* Gets the cloth density.
*/
float PhysxCloth::
get_density() const {
nassertr(_error_type == ET_ok, 0.0f);
return _ptr->getDensity();
}
/**
* Gets the relative grid spacing for the broad phase. The cloth is
* represented by a set of world aligned cubical cells in broad phase. The
* size of these cells is determined by multiplying the length of the diagonal
* of the AABB of the initial soft body size with this constant.
*/
float PhysxCloth::
get_relative_grid_spacing() const {
nassertr(_error_type == ET_ok, 0.0f);
return _ptr->getRelativeGridSpacing();
}
/**
* Gets the number of cloth particles.
*/
unsigned int PhysxCloth::
get_num_particles() {
nassertr(_error_type == ET_ok, 0);
return _ptr->getNumberOfParticles();
}
/**
* Sets the value of a single flag.
*/
void PhysxCloth::
set_flag(PhysxClothFlag flag, bool value) {
nassertv(_error_type == ET_ok);
NxU32 flags = _ptr->getFlags();
if (value == true) {
flags |= flag;
}
else {
flags &= ~(flag);
}
_ptr->setFlags(flags);
}
/**
* Retrieves the value of a single flag.
*/
bool PhysxCloth::
get_flag(PhysxClothFlag flag) const {
nassertr(_error_type == ET_ok, false);
return (_ptr->getFlags() & flag) ? true : false;
}
/**
* Sets 128-bit mask used for collision filtering.
*/
void PhysxCloth::
set_groups_mask(const PhysxGroupsMask &mask) {
nassertv(_error_type == ET_ok);
NxGroupsMask _mask = mask.get_mask();
_ptr->setGroupsMask(_mask);
}
/**
* Gets the 128-bit groups mask used for collision filtering.
*/
PhysxGroupsMask PhysxCloth::
get_groups_mask() const {
PhysxGroupsMask mask;
nassertr(_error_type == ET_ok, mask);
NxGroupsMask _mask = _ptr->getGroupsMask();
mask.set_mask(_mask);
return mask;
}
/**
* Returns true if this cloth is sleeping.
*
* When a cloth does not move for a period of time, it is no longer simulated
* in order to save time. This state is called sleeping. However, because
* the object automatically wakes up when it is either touched by an awake
* object, or one of its properties is changed by the user, the entire sleep
* mechanism should be transparent to the user.
*/
bool PhysxCloth::
is_sleeping() const {
nassertr(_error_type == ET_ok, false);
return _ptr->isSleeping();
}
/**
* Wakes up the cloth if it is sleeping.
*
* The wakeCounterValue determines how long until the body is put to sleep, a
* value of zero means that the body is sleeping. wake_up(0) is equivalent to
* PhysxCloth::put_to_sleep().
*/
void PhysxCloth::
wake_up(float wakeCounterValue) {
nassertv(_error_type == ET_ok);
_ptr->wakeUp(wakeCounterValue);
}
/**
* Forces the cloth to sleep.
*
* The cloth will stay asleep until the next call to simulate, and will not
* wake up until then even when otherwise it would (for example a force is
* applied to it). It can however wake up during the next do_physics call.
*/
void PhysxCloth::
put_to_sleep() {
nassertv(_error_type == ET_ok);
_ptr->putToSleep();
}
/**
* Sets the linear velocity below which an cloth may go to sleep. Cloths
* whose linear velocity is above this threshold will not be put to sleep.
*
* Setting the sleep angular/linear velocity only makes sense when the
* BF_energy_sleep_test is not set.
*/
void PhysxCloth::
set_sleep_linear_velocity(float threshold) {
nassertv(_error_type == ET_ok);
_ptr->setSleepLinearVelocity(threshold);
}
/**
* Returns the linear velocity below which an soft body may go to sleep.
* cloths whose linear velocity is above this threshold will not be put to
* sleep.
*/
float PhysxCloth::
get_sleep_linear_velocity() const {
nassertr(_error_type == ET_ok, 0.0f);
return _ptr->getSleepLinearVelocity();
}
/**
* Attaches a cloth vertex to a position in world space.
*/
void PhysxCloth::
attach_vertex_to_global_pos(unsigned int vertexId, LPoint3f const &pos) {
nassertv(_error_type == ET_ok);
nassertv(!pos.is_nan());
_ptr->attachVertexToGlobalPosition(vertexId, PhysxManager::point3_to_nxVec3(pos));
}
/**
* Attaches the cloth to a shape. All cloth points currently inside the shape
* are attached.
*
* This method only works with primitive and convex shapes. Since the inside
* of a general triangle mesh is not clearly defined.
*/
void PhysxCloth::
attach_to_shape(PhysxShape *shape) {
nassertv(_error_type == ET_ok);
nassertv(shape);
NxU32 attachmentFlags = 0; // --TODO--
_ptr->attachToShape(shape->ptr(), attachmentFlags);
}
/**
* Attaches the cloth to all shapes, currently colliding.
*
* This method only works with primitive and convex shapes. Since the inside
* of a general triangle mesh is not clearly defined.
*/
void PhysxCloth::
attach_to_colliding_shapes() {
nassertv(_error_type == ET_ok);
NxU32 attachmentFlags = 0; // --TODO--
_ptr->attachToCollidingShapes(attachmentFlags);
}
/**
* Detaches the cloth from a shape it has been attached to before.
*
* If the cloth has not been attached to the shape before, the call has no
* effect.
*/
void PhysxCloth::
detach_from_shape(PhysxShape *shape) {
nassertv(_error_type == ET_ok);
nassertv(shape);
_ptr->detachFromShape(shape->ptr());
}
/**
* Frees a previously attached cloth point.
*/
void PhysxCloth::
free_vertex(unsigned int vertexId) {
nassertv(_error_type == ET_ok);
_ptr->freeVertex(vertexId);
}
/**
* Attaches a cloth vertex to a local position within a shape.
*/
void PhysxCloth::
attach_vertex_to_shape(unsigned int vertexId, PhysxShape *shape, LPoint3f const &localPos) {
nassertv(_error_type == ET_ok);
nassertv(!localPos.is_nan());
nassertv(shape);
NxU32 attachmentFlags = 0; // --TODO--
_ptr->attachVertexToShape(vertexId, shape->ptr(),
PhysxManager::point3_to_nxVec3(localPos),
attachmentFlags);
}
/**
* Return the attachment status of the given vertex.
*/
PhysxEnums::PhysxVertexAttachmentStatus PhysxCloth::
get_vertex_attachment_status(unsigned int vertexId) const {
nassertr(_error_type == ET_ok, VAS_none);
// --TODO-- nassertr(vertexId < _ptr->getNumberOfParticles(), VAS_none);
return (PhysxVertexAttachmentStatus) _ptr->getVertexAttachmentStatus(vertexId);
}
/**
* Returns the pointer to an attached shape pointer of the given vertex. If
* the vertex is not attached or attached to a global position, NULL is
* returned.
*/
PhysxShape *PhysxCloth::
get_vertex_attachment_shape(unsigned int vertexId) const {
nassertr(_error_type == ET_ok, nullptr);
// --TODO-- nassertr(vertexId < _ptr->getNumberOfParticles(), NULL);
NxShape *shapePtr = _ptr->getVertexAttachmentShape(vertexId);
PhysxShape *shape = shapePtr ? (PhysxShape *)(shapePtr->userData) : nullptr;
return shape;
}
/**
* Returns the attachment position of the given vertex. If the vertex is
* attached to shape, the position local to the shape's pose is returned. If
* the vertex is not attached, the return value is undefined.
*/
LPoint3f PhysxCloth::
get_vertex_attachment_pos(unsigned int vertexId) const {
nassertr(_error_type == ET_ok, LPoint3f::zero());
// --TODO-- nassertr(vertexId < _ptr->getNumberOfParticles(),
// LPoint3f::zero());
return PhysxManager::nxVec3_to_point3(_ptr->getVertexAttachmentPosition(vertexId));
}
/**
* Sets an external acceleration which affects all non attached particles of
* the cloth.
*/
void PhysxCloth::
set_external_acceleration(LVector3f const &acceleration) {
nassertv(_error_type == ET_ok);
nassertv_always(!acceleration.is_nan());
_ptr->setExternalAcceleration(PhysxManager::vec3_to_nxVec3(acceleration));
}
/**
* Sets an acceleration acting normal to the cloth surface at each vertex.
*/
void PhysxCloth::
set_wind_acceleration(LVector3f const &acceleration) {
nassertv(_error_type == ET_ok);
nassertv_always(!acceleration.is_nan());
_ptr->setWindAcceleration(PhysxManager::vec3_to_nxVec3(acceleration));
}
/**
* Retrieves the external acceleration which affects all non attached
* particles of the cloth.
*/
LVector3f PhysxCloth::
get_external_acceleration() const {
nassertr(_error_type == ET_ok, LVector3f::zero());
return PhysxManager::nxVec3_to_vec3(_ptr->getExternalAcceleration());
}
/**
* Retrieves the acceleration acting normal to the cloth surface at each
* vertex
*/
LVector3f PhysxCloth::
get_wind_acceleration() const {
nassertr(_error_type == ET_ok, LVector3f::zero());
return PhysxManager::nxVec3_to_vec3(_ptr->getWindAcceleration());
}
/**
* Applies a force (or impulse) defined in the global coordinate frame, to a
* particular vertex of the cloth.
*/
void PhysxCloth::
add_force_at_vertex(LVector3f const &force, int vertexId, PhysxForceMode mode) {
nassertv(_error_type == ET_ok);
_ptr->addForceAtVertex(PhysxManager::vec3_to_nxVec3(force),
vertexId,
(NxForceMode) mode);
}
/**
* Applies a radial force (or impulse) at a particular position. All vertices
* within radius will be affected with a quadratic drop-off.
*/
void PhysxCloth::
add_force_at_pos(LPoint3f const &pos, float magnitude, float radius, PhysxForceMode mode) {
nassertv(_error_type == ET_ok);
_ptr->addForceAtPos(PhysxManager::point3_to_nxVec3(pos),
magnitude,
radius,
(NxForceMode) mode);
}
/**
* Applies a directed force (or impulse) at a particular position. All
* vertices within radius will be affected with a quadratic drop-off.
*/
void PhysxCloth::
add_directed_force_at_pos(LPoint3f const &pos, LVector3f const &force, float radius, PhysxForceMode mode) {
nassertv(_error_type == ET_ok);
_ptr->addDirectedForceAtPos(PhysxManager::point3_to_nxVec3(pos),
PhysxManager::vec3_to_nxVec3(force),
radius,
(NxForceMode) mode);
}

View File

@@ -1,132 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxCloth.h
* @author enn0x
* @date 2010-03-30
*/
#ifndef PHYSXCLOTH_H
#define PHYSXCLOTH_H
#include "pandabase.h"
#include "luse.h"
#include "physxObject.h"
#include "physxObjectCollection.h"
#include "physxEnums.h"
#include "physx_includes.h"
class PhysxScene;
class PhysxGroupsMask;
class PhysxClothNode;
/**
*
*/
class EXPCL_PANDAPHYSX PhysxCloth : public PhysxObject, public PhysxEnums {
PUBLISHED:
INLINE PhysxCloth();
INLINE ~PhysxCloth();
PhysxScene *get_scene() const;
PhysxClothNode *get_cloth_node() const;
PhysxClothNode *create_cloth_node(const char *name);
void set_name(const char *name);
void set_group(unsigned int group);
void set_groups_mask(const PhysxGroupsMask &mask);
void set_flag(PhysxClothFlag flag, bool value);
void set_thickness(float thickness);
const char *get_name() const;
unsigned int get_num_particles();
unsigned int get_group() const;
PhysxGroupsMask get_groups_mask() const;
bool get_flag(PhysxClothFlag flag) const;
float get_thickness() const;
float get_density() const;
float get_relative_grid_spacing() const;
// Attachment
void attach_vertex_to_global_pos(unsigned int vertexId, LPoint3f const &pos);
void free_vertex(unsigned int vertexId);
void attach_to_shape(PhysxShape *shape);
void attach_to_colliding_shapes();
void detach_from_shape(PhysxShape *shape);
void attach_vertex_to_shape(unsigned int vertexId, PhysxShape *shape, LPoint3f const &localPos);
PhysxVertexAttachmentStatus get_vertex_attachment_status(unsigned int vertexId) const;
PhysxShape *get_vertex_attachment_shape(unsigned int vertexId) const;
LPoint3f get_vertex_attachment_pos(unsigned int vertexId) const;
// Sleeping
bool is_sleeping() const;
void wake_up(float wakeCounterValue=NX_SLEEP_INTERVAL);
void put_to_sleep();
void set_sleep_linear_velocity(float threshold);
float get_sleep_linear_velocity() const;
// Forces
void set_external_acceleration(LVector3f const &acceleration);
LVector3f get_external_acceleration() const;
void set_wind_acceleration(LVector3f const &acceleration);
LVector3f get_wind_acceleration() const;
void add_force_at_vertex(LVector3f const &force, int vertexId,
PhysxForceMode mode=FM_force);
void add_force_at_pos(LPoint3f const &pos, float magnitude, float radius,
PhysxForceMode mode=FM_force);
void add_directed_force_at_pos(LPoint3f const &pos, LVector3f const &force, float radius,
PhysxForceMode mode=FM_force);
INLINE void ls() const;
INLINE void ls(std::ostream &out, int indent_level=0) const;
public:
void update();
PUBLISHED:
void release();
public:
INLINE NxCloth *ptr() const { return _ptr; };
void link(NxCloth *ptr);
void unlink();
private:
NxCloth *_ptr;
PT(PhysxClothNode) _node;
std::string _name;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
PhysxObject::init_type();
register_type(_type_handle, "PhysxCloth",
PhysxObject::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {
init_type();
return get_class_type();
}
private:
static TypeHandle _type_handle;
};
#include "physxCloth.I"
#endif // PHYSXCLOTH_H

View File

@@ -1,48 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxClothDesc.I
* @author enn0x
* @date 2010-03-30
*/
/**
*
*/
INLINE PhysxClothDesc::
PhysxClothDesc() {
set_to_default();
}
/**
*
*/
INLINE PhysxClothDesc::
~PhysxClothDesc() {
}
/**
* (re)sets the structure to the default.
*/
INLINE void PhysxClothDesc::
set_to_default() {
_desc.setToDefault();
set_name("");
}
/**
* Returns true if the descriptor is valid.
*/
INLINE bool PhysxClothDesc::
is_valid() const {
return _desc.isValid();
}

View File

@@ -1,298 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxClothDesc.cxx
* @author enn0x
* @date 2010-03-30
*/
#include "physxClothDesc.h"
#include "physxClothMesh.h"
#include "physxManager.h"
/**
*
*/
void PhysxClothDesc::
set_name(const char *name) {
_name = name ? name : "";
_desc.name = _name.c_str();
}
/**
*
*/
void PhysxClothDesc::
set_global_pos(const LPoint3f &pos) {
_desc.globalPose.t = PhysxManager::point3_to_nxVec3(pos);
}
/**
*
*/
void PhysxClothDesc::
set_global_mat(const LMatrix4f &mat) {
_desc.globalPose = PhysxManager::mat4_to_nxMat34(mat);
}
/**
*
*/
void PhysxClothDesc::
set_global_hpr(float h, float p, float r) {
LQuaternionf q;
LMatrix3f rot;
NxMat34 m;
q.set_hpr(LVector3f(h, p, r));
q.extract_to_matrix(rot);
_desc.globalPose.M = PhysxManager::mat3_to_nxMat33(rot);
}
/**
*
*/
void PhysxClothDesc::
set_thickness(float thickness) {
_desc.thickness = thickness;
}
/**
*
*/
void PhysxClothDesc::
set_density(float density) {
_desc.density = density;
}
/**
*
*/
void PhysxClothDesc::
set_bending_stiffness(float stiffness) {
_desc.bendingStiffness = stiffness;
}
/**
*
*/
void PhysxClothDesc::
set_stretching_stiffness(float stiffness) {
_desc.stretchingStiffness = stiffness;
}
/**
*
*/
void PhysxClothDesc::
set_damping_coefficient(float damping) {
_desc.dampingCoefficient = damping;
}
/**
*
*/
void PhysxClothDesc::
set_friction(float friction) {
_desc.friction = friction;
}
/**
*
*/
void PhysxClothDesc::
set_pressure(float pressure) {
_desc.pressure = pressure;
}
/**
*
*/
void PhysxClothDesc::
set_tear_factor(float tearFactor) {
_desc.tearFactor = tearFactor;
}
/**
* Raise or lower individual ClothFlag flags.
*/
void PhysxClothDesc::
set_flag(PhysxClothFlag flag, bool value) {
if (value == true) {
_desc.flags |= flag;
}
else {
_desc.flags &= ~(flag);
}
}
/**
* Number of solver iterations. Small numbers make the simulation faster
* while the cloth gets less stiff.
*/
void PhysxClothDesc::
set_solver_iterations(unsigned int iterations) {
_desc.solverIterations = iterations;
}
/**
*
*/
void PhysxClothDesc::
set_cloth_mesh(PhysxClothMesh *mesh) {
_desc.clothMesh = mesh->ptr();
}
/**
*
*/
const char *PhysxClothDesc::
get_name() const {
return _desc.name;
}
/**
*
*/
LPoint3f PhysxClothDesc::
get_global_pos() const {
return PhysxManager::nxVec3_to_point3(_desc.globalPose.t);
}
/**
*
*/
LMatrix4f PhysxClothDesc::
get_global_mat() const {
return PhysxManager::nxMat34_to_mat4(_desc.globalPose);
}
/**
*
*/
float PhysxClothDesc::
get_thickness() const {
return _desc.thickness;
}
/**
*
*/
float PhysxClothDesc::
get_density() const {
return _desc.density;
}
/**
*
*/
float PhysxClothDesc::
get_bending_stiffness() const {
return _desc.bendingStiffness;
}
/**
*
*/
float PhysxClothDesc::
get_stretching_stiffness() const {
return _desc.stretchingStiffness;
}
/**
*
*/
float PhysxClothDesc::
get_damping_coefficient() const {
return _desc.dampingCoefficient;
}
/**
*
*/
float PhysxClothDesc::
get_friction() const {
return _desc.friction;
}
/**
*
*/
float PhysxClothDesc::
get_pressure() const {
return _desc.pressure;
}
/**
*
*/
float PhysxClothDesc::
get_tear_factor() const {
return _desc.tearFactor;
}
/**
*
*/
bool PhysxClothDesc::
get_flag(PhysxClothFlag flag) const {
return (_desc.flags & flag) ? true : false;
}
/**
*
*/
unsigned int PhysxClothDesc::
get_solver_iterations() const {
return _desc.solverIterations;
}
/**
* Used by PhysScene to query the sizes of arrays to allocate for the user
* buffers in PhysxClothNode.
*/
/*
void PhysxClothDesc::
get_mesh_numbers(NxU32 &numVertices, NxU32 &numTriangles) {
NxClothMeshDesc meshDesc;
_desc.clothMesh->saveToDesc(meshDesc);
numVertices = meshDesc.numVertices;
numTriangles = meshDesc.numTriangles;
}
*/

View File

@@ -1,77 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxClothDesc.h
* @author enn0x
* @date 2010-03-30
*/
#ifndef PHYSXCLOTHDESC_H
#define PHYSXCLOTHDESC_H
#include "pandabase.h"
#include "luse.h"
#include "physxEnums.h"
#include "physx_includes.h"
class PhysxClothMesh;
/**
* Descriptor for PhysxCloth.
*/
class EXPCL_PANDAPHYSX PhysxClothDesc : public PhysxEnums {
PUBLISHED:
INLINE PhysxClothDesc();
INLINE ~PhysxClothDesc();
INLINE void set_to_default();
INLINE bool is_valid() const;
void set_cloth_mesh(PhysxClothMesh *mesh);
void set_name(const char *name);
void set_global_pos(const LPoint3f &pos);
void set_global_mat(const LMatrix4f &mat);
void set_global_hpr(float h, float p, float r);
void set_thickness(float thickness);
void set_density(float density);
void set_bending_stiffness(float stiffness);
void set_stretching_stiffness(float stiffness);
void set_damping_coefficient(float damping);
void set_friction(float friction);
void set_pressure(float pressure);
void set_tear_factor(float tearFactor);
void set_solver_iterations(unsigned int interations);
void set_flag(PhysxClothFlag flag, bool value);
const char *get_name() const;
LPoint3f get_global_pos() const;
LMatrix4f get_global_mat() const;
float get_thickness() const;
float get_density() const;
float get_bending_stiffness() const;
float get_stretching_stiffness() const;
float get_damping_coefficient() const;
float get_friction() const;
float get_pressure() const;
float get_tear_factor() const;
unsigned int get_solver_iterations() const;
bool get_flag(PhysxClothFlag flag) const;
public:
NxClothDesc _desc;
private:
std::string _name;
};
#include "physxClothDesc.I"
#endif // PHYSXCLOTHDESC_H

View File

@@ -1,47 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxClothMesh.I
* @author enn0x
* @date 2010-03-28
*/
/**
*
*/
INLINE PhysxClothMesh::
PhysxClothMesh() : PhysxObject() {
}
/**
*
*/
INLINE PhysxClothMesh::
~PhysxClothMesh() {
}
/**
*
*/
INLINE void PhysxClothMesh::
ls() const {
ls(nout);
}
/**
*
*/
INLINE void PhysxClothMesh::
ls(std::ostream &out, int indent_level) const {
indent(out, indent_level) << get_type().get_name()
<< " (at 0x" << this << ")\n";
}

View File

@@ -1,66 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxClothMesh.cxx
* @author enn0x
* @date 2010-03-28
*/
#include "physxClothMesh.h"
#include "physxMeshPool.h"
TypeHandle PhysxClothMesh::_type_handle;
/**
*
*/
void PhysxClothMesh::
link(NxClothMesh *meshPtr) {
// Link self
PhysxManager::get_global_ptr()->_cloth_meshes.add(this);
_ptr = meshPtr;
_error_type = ET_ok;
}
/**
*
*/
void PhysxClothMesh::
unlink() {
// Unlink self
_error_type = ET_released;
PhysxManager::get_global_ptr()->_cloth_meshes.remove(this);
}
/**
*
*/
void PhysxClothMesh::
release() {
nassertv(_error_type == ET_ok);
unlink();
NxGetPhysicsSDK()->releaseClothMesh(*_ptr);
_ptr = nullptr;
PhysxMeshPool::release_cloth_mesh(this);
}
/**
* Returns the reference count for shared meshes.
*/
unsigned int PhysxClothMesh::
get_reference_count() const {
nassertr(_error_type == ET_ok, 0);
return _ptr->getReferenceCount();
}

View File

@@ -1,71 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxClothMesh.h
* @author enn0x
* @date 2010-03-28
*/
#ifndef PHYSXCLOTHMESH_H
#define PHYSXCLOTHMESH_H
#include "pandabase.h"
#include "physxObject.h"
#include "physx_includes.h"
/**
*
*/
class EXPCL_PANDAPHYSX PhysxClothMesh : public PhysxObject {
PUBLISHED:
unsigned int get_reference_count() const;
PUBLISHED:
void release();
INLINE void ls() const;
INLINE void ls(std::ostream &out, int indent_level=0) const;
public:
INLINE PhysxClothMesh();
INLINE ~PhysxClothMesh();
INLINE NxClothMesh *ptr() const { return _ptr; };
void link(NxClothMesh *meshPtr);
void unlink();
private:
NxClothMesh *_ptr;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
PhysxObject::init_type();
register_type(_type_handle, "PhysxClothMesh",
PhysxObject::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {
init_type();
return get_class_type();
}
private:
static TypeHandle _type_handle;
};
#include "physxClothMesh.I"
#endif // PHYSXCLOTHMESH_H

View File

@@ -1,82 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxClothMeshDesc.I
* @author enn0x
* @date 2010-03-28
*/
/**
*
*/
INLINE PhysxClothMeshDesc::
PhysxClothMeshDesc() {
_desc.flags = 0;
_desc.pointStrideBytes = sizeof(NxVec3);
_desc.triangleStrideBytes = 3*sizeof(NxU32);
_desc.points = nullptr;
_desc.triangles = nullptr;
_points = nullptr;
_triangles = nullptr;
_texcoords = nullptr;
}
/**
*
*/
INLINE PhysxClothMeshDesc::
~PhysxClothMeshDesc() {
if (_points) {
delete [] _points;
}
if (_triangles) {
delete [] _triangles;
}
if (_texcoords) {
delete [] _texcoords;
}
}
/**
* Returns true if the descriptor is valid.
*/
INLINE bool PhysxClothMeshDesc::
is_valid() const {
return _desc.isValid();
}
/**
*
*/
INLINE const NxClothMeshDesc &PhysxClothMeshDesc::
get_desc() const {
return _desc;
}
/**
*
*/
INLINE const plist<LPoint2f> PhysxClothMeshDesc::
get_texcoords() const {
plist<LPoint2f> texcoords;
for (unsigned int i=0; i < _desc.numVertices; i++) {
LPoint2f uv = _texcoords[i];
texcoords.push_back(uv);
}
return texcoords;
}

View File

@@ -1,193 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxClothMeshDesc.cxx
* @author enn0x
* @date 2010-03-28
*/
#include "physxClothMeshDesc.h"
#include "physxManager.h"
#include "nodePathCollection.h"
#include "geomNode.h"
#include "geomVertexReader.h"
/**
* Sets the number of vertices to be stored within this triangle mesh. The
* function allocates memory for the vertices, but it does not set any
* vertices.
*
* This method must be called before any calls to set_vertex are done!
*/
void PhysxClothMeshDesc::
set_num_vertices(unsigned int numVertices) {
// Vertices
if (_desc.points) {
delete [] _points;
}
_points = new NxVec3[numVertices];
_desc.numVertices = numVertices;
_desc.points = _points;
// Texture coordinates
if (_texcoords) {
delete [] _texcoords;
}
_texcoords = new LPoint2f[numVertices];
}
/**
* Sets a single vertex. You have to call the function set_num_vertices
* before you can call this function.
*/
void PhysxClothMeshDesc::
set_vertex(unsigned int idx, const LPoint3f &vert, const LPoint2f &texcoord) {
nassertv(_desc.numVertices > idx);
_points[idx] = PhysxManager::point3_to_nxVec3(vert);
_texcoords[idx] = texcoord;
}
/**
* Sets the number of triangles to be stored in this triangle mesh.
*
* This method must be called before any calls to set_triangle are done!
*/
void PhysxClothMeshDesc::
set_num_triangles(unsigned int numTriangles) {
if (_desc.triangles) {
delete [] _triangles;
}
_triangles = new NxU32[3 * numTriangles];
_desc.numTriangles = numTriangles;
_desc.triangles = _triangles;
}
/**
* Sets a single triangle, by providing the three indices i1, i2, i3.
*/
void PhysxClothMeshDesc::
set_triangle(unsigned int idx,
unsigned int i1, unsigned int i2, unsigned int i3) {
nassertv(_desc.numTriangles > idx);
idx = 3 * idx;
_triangles[idx] = i1;
_triangles[idx + 1] = i2;
_triangles[idx + 2] = i3;
}
/**
* A convenience method to set the mesh data from a NodePath in a single call.
* The method iterates over the NodePath geoms and collects data for the
* triangle mesh.
*
* Do not use the following function when using this one: - set_num_vertices -
* set_vertex - set_num_triangles - set_triangle
*/
void PhysxClothMeshDesc::
set_from_node_path(const NodePath &np) {
pvector<LPoint3f> dataVertices;
pvector<LPoint2f> dataTexcoords;
pvector<int> dataIndices;
// Collect data from NodePath
NodePathCollection npc = np.find_all_matches( "**/+GeomNode" );
for (int i=0; i<npc.get_num_paths(); i++) {
NodePath gnp = npc.get_path(i);
GeomNode *gnode = DCAST(GeomNode, gnp.node());
for (int j=0; j<gnode->get_num_geoms(); j++) {
CPT(Geom) geom = gnode->get_geom(j);
CPT(GeomVertexData) vdata = geom->get_vertex_data();
GeomVertexReader reader;
// Vertices
reader = GeomVertexReader(vdata, InternalName::get_vertex());
while (!reader.is_at_end()) {
dataVertices.push_back(reader.get_data3f());
}
// Texcoords
reader = GeomVertexReader(vdata, InternalName::get_texcoord());
while (!reader.is_at_end()) {
dataTexcoords.push_back(reader.get_data2f());
}
// Indices
for (int k=0; k<geom->get_num_primitives(); k++) {
CPT(GeomPrimitive) prim = geom->get_primitive(k);
prim = prim->decompose();
for (int l=0; l<prim->get_num_primitives(); l++) {
int s = prim->get_primitive_start(l);
int e = prim->get_primitive_end(l);
for (int l=s; l<e; l++) {
dataIndices.push_back(prim->get_vertex(l));
}
}
}
}
}
// Set descriptor members
int i;
NxU32 numVertices = dataVertices.size();
NxU32 numTriangles = dataIndices.size() / 3;
_points = new NxVec3[numVertices];
_triangles = new NxU32[3 * numTriangles];
_texcoords = new LPoint2f[numVertices];
i = 0;
pvector<LPoint3f>::const_iterator vit;
for (vit=dataVertices.begin(); vit!=dataVertices.end(); vit++) {
LPoint3f v = *vit;
_points[i] = PhysxManager::point3_to_nxVec3(v);
i++;
}
i = 0;
pvector<LPoint2f>::const_iterator tcit;
for (tcit=dataTexcoords.begin(); tcit!=dataTexcoords.end(); tcit++) {
LPoint2f tc = *tcit;
_texcoords[i] = tc;
i++;
}
i = 0;
pvector<int>::const_iterator iit;
for(iit=dataIndices.begin(); iit!=dataIndices.end(); iit++) {
NxU32 idx = *iit;
_triangles[i] = idx;
i++;
}
_desc.numVertices = numVertices;
_desc.points = _points;
_desc.numTriangles = numTriangles;
_desc.triangles = _triangles;
}

View File

@@ -1,59 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxClothMeshDesc.h
* @author enn0x
* @date 2010-03-28
*/
#ifndef PHYSXCLOTHMESHDESC_H
#define PHYSXCLOTHMESHDESC_H
#include "pandabase.h"
#include "luse.h"
#include "nodePath.h"
#include "plist.h"
#include "physx_includes.h"
/**
*
*/
class EXPCL_PANDAPHYSX PhysxClothMeshDesc {
PUBLISHED:
INLINE PhysxClothMeshDesc();
INLINE ~PhysxClothMeshDesc();
INLINE bool is_valid() const;
void set_num_vertices(unsigned int n);
void set_vertex(unsigned int idx,
const LPoint3f &vert, const LPoint2f &texcoord);
void set_num_triangles(unsigned int n);
void set_triangle(unsigned int idx,
unsigned int i1, unsigned int i2, unsigned int i3);
void set_from_node_path(const NodePath &np);
public:
INLINE const NxClothMeshDesc &get_desc() const;
INLINE const plist<LPoint2f> get_texcoords() const;
private:
NxClothMeshDesc _desc;
NxVec3 *_points;
NxU32 *_triangles;
LPoint2f *_texcoords;
};
#include "physxClothMeshDesc.I"
#endif // PHYSXCLOTHMESHDESC_H

View File

@@ -1,45 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxClothNode.I
* @author enn0x
* @date 2010-04-05
*/
/**
*
*/
INLINE PhysxClothNode::
PhysxClothNode(const char *name) : GeomNode(name) {
_numVertices = 0;
_vdata = new GeomVertexData("", GeomVertexFormat::get_v3n3t2(), Geom::UH_stream);
_prim = new GeomTriangles(Geom::UH_stream);
_prim->set_shade_model(Geom::SM_uniform);
_geom = new Geom(_vdata);
_geom->add_primitive(_prim);
this->add_geom(_geom);
_numTexcoords = 0;
_texcoords = nullptr;
}
/**
*
*/
INLINE PhysxClothNode::
~PhysxClothNode() {
if (_texcoords) {
delete [] _texcoords;
}
}

View File

@@ -1,215 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxClothNode.cxx
* @author enn0x
* @date 2010-04-05
*/
#include "physxClothNode.h"
#include "physxCloth.h"
#include "physxFileStream.h"
#include "geomVertexFormat.h"
#include "geomVertexWriter.h"
TypeHandle PhysxClothNode::_type_handle;
/**
*
*/
void PhysxClothNode::
allocate(PhysxCloth *cloth) {
_cloth = cloth;
// Retrieve number of vertices and triangles the hard way
NxClothMeshDesc meshDesc;
_cloth->ptr()->getClothMesh()->saveToDesc(meshDesc);
NxU32 numVertices = meshDesc.numVertices;
NxU32 numTriangles = meshDesc.numTriangles;
NxReal factor = 1.0f; // TODO: max(1.0f, factor);
// Reserve more memory for vertices than the initial mesh takes because
// tearing creates new vertices
NxU32 maxVertices = factor * numVertices;
_mesh.verticesPosBegin = (NxVec3 *)malloc(sizeof(NxVec3) * maxVertices);
_mesh.verticesNormalBegin = (NxVec3 *)malloc(sizeof(NxVec3) * maxVertices);
_mesh.verticesPosByteStride = sizeof(NxVec3);
_mesh.verticesNormalByteStride = sizeof(NxVec3);
_mesh.maxVertices = maxVertices;
_mesh.numVerticesPtr = (NxU32 *)malloc(sizeof(NxU32));
// The number of triangles is constant, even if the cloth is torn
NxU32 maxIndices = 3 * numTriangles;
_mesh.indicesBegin = (NxU32 *)malloc(sizeof(NxU32) * maxIndices);
_mesh.indicesByteStride = sizeof(NxU32);
_mesh.maxIndices = maxIndices;
_mesh.numIndicesPtr = (NxU32 *)malloc(sizeof(NxU32));
NxU32 maxParentIndices = maxVertices;
_mesh.parentIndicesBegin = (NxU32 *)malloc(sizeof(NxU32)*maxParentIndices);
_mesh.parentIndicesByteStride = sizeof(NxU32);
_mesh.maxParentIndices = maxParentIndices;
_mesh.numParentIndicesPtr = (NxU32 *)malloc(sizeof(NxU32));
*(_mesh.numVerticesPtr) = 0;
*(_mesh.numIndicesPtr) = 0;
_cloth->ptr()->setMeshData(_mesh);
}
/**
*
*/
void PhysxClothNode::
update() {
NxU32 numVertices = *(_mesh.numVerticesPtr);
if (numVertices == _numVertices) {
update_geom();
}
else {
update_texcoords();
create_geom();
_numVertices = numVertices;
}
}
/**
*
*/
void PhysxClothNode::
create_geom() {
_prim->clear_vertices();
GeomVertexWriter vwriter = GeomVertexWriter(_vdata, InternalName::get_vertex());
GeomVertexWriter nwriter = GeomVertexWriter(_vdata, InternalName::get_normal());
GeomVertexWriter twriter = GeomVertexWriter(_vdata, InternalName::get_texcoord());
// Vertices and normals
NxU32 numVertices = *(_mesh.numVerticesPtr);
NxVec3 *v = (NxVec3 *)_mesh.verticesPosBegin;
NxVec3 *n = (NxVec3 *)_mesh.verticesNormalBegin;
for (unsigned int i=0; i < numVertices; i++) {
vwriter.add_data3f(v->x, v->y, v->z);
v++;
nwriter.add_data3f(n->x, n->y, n->z);
n++;
}
// Texture coordinates
NxReal tex_u;
NxReal tex_v;
if (_texcoords) {
for (unsigned int i=0; i < numVertices; i++) {
tex_u = _texcoords[2*i];
tex_v = _texcoords[2*i+1];
twriter.add_data2f(tex_u, tex_v);
}
}
// Indices
NxU32 numIndices = *(_mesh.numIndicesPtr);
NxU32 *idx = (NxU32 *)_mesh.indicesBegin;
for (unsigned int i=0; i < numIndices; i++) {
_prim->add_vertex(*idx);
idx++;
}
_prim->close_primitive();
}
/**
*
*/
void PhysxClothNode::
update_geom() {
GeomVertexWriter vwriter = GeomVertexWriter(_vdata, InternalName::get_vertex());
GeomVertexWriter nwriter = GeomVertexWriter(_vdata, InternalName::get_normal());
NxU32 numVertices = *(_mesh.numVerticesPtr);
NxVec3 *v = (NxVec3 *)_mesh.verticesPosBegin;
NxVec3 *n = (NxVec3 *)_mesh.verticesNormalBegin;
for (unsigned int i=0; i < numVertices; i++) {
vwriter.set_data3f(v->x, v->y, v->z);
v++;
nwriter.set_data3f(n->x, n->y, n->z);
n++;
}
}
/**
*
*/
void PhysxClothNode::
update_texcoords() {
if (!_texcoords) {
return;
}
NxU32 numVertices = *(_mesh.numVerticesPtr);
NxU32 *parent = (NxU32 *)_mesh.parentIndicesBegin + _numTexcoords;
for (NxU32 i=_numTexcoords; i < numVertices; i++, parent++) {
_texcoords[2*i] = _texcoords[2*(*parent)];
_texcoords[2*i+1] = _texcoords[2*(*parent)+1];
}
_numTexcoords = numVertices;
}
/**
*
*/
bool PhysxClothNode::
set_texcoords(const Filename &filename) {
if (filename.empty()) {
return false;
}
Filename fn(filename);
fn.resolve_filename(get_model_path());
if (!filename.exists()) {
return false;
}
PhysxFileStream fs(filename.c_str(), true);
fs.readByte(); // N
fs.readByte(); // X
fs.readByte(); // X
fs.readByte(); // 1
fs.readByte(); // T
fs.readByte(); // E
fs.readByte(); // X
fs.readByte(); // C
fs.readByte(); // 1
_numTexcoords = fs.readDword();
_texcoords = new float[2 * _numTexcoords];
for (unsigned int i=0; i<_numTexcoords; i++) {
_texcoords[2*i] = fs.readFloat();
_texcoords[2*i+1] = fs.readFloat();
}
return true;
}

View File

@@ -1,85 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxClothNode.h
* @author enn0x
* @date 2010-04-05
*/
#ifndef PHYSXCLOTHNODE_H
#define PHYSXCLOTHNODE_H
#include "pandabase.h"
#include "pointerTo.h"
#include "geomNode.h"
#include "transformState.h"
#include "geom.h"
#include "geomVertexData.h"
#include "geomTriangles.h"
#include "filename.h"
#include "physx_includes.h"
class PhysxCloth;
/**
* Renderable geometry which represents a cloth mesh.
*/
class EXPCL_PANDAPHYSX PhysxClothNode : public GeomNode {
PUBLISHED:
INLINE explicit PhysxClothNode(const char *name);
INLINE ~PhysxClothNode();
bool set_texcoords(const Filename &filename);
public:
void allocate(PhysxCloth *cloth);
void update();
private:
void create_geom();
void update_geom();
void update_texcoords();
unsigned int _numVertices;
NxMeshData _mesh;
PT(GeomVertexData) _vdata;
PT(Geom) _geom;
PT(GeomTriangles) _prim;
PT(PhysxCloth) _cloth;
unsigned int _numTexcoords;
float *_texcoords;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
GeomNode::init_type();
register_type(_type_handle, "PhysxClothNode",
GeomNode::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {
init_type();
return get_class_type();
}
private:
static TypeHandle _type_handle;
};
#include "physxClothNode.I"
#endif // PHYSXCLOTHNODE_H

View File

@@ -1,46 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxConstraintDominance.I
* @author enn0x
* @date 2009-12-22
*/
/**
*
*/
INLINE PhysxConstraintDominance::
PhysxConstraintDominance(float d0, float d1) : _dominance(d0, d1) {
}
/**
*
*/
INLINE PhysxConstraintDominance::
~PhysxConstraintDominance() {
}
/**
*
*/
INLINE NxConstraintDominance PhysxConstraintDominance::
get_dominance() const {
return _dominance;
}
/**
*
*/
INLINE void PhysxConstraintDominance::
set_dominance(NxConstraintDominance value) {
_dominance = value;
}

View File

@@ -1,50 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxConstraintDominance.cxx
* @author enn0x
* @date 2009-12-22
*/
#include "physxConstraintDominance.h"
/**
* Retruns the first dominance factor.
*/
float PhysxConstraintDominance::
get_0() const {
return _dominance.dominance0;
}
/**
* Returns the second dominance factor.
*/
float PhysxConstraintDominance::
get_1() const {
return _dominance.dominance1;
}
/**
* Sets the first dominance factor.
*/
void PhysxConstraintDominance::
set_0(float d0) {
_dominance.dominance0 = d0;
}
/**
* Sets the second dominance factor.
*/
void PhysxConstraintDominance::
set_1(float d1) {
_dominance.dominance1 = d1;
}

View File

@@ -1,53 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxConstraintDominance.h
* @author enn0x
* @date 2009-12-22
*/
#ifndef PHYSXCONSTRAINTDOMINANCE_H
#define PHYSXCONSTRAINTDOMINANCE_H
#include "pandabase.h"
#include "luse.h"
#include "config_physx.h"
class PhysxShape;
/**
* Expresses the dominance relationship of a constraint. For the time being
* only three settings are permitted:. (1.0f, 1.0f), (0.0f, 1.0f), and (1.0f,
* 0.0f).
*
* See PhysxScene::set_dominance_group_pair for a detailed explanation of
* dominance behaviour.
*/
class EXPCL_PANDAPHYSX PhysxConstraintDominance {
PUBLISHED:
INLINE PhysxConstraintDominance(float d0, float d1);
INLINE ~PhysxConstraintDominance();
float get_0() const;
float get_1() const;
void set_0(float d0);
void set_1(float d1);
public:
INLINE void set_dominance(NxConstraintDominance value);
INLINE NxConstraintDominance get_dominance() const;
private:
NxConstraintDominance _dominance;
};
#include "physxConstraintDominance.I"
#endif // PHYSXCONSTRAINTDOMINANCE_H

View File

@@ -1,29 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxContactPair.I
* @author enn0x
* @date 2009-12-19
*/
/**
*
*/
INLINE PhysxContactPair::
PhysxContactPair(const NxContactPair pair) {
_pair = pair;
}
/**
*
*/
INLINE PhysxContactPair::
~PhysxContactPair() {
}

View File

@@ -1,136 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxContactPair.cxx
* @author enn0x
* @date 2009-12-19
*/
#include "physxContactPair.h"
#include "physxManager.h"
#include "physxActor.h"
#include "physxContactPoint.h"
TypeHandle PhysxContactPair::_type_handle;
/**
* Returns the first of the two actors that makes up this pair.
*/
PhysxActor *PhysxContactPair::
get_actor_a() const {
if (_pair.isDeletedActor[0]) {
physx_cat.warning() << "actor A has been deleted" << std::endl;
return nullptr;
}
NxActor *actorPtr = _pair.actors[0];
return (actorPtr == nullptr) ? nullptr : (PhysxActor *)actorPtr->userData;
}
/**
* Returns the second of the two actors that make up his pair.
*/
PhysxActor *PhysxContactPair::
get_actor_b() const {
if (_pair.isDeletedActor[1]) {
physx_cat.warning() << "actor B has been deleted" << std::endl;
return nullptr;
}
NxActor *actorPtr = _pair.actors[1];
return (actorPtr == nullptr) ? nullptr : (PhysxActor *)actorPtr->userData;
}
/**
* Returns true if the first of the two actors is deleted.
*/
bool PhysxContactPair::
is_deleted_a() const {
return _pair.isDeletedActor[0];
}
/**
* Returns true if the second of the two actors is deleted.
*/
bool PhysxContactPair::
is_deleted_b() const {
return _pair.isDeletedActor[1];
}
/**
* Returns the total contact normal force that was applied for this pair, to
* maintain nonpenetration constraints.
*
* You should set the ContactPairFlag CPF_notify_forces in order to receive
* this value.
*
* @see PhysxScene::set_actor_pair_flag
* @see PhysxScene::set_actor_group_pair_flag
*/
LVector3f PhysxContactPair::
get_sum_normal_force() const {
return PhysxManager::nxVec3_to_vec3(_pair.sumNormalForce);
}
/**
* Returns the total tangential force that was applied for this pair.
*
* You should set the ContactPairFlag CPF_notify_forces in order to receive
* this value.
*
* @see PhysxScene::set_actor_pair_flag
* @see PhysxScene::set_actor_group_pair_flag
*/
LVector3f PhysxContactPair::
get_sum_friction_force() const {
return PhysxManager::nxVec3_to_vec3(_pair.sumFrictionForce);
}
/**
* Returns the total number of contact points reported in this pair's contact
* stream.
*
* This method is a helper for iterating over the pair's contact stream.
*/
unsigned int PhysxContactPair::
get_num_contact_points() {
if (_contacts.size() == 0) {
NxContactStreamIterator it(_pair.stream);
while(it.goNextPair()) {
while(it.goNextPatch()) {
while(it.goNextPoint()) {
PhysxContactPoint cp;
cp.set(it);
_contacts.push_back(cp);
}
}
}
}
return _contacts.size();
}
/**
* Returns an instance of PhysxContactPoint, which represents a single entry
* of this pair's contact stream.
*
* This method is a helper for iterating over the pair's contact stream.
*/
PhysxContactPoint PhysxContactPair::
get_contact_point(unsigned int idx) const {
nassertr(idx < _contacts.size(), PhysxContactPoint::empty());
return _contacts[idx];
}

View File

@@ -1,77 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxContactPair.h
* @author enn0x
* @date 2009-12-19
*/
#ifndef PHYSXCONTACTPAIR_H
#define PHYSXCONTACTPAIR_H
#include "pandabase.h"
#include "luse.h"
#include "typedReferenceCount.h"
#include "pvector.h"
#include "config_physx.h"
class PhysxShape;
class PhysxContactPoint;
/**
* An instance of this class is send with contact reporting events. It
* contains detailed information on the contact.
*/
class EXPCL_PANDAPHYSX PhysxContactPair : public TypedReferenceCount {
PUBLISHED:
INLINE ~PhysxContactPair();
bool is_deleted_a() const;
bool is_deleted_b() const;
PhysxActor *get_actor_a() const;
PhysxActor *get_actor_b() const;
LVector3f get_sum_normal_force() const;
LVector3f get_sum_friction_force() const;
unsigned int get_num_contact_points();
PhysxContactPoint get_contact_point(unsigned int idx) const;
MAKE_SEQ(get_contact_points, get_num_contact_points, get_contact_point);
public:
INLINE PhysxContactPair(const NxContactPair pair);
private:
NxContactPair _pair;
pvector<PhysxContactPoint> _contacts;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
TypedReferenceCount::init_type();
register_type(_type_handle, "PhysxContactPair",
TypedReferenceCount::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {
init_type();
return get_class_type();
}
private:
static TypeHandle _type_handle;
};
#include "physxContactPair.I"
#endif // PHYSXCONTACTPAIR_H

View File

@@ -1,29 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxContactPoint.I
* @author enn0x
* @date 2009-12-20
*/
/**
*
*/
INLINE PhysxContactPoint::
PhysxContactPoint() {
// _hit = hit;
}
/**
*
*/
INLINE PhysxContactPoint::
~PhysxContactPoint() {
}

View File

@@ -1,96 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxContactPoint.cxx
* @author enn0x
* @date 2009-12-20
*/
#include "physxContactPoint.h"
#include "physxManager.h"
#include "physxShape.h"
TypeHandle PhysxContactPoint::_type_handle;
/**
*
*/
void PhysxContactPoint::
set(NxContactStreamIterator it) {
_point = it.getPoint();
_normal = it.getPatchNormal();
_normal_force = it.getPointNormalForce();
_separation = it.getSeparation();
_feature_index0 = it.getFeatureIndex0();
_feature_index1 = it.getFeatureIndex1();
}
/**
*
*/
PhysxContactPoint PhysxContactPoint::
empty() {
return PhysxContactPoint();
}
/**
* Returns the contact point position.
*/
LPoint3f PhysxContactPoint::
get_point() const {
return PhysxManager::nxVec3_to_point3(_point);
}
/**
* Retrieves the patch normal.
*/
LVector3f PhysxContactPoint::
get_normal() const {
return PhysxManager::nxVec3_to_vec3(_normal);
}
/**
* Retrieves the point normal force.
*/
float PhysxContactPoint::
get_normal_force() const {
return _normal_force;
}
/**
* Return the separation for the contact point.
*/
float PhysxContactPoint::
get_separation() const {
return _separation;
}
/**
* Retrieves the feature index.
*/
unsigned int PhysxContactPoint::
get_feature_index0() const {
return _feature_index0;
}
/**
* Retrieves the feature index.
*/
unsigned int PhysxContactPoint::
get_feature_index1() const {
return _feature_index1;
}

View File

@@ -1,78 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxContactPoint.h
* @author enn0x
* @date 2009-12-20
*/
#ifndef PHYSXCONTACTPOINT_H
#define PHYSXCONTACTPOINT_H
#include "pandabase.h"
#include "luse.h"
#include "typedObject.h"
#include "config_physx.h"
class PhysxShape;
/**
* A helper structure for iterating over contact streams reported by
* PhysxContactPair.
*/
class EXPCL_PANDAPHYSX PhysxContactPoint : public TypedObject {
PUBLISHED:
INLINE PhysxContactPoint();
INLINE ~PhysxContactPoint();
LPoint3f get_point() const;
LVector3f get_normal() const;
float get_normal_force() const;
float get_separation() const;
unsigned int get_feature_index0() const;
unsigned int get_feature_index1() const;
public:
static PhysxContactPoint empty();
void set(NxContactStreamIterator it);
private:
NxVec3 _point;
NxVec3 _normal;
NxReal _normal_force;
NxReal _separation;
NxU32 _feature_index0;
NxU32 _feature_index1;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
TypedReferenceCount::init_type();
register_type(_type_handle, "PhysxContactPoint",
TypedReferenceCount::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {
init_type();
return get_class_type();
}
private:
static TypeHandle _type_handle;
};
#include "physxContactPoint.I"
#endif // PHYSXCONTACTPOINT_H

View File

@@ -1,29 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxContactReport.I
* @author enn0x
* @date 2009-09-19
*/
/**
*
*/
INLINE PhysxContactReport::
PhysxContactReport() : NxUserContactReport() {
_enabled = false;
}
/**
*
*/
INLINE PhysxContactReport::
~PhysxContactReport() {
}

View File

@@ -1,91 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxContactReport.cxx
* @author enn0x
* @date 2009-09-19
*/
#include "physxContactReport.h"
#include "physxContactPair.h"
#include "physxManager.h"
#include "event.h"
#include "eventQueue.h"
#include "eventParameter.h"
PStatCollector PhysxContactReport::_pcollector("App:PhysX:Contact Reporting");
/**
*
*/
void PhysxContactReport::
enable() {
_enabled = true;
}
/**
*
*/
void PhysxContactReport::
disable() {
_enabled = false;
}
/**
*
*/
bool PhysxContactReport::
is_enabled() const {
return _enabled;
}
/**
*
*/
void PhysxContactReport::
onContactNotify(NxContactPair &pair, NxU32 flags) {
if (!_enabled) {
return;
}
_pcollector.start();
Event *event;
if (flags & NX_NOTIFY_ON_START_TOUCH) {
event = new Event("physx-contact-start");
}
else if (flags & NX_NOTIFY_ON_END_TOUCH) {
event = new Event("physx-contact-stop");
}
else if (flags & NX_NOTIFY_ON_TOUCH) {
event = new Event("physx-contact-touch");
}
else if (flags & NX_NOTIFY_ON_START_TOUCH_FORCE_THRESHOLD) {
event = new Event("physx-contact-start-force-threshold");
}
else if (flags & NX_NOTIFY_ON_END_TOUCH_FORCE_THRESHOLD) {
event = new Event("physx-contact-stop-force-threshold");
}
else if (flags & NX_NOTIFY_ON_TOUCH_FORCE_THRESHOLD) {
event = new Event("physx-contact-touch-force-threshold");
}
else {
return;
}
PT(PhysxContactPair) ppair = new PhysxContactPair(pair);
event->add_parameter(EventParameter(ppair));
EventQueue::get_global_event_queue()->queue_event(event);
_pcollector.stop();
}

View File

@@ -1,43 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxContactReport.h
* @author enn0x
* @date 2009-09-19
*/
#ifndef PHYSXCONTACTREPORT_H
#define PHYSXCONTACTREPORT_H
#include "pandabase.h"
#include "pStatCollector.h"
#include "physx_includes.h"
/**
* Implementation of the NxUserContactReport interface.
*/
class EXPCL_PANDAPHYSX PhysxContactReport : public NxUserContactReport {
public:
INLINE PhysxContactReport();
INLINE ~PhysxContactReport();
void enable();
void disable();
bool is_enabled() const;
void onContactNotify(NxContactPair& pair, NxU32 flags);
private:
bool _enabled;
static PStatCollector _pcollector;
};
#include "physxContactReport.I"
#endif // PHYSXCONTACTREPORT_H

View File

@@ -1,69 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxController.I
* @author enn0x
* @date 2009-09-24
*/
/**
*
*/
INLINE PhysxController::
PhysxController() : PhysxObject() {
_speed = NxVec3(0.0f, 0.0f, 0.0f);
_omega = 0.0f;
_heading = 0.0f;
_jumping = false;
_jump_time = 0.0f;
_jump_v0 = 0.0f;
_sharpness = 1.0f;
_min_dist = 0.0001f;
_up_vector = NxVec3(0.0f, 1.0f, 0.0f);
_up_axis = (NxHeightFieldAxis)physx_up_axis.get_value();
switch (_up_axis) {
case NX_Z:
_up_quat = NxQuat(90.0f, NxVec3(1.0f, 0.0f, 0.0f));
break;
case NX_Y:
_up_quat = NxQuat(0.0f, NxVec3(1.0f, 0.0f, 0.0f));
break;
default:
physx_cat.error() << "only y-up and z-up are permitted" << std::endl;
}
_up_quat_inv = _up_quat;
_up_quat_inv.invert();
}
/**
*
*/
INLINE void PhysxController::
ls() const {
ls(nout);
}
/**
*
*/
INLINE void PhysxController::
ls(std::ostream &out, int indent_level) const {
indent(out, indent_level) << get_type().get_name()
<< " (at 0x" << this << ")";
out << " A:0x" << get_actor();
out << "\n";
}

View File

@@ -1,333 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file physxController.cxx
* @author enn0x
* @date 2009-09-24
*/
#include "event.h"
#include "eventQueue.h"
#include "eventParameter.h"
#include "physxController.h"
#include "physxManager.h"
#include "physxActor.h"
#include "physxBoxController.h"
#include "physxCapsuleController.h"
TypeHandle PhysxController::_type_handle;
/**
*
*/
void PhysxController::
release() {
nassertv(_error_type == ET_ok);
NxControllerManager *cm = get_actor()->get_scene()->cm();
unlink();
cm->releaseController(*ptr());
}
/**
*
*/
PhysxController *PhysxController::
factory(NxControllerType controllerType) {
switch (controllerType) {
case NX_CONTROLLER_BOX:
return new PhysxBoxController();
case NX_CONTROLLER_CAPSULE:
return new PhysxCapsuleController();
default:
break;
}
physx_cat.error() << "Unknown controller type.\n";
return nullptr;
}
/**
* Retrieves the actor which this controller is associated with.
*/
PhysxActor *PhysxController::
get_actor() const {
nassertr(_error_type == ET_ok, nullptr);
return (PhysxActor *)(ptr()->getActor()->userData);
}
/**
* Sets the position of the controller is global space. This can be used for
* initial placement or for teleporting the character.
*/
void PhysxController::
set_pos(const LPoint3f &pos) {
nassertv(_error_type == ET_ok);
ptr()->setPosition(PhysxManager::point3_to_nxExtVec3(pos));
}
/**
* Retruns the position of the controller is global space.
*/
LPoint3f PhysxController::
get_pos() const {
nassertr(_error_type == ET_ok, LPoint3f::zero());
return PhysxManager::nxExtVec3_to_point3(ptr()->getPosition());
}
/**
* Sharpness is used to smooth motion with a feedback filter, having a value
* between 0 (so smooth it doesn't move) and 1 (no smoothing = unfiltered
* motion). Sharpness can ease the motion curve when the auto-step feature is
* used with boxes. Default value is 1.0.
*/
void PhysxController::
set_sharpness(float sharpness) {
nassertv(_error_type == ET_ok);
nassertv(sharpness > 0.0f);
nassertv(sharpness <= 1.0f);
_sharpness = sharpness;
}
/**
* Returns the sharpness used to ease the motion curve when the auto-step
* feature is used. Default value is 1.0.
*/
float PhysxController::
get_sharpness() const {
nassertr(_error_type == ET_ok, 0.0f);
return _sharpness;
}
/**
* Enable/Disable collisions for this controller and actor.
*/
void PhysxController::
set_collision(bool enable) {
nassertv(_error_type == ET_ok);
ptr()->setCollision(enable);
}
/**
* Sets the the minimum travelled distance to consider when moving the
* controller. If travelled distance is smaller, the character doesn't move.
* This is used to stop the recursive motion algorithm when remaining distance
* to travel is small. The default value is 0.0001.
*/
void PhysxController::
set_min_distance(float min_dist) {
nassertv(_error_type == ET_ok);
nassertv(min_dist > 0.0f);
_min_dist = min_dist;
}
/**
* Sets the step height/offset for the controller.
*/
void PhysxController::
set_step_offset(float offset) {
nassertv(_error_type == ET_ok);
nassertv(offset > 0.0f);
ptr()->setStepOffset(offset);
}
/**
* Sets the linear speed of the controller in global space.
*/
void PhysxController::
set_global_speed(const LVector3f &speed) {
nassertv(_error_type == ET_ok);
nassertv_always(!speed.is_nan());
_speed = NxVec3(speed.get_x(), speed.get_y(), speed.get_z());
}
/**
* Sets the linear speed of the controller in local coordinates.
*/
void PhysxController::
set_local_speed(const LVector3f &speed) {
nassertv(_error_type == ET_ok);
nassertv_always(!speed.is_nan());
NodePath np = get_actor()->get_node_path();
nassertv(!np.is_empty());
NxQuat q = ptr()->getActor()->getGlobalOrientationQuat();
NxVec3 s = NxVec3(speed.get_x(), speed.get_y(), speed.get_z());
_speed = (q * _up_quat_inv).rot(s);
}
/**
* Sets the angular velocity (degrees per second) of the controller. The
* angular velocity is used to compute the new heading when updating the
* controller.
*/
void PhysxController::
set_omega(float omega) {
nassertv(_error_type == ET_ok);
_omega = omega;
}
/**
* Sets the heading of the controller is global space. Note: only heading is
* supported. Pitch and roll are constrained by PhysX in order to alyways
* keep the character upright.
*/
void PhysxController::
set_h(float heading) {
nassertv(_error_type == ET_ok);
_heading = heading;
NxQuat q(_heading, _up_vector);
ptr()->getActor()->moveGlobalOrientationQuat(_up_quat * q);
}
/**
* Returns the heading of the controller in global space.
*/
float PhysxController::
get_h() const {
nassertr(_error_type == ET_ok, 0.0f);
return _heading;
}
/**
* The character controller uses caching in order to speed up collision
* testing, this caching can not detect when static objects have changed in
* the scene. You need to call this method when such changes have been made.
*/
void PhysxController::
report_scene_changed() {
nassertv(_error_type == ET_ok);
ptr()->reportSceneChanged();
}
/**
*
*/
void PhysxController::
update_controller(float dt) {
nassertv(_error_type == ET_ok);
// Speed
NxU32 mask = 0xFFFFFFFF;
NxU32 collision_flags;
NxVec3 gravity;
ptr()->getActor()->getScene().getGravity(gravity);
NxVec3 d = (_speed + gravity) * dt;
NxReal heightDelta = get_jump_height(dt, gravity);
if (heightDelta != 0.0f) {
((_up_axis == NX_Z) ? d.z : d.y) += heightDelta;
}
ptr()->move(d, mask, _min_dist, collision_flags, _sharpness);
if (collision_flags & NXCC_COLLISION_DOWN) {
stop_jump();
}
// Omega
if (_omega != 0.0f) {
NxReal delta = _omega * dt;
_heading += delta;
NxQuat q(_heading, _up_vector);
ptr()->getActor()->moveGlobalOrientationQuat(_up_quat * q);
}
// Reset speed and omega
_speed.zero();
_omega = 0.0f;
}
/**
*
*/
NxReal PhysxController::
get_jump_height(float dt, NxVec3 &gravity) {
if (_jumping == false) {
return 0.0f;
}
_jump_time += dt;
float G = (_up_axis == NX_Z) ? gravity.z : gravity.y;
float h = 2.0f * G * _jump_time * _jump_time + _jump_v0 * _jump_time;
return (h - G) * dt;
}
/**
* Enters the jump mode. The parameter is the intial upward velocity of the
* character.
*/
void PhysxController::
start_jump(float v0) {
nassertv(_error_type == ET_ok);
if (_jumping == true) {
return;
}
_jumping = true;
_jump_time = 0.0f;
_jump_v0 = v0;
}
/**
* Leaves the jump mode. This method is automatically called if a ground
* collision is detected. Usually users need not call this method.
*/
void PhysxController::
stop_jump() {
nassertv(_error_type == ET_ok);
if (_jumping == false) {
return;
}
_jumping = false;
// NxVec3 v = ptr()->getActor()->getLinearVelocity(); double velocity =
// (_up_axis == NX_Z) ? v.z : v.y;
Event *event = new Event("physx-controller-down");
event->add_parameter(EventParameter(this));
// event->add_parameter(EventParameter(velocity));
EventQueue::get_global_event_queue()->queue_event(event);
}

Some files were not shown because too many files have changed in this diff Show More