file_path
stringlengths 21
202
| content
stringlengths 19
1.02M
| size
int64 19
1.02M
| lang
stringclasses 8
values | avg_line_length
float64 5.88
100
| max_line_length
int64 12
993
| alphanum_fraction
float64 0.27
0.93
|
---|---|---|---|---|---|---|
NVIDIA-Omniverse/PhysX/physx/source/physx/src/NpPvdSceneClient.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "foundation/PxPreprocessor.h"
#if PX_SUPPORT_PVD
#include "common/PxProfileZone.h"
#include "common/PxRenderBuffer.h"
#include "PxParticleSystem.h"
#include "PxPBDParticleSystem.h"
//#include "PxFLIPParticleSystem.h"
//#include "PxMPMParticleSystem.h"
#include "PxPhysics.h"
#include "PxConstraintDesc.h"
#include "NpPvdSceneClient.h"
#include "ScBodySim.h"
#include "ScConstraintSim.h"
#include "ScConstraintCore.h"
#include "PxsMaterialManager.h"
#include "PvdTypeNames.h"
#include "PxPvdUserRenderer.h"
#include "PxvNphaseImplementationContext.h"
#include "NpConstraint.h"
#include "NpRigidStatic.h"
#include "NpRigidDynamic.h"
#include "NpArticulationLink.h"
#include "NpSoftBody.h"
//#include "NpFEMCloth.h"
#include "NpHairSystem.h"
#include "NpAggregate.h"
#include "NpScene.h"
#include "NpArticulationJointReducedCoordinate.h"
#include "NpArticulationReducedCoordinate.h"
using namespace physx;
using namespace physx::Vd;
using namespace physx::pvdsdk;
namespace
{
PX_FORCE_INLINE PxU64 getContextId(NpScene& scene) { return scene.getScScene().getContextId(); }
///////////////////////////////////////////////////////////////////////////////
// Sc-to-Np
PX_FORCE_INLINE static NpConstraint* getNpConstraint(Sc::ConstraintCore* scConstraint)
{
return reinterpret_cast<NpConstraint*>(reinterpret_cast<char*>(scConstraint) - NpConstraint::getCoreOffset());
}
///////////////////////////////////////////////////////////////////////////////
PX_FORCE_INLINE static const PxActor* getPxActor(const NpActor* scActor)
{
return scActor->getPxActor();
}
struct CreateOp
{
CreateOp& operator=(const CreateOp&);
physx::pvdsdk::PvdDataStream& mStream;
PvdMetaDataBinding& mBinding;
PsPvd* mPvd;
PxScene& mScene;
CreateOp(physx::pvdsdk::PvdDataStream& str, PvdMetaDataBinding& bind, PsPvd* pvd, PxScene& scene)
: mStream(str), mBinding(bind), mPvd(pvd), mScene(scene)
{
}
template <typename TDataType>
void operator()(const TDataType& dtype)
{
mBinding.createInstance(mStream, dtype, mScene, PxGetPhysics(), mPvd);
}
void operator()(const PxArticulationLink&)
{
}
};
struct UpdateOp
{
UpdateOp& operator=(const UpdateOp&);
physx::pvdsdk::PvdDataStream& mStream;
PvdMetaDataBinding& mBinding;
UpdateOp(physx::pvdsdk::PvdDataStream& str, PvdMetaDataBinding& bind) : mStream(str), mBinding(bind)
{
}
template <typename TDataType>
void operator()(const TDataType& dtype)
{
mBinding.sendAllProperties(mStream, dtype);
}
};
struct DestroyOp
{
DestroyOp& operator=(const DestroyOp&);
physx::pvdsdk::PvdDataStream& mStream;
PvdMetaDataBinding& mBinding;
PxScene& mScene;
DestroyOp(physx::pvdsdk::PvdDataStream& str, PvdMetaDataBinding& bind, PxScene& scene)
: mStream(str), mBinding(bind), mScene(scene)
{
}
template <typename TDataType>
void operator()(const TDataType& dtype)
{
mBinding.destroyInstance(mStream, dtype, mScene);
}
void operator()(const PxArticulationLink& dtype)
{
mBinding.destroyInstance(mStream, dtype);
}
};
template <typename TOperator>
inline void BodyTypeOperation(const NpActor* scBody, TOperator op)
{
// const bool isArticulationLink = scBody->getActorType_() == PxActorType::eARTICULATION_LINK;
const bool isArticulationLink = scBody->getNpType() == NpType::eBODY_FROM_ARTICULATION_LINK;
if(isArticulationLink)
{
const NpArticulationLink* link = static_cast<const NpArticulationLink*>(scBody);
op(*static_cast<const PxArticulationLink*>(link));
}
else
{
const NpRigidDynamic* npRigidDynamic = static_cast<const NpRigidDynamic*>(scBody);
op(*static_cast<const PxRigidDynamic*>(npRigidDynamic));
}
}
template <typename TOperator>
inline void ActorTypeOperation(const PxActor* actor, TOperator op)
{
switch(actor->getType())
{
case PxActorType::eRIGID_STATIC:
op(*static_cast<const PxRigidStatic*>(actor));
break;
case PxActorType::eRIGID_DYNAMIC:
op(*static_cast<const PxRigidDynamic*>(actor));
break;
case PxActorType::eARTICULATION_LINK:
op(*static_cast<const PxArticulationLink*>(actor));
break;
case PxActorType::eSOFTBODY:
#if PX_SUPPORT_GPU_PHYSX
op(*static_cast<const PxSoftBody*>(actor));
#endif
break;
case PxActorType::eFEMCLOTH:
//op(*static_cast<const PxFEMCloth*>(actor));
break;
case PxActorType::ePBD_PARTICLESYSTEM:
op(*static_cast<const PxPBDParticleSystem*>(actor));
break;
case PxActorType::eFLIP_PARTICLESYSTEM:
//op(*static_cast<const PxFLIPParticleSystem*>(actor));
break;
case PxActorType::eMPM_PARTICLESYSTEM:
//op(*static_cast<const PxMPMParticleSystem*>(actor));
break;
case PxActorType::eHAIRSYSTEM:
//op(*static_cast<const PxHairSystem*>(actor));
break;
case PxActorType::eACTOR_COUNT:
case PxActorType::eACTOR_FORCE_DWORD:
PX_ASSERT(false);
break;
};
}
namespace
{
struct PvdConstraintVisualizer : public PxConstraintVisualizer
{
PX_NOCOPY(PvdConstraintVisualizer)
public:
physx::pvdsdk::PvdUserRenderer& mRenderer;
PvdConstraintVisualizer(const void* id, physx::pvdsdk::PvdUserRenderer& r) : mRenderer(r)
{
mRenderer.setInstanceId(id);
}
virtual void visualizeJointFrames(const PxTransform& parent, const PxTransform& child) PX_OVERRIDE
{
mRenderer.visualizeJointFrames(parent, child);
}
virtual void visualizeLinearLimit(const PxTransform& t0, const PxTransform& t1, PxReal value) PX_OVERRIDE
{
mRenderer.visualizeLinearLimit(t0, t1, PxF32(value));
}
virtual void visualizeAngularLimit(const PxTransform& t0, PxReal lower, PxReal upper) PX_OVERRIDE
{
mRenderer.visualizeAngularLimit(t0, PxF32(lower), PxF32(upper));
}
virtual void visualizeLimitCone(const PxTransform& t, PxReal tanQSwingY, PxReal tanQSwingZ) PX_OVERRIDE
{
mRenderer.visualizeLimitCone(t, PxF32(tanQSwingY), PxF32(tanQSwingZ));
}
virtual void visualizeDoubleCone(const PxTransform& t, PxReal angle) PX_OVERRIDE
{
mRenderer.visualizeDoubleCone(t, PxF32(angle));
}
virtual void visualizeLine( const PxVec3& p0, const PxVec3& p1, PxU32 color) PX_OVERRIDE
{
const PxDebugLine line(p0, p1, color);
mRenderer.drawLines(&line, 1);
}
};
}
class SceneRendererClient : public RendererEventClient, public physx::PxUserAllocated
{
PX_NOCOPY(SceneRendererClient)
public:
SceneRendererClient(PvdUserRenderer* renderer, PxPvd* pvd):mRenderer(renderer)
{
mStream = PvdDataStream::create(pvd);
mStream->createInstance(renderer);
}
~SceneRendererClient()
{
mStream->destroyInstance(mRenderer);
mStream->release();
}
virtual void handleBufferFlush(const uint8_t* inData, uint32_t inLength)
{
mStream->setPropertyValue(mRenderer, "events", inData, inLength);
}
private:
PvdUserRenderer* mRenderer;
PvdDataStream* mStream;
};
} // namespace
PvdSceneClient::PvdSceneClient(NpScene& scene) :
mPvd (NULL),
mScene (scene),
mPvdDataStream (NULL),
mUserRender (NULL),
mRenderClient (NULL),
mIsConnected (false)
{
}
PvdSceneClient::~PvdSceneClient()
{
if(mPvd)
mPvd->removeClient(this);
}
void PvdSceneClient::updateCamera(const char* name, const PxVec3& origin, const PxVec3& up, const PxVec3& target)
{
if(mIsConnected)
mPvdDataStream->updateCamera(name, origin, up, target);
}
void PvdSceneClient::drawPoints(const PxDebugPoint* points, PxU32 count)
{
if(mUserRender)
mUserRender->drawPoints(points, count);
}
void PvdSceneClient::drawLines(const PxDebugLine* lines, PxU32 count)
{
if(mUserRender)
mUserRender->drawLines(lines, count);
}
void PvdSceneClient::drawTriangles(const PxDebugTriangle* triangles, PxU32 count)
{
if(mUserRender)
mUserRender->drawTriangles(triangles, count);
}
void PvdSceneClient::drawText(const PxDebugText& text)
{
if(mUserRender)
mUserRender->drawText(text);
}
void PvdSceneClient::setScenePvdFlag(PxPvdSceneFlag::Enum flag, bool value)
{
if(value)
mFlags |= flag;
else
mFlags &= ~flag;
}
void PvdSceneClient::onPvdConnected()
{
if(mIsConnected || !mPvd)
return;
mIsConnected = true;
mPvdDataStream = PvdDataStream::create(mPvd);
mUserRender = PvdUserRenderer::create();
mRenderClient = PX_NEW(SceneRendererClient)(mUserRender, mPvd);
mUserRender->setClient(mRenderClient);
sendEntireScene();
}
void PvdSceneClient::onPvdDisconnected()
{
if(!mIsConnected)
return;
mIsConnected = false;
PX_DELETE(mRenderClient);
mUserRender->release();
mUserRender = NULL;
mPvdDataStream->release();
mPvdDataStream = NULL;
}
void PvdSceneClient::updatePvdProperties()
{
mMetaDataBinding.sendAllProperties(*mPvdDataStream, mScene);
}
void PvdSceneClient::releasePvdInstance()
{
if(mPvdDataStream)
{
PxScene* theScene = &mScene;
// remove from parent
mPvdDataStream->removeObjectRef(&PxGetPhysics(), "Scenes", theScene);
mPvdDataStream->destroyInstance(theScene);
}
}
// PT: this is only called once, from "onPvdConnected"
void PvdSceneClient::sendEntireScene()
{
NpScene* npScene = &mScene;
if(npScene->getFlagsFast() & PxSceneFlag::eREQUIRE_RW_LOCK) // getFlagsFast() will trigger a warning of lock check
npScene->lockRead(PX_FL);
PxPhysics& physics = PxGetPhysics();
{
PxScene* theScene = &mScene;
mPvdDataStream->createInstance(theScene);
updatePvdProperties();
// Create parent/child relationship.
mPvdDataStream->setPropertyValue(theScene, "Physics", reinterpret_cast<const void*>(&physics));
mPvdDataStream->pushBackObjectRef(&physics, "Scenes", theScene);
}
// materials:
{
PxsMaterialManager& manager = mScene.getScScene().getMaterialManager();
PxsMaterialManagerIterator<PxsMaterialCore> iter(manager);
PxsMaterialCore* mat;
while(iter.getNextMaterial(mat))
{
const PxMaterial* theMaterial = mat->mMaterial;
if(mPvd->registerObject(theMaterial))
mMetaDataBinding.createInstance(*mPvdDataStream, *theMaterial, physics);
};
}
if(mPvd->getInstrumentationFlags() & PxPvdInstrumentationFlag::eDEBUG)
{
PxArray<PxActor*> actorArray;
// RBs
// static:
{
PxU32 numActors = npScene->getNbActors(PxActorTypeFlag::eRIGID_STATIC | PxActorTypeFlag::eRIGID_DYNAMIC);
actorArray.resize(numActors);
npScene->getActors(PxActorTypeFlag::eRIGID_STATIC | PxActorTypeFlag::eRIGID_DYNAMIC, actorArray.begin(), actorArray.size());
for(PxU32 i = 0; i < numActors; i++)
{
PxActor* pxActor = actorArray[i];
if(pxActor->getConcreteType()==PxConcreteType::eRIGID_STATIC)
mMetaDataBinding.createInstance(*mPvdDataStream, *static_cast<PxRigidStatic*>(pxActor), *npScene, physics, mPvd);
else
mMetaDataBinding.createInstance(*mPvdDataStream, *static_cast<PxRigidDynamic*>(pxActor), *npScene, physics, mPvd);
}
}
// articulations & links
{
PxArray<PxArticulationReducedCoordinate*> articulations;
PxU32 numArticulations = npScene->getNbArticulations();
articulations.resize(numArticulations);
npScene->getArticulations(articulations.begin(), articulations.size());
for(PxU32 i = 0; i < numArticulations; i++)
mMetaDataBinding.createInstance(*mPvdDataStream, *articulations[i], *npScene, physics, mPvd);
}
// joints
{
Sc::ConstraintCore*const * constraints = mScene.getScScene().getConstraints();
PxU32 nbConstraints = mScene.getScScene().getNbConstraints();
for(PxU32 i = 0; i < nbConstraints; i++)
{
updateConstraint(*constraints[i], PxPvdUpdateType::CREATE_INSTANCE);
updateConstraint(*constraints[i], PxPvdUpdateType::UPDATE_ALL_PROPERTIES);
}
}
}
if(npScene->getFlagsFast() & PxSceneFlag::eREQUIRE_RW_LOCK)
npScene->unlockRead();
}
void PvdSceneClient::updateConstraint(const Sc::ConstraintCore& scConstraint, PxU32 updateType)
{
PxConstraintConnector* conn = scConstraint.getPxConnector();
if(conn && checkPvdDebugFlag())
conn->updatePvdProperties(*mPvdDataStream, scConstraint.getPxConstraint(), PxPvdUpdateType::Enum(updateType));
}
void PvdSceneClient::createPvdInstance(const PxActor* actor)
{
if(checkPvdDebugFlag())
ActorTypeOperation(actor, CreateOp(*mPvdDataStream, mMetaDataBinding, mPvd, mScene));
}
void PvdSceneClient::updatePvdProperties(const PxActor* actor)
{
if(checkPvdDebugFlag())
ActorTypeOperation(actor, UpdateOp(*mPvdDataStream, mMetaDataBinding));
}
void PvdSceneClient::releasePvdInstance(const PxActor* actor)
{
if(checkPvdDebugFlag())
ActorTypeOperation(actor, DestroyOp(*mPvdDataStream, mMetaDataBinding, mScene));
}
///////////////////////////////////////////////////////////////////////////////
void PvdSceneClient::createPvdInstance(const NpActor* actor)
{
// PT: why not UPDATE_PVD_PROPERTIES_CHECK() here?
createPvdInstance(getPxActor(actor));
}
void PvdSceneClient::updatePvdProperties(const NpActor* actor)
{
// PT: why not UPDATE_PVD_PROPERTIES_CHECK() here?
updatePvdProperties(getPxActor(actor));
}
void PvdSceneClient::releasePvdInstance(const NpActor* actor)
{
// PT: why not UPDATE_PVD_PROPERTIES_CHECK() here?
releasePvdInstance(getPxActor(actor));
}
///////////////////////////////////////////////////////////////////////////////
void PvdSceneClient::createPvdInstance(const NpRigidDynamic* body)
{
if(checkPvdDebugFlag() && body->getNpType() != NpType::eBODY_FROM_ARTICULATION_LINK)
BodyTypeOperation(body, CreateOp(*mPvdDataStream, mMetaDataBinding, mPvd, mScene));
}
void PvdSceneClient::createPvdInstance(const NpArticulationLink* body)
{
if(checkPvdDebugFlag() && body->getNpType() != NpType::eBODY_FROM_ARTICULATION_LINK)
BodyTypeOperation(body, CreateOp(*mPvdDataStream, mMetaDataBinding, mPvd, mScene));
}
void PvdSceneClient::releasePvdInstance(const NpRigidDynamic* body)
{
releasePvdInstance(getPxActor(body));
}
void PvdSceneClient::releasePvdInstance(const NpArticulationLink* body)
{
releasePvdInstance(getPxActor(body));
}
void PvdSceneClient::updateBodyPvdProperties(const NpActor* body)
{
if(checkPvdDebugFlag())
{
if(body->getNpType() == NpType::eBODY_FROM_ARTICULATION_LINK)
updatePvdProperties(static_cast<const NpArticulationLink*>(body));
else if(body->getNpType() == NpType::eBODY)
updatePvdProperties(static_cast<const NpRigidDynamic*>(body));
else PX_ASSERT(0);
}
}
void PvdSceneClient::updatePvdProperties(const NpRigidDynamic* body)
{
if(checkPvdDebugFlag())
BodyTypeOperation(body, UpdateOp(*mPvdDataStream, mMetaDataBinding));
}
void PvdSceneClient::updatePvdProperties(const NpArticulationLink* body)
{
if(checkPvdDebugFlag())
BodyTypeOperation(body, UpdateOp(*mPvdDataStream, mMetaDataBinding));
}
void PvdSceneClient::updateKinematicTarget(const NpActor* body, const PxTransform& p)
{
if(checkPvdDebugFlag())
{
if(body->getNpType() == NpType::eBODY_FROM_ARTICULATION_LINK)
mPvdDataStream->setPropertyValue(static_cast<const NpArticulationLink*>(body), "KinematicTarget", p);
else if(body->getNpType() == NpType::eBODY)
mPvdDataStream->setPropertyValue(static_cast<const NpRigidDynamic*>(body), "KinematicTarget", p);
else PX_ASSERT(0);
}
}
///////////////////////////////////////////////////////////////////////////////
void PvdSceneClient::releasePvdInstance(const NpRigidStatic* rigidStatic)
{
releasePvdInstance(static_cast<const NpActor*>(rigidStatic));
}
void PvdSceneClient::createPvdInstance(const NpRigidStatic* rigidStatic)
{
if(checkPvdDebugFlag())
mMetaDataBinding.createInstance(*mPvdDataStream, *rigidStatic, mScene, PxGetPhysics(), mPvd);
}
void PvdSceneClient::updatePvdProperties(const NpRigidStatic* rigidStatic)
{
if(checkPvdDebugFlag())
mMetaDataBinding.sendAllProperties(*mPvdDataStream, *rigidStatic);
}
///////////////////////////////////////////////////////////////////////////////
void PvdSceneClient::createPvdInstance(const NpConstraint* constraint)
{
if(checkPvdDebugFlag())
updateConstraint(constraint->getCore(), PxPvdUpdateType::CREATE_INSTANCE);
}
void PvdSceneClient::updatePvdProperties(const NpConstraint* constraint)
{
if(checkPvdDebugFlag())
updateConstraint(constraint->getCore(), PxPvdUpdateType::UPDATE_ALL_PROPERTIES);
}
void PvdSceneClient::releasePvdInstance(const NpConstraint* constraint)
{
const Sc::ConstraintCore& scConstraint = constraint->getCore();
PxConstraintConnector* conn;
if(checkPvdDebugFlag() && (conn = scConstraint.getPxConnector()) != NULL)
conn->updatePvdProperties(*mPvdDataStream, scConstraint.getPxConstraint(), PxPvdUpdateType::RELEASE_INSTANCE);
}
///////////////////////////////////////////////////////////////////////////////
void PvdSceneClient::createPvdInstance(const NpArticulationReducedCoordinate* articulation)
{
if (checkPvdDebugFlag())
{
mMetaDataBinding.createInstance(*mPvdDataStream, *articulation, mScene, PxGetPhysics(), mPvd);
}
}
void PvdSceneClient::updatePvdProperties(const NpArticulationReducedCoordinate* articulation)
{
if(checkPvdDebugFlag())
{
mMetaDataBinding.sendAllProperties(*mPvdDataStream, *articulation);
}
}
void PvdSceneClient::releasePvdInstance(const NpArticulationReducedCoordinate* articulation)
{
if (checkPvdDebugFlag())
{
mMetaDataBinding.destroyInstance(*mPvdDataStream, *articulation, mScene);
}
}
///////////////////////////////////////////////////////////////////////////////
void PvdSceneClient::createPvdInstance(const NpArticulationJointReducedCoordinate* articulationJoint)
{
PX_UNUSED(articulationJoint);
}
void PvdSceneClient::updatePvdProperties(const NpArticulationJointReducedCoordinate* articulationJoint)
{
if (checkPvdDebugFlag())
{
mMetaDataBinding.sendAllProperties(*mPvdDataStream, *articulationJoint);
}
}
void PvdSceneClient::releasePvdInstance(const NpArticulationJointReducedCoordinate* articulationJoint)
{
PX_UNUSED(articulationJoint);
}
/////////////////////////////////////////////////////////////////////////////////
void PvdSceneClient::createPvdInstance(const NpArticulationSpatialTendon* articulationTendon)
{
PX_UNUSED(articulationTendon);
}
void PvdSceneClient::updatePvdProperties(const NpArticulationSpatialTendon* articulationTendon)
{
PX_UNUSED(articulationTendon);
}
void PvdSceneClient::releasePvdInstance(const NpArticulationSpatialTendon* articulationTendon)
{
PX_UNUSED(articulationTendon);
}
/////////////////////////////////////////////////////////////////////////////////
void PvdSceneClient::createPvdInstance(const NpArticulationFixedTendon* articulationTendon)
{
PX_UNUSED(articulationTendon);
}
void PvdSceneClient::updatePvdProperties(const NpArticulationFixedTendon* articulationTendon)
{
PX_UNUSED(articulationTendon);
}
void PvdSceneClient::releasePvdInstance(const NpArticulationFixedTendon* articulationTendon)
{
PX_UNUSED(articulationTendon);
}
/////////////////////////////////////////////////////////////////////////////////
void PvdSceneClient::createPvdInstance(const NpArticulationSensor* sensor)
{
PX_UNUSED(sensor);
}
void PvdSceneClient::updatePvdProperties(const NpArticulationSensor* sensor)
{
PX_UNUSED(sensor);
}
void PvdSceneClient::releasePvdInstance(const NpArticulationSensor* sensor)
{
PX_UNUSED(sensor);
}
///////////////////////////////////////////////////////////////////////////////
void PvdSceneClient::createPvdInstance(const PxsMaterialCore* materialCore)
{
if(checkPvdDebugFlag())
{
const PxMaterial* theMaterial = materialCore->mMaterial;
if(mPvd->registerObject(theMaterial))
mMetaDataBinding.createInstance(*mPvdDataStream, *theMaterial, PxGetPhysics());
}
}
void PvdSceneClient::updatePvdProperties(const PxsMaterialCore* materialCore)
{
if(checkPvdDebugFlag())
mMetaDataBinding.sendAllProperties(*mPvdDataStream, *materialCore->mMaterial);
}
void PvdSceneClient::releasePvdInstance(const PxsMaterialCore* materialCore)
{
if(checkPvdDebugFlag() && mPvd->unRegisterObject(materialCore->mMaterial))
mMetaDataBinding.destroyInstance(*mPvdDataStream, *materialCore->mMaterial, PxGetPhysics());
}
///////////////////////////////////////////////////////////////////////////////
void PvdSceneClient::createPvdInstance(const PxsFEMSoftBodyMaterialCore* materialCore)
{
if (checkPvdDebugFlag())
{
const PxFEMSoftBodyMaterial* theMaterial = materialCore->mMaterial;
if (mPvd->registerObject(theMaterial))
mMetaDataBinding.createInstance(*mPvdDataStream, *theMaterial, PxGetPhysics());
}
}
void PvdSceneClient::updatePvdProperties(const PxsFEMSoftBodyMaterialCore* materialCore)
{
if (checkPvdDebugFlag())
mMetaDataBinding.sendAllProperties(*mPvdDataStream, *materialCore->mMaterial);
}
void PvdSceneClient::releasePvdInstance(const PxsFEMSoftBodyMaterialCore* materialCore)
{
if (checkPvdDebugFlag() && mPvd->unRegisterObject(materialCore->mMaterial))
mMetaDataBinding.destroyInstance(*mPvdDataStream, *materialCore->mMaterial, PxGetPhysics());
}
///////////////////////////////////////////////////////////////////////////////
void PvdSceneClient::createPvdInstance(const PxsFEMClothMaterialCore*)
{
// no PVD support but method is "needed" since macro code is shared among all material types
}
void PvdSceneClient::updatePvdProperties(const PxsFEMClothMaterialCore*)
{
// no PVD support but method is "needed" since macro code is shared among all material types
}
void PvdSceneClient::releasePvdInstance(const PxsFEMClothMaterialCore*)
{
// no PVD support but method is "needed" since macro code is shared among all material types
}
///////////////////////////////////////////////////////////////////////////////
void PvdSceneClient::createPvdInstance(const PxsPBDMaterialCore* /*materialCore*/)
{
// PX_ASSERT(0);
}
void PvdSceneClient::updatePvdProperties(const PxsPBDMaterialCore* /*materialCore*/)
{
// PX_ASSERT(0);
}
void PvdSceneClient::releasePvdInstance(const PxsPBDMaterialCore* /*materialCore*/)
{
// PX_ASSERT(0);
}
void PvdSceneClient::createPvdInstance(const PxsFLIPMaterialCore* /*materialCore*/)
{
// PX_ASSERT(0);
}
void PvdSceneClient::updatePvdProperties(const PxsFLIPMaterialCore* /*materialCore*/)
{
// PX_ASSERT(0);
}
void PvdSceneClient::releasePvdInstance(const PxsFLIPMaterialCore* /*materialCore*/)
{
// PX_ASSERT(0);
}
void PvdSceneClient::createPvdInstance(const PxsMPMMaterialCore* /*materialCore*/)
{
// PX_ASSERT(0);
}
void PvdSceneClient::updatePvdProperties(const PxsMPMMaterialCore* /*materialCore*/)
{
// PX_ASSERT(0);
}
void PvdSceneClient::releasePvdInstance(const PxsMPMMaterialCore* /*materialCore*/)
{
// PX_ASSERT(0);
}
///////////////////////////////////////////////////////////////////////////////
void PvdSceneClient::createPvdInstance(const NpShape* npShape, PxActor& owner)
{
if(checkPvdDebugFlag())
{
PX_PROFILE_ZONE("PVD.createPVDInstance", getContextId(mScene));
mMetaDataBinding.createInstance(*mPvdDataStream, *npShape, static_cast<PxRigidActor&>(owner), PxGetPhysics(), mPvd);
}
}
static void addShapesToPvd(PxU32 nbShapes, NpShape* const* shapes, PxActor& pxActor, PsPvd* pvd, PvdDataStream& stream, PvdMetaDataBinding& binding)
{
PxPhysics& physics = PxGetPhysics();
for(PxU32 i=0;i<nbShapes;i++)
{
const NpShape* npShape = shapes[i];
binding.createInstance(stream, *npShape, static_cast<PxRigidActor&>(pxActor), physics, pvd);
}
}
void PvdSceneClient::addBodyAndShapesToPvd(NpRigidDynamic& b)
{
if(checkPvdDebugFlag())
{
PX_PROFILE_ZONE("PVD.createPVDInstance", getContextId(mScene));
createPvdInstance(&b);
PxActor& pxActor = *b.getCore().getPxActor();
NpShape* const* shapes;
const PxU32 nbShapes = NpRigidDynamicGetShapes(b, shapes);
addShapesToPvd(nbShapes, shapes, pxActor, mPvd, *mPvdDataStream, mMetaDataBinding);
}
}
void PvdSceneClient::addStaticAndShapesToPvd(NpRigidStatic& s)
{
if(checkPvdDebugFlag())
{
PX_PROFILE_ZONE("PVD.createPVDInstance", getContextId(mScene));
createPvdInstance(&s);
PxActor& pxActor = static_cast<PxRigidStatic&>(s);
NpShape* const* shapes;
const PxU32 nbShapes = NpRigidStaticGetShapes(s, shapes);
addShapesToPvd(nbShapes, shapes, pxActor, mPvd, *mPvdDataStream, mMetaDataBinding);
}
}
void PvdSceneClient::updateMaterials(const NpShape* npShape)
{
if(checkPvdDebugFlag())
mMetaDataBinding.updateMaterials(*mPvdDataStream, *npShape, mPvd);
}
void PvdSceneClient::updatePvdProperties(const NpShape* npShape)
{
if(checkPvdDebugFlag())
mMetaDataBinding.sendAllProperties(*mPvdDataStream, *npShape);
}
void PvdSceneClient::releaseAndRecreateGeometry(const NpShape* npShape)
{
if(checkPvdDebugFlag())
mMetaDataBinding.releaseAndRecreateGeometry(*mPvdDataStream, *npShape, NpPhysics::getInstance(), mPvd);
}
void PvdSceneClient::releasePvdInstance(const NpShape* npShape, PxActor& owner)
{
if(checkPvdDebugFlag())
{
PX_PROFILE_ZONE("PVD.releasePVDInstance", getContextId(mScene));
mMetaDataBinding.destroyInstance(*mPvdDataStream, *npShape, static_cast<PxRigidActor&>(owner));
const PxU32 numMaterials = npShape->getNbMaterials();
PX_ALLOCA(materialPtr, PxMaterial*, numMaterials);
npShape->getMaterials(materialPtr, numMaterials);
for(PxU32 idx = 0; idx < numMaterials; ++idx)
releasePvdInstance(&(static_cast<NpMaterial*>(materialPtr[idx])->mMaterial));
}
}
///////////////////////////////////////////////////////////////////////////////
void PvdSceneClient::originShift(PxVec3 shift)
{
mMetaDataBinding.originShift(*mPvdDataStream, &mScene, shift);
}
void PvdSceneClient::frameStart(PxReal simulateElapsedTime)
{
PX_PROFILE_ZONE("Basic.pvdFrameStart", mScene.getScScene().getContextId());
if(!mIsConnected)
return;
mPvdDataStream->flushPvdCommand();
mMetaDataBinding.sendBeginFrame(*mPvdDataStream, &mScene, simulateElapsedTime);
}
void PvdSceneClient::frameEnd()
{
PX_PROFILE_ZONE("Basic.pvdFrameEnd", mScene.getScScene().getContextId());
if(!mIsConnected)
{
if(mPvd)
mPvd->flush(); // Even if we aren't connected, we may need to flush buffered events.
return;
}
PxScene* theScene = &mScene;
mMetaDataBinding.sendStats(*mPvdDataStream, theScene);
// flush our data to the main connection
mPvd->flush();
// End the frame *before* we send the dynamic object current data.
// This ensures that contacts end up synced with the rest of the system.
// Note that contacts were sent much earler in NpScene::fetchResults.
mMetaDataBinding.sendEndFrame(*mPvdDataStream, &mScene);
if(mPvd->getInstrumentationFlags() & PxPvdInstrumentationFlag::eDEBUG)
{
PX_PROFILE_ZONE("PVD.sceneUpdate", getContextId(mScene));
PvdVisualizer* vizualizer = NULL;
const bool visualizeJoints = getScenePvdFlagsFast() & PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS;
if(visualizeJoints)
vizualizer = this;
mMetaDataBinding.updateDynamicActorsAndArticulations(*mPvdDataStream, theScene, vizualizer);
}
// frame end moved to update contacts to have them in the previous frame.
}
///////////////////////////////////////////////////////////////////////////////
void PvdSceneClient::createPvdInstance(const NpAggregate* npAggregate)
{
if(checkPvdDebugFlag())
{
PX_PROFILE_ZONE("PVD.createPVDInstance", getContextId(mScene));
mMetaDataBinding.createInstance(*mPvdDataStream, *npAggregate, mScene);
}
}
void PvdSceneClient::updatePvdProperties(const NpAggregate* npAggregate)
{
if(checkPvdDebugFlag())
mMetaDataBinding.sendAllProperties(*mPvdDataStream, *npAggregate);
}
void PvdSceneClient::attachAggregateActor(const NpAggregate* npAggregate, NpActor* actor)
{
if(checkPvdDebugFlag())
mMetaDataBinding.attachAggregateActor(*mPvdDataStream, *npAggregate, *getPxActor(actor));
}
void PvdSceneClient::detachAggregateActor(const NpAggregate* npAggregate, NpActor* actor)
{
if(checkPvdDebugFlag())
mMetaDataBinding.detachAggregateActor(*mPvdDataStream, *npAggregate, *getPxActor(actor));
}
void PvdSceneClient::releasePvdInstance(const NpAggregate* npAggregate)
{
if(checkPvdDebugFlag())
{
PX_PROFILE_ZONE("PVD.releasePVDInstance", getContextId(mScene));
mMetaDataBinding.destroyInstance(*mPvdDataStream, *npAggregate, mScene);
}
}
///////////////////////////////////////////////////////////////////////////////
#if PX_SUPPORT_GPU_PHYSX
void PvdSceneClient::createPvdInstance(const NpSoftBody* softBody)
{
PX_UNUSED(softBody);
//Todo
}
void PvdSceneClient::updatePvdProperties(const NpSoftBody* softBody)
{
PX_UNUSED(softBody);
//Todo
}
void PvdSceneClient::attachAggregateActor(const NpSoftBody* softBody, NpActor* actor)
{
PX_UNUSED(softBody);
PX_UNUSED(actor);
//Todo
}
void PvdSceneClient::detachAggregateActor(const NpSoftBody* softBody, NpActor* actor)
{
PX_UNUSED(softBody);
PX_UNUSED(actor);
//Todo
}
void PvdSceneClient::releasePvdInstance(const NpSoftBody* softBody)
{
PX_UNUSED(softBody);
//Todo
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void PvdSceneClient::createPvdInstance(const NpFEMCloth* femCloth)
{
PX_UNUSED(femCloth);
//Todo
}
void PvdSceneClient::updatePvdProperties(const NpFEMCloth* femCloth)
{
PX_UNUSED(femCloth);
//Todo
}
void PvdSceneClient::attachAggregateActor(const NpFEMCloth* femCloth, NpActor* actor)
{
PX_UNUSED(femCloth);
PX_UNUSED(actor);
//Todo
}
void PvdSceneClient::detachAggregateActor(const NpFEMCloth* femCloth, NpActor* actor)
{
PX_UNUSED(femCloth);
PX_UNUSED(actor);
//Todo
}
void PvdSceneClient::releasePvdInstance(const NpFEMCloth* femCloth)
{
PX_UNUSED(femCloth);
//Todo
}
///////////////////////////////////////////////////////////////////////////////
void PvdSceneClient::createPvdInstance(const NpPBDParticleSystem* particleSystem)
{
PX_UNUSED(particleSystem);
//Todo
}
void PvdSceneClient::updatePvdProperties(const NpPBDParticleSystem* particleSystem)
{
PX_UNUSED(particleSystem);
//Todo
}
void PvdSceneClient::attachAggregateActor(const NpPBDParticleSystem* particleSystem, NpActor* actor)
{
PX_UNUSED(particleSystem);
PX_UNUSED(actor);
//Todo
}
void PvdSceneClient::detachAggregateActor(const NpPBDParticleSystem* particleSystem, NpActor* actor)
{
PX_UNUSED(particleSystem);
PX_UNUSED(actor);
//Todo
}
void PvdSceneClient::releasePvdInstance(const NpPBDParticleSystem* particleSystem)
{
PX_UNUSED(particleSystem);
//Todo
}
///////////////////////////////////////////////////////////////////////////////
void PvdSceneClient::createPvdInstance(const NpFLIPParticleSystem* particleSystem)
{
PX_UNUSED(particleSystem);
//Todo
}
void PvdSceneClient::updatePvdProperties(const NpFLIPParticleSystem* particleSystem)
{
PX_UNUSED(particleSystem);
//Todo
}
void PvdSceneClient::attachAggregateActor(const NpFLIPParticleSystem* particleSystem, NpActor* actor)
{
PX_UNUSED(particleSystem);
PX_UNUSED(actor);
//Todo
}
void PvdSceneClient::detachAggregateActor(const NpFLIPParticleSystem* particleSystem, NpActor* actor)
{
PX_UNUSED(particleSystem);
PX_UNUSED(actor);
//Todo
}
void PvdSceneClient::releasePvdInstance(const NpFLIPParticleSystem* particleSystem)
{
PX_UNUSED(particleSystem);
//Todo
}
///////////////////////////////////////////////////////////////////////////////
void PvdSceneClient::createPvdInstance(const NpMPMParticleSystem* particleSystem)
{
PX_UNUSED(particleSystem);
//Todo
}
void PvdSceneClient::updatePvdProperties(const NpMPMParticleSystem* particleSystem)
{
PX_UNUSED(particleSystem);
//Todo
}
void PvdSceneClient::attachAggregateActor(const NpMPMParticleSystem* particleSystem, NpActor* actor)
{
PX_UNUSED(particleSystem);
PX_UNUSED(actor);
//Todo
}
void PvdSceneClient::detachAggregateActor(const NpMPMParticleSystem* particleSystem, NpActor* actor)
{
PX_UNUSED(particleSystem);
PX_UNUSED(actor);
//Todo
}
void PvdSceneClient::releasePvdInstance(const NpMPMParticleSystem* particleSystem)
{
PX_UNUSED(particleSystem);
//Todo
}
///////////////////////////////////////////////////////////////////////////////
void PvdSceneClient::createPvdInstance(const NpHairSystem* hairSystem)
{
PX_UNUSED(hairSystem);
//Todo
}
void PvdSceneClient::updatePvdProperties(const NpHairSystem* hairSystem)
{
PX_UNUSED(hairSystem);
//Todo
}
void PvdSceneClient::attachAggregateActor(const NpHairSystem* hairSystem, NpActor* actor)
{
PX_UNUSED(hairSystem);
PX_UNUSED(actor);
//Todo
}
void PvdSceneClient::detachAggregateActor(const NpHairSystem* hairSystem, NpActor* actor)
{
PX_UNUSED(hairSystem);
PX_UNUSED(actor);
//Todo
}
void PvdSceneClient::releasePvdInstance(const NpHairSystem* hairSystem)
{
PX_UNUSED(hairSystem);
//Todo
}
#endif
///////////////////////////////////////////////////////////////////////////////
void PvdSceneClient::updateJoints()
{
if(checkPvdDebugFlag())
{
PX_PROFILE_ZONE("PVD.updateJoints", getContextId(mScene));
const bool visualizeJoints = getScenePvdFlagsFast() & PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS;
Sc::ConstraintCore*const * constraints = mScene.getScScene().getConstraints();
const PxU32 nbConstraints = mScene.getScScene().getNbConstraints();
PxI64 constraintCount = 0;
for(PxU32 i=0; i<nbConstraints; i++)
{
Sc::ConstraintCore* constraint = constraints[i];
PxPvdUpdateType::Enum updateType = getNpConstraint(constraint)->isDirty()
? PxPvdUpdateType::UPDATE_ALL_PROPERTIES
: PxPvdUpdateType::UPDATE_SIM_PROPERTIES;
updateConstraint(*constraint, updateType);
PxConstraintConnector* conn = constraint->getPxConnector();
// visualization is updated here
{
PxU32 typeId = 0;
void* joint = NULL;
if(conn)
joint = conn->getExternalReference(typeId);
// visualize:
Sc::ConstraintSim* sim = constraint->getSim();
if(visualizeJoints && sim && sim->getConstantsLL() && joint && constraint->getVisualize())
{
Sc::BodySim* b0 = sim->getBody(0);
Sc::BodySim* b1 = sim->getBody(1);
PxTransform t0 = b0 ? b0->getBody2World() : PxTransform(PxIdentity);
PxTransform t1 = b1 ? b1->getBody2World() : PxTransform(PxIdentity);
PvdConstraintVisualizer viz(joint, *mUserRender);
(*constraint->getVisualize())(viz, sim->getConstantsLL(), t0, t1, 0xffffFFFF);
}
}
++constraintCount;
}
mUserRender->flushRenderEvents();
}
}
void PvdSceneClient::updateContacts()
{
if(!checkPvdDebugFlag())
return;
PX_PROFILE_ZONE("PVD.updateContacts", getContextId(mScene));
// if contacts are disabled, send empty array and return
const PxScene* theScene = &mScene;
if(!(getScenePvdFlagsFast() & PxPvdSceneFlag::eTRANSMIT_CONTACTS))
{
mMetaDataBinding.sendContacts(*mPvdDataStream, *theScene);
return;
}
PxsContactManagerOutputIterator outputIter;
Sc::ContactIterator contactIter;
mScene.getScScene().initContactsIterator(contactIter, outputIter);
Sc::ContactIterator::Pair* pair;
Sc::Contact* contact;
PxArray<Sc::Contact> contacts;
while ((pair = contactIter.getNextPair()) != NULL)
{
while ((contact = pair->getNextContact()) != NULL)
contacts.pushBack(*contact);
}
mMetaDataBinding.sendContacts(*mPvdDataStream, *theScene, contacts);
}
void PvdSceneClient::updateSceneQueries()
{
if(checkPvdDebugFlag() && (getScenePvdFlagsFast() & PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES))
mMetaDataBinding.sendSceneQueries(*mPvdDataStream, mScene, mPvd);
}
void PvdSceneClient::visualize(PxArticulationLink& link)
{
#if PX_ENABLE_DEBUG_VISUALIZATION
NpArticulationLink& npLink = static_cast<NpArticulationLink&>(link);
const void* itemId = npLink.getInboundJoint();
if(itemId && mUserRender)
{
PvdConstraintVisualizer viz(itemId, *mUserRender);
npLink.visualizeJoint(viz);
}
#else
PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION
PX_UNUSED(link);
#endif
}
void PvdSceneClient::visualize(const PxRenderBuffer& debugRenderable)
{
if(mUserRender)
{
// PT: I think the mUserRender object can contain extra data (including things coming from the user), because the various
// draw functions are exposed e.g. in PxPvdSceneClient.h. So I suppose we have to keep the render buffer around regardless
// of the connection flags. Thus I only skip the "drawRenderbuffer" call, for minimal intrusion into this file.
if(checkPvdDebugFlag())
{
mUserRender->drawRenderbuffer(
reinterpret_cast<const PxDebugPoint*>(debugRenderable.getPoints()), debugRenderable.getNbPoints(),
reinterpret_cast<const PxDebugLine*>(debugRenderable.getLines()), debugRenderable.getNbLines(),
reinterpret_cast<const PxDebugTriangle*>(debugRenderable.getTriangles()), debugRenderable.getNbTriangles());
}
mUserRender->flushRenderEvents();
}
}
#endif
| 37,936 | C++ | 28.115119 | 158 | 0.721926 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/NpArticulationSensor.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "PxArticulationReducedCoordinate.h"
#include "foundation/PxUserAllocated.h"
#include "foundation/PxMemory.h"
#include "ScArticulationSensor.h"
#include "NpBase.h"
#ifndef NP_ARTICULATION_SENSOR_H
#define NP_ARTICULATION_SENSOR_H
namespace physx
{
typedef PxU32 ArticulationSensorHandle;
class NpArticulationSensor : public PxArticulationSensor, public NpBase
{
public:
// PX_SERIALIZATION
NpArticulationSensor(PxBaseFlags baseFlags)
: PxArticulationSensor(baseFlags), NpBase(PxEmpty), mCore(PxEmpty) {}
void preExportDataReset() {}
virtual void exportExtraData(PxSerializationContext& ) {}
void importExtraData(PxDeserializationContext& ) {}
void resolveReferences(PxDeserializationContext& );
virtual void requiresObjects(PxProcessPxBaseCallback&) {}
virtual bool isSubordinate() const { return true; }
static NpArticulationSensor* createObject(PxU8*& address, PxDeserializationContext& context);
static void getBinaryMetaData(PxOutputStream& stream);
//~PX_SERIALIZATION
NpArticulationSensor(PxArticulationLink* link, const PxTransform& relativePose);
virtual ~NpArticulationSensor() {}
virtual void release();
virtual PxSpatialForce getForces() const;
virtual PxTransform getRelativePose() const;
virtual void setRelativePose(const PxTransform&);
virtual PxArticulationLink* getLink() const;
virtual PxU32 getIndex() const;
virtual PxArticulationReducedCoordinate* getArticulation() const;
virtual PxArticulationSensorFlags getFlags() const;
virtual void setFlag(PxArticulationSensorFlag::Enum flag, bool enabled);
PX_FORCE_INLINE Sc::ArticulationSensorCore& getSensorCore() { return mCore; }
PX_FORCE_INLINE const Sc::ArticulationSensorCore& getSensorCore() const { return mCore; }
PX_FORCE_INLINE ArticulationSensorHandle getHandle() { return mHandle; }
PX_FORCE_INLINE void setHandle(ArticulationSensorHandle handle) { mHandle = handle; }
private:
PxArticulationLink* mLink;
Sc::ArticulationSensorCore mCore;
ArticulationSensorHandle mHandle;
};
}
#endif //NP_ARTICULATION_SENSOR_H
| 3,817 | C | 43.395348 | 96 | 0.771024 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/PvdPhysicsClient.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PVD_PHYSICS_CLIENT_H
#define PVD_PHYSICS_CLIENT_H
#if PX_SUPPORT_PVD
#include "foundation/PxErrorCallback.h"
#include "foundation/PxHashMap.h"
#include "PxPvdClient.h"
#include "PvdMetaDataPvdBinding.h"
#include "NpFactory.h"
#include "foundation/PxMutex.h"
#include "PsPvd.h"
namespace physx
{
class PxProfileMemoryEventBuffer;
namespace Vd
{
class PvdPhysicsClient : public PvdClient, public PxErrorCallback, public NpFactoryListener, public PxUserAllocated
{
PX_NOCOPY(PvdPhysicsClient)
public:
PvdPhysicsClient(PsPvd* pvd);
virtual ~PvdPhysicsClient();
bool isConnected() const;
void onPvdConnected();
void onPvdDisconnected();
void flush();
physx::pvdsdk::PvdDataStream* getDataStream();
void sendEntireSDK();
void destroyPvdInstance(const PxPhysics* physics);
// NpFactoryListener
virtual void onMeshFactoryBufferRelease(const PxBase* object, PxType typeID);
/// NpFactoryListener
// PxErrorCallback
void reportError(PxErrorCode::Enum code, const char* message, const char* file, int line);
private:
void createPvdInstance(const PxTriangleMesh* triMesh);
void destroyPvdInstance(const PxTriangleMesh* triMesh);
void createPvdInstance(const PxTetrahedronMesh* tetMesh);
void destroyPvdInstance(const PxTetrahedronMesh* tetMesh);
void createPvdInstance(const PxConvexMesh* convexMesh);
void destroyPvdInstance(const PxConvexMesh* convexMesh);
void createPvdInstance(const PxHeightField* heightField);
void destroyPvdInstance(const PxHeightField* heightField);
void createPvdInstance(const PxMaterial* mat);
void destroyPvdInstance(const PxMaterial* mat);
void updatePvdProperties(const PxMaterial* mat);
void createPvdInstance(const PxFEMSoftBodyMaterial* mat);
void destroyPvdInstance(const PxFEMSoftBodyMaterial* mat);
void updatePvdProperties(const PxFEMSoftBodyMaterial* mat);
void createPvdInstance(const PxFEMClothMaterial* mat);
void destroyPvdInstance(const PxFEMClothMaterial* mat);
void updatePvdProperties(const PxFEMClothMaterial* mat);
void createPvdInstance(const PxPBDMaterial* mat);
void destroyPvdInstance(const PxPBDMaterial* mat);
void updatePvdProperties(const PxPBDMaterial* mat);
PsPvd* mPvd;
PvdDataStream* mPvdDataStream;
PvdMetaDataBinding mMetaDataBinding;
bool mIsConnected;
};
} // namespace Vd
} // namespace physx
#endif // PX_SUPPORT_PVD
#endif // PVD_PHYSICS_CLIENT_H
| 4,071 | C | 37.056074 | 115 | 0.787276 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/NpFEMCloth.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "foundation/PxPreprocessor.h"
#if PX_SUPPORT_GPU_PHYSX
#include "NpFEMCloth.h"
#include "NpCheck.h"
#include "NpScene.h"
#include "NpShape.h"
#include "geometry/PxTriangleMesh.h"
#include "geometry/PxTriangleMeshGeometry.h"
#include "PxPhysXGpu.h"
#include "PxvGlobals.h"
#include "GuTriangleMesh.h"
#include "NpRigidDynamic.h"
#include "NpRigidStatic.h"
#include "NpArticulationLink.h"
#include "GuTriangleMesh.h"
#include "ScFEMClothSim.h"
using namespace physx;
namespace physx
{
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
NpFEMCloth::NpFEMCloth(PxCudaContextManager& cudaContextManager)
:
NpActorTemplate(PxConcreteType::eFEM_CLOTH, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE, NpType::eFEMCLOTH),
mShape(NULL),
mCudaContextManager(&cudaContextManager)
{
}
NpFEMCloth::NpFEMCloth(PxBaseFlags baseFlags, PxCudaContextManager& cudaContextManager) :
NpActorTemplate(baseFlags),
mShape(NULL),
mCudaContextManager(&cudaContextManager)
{
}
PxBounds3 NpFEMCloth::getWorldBounds(float inflation) const
{
NP_READ_CHECK(getNpScene());
if (!getNpScene())
{
PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "Querying bounds of a PxFEMCloth which is not part of a PxScene is not supported.");
return PxBounds3::empty();
}
const Sc::FEMClothSim* sim = mCore.getSim();
PX_ASSERT(sim);
PX_SIMD_GUARD;
const PxBounds3 bounds = sim->getBounds();
PX_ASSERT(bounds.isValid());
// PT: unfortunately we can't just scale the min/max vectors, we need to go through center/extents.
const PxVec3 center = bounds.getCenter();
const PxVec3 inflatedExtents = bounds.getExtents() * inflation;
return PxBounds3::centerExtents(center, inflatedExtents);
}
void NpFEMCloth::setFEMClothFlag(PxFEMClothFlag::Enum flag, bool val)
{
PxFEMClothFlags flags = mCore.getFlags();
if (val)
flags.raise(flag);
else
flags.clear(flag);
mCore.setFlags(flags);
}
void NpFEMCloth::setFEMClothFlags(PxFEMClothFlags flags)
{
mCore.setFlags(flags);
}
PxFEMClothFlags NpFEMCloth::getFEMClothFlag() const
{
return mCore.getFlags();
}
#if 0 // disabled until future use.
void NpFEMCloth::setDrag(const PxReal drag)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setDrag() not allowed while simulation is running. Call will be ignored.")
mCore.setDrag(drag);
UPDATE_PVD_PROPERTY
}
PxReal NpFEMCloth::getDrag() const
{
return mCore.getDrag();
}
void NpFEMCloth::setLift(const PxReal lift)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setLift() not allowed while simulation is running. Call will be ignored.")
mCore.setLift(lift);
UPDATE_PVD_PROPERTY
}
PxReal NpFEMCloth::getLift() const
{
return mCore.getLift();
}
void NpFEMCloth::setWind(const PxVec3& wind)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setWind() not allowed while simulation is running. Call will be ignored.")
mCore.setWind(wind);
UPDATE_PVD_PROPERTY
}
PxVec3 NpFEMCloth::getWind() const
{
return mCore.getWind();
}
void NpFEMCloth::setAirDensity(const PxReal airDensity)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setAirDensity() not allowed while simulation is running. Call will be ignored.")
mCore.setAirDensity(airDensity);
UPDATE_PVD_PROPERTY
}
float NpFEMCloth::getAirDensity() const
{
return mCore.getAirDensity();
}
void NpFEMCloth::setBendingActivationAngle(const PxReal angle)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setBendingActivationAngle() not allowed while simulation is running. Call will be ignored.")
mCore.setBendingActivationAngle(angle);
UPDATE_PVD_PROPERTY
}
PxReal NpFEMCloth::getBendingActivationAngle() const
{
return mCore.getBendingActivationAngle();
}
#endif
void NpFEMCloth::setParameter(const PxFEMParameters& paramters)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setParameter() not allowed while simulation is running. Call will be ignored.")
mCore.setParameter(paramters);
UPDATE_PVD_PROPERTY
}
PxFEMParameters NpFEMCloth::getParameter() const
{
NP_READ_CHECK(getNpScene());
return mCore.getParameter();
}
void NpFEMCloth::setBendingScales(const PxReal* const bendingScales, PxU32 nbElements)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setBendingScales() not allowed while simulation is running. Call will be ignored.")
mCore.setBendingScales(bendingScales, nbElements);
UPDATE_PVD_PROPERTY
}
const PxReal* NpFEMCloth::getBendingScales() const
{
NP_READ_CHECK(getNpScene());
return mCore.getBendingScales();
}
PxU32 NpFEMCloth::getNbBendingScales() const
{
NP_READ_CHECK(getNpScene());
return mCore.getNbBendingScales();
}
void NpFEMCloth::setMaxVelocity(const PxReal v)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setMaxVelocity() not allowed while simulation is running. Call will be ignored.")
mCore.setMaxVelocity(v);
UPDATE_PVD_PROPERTY
}
PxReal NpFEMCloth::getMaxVelocity() const
{
return mCore.getMaxVelocity();
}
void NpFEMCloth::setMaxDepenetrationVelocity(const PxReal v)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setMaxDepenetrationVelocity() not allowed while simulation is running. Call will be ignored.")
mCore.setMaxDepenetrationVelocity(v);
UPDATE_PVD_PROPERTY
}
PxReal NpFEMCloth::getMaxDepenetrationVelocity() const
{
return mCore.getMaxDepenetrationVelocity();
}
void NpFEMCloth::setNbCollisionPairUpdatesPerTimestep(const PxU32 frequency)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setNbCollisionPairUpdatesPerTimestep() not allowed while simulation is running. Call will be ignored.")
mCore.setNbCollisionPairUpdatesPerTimestep(frequency);
UPDATE_PVD_PROPERTY
}
PxU32 NpFEMCloth::getNbCollisionPairUpdatesPerTimestep() const
{
return mCore.getNbCollisionPairUpdatesPerTimestep();
}
void NpFEMCloth::setNbCollisionSubsteps(const PxU32 frequency)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setNbCollisionSubsteps() not allowed while simulation is running. Call will be ignored.")
mCore.setNbCollisionSubsteps(frequency);
UPDATE_PVD_PROPERTY
}
PxU32 NpFEMCloth::getNbCollisionSubsteps() const
{
return mCore.getNbCollisionSubsteps();
}
PxVec4* NpFEMCloth::getPositionInvMassBufferD()
{
PX_CHECK_AND_RETURN_NULL(mShape != NULL, " NpFEMCloth::getPositionInvMassBufferD: FEM cloth does not have a shape, attach shape first.");
Dy::FEMClothCore& core = mCore.getCore();
return core.mPositionInvMass;
}
PxVec4* NpFEMCloth::getVelocityBufferD()
{
PX_CHECK_AND_RETURN_NULL(mShape != NULL, " NpFEMCloth::getVelocityBufferD: FEM cloth does not have a shape, attach shape first.");
Dy::FEMClothCore& core = mCore.getCore();
return core.mVelocity;
}
PxVec4* NpFEMCloth::getRestPositionBufferD()
{
PX_CHECK_AND_RETURN_NULL(mShape != NULL, " NpFEMCloth::getRestPositionBufferD: FEM cloth does not have a shape, attach shape first.");
Dy::FEMClothCore& core = mCore.getCore();
return core.mRestPosition;
}
void NpFEMCloth::markDirty(PxFEMClothDataFlags flags)
{
NP_WRITE_CHECK(getNpScene());
Dy::FEMClothCore& core = mCore.getCore();
core.mDirtyFlags |= flags;
}
PxCudaContextManager* NpFEMCloth::getCudaContextManager() const
{
return mCudaContextManager;
}
void NpFEMCloth::setCudaContextManager(PxCudaContextManager* cudaContextManager)
{
mCudaContextManager = cudaContextManager;
}
void NpFEMCloth::setSolverIterationCounts(PxU32 positionIters) // maybe use PxU16?
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_AND_RETURN(positionIters > 0, "NpFEMCloth::setSolverIterationCounts: positionIters must be more than zero!");
PX_CHECK_AND_RETURN(positionIters <= 255, "NpFEMCloth::setSolverIterationCounts: positionIters must be no greater than 255!");
//PX_CHECK_AND_RETURN(velocityIters > 0, "NpFEMCloth::setSolverIterationCounts: velocityIters must be more than zero!");
//PX_CHECK_AND_RETURN(velocityIters <= 255, "NpFEMCloth::setSolverIterationCounts: velocityIters must be no greater than 255!");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setSolverIterationCounts() not allowed while simulation is running. Call will be ignored.")
//mCore.setSolverIterationCounts((velocityIters & 0xff) << 8 | (positionIters & 0xff));
mCore.setSolverIterationCounts(positionIters & 0xff);
}
void NpFEMCloth::getSolverIterationCounts(PxU32& positionIters) const
{
NP_READ_CHECK(getNpScene());
PxU16 x = mCore.getSolverIterationCounts();
//velocityIters = PxU32(x >> 8);
positionIters = PxU32(x & 0xff);
}
PxShape* NpFEMCloth::getShape()
{
return mShape;
}
bool NpFEMCloth::attachShape(PxShape& shape)
{
NpShape* npShape = static_cast<NpShape*>(&shape);
PX_CHECK_AND_RETURN_NULL(npShape->getGeometryTypeFast() == PxGeometryType::eTRIANGLEMESH, "NpFEMCloth::attachShape: Geometry type must be triangle mesh geometry");
PX_CHECK_AND_RETURN_NULL(mShape == NULL, "NpFEMCloth::attachShape: FEM-cloth can just have one shape");
PX_CHECK_AND_RETURN_NULL(shape.isExclusive(), "NpFEMCloth::attachShape: shape must be exclusive");
Dy::FEMClothCore& core = mCore.getCore();
PX_CHECK_AND_RETURN_NULL(core.mPositionInvMass == NULL, "NpFEMCloth::attachShape: mPositionInvMass already exists, overwrite not allowed, call detachShape first");
PX_CHECK_AND_RETURN_NULL(core.mVelocity == NULL, "NpFEMCloth::attachShape: mClothVelocity already exists, overwrite not allowed, call detachShape first");
PX_CHECK_AND_RETURN_NULL(core.mRestPosition == NULL, "NpFEMCloth::attachShape: mClothRestPosition already exists, overwrite not allowed, call detachShape first");
const PxTriangleMeshGeometry& geom = static_cast<const PxTriangleMeshGeometry&>(npShape->getGeometry());
Gu::TriangleMesh* guMesh = static_cast<Gu::TriangleMesh*>(geom.triangleMesh);
#if PX_CHECKED
const PxU32 triangleReference = guMesh->getNbTriangleReferences();
PX_CHECK_AND_RETURN_NULL(triangleReference > 0, "NpFEMCloth::attachShape: cloth triangle mesh has cooked with eENABLE_VERT_MAPPING");
#endif
mShape = npShape;
PX_ASSERT(shape.getActor() == NULL);
npShape->onActorAttach(*this);
updateMaterials();
const PxU32 numVerts = guMesh->getNbVerticesFast();
core.mPositionInvMass = PX_DEVICE_ALLOC_T(PxVec4, mCudaContextManager, numVerts);
core.mVelocity = PX_DEVICE_ALLOC_T(PxVec4, mCudaContextManager, numVerts);
core.mRestPosition = PX_DEVICE_ALLOC_T(PxVec4, mCudaContextManager, numVerts);
return true;
}
void NpFEMCloth::addRigidFilter(PxRigidActor* actor, PxU32 vertId)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpFEMCloth::addRigidFilter: Cloth must be inserted into the scene.");
PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpFEMCloth::addRigidFilter: actor must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpFEMCloth::addRigidFilter: Illegal to call while simulation is running.");
Sc::BodyCore* core = getBodyCore(actor);
return mCore.addRigidFilter(core, vertId);
}
void NpFEMCloth::removeRigidFilter(PxRigidActor* actor, PxU32 vertId)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpFEMCloth::removeRigidFilter: cloth must be inserted into the scene.");
PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpFEMCloth::removeRigidFilter: actor must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpFEMCloth::removeRigidFilter: Illegal to call while simulation is running.");
Sc::BodyCore* core = getBodyCore(actor);
mCore.removeRigidFilter(core, vertId);
}
PxU32 NpFEMCloth::addRigidAttachment(PxRigidActor* actor, PxU32 vertId, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN_VAL(getNpScene() != NULL, "NpFEMCloth::addRigidAttachment: cloth must be inserted into the scene.", 0xFFFFFFFF);
PX_CHECK_AND_RETURN_VAL((actor == NULL || actor->getScene() != NULL), "NpFEMCloth::addRigidAttachment: actor must be inserted into the scene.", 0xFFFFFFFF);
PX_CHECK_AND_RETURN_VAL(constraint == NULL || constraint->isValid(), "NpFEMCloth::addRigidAttachment: PxConeLimitedConstraint needs to be valid if specified.", 0xFFFFFFFF);
PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "NpFEMCloth::addRigidAttachment: Illegal to call while simulation is running.", 0xFFFFFFFF);
Sc::BodyCore* core = getBodyCore(actor);
PxVec3 aPose = actorSpacePose;
if(actor && actor->getConcreteType()==PxConcreteType::eRIGID_STATIC)
{
NpRigidStatic* stat = static_cast<NpRigidStatic*>(actor);
aPose = stat->getGlobalPose().transform(aPose);
}
return mCore.addRigidAttachment(core, vertId, aPose, constraint);
}
void NpFEMCloth::removeRigidAttachment(PxRigidActor* actor, PxU32 handle)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpFEMCloth::removeRigidAttachment: cloth must be inserted into the scene.");
PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpFEMCloth::removeRigidAttachment: actor must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpFEMCloth::removeRigidAttachment: Illegal to call while simulation is running.");
Sc::BodyCore* core = getBodyCore(actor);
mCore.removeRigidAttachment(core, handle);
}
void NpFEMCloth::addTriRigidFilter(PxRigidActor* actor, PxU32 triangleIdx)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpFEMCloth::addTriRigidFilter: cloth must be inserted into the scene.");
PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpFEMCloth::addTriRigidFilter: actor must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpFEMCloth::addTriRigidFilter: Illegal to call while simulation is running.");
Sc::BodyCore* core = getBodyCore(actor);
return mCore.addTriRigidFilter(core, triangleIdx);
}
void NpFEMCloth::removeTriRigidFilter(PxRigidActor* actor, PxU32 triangleId)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpFEMCloth::releaseTriRigidAttachment: cloth must be inserted into the scene.");
PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpFEMCloth::releaseTriRigidAttachment: actor must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpFEMCloth::releaseTriRigidAttachment: Illegal to call while simulation is running.");
Sc::BodyCore* core = getBodyCore(actor);
mCore.removeTriRigidFilter(core, triangleId);
}
PxU32 NpFEMCloth::addTriRigidAttachment(PxRigidActor* actor, PxU32 triangleIdx, const PxVec4& barycentric, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN_VAL(getNpScene() != NULL, "NpFEMCloth::addTriRigidAttachment: cloth must be inserted into the scene.", 0xFFFFFFFF);
PX_CHECK_AND_RETURN_VAL((actor == NULL || actor->getScene() != NULL), "NpFEMCloth::addTriRigidAttachment: actor must be inserted into the scene.", 0xFFFFFFFF);
PX_CHECK_AND_RETURN_VAL(constraint == NULL || constraint->isValid(), "NpFEMCloth::addTriRigidAttachment: PxConeLimitedConstraint needs to be valid if specified.", 0xFFFFFFFF);
PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "NpFEMCloth::addTriRigidAttachment: Illegal to call while simulation is running.", 0xFFFFFFFF);
Sc::BodyCore* core = getBodyCore(actor);
PxVec3 aPose = actorSpacePose;
if(actor && actor->getConcreteType()==PxConcreteType::eRIGID_STATIC)
{
NpRigidStatic* stat = static_cast<NpRigidStatic*>(actor);
aPose = stat->getGlobalPose().transform(aPose);
}
return mCore.addTriRigidAttachment(core, triangleIdx, barycentric, aPose, constraint);
}
void NpFEMCloth::removeTriRigidAttachment(PxRigidActor* actor, PxU32 handle)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpFEMCloth::releaseTriRigidAttachment: cloth must be inserted into the scene.");
PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpFEMCloth::releaseTriRigidAttachment: actor must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpFEMCloth::releaseTriRigidAttachment: Illegal to call while simulation is running.");
Sc::BodyCore* core = getBodyCore(actor);
mCore.removeTriRigidAttachment(core, handle);
}
void NpFEMCloth::addClothFilter(PxFEMCloth* otherCloth, PxU32 otherTriIdx, PxU32 triIdx)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpFEMCloth::addClothAttachment: cloth must be inserted into the scene.");
PX_CHECK_AND_RETURN((otherCloth == NULL || otherCloth->getScene() != NULL), "NpFEMCloth::addClothFilter: actor must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpFEMCloth::addClothFilter: Illegal to call while simulation is running.");
NpFEMCloth* dyn = static_cast<NpFEMCloth*>(otherCloth);
Sc::FEMClothCore* otherCore = &dyn->getCore();
return mCore.addClothFilter(otherCore, otherTriIdx, triIdx);
}
void NpFEMCloth::removeClothFilter(PxFEMCloth* otherCloth, PxU32 otherTriIdx, PxU32 triIdx)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(otherCloth != NULL, "NpFEMCloth::removeClothFilter: actor must not be null");
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpFEMCloth::removeClothFilter: cloth must be inserted into the scene.");
PX_CHECK_AND_RETURN(otherCloth->getScene() != NULL, "NpFEMCloth::removeClothFilter: actor must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpFEMCloth::removeClothFilter: Illegal to call while simulation is running.");
NpFEMCloth* dyn = static_cast<NpFEMCloth*>(otherCloth);
Sc::FEMClothCore* otherCore = &dyn->getCore();
mCore.removeClothFilter(otherCore, otherTriIdx, triIdx);
}
PxU32 NpFEMCloth::addClothAttachment(PxFEMCloth* otherCloth, PxU32 otherTriIdx, const PxVec4& otherTriBarycentric, PxU32 triIdx, const PxVec4& triBarycentric)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN_VAL(getNpScene() != NULL, "NpFEMCloth::addClothAttachment: cloth must be inserted into the scene.", 0xFFFFFFFF);
PX_CHECK_AND_RETURN_VAL((otherCloth == NULL || otherCloth->getScene() != NULL), "NpFEMCloth::addClothAttachment: actor must be inserted into the scene.", 0xFFFFFFFF);
PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "NpFEMCloth::addClothAttachment: Illegal to call while simulation is running.", 0xFFFFFFFF);
NpFEMCloth* dyn = static_cast<NpFEMCloth*>(otherCloth);
Sc::FEMClothCore* otherCore = &dyn->getCore();
return mCore.addClothAttachment(otherCore, otherTriIdx, otherTriBarycentric, triIdx, triBarycentric);
}
void NpFEMCloth::removeClothAttachment(PxFEMCloth* otherCloth, PxU32 handle)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(otherCloth != NULL, "NpFEMCloth::releaseClothAttachment: actor must not be null");
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpFEMCloth::releaseClothAttachment: cloth must be inserted into the scene.");
PX_CHECK_AND_RETURN(otherCloth->getScene() != NULL, "NpFEMCloth::releaseClothAttachment: actor must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpFEMCloth::releaseClothAttachment: Illegal to call while simulation is running.");
NpFEMCloth* dyn = static_cast<NpFEMCloth*>(otherCloth);
Sc::FEMClothCore* otherCore = &dyn->getCore();
mCore.removeClothAttachment(otherCore, handle);
}
void NpFEMCloth::detachShape()
{
Dy::FEMClothCore& core = mCore.getCore();
if (core.mPositionInvMass)
{
PX_DEVICE_FREE(mCudaContextManager, core.mPositionInvMass);
core.mPositionInvMass = NULL;
}
if (core.mVelocity)
{
PX_DEVICE_FREE(mCudaContextManager, core.mVelocity);
core.mVelocity = NULL;
}
if (core.mRestPosition)
{
PX_DEVICE_FREE(mCudaContextManager, core.mRestPosition);
core.mRestPosition = NULL;
}
if (mShape)
mShape->onActorDetach();
mShape = NULL;
}
void NpFEMCloth::release()
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
if (npScene)
{
npScene->scRemoveFEMCloth(*this);
npScene->removeFromFEMClothList(*this);
}
detachShape();
PX_ASSERT(!isAPIWriteForbidden());
NpDestroyFEMCloth(this);
}
void NpFEMCloth::setName(const char* debugName)
{
NP_WRITE_CHECK(getNpScene());
mName = debugName;
}
const char* NpFEMCloth::getName() const
{
NP_READ_CHECK(getNpScene());
return mName;
}
bool NpFEMCloth::isSleeping() const
{
Sc::FEMClothSim* sim = mCore.getSim();
if (sim)
{
return sim->isSleeping();
}
return true;
}
void NpFEMCloth::updateMaterials()
{
Dy::FEMClothCore& core = mCore.getCore();
core.clearMaterials();
for (PxU32 i = 0; i < mShape->getNbMaterials(); ++i)
{
PxFEMClothMaterial* material;
mShape->getClothMaterials(&material, 1, i);
core.setMaterial(static_cast<NpFEMClothMaterial*>(material)->mMaterial.mMaterialIndex);
}
}
#endif
}
#endif //PX_SUPPORT_GPU_PHYSX
| 23,752 | C++ | 34.665165 | 177 | 0.745874 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/NpSceneQueries.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "NpSceneQueries.h"
#include "common/PxProfileZone.h"
#include "GuBounds.h"
#include "CmTransformUtils.h"
#include "NpShape.h"
#include "NpActor.h"
#include "NpRigidStatic.h"
#include "NpRigidDynamic.h"
#include "NpArticulationLink.h"
#include "GuActorShapeMap.h"
using namespace physx;
using namespace Sq;
using namespace Gu;
#if PX_SUPPORT_PVD
#include "NpPvdSceneQueryCollector.h"
#endif
PX_IMPLEMENT_OUTPUT_ERROR
static PX_FORCE_INLINE NpShape* getShapeFromPayload(const PrunerPayload& payload)
{
return reinterpret_cast<NpShape*>(payload.data[0]);
}
static PX_FORCE_INLINE NpActor* getActorFromPayload(const PrunerPayload& payload)
{
return reinterpret_cast<NpActor*>(payload.data[1]);
}
///////////////////////////////////////////////////////////////////////////////
static PX_FORCE_INLINE ActorShapeData createActorShapeData(PrunerData data, PrunerCompoundId id) { return (ActorShapeData(id) << 32) | ActorShapeData(data); }
static PX_FORCE_INLINE PrunerData getPrunerData(ActorShapeData data) { return PrunerData(data); }
static PX_FORCE_INLINE PrunerCompoundId getCompoundID(ActorShapeData data) { return PrunerCompoundId(data >> 32); }
///////////////////////////////////////////////////////////////////////////////
namespace
{
class NpSqAdapter : public QueryAdapter
{
public:
NpSqAdapter() {}
virtual ~NpSqAdapter() {}
// Adapter
virtual const PxGeometry& getGeometry(const PrunerPayload& payload) const;
//~Adapter
// QueryAdapter
virtual PrunerHandle findPrunerHandle(const PxQueryCache& cache, PrunerCompoundId& compoundId, PxU32& prunerIndex) const;
virtual void getFilterData(const PrunerPayload& payload, PxFilterData& filterData) const;
virtual void getActorShape(const PrunerPayload& payload, PxActorShape& actorShape) const;
//~QueryAdapter
ActorShapeMap mDatabase;
};
}
PrunerHandle NpSqAdapter::findPrunerHandle(const PxQueryCache& cache, PrunerCompoundId& compoundId, PxU32& prunerIndex) const
{
const NpActor& npActor = NpActor::getFromPxActor(*cache.actor);
const PxU32 actorIndex = npActor.getBaseIndex();
PX_ASSERT(actorIndex!=NP_UNUSED_BASE_INDEX);
const ActorShapeData actorShapeData = mDatabase.find(actorIndex, &npActor, static_cast<NpShape*>(cache.shape));
const PrunerData prunerData = getPrunerData(actorShapeData);
compoundId = getCompoundID(actorShapeData);
prunerIndex = getPrunerIndex(prunerData);
return getPrunerHandle(prunerData);
}
void NpSqAdapter::getFilterData(const PrunerPayload& payload, PxFilterData& filterData) const
{
NpShape* npShape = getShapeFromPayload(payload);
filterData = npShape->getQueryFilterData();
}
void NpSqAdapter::getActorShape(const PrunerPayload& payload, PxActorShape& actorShape) const
{
NpShape* npShape = getShapeFromPayload(payload);
NpActor* npActor = getActorFromPayload(payload);
actorShape.actor = static_cast<PxRigidActor*>(static_cast<const Sc::RigidCore&>(npActor->getActorCore()).getPxActor());
actorShape.shape = npShape;
PX_ASSERT(actorShape.shape == npShape->getCore().getPxShape());
}
const PxGeometry& NpSqAdapter::getGeometry(const PrunerPayload& payload) const
{
NpShape* npShape = getShapeFromPayload(payload);
return npShape->getCore().getGeometry();
}
#if PX_SUPPORT_PVD
bool NpSceneQueries::transmitSceneQueries()
{
if(!mPVDClient)
return false;
if(!(mPVDClient->checkPvdDebugFlag() && (mPVDClient->getScenePvdFlagsFast() & PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES)))
return false;
return true;
}
void NpSceneQueries::raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal distance, const PxRaycastHit* hit, PxU32 hitsNum, const PxQueryFilterData& filterData, bool multipleHits)
{
mSingleSqCollector.raycast(origin, unitDir, distance, hit, hitsNum, filterData, multipleHits);
}
void NpSceneQueries::sweep(const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, PxReal distance, const PxSweepHit* hit, PxU32 hitsNum, const PxQueryFilterData& filterData, bool multipleHits)
{
mSingleSqCollector.sweep(geometry, pose, unitDir, distance, hit, hitsNum, filterData, multipleHits);
}
void NpSceneQueries::overlap(const PxGeometry& geometry, const PxTransform& pose, const PxOverlapHit* hit, PxU32 hitsNum, const PxQueryFilterData& filterData)
{
mSingleSqCollector.overlapMultiple(geometry, pose, hit, hitsNum, filterData);
}
#endif
static PX_FORCE_INLINE void setPayload(PrunerPayload& pp, const NpShape* npShape, const NpActor* npActor)
{
pp.data[0] = size_t(npShape);
pp.data[1] = size_t(npActor);
}
static PX_FORCE_INLINE bool isDynamicActor(const PxRigidActor& actor)
{
const PxType actorType = actor.getConcreteType();
return actorType != PxConcreteType::eRIGID_STATIC;
}
namespace
{
struct DatabaseCleaner : PrunerPayloadRemovalCallback
{
DatabaseCleaner(NpSqAdapter& adapter) : mAdapter(adapter){}
virtual void invoke(PxU32 nbRemoved, const PrunerPayload* removed)
{
PxU32 actorIndex = NP_UNUSED_BASE_INDEX;
const NpActor* cachedActor = NULL;
while(nbRemoved--)
{
const PrunerPayload& payload = *removed++;
const NpActor* npActor = getActorFromPayload(payload);
if(npActor!=cachedActor)
{
actorIndex = npActor->getBaseIndex();
cachedActor = npActor;
}
PX_ASSERT(actorIndex!=NP_UNUSED_BASE_INDEX);
bool status = mAdapter.mDatabase.remove(actorIndex, npActor, getShapeFromPayload(payload), NULL);
PX_ASSERT(status);
PX_UNUSED(status);
}
}
NpSqAdapter& mAdapter;
PX_NOCOPY(DatabaseCleaner)
};
}
namespace
{
class InternalPxSQ : public PxSceneQuerySystem, public PxUserAllocated
{
public:
InternalPxSQ(const PxSceneDesc& desc, PVDCapture* pvd, PxU64 contextID, Pruner* staticPruner, Pruner* dynamicPruner) :
mQueries(pvd, contextID, staticPruner, dynamicPruner, desc.dynamicTreeRebuildRateHint, SQ_PRUNER_EPSILON, desc.limits, mAdapter),
mUpdateMode (desc.sceneQueryUpdateMode),
mRefCount (1)
{}
virtual ~InternalPxSQ(){}
PX_FORCE_INLINE Sq::PrunerManager& SQ() { return mQueries.mSQManager; }
PX_FORCE_INLINE const Sq::PrunerManager& SQ() const { return mQueries.mSQManager; }
virtual void release()
{
mRefCount--;
if(!mRefCount)
PX_DELETE_THIS;
}
virtual void acquireReference()
{
mRefCount++;
}
virtual void preallocate(PxU32 prunerIndex, PxU32 nbShapes)
{
SQ().preallocate(prunerIndex, nbShapes);
}
// PT: TODO: returning PxSQShapeHandle means we have to store them in PhysX, inside the shape manager's mSceneQueryData array. But if we'd change the API here
// and also pass the actor/shape couple instead of cached PxSQShapeHandle to functions like removeSQShape, it would simplify the internal PhysX code and truly
// decouple the SQ parts from the rest. It is unclear what the consequences would be on performance: on one hand the PxSQ implementation would need a
// hashmap or something to remap actor/shape to the SQ data, on the other hand the current code for that in PhysX is only fast for non-shared shapes.
// (see findSceneQueryData)
//
// Another appealing side-effect here is that there probably wouldn't be a "compound ID" anymore: we just pass the actor/shape couple and it's up to
// the implementation to know that this actor was added "as a compound" or not. Again, consequences on the code are unknown. We might have to just try.
//
// It might become quite tedious for the sync function though, since that one caches *PxSQPrunerHandles*. We don't want to do the "ref finding" equivalent each
// frame for each shape, so some kind of cache is needed. That probably means these cached items must appear and be handled on the PhysX/internal side of
// the API. That being said and as noted already in another part of the code:
// PT: TODO: this is similar to findPrunerData in QueryAdapter. Maybe we could unify these.
// => so the ref-finding code could stay, and just reuse findPrunerData (like the query cache). It wouldn't fully decouple the internal PhysX code from SQ,
// since we'd still store an array of "PrunerData" internally. *BUT* we could still drop mSceneQueryData. So, still worth trying.
//
// The nail in the coffin for this idea though is that we still need to provide an internal implementation of PxSQ, and that one does use mSceneQueryData.
// So we're struck with this array, unless we decide that there is NO internal implementation, and it's all moved to Extensions all the time.
//
// If we move the implementation to Extension, suddenly we need to link to SceneQuery.lib, which was not the case previously. At this point it becomes
// appealing to just move the Sq code to Gu: it solves the link errors, we could finally include it from Sc, we'd get rid of cross-DLL calls between
// Sq and Gu, etc
virtual void addSQShape( const PxRigidActor& actor, const PxShape& shape, const PxBounds3& bounds,
const PxTransform& transform, const PxSQCompoundHandle* compoundHandle, bool hasPruningStructure)
{
const NpShape& npShape = static_cast<const NpShape&>(shape);
const NpActor& npActor = NpActor::getFromPxActor(actor);
PrunerPayload payload;
setPayload(payload, &npShape, &npActor);
const PrunerCompoundId pcid = compoundHandle ? PrunerCompoundId(*compoundHandle) : INVALID_COMPOUND_ID;
const PrunerData prunerData = SQ().addPrunerShape(payload, isDynamicActor(actor), pcid, bounds, transform, hasPruningStructure);
const PxU32 actorIndex = npActor.getBaseIndex();
PX_ASSERT(actorIndex!=NP_UNUSED_BASE_INDEX);
mAdapter.mDatabase.add(actorIndex, &npActor, &npShape, createActorShapeData(prunerData, pcid));
}
virtual void removeSQShape(const PxRigidActor& actor, const PxShape& shape)
{
const NpActor& npActor = NpActor::getFromPxActor(actor);
const NpShape& npShape = static_cast<const NpShape&>(shape);
const PxU32 actorIndex = npActor.getBaseIndex();
PX_ASSERT(actorIndex!=NP_UNUSED_BASE_INDEX);
ActorShapeData actorShapeData;
mAdapter.mDatabase.remove(actorIndex, &npActor, &npShape, &actorShapeData);
const PrunerData data = getPrunerData(actorShapeData);
const PrunerCompoundId compoundId = getCompoundID(actorShapeData);
SQ().removePrunerShape(compoundId, data, NULL);
}
virtual void updateSQShape(const PxRigidActor& actor, const PxShape& shape, const PxTransform& transform)
{
const NpActor& npActor = NpActor::getFromPxActor(actor);
const NpShape& npShape = static_cast<const NpShape&>(shape);
const PxU32 actorIndex = npActor.getBaseIndex();
PX_ASSERT(actorIndex!=NP_UNUSED_BASE_INDEX);
const ActorShapeData actorShapeData = mAdapter.mDatabase.find(actorIndex, &npActor, &npShape);
const PrunerData shapeHandle = getPrunerData(actorShapeData);
const PrunerCompoundId pcid = getCompoundID(actorShapeData);
SQ().markForUpdate(pcid, shapeHandle, transform);
}
virtual PxSQCompoundHandle addSQCompound(const PxRigidActor& actor, const PxShape** shapes, const PxBVH& pxbvh, const PxTransform* transforms)
{
const BVH& bvh = static_cast<const BVH&>(pxbvh);
const PxU32 numSqShapes = bvh.BVH::getNbBounds();
const NpActor& npActor = NpActor::getFromPxActor(actor);
PX_ALLOCA(payloads, PrunerPayload, numSqShapes);
for(PxU32 i=0; i<numSqShapes; i++)
setPayload(payloads[i], static_cast<const NpShape*>(shapes[i]), &npActor);
const PxU32 actorIndex = npActor.getBaseIndex();
PX_ASSERT(actorIndex!=NP_UNUSED_BASE_INDEX);
PX_ALLOCA(shapeHandles, PrunerData, numSqShapes);
SQ().addCompoundShape(bvh, PrunerCompoundId(actorIndex), actor.getGlobalPose(), shapeHandles, payloads, transforms, isDynamicActor(actor));
for(PxU32 i=0; i<numSqShapes; i++)
{
// PT: TODO: actorIndex is now redundant!
mAdapter.mDatabase.add(actorIndex, &npActor, static_cast<const NpShape*>(shapes[i]), createActorShapeData(shapeHandles[i], actorIndex));
}
return PxSQCompoundHandle(actorIndex);
}
virtual void removeSQCompound(PxSQCompoundHandle compoundHandle)
{
DatabaseCleaner cleaner(mAdapter);
SQ().removeCompoundActor(PrunerCompoundId(compoundHandle), &cleaner);
}
virtual void updateSQCompound(PxSQCompoundHandle compoundHandle, const PxTransform& compoundTransform)
{
SQ().updateCompoundActor(PrunerCompoundId(compoundHandle), compoundTransform);
}
virtual void flushUpdates() { SQ().flushUpdates(); }
virtual void flushMemory() { SQ().flushMemory(); }
virtual void visualize(PxU32 prunerIndex, PxRenderOutput& out) const { SQ().visualize(prunerIndex, out); }
virtual void shiftOrigin(const PxVec3& shift) { SQ().shiftOrigin(shift); }
virtual PxSQBuildStepHandle prepareSceneQueryBuildStep(PxU32 prunerIndex) { return SQ().prepareSceneQueriesUpdate(PruningIndex::Enum(prunerIndex)); }
virtual void sceneQueryBuildStep(PxSQBuildStepHandle handle) { SQ().sceneQueryBuildStep(handle); }
virtual void setDynamicTreeRebuildRateHint(PxU32 dynTreeRebuildRateHint) { SQ().setDynamicTreeRebuildRateHint(dynTreeRebuildRateHint); }
virtual PxU32 getDynamicTreeRebuildRateHint() const { return SQ().getDynamicTreeRebuildRateHint(); }
virtual void forceRebuildDynamicTree(PxU32 prunerIndex) { SQ().forceRebuildDynamicTree(prunerIndex); }
virtual PxSceneQueryUpdateMode::Enum getUpdateMode() const { return mUpdateMode; }
virtual void setUpdateMode(PxSceneQueryUpdateMode::Enum mode) { mUpdateMode = mode; }
virtual PxU32 getStaticTimestamp() const { return SQ().getStaticTimestamp(); }
virtual void finalizeUpdates()
{
switch(mUpdateMode)
{
case PxSceneQueryUpdateMode::eBUILD_ENABLED_COMMIT_ENABLED: SQ().afterSync(true, true); break;
case PxSceneQueryUpdateMode::eBUILD_ENABLED_COMMIT_DISABLED: SQ().afterSync(true, false); break;
case PxSceneQueryUpdateMode::eBUILD_DISABLED_COMMIT_DISABLED: SQ().afterSync(false, false); break;
}
}
virtual void merge(const PxPruningStructure& pxps)
{
Pruner* staticPruner = SQ().getPruner(PruningIndex::eSTATIC);
if(staticPruner)
staticPruner->merge(pxps.getStaticMergeData());
Pruner* dynamicPruner = SQ().getPruner(PruningIndex::eDYNAMIC);
if(dynamicPruner)
dynamicPruner->merge(pxps.getDynamicMergeData());
}
virtual bool raycast( const PxVec3& origin, const PxVec3& unitDir, const PxReal distance,
PxRaycastCallback& hitCall, PxHitFlags hitFlags,
const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall,
const PxQueryCache* cache, PxGeometryQueryFlags flags) const
{
return mQueries._raycast(origin, unitDir, distance, hitCall, hitFlags, filterData, filterCall, cache, flags);
}
virtual bool sweep( const PxGeometry& geometry, const PxTransform& pose,
const PxVec3& unitDir, const PxReal distance,
PxSweepCallback& hitCall, PxHitFlags hitFlags,
const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall,
const PxQueryCache* cache, const PxReal inflation, PxGeometryQueryFlags flags) const
{
return mQueries._sweep(geometry, pose, unitDir, distance, hitCall, hitFlags, filterData, filterCall, cache, inflation, flags);
}
virtual bool overlap( const PxGeometry& geometry, const PxTransform& transform,
PxOverlapCallback& hitCall,
const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall,
const PxQueryCache* cache, PxGeometryQueryFlags flags) const
{
return mQueries._overlap( geometry, transform, hitCall, filterData, filterCall, cache, flags);
}
virtual PxSQPrunerHandle getHandle(const PxRigidActor& actor, const PxShape& shape, PxU32& prunerIndex) const
{
const NpActor& npActor = NpActor::getFromPxActor(actor);
const NpShape& npShape = static_cast<const NpShape&>(shape);
const PxU32 actorIndex = npActor.getBaseIndex();
PX_ASSERT(actorIndex!=NP_UNUSED_BASE_INDEX);
const ActorShapeData actorShapeData = mAdapter.mDatabase.find(actorIndex, &npActor, &npShape);
const PrunerData prunerData = getPrunerData(actorShapeData);
prunerIndex = getPrunerIndex(prunerData);
return PxSQPrunerHandle(getPrunerHandle(prunerData));
}
virtual void sync(PxU32 prunerIndex, const PxSQPrunerHandle* handles, const PxU32* boundsIndices, const PxBounds3* bounds, const PxTransform32* transforms, PxU32 count, const PxBitMap& ignoredIndices)
{
PX_ASSERT(prunerIndex==PruningIndex::eDYNAMIC);
if(prunerIndex==PruningIndex::eDYNAMIC)
SQ().sync(handles, boundsIndices, bounds, transforms, count, ignoredIndices);
}
SceneQueries mQueries;
NpSqAdapter mAdapter;
PxSceneQueryUpdateMode::Enum mUpdateMode;
PxU32 mRefCount;
};
}
#include "SqFactory.h"
static CompanionPrunerType getCompanionType(PxDynamicTreeSecondaryPruner::Enum type)
{
switch(type)
{
case PxDynamicTreeSecondaryPruner::eNONE: return COMPANION_PRUNER_NONE;
case PxDynamicTreeSecondaryPruner::eBUCKET: return COMPANION_PRUNER_BUCKET;
case PxDynamicTreeSecondaryPruner::eINCREMENTAL: return COMPANION_PRUNER_INCREMENTAL;
case PxDynamicTreeSecondaryPruner::eBVH: return COMPANION_PRUNER_AABB_TREE;
case PxDynamicTreeSecondaryPruner::eLAST: return COMPANION_PRUNER_NONE;
}
return COMPANION_PRUNER_NONE;
}
static BVHBuildStrategy getBuildStrategy(PxBVHBuildStrategy::Enum bs)
{
switch(bs)
{
case PxBVHBuildStrategy::eFAST: return BVH_SPLATTER_POINTS;
case PxBVHBuildStrategy::eDEFAULT: return BVH_SPLATTER_POINTS_SPLIT_GEOM_CENTER;
case PxBVHBuildStrategy::eSAH: return BVH_SAH;
case PxBVHBuildStrategy::eLAST: return BVH_SPLATTER_POINTS;
}
return BVH_SPLATTER_POINTS;
}
static Pruner* create(PxPruningStructureType::Enum type, PxU64 contextID, PxDynamicTreeSecondaryPruner::Enum secondaryType, PxBVHBuildStrategy::Enum buildStrategy, PxU32 nbObjectsPerNode)
{
// PT: to force testing the bucket pruner
// return createBucketPruner(contextID);
// return createIncrementalPruner(contextID);
const CompanionPrunerType cpType = getCompanionType(secondaryType);
const BVHBuildStrategy bs = getBuildStrategy(buildStrategy);
Pruner* pruner = NULL;
switch(type)
{
case PxPruningStructureType::eNONE: { pruner = createBucketPruner(contextID); break; }
case PxPruningStructureType::eDYNAMIC_AABB_TREE: { pruner = createAABBPruner(contextID, true, cpType, bs, nbObjectsPerNode); break; }
case PxPruningStructureType::eSTATIC_AABB_TREE: { pruner = createAABBPruner(contextID, false, cpType, bs, nbObjectsPerNode); break; }
// PT: for tests
case PxPruningStructureType::eLAST: { pruner = createIncrementalPruner(contextID); break; }
// case PxPruningStructureType::eLAST: break;
}
return pruner;
}
static PxSceneQuerySystem* getPxSQ(const PxSceneDesc& desc, PVDCapture* pvd, PxU64 contextID)
{
if(desc.sceneQuerySystem)
{
desc.sceneQuerySystem->acquireReference();
return desc.sceneQuerySystem;
}
else
{
Pruner* staticPruner = create(desc.staticStructure, contextID, desc.dynamicTreeSecondaryPruner, desc.staticBVHBuildStrategy, desc.staticNbObjectsPerNode);
Pruner* dynamicPruner = create(desc.dynamicStructure, contextID, desc.dynamicTreeSecondaryPruner, desc.dynamicBVHBuildStrategy, desc.dynamicNbObjectsPerNode);
return PX_NEW(InternalPxSQ)(desc, pvd, contextID, staticPruner, dynamicPruner);
}
}
#if PX_SUPPORT_PVD
#define PVD_PARAM this
#else
#define PVD_PARAM NULL
#endif
NpSceneQueries::NpSceneQueries(const PxSceneDesc& desc, Vd::PvdSceneClient* pvd, PxU64 contextID) :
mSQ (getPxSQ(desc, PVD_PARAM, contextID))
#if PX_SUPPORT_PVD
// PT: warning, pvd object not created yet at this point
,mPVDClient (pvd)
,mSingleSqCollector (pvd, false)
#endif
{
PX_UNUSED(pvd);
PX_UNUSED(contextID);
}
NpSceneQueries::~NpSceneQueries()
{
if(mSQ)
{
mSQ->release();
mSQ = NULL;
}
}
void NpSceneQueries::sync(PxU32 prunerIndex, const ScPrunerHandle* handles, const PxU32* indices, const PxBounds3* bounds,
const PxTransform32* transforms, PxU32 count, const PxBitMap& ignoredIndices)
{
mSQ->sync(prunerIndex, handles, indices, bounds, transforms, count, ignoredIndices);
}
#include "NpScene.h"
// PT: TODO: eventually move NP_READ_CHECK to internal PxSQ version ?
bool NpScene::raycast(
const PxVec3& origin, const PxVec3& unitDir, const PxReal distance,
PxHitCallback<PxRaycastHit>& hits, PxHitFlags hitFlags, const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall,
const PxQueryCache* cache, PxGeometryQueryFlags flags) const
{
NP_READ_CHECK(this);
return mNpSQ.mSQ->raycast(origin, unitDir, distance, hits, hitFlags, filterData, filterCall, cache, flags);
}
bool NpScene::overlap(
const PxGeometry& geometry, const PxTransform& pose, PxOverlapCallback& hits,
const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall,
const PxQueryCache* cache, PxGeometryQueryFlags flags) const
{
NP_READ_CHECK(this);
return mNpSQ.mSQ->overlap(geometry, pose, hits, filterData, filterCall, cache, flags);
}
bool NpScene::sweep(
const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, const PxReal distance,
PxHitCallback<PxSweepHit>& hits, PxHitFlags hitFlags, const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall,
const PxQueryCache* cache, const PxReal inflation, PxGeometryQueryFlags flags) const
{
NP_READ_CHECK(this);
return mNpSQ.mSQ->sweep(geometry, pose, unitDir, distance, hits, hitFlags, filterData, filterCall, cache, inflation, flags);
}
void NpScene::setUpdateMode(PxSceneQueryUpdateMode::Enum updateMode)
{
NP_WRITE_CHECK(this);
getSQAPI().setUpdateMode(updateMode);
updatePvdProperties();
}
PxSceneQueryUpdateMode::Enum NpScene::getUpdateMode() const
{
NP_READ_CHECK(this);
return getSQAPI().getUpdateMode();
}
void NpScene::setDynamicTreeRebuildRateHint(PxU32 dynamicTreeRebuildRateHint)
{
NP_WRITE_CHECK(this);
PX_CHECK_AND_RETURN((dynamicTreeRebuildRateHint >= 4), "PxScene::setDynamicTreeRebuildRateHint(): Param has to be >= 4!");
getSQAPI().setDynamicTreeRebuildRateHint(dynamicTreeRebuildRateHint);
updatePvdProperties();
}
PxU32 NpScene::getDynamicTreeRebuildRateHint() const
{
NP_READ_CHECK(this);
return getSQAPI().getDynamicTreeRebuildRateHint();
}
void NpScene::forceRebuildDynamicTree(PxU32 prunerIndex)
{
PX_PROFILE_ZONE("API.forceDynamicTreeRebuild", getContextId());
NP_WRITE_CHECK(this);
PX_SIMD_GUARD;
getSQAPI().forceRebuildDynamicTree(prunerIndex);
}
PxU32 NpScene::getStaticTimestamp() const
{
return getSQAPI().getStaticTimestamp();
}
PxPruningStructureType::Enum NpScene::getStaticStructure() const
{
return mPrunerType[0];
}
PxPruningStructureType::Enum NpScene::getDynamicStructure() const
{
return mPrunerType[1];
}
void NpScene::flushUpdates()
{
PX_PROFILE_ZONE("API.flushQueryUpdates", getContextId());
NP_WRITE_CHECK(this);
PX_SIMD_GUARD;
getSQAPI().flushUpdates();
}
namespace
{
class SqRefFinder: public Sc::SqRefFinder
{
PX_NOCOPY(SqRefFinder)
public:
SqRefFinder(const PxSceneQuerySystem& pxsq) : mPXSQ(pxsq) {}
const PxSceneQuerySystem& mPXSQ;
virtual ScPrunerHandle find(const PxRigidBody* body, const PxShape* shape, PxU32& prunerIndex)
{
return mPXSQ.getHandle(*body, *shape, prunerIndex);
}
};
}
void NpScene::syncSQ()
{
PxSceneQuerySystem& pm = getSQAPI();
{
const PxU32 numBodies = mScene.getNumActiveCompoundBodies();
const Sc::BodyCore*const* bodies = mScene.getActiveCompoundBodiesArray();
// PT: we emulate "getGlobalPose" here by doing the equivalent matrix computation directly.
// This works because the code is the same for rigid dynamic & articulation links.
// PT: TODO: SIMD
for(PxU32 i = 0; i < numBodies; i++)
{
// PT: we don't have access to Np from here so we have to go through Px, which is a bit ugly.
// If this creates perf issues an alternative would be to just store the ID along with the body
// pointer in the active compound bodies array.
PxActor* actor = bodies[i]->getPxActor();
PX_ASSERT(actor);
const PxU32 id = static_cast<PxRigidActor*>(actor)->getInternalActorIndex();
PX_ASSERT(id!=0xffffffff);
pm.updateSQCompound(PxSQCompoundHandle(id), bodies[i]->getBody2World() * bodies[i]->getBody2Actor().getInverse());
}
}
SqRefFinder sqRefFinder(pm);
mScene.syncSceneQueryBounds(mNpSQ, sqRefFinder);
pm.finalizeUpdates();
}
void NpScene::forceSceneQueryRebuild()
{
// PT: what is this function anyway? What's the difference between this and forceDynamicTreeRebuild ? Why is the implementation different?
syncSQ();
}
void NpScene::sceneQueriesStaticPrunerUpdate(PxBaseTask* )
{
PX_PROFILE_ZONE("SceneQuery.sceneQueriesStaticPrunerUpdate", getContextId());
// run pruner build only, this will build the new tree only, no commit happens
getSQAPI().sceneQueryBuildStep(mStaticBuildStepHandle);
}
void NpScene::sceneQueriesDynamicPrunerUpdate(PxBaseTask*)
{
PX_PROFILE_ZONE("SceneQuery.sceneQueriesDynamicPrunerUpdate", getContextId());
// run pruner build only, this will build the new tree only, no commit happens
getSQAPI().sceneQueryBuildStep(mDynamicBuildStepHandle);
}
void NpScene::sceneQueriesUpdate(PxBaseTask* completionTask, bool controlSimulation)
{
PX_SIMD_GUARD;
PxSQBuildStepHandle runUpdateTasksStatic = NULL;
PxSQBuildStepHandle runUpdateTasksDynamic = NULL;
{
// write guard must end before scene queries tasks kicks off worker threads
NP_WRITE_CHECK(this);
PX_PROFILE_START_CROSSTHREAD("Basic.sceneQueriesUpdate", getContextId());
if(mSQUpdateRunning)
{
//fetchSceneQueries doesn't get called
outputError<PxErrorCode::eINVALID_OPERATION>(__LINE__, "PxScene::fetchSceneQueries was not called!");
return;
}
PxSceneQuerySystem& pxsq = getSQAPI();
// flush scene queries updates
pxsq.flushUpdates();
// prepare scene queries for build - copy bounds
runUpdateTasksStatic = pxsq.prepareSceneQueryBuildStep(PX_SCENE_PRUNER_STATIC);
runUpdateTasksDynamic = pxsq.prepareSceneQueryBuildStep(PX_SCENE_PRUNER_DYNAMIC);
mStaticBuildStepHandle = runUpdateTasksStatic;
mDynamicBuildStepHandle = runUpdateTasksDynamic;
mSQUpdateRunning = true;
}
{
PX_PROFILE_ZONE("Sim.sceneQueriesTaskSetup", getContextId());
if (controlSimulation)
{
{
PX_PROFILE_ZONE("Sim.resetDependencies", getContextId());
// Only reset dependencies, etc if we own the TaskManager. Will be false
// when an NpScene is controlled by an APEX scene.
mTaskManager->resetDependencies();
}
mTaskManager->startSimulation();
}
mSceneQueriesCompletion.setContinuation(*mTaskManager, completionTask);
if(runUpdateTasksStatic)
mSceneQueriesStaticPrunerUpdate.setContinuation(&mSceneQueriesCompletion);
if(runUpdateTasksDynamic)
mSceneQueriesDynamicPrunerUpdate.setContinuation(&mSceneQueriesCompletion);
mSceneQueriesCompletion.removeReference();
if(runUpdateTasksStatic)
mSceneQueriesStaticPrunerUpdate.removeReference();
if(runUpdateTasksDynamic)
mSceneQueriesDynamicPrunerUpdate.removeReference();
}
}
bool NpScene::checkSceneQueriesInternal(bool block)
{
PX_PROFILE_ZONE("Basic.checkSceneQueries", getContextId());
return mSceneQueriesDone.wait(block ? PxSync::waitForever : 0);
}
bool NpScene::checkQueries(bool block)
{
return checkSceneQueriesInternal(block);
}
bool NpScene::fetchQueries(bool block)
{
if(!mSQUpdateRunning)
{
//fetchSceneQueries doesn't get called
outputError<PxErrorCode::eINVALID_OPERATION>(__LINE__, "PxScene::fetchQueries: fetchQueries() called illegally! It must be called after sceneQueriesUpdate()");
return false;
}
if(!checkSceneQueriesInternal(block))
return false;
{
PX_SIMD_GUARD;
NP_WRITE_CHECK(this);
// we use cross thread profile here, to show the event in cross thread view
// PT: TODO: why do we want to show it in the cross thread view?
PX_PROFILE_START_CROSSTHREAD("Basic.fetchQueries", getContextId());
// flush updates and commit if work is done
getSQAPI().flushUpdates();
PX_PROFILE_STOP_CROSSTHREAD("Basic.fetchQueries", getContextId());
PX_PROFILE_STOP_CROSSTHREAD("Basic.sceneQueriesUpdate", getContextId());
mSceneQueriesDone.reset();
mSQUpdateRunning = false;
}
return true;
}
| 30,251 | C++ | 36.862328 | 213 | 0.747645 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/NpActor.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef NP_ACTOR_H
#define NP_ACTOR_H
#include "NpConnector.h"
#include "NpBase.h"
namespace physx
{
class NpShapeManager;
class NpAggregate;
class NpScene;
class NpShape;
const Sc::BodyCore* getBodyCore(const PxRigidActor* actor);
PX_FORCE_INLINE Sc::BodyCore* getBodyCore(PxRigidActor* actor)
{
const Sc::BodyCore* core = getBodyCore(static_cast<const PxRigidActor*>(actor));
return const_cast<Sc::BodyCore*>(core);
}
class NpActor : public NpBase
{
public:
// PX_SERIALIZATION
NpActor(const PxEMPTY) : NpBase(PxEmpty) {}
void exportExtraData(PxSerializationContext& stream);
void importExtraData(PxDeserializationContext& context);
void resolveReferences(PxDeserializationContext& context);
static void getBinaryMetaData(PxOutputStream& stream);
//~PX_SERIALIZATION
NpActor(NpType::Enum type);
void removeConstraints(PxRigidActor& owner);
void removeFromAggregate(PxActor& owner);
NpAggregate* getNpAggregate(PxU32& index) const;
void setAggregate(NpAggregate* np, PxActor& owner);
PxAggregate* getAggregate() const;
void scSetDominanceGroup(PxDominanceGroup v);
void scSetOwnerClient(PxClientID inId);
void removeConstraintsFromScene();
PX_FORCE_INLINE void addConstraintsToScene() // inline the fast path for addActors()
{
if(mConnectorArray)
addConstraintsToSceneInternal();
}
PxU32 findConnector(NpConnectorType::Enum type, PxBase* object) const;
void addConnector(NpConnectorType::Enum type, PxBase* object, const char* errMsg);
void removeConnector(PxActor& owner, NpConnectorType::Enum type, PxBase* object, const char* errorMsg);
PxU32 getNbConnectors(NpConnectorType::Enum type) const;
static NpShapeManager* getShapeManager_(PxRigidActor& actor); // bit misplaced here, but we don't want a separate subclass just for this
static const NpShapeManager* getShapeManager_(const PxRigidActor& actor); // bit misplaced here, but we don't want a separate subclass just for this
static NpActor& getFromPxActor(PxActor& actor) { return *PxPointerOffset<NpActor*>(&actor, ptrdiff_t(sOffsets.pxActorToNpActor[actor.getConcreteType()])); }
static const NpActor& getFromPxActor(const PxActor& actor) { return *PxPointerOffset<const NpActor*>(&actor, ptrdiff_t(sOffsets.pxActorToNpActor[actor.getConcreteType()])); }
const PxActor* getPxActor() const;
static NpScene* getNpSceneFromActor(const PxActor& actor)
{
return getFromPxActor(actor).getNpScene();
}
PX_FORCE_INLINE NpConnectorIterator getConnectorIterator(NpConnectorType::Enum type)
{
if (mConnectorArray)
return NpConnectorIterator(&mConnectorArray->front(), mConnectorArray->size(), type);
else
return NpConnectorIterator(NULL, 0, type);
}
static void onActorRelease(PxActor* actor);
template<typename T> PxU32 getConnectors(NpConnectorType::Enum type, T** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const
{
PxU32 nbConnectors = 0;
if(mConnectorArray)
{
for(PxU32 i=0; i<mConnectorArray->size(); i++)
{
NpConnector& c = (*mConnectorArray)[i];
if(c.mType == type && nbConnectors < bufferSize && i>=startIndex)
userBuffer[nbConnectors++] = static_cast<T*>(c.mObject);
}
}
return nbConnectors;
}
PX_INLINE PxActorFlags getActorFlags() const { return getActorCore().getActorFlags(); }
PX_INLINE PxDominanceGroup getDominanceGroup() const { return getActorCore().getDominanceGroup(); }
PX_INLINE PxClientID getOwnerClient() const { return getActorCore().getOwnerClient(); }
PX_INLINE void scSetActorFlags(PxActorFlags v)
{
PX_ASSERT(!isAPIWriteForbidden());
// PT: TODO: move this check out of here, they should be done in Np!
#if PX_CHECKED
const PxActorFlags aFlags = getActorFlags();
const NpType::Enum npType = getNpType();
if((!aFlags.isSet(PxActorFlag::eDISABLE_SIMULATION)) && v.isSet(PxActorFlag::eDISABLE_SIMULATION) &&
(npType != NpType::eBODY) && (npType != NpType::eRIGID_STATIC))
{
PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL,
"PxActor::setActorFlag: PxActorFlag::eDISABLE_SIMULATION is only supported by PxRigidDynamic and PxRigidStatic objects.");
}
#endif
getActorCore().setActorFlags(v);
UPDATE_PVD_PROPERTY
}
PX_FORCE_INLINE const Sc::ActorCore& getActorCore() const
{
return *reinterpret_cast<const Sc::ActorCore*>(size_t(this) + sNpOffsets.npToSc[getNpType()]);
}
PX_FORCE_INLINE Sc::ActorCore& getActorCore()
{
return *reinterpret_cast<Sc::ActorCore*>(size_t(this) + sNpOffsets.npToSc[getNpType()]);
}
PX_INLINE const Sc::RigidCore& getScRigidCore() const
{
return static_cast<const Sc::RigidCore&>(getActorCore());
}
PX_INLINE Sc::RigidCore& getScRigidCore()
{
return static_cast<Sc::RigidCore&>(getActorCore());
}
PX_FORCE_INLINE void scSwitchToNoSim()
{
NpScene* scene = getNpScene();
if(scene && (!scene->isAPIWriteForbidden()))
scene->scSwitchRigidToNoSim(*this);
}
PX_FORCE_INLINE void scSwitchFromNoSim()
{
NpScene* scene = getNpScene();
if(scene && (!scene->isAPIWriteForbidden()))
scene->scSwitchRigidFromNoSim(*this);
}
protected:
~NpActor() {}
const char* mName;
// Lazy-create array for connector objects like constraints, observers, ...
// Most actors have no such objects, so we bias this class accordingly:
NpConnectorArray* mConnectorArray;
private:
void addConstraintsToSceneInternal();
void removeConnector(PxActor& owner, PxU32 index);
struct Offsets
{
size_t pxActorToNpActor[PxConcreteType::ePHYSX_CORE_COUNT];
Offsets();
};
public:
static const Offsets sOffsets;
struct NpOffsets
{
size_t npToSc[NpType::eTYPE_COUNT];
NpOffsets();
};
static const NpOffsets sNpOffsets;
};
}
#endif
| 8,230 | C | 39.348039 | 179 | 0.669623 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/NpPhysics.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef NP_PHYSICS_H
#define NP_PHYSICS_H
#include "PxPhysics.h"
#include "foundation/PxUserAllocated.h"
#include "foundation/PxHashSet.h"
#include "foundation/PxHashMap.h"
#include "GuMeshFactory.h"
#include "NpMaterial.h"
#include "NpFEMSoftBodyMaterial.h"
#include "NpFEMClothMaterial.h"
#include "NpPBDMaterial.h"
#include "NpFLIPMaterial.h"
#include "NpMPMMaterial.h"
#include "NpPhysicsInsertionCallback.h"
#include "NpMaterialManager.h"
#include "ScPhysics.h"
#ifdef LINUX
#include <string.h>
#endif
#if PX_SUPPORT_GPU_PHYSX
#include "device/PhysXIndicator.h"
#endif
#include "PsPvd.h"
#if PX_SUPPORT_OMNI_PVD
class OmniPvdPxSampler;
namespace physx
{
class PxOmniPvd;
}
#endif
namespace physx
{
#if PX_SUPPORT_PVD
namespace Vd
{
class PvdPhysicsClient;
}
#endif
struct NpMaterialIndexTranslator
{
NpMaterialIndexTranslator() : indicesNeedTranslation(false) {}
PxHashMap<PxU16, PxU16> map;
bool indicesNeedTranslation;
};
class NpScene;
struct PxvOffsetTable;
#if PX_VC
#pragma warning(push)
#pragma warning(disable:4996) // We have to implement deprecated member functions, do not warn.
#endif
template <typename T> class NpMaterialAccessor;
class NpPhysics : public PxPhysics, public PxUserAllocated
{
PX_NOCOPY(NpPhysics)
struct NpDelListenerEntry : public PxUserAllocated
{
NpDelListenerEntry(const PxDeletionEventFlags& de, bool restrictedObjSet)
: flags(de)
, restrictedObjectSet(restrictedObjSet)
{
}
PxHashSet<const PxBase*> registeredObjects; // specifically registered objects for deletion events
PxDeletionEventFlags flags;
bool restrictedObjectSet;
};
NpPhysics( const PxTolerancesScale& scale,
const PxvOffsetTable& pxvOffsetTable,
bool trackOutstandingAllocations,
physx::pvdsdk::PsPvd* pvd,
PxFoundation&,
physx::PxOmniPvd* omniPvd);
virtual ~NpPhysics();
public:
static NpPhysics* createInstance( PxU32 version,
PxFoundation& foundation,
const PxTolerancesScale& scale,
bool trackOutstandingAllocations,
physx::pvdsdk::PsPvd* pvd,
physx::PxOmniPvd* omniPvd);
static PxU32 releaseInstance();
static NpPhysics& getInstance() { return *mInstance; }
virtual void release() PX_OVERRIDE;
virtual PxOmniPvd* getOmniPvd() PX_OVERRIDE;
virtual PxScene* createScene(const PxSceneDesc&) PX_OVERRIDE;
void releaseSceneInternal(PxScene&);
virtual PxU32 getNbScenes() const PX_OVERRIDE;
virtual PxU32 getScenes(PxScene** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE;
virtual PxRigidStatic* createRigidStatic(const PxTransform&) PX_OVERRIDE;
virtual PxRigidDynamic* createRigidDynamic(const PxTransform&) PX_OVERRIDE;
virtual PxArticulationReducedCoordinate* createArticulationReducedCoordinate() PX_OVERRIDE;
virtual PxSoftBody* createSoftBody(PxCudaContextManager& cudaContextManager) PX_OVERRIDE;
virtual PxHairSystem* createHairSystem(PxCudaContextManager& cudaContextManager) PX_OVERRIDE;
virtual PxFEMCloth* createFEMCloth(PxCudaContextManager& cudaContextManager) PX_OVERRIDE;
virtual PxPBDParticleSystem* createPBDParticleSystem(PxCudaContextManager& cudaContextManager, PxU32 maxNeighborhood) PX_OVERRIDE;
virtual PxFLIPParticleSystem* createFLIPParticleSystem(PxCudaContextManager& cudaContextManager) PX_OVERRIDE;
virtual PxMPMParticleSystem* createMPMParticleSystem(PxCudaContextManager& cudaContextManager) PX_OVERRIDE;
virtual PxConstraint* createConstraint(PxRigidActor* actor0, PxRigidActor* actor1, PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize) PX_OVERRIDE;
virtual PxAggregate* createAggregate(PxU32 maxActors, PxU32 maxShapes, PxAggregateFilterHint filterHint) PX_OVERRIDE;
virtual PxShape* createShape(const PxGeometry&, PxMaterial*const *, PxU16, bool, PxShapeFlags shapeFlags) PX_OVERRIDE;
virtual PxShape* createShape(const PxGeometry&, PxFEMSoftBodyMaterial*const *, PxU16, bool, PxShapeFlags shapeFlags) PX_OVERRIDE;
virtual PxShape* createShape(const PxGeometry&, PxFEMClothMaterial*const *, PxU16, bool, PxShapeFlags shapeFlags) PX_OVERRIDE;
virtual PxU32 getNbShapes() const PX_OVERRIDE;
virtual PxU32 getShapes(PxShape** userBuffer, PxU32 bufferSize, PxU32 startIndex) const PX_OVERRIDE;
virtual PxMaterial* createMaterial(PxReal staticFriction, PxReal dynamicFriction, PxReal restitution) PX_OVERRIDE;
virtual PxU32 getNbMaterials() const PX_OVERRIDE;
virtual PxU32 getMaterials(PxMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE;
virtual PxFEMSoftBodyMaterial* createFEMSoftBodyMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction) PX_OVERRIDE;
virtual PxU32 getNbFEMSoftBodyMaterials() const PX_OVERRIDE;
virtual PxU32 getFEMSoftBodyMaterials(PxFEMSoftBodyMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE;
virtual PxFEMClothMaterial* createFEMClothMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction, PxReal thickness) PX_OVERRIDE;
virtual PxU32 getNbFEMClothMaterials() const PX_OVERRIDE;
virtual PxU32 getFEMClothMaterials(PxFEMClothMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE;
virtual PxPBDMaterial* createPBDMaterial(PxReal friction, PxReal damping, PxReal adhesion, PxReal viscosity, PxReal vorticityConfinement, PxReal surfaceTension, PxReal cohesion, PxReal lift, PxReal drag, PxReal cflCoefficient, PxReal gravityScale) PX_OVERRIDE;
virtual PxU32 getNbPBDMaterials() const PX_OVERRIDE;
virtual PxU32 getPBDMaterials(PxPBDMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE;
virtual PxFLIPMaterial* createFLIPMaterial(PxReal friction, PxReal damping, PxReal maxVelocity, PxReal viscosity, PxReal gravityScale) PX_OVERRIDE;
virtual PxU32 getNbFLIPMaterials() const PX_OVERRIDE;
virtual PxU32 getFLIPMaterials(PxFLIPMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE;
virtual PxMPMMaterial* createMPMMaterial(PxReal friction, PxReal damping, PxReal maxVelocity, bool isPlastic, PxReal youngsModulus, PxReal poissons, PxReal hardening, PxReal criticalCompression, PxReal criticalStretch, PxReal tensileDamageSensitivity, PxReal compressiveDamageSensitivity, PxReal attractiveForceResidual, PxReal gravityScale) PX_OVERRIDE;
virtual PxU32 getNbMPMMaterials() const PX_OVERRIDE;
virtual PxU32 getMPMMaterials(PxMPMMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE;
virtual PxTriangleMesh* createTriangleMesh(PxInputStream&) PX_OVERRIDE;
virtual PxU32 getNbTriangleMeshes() const PX_OVERRIDE;
virtual PxU32 getTriangleMeshes(PxTriangleMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE;
virtual PxTetrahedronMesh* createTetrahedronMesh(PxInputStream&) PX_OVERRIDE;
virtual PxU32 getNbTetrahedronMeshes() const PX_OVERRIDE;
virtual PxU32 getTetrahedronMeshes(PxTetrahedronMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE;
virtual PxSoftBodyMesh* createSoftBodyMesh(PxInputStream&) PX_OVERRIDE;
virtual PxHeightField* createHeightField(PxInputStream& stream) PX_OVERRIDE;
virtual PxU32 getNbHeightFields() const PX_OVERRIDE;
virtual PxU32 getHeightFields(PxHeightField** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE;
virtual PxConvexMesh* createConvexMesh(PxInputStream&) PX_OVERRIDE;
virtual PxU32 getNbConvexMeshes() const PX_OVERRIDE;
virtual PxU32 getConvexMeshes(PxConvexMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE;
virtual PxBVH* createBVH(PxInputStream&) PX_OVERRIDE;
virtual PxU32 getNbBVHs() const PX_OVERRIDE;
virtual PxU32 getBVHs(PxBVH** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE;
virtual PxParticleBuffer* createParticleBuffer(PxU32 maxParticles, PxU32 maxVolumes, PxCudaContextManager* cudaContextManager) PX_OVERRIDE;
virtual PxParticleAndDiffuseBuffer* createParticleAndDiffuseBuffer(PxU32 maxParticles, PxU32 maxVolumes, PxU32 maxDiffuseParticles, PxCudaContextManager* cudaContextManager) PX_OVERRIDE;
virtual PxParticleClothBuffer* createParticleClothBuffer(PxU32 maxParticles, PxU32 maxNumVolumes, PxU32 maxNumCloths, PxU32 maxNumTriangles, PxU32 maxNumSprings, PxCudaContextManager* cudaContextManager) PX_OVERRIDE;
virtual PxParticleRigidBuffer* createParticleRigidBuffer(PxU32 maxParticles, PxU32 maxNumVolumes, PxU32 maxNumRigids, PxCudaContextManager* cudaContextManager) PX_OVERRIDE;
#if PX_SUPPORT_GPU_PHYSX
void registerPhysXIndicatorGpuClient();
void unregisterPhysXIndicatorGpuClient();
#else
PX_FORCE_INLINE void registerPhysXIndicatorGpuClient() {}
PX_FORCE_INLINE void unregisterPhysXIndicatorGpuClient() {}
#endif
virtual PxPruningStructure* createPruningStructure(PxRigidActor*const* actors, PxU32 nbActors) PX_OVERRIDE;
virtual const PxTolerancesScale& getTolerancesScale() const PX_OVERRIDE;
virtual PxFoundation& getFoundation() PX_OVERRIDE;
PX_INLINE NpScene* getScene(PxU32 i) const { return mSceneArray[i]; }
PX_INLINE PxU32 getNumScenes() const { return mSceneArray.size(); }
virtual void registerDeletionListener(PxDeletionListener& observer, const PxDeletionEventFlags& deletionEvents, bool restrictedObjectSet) PX_OVERRIDE;
virtual void unregisterDeletionListener(PxDeletionListener& observer) PX_OVERRIDE;
virtual void registerDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount) PX_OVERRIDE;
virtual void unregisterDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount) PX_OVERRIDE;
void notifyDeletionListeners(const PxBase*, void* userData, PxDeletionEventFlag::Enum deletionEvent);
PX_FORCE_INLINE void notifyDeletionListenersUserRelease(const PxBase* b, void* userData) { notifyDeletionListeners(b, userData, PxDeletionEventFlag::eUSER_RELEASE); }
PX_FORCE_INLINE void notifyDeletionListenersMemRelease(const PxBase* b, void* userData) { notifyDeletionListeners(b, userData, PxDeletionEventFlag::eMEMORY_RELEASE); }
virtual PxInsertionCallback& getPhysicsInsertionCallback() PX_OVERRIDE { return mObjectInsertion; }
bool sendMaterialTable(NpScene&);
NpMaterialManager<NpMaterial>& getMaterialManager() { return mMasterMaterialManager; }
#if PX_SUPPORT_GPU_PHYSX
NpMaterialManager<NpFEMSoftBodyMaterial>& getFEMSoftBodyMaterialManager() { return mMasterFEMSoftBodyMaterialManager; }
NpMaterialManager<NpPBDMaterial>& getPBDMaterialManager() { return mMasterPBDMaterialManager; }
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
NpMaterialManager<NpFEMClothMaterial>& getFEMClothMaterialManager() { return mMasterFEMClothMaterialManager; }
NpMaterialManager<NpFLIPMaterial>& getFLIPMaterialManager() { return mMasterFLIPMaterialManager; }
NpMaterialManager<NpMPMMaterial>& getMPMMaterialManager() { return mMasterMPMMaterialManager; }
#endif
#endif
NpMaterial* addMaterial(NpMaterial* np);
void removeMaterialFromTable(NpMaterial&);
void updateMaterial(NpMaterial&);
#if PX_SUPPORT_GPU_PHYSX
NpFEMSoftBodyMaterial* addMaterial(NpFEMSoftBodyMaterial* np);
void removeMaterialFromTable(NpFEMSoftBodyMaterial&);
void updateMaterial(NpFEMSoftBodyMaterial&);
NpPBDMaterial* addMaterial(NpPBDMaterial* np);
void removeMaterialFromTable(NpPBDMaterial&);
void updateMaterial(NpPBDMaterial&);
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
NpFEMClothMaterial* addMaterial(NpFEMClothMaterial* np);
void removeMaterialFromTable(NpFEMClothMaterial&);
void updateMaterial(NpFEMClothMaterial&);
NpFLIPMaterial* addMaterial(NpFLIPMaterial* np);
void removeMaterialFromTable(NpFLIPMaterial&);
void updateMaterial(NpFLIPMaterial&);
NpMPMMaterial* addMaterial(NpMPMMaterial* np);
void removeMaterialFromTable(NpMPMMaterial&);
void updateMaterial(NpMPMMaterial&);
#endif
#endif
static void initOffsetTables(PxvOffsetTable& pxvOffsetTable);
static bool apiReentryLock;
#if PX_SUPPORT_OMNI_PVD
OmniPvdPxSampler* mOmniPvdSampler;
PxOmniPvd* mOmniPvd;
#endif
private:
typedef PxCoalescedHashMap<PxDeletionListener*, NpDelListenerEntry*> DeletionListenerMap;
PxArray<NpScene*> mSceneArray;
Sc::Physics mPhysics;
NpMaterialManager<NpMaterial> mMasterMaterialManager;
#if PX_SUPPORT_GPU_PHYSX
NpMaterialManager<NpFEMSoftBodyMaterial> mMasterFEMSoftBodyMaterialManager;
NpMaterialManager<NpPBDMaterial> mMasterPBDMaterialManager;
#endif
NpPhysicsInsertionCallback mObjectInsertion;
struct MeshDeletionListener: public Gu::MeshFactoryListener
{
void onMeshFactoryBufferRelease(const PxBase* object, PxType type)
{
PX_UNUSED(type);
NpPhysics::getInstance().notifyDeletionListeners(object, NULL, PxDeletionEventFlag::eMEMORY_RELEASE);
}
};
PxMutex mDeletionListenerMutex;
DeletionListenerMap mDeletionListenerMap;
MeshDeletionListener mDeletionMeshListener;
bool mDeletionListenersExist;
PxMutex mSceneAndMaterialMutex; // guarantees thread safety for API calls related to scene and material containers
PxFoundation& mFoundation;
#if PX_SUPPORT_GPU_PHYSX
PhysXIndicator mPhysXIndicator;
PxU32 mNbRegisteredGpuClients;
PxMutex mPhysXIndicatorMutex;
#endif
#if PX_SUPPORT_PVD
physx::pvdsdk::PsPvd* mPvd;
Vd::PvdPhysicsClient* mPvdPhysicsClient;
#endif
static PxU32 mRefCount;
static NpPhysics* mInstance;
friend class NpCollection;
#if PX_SUPPORT_OMNI_PVD
public:
class OmniPvdListener : public physx::NpFactoryListener
{
public:
virtual void onMeshFactoryBufferRelease(const PxBase*, PxType) {}
virtual void onObjectAdd(const PxBase*);
virtual void onObjectRemove(const PxBase*);
}
mOmniPvdListener;
private:
#endif
// GW: these must be the last defined members for now. Otherwise it appears to mess up the offsets
// expected when linking SDK dlls against unit tests due to differing values of PX_ENABLE_FEATURES_UNDER_CONSTRUCTION...
// this warrants further investigation and hopefully a better solution
#if PX_SUPPORT_GPU_PHYSX
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
NpMaterialManager<NpFEMClothMaterial> mMasterFEMClothMaterialManager;
NpMaterialManager<NpFLIPMaterial> mMasterFLIPMaterialManager;
NpMaterialManager<NpMPMMaterial> mMasterMPMMaterialManager;
#endif
#endif
};
template <> class NpMaterialAccessor<NpMaterial>
{
public:
static NpMaterialManager<NpMaterial>& getMaterialManager(NpPhysics& physics)
{
return physics.getMaterialManager();
}
};
#if PX_SUPPORT_GPU_PHYSX
template <> class NpMaterialAccessor<NpFEMSoftBodyMaterial>
{
public:
static NpMaterialManager<NpFEMSoftBodyMaterial>& getMaterialManager(NpPhysics& physics)
{
return physics.getFEMSoftBodyMaterialManager();
}
};
template <> class NpMaterialAccessor<NpPBDMaterial>
{
public:
static NpMaterialManager<NpPBDMaterial>& getMaterialManager(NpPhysics& physics)
{
return physics.getPBDMaterialManager();
}
};
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
template <> class NpMaterialAccessor<NpFEMClothMaterial>
{
public:
static NpMaterialManager<NpFEMClothMaterial>& getMaterialManager(NpPhysics& physics)
{
return physics.getFEMClothMaterialManager();
}
};
template <> class NpMaterialAccessor<NpFLIPMaterial>
{
public:
static NpMaterialManager<NpFLIPMaterial>& getMaterialManager(NpPhysics& physics)
{
return physics.getFLIPMaterialManager();
}
};
template <> class NpMaterialAccessor<NpMPMMaterial>
{
public:
static NpMaterialManager<NpMPMMaterial>& getMaterialManager(NpPhysics& physics)
{
return physics.getMPMMaterialManager();
}
};
#endif
#endif
#if PX_VC
#pragma warning(pop)
#endif
}
#endif
| 18,160 | C | 42.035545 | 359 | 0.77109 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/NpArticulationReducedCoordinate.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "NpArticulationReducedCoordinate.h"
#include "NpArticulationTendon.h"
#include "NpArticulationSensor.h"
#include "DyFeatherstoneArticulation.h"
#include "ScArticulationSim.h"
#include "ScConstraintSim.h"
#include "foundation/PxAlignedMalloc.h"
#include "foundation/PxPool.h"
#include "PxPvdDataStream.h"
#include "NpAggregate.h"
#include "omnipvd/NpOmniPvdSetData.h"
using namespace physx;
void PxArticulationCache::release()
{
PxcScratchAllocator* scratchAlloc = reinterpret_cast<PxcScratchAllocator*>(scratchAllocator);
PX_DELETE(scratchAlloc);
scratchAllocator = NULL;
PX_FREE(scratchMemory);
PX_FREE_THIS;
}
// PX_SERIALIZATION
NpArticulationReducedCoordinate* NpArticulationReducedCoordinate::createObject(PxU8*& address, PxDeserializationContext& context)
{
NpArticulationReducedCoordinate* obj = PX_PLACEMENT_NEW(address, NpArticulationReducedCoordinate(PxBaseFlag::eIS_RELEASABLE));
address += sizeof(NpArticulationReducedCoordinate);
obj->importExtraData(context);
obj->resolveReferences(context);
return obj;
}
void NpArticulationReducedCoordinate::preExportDataReset()
{
//for now, no support for loop joint serialization
PxArray<NpConstraint*> emptyLoopJoints;
PxMemCopy(&mLoopJoints, &emptyLoopJoints, sizeof(PxArray<NpConstraint*>));
}
//~PX_SERIALIZATION
NpArticulationReducedCoordinate::NpArticulationReducedCoordinate()
: PxArticulationReducedCoordinate(PxConcreteType::eARTICULATION_REDUCED_COORDINATE, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE),
NpBase(NpType::eARTICULATION), mNumShapes(0), mAggregate(NULL), mName(NULL), mCacheVersion(0), mTopologyChanged(false)
{
}
void NpArticulationReducedCoordinate::setArticulationFlags(PxArticulationFlags flags)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::setArticulationFlags() not allowed while simulation is running. Call will be ignored.");
scSetArticulationFlags(flags);
OMNI_PVD_SET(OMNI_PVD_CONTEXT_HANDLE, PxArticulationReducedCoordinate, articulationFlags, static_cast<const PxArticulationReducedCoordinate&>(*this), flags);
}
void NpArticulationReducedCoordinate::setArticulationFlag(PxArticulationFlag::Enum flag, bool value)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::setArticulationFlag() not allowed while simulation is running. Call will be ignored.");
PxArticulationFlags flags = mCore.getArticulationFlags();
if(value)
flags |= flag;
else
flags &= (~flag);
scSetArticulationFlags(flags);
OMNI_PVD_SET(OMNI_PVD_CONTEXT_HANDLE, PxArticulationReducedCoordinate, articulationFlags, static_cast<const PxArticulationReducedCoordinate&>(*this), flags);
}
PxArticulationFlags NpArticulationReducedCoordinate::getArticulationFlags() const
{
NP_READ_CHECK(getNpScene());
return mCore.getArticulationFlags();
}
PxU32 NpArticulationReducedCoordinate::getDofs() const
{
NP_READ_CHECK(getNpScene());
// core will check if in scene and return 0xFFFFFFFF if not.
return mCore.getDofs();
}
PxArticulationCache* NpArticulationReducedCoordinate::createCache() const
{
NP_READ_CHECK(getNpScene()); // doesn't modify the scene, only reads
PX_CHECK_AND_RETURN_NULL(getNpScene(), "PxArticulationReducedCoordinate::createCache: Articulation must be in a scene.");
PxArticulationCache* cache = mCore.createCache();
if (cache)
cache->version = mCacheVersion;
return cache;
}
PxU32 NpArticulationReducedCoordinate::getCacheDataSize() const
{
NP_READ_CHECK(getNpScene()); // doesn't modify the scene, only reads
// core will check if in scene and return 0xFFFFFFFF if not.
return mCore.getCacheDataSize();
}
void NpArticulationReducedCoordinate::zeroCache(PxArticulationCache& cache) const
{
NP_READ_CHECK(getNpScene()); // doesn't modify the scene, only reads
PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::zeroCache: Articulation must be in a scene.");
// need to check cache version as correct cache size is required for zeroing
PX_CHECK_AND_RETURN(cache.version == mCacheVersion, "PxArticulationReducedCoordinate::zeroCache: cache is invalid, articulation configuration has changed! ");
return mCore.zeroCache(cache);
}
void NpArticulationReducedCoordinate::applyCache(PxArticulationCache& cache, const PxArticulationCacheFlags flags, bool autowake)
{
PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::applyCache: Articulation must be in a scene.");
PX_CHECK_AND_RETURN(cache.version == mCacheVersion, "PxArticulationReducedCoordinate::applyCache: cache is invalid, articulation configuration has changed! ");
PX_CHECK_AND_RETURN(!(getScene()->getFlags() & PxSceneFlag::eENABLE_DIRECT_GPU_API), "PxArticulationReducedCoordinate::applyCache : it is illegal to call this method if PxSceneFlag::eENABLE_DIRECT_GPU_API is enabled!");
//if we try to do a bulk op when sim is running, return with error
if (getNpScene()->getSimulationStage() != Sc::SimulationStage::eCOMPLETE)
{
PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL,
"PxArticulationReducedCoordinate::applyCache() not allowed while simulation is running. Call will be ignored.");
return;
}
if (!(getScene()->getFlags() & PxSceneFlag::eENABLE_DIRECT_GPU_API))
{
const bool forceWake = mCore.applyCache(cache, flags);
if (flags & (PxArticulationCacheFlag::ePOSITION | PxArticulationCacheFlag::eROOT_TRANSFORM))
{
const PxU32 linkCount = mArticulationLinks.size();
//KS - the below code forces contact managers to be updated/cached data to be dropped and
//shape transforms to be updated.
for (PxU32 i = 0; i < linkCount; ++i)
{
NpArticulationLink* link = mArticulationLinks[i];
//in the lowlevel articulation, we have already updated bodyCore's body2World
const PxTransform internalPose = link->getCore().getBody2World();
link->scSetBody2World(internalPose);
}
}
wakeUpInternal(forceWake, autowake);
}
}
void NpArticulationReducedCoordinate::copyInternalStateToCache(PxArticulationCache& cache, const PxArticulationCacheFlags flags) const
{
PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::copyInternalStateToCache: Articulation must be in a scene.");
PX_CHECK_AND_RETURN(cache.version == mCacheVersion, "PxArticulationReducedCoordinate::copyInternalStateToCache: cache is invalid, articulation configuration has changed! ");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::copyInternalStateToCache() not allowed while simulation is running. Call will be ignored.");
PX_CHECK_AND_RETURN(!(getScene()->getFlags() & PxSceneFlag::eENABLE_DIRECT_GPU_API), "PxArticulationReducedCoordinate::copyInternalStateToCache : it is illegal to call this method if PxSceneFlag::eENABLE_DIRECT_GPU_API is enabled!");
const bool isGpuSimEnabled = getNpScene()->getFlags() & PxSceneFlag::eENABLE_GPU_DYNAMICS;
mCore.copyInternalStateToCache(cache, flags, isGpuSimEnabled);
}
void NpArticulationReducedCoordinate::packJointData(const PxReal* maximum, PxReal* reduced) const
{
NP_READ_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::packJointData: Articulation must be in a scene.");
mCore.packJointData(maximum, reduced);
}
void NpArticulationReducedCoordinate::unpackJointData(const PxReal* reduced, PxReal* maximum) const
{
NP_READ_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::unpackJointData: Articulation must be in a scene.");
mCore.unpackJointData(reduced, maximum);
}
void NpArticulationReducedCoordinate::commonInit() const
{
NP_READ_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::commonInit: Articulation must be in a scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::commonInit() not allowed while simulation is running. Call will be ignored.");
mCore.commonInit();
}
void NpArticulationReducedCoordinate::computeGeneralizedGravityForce(PxArticulationCache& cache) const
{
NP_READ_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::computeGeneralizedGravityForce: Articulation must be in a scene.");
PX_CHECK_AND_RETURN(cache.version ==mCacheVersion, "PxArticulationReducedCoordinate::computeGeneralizedGravityForce: cache is invalid, articulation configuration has changed! ");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::computeGeneralizedGravityForce() not allowed while simulation is running. Call will be ignored.");
mCore.computeGeneralizedGravityForce(cache);
}
void NpArticulationReducedCoordinate::computeCoriolisAndCentrifugalForce(PxArticulationCache& cache) const
{
NP_READ_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::computeCoriolisAndCentrifugalForce: Articulation must be in a scene.");
PX_CHECK_AND_RETURN(cache.version == mCacheVersion, "PxArticulationReducedCoordinate::computeCoriolisAndCentrifugalForce: cache is invalid, articulation configuration has changed! ");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::computeCoriolisAndCentrifugalForce() not allowed while simulation is running. Call will be ignored.");
mCore.computeCoriolisAndCentrifugalForce(cache);
}
void NpArticulationReducedCoordinate::computeGeneralizedExternalForce(PxArticulationCache& cache) const
{
NP_READ_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::computeGeneralizedExternalForce: Articulation must be in a scene.");
PX_CHECK_AND_RETURN(cache.version == mCacheVersion, "PxArticulationReducedCoordinate::computeGeneralizedExternalForce: cache is invalid, articulation configuration has changed! ");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::computeGeneralizedExternalForce() not allowed while simulation is running. Call will be ignored.");
mCore.computeGeneralizedExternalForce(cache);
}
void NpArticulationReducedCoordinate::computeJointAcceleration(PxArticulationCache& cache) const
{
NP_READ_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::computeJointAcceleration: Articulation must be in a scene.");
PX_CHECK_AND_RETURN(cache.version == mCacheVersion, "PxArticulationReducedCoordinate::computeJointAcceleration: cache is invalid, articulation configuration has changed! ");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::computeJointAcceleration() not allowed while simulation is running. Call will be ignored.");
mCore.computeJointAcceleration(cache);
}
void NpArticulationReducedCoordinate::computeJointForce(PxArticulationCache& cache) const
{
NP_READ_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::computeJointForce: Articulation must be in a scene.");
PX_CHECK_AND_RETURN(cache.version == mCacheVersion, "PxArticulationReducedCoordinate::computeJointForce: cache is invalid, articulation configuration has changed! ");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::computeJointForce() not allowed while simulation is running. Call will be ignored.");
mCore.computeJointForce(cache);
}
void NpArticulationReducedCoordinate::computeDenseJacobian(PxArticulationCache& cache, PxU32& nRows, PxU32& nCols) const
{
NP_READ_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::computeDenseJacobian: Articulation must be in a scene.");
PX_CHECK_AND_RETURN(cache.version == mCacheVersion, "PxArticulationReducedCoordinate::computeDenseJacobian: cache is invalid, articulation configuration has changed! ");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::computeDenseJacobian() not allowed while simulation is running. Call will be ignored.");
mCore.computeDenseJacobian(cache, nRows, nCols);
}
void NpArticulationReducedCoordinate::computeCoefficientMatrix(PxArticulationCache& cache) const
{
NpScene* npScene = getNpScene();
NP_READ_CHECK(npScene);
PX_CHECK_AND_RETURN(npScene, "PxArticulationReducedCoordinate::computeCoefficientMatrix: Articulation must be in a scene.");
PX_CHECK_AND_RETURN(cache.version == mCacheVersion, "PxArticulationReducedCoordinate::computeCoefficientMatrix: cache is invalid, articulation configuration has changed! ");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxArticulationReducedCoordinate::computeCoefficientMatrix() not allowed while simulation is running. Call will be ignored.");
npScene->updateConstants(mLoopJoints);
mCore.computeCoefficientMatrix(cache);
}
bool NpArticulationReducedCoordinate::computeLambda(PxArticulationCache& cache, PxArticulationCache& initialState, const PxReal* const jointTorque, const PxU32 maxIter) const
{
if (!getNpScene())
return PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, PX_FL,
"PxArticulationReducedCoordinate::computeLambda: Articulation must be in a scene.");
NP_READ_CHECK(getNpScene());
PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "PxArticulationReducedCoordinate::computeLambda() not allowed while simulation is running. Call will be ignored.", false);
if (cache.version != mCacheVersion)
return PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, PX_FL,
"PxArticulationReducedCoordinate::computeLambda: cache is invalid, articulation configuration has changed!");
return mCore.computeLambda(cache, initialState, jointTorque, getScene()->getGravity(), maxIter);
}
void NpArticulationReducedCoordinate::computeGeneralizedMassMatrix(PxArticulationCache& cache) const
{
NP_READ_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::computeGeneralizedMassMatrix: Articulation must be in a scene.");
PX_CHECK_AND_RETURN(cache.version == mCacheVersion, "PxArticulationReducedCoordinate::computeGeneralizedMassMatrix: cache is invalid, articulation configuration has changed!");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::computeGeneralizedMassMatrix() not allowed while simulation is running. Call will be ignored.");
mCore.computeGeneralizedMassMatrix(cache);
}
void NpArticulationReducedCoordinate::addLoopJoint(PxConstraint* joint)
{
NP_WRITE_CHECK(getNpScene());
#if PX_CHECKED
PxRigidActor* actor0;
PxRigidActor* actor1;
joint->getActors(actor0, actor1);
PxArticulationLink* link0 = NULL;
PxArticulationLink* link1 = NULL;
if(actor0 && actor0->getConcreteType()==PxConcreteType::eARTICULATION_LINK)
link0 = static_cast<PxArticulationLink*>(actor0);
if(actor1 && actor1->getConcreteType()==PxConcreteType::eARTICULATION_LINK)
link1 = static_cast<PxArticulationLink*>(actor1);
PX_CHECK_AND_RETURN((link0 || link1), "PxArticulationReducedCoordinate::addLoopJoint : at least one of the PxRigidActors need to be PxArticulationLink!");
PxArticulationReducedCoordinate* base0 = NULL;
PxArticulationReducedCoordinate* base1 = NULL;
if (link0)
base0 = &link0->getArticulation();
if (link1)
base1 = &link1->getArticulation();
PX_CHECK_AND_RETURN((base0 == this || base1 == this), "PxArticulationReducedCoordinate::addLoopJoint : at least one of the PxArticulationLink belongs to this articulation!");
#endif
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::addLoopJoint() not allowed while simulation is running. Call will be ignored.")
const PxU32 size = mLoopJoints.size();
if (size >= mLoopJoints.capacity())
mLoopJoints.reserve(size * 2 + 1);
NpConstraint* constraint = static_cast<NpConstraint*>(joint);
mLoopJoints.pushBack(constraint);
Sc::ArticulationSim* scArtSim = mCore.getSim();
Sc::ConstraintSim* cSim = constraint->getCore().getSim();
if(scArtSim)
scArtSim->addLoopConstraint(cSim);
}
void NpArticulationReducedCoordinate::removeLoopJoint(PxConstraint* joint)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::removeLoopJoint() not allowed while simulation is running. Call will be ignored.")
NpConstraint* constraint = static_cast<NpConstraint*>(joint);
mLoopJoints.findAndReplaceWithLast(constraint);
Sc::ArticulationSim* scArtSim = mCore.getSim();
Sc::ConstraintSim* cSim = constraint->getCore().getSim();
scArtSim->removeLoopConstraint(cSim);
}
PxU32 NpArticulationReducedCoordinate::getNbLoopJoints() const
{
NP_READ_CHECK(getNpScene());
return mLoopJoints.size();
}
PxU32 NpArticulationReducedCoordinate::getLoopJoints(PxConstraint** userBuffer, PxU32 bufferSize, PxU32 startIndex) const
{
NP_READ_CHECK(getNpScene());
return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mLoopJoints.begin(), mLoopJoints.size());
}
PxU32 NpArticulationReducedCoordinate::getCoefficientMatrixSize() const
{
NP_READ_CHECK(getNpScene());
PX_CHECK_AND_RETURN_NULL(getNpScene(), "PxArticulationReducedCoordinate::getCoefficientMatrixSize: Articulation must be in a scene.");
// core will check if in scene and return 0xFFFFFFFF if not.
return mCore.getCoefficientMatrixSize();
}
void NpArticulationReducedCoordinate::setRootGlobalPose(const PxTransform& pose, bool autowake)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(!mArticulationLinks.empty(), "PxArticulationReducedCoordinate::setRootGlobalPose() called on empty articulation.");
PX_CHECK_AND_RETURN(pose.isValid(), "PxArticulationReducedCoordinate::setRootGlobalPose pose is not valid.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::setRootGlobalPose() not allowed while simulation is running. Call will be ignored.");
NpArticulationLink* root = mArticulationLinks[0];
root->setGlobalPoseInternal(pose, autowake);
}
PxTransform NpArticulationReducedCoordinate::getRootGlobalPose() const
{
NP_READ_CHECK(getNpScene());
PX_CHECK_AND_RETURN_VAL(!mArticulationLinks.empty(), "PxArticulationReducedCoordinate::getRootGlobalPose() called on empty articulation.", PxTransform(PxIdentity));
PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE_AND_RETURN_VAL(getNpScene(), "PxArticulationReducedCoordinate::getRootGlobalPose() not allowed while simulation is running, except in a split simulation during PxScene::collide() and up to PxScene::advance().", PxTransform(PxIdentity));
NpArticulationLink* root = mArticulationLinks[0];
return root->getGlobalPose();
}
void NpArticulationReducedCoordinate::setRootLinearVelocity(const PxVec3& linearVelocity, bool autowake)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(!mArticulationLinks.empty(), "PxArticulationReducedCoordinate::setRootLinearVelocity() called on empty articulation.");
PX_CHECK_AND_RETURN(linearVelocity.isFinite(), "PxArticulationReducedCoordinate::setRootLinearVelocity velocity is not finite.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(getNpScene(), "PxArticulationReducedCoordinate::setRootLinearVelocity() not allowed while simulation is running, except in a split simulation in-between PxScene::fetchCollision() and PxScene::advance(). Call will be ignored.");
if (getNpScene() && (getNpScene()->getFlags() & PxSceneFlag::eENABLE_DIRECT_GPU_API) && getNpScene()->isDirectGPUAPIInitialized())
{
PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxArticulationReducedCoordinate::setRootLinearVelocity(): it is illegal to call this method if PxSceneFlag::eENABLE_DIRECT_GPU_API is enabled!");
}
NpArticulationLink* root = mArticulationLinks[0];
root->scSetLinearVelocity(linearVelocity);
if(getNpScene())
{
const bool forceWakeup = !(linearVelocity.isZero());
wakeUpInternal(forceWakeup, autowake);
}
}
void NpArticulationReducedCoordinate::setRootAngularVelocity(const PxVec3& angularVelocity, bool autowake)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(!mArticulationLinks.empty(), "PxArticulationReducedCoordinate::setRootAngularVelocity() called on empty articulation.");
PX_CHECK_AND_RETURN(angularVelocity.isFinite(), "PxArticulationReducedCoordinate::setRootAngularVelocity velocity is not finite.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(getNpScene(), "PxArticulationReducedCoordinate::setRootAngularVelocity() not allowed while simulation is running, except in a split simulation in-between PxScene::fetchCollision() and PxScene::advance(). Call will be ignored.");
if (getNpScene() && (getNpScene()->getFlags() & PxSceneFlag::eENABLE_DIRECT_GPU_API) && getNpScene()->isDirectGPUAPIInitialized())
{
PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxArticulationReducedCoordinate::setRootAngularVelocity(): it is illegal to call this method if PxSceneFlag::eENABLE_DIRECT_GPU_API is enabled!");
}
NpArticulationLink* root = mArticulationLinks[0];
root->scSetAngularVelocity(angularVelocity);
if (getNpScene())
{
const bool forceWakeup = !(angularVelocity.isZero());
wakeUpInternal(forceWakeup, autowake);
}
}
PxVec3 NpArticulationReducedCoordinate::getRootLinearVelocity() const
{
NP_READ_CHECK(getNpScene());
PX_CHECK_AND_RETURN_VAL(!mArticulationLinks.empty(), "PxArticulationReducedCoordinate::getRootLinearVelocity() called on empty articulation.", PxVec3(0.0f));
PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE_AND_RETURN_VAL(getNpScene(), "PxArticulationReducedCoordinate::getRootLinearVelocity() not allowed while simulation is running, except in a split simulation during PxScene::collide() and up to PxScene::advance().", PxVec3(0.f));
NpArticulationLink* root = mArticulationLinks[0];
return root->getLinearVelocity();
}
PxVec3 NpArticulationReducedCoordinate::getRootAngularVelocity() const
{
NP_READ_CHECK(getNpScene());
PX_CHECK_AND_RETURN_VAL(!mArticulationLinks.empty(), "PxArticulationReducedCoordinate::getRootAngularVelocity() called on empty articulation.", PxVec3(0.0f));
PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE_AND_RETURN_VAL(getNpScene(), "PxArticulationReducedCoordinate::getRootAngularVelocity() not allowed while simulation is running, except in a split simulation during PxScene::collide() and up to PxScene::advance().", PxVec3(0.f));
NpArticulationLink* root = mArticulationLinks[0];
return root->getAngularVelocity();
}
PxSpatialVelocity NpArticulationReducedCoordinate::getLinkAcceleration(const PxU32 linkId)
{
NP_READ_CHECK(getNpScene());
PX_CHECK_AND_RETURN_VAL(getNpScene(), "PxArticulationReducedCoordinate::getLinkAcceleration: Articulation must be in a scene.", PxSpatialVelocity());
PX_CHECK_AND_RETURN_VAL(linkId < 64, "PxArticulationReducedCoordinate::getLinkAcceleration index is not valid.", PxSpatialVelocity());
PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE_AND_RETURN_VAL(getNpScene(), "PxArticulationReducedCoordinate::getLinkAcceleration() not allowed while simulation is running, except in a split simulation during PxScene::collide() and up to PxScene::advance().", PxSpatialVelocity());
const bool isGpuSimEnabled = (getNpScene()->getFlags() & PxSceneFlag::eENABLE_GPU_DYNAMICS) ? true : false;
return mCore.getLinkAcceleration(linkId, isGpuSimEnabled);
}
PxU32 NpArticulationReducedCoordinate::getGpuArticulationIndex()
{
NP_READ_CHECK(getNpScene());
PX_CHECK_AND_RETURN_VAL(getNpScene(), "PxArticulationReducedCoordinate::getGpuArticulationIndex: Articulation must be in a scene.", 0xffffffff);
if (getScene()->getFlags() & PxSceneFlag::eENABLE_DIRECT_GPU_API)
return mCore.getGpuArticulationIndex();
return 0xffffffff;
}
PxArticulationSpatialTendon* NpArticulationReducedCoordinate::createSpatialTendon()
{
if(getNpScene())
{
PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL,
"PxArticulationReducedCoordinate::createSpatialTendon() not allowed while the articulation is in a scene. Call will be ignored.");
return NULL;
}
void* tendonMem = PX_ALLOC(sizeof(NpArticulationSpatialTendon), "NpArticulationSpatialTendon");
PxMarkSerializedMemory(tendonMem, sizeof(NpArticulationSpatialTendon));
NpArticulationSpatialTendon* tendon = PX_PLACEMENT_NEW(tendonMem, NpArticulationSpatialTendon)(this);
tendon->setHandle(mSpatialTendons.size());
mSpatialTendons.pushBack(tendon);
return tendon;
}
void NpArticulationReducedCoordinate::removeSpatialTendonInternal(NpArticulationSpatialTendon* npTendon)
{
//we don't need to remove low-level tendon from the articulation sim because the only case the tendon can be removed is
//when the whole articulation is removed from the scene and the ArticulationSim get destroyed
getNpScene()->scRemoveArticulationSpatialTendon(*npTendon);
}
PxArticulationFixedTendon* NpArticulationReducedCoordinate::createFixedTendon()
{
if(getNpScene())
{
PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxArticulationReducedCoordinate::createFixedTendon() not allowed while the articulation is in a scene. Call will be ignored.");
return NULL;
}
void* tendonMem = PX_ALLOC(sizeof(NpArticulationFixedTendon), "NpArticulationFixedTendon");
PxMarkSerializedMemory(tendonMem, sizeof(NpArticulationFixedTendon));
NpArticulationFixedTendon* tendon = PX_PLACEMENT_NEW(tendonMem, NpArticulationFixedTendon)(this);
tendon->setHandle(mFixedTendons.size());
mFixedTendons.pushBack(tendon);
return tendon;
}
void NpArticulationReducedCoordinate::removeFixedTendonInternal(NpArticulationFixedTendon* npTendon)
{
//we don't need to remove low-level tendon from the articulation sim because the only case the tendon can be removed is
//when the whole articulation is removed from the scene and the ArticulationSim get destroyed
getNpScene()->scRemoveArticulationFixedTendon(*npTendon);
}
void NpArticulationReducedCoordinate::removeSensorInternal(NpArticulationSensor* npSensor)
{
//we don't need to remove low-level sensor from the articulation sim because the only case the tendon can be removed is
//when the whole articulation is removed from the scene and the ArticulationSim get destroyed
getNpScene()->scRemoveArticulationSensor(*npSensor);
}
PxArticulationSensor* NpArticulationReducedCoordinate::createSensor(PxArticulationLink* link, const PxTransform& relativePose)
{
if (getNpScene())
{
PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxArticulationReducedCoordinate::createSensor() not allowed while the articulation is in a scene. Call will be ignored.");
return NULL;
}
void* sensorMem = PX_ALLOC(sizeof(NpArticulationSensor), "NpArticulationSensor");
PxMarkSerializedMemory(sensorMem, sizeof(NpArticulationSensor));
NpArticulationSensor* sensor = PX_PLACEMENT_NEW(sensorMem, NpArticulationSensor)(link, relativePose);
sensor->setHandle(mSensors.size());
mSensors.pushBack(sensor);
mTopologyChanged = true;
return sensor;
}
void NpArticulationReducedCoordinate::releaseSensor(PxArticulationSensor& sensor)
{
if (getNpScene())
{
PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxArticulationReducedCoordinate::releaseSensor() not allowed while the articulation is in a scene. Call will be ignored.");
return;
}
NpArticulationSensor* npSensor = static_cast<NpArticulationSensor*>(&sensor);
const PxU32 handle = npSensor->getHandle();
PX_CHECK_AND_RETURN(handle < mSensors.size() && mSensors[handle] == npSensor,
"PxArticulationReducedCoordinate::releaseSensor: Attempt to release sensor that is not part of this articulation.");
mSensors.back()->setHandle(handle);
mSensors.replaceWithLast(handle);
npSensor->~NpArticulationSensor();
if (npSensor->getBaseFlags() & PxBaseFlag::eOWNS_MEMORY)
PX_FREE(npSensor);
mTopologyChanged = true;
}
PxU32 NpArticulationReducedCoordinate::getSensors(PxArticulationSensor** userBuffer, PxU32 bufferSize, PxU32 startIndex) const
{
return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mSensors.begin(), mSensors.size());
}
PxU32 NpArticulationReducedCoordinate::getNbSensors()
{
return mSensors.size();
}
NpArticulationSensor* NpArticulationReducedCoordinate::getSensor(const PxU32 index) const
{
return mSensors[index];
}
PxU32 NpArticulationReducedCoordinate::getSpatialTendons(PxArticulationSpatialTendon** userBuffer, PxU32 bufferSize, PxU32 startIndex) const
{
return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mSpatialTendons.begin(), mSpatialTendons.size());
}
PxU32 NpArticulationReducedCoordinate::getNbSpatialTendons()
{
return mSpatialTendons.size();
}
NpArticulationSpatialTendon* NpArticulationReducedCoordinate::getSpatialTendon(const PxU32 index) const
{
return mSpatialTendons[index];
}
PxU32 NpArticulationReducedCoordinate::getFixedTendons(PxArticulationFixedTendon** userBuffer, PxU32 bufferSize, PxU32 startIndex) const
{
return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mFixedTendons.begin(), mFixedTendons.size());
}
PxU32 NpArticulationReducedCoordinate::getNbFixedTendons()
{
return mFixedTendons.size();
}
NpArticulationFixedTendon* NpArticulationReducedCoordinate::getFixedTendon(const PxU32 index) const
{
return mFixedTendons[index];
}
void NpArticulationReducedCoordinate::updateKinematic(PxArticulationKinematicFlags flags)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::updateKinematic: Articulation must be in a scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::updateKinematic() not allowed while simulation is running. Call will be ignored.");
if (getNpScene() && (getNpScene()->getFlags() & PxSceneFlag::eENABLE_DIRECT_GPU_API) && getNpScene()->isDirectGPUAPIInitialized())
{
PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxArticulationReducedCoordinate::updateKinematic(): it is illegal to call this method if PxSceneFlag::eENABLE_DIRECT_GPU_API is enabled!");
}
if(getNpScene())
{
mCore.updateKinematic(flags);
const PxU32 linkCount = mArticulationLinks.size();
//KS - the below code forces contact managers to be updated/cached data to be dropped and
//shape transforms to be updated.
for(PxU32 i = 0; i < linkCount; ++i)
{
NpArticulationLink* link = mArticulationLinks[i];
//in the lowlevel articulation, we have already updated bodyCore's body2World
const PxTransform internalPose = link->getCore().getBody2World();
link->scSetBody2World(internalPose);
}
}
}
NpArticulationReducedCoordinate::~NpArticulationReducedCoordinate()
{
//release tendons
for (PxU32 i = 0; i < mSpatialTendons.size(); ++i)
{
if (mSpatialTendons[i])
{
mSpatialTendons[i]->~NpArticulationSpatialTendon();
if(mSpatialTendons[i]->getBaseFlags() & PxBaseFlag::eOWNS_MEMORY)
PX_FREE(mSpatialTendons[i]);
}
}
for (PxU32 i = 0; i < mFixedTendons.size(); ++i)
{
if (mFixedTendons[i])
{
mFixedTendons[i]->~NpArticulationFixedTendon();
if(mFixedTendons[i]->getBaseFlags() & PxBaseFlag::eOWNS_MEMORY)
PX_FREE(mFixedTendons[i]);
}
}
for (PxU32 i = 0; i < mSensors.size(); ++i)
{
if (mSensors[i])
{
mSensors[i]->~NpArticulationSensor();
if(mSensors[i]->getBaseFlags() & PxBaseFlag::eOWNS_MEMORY)
PX_FREE(mSensors[i]);
}
}
NpFactory::getInstance().onArticulationRelease(this);
}
PxArticulationJointReducedCoordinate* NpArticulationReducedCoordinate::createArticulationJoint(PxArticulationLink& parent,
const PxTransform& parentFrame,
PxArticulationLink& child,
const PxTransform& childFrame)
{
return NpFactory::getInstance().createNpArticulationJointRC(static_cast<NpArticulationLink&>(parent), parentFrame, static_cast<NpArticulationLink&>(child), childFrame);
}
void NpArticulationReducedCoordinate::recomputeLinkIDs()
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::recomputeLinkIDs: Articulation must be in a scene.");
if (!isAPIWriteForbidden())
{
Sc::ArticulationSim* scArtSim = getCore().getSim();
if (scArtSim)
{
physx::NpArticulationLink*const* links = getLinks();
const PxU32 nbLinks = getNbLinks();
for (PxU32 i = 1; i < nbLinks; ++i)
{
physx::NpArticulationLink* link = links[i];
PxU32 cHandle = scArtSim->findBodyIndex(*link->getCore().getSim());
link->setLLIndex(cHandle);
}
}
}
}
// PX_SERIALIZATION
void NpArticulationReducedCoordinate::requiresObjects(PxProcessPxBaseCallback& c)
{
// Collect articulation links
const PxU32 nbLinks = mArticulationLinks.size();
for (PxU32 i = 0; i < nbLinks; i++)
c.process(*mArticulationLinks[i]);
const PxU32 nbSensors = mSensors.size();
for (PxU32 i = 0; i < nbSensors; i++)
c.process(*mSensors[i]);
const PxU32 nbSpatialTendons = mSpatialTendons.size();
for (PxU32 i = 0; i < nbSpatialTendons; i++)
c.process(*mSpatialTendons[i]);
const PxU32 nbFixedTendons = mFixedTendons.size();
for (PxU32 i = 0; i < nbFixedTendons; i++)
c.process(*mFixedTendons[i]);
}
void NpArticulationReducedCoordinate::exportExtraData(PxSerializationContext& stream)
{
Cm::exportInlineArray(mArticulationLinks, stream);
Cm::exportArray(mSpatialTendons, stream);
Cm::exportArray(mFixedTendons, stream);
Cm::exportArray(mSensors, stream);
stream.writeName(mName);
}
void NpArticulationReducedCoordinate::importExtraData(PxDeserializationContext& context)
{
Cm::importInlineArray(mArticulationLinks, context);
Cm::importArray(mSpatialTendons, context);
Cm::importArray(mFixedTendons, context);
Cm::importArray(mSensors, context);
context.readName(mName);
}
void NpArticulationReducedCoordinate::resolveReferences(PxDeserializationContext& context)
{
const PxU32 nbLinks = mArticulationLinks.size();
for (PxU32 i = 0; i < nbLinks; i++)
{
NpArticulationLink*& link = mArticulationLinks[i];
context.translatePxBase(link);
}
const PxU32 nbSensors = mSensors.size();
for (PxU32 i = 0; i < nbSensors; i++)
{
NpArticulationSensor*& sensor = mSensors[i];
context.translatePxBase(sensor);
}
const PxU32 nbSpatialTendons = mSpatialTendons.size();
for (PxU32 i = 0; i < nbSpatialTendons; i++)
{
NpArticulationSpatialTendon*& spatialTendon = mSpatialTendons[i];
context.translatePxBase(spatialTendon);
}
const PxU32 nbFixedTendons = mFixedTendons.size();
for (PxU32 i = 0; i < nbFixedTendons; i++)
{
NpArticulationFixedTendon*& fixedTendon = mFixedTendons[i];
context.translatePxBase(fixedTendon);
}
mAggregate = NULL;
}
// ~PX_SERIALIZATION
void NpArticulationReducedCoordinate::release()
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxArticulationReducedCoordinate::release() not allowed while simulation is running. Call will be ignored.");
NpPhysics::getInstance().notifyDeletionListenersUserRelease(this, PxArticulationReducedCoordinate::userData);
//!!!AL TODO: Order should not matter in this case. Optimize by having a path which does not restrict release to leaf links or
// by using a more advanced data structure
PxU32 idx = 0;
while (mArticulationLinks.size())
{
idx = idx % mArticulationLinks.size();
if (mArticulationLinks[idx]->getNbChildren() == 0)
{
mArticulationLinks[idx]->releaseInternal(); // deletes joint, link and removes link from list
}
else
{
idx++;
}
}
if (npScene)
{
npScene->removeArticulationTendons(*this);
npScene->removeArticulationSensors(*this);
npScene->scRemoveArticulation(*this);
npScene->removeFromArticulationList(*this);
}
mArticulationLinks.clear();
NpDestroyArticulation(this);
}
PxArticulationLink* NpArticulationReducedCoordinate::createLink(PxArticulationLink* parent, const PxTransform& pose)
{
if(getNpScene())
{
PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxArticulationReducedCoordinate::createLink() not allowed while the articulation is in a scene. Call will be ignored.");
return NULL;
}
PX_CHECK_AND_RETURN_NULL(pose.isSane(), "PxArticulationReducedCoordinate::createLink: pose is not valid.");
if (parent && mArticulationLinks.empty())
{
PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL,
"PxArticulationReducedCoordinate::createLink: Root articulation link must have NULL parent pointer!");
return NULL;
}
// Check if parent is in same articulation is done internally for checked builds
if (!parent && !mArticulationLinks.empty())
{
PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxArticulationReducedCoordinate::createLink: Non-root articulation link must have valid parent pointer!");
return NULL;
}
NpArticulationLink* parentLink = static_cast<NpArticulationLink*>(parent);
NpArticulationLink* link = static_cast<NpArticulationLink*>(NpFactory::getInstance().createArticulationLink(*this, parentLink, pose.getNormalized()));
if (link)
{
addToLinkList(*link);
mTopologyChanged = true;
}
return link;
}
void NpArticulationReducedCoordinate::setSolverIterationCounts(PxU32 positionIters, PxU32 velocityIters)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(positionIters > 0, "PxArticulationReducedCoordinate::setSolverIterationCount: positionIters must be more than zero!");
PX_CHECK_AND_RETURN(positionIters <= 255, "PxArticulationReducedCoordinate::setSolverIterationCount: positionIters must be no greater than 255!");
PX_CHECK_AND_RETURN(velocityIters <= 255, "PxArticulationReducedCoordinate::setSolverIterationCount: velocityIters must be no greater than 255!");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::setSolverIterationCounts() not allowed while simulation is running. Call will be ignored.");
scSetSolverIterationCounts((velocityIters & 0xff) << 8 | (positionIters & 0xff));
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationReducedCoordinate, positionIterations, static_cast<const PxArticulationReducedCoordinate&>(*this), positionIters);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationReducedCoordinate, velocityIterations, static_cast<const PxArticulationReducedCoordinate&>(*this), velocityIters);
OMNI_PVD_WRITE_SCOPE_END
}
void NpArticulationReducedCoordinate::getSolverIterationCounts(PxU32& positionIters, PxU32& velocityIters) const
{
NP_READ_CHECK(getNpScene());
const PxU16 x = mCore.getSolverIterationCounts();
velocityIters = PxU32(x >> 8);
positionIters = PxU32(x & 0xff);
}
void NpArticulationReducedCoordinate::setGlobalPose()
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::setGlobalPose: Articulation must be in a scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::setGlobalPose() not allowed while simulation is running. Call will be ignored.");
PX_ASSERT(!isAPIWriteForbidden());
mCore.setGlobalPose();
//This code is force PVD to update other links position
{
physx::NpArticulationLink*const* links = getLinks();
const PxU32 nbLinks = getNbLinks();
for (PxU32 i = 1; i < nbLinks; ++i)
{
physx::NpArticulationLink* link = links[i];
//in the lowlevel articulation, we have already updated bodyCore's body2World
const PxTransform internalPose = link->getCore().getBody2World();
link->scSetBody2World(internalPose);
}
}
}
bool NpArticulationReducedCoordinate::isSleeping() const
{
NP_READ_CHECK(getNpScene());
PX_CHECK_AND_RETURN_VAL(getNpScene(), "PxArticulationReducedCoordinate::isSleeping: Articulation must be in a scene.", true);
PX_CHECK_SCENE_API_READ_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "PxArticulationReducedCoordinate::isSleeping() not allowed while simulation is running, except in a split simulation in-between PxScene::fetchCollision() and PxScene::advance().", true);
return mCore.isSleeping();
}
void NpArticulationReducedCoordinate::setSleepThreshold(PxReal threshold)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::setSleepThreshold() not allowed while simulation is running. Call will be ignored.");
scSetSleepThreshold(threshold);
OMNI_PVD_SET(OMNI_PVD_CONTEXT_HANDLE, PxArticulationReducedCoordinate, sleepThreshold, static_cast<const PxArticulationReducedCoordinate&>(*this), threshold);
}
PxReal NpArticulationReducedCoordinate::getSleepThreshold() const
{
NP_READ_CHECK(getNpScene());
return mCore.getSleepThreshold();
}
void NpArticulationReducedCoordinate::setStabilizationThreshold(PxReal threshold)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::setStabilizationThreshold() not allowed while simulation is running. Call will be ignored.");
scSetFreezeThreshold(threshold);
OMNI_PVD_SET(OMNI_PVD_CONTEXT_HANDLE, PxArticulationReducedCoordinate, stabilizationThreshold, static_cast<const PxArticulationReducedCoordinate&>(*this), threshold);
}
PxReal NpArticulationReducedCoordinate::getStabilizationThreshold() const
{
NP_READ_CHECK(getNpScene());
return mCore.getFreezeThreshold();
}
void NpArticulationReducedCoordinate::setWakeCounter(PxReal wakeCounterValue)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(getNpScene(), "PxArticulationReducedCoordinate::setWakeCounter() not allowed while simulation is running, except in a split simulation in-between PxScene::fetchCollision() and PxScene::advance(). Call will be ignored.");
for (PxU32 i = 0; i < mArticulationLinks.size(); i++)
{
mArticulationLinks[i]->scSetWakeCounter(wakeCounterValue);
}
scSetWakeCounter(wakeCounterValue);
OMNI_PVD_SET(OMNI_PVD_CONTEXT_HANDLE, PxArticulationReducedCoordinate, wakeCounter, static_cast<const PxArticulationReducedCoordinate&>(*this), wakeCounterValue);
}
PxReal NpArticulationReducedCoordinate::getWakeCounter() const
{
NP_READ_CHECK(getNpScene());
PX_CHECK_SCENE_API_READ_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "PxArticulationReducedCoordinate::getWakeCounter() not allowed while simulation is running, except in a split simulation in-between PxScene::fetchCollision() and PxScene::advance().", 0.0f);
return mCore.getWakeCounter();
}
// follows D6 wakeup logic and is used for joint and tendon autowake
void NpArticulationReducedCoordinate::autoWakeInternal(void)
{
PxReal wakeCounter = mCore.getWakeCounter();
if (wakeCounter < getNpScene()->getWakeCounterResetValueInternal())
{
wakeCounter = getNpScene()->getWakeCounterResetValueInternal();
for (PxU32 i = 0; i < mArticulationLinks.size(); i++)
{
mArticulationLinks[i]->scWakeUpInternal(wakeCounter);
}
scWakeUpInternal(wakeCounter);
}
}
// Follows RB wakeup logic. If autowake is true, increase wakeup counter to at least the scene reset valu
// If forceWakeUp is true, wakeup and leave wakeup counter unchanged, so that articulation goes to sleep
// again if wakecounter was zero at forceWakeup. The value of forceWakeup has no effect if autowake is true.
void NpArticulationReducedCoordinate::wakeUpInternal(bool forceWakeUp, bool autowake)
{
PX_ASSERT(getNpScene());
PxReal wakeCounterResetValue = getNpScene()->getWakeCounterResetValueInternal();
PxReal wakeCounter = mCore.getWakeCounter();
bool needsWakingUp = isSleeping() && (autowake || forceWakeUp);
if (autowake && (wakeCounter < wakeCounterResetValue))
{
wakeCounter = wakeCounterResetValue;
needsWakingUp = true;
}
if (needsWakingUp)
{
for (PxU32 i = 0; i < mArticulationLinks.size(); i++)
{
mArticulationLinks[i]->scWakeUpInternal(wakeCounter);
}
scWakeUpInternal(wakeCounter);
}
}
void NpArticulationReducedCoordinate::wakeUp()
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::wakeUp: Articulation must be in a scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(getNpScene(), "PxArticulationReducedCoordinate::wakeUp() not allowed while simulation is running, except in a split simulation in-between PxScene::fetchCollision() and PxScene::advance(). Call will be ignored.");
for (PxU32 i = 0; i < mArticulationLinks.size(); i++)
{
mArticulationLinks[i]->scWakeUpInternal(getNpScene()->getWakeCounterResetValueInternal());
}
PX_ASSERT(getNpScene()); // only allowed for an object in a scene
scWakeUpInternal(getNpScene()->getWakeCounterResetValueInternal());
}
void NpArticulationReducedCoordinate::putToSleep()
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::putToSleep: Articulation must be in a scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::putToSleep() not allowed while simulation is running. Call will be ignored.");
for (PxU32 i = 0; i < mArticulationLinks.size(); i++)
{
mArticulationLinks[i]->scPutToSleepInternal();
}
PX_ASSERT(!isAPIWriteForbidden());
mCore.putToSleep();
}
void NpArticulationReducedCoordinate::setMaxCOMLinearVelocity(const PxReal maxLinearVelocity)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::setMaxCOMLinearVelocity() not allowed while simulation is running. Call will be ignored.");
scSetMaxLinearVelocity(maxLinearVelocity);
OMNI_PVD_SET(OMNI_PVD_CONTEXT_HANDLE, PxArticulationReducedCoordinate, maxLinearVelocity, static_cast<const PxArticulationReducedCoordinate&>(*this), maxLinearVelocity);
}
PxReal NpArticulationReducedCoordinate::getMaxCOMLinearVelocity() const
{
NP_READ_CHECK(getNpScene());
return mCore.getMaxLinearVelocity();
}
void NpArticulationReducedCoordinate::setMaxCOMAngularVelocity(const PxReal maxAngularVelocity)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::setMaxCOMAngularVelocity() not allowed while simulation is running. Call will be ignored.");
scSetMaxAngularVelocity(maxAngularVelocity);
OMNI_PVD_SET(OMNI_PVD_CONTEXT_HANDLE, PxArticulationReducedCoordinate, maxAngularVelocity, static_cast<const PxArticulationReducedCoordinate&>(*this), maxAngularVelocity);
}
PxReal NpArticulationReducedCoordinate::getMaxCOMAngularVelocity() const
{
NP_READ_CHECK(getNpScene());
return mCore.getMaxAngularVelocity();
}
PxU32 NpArticulationReducedCoordinate::getNbLinks() const
{
NP_READ_CHECK(getNpScene());
return mArticulationLinks.size();
}
PxU32 NpArticulationReducedCoordinate::getLinks(PxArticulationLink** userBuffer, PxU32 bufferSize, PxU32 startIndex) const
{
NP_READ_CHECK(getNpScene());
return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mArticulationLinks.begin(), mArticulationLinks.size());
}
PxU32 NpArticulationReducedCoordinate::getNbShapes() const
{
NP_READ_CHECK(getNpScene());
return mNumShapes;
}
PxBounds3 NpArticulationReducedCoordinate::getWorldBounds(float inflation) const
{
NP_READ_CHECK(getNpScene());
PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE_AND_RETURN_VAL(getNpScene(), "PxArticulationReducedCoordinate::getWorldBounds() not allowed while simulation is running, except in a split simulation during PxScene::collide() and up to PxScene::advance().", PxBounds3::empty());
PxBounds3 bounds = PxBounds3::empty();
for (PxU32 i = 0; i < mArticulationLinks.size(); i++)
{
bounds.include(mArticulationLinks[i]->getWorldBounds());
}
PX_ASSERT(bounds.isValid());
// PT: unfortunately we can't just scale the min/max vectors, we need to go through center/extents.
const PxVec3 center = bounds.getCenter();
const PxVec3 inflatedExtents = bounds.getExtents() * inflation;
return PxBounds3::centerExtents(center, inflatedExtents);
}
PxAggregate* NpArticulationReducedCoordinate::getAggregate() const
{
NP_READ_CHECK(getNpScene());
return mAggregate;
}
void NpArticulationReducedCoordinate::setName(const char* debugName)
{
NP_WRITE_CHECK(getNpScene());
mName = debugName;
}
const char* NpArticulationReducedCoordinate::getName() const
{
NP_READ_CHECK(getNpScene());
return mName;
}
NpArticulationLink* NpArticulationReducedCoordinate::getRoot()
{
if (!mArticulationLinks.size())
return NULL;
PX_ASSERT(mArticulationLinks[0]->getInboundJoint() == NULL);
return mArticulationLinks[0];
}
void NpArticulationReducedCoordinate::setAggregate(PxAggregate* a)
{
mAggregate = static_cast<NpAggregate*>(a);
}
| 49,981 | C++ | 39.536902 | 286 | 0.786319 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/NpPruningStructure.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "NpPruningStructure.h"
#include "GuAABBTree.h"
#include "GuAABBTreeNode.h"
#include "NpBounds.h"
#include "NpRigidDynamic.h"
#include "NpRigidStatic.h"
#include "NpShape.h"
#include "GuBounds.h"
#include "CmTransformUtils.h"
#include "CmUtils.h"
#include "SqPrunerData.h"
using namespace physx;
using namespace Sq;
using namespace Gu;
//////////////////////////////////////////////////////////////////////////
#define PS_NB_OBJECTS_PER_NODE 4
//////////////////////////////////////////////////////////////////////////
PruningStructure::PruningStructure(PxBaseFlags baseFlags)
: PxPruningStructure(baseFlags)
{
}
//////////////////////////////////////////////////////////////////////////
PruningStructure::PruningStructure()
: PxPruningStructure(PxConcreteType::ePRUNING_STRUCTURE, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE),
mNbActors(0), mActors(0), mValid(true)
{
for(PxU32 i=0; i<2; i++)
mData[i].init();
}
//////////////////////////////////////////////////////////////////////////
PruningStructure::~PruningStructure()
{
if(getBaseFlags() & PxBaseFlag::eOWNS_MEMORY)
{
for(PxU32 i=0; i<2; i++)
{
PX_FREE(mData[i].mAABBTreeIndices);
PX_FREE(mData[i].mAABBTreeNodes);
}
PX_FREE(mActors);
}
}
//////////////////////////////////////////////////////////////////////////
void PruningStructure::release()
{
// if we release the pruning structure we set the pruner structure to NUUL
for (PxU32 i = 0; i < mNbActors; i++)
{
PX_ASSERT(mActors[i]);
PxType type = mActors[i]->getConcreteType();
if (type == PxConcreteType::eRIGID_STATIC)
static_cast<NpRigidStatic*>(mActors[i])->getShapeManager().setPruningStructure(NULL);
else if (type == PxConcreteType::eRIGID_DYNAMIC)
static_cast<NpRigidDynamic*>(mActors[i])->getShapeManager().setPruningStructure(NULL);
}
if(getBaseFlags() & PxBaseFlag::eOWNS_MEMORY)
PX_DELETE_THIS;
else
this->~PruningStructure();
}
template <typename ActorType>
static void getShapeBounds(PxRigidActor* actor, bool dynamic, PxBounds3* bounds, PxU32& numShapes)
{
PruningIndex::Enum treeStructure = dynamic ? PruningIndex::eDYNAMIC : PruningIndex::eSTATIC;
ActorType& a = *static_cast<ActorType*>(actor);
const PxU32 nbShapes = a.getNbShapes();
for (PxU32 iShape = 0; iShape < nbShapes; iShape++)
{
NpShape* shape = a.getShapeManager().getShapes()[iShape];
if (shape->getFlags() & PxShapeFlag::eSCENE_QUERY_SHAPE)
{
(gComputeBoundsTable[treeStructure])(*bounds, *shape, a);
bounds++;
numShapes++;
}
}
}
//////////////////////////////////////////////////////////////////////////
bool PruningStructure::build(PxRigidActor*const* actors, PxU32 nbActors)
{
PX_ASSERT(actors);
PX_ASSERT(nbActors > 0);
PxU32 numShapes[2] = { 0, 0 };
// parse the actors first to get the shapes size
for (PxU32 actorsDone = 0; actorsDone < nbActors; actorsDone++)
{
if (actorsDone + 1 < nbActors)
PxPrefetch(actors[actorsDone + 1], sizeof(NpRigidDynamic)); // worst case: PxRigidStatic is smaller
PxType type = actors[actorsDone]->getConcreteType();
const PxRigidActor& actor = *(actors[actorsDone]);
NpScene* scene = NpActor::getFromPxActor(actor).getNpScene();
if(scene)
{
PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "PrunerStructure::build: Actor already assigned to a scene!");
return false;
}
const PxU32 nbShapes = actor.getNbShapes();
bool hasQueryShape = false;
for (PxU32 iShape = 0; iShape < nbShapes; iShape++)
{
PxShape* shape;
actor.getShapes(&shape, 1, iShape);
if(shape->getFlags() & PxShapeFlag::eSCENE_QUERY_SHAPE)
{
hasQueryShape = true;
if (type == PxConcreteType::eRIGID_STATIC)
numShapes[PruningIndex::eSTATIC]++;
else
numShapes[PruningIndex::eDYNAMIC]++;
}
}
// each provided actor must have a query shape
if(!hasQueryShape)
{
PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "PrunerStructure::build: Provided actor has no scene query shape!");
return false;
}
if (type == PxConcreteType::eRIGID_STATIC)
{
NpRigidStatic* rs = static_cast<NpRigidStatic*>(actors[actorsDone]);
if(rs->getShapeManager().getPruningStructure())
{
PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "PrunerStructure::build: Provided actor has already a pruning structure!");
return false;
}
rs->getShapeManager().setPruningStructure(this);
}
else if (type == PxConcreteType::eRIGID_DYNAMIC)
{
NpRigidDynamic* rd = static_cast<NpRigidDynamic*>(actors[actorsDone]);
if (rd->getShapeManager().getPruningStructure())
{
PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "PrunerStructure::build: Provided actor has already a pruning structure!");
return false;
}
rd->getShapeManager().setPruningStructure(this);
}
else
{
PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "PrunerStructure::build: Provided actor is not a rigid actor!");
return false;
}
}
AABBTreeBounds bounds[2];
for (PxU32 i = 0; i < 2; i++)
{
if(numShapes[i])
{
bounds[i].init(numShapes[i]);
}
}
// now I go again and gather bounds and payload
numShapes[PruningIndex::eSTATIC] = 0;
numShapes[PruningIndex::eDYNAMIC] = 0;
for (PxU32 actorsDone = 0; actorsDone < nbActors; actorsDone++)
{
PxType type = actors[actorsDone]->getConcreteType();
if (type == PxConcreteType::eRIGID_STATIC)
{
getShapeBounds<NpRigidStatic>(actors[actorsDone], false, &bounds[PruningIndex::eSTATIC].getBounds()[numShapes[PruningIndex::eSTATIC]], numShapes[PruningIndex::eSTATIC]);
}
else if (type == PxConcreteType::eRIGID_DYNAMIC)
{
getShapeBounds<NpRigidDynamic>(actors[actorsDone], true, &bounds[PruningIndex::eDYNAMIC].getBounds()[numShapes[PruningIndex::eDYNAMIC]], numShapes[PruningIndex::eDYNAMIC]);
}
}
AABBTree aabbTrees[2];
for (PxU32 i = 0; i < 2; i++)
{
mData[i].mNbObjects = numShapes[i];
if (numShapes[i])
{
// create the AABB tree
NodeAllocator nodeAllocator;
bool status = aabbTrees[i].build(AABBTreeBuildParams(PS_NB_OBJECTS_PER_NODE, numShapes[i], &bounds[i]), nodeAllocator);
PX_UNUSED(status);
PX_ASSERT(status);
// store the tree nodes
mData[i].mNbNodes = aabbTrees[i].getNbNodes();
mData[i].mAABBTreeNodes = PX_ALLOCATE(BVHNode, mData[i].mNbNodes, "BVHNode");
PxMemCopy(mData[i].mAABBTreeNodes, aabbTrees[i].getNodes(), sizeof(BVHNode)*mData[i].mNbNodes);
mData[i].mAABBTreeIndices = PX_ALLOCATE(PxU32, mData[i].mNbObjects, "PxU32");
PxMemCopy(mData[i].mAABBTreeIndices, aabbTrees[i].getIndices(), sizeof(PxU32)*mData[i].mNbObjects);
// discard the data
bounds[i].release();
}
}
// store the actors for verification and serialization
mNbActors = nbActors;
mActors = PX_ALLOCATE(PxActor*, mNbActors, "PxActor*");
PxMemCopy(mActors, actors, sizeof(PxActor*)*mNbActors);
return true;
}
//////////////////////////////////////////////////////////////////////////
PruningStructure* PruningStructure::createObject(PxU8*& address, PxDeserializationContext& context)
{
PruningStructure* obj = PX_PLACEMENT_NEW(address, PruningStructure(PxBaseFlag::eIS_RELEASABLE));
address += sizeof(PruningStructure);
obj->importExtraData(context);
obj->resolveReferences(context);
return obj;
}
//////////////////////////////////////////////////////////////////////////
void PruningStructure::resolveReferences(PxDeserializationContext& context)
{
if (!isValid())
return;
for (PxU32 i = 0; i < mNbActors; i++)
context.translatePxBase(mActors[i]);
}
//////////////////////////////////////////////////////////////////////////
void PruningStructure::requiresObjects(PxProcessPxBaseCallback& c)
{
if (!isValid())
return;
for (PxU32 i = 0; i < mNbActors; i++)
c.process(*mActors[i]);
}
//////////////////////////////////////////////////////////////////////////
void PruningStructure::exportExtraData(PxSerializationContext& stream)
{
if (!isValid())
{
PxGetFoundation().error(PxErrorCode::eDEBUG_WARNING, PX_FL, "PrunerStructure::exportExtraData: Pruning structure is invalid!");
return;
}
for (PxU32 i = 0; i < 2; i++)
{
if (mData[i].mAABBTreeNodes)
{
// store nodes
stream.alignData(PX_SERIAL_ALIGN);
stream.writeData(mData[i].mAABBTreeNodes, mData[i].mNbNodes * sizeof(BVHNode));
}
if(mData[i].mAABBTreeIndices)
{
// store indices
stream.alignData(PX_SERIAL_ALIGN);
stream.writeData(mData[i].mAABBTreeIndices, mData[i].mNbObjects * sizeof(PxU32));
}
}
if(mActors)
{
// store actor pointers
stream.alignData(PX_SERIAL_ALIGN);
stream.writeData(mActors, mNbActors * sizeof(PxActor*));
}
}
//////////////////////////////////////////////////////////////////////////
void PruningStructure::importExtraData(PxDeserializationContext& context)
{
if (!isValid())
{
PxGetFoundation().error(PxErrorCode::eDEBUG_WARNING, PX_FL, "PrunerStructure::importExtraData: Pruning structure is invalid!");
return;
}
for (PxU32 i = 0; i < 2; i++)
{
if (mData[i].mAABBTreeNodes)
mData[i].mAABBTreeNodes = context.readExtraData<BVHNode, PX_SERIAL_ALIGN>(mData[i].mNbNodes);
if(mData[i].mAABBTreeIndices)
mData[i].mAABBTreeIndices = context.readExtraData<PxU32, PX_SERIAL_ALIGN>(mData[i].mNbObjects);
}
if (mActors)
{
// read actor pointers
mActors = context.readExtraData<PxActor*, PX_SERIAL_ALIGN>(mNbActors);
}
}
//////////////////////////////////////////////////////////////////////////
PxU32 PruningStructure::getNbRigidActors() const
{
return mNbActors;
}
const void* PruningStructure::getStaticMergeData() const
{
return &mData[PruningIndex::eSTATIC];
}
const void* PruningStructure::getDynamicMergeData() const
{
return &mData[PruningIndex::eDYNAMIC];
}
PxU32 PruningStructure::getRigidActors(PxRigidActor** userBuffer, PxU32 bufferSize, PxU32 startIndex/* =0 */) const
{
if(!isValid())
{
PxGetFoundation().error(PxErrorCode::eDEBUG_WARNING, PX_FL, "PrunerStructure::getRigidActors: Pruning structure is invalid!");
return 0;
}
return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mActors, mNbActors);
}
//////////////////////////////////////////////////////////////////////////
void PruningStructure::invalidate(PxActor* actor)
{
PX_ASSERT(actor);
// remove actor from the actor list to avoid mem corruption
// this slow, but should be called only with error msg send to user about invalid behavior
for (PxU32 i = 0; i < mNbActors; i++)
{
if(mActors[i] == actor)
{
// set pruning structure to NULL and remove the actor from the list
PxType type = mActors[i]->getConcreteType();
if (type == PxConcreteType::eRIGID_STATIC)
static_cast<NpRigidStatic*>(mActors[i])->getShapeManager().setPruningStructure(NULL);
else if (type == PxConcreteType::eRIGID_DYNAMIC)
static_cast<NpRigidDynamic*>(mActors[i])->getShapeManager().setPruningStructure(NULL);
mActors[i] = mActors[mNbActors--];
break;
}
}
mValid = false;
}
| 12,679 | C++ | 30.542288 | 175 | 0.664642 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/NpArticulationTendon.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef NP_ARTICULATION_TENDON_H
#define NP_ARTICULATION_TENDON_H
#include "foundation/PxInlineArray.h"
#include "PxArticulationTendon.h"
#include "ScArticulationTendonCore.h"
#include "ScArticulationAttachmentCore.h"
#include "ScArticulationTendonJointCore.h"
#include "NpBase.h"
namespace physx
{
typedef PxU32 ArticulationAttachmentHandle;
typedef PxU32 ArticulationTendonHandle;
class NpArticulationReducedCoordinate;
class NpArticulationAttachment;
class NpArticulationSpatialTendon;
class NpArticulationTendonJoint;
class NpArticulationFixedTendon;
class NpArticulationAttachmentArray : public PxInlineArray<NpArticulationAttachment*, 4> //!!!AL TODO: check if default of 4 elements makes sense
{
public:
// PX_SERIALIZATION
NpArticulationAttachmentArray(const PxEMPTY) : PxInlineArray<NpArticulationAttachment*, 4>(PxEmpty) {}
static void getBinaryMetaData(PxOutputStream& stream);
//~PX_SERIALIZATION
NpArticulationAttachmentArray() : PxInlineArray<NpArticulationAttachment*, 4>("NpArticulationAttachmentArray") {}
};
class NpArticulationTendonJointArray : public PxInlineArray<NpArticulationTendonJoint*, 4> //!!!AL TODO: check if default of 4 elements makes sense
{
public:
// PX_SERIALIZATION
NpArticulationTendonJointArray(const PxEMPTY) : PxInlineArray<NpArticulationTendonJoint*, 4>(PxEmpty) {}
static void getBinaryMetaData(PxOutputStream& stream);
//~PX_SERIALIZATION
NpArticulationTendonJointArray() : PxInlineArray<NpArticulationTendonJoint*, 4>("NpArticulationTendonJointArray") {}
};
class NpArticulationAttachment : public PxArticulationAttachment, public NpBase
{
public:
// PX_SERIALIZATION
NpArticulationAttachment(PxBaseFlags baseFlags)
: PxArticulationAttachment(baseFlags), NpBase(PxEmpty), mHandle(PxEmpty), mChildren(PxEmpty), mCore(PxEmpty) {}
void preExportDataReset() { mCore.preExportDataReset(); }
virtual void exportExtraData(PxSerializationContext& );
void importExtraData(PxDeserializationContext& );
void resolveReferences(PxDeserializationContext& );
virtual void requiresObjects(PxProcessPxBaseCallback&);
virtual bool isSubordinate() const { return true; }
static NpArticulationAttachment* createObject(PxU8*& address, PxDeserializationContext& context);
static void getBinaryMetaData(PxOutputStream& stream);
//~PX_SERIALIZATION
NpArticulationAttachment(PxArticulationAttachment* parent, const PxReal coefficient, const PxVec3 relativeOffset, PxArticulationLink* link);
virtual ~NpArticulationAttachment();
virtual void setRestLength(const PxReal restLength);
virtual PxReal getRestLength() const;
virtual void setLimitParameters(const PxArticulationTendonLimit& paramters);
virtual PxArticulationTendonLimit getLimitParameters() const;
virtual void setRelativeOffset(const PxVec3& offset);
virtual PxVec3 getRelativeOffset() const;
virtual void setCoefficient(const PxReal coefficient);
virtual PxReal getCoefficient() const;
virtual PxArticulationLink* getLink() const { return mLink; }
virtual PxArticulationAttachment* getParent() const { return mParent; }
virtual PxArticulationSpatialTendon* getTendon() const;
virtual bool isLeaf() const { return mChildren.empty(); }
virtual void release();
PX_FORCE_INLINE NpArticulationAttachment** getChildren() { return mChildren.begin(); }
PX_FORCE_INLINE PxU32 getNumChildren() { return mChildren.size(); }
PX_FORCE_INLINE void setTendon(NpArticulationSpatialTendon* tendon) { mTendon = tendon; }
PX_FORCE_INLINE NpArticulationSpatialTendon& getTendon() { return *mTendon; }
PX_FORCE_INLINE Sc::ArticulationAttachmentCore& getCore() { return mCore; }
void removeChild(NpArticulationAttachment* child);
PxArticulationLink* mLink; //the link this attachment attach to
PxArticulationAttachment* mParent;
ArticulationAttachmentHandle mHandle;
NpArticulationAttachmentArray mChildren;
NpArticulationSpatialTendon* mTendon;
Sc::ArticulationAttachmentCore mCore;
};
class NpArticulationSpatialTendon : public PxArticulationSpatialTendon, public NpBase
{
public:
// PX_SERIALIZATION
NpArticulationSpatialTendon(PxBaseFlags baseFlags)
: PxArticulationSpatialTendon(baseFlags), NpBase(PxEmpty), mAttachments(PxEmpty), mCore(PxEmpty) {}
void preExportDataReset() { mCore.preExportDataReset(); }
virtual void exportExtraData(PxSerializationContext& );
void importExtraData(PxDeserializationContext& );
void resolveReferences(PxDeserializationContext& );
virtual void requiresObjects(PxProcessPxBaseCallback&);
virtual bool isSubordinate() const { return true; }
static NpArticulationSpatialTendon* createObject(PxU8*& address, PxDeserializationContext& context);
static void getBinaryMetaData(PxOutputStream& stream);
//~PX_SERIALIZATION
NpArticulationSpatialTendon(NpArticulationReducedCoordinate* articulation);
virtual ~NpArticulationSpatialTendon();
virtual PxArticulationAttachment* createAttachment(PxArticulationAttachment* parent, const PxReal coefficient, const PxVec3 relativeOffset, PxArticulationLink* link);
NpArticulationAttachment* getAttachment(const PxU32 index);
virtual PxU32 getAttachments(PxArticulationAttachment** userBuffer, PxU32 bufferSize, PxU32 startIndex) const;
PxU32 getNbAttachments() const;
virtual void setStiffness(const PxReal stiffness);
virtual PxReal getStiffness() const;
virtual void setDamping(const PxReal damping);
virtual PxReal getDamping() const;
virtual void setLimitStiffness(const PxReal stiffness);
virtual PxReal getLimitStiffness() const;
virtual void setOffset(const PxReal offset, bool autowake = true);
virtual PxReal getOffset() const;
virtual PxArticulationReducedCoordinate* getArticulation() const;
virtual void release();
PX_FORCE_INLINE Sc::ArticulationSpatialTendonCore& getTendonCore() { return mCore; }
PX_FORCE_INLINE ArticulationTendonHandle getHandle() { return mHandle; }
PX_FORCE_INLINE void setHandle(ArticulationTendonHandle handle) { mHandle = handle; }
PX_FORCE_INLINE NpArticulationAttachmentArray& getAttachments() { return mAttachments; }
private:
NpArticulationAttachmentArray mAttachments;
NpArticulationReducedCoordinate* mArticulation;
PxU32 mLLIndex;
Sc::ArticulationSpatialTendonCore mCore;
ArticulationTendonHandle mHandle;
};
class NpArticulationTendonJoint : public PxArticulationTendonJoint, public NpBase
{
public:
// PX_SERIALIZATION
NpArticulationTendonJoint(PxBaseFlags baseFlags) : PxArticulationTendonJoint(baseFlags), NpBase(PxEmpty), mChildren(PxEmpty), mCore(PxEmpty), mHandle(PxEmpty) {}
void preExportDataReset() { mCore.preExportDataReset(); }
virtual void exportExtraData(PxSerializationContext& );
void importExtraData(PxDeserializationContext& );
void resolveReferences(PxDeserializationContext& );
virtual void requiresObjects(PxProcessPxBaseCallback&);
virtual bool isSubordinate() const { return true; }
static NpArticulationTendonJoint* createObject(PxU8*& address, PxDeserializationContext& context);
static void getBinaryMetaData(PxOutputStream& stream);
//~PX_SERIALIZATION
NpArticulationTendonJoint(PxArticulationTendonJoint* parent, PxArticulationAxis::Enum axis, const PxReal coefficient, const PxReal recipCoefficient, PxArticulationLink* link);
virtual ~NpArticulationTendonJoint(){}
virtual PxArticulationLink* getLink() const { return mLink; }
virtual PxArticulationTendonJoint* getParent() const { return mParent; }
virtual PxArticulationFixedTendon* getTendon() const;
virtual void setCoefficient(const PxArticulationAxis::Enum axis, const PxReal coefficient, const PxReal recipCoefficient);
virtual void getCoefficient(PxArticulationAxis::Enum& axis, PxReal& coefficient, PxReal& recipCoefficient) const;
virtual void release();
PX_FORCE_INLINE NpArticulationTendonJoint** getChildren() { return mChildren.begin(); }
PX_FORCE_INLINE PxU32 getNumChildren() { return mChildren.size(); }
PX_FORCE_INLINE void setTendon(NpArticulationFixedTendon* tendon) { mTendon = tendon; }
PX_FORCE_INLINE NpArticulationFixedTendon& getTendon() { return *mTendon; }
PX_FORCE_INLINE Sc::ArticulationTendonJointCore& getCore() { return mCore; }
void removeChild(NpArticulationTendonJoint* child);
PxArticulationLink* mLink; //the link this joint associated with
PxArticulationTendonJoint* mParent;
NpArticulationTendonJointArray mChildren;
NpArticulationFixedTendon* mTendon;
Sc::ArticulationTendonJointCore mCore;
PxU32 mHandle;
};
class NpArticulationFixedTendon : public PxArticulationFixedTendon, public NpBase
{
public:
// PX_SERIALIZATION
NpArticulationFixedTendon(PxBaseFlags baseFlags): PxArticulationFixedTendon(baseFlags), NpBase(PxEmpty), mTendonJoints(PxEmpty), mCore(PxEmpty), mHandle(PxEmpty) {}
void preExportDataReset() {}
virtual void exportExtraData(PxSerializationContext& );
void importExtraData(PxDeserializationContext& );
void resolveReferences(PxDeserializationContext& );
virtual void requiresObjects(PxProcessPxBaseCallback&);
virtual bool isSubordinate() const { return true; }
static NpArticulationFixedTendon* createObject(PxU8*& address, PxDeserializationContext& context);
static void getBinaryMetaData(PxOutputStream& stream);
//~PX_SERIALIZATION
NpArticulationFixedTendon(NpArticulationReducedCoordinate* articulation);
virtual ~NpArticulationFixedTendon();
virtual PxArticulationTendonJoint* createTendonJoint(PxArticulationTendonJoint* parent, PxArticulationAxis::Enum axis, const PxReal scale, const PxReal recipScale, PxArticulationLink* link);
NpArticulationTendonJoint* getTendonJoint(const PxU32 index);
virtual PxU32 getTendonJoints(PxArticulationTendonJoint** userBuffer, PxU32 bufferSize, PxU32 startIndex) const;
virtual PxU32 getNbTendonJoints(void) const;
virtual void setStiffness(const PxReal stiffness);
virtual PxReal getStiffness() const;
virtual void setDamping(const PxReal damping);
virtual PxReal getDamping() const;
virtual void setLimitStiffness(const PxReal damping);
virtual PxReal getLimitStiffness() const;
virtual void setRestLength(const PxReal restLength);
virtual PxReal getRestLength() const;
virtual void setLimitParameters(const PxArticulationTendonLimit& paramters);
virtual PxArticulationTendonLimit getLimitParameters() const;
virtual void setOffset(const PxReal offset, bool autowake = true);
virtual PxReal getOffset() const;
virtual PxArticulationReducedCoordinate* getArticulation() const;
virtual void release();
PX_FORCE_INLINE ArticulationTendonHandle getHandle() { return mHandle; }
PX_FORCE_INLINE void setHandle(ArticulationTendonHandle handle) { mHandle = handle; }
PX_FORCE_INLINE Sc::ArticulationFixedTendonCore& getTendonCore() { return mCore; }
PX_FORCE_INLINE NpArticulationTendonJointArray& getTendonJoints() { return mTendonJoints; }
private:
NpArticulationTendonJointArray mTendonJoints;
NpArticulationReducedCoordinate* mArticulation;
PxU32 mLLIndex;
Sc::ArticulationFixedTendonCore mCore;
ArticulationTendonHandle mHandle;
};
}
#endif
| 13,267 | C | 41.8 | 193 | 0.772292 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/PvdMetaDataPvdBinding.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
// suppress LNK4221
#include "foundation/PxPreprocessor.h"
PX_DUMMY_SYMBOL
#if PX_SUPPORT_PVD
#include "foundation/PxSimpleTypes.h"
#include "foundation/Px.h"
#include "PxMetaDataObjects.h"
#include "PxPvdDataStream.h"
#include "PxScene.h"
#include "ScBodyCore.h"
#include "PvdMetaDataExtensions.h"
#include "PvdMetaDataPropertyVisitor.h"
#include "PvdMetaDataDefineProperties.h"
#include "PvdMetaDataBindingData.h"
#include "PxRigidDynamic.h"
#include "PxArticulationReducedCoordinate.h"
#include "PxArticulationLink.h"
#include "NpScene.h"
#include "NpPhysics.h"
#include "PvdTypeNames.h"
#include "PvdMetaDataPvdBinding.h"
using namespace physx;
using namespace Sc;
using namespace Vd;
using namespace Sq;
namespace physx
{
namespace Vd
{
struct NameValuePair
{
const char* mName;
PxU32 mValue;
};
#if PX_LINUX && PX_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wreserved-identifier"
#endif
static const NameValuePair g_physx_Sq_SceneQueryID__EnumConversion[] = {
{ "QUERY_RAYCAST_ANY_OBJECT", PxU32(QueryID::QUERY_RAYCAST_ANY_OBJECT) },
{ "QUERY_RAYCAST_CLOSEST_OBJECT", PxU32(QueryID::QUERY_RAYCAST_CLOSEST_OBJECT) },
{ "QUERY_RAYCAST_ALL_OBJECTS", PxU32(QueryID::QUERY_RAYCAST_ALL_OBJECTS) },
{ "QUERY_OVERLAP_SPHERE_ALL_OBJECTS", PxU32(QueryID::QUERY_OVERLAP_SPHERE_ALL_OBJECTS) },
{ "QUERY_OVERLAP_AABB_ALL_OBJECTS", PxU32(QueryID::QUERY_OVERLAP_AABB_ALL_OBJECTS) },
{ "QUERY_OVERLAP_OBB_ALL_OBJECTS", PxU32(QueryID::QUERY_OVERLAP_OBB_ALL_OBJECTS) },
{ "QUERY_OVERLAP_CAPSULE_ALL_OBJECTS", PxU32(QueryID::QUERY_OVERLAP_CAPSULE_ALL_OBJECTS) },
{ "QUERY_OVERLAP_CONVEX_ALL_OBJECTS", PxU32(QueryID::QUERY_OVERLAP_CONVEX_ALL_OBJECTS) },
{ "QUERY_LINEAR_OBB_SWEEP_CLOSEST_OBJECT", PxU32(QueryID::QUERY_LINEAR_OBB_SWEEP_CLOSEST_OBJECT) },
{ "QUERY_LINEAR_CAPSULE_SWEEP_CLOSEST_OBJECT", PxU32(QueryID::QUERY_LINEAR_CAPSULE_SWEEP_CLOSEST_OBJECT) },
{ "QUERY_LINEAR_CONVEX_SWEEP_CLOSEST_OBJECT", PxU32(QueryID::QUERY_LINEAR_CONVEX_SWEEP_CLOSEST_OBJECT) },
{ NULL, 0 }
};
#if PX_LINUX && PX_CLANG
#pragma clang diagnostic pop
#endif
struct SceneQueryIDConvertor
{
const NameValuePair* NameConversion;
SceneQueryIDConvertor() : NameConversion(g_physx_Sq_SceneQueryID__EnumConversion)
{
}
};
PvdMetaDataBinding::PvdMetaDataBinding() : mBindingData(PX_NEW(PvdMetaDataBindingData)())
{
}
PvdMetaDataBinding::~PvdMetaDataBinding()
{
for(OwnerActorsMap::Iterator iter = mBindingData->mOwnerActorsMap.getIterator(); !iter.done(); iter++)
{
iter->second->~OwnerActorsValueType();
PX_FREE(iter->second);
}
PX_DELETE(mBindingData);
}
template <typename TDataType, typename TValueType, typename TClassType>
static inline void definePropertyStruct(PvdDataStream& inStream, const char* pushName = NULL)
{
PvdPropertyDefinitionHelper& helper(inStream.getPropertyDefinitionHelper());
PvdClassInfoValueStructDefine definitionObj(helper);
bool doPush = pushName && *pushName;
if(doPush)
definitionObj.pushName(pushName);
visitAllPvdProperties<TDataType>(definitionObj);
if(doPush)
definitionObj.popName();
helper.addPropertyMessage(getPvdNamespacedNameForType<TClassType>(), getPvdNamespacedNameForType<TValueType>(), sizeof(TValueType));
}
template <typename TDataType>
static inline void createClassAndDefineProperties(PvdDataStream& inStream)
{
inStream.createClass<TDataType>();
PvdPropertyDefinitionHelper& helper(inStream.getPropertyDefinitionHelper());
PvdClassInfoDefine definitionObj(helper, getPvdNamespacedNameForType<TDataType>());
visitAllPvdProperties<TDataType>(definitionObj);
}
template <typename TDataType, typename TParentType>
static inline void createClassDeriveAndDefineProperties(PvdDataStream& inStream)
{
inStream.createClass<TDataType>();
inStream.deriveClass<TParentType, TDataType>();
PvdPropertyDefinitionHelper& helper(inStream.getPropertyDefinitionHelper());
PvdClassInfoDefine definitionObj(helper, getPvdNamespacedNameForType<TDataType>());
visitInstancePvdProperties<TDataType>(definitionObj);
}
template <typename TDataType, typename TConvertSrc, typename TConvertData>
static inline void defineProperty(PvdDataStream& inStream, const char* inPropertyName, const char* semantic)
{
PvdPropertyDefinitionHelper& helper(inStream.getPropertyDefinitionHelper());
// PxEnumTraits< TValueType > filterFlagsEnum;
TConvertSrc filterFlagsEnum;
const TConvertData* convertor = filterFlagsEnum.NameConversion;
for(; convertor->mName != NULL; ++convertor)
helper.addNamedValue(convertor->mName, convertor->mValue);
inStream.createProperty<TDataType, PxU32>(inPropertyName, semantic, PropertyType::Scalar, helper.getNamedValues());
helper.clearNamedValues();
}
template <typename TDataType, typename TConvertSrc, typename TConvertData>
static inline void definePropertyFlags(PvdDataStream& inStream, const char* inPropertyName)
{
defineProperty<TDataType, TConvertSrc, TConvertData>(inStream, inPropertyName, "Bitflag");
}
template <typename TDataType, typename TConvertSrc, typename TConvertData>
static inline void definePropertyEnums(PvdDataStream& inStream, const char* inPropertyName)
{
defineProperty<TDataType, TConvertSrc, TConvertData>(inStream, inPropertyName, "Enumeration Value");
}
static PX_FORCE_INLINE void registerPvdRaycast(PvdDataStream& inStream)
{
inStream.createClass<PvdRaycast>();
definePropertyEnums<PvdRaycast, SceneQueryIDConvertor, NameValuePair>(inStream, "type");
inStream.createProperty<PvdRaycast, PxFilterData>("filterData");
definePropertyFlags<PvdRaycast, PxEnumTraits<physx::PxQueryFlag::Enum>, PxU32ToName>(inStream, "filterFlags");
inStream.createProperty<PvdRaycast, PxVec3>("origin");
inStream.createProperty<PvdRaycast, PxVec3>("unitDir");
inStream.createProperty<PvdRaycast, PxF32>("distance");
inStream.createProperty<PvdRaycast, String>("hits_arrayName");
inStream.createProperty<PvdRaycast, PxU32>("hits_baseIndex");
inStream.createProperty<PvdRaycast, PxU32>("hits_count");
}
static PX_FORCE_INLINE void registerPvdSweep(PvdDataStream& inStream)
{
inStream.createClass<PvdSweep>();
definePropertyEnums<PvdSweep, SceneQueryIDConvertor, NameValuePair>(inStream, "type");
definePropertyFlags<PvdSweep, PxEnumTraits<physx::PxQueryFlag::Enum>, PxU32ToName>(inStream, "filterFlags");
inStream.createProperty<PvdSweep, PxVec3>("unitDir");
inStream.createProperty<PvdSweep, PxF32>("distance");
inStream.createProperty<PvdSweep, String>("geom_arrayName");
inStream.createProperty<PvdSweep, PxU32>("geom_baseIndex");
inStream.createProperty<PvdSweep, PxU32>("geom_count");
inStream.createProperty<PvdSweep, String>("pose_arrayName");
inStream.createProperty<PvdSweep, PxU32>("pose_baseIndex");
inStream.createProperty<PvdSweep, PxU32>("pose_count");
inStream.createProperty<PvdSweep, String>("filterData_arrayName");
inStream.createProperty<PvdSweep, PxU32>("filterData_baseIndex");
inStream.createProperty<PvdSweep, PxU32>("filterData_count");
inStream.createProperty<PvdSweep, String>("hits_arrayName");
inStream.createProperty<PvdSweep, PxU32>("hits_baseIndex");
inStream.createProperty<PvdSweep, PxU32>("hits_count");
}
static PX_FORCE_INLINE void registerPvdOverlap(PvdDataStream& inStream)
{
inStream.createClass<PvdOverlap>();
definePropertyEnums<PvdOverlap, SceneQueryIDConvertor, NameValuePair>(inStream, "type");
inStream.createProperty<PvdOverlap, PxFilterData>("filterData");
definePropertyFlags<PvdOverlap, PxEnumTraits<physx::PxQueryFlag::Enum>, PxU32ToName>(inStream, "filterFlags");
inStream.createProperty<PvdOverlap, PxTransform>("pose");
inStream.createProperty<PvdOverlap, String>("geom_arrayName");
inStream.createProperty<PvdOverlap, PxU32>("geom_baseIndex");
inStream.createProperty<PvdOverlap, PxU32>("geom_count");
inStream.createProperty<PvdOverlap, String>("hits_arrayName");
inStream.createProperty<PvdOverlap, PxU32>("hits_baseIndex");
inStream.createProperty<PvdOverlap, PxU32>("hits_count");
}
static PX_FORCE_INLINE void registerPvdSqHit(PvdDataStream& inStream)
{
inStream.createClass<PvdSqHit>();
inStream.createProperty<PvdSqHit, ObjectRef>("Shape");
inStream.createProperty<PvdSqHit, ObjectRef>("Actor");
inStream.createProperty<PvdSqHit, PxU32>("FaceIndex");
definePropertyFlags<PvdSqHit, PxEnumTraits<physx::PxHitFlag::Enum>, PxU32ToName>(inStream, "Flags");
inStream.createProperty<PvdSqHit, PxVec3>("Impact");
inStream.createProperty<PvdSqHit, PxVec3>("Normal");
inStream.createProperty<PvdSqHit, PxF32>("Distance");
inStream.createProperty<PvdSqHit, PxF32>("U");
inStream.createProperty<PvdSqHit, PxF32>("V");
}
void PvdMetaDataBinding::registerSDKProperties(PvdDataStream& inStream)
{
if (inStream.isClassExist<PxPhysics>())
return;
// PxPhysics
{
inStream.createClass<PxPhysics>();
PvdPropertyDefinitionHelper& helper(inStream.getPropertyDefinitionHelper());
PvdClassInfoDefine definitionObj(helper, getPvdNamespacedNameForType<PxPhysics>());
helper.pushName("TolerancesScale");
visitAllPvdProperties<PxTolerancesScale>(definitionObj);
helper.popName();
inStream.createProperty<PxPhysics, ObjectRef>("Scenes", "children", PropertyType::Array);
inStream.createProperty<PxPhysics, ObjectRef>("SharedShapes", "children", PropertyType::Array);
inStream.createProperty<PxPhysics, ObjectRef>("Materials", "children", PropertyType::Array);
inStream.createProperty<PxPhysics, ObjectRef>("HeightFields", "children", PropertyType::Array);
inStream.createProperty<PxPhysics, ObjectRef>("ConvexMeshes", "children", PropertyType::Array);
inStream.createProperty<PxPhysics, ObjectRef>("TriangleMeshes", "children", PropertyType::Array);
inStream.createProperty<PxPhysics, PxU32>("Version.Major");
inStream.createProperty<PxPhysics, PxU32>("Version.Minor");
inStream.createProperty<PxPhysics, PxU32>("Version.Bugfix");
inStream.createProperty<PxPhysics, String>("Version.Build");
definePropertyStruct<PxTolerancesScale, PxTolerancesScaleGeneratedValues, PxPhysics>(inStream, "TolerancesScale");
}
{ // PxGeometry
inStream.createClass<PxGeometry>();
inStream.createProperty<PxGeometry, ObjectRef>("Shape", "parents", PropertyType::Scalar);
}
{ // PxBoxGeometry
createClassDeriveAndDefineProperties<PxBoxGeometry, PxGeometry>(inStream);
definePropertyStruct<PxBoxGeometry, PxBoxGeometryGeneratedValues, PxBoxGeometry>(inStream);
}
{ // PxSphereGeometry
createClassDeriveAndDefineProperties<PxSphereGeometry, PxGeometry>(inStream);
definePropertyStruct<PxSphereGeometry, PxSphereGeometryGeneratedValues, PxSphereGeometry>(inStream);
}
{ // PxCapsuleGeometry
createClassDeriveAndDefineProperties<PxCapsuleGeometry, PxGeometry>(inStream);
definePropertyStruct<PxCapsuleGeometry, PxCapsuleGeometryGeneratedValues, PxCapsuleGeometry>(inStream);
}
{ // PxPlaneGeometry
createClassDeriveAndDefineProperties<PxPlaneGeometry, PxGeometry>(inStream);
}
{ // PxConvexMeshGeometry
createClassDeriveAndDefineProperties<PxConvexMeshGeometry, PxGeometry>(inStream);
definePropertyStruct<PxConvexMeshGeometry, PxConvexMeshGeometryGeneratedValues, PxConvexMeshGeometry>(inStream);
}
{ // PxTetrahedronMeshGeometry
createClassDeriveAndDefineProperties<PxTetrahedronMeshGeometry, PxGeometry>(inStream);
definePropertyStruct<PxTetrahedronMeshGeometry, PxTetrahedronMeshGeometryGeneratedValues, PxTetrahedronMeshGeometry>(inStream);
}
{ // PxTriangleMeshGeometry
createClassDeriveAndDefineProperties<PxTriangleMeshGeometry, PxGeometry>(inStream);
definePropertyStruct<PxTriangleMeshGeometry, PxTriangleMeshGeometryGeneratedValues, PxTriangleMeshGeometry>(inStream);
}
{ // PxHeightFieldGeometry
createClassDeriveAndDefineProperties<PxHeightFieldGeometry, PxGeometry>(inStream);
definePropertyStruct<PxHeightFieldGeometry, PxHeightFieldGeometryGeneratedValues, PxHeightFieldGeometry>(inStream);
}
{ // PxCustomGeometry
createClassDeriveAndDefineProperties<PxCustomGeometry, PxGeometry>(inStream);
definePropertyStruct<PxCustomGeometry, PxCustomGeometryGeneratedValues, PxCustomGeometry>(inStream);
}
// PxScene
{
// PT: TODO: why inline this for PvdContact but do PvdRaycast/etc in separate functions?
{ // contact information
inStream.createClass<PvdContact>();
inStream.createProperty<PvdContact, PxVec3>("Point");
inStream.createProperty<PvdContact, PxVec3>("Axis");
inStream.createProperty<PvdContact, ObjectRef>("Shapes[0]");
inStream.createProperty<PvdContact, ObjectRef>("Shapes[1]");
inStream.createProperty<PvdContact, PxF32>("Separation");
inStream.createProperty<PvdContact, PxF32>("NormalForce");
inStream.createProperty<PvdContact, PxU32>("InternalFaceIndex[0]");
inStream.createProperty<PvdContact, PxU32>("InternalFaceIndex[1]");
inStream.createProperty<PvdContact, bool>("NormalForceValid");
}
registerPvdSqHit(inStream);
registerPvdRaycast(inStream);
registerPvdSweep(inStream);
registerPvdOverlap(inStream);
inStream.createClass<PxScene>();
PvdPropertyDefinitionHelper& helper(inStream.getPropertyDefinitionHelper());
PvdClassInfoDefine definitionObj(helper, getPvdNamespacedNameForType<PxScene>());
visitAllPvdProperties<PxSceneDesc>(definitionObj);
helper.pushName("SimulationStatistics");
visitAllPvdProperties<PxSimulationStatistics>(definitionObj);
helper.popName();
inStream.createProperty<PxScene, ObjectRef>("Physics", "parents", PropertyType::Scalar);
inStream.createProperty<PxScene, PxU32>("Timestamp");
inStream.createProperty<PxScene, PxReal>("SimulateElapsedTime");
definePropertyStruct<PxSceneDesc, PxSceneDescGeneratedValues, PxScene>(inStream);
definePropertyStruct<PxSimulationStatistics, PxSimulationStatisticsGeneratedValues, PxScene>(inStream, "SimulationStatistics");
inStream.createProperty<PxScene, PvdContact>("Contacts", "", PropertyType::Array);
inStream.createProperty<PxScene, PvdOverlap>("SceneQueries.Overlaps", "", PropertyType::Array);
inStream.createProperty<PxScene, PvdSweep>("SceneQueries.Sweeps", "", PropertyType::Array);
inStream.createProperty<PxScene, PvdSqHit>("SceneQueries.Hits", "", PropertyType::Array);
inStream.createProperty<PxScene, PvdRaycast>("SceneQueries.Raycasts", "", PropertyType::Array);
inStream.createProperty<PxScene, PxTransform>("SceneQueries.PoseList", "", PropertyType::Array);
inStream.createProperty<PxScene, PxFilterData>("SceneQueries.FilterDataList", "", PropertyType::Array);
inStream.createProperty<PxScene, ObjectRef>("SceneQueries.GeometryList", "", PropertyType::Array);
inStream.createProperty<PxScene, PvdOverlap>("BatchedQueries.Overlaps", "", PropertyType::Array);
inStream.createProperty<PxScene, PvdSweep>("BatchedQueries.Sweeps", "", PropertyType::Array);
inStream.createProperty<PxScene, PvdSqHit>("BatchedQueries.Hits", "", PropertyType::Array);
inStream.createProperty<PxScene, PvdRaycast>("BatchedQueries.Raycasts", "", PropertyType::Array);
inStream.createProperty<PxScene, PxTransform>("BatchedQueries.PoseList", "", PropertyType::Array);
inStream.createProperty<PxScene, PxFilterData>("BatchedQueries.FilterDataList", "", PropertyType::Array);
inStream.createProperty<PxScene, ObjectRef>("BatchedQueries.GeometryList", "", PropertyType::Array);
inStream.createProperty<PxScene, ObjectRef>("RigidStatics", "children", PropertyType::Array);
inStream.createProperty<PxScene, ObjectRef>("RigidDynamics", "children", PropertyType::Array);
inStream.createProperty<PxScene, ObjectRef>("Articulations", "children", PropertyType::Array);
inStream.createProperty<PxScene, ObjectRef>("Joints", "children", PropertyType::Array);
inStream.createProperty<PxScene, ObjectRef>("Aggregates", "children", PropertyType::Array);
}
// PxMaterial
{
createClassAndDefineProperties<PxMaterial>(inStream);
definePropertyStruct<PxMaterial, PxMaterialGeneratedValues, PxMaterial>(inStream);
inStream.createProperty<PxMaterial, ObjectRef>("Physics", "parents", PropertyType::Scalar);
}
// PxHeightField
{
{
inStream.createClass<PxHeightFieldSample>();
inStream.createProperty<PxHeightFieldSample, PxU16>("Height");
inStream.createProperty<PxHeightFieldSample, PxU8>("MaterialIndex[0]");
inStream.createProperty<PxHeightFieldSample, PxU8>("MaterialIndex[1]");
}
inStream.createClass<PxHeightField>();
// It is important the PVD fields match the RepX fields, so this has
// to be hand coded.
PvdPropertyDefinitionHelper& helper(inStream.getPropertyDefinitionHelper());
PvdClassInfoDefine definitionObj(helper, getPvdNamespacedNameForType<PxHeightField>());
visitAllPvdProperties<PxHeightFieldDesc>(definitionObj);
inStream.createProperty<PxHeightField, PxHeightFieldSample>("Samples", "", PropertyType::Array);
inStream.createProperty<PxHeightField, ObjectRef>("Physics", "parents", PropertyType::Scalar);
definePropertyStruct<PxHeightFieldDesc, PxHeightFieldDescGeneratedValues, PxHeightField>(inStream);
}
// PxConvexMesh
{
{ // hull polygon data.
inStream.createClass<PvdHullPolygonData>();
inStream.createProperty<PvdHullPolygonData, PxU16>("NumVertices");
inStream.createProperty<PvdHullPolygonData, PxU16>("IndexBase");
}
inStream.createClass<PxConvexMesh>();
inStream.createProperty<PxConvexMesh, PxF32>("Mass");
inStream.createProperty<PxConvexMesh, PxMat33>("LocalInertia");
inStream.createProperty<PxConvexMesh, PxVec3>("LocalCenterOfMass");
inStream.createProperty<PxConvexMesh, PxVec3>("Points", "", PropertyType::Array);
inStream.createProperty<PxConvexMesh, PvdHullPolygonData>("HullPolygons", "", PropertyType::Array);
inStream.createProperty<PxConvexMesh, PxU8>("PolygonIndexes", "", PropertyType::Array);
inStream.createProperty<PxConvexMesh, ObjectRef>("Physics", "parents", PropertyType::Scalar);
}
// PxTriangleMesh
{
inStream.createClass<PxTriangleMesh>();
inStream.createProperty<PxTriangleMesh, PxVec3>("Points", "", PropertyType::Array);
inStream.createProperty<PxTriangleMesh, PxU32>("NbTriangles", "", PropertyType::Scalar);
inStream.createProperty<PxTriangleMesh, PxU32>("Triangles", "", PropertyType::Array);
inStream.createProperty<PxTriangleMesh, PxU16>("MaterialIndices", "", PropertyType::Array);
inStream.createProperty<PxTriangleMesh, ObjectRef>("Physics", "parents", PropertyType::Scalar);
}
// PxTetrahedronMesh
{
inStream.createClass<PxTetrahedronMesh>();
inStream.createProperty<PxTetrahedronMesh, PxVec3>("Points", "", PropertyType::Array);
inStream.createProperty<PxTetrahedronMesh, PxU32>("NbTriangles", "", PropertyType::Scalar);
inStream.createProperty<PxTetrahedronMesh, PxU32>("Triangles", "", PropertyType::Array);
inStream.createProperty<PxTetrahedronMesh, ObjectRef>("Physics", "parents", PropertyType::Scalar);
}
// PxFEMSoftBodyMaterial
{
createClassAndDefineProperties<PxFEMSoftBodyMaterial>(inStream);
definePropertyStruct<PxFEMSoftBodyMaterial, PxFEMSoftBodyMaterialGeneratedValues, PxFEMSoftBodyMaterial>(inStream);
inStream.createProperty<PxFEMSoftBodyMaterial, ObjectRef>("Physics", "parents", PropertyType::Scalar);
}
// PxFEMClothMaterial
// jcarius: Commented-out until FEMCloth is not under construction anymore
// {
// createClassAndDefineProperties<PxFEMClothMaterial>(inStream);
// definePropertyStruct<PxFEMClothMaterial, PxFEMClothMaterialGeneratedValues, PxFEMClothMaterial>(inStream);
// inStream.createProperty<PxFEMClothMaterial, ObjectRef>("Physics", "parents", PropertyType::Scalar);
// }
{ // PxShape
createClassAndDefineProperties<PxShape>(inStream);
definePropertyStruct<PxShape, PxShapeGeneratedValues, PxShape>(inStream);
inStream.createProperty<PxShape, ObjectRef>("Geometry", "children");
inStream.createProperty<PxShape, ObjectRef>("Materials", "children", PropertyType::Array);
inStream.createProperty<PxShape, ObjectRef>("Actor", "parents");
}
// PxActor
{
createClassAndDefineProperties<PxActor>(inStream);
inStream.createProperty<PxActor, ObjectRef>("Scene", "parents");
}
// PxRigidActor
{
createClassDeriveAndDefineProperties<PxRigidActor, PxActor>(inStream);
inStream.createProperty<PxRigidActor, ObjectRef>("Shapes", "children", PropertyType::Array);
inStream.createProperty<PxRigidActor, ObjectRef>("Joints", "children", PropertyType::Array);
}
// PxRigidStatic
{
createClassDeriveAndDefineProperties<PxRigidStatic, PxRigidActor>(inStream);
definePropertyStruct<PxRigidStatic, PxRigidStaticGeneratedValues, PxRigidStatic>(inStream);
}
{ // PxRigidBody
createClassDeriveAndDefineProperties<PxRigidBody, PxRigidActor>(inStream);
}
// PxRigidDynamic
{
createClassDeriveAndDefineProperties<PxRigidDynamic, PxRigidBody>(inStream);
// If anyone adds a 'getKinematicTarget' to PxRigidDynamic you can remove the line
// below (after the code generator has run).
inStream.createProperty<PxRigidDynamic, PxTransform>("KinematicTarget");
definePropertyStruct<PxRigidDynamic, PxRigidDynamicGeneratedValues, PxRigidDynamic>(inStream);
// Manually define the update struct.
PvdPropertyDefinitionHelper& helper(inStream.getPropertyDefinitionHelper());
/*struct PxRigidDynamicUpdateBlock
{
Transform GlobalPose;
Float3 LinearVelocity;
Float3 AngularVelocity;
PxU8 IsSleeping;
PxU8 padding[3];
};
*/
helper.pushName("GlobalPose");
helper.addPropertyMessageArg<PxTransform>(PX_OFFSET_OF_RT(PxRigidDynamicUpdateBlock, GlobalPose));
helper.popName();
helper.pushName("LinearVelocity");
helper.addPropertyMessageArg<PxVec3>(PX_OFFSET_OF_RT(PxRigidDynamicUpdateBlock, LinearVelocity));
helper.popName();
helper.pushName("AngularVelocity");
helper.addPropertyMessageArg<PxVec3>(PX_OFFSET_OF_RT(PxRigidDynamicUpdateBlock, AngularVelocity));
helper.popName();
helper.pushName("IsSleeping");
helper.addPropertyMessageArg<bool>(PX_OFFSET_OF_RT(PxRigidDynamicUpdateBlock, IsSleeping));
helper.popName();
helper.addPropertyMessage<PxRigidDynamic, PxRigidDynamicUpdateBlock>();
}
// PxArticulationReducedCoordinate
{
createClassAndDefineProperties<PxArticulationReducedCoordinate>(inStream);
inStream.createProperty<PxArticulationReducedCoordinate, ObjectRef>("Scene", "parents");
inStream.createProperty<PxArticulationReducedCoordinate, ObjectRef>("Links", "children", PropertyType::Array);
definePropertyStruct<PxArticulationReducedCoordinate, PxArticulationReducedCoordinateGeneratedValues, PxArticulationReducedCoordinate>(inStream);
}
{ // PxArticulationLink
createClassDeriveAndDefineProperties<PxArticulationLink, PxRigidBody>(inStream);
inStream.createProperty<PxArticulationLink, ObjectRef>("Parent", "parents");
inStream.createProperty<PxArticulationLink, ObjectRef>("Links", "children", PropertyType::Array);
inStream.createProperty<PxArticulationLink, ObjectRef>("InboundJoint", "children");
definePropertyStruct<PxArticulationLink, PxArticulationLinkGeneratedValues, PxArticulationLink>(inStream);
PvdPropertyDefinitionHelper& helper(inStream.getPropertyDefinitionHelper());
/*struct PxArticulationLinkUpdateBlock
{
Transform GlobalPose;
Float3 LinearVelocity;
Float3 AngularVelocity;
};*/
helper.pushName("GlobalPose");
helper.addPropertyMessageArg<PxTransform>(PX_OFFSET_OF(PxArticulationLinkUpdateBlock, GlobalPose));
helper.popName();
helper.pushName("LinearVelocity");
helper.addPropertyMessageArg<PxVec3>(PX_OFFSET_OF(PxArticulationLinkUpdateBlock, LinearVelocity));
helper.popName();
helper.pushName("AngularVelocity");
helper.addPropertyMessageArg<PxVec3>(PX_OFFSET_OF(PxArticulationLinkUpdateBlock, AngularVelocity));
helper.popName();
helper.addPropertyMessage<PxArticulationLink, PxArticulationLinkUpdateBlock>();
}
{ // PxArticulationJoint
createClassAndDefineProperties<PxArticulationJointReducedCoordinate>(inStream);
inStream.createProperty<PxArticulationJointReducedCoordinate, ObjectRef>("Link", "parents");
definePropertyStruct<PxArticulationJointReducedCoordinate, PxArticulationJointReducedCoordinateGeneratedValues, PxArticulationJointReducedCoordinate>(inStream);
PvdPropertyDefinitionHelper& helper(inStream.getPropertyDefinitionHelper());
helper.pushName("JointPosition[eX]");
helper.addPropertyMessageArg<PxReal>(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointPosition_eX));
helper.popName();
helper.pushName("JointPosition[eY]");
helper.addPropertyMessageArg<PxReal>(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointPosition_eY));
helper.popName();
helper.pushName("JointPosition[eZ]");
helper.addPropertyMessageArg<PxReal>(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointPosition_eZ));
helper.popName();
helper.pushName("JointPosition[eTWIST]");
helper.addPropertyMessageArg<PxReal>(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointPosition_eTwist));
helper.popName();
helper.pushName("JointPosition[eSWING1]");
helper.addPropertyMessageArg<PxReal>(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointPosition_eSwing1));
helper.popName();
helper.pushName("JointPosition[eSWING2]");
helper.addPropertyMessageArg<PxReal>(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointPosition_eSwing2));
helper.popName();
helper.pushName("JointVelocity[eX]");
helper.addPropertyMessageArg<PxReal>(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointVelocity_eX));
helper.popName();
helper.pushName("JointVelocity[eY]");
helper.addPropertyMessageArg<PxReal>(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointVelocity_eY));
helper.popName();
helper.pushName("JointVelocity[eZ]");
helper.addPropertyMessageArg<PxReal>(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointVelocity_eZ));
helper.popName();
helper.pushName("JointVelocity[eTWIST]");
helper.addPropertyMessageArg<PxReal>(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointVelocity_eTwist));
helper.popName();
helper.pushName("JointVelocity[eSWING1]");
helper.addPropertyMessageArg<PxReal>(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointVelocity_eSwing1));
helper.popName();
helper.pushName("JointVelocity[eSWING2]");
helper.addPropertyMessageArg<PxReal>(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointVelocity_eSwing2));
helper.popName();
helper.addPropertyMessage<PxArticulationJointReducedCoordinate, PxArticulationJointUpdateBlock>();
}
{ // PxConstraint
createClassAndDefineProperties<PxConstraint>(inStream);
definePropertyStruct<PxConstraint, PxConstraintGeneratedValues, PxConstraint>(inStream);
}
{
// PxAggregate
createClassAndDefineProperties<PxAggregate>(inStream);
inStream.createProperty<PxAggregate, ObjectRef>("Scene", "parents");
definePropertyStruct<PxAggregate, PxAggregateGeneratedValues, PxAggregate>(inStream);
inStream.createProperty<PxAggregate, ObjectRef>("Actors", "children", PropertyType::Array);
inStream.createProperty<PxAggregate, ObjectRef>("Articulations", "children", PropertyType::Array);
}
}
template <typename TClassType, typename TValueType, typename TDataType>
static void doSendAllProperties(PvdDataStream& inStream, const TDataType* inDatatype, const void* instanceId)
{
TValueType theValues(inDatatype);
inStream.setPropertyMessage(instanceId, theValues);
}
void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxPhysics& inPhysics)
{
PxTolerancesScale theScale(inPhysics.getTolerancesScale());
doSendAllProperties<PxPhysics, PxTolerancesScaleGeneratedValues>(inStream, &theScale, &inPhysics);
inStream.setPropertyValue(&inPhysics, "Version.Major", PxU32(PX_PHYSICS_VERSION_MAJOR));
inStream.setPropertyValue(&inPhysics, "Version.Minor", PxU32(PX_PHYSICS_VERSION_MINOR));
inStream.setPropertyValue(&inPhysics, "Version.Bugfix", PxU32(PX_PHYSICS_VERSION_BUGFIX));
#if PX_DEBUG
String buildType = "Debug";
#elif PX_CHECKED
String buildType = "Checked";
#elif PX_PROFILE
String buildType = "Profile";
#else
String buildType = "Release";
#endif
inStream.setPropertyValue(&inPhysics, "Version.Build", buildType);
}
void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxScene& inScene)
{
const PxPhysics& physics(const_cast<PxScene&>(inScene).getPhysics());
PxTolerancesScale theScale;
PxSceneDesc theDesc(theScale);
{
// setDominanceGroupPair ?
theDesc.gravity = inScene.getGravity();
theDesc.simulationEventCallback = inScene.getSimulationEventCallback();
theDesc.contactModifyCallback = inScene.getContactModifyCallback();
theDesc.ccdContactModifyCallback = inScene.getCCDContactModifyCallback();
theDesc.filterShaderData = inScene.getFilterShaderData();
theDesc.filterShaderDataSize = inScene.getFilterShaderDataSize();
theDesc.filterShader = inScene.getFilterShader();
theDesc.filterCallback = inScene.getFilterCallback();
// PxPairFilteringMode::Enum KineKineFilteringMode;
// PxPairFilteringMode::Enum StaticKineFilteringMode;
theDesc.broadPhaseType = inScene.getBroadPhaseType();
theDesc.broadPhaseCallback = inScene.getBroadPhaseCallback();
theDesc.limits = inScene.getLimits();
theDesc.frictionType = inScene.getFrictionType();
// PxSolverType::Enum SolverType;
theDesc.bounceThresholdVelocity = inScene.getBounceThresholdVelocity();
theDesc.frictionOffsetThreshold = inScene.getFrictionOffsetThreshold();
theDesc.frictionCorrelationDistance = inScene.getFrictionCorrelationDistance();
theDesc.flags = inScene.getFlags();
theDesc.cpuDispatcher = inScene.getCpuDispatcher();
theDesc.cudaContextManager = inScene.getCudaContextManager();
theDesc.staticStructure = inScene.getStaticStructure();
theDesc.dynamicStructure = inScene.getDynamicStructure();
theDesc.dynamicTreeRebuildRateHint = inScene.getDynamicTreeRebuildRateHint();
theDesc.sceneQueryUpdateMode = inScene.getSceneQueryUpdateMode();
theDesc.userData = inScene.userData;
theDesc.solverBatchSize = inScene.getSolverBatchSize();
theDesc.solverArticulationBatchSize = inScene.getSolverArticulationBatchSize();
// PxU32 NbContactDataBlocks;
// PxU32 MaxNbContactDataBlocks;
// theDesc.nbContactDataBlocks = inScene.getNbContactDataBlocksUsed();
// theDesc.maxNbContactDataBlocks = inScene.getMaxNbContactDataBlocksUsed();
theDesc.maxBiasCoefficient = inScene.getMaxBiasCoefficient();
theDesc.contactReportStreamBufferSize = inScene.getContactReportStreamBufferSize();
theDesc.ccdMaxPasses = inScene.getCCDMaxPasses();
theDesc.ccdThreshold = inScene.getCCDThreshold();
theDesc.ccdMaxSeparation = inScene.getCCDMaxSeparation();
// theDesc.simulationOrder = inScene.getSimulationOrder();
theDesc.wakeCounterResetValue = inScene.getWakeCounterResetValue();
theDesc.gpuDynamicsConfig = inScene.getGpuDynamicsConfig();
// PxBounds3 SanityBounds;
// PxgDynamicsMemoryConfig GpuDynamicsConfig;
// PxU32 GpuMaxNumPartitions;
// PxU32 GpuComputeVersion;
// PxReal BroadPhaseInflation;
// PxU32 ContactPairSlabSize;
}
PxSceneDescGeneratedValues theValues(&theDesc);
inStream.setPropertyMessage(&inScene, theValues);
// Create parent/child relationship.
inStream.setPropertyValue(&inScene, "Physics", reinterpret_cast<const void*>(&physics));
inStream.pushBackObjectRef(&physics, "Scenes", &inScene);
}
void PvdMetaDataBinding::sendBeginFrame(PvdDataStream& inStream, const PxScene* inScene, PxReal simulateElapsedTime)
{
inStream.beginSection(inScene, "frame");
inStream.setPropertyValue(inScene, "Timestamp", inScene->getTimestamp());
inStream.setPropertyValue(inScene, "SimulateElapsedTime", simulateElapsedTime);
}
template <typename TDataType>
struct NullConverter
{
void operator()(TDataType& data, const TDataType& src)
{
data = src;
}
};
template <typename TTargetType, PxU32 T_NUM_ITEMS, typename TSourceType = TTargetType,
typename Converter = NullConverter<TTargetType> >
class ScopedPropertyValueSender
{
TTargetType mStack[T_NUM_ITEMS];
TTargetType* mCur;
const TTargetType* mEnd;
PvdDataStream& mStream;
public:
ScopedPropertyValueSender(PvdDataStream& inStream, const void* inObj, String name)
: mCur(mStack), mEnd(&mStack[T_NUM_ITEMS]), mStream(inStream)
{
mStream.beginSetPropertyValue(inObj, name, getPvdNamespacedNameForType<TTargetType>());
}
~ScopedPropertyValueSender()
{
if(mStack != mCur)
{
PxU32 size = sizeof(TTargetType) * PxU32(mCur - mStack);
mStream.appendPropertyValueData(DataRef<const PxU8>(reinterpret_cast<PxU8*>(mStack), size));
}
mStream.endSetPropertyValue();
}
void append(const TSourceType& data)
{
Converter()(*mCur, data);
if(mCur < mEnd - 1)
++mCur;
else
{
mStream.appendPropertyValueData(DataRef<const PxU8>(reinterpret_cast<PxU8*>(mStack), sizeof mStack));
mCur = mStack;
}
}
private:
ScopedPropertyValueSender& operator=(const ScopedPropertyValueSender&);
};
void PvdMetaDataBinding::sendContacts(PvdDataStream& inStream, const PxScene& inScene)
{
inStream.setPropertyValue(&inScene, "Contacts", DataRef<const PxU8>(), getPvdNamespacedNameForType<PvdContact>());
}
void PvdMetaDataBinding::sendStats(PvdDataStream& inStream, const PxScene* inScene)
{
PxSimulationStatistics theStats;
inScene->getSimulationStatistics(theStats);
PxSimulationStatisticsGeneratedValues values(&theStats);
inStream.setPropertyMessage(inScene, values);
}
struct PvdContactConverter
{
void operator()(PvdContact& data, const Sc::Contact& src)
{
data.point = src.point;
data.axis = src.normal;
data.shape0 = src.shape0;
data.shape1 = src.shape1;
data.separation = src.separation;
data.normalForce = src.normalForce;
data.internalFaceIndex0 = src.faceIndex0;
data.internalFaceIndex1 = src.faceIndex1;
data.normalForceAvailable = src.normalForceAvailable;
}
};
void PvdMetaDataBinding::sendContacts(PvdDataStream& inStream, const PxScene& inScene, PxArray<Contact>& inContacts)
{
ScopedPropertyValueSender<PvdContact, 32, Sc::Contact, PvdContactConverter> sender(inStream, &inScene, "Contacts");
for(PxU32 i = 0; i < inContacts.size(); i++)
{
sender.append(inContacts[i]);
}
}
void PvdMetaDataBinding::sendEndFrame(PvdDataStream& inStream, const PxScene* inScene)
{
//flush other client
inStream.endSection(inScene, "frame");
}
template <typename TDataType>
static void addPhysicsGroupProperty(PvdDataStream& inStream, const char* groupName, const TDataType& inData, const PxPhysics& ownerPhysics)
{
inStream.setPropertyValue(&inData, "Physics", reinterpret_cast<const void*>(&ownerPhysics));
inStream.pushBackObjectRef(&ownerPhysics, groupName, &inData);
// Buffer type objects *have* to be flushed directly out once created else scene creation doesn't work.
}
template <typename TDataType>
static void removePhysicsGroupProperty(PvdDataStream& inStream, const char* groupName, const TDataType& inData, const PxPhysics& ownerPhysics)
{
inStream.removeObjectRef(&ownerPhysics, groupName, &inData);
inStream.destroyInstance(&inData);
}
void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxMaterial& inMaterial, const PxPhysics& ownerPhysics)
{
inStream.createInstance(&inMaterial);
sendAllProperties(inStream, inMaterial);
addPhysicsGroupProperty(inStream, "Materials", inMaterial, ownerPhysics);
}
void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxMaterial& inMaterial)
{
PxMaterialGeneratedValues values(&inMaterial);
inStream.setPropertyMessage(&inMaterial, values);
}
void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxMaterial& inMaterial, const PxPhysics& ownerPhysics)
{
removePhysicsGroupProperty(inStream, "Materials", inMaterial, ownerPhysics);
}
void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxFEMSoftBodyMaterial& inMaterial, const PxPhysics& ownerPhysics)
{
inStream.createInstance(&inMaterial);
sendAllProperties(inStream, inMaterial);
addPhysicsGroupProperty(inStream, "FEMMaterials", inMaterial, ownerPhysics);
}
void PvdMetaDataBinding::sendAllProperties(PvdDataStream& /*inStream*/, const PxFEMSoftBodyMaterial& /*inMaterial*/)
{
/*PxMaterialGeneratedValues values(&inMaterial);
inStream.setPropertyMessage(&inMaterial, values);*/
}
void PvdMetaDataBinding::destroyInstance(PvdDataStream& /*inStream*/, const PxFEMSoftBodyMaterial& /*inMaterial*/, const PxPhysics& /*ownerPhysics*/)
{
//removePhysicsGroupProperty(inStream, "Materials", inMaterial, ownerPhysics);
}
// jcarius: Commented-out until FEMCloth is not under construction anymore
// void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxFEMClothMaterial& inMaterial, const PxPhysics& ownerPhysics)
// {
// inStream.createInstance(&inMaterial);
// sendAllProperties(inStream, inMaterial);
// addPhysicsGroupProperty(inStream, "FEMMaterials", inMaterial, ownerPhysics);
// }
// void PvdMetaDataBinding::sendAllProperties(PvdDataStream& /*inStream*/, const PxFEMClothMaterial& /*inMaterial*/)
// {
// /*PxMaterialGeneratedValues values(&inMaterial);
// inStream.setPropertyMessage(&inMaterial, values);*/
// }
// void PvdMetaDataBinding::destroyInstance(PvdDataStream& /*inStream*/, const PxFEMClothMaterial& /*inMaterial*/, const PxPhysics& /*ownerPhysics*/)
// {
// //removePhysicsGroupProperty(inStream, "Materials", inMaterial, ownerPhysics);
// }
void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxPBDMaterial& inMaterial, const PxPhysics& ownerPhysics)
{
inStream.createInstance(&inMaterial);
sendAllProperties(inStream, inMaterial);
addPhysicsGroupProperty(inStream, "PBDMaterials", inMaterial, ownerPhysics);
}
void PvdMetaDataBinding::sendAllProperties(PvdDataStream& /*inStream*/, const PxPBDMaterial& /*inMaterial*/)
{
/*PxMaterialGeneratedValues values(&inMaterial);
inStream.setPropertyMessage(&inMaterial, values);*/
}
void PvdMetaDataBinding::destroyInstance(PvdDataStream& /*inStream*/, const PxPBDMaterial& /*inMaterial*/, const PxPhysics& /*ownerPhysics*/)
{
//removePhysicsGroupProperty(inStream, "Materials", inMaterial, ownerPhysics);
}
void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxHeightField& inData)
{
PxHeightFieldDesc theDesc;
// Save the height field to desc.
theDesc.nbRows = inData.getNbRows();
theDesc.nbColumns = inData.getNbColumns();
theDesc.format = inData.getFormat();
theDesc.samples.stride = inData.getSampleStride();
theDesc.samples.data = NULL;
theDesc.convexEdgeThreshold = inData.getConvexEdgeThreshold();
theDesc.flags = inData.getFlags();
PxU32 theCellCount = inData.getNbRows() * inData.getNbColumns();
PxU32 theSampleStride = sizeof(PxHeightFieldSample);
PxU32 theSampleBufSize = theCellCount * theSampleStride;
mBindingData->mTempU8Array.resize(theSampleBufSize);
PxHeightFieldSample* theSamples = reinterpret_cast<PxHeightFieldSample*>(mBindingData->mTempU8Array.begin());
inData.saveCells(theSamples, theSampleBufSize);
theDesc.samples.data = theSamples;
PxHeightFieldDescGeneratedValues values(&theDesc);
inStream.setPropertyMessage(&inData, values);
PxHeightFieldSample* theSampleData = reinterpret_cast<PxHeightFieldSample*>(mBindingData->mTempU8Array.begin());
inStream.setPropertyValue(&inData, "Samples", theSampleData, theCellCount);
}
void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxHeightField& inData, const PxPhysics& ownerPhysics)
{
inStream.createInstance(&inData);
sendAllProperties(inStream, inData);
addPhysicsGroupProperty(inStream, "HeightFields", inData, ownerPhysics);
}
void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxHeightField& inData, const PxPhysics& ownerPhysics)
{
removePhysicsGroupProperty(inStream, "HeightFields", inData, ownerPhysics);
}
void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxConvexMesh& inData, const PxPhysics& ownerPhysics)
{
inStream.createInstance(&inData);
PxReal mass;
PxMat33 localInertia;
PxVec3 localCom;
inData.getMassInformation(mass, localInertia, localCom);
inStream.setPropertyValue(&inData, "Mass", mass);
inStream.setPropertyValue(&inData, "LocalInertia", localInertia);
inStream.setPropertyValue(&inData, "LocalCenterOfMass", localCom);
// update arrays:
// vertex Array:
{
const PxVec3* vertexPtr = inData.getVertices();
const PxU32 numVertices = inData.getNbVertices();
inStream.setPropertyValue(&inData, "Points", vertexPtr, numVertices);
}
// HullPolyArray:
PxU16 maxIndices = 0;
{
PxU32 numPolygons = inData.getNbPolygons();
PvdHullPolygonData* tempData = mBindingData->allocateTemp<PvdHullPolygonData>(numPolygons);
// Get the polygon data stripping the plane equations
for(PxU32 index = 0; index < numPolygons; index++)
{
PxHullPolygon curOut;
inData.getPolygonData(index, curOut);
maxIndices = PxMax(maxIndices, PxU16(curOut.mIndexBase + curOut.mNbVerts));
tempData[index].mIndexBase = curOut.mIndexBase;
tempData[index].mNumVertices = curOut.mNbVerts;
}
inStream.setPropertyValue(&inData, "HullPolygons", tempData, numPolygons);
}
// poly index Array:
{
const PxU8* indices = inData.getIndexBuffer();
inStream.setPropertyValue(&inData, "PolygonIndexes", indices, maxIndices);
}
addPhysicsGroupProperty(inStream, "ConvexMeshes", inData, ownerPhysics);
}
void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxConvexMesh& inData, const PxPhysics& ownerPhysics)
{
removePhysicsGroupProperty(inStream, "ConvexMeshes", inData, ownerPhysics);
}
void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxTetrahedronMesh& inData, const PxPhysics& ownerPhysics)
{
inStream.createInstance(&inData);
// vertex Array:
{
const PxVec3* vertexPtr = inData.getVertices();
const PxU32 numVertices = inData.getNbVertices();
inStream.setPropertyValue(&inData, "Vertices", vertexPtr, numVertices);
}
////invert mass array
//{
// const float* invMassPtr = inData.getVertInvMasses();
// const PxU32 numVertices = inData.getCollisionMesh().getNbVertices();
// inStream.setPropertyValue(&inData, "invert mass", invMassPtr, numVertices);
//}
// index Array:
{
const bool has16BitIndices = inData.getTetrahedronMeshFlags() & PxTetrahedronMeshFlag::e16_BIT_INDICES ? true : false;
const PxU32 numTetrahedrons= inData.getNbTetrahedrons();
inStream.setPropertyValue(&inData, "NbTetrahedron", numTetrahedrons);
const PxU32 numIndexes = numTetrahedrons * 4;
const PxU8* tetrahedronsPtr = reinterpret_cast<const PxU8*>(inData.getTetrahedrons());
// We declared this type as a 32 bit integer above.
// PVD will automatically unsigned-extend data that is smaller than the target type.
if (has16BitIndices)
inStream.setPropertyValue(&inData, "Tetrahedrons", reinterpret_cast<const PxU16*>(tetrahedronsPtr), numIndexes);
else
inStream.setPropertyValue(&inData, "Tetrahedrons", reinterpret_cast<const PxU32*>(tetrahedronsPtr), numIndexes);
}
addPhysicsGroupProperty(inStream, "TetrahedronMeshes", inData, ownerPhysics);
}
void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxTetrahedronMesh& inData, const PxPhysics& ownerPhysics)
{
removePhysicsGroupProperty(inStream, "TetrahedronMeshes", inData, ownerPhysics);
}
void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxTriangleMesh& inData, const PxPhysics& ownerPhysics)
{
inStream.createInstance(&inData);
bool hasMatIndex = inData.getTriangleMaterialIndex(0) != 0xffff;
// update arrays:
// vertex Array:
{
const PxVec3* vertexPtr = inData.getVertices();
const PxU32 numVertices = inData.getNbVertices();
inStream.setPropertyValue(&inData, "Points", vertexPtr, numVertices);
}
// index Array:
{
const bool has16BitIndices = inData.getTriangleMeshFlags() & PxTriangleMeshFlag::e16_BIT_INDICES ? true : false;
const PxU32 numTriangles = inData.getNbTriangles();
inStream.setPropertyValue(&inData, "NbTriangles", numTriangles);
const PxU32 numIndexes = numTriangles * 3;
const PxU8* trianglePtr = reinterpret_cast<const PxU8*>(inData.getTriangles());
// We declared this type as a 32 bit integer above.
// PVD will automatically unsigned-extend data that is smaller than the target type.
if(has16BitIndices)
inStream.setPropertyValue(&inData, "Triangles", reinterpret_cast<const PxU16*>(trianglePtr), numIndexes);
else
inStream.setPropertyValue(&inData, "Triangles", reinterpret_cast<const PxU32*>(trianglePtr), numIndexes);
}
// material Array:
if(hasMatIndex)
{
PxU32 numMaterials = inData.getNbTriangles();
PxU16* matIndexData = mBindingData->allocateTemp<PxU16>(numMaterials);
for(PxU32 m = 0; m < numMaterials; m++)
matIndexData[m] = inData.getTriangleMaterialIndex(m);
inStream.setPropertyValue(&inData, "MaterialIndices", matIndexData, numMaterials);
}
addPhysicsGroupProperty(inStream, "TriangleMeshes", inData, ownerPhysics);
}
void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxTriangleMesh& inData, const PxPhysics& ownerPhysics)
{
removePhysicsGroupProperty(inStream, "TriangleMeshes", inData, ownerPhysics);
}
template <typename TDataType>
void PvdMetaDataBinding::registrarPhysicsObject(PvdDataStream&, const TDataType&, PsPvd*)
{
}
template <>
void PvdMetaDataBinding::registrarPhysicsObject<PxConvexMeshGeometry>(PvdDataStream& inStream, const PxConvexMeshGeometry& geom, PsPvd* pvd)
{
if(pvd->registerObject(geom.convexMesh))
createInstance(inStream, *geom.convexMesh, PxGetPhysics());
}
template <>
void PvdMetaDataBinding::registrarPhysicsObject<PxTetrahedronMeshGeometry>(PvdDataStream& inStream, const PxTetrahedronMeshGeometry& geom, PsPvd* pvd)
{
if (pvd->registerObject(geom.tetrahedronMesh))
createInstance(inStream, *geom.tetrahedronMesh, PxGetPhysics());
}
template <>
void PvdMetaDataBinding::registrarPhysicsObject<PxTriangleMeshGeometry>(PvdDataStream& inStream, const PxTriangleMeshGeometry& geom, PsPvd* pvd)
{
if(pvd->registerObject(geom.triangleMesh))
createInstance(inStream, *geom.triangleMesh, PxGetPhysics());
}
template <>
void PvdMetaDataBinding::registrarPhysicsObject<PxHeightFieldGeometry>(PvdDataStream& inStream, const PxHeightFieldGeometry& geom, PsPvd* pvd)
{
if(pvd->registerObject(geom.heightField))
createInstance(inStream, *geom.heightField, PxGetPhysics());
}
template <typename TGeneratedValuesType, typename TGeomType>
static void sendGeometry(PvdMetaDataBinding& metaBind, PvdDataStream& inStream, const PxShape& inShape, const TGeomType& geom, PsPvd* pvd)
{
const void* geomInst = (reinterpret_cast<const PxU8*>(&inShape)) + 4;
inStream.createInstance(getPvdNamespacedNameForType<TGeomType>(), geomInst);
metaBind.registrarPhysicsObject<TGeomType>(inStream, geom, pvd);
TGeneratedValuesType values(&geom);
inStream.setPropertyMessage(geomInst, values);
inStream.setPropertyValue(&inShape, "Geometry", geomInst);
inStream.setPropertyValue(geomInst, "Shape", reinterpret_cast<const void*>(&inShape));
}
static void setGeometry(PvdMetaDataBinding& metaBind, PvdDataStream& inStream, const PxShape& inObj, PsPvd* pvd)
{
const PxGeometry& geom = inObj.getGeometry();
switch(geom.getType())
{
#define SEND_PVD_GEOM_TYPE(enumType, geomType, valueType) \
case PxGeometryType::enumType: \
{ \
Px##geomType geomT = static_cast<const Px##geomType&>(geom); \
sendGeometry<valueType>(metaBind, inStream, inObj, geomT, pvd); \
} \
break;
SEND_PVD_GEOM_TYPE(eSPHERE, SphereGeometry, PxSphereGeometryGeneratedValues);
// Plane geometries don't have any properties, so this avoids using a property
// struct for them.
case PxGeometryType::ePLANE:
{
const void* geomInst = (reinterpret_cast<const PxU8*>(&inObj)) + 4;
inStream.createInstance(getPvdNamespacedNameForType<PxPlaneGeometry>(), geomInst);
inStream.setPropertyValue(&inObj, "Geometry", geomInst);
inStream.setPropertyValue(geomInst, "Shape", reinterpret_cast<const void*>(&inObj));
}
break;
SEND_PVD_GEOM_TYPE(eCAPSULE, CapsuleGeometry, PxCapsuleGeometryGeneratedValues);
SEND_PVD_GEOM_TYPE(eBOX, BoxGeometry, PxBoxGeometryGeneratedValues);
SEND_PVD_GEOM_TYPE(eCONVEXMESH, ConvexMeshGeometry, PxConvexMeshGeometryGeneratedValues);
SEND_PVD_GEOM_TYPE(eTETRAHEDRONMESH, TetrahedronMeshGeometry, PxTetrahedronMeshGeometryGeneratedValues);
SEND_PVD_GEOM_TYPE(eTRIANGLEMESH, TriangleMeshGeometry, PxTriangleMeshGeometryGeneratedValues);
SEND_PVD_GEOM_TYPE(eHEIGHTFIELD, HeightFieldGeometry, PxHeightFieldGeometryGeneratedValues);
SEND_PVD_GEOM_TYPE(eCUSTOM, CustomGeometry, PxCustomGeometryGeneratedValues);
#undef SEND_PVD_GEOM_TYPE
case PxGeometryType::ePARTICLESYSTEM:
// A.B. implement later
break;
case PxGeometryType::eHAIRSYSTEM:
break;
case PxGeometryType::eGEOMETRY_COUNT:
case PxGeometryType::eINVALID:
PX_ASSERT(false);
break;
}
}
static void setMaterials(PvdMetaDataBinding& metaBing, PvdDataStream& inStream, const PxShape& inObj, PsPvd* pvd, PvdMetaDataBindingData* mBindingData)
{
PxU32 numMaterials = inObj.getNbMaterials();
PxMaterial** materialPtr = mBindingData->allocateTemp<PxMaterial*>(numMaterials);
inObj.getMaterials(materialPtr, numMaterials);
for(PxU32 idx = 0; idx < numMaterials; ++idx)
{
if(pvd->registerObject(materialPtr[idx]))
metaBing.createInstance(inStream, *materialPtr[idx], PxGetPhysics());
inStream.pushBackObjectRef(&inObj, "Materials", materialPtr[idx]);
}
}
void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxShape& inObj, const PxRigidActor& owner, const PxPhysics& ownerPhysics, PsPvd* pvd)
{
if(!inStream.isInstanceValid(&owner))
return;
const OwnerActorsMap::Entry* entry = mBindingData->mOwnerActorsMap.find(&inObj);
if(entry != NULL)
{
if(!mBindingData->mOwnerActorsMap[&inObj]->contains(&owner))
mBindingData->mOwnerActorsMap[&inObj]->insert(&owner);
}
else
{
OwnerActorsValueType* data = reinterpret_cast<OwnerActorsValueType*>(
PX_ALLOC(sizeof(OwnerActorsValueType), "mOwnerActorsMapValue")); //( 1 );
OwnerActorsValueType* actors = PX_PLACEMENT_NEW(data, OwnerActorsValueType);
actors->insert(&owner);
mBindingData->mOwnerActorsMap.insert(&inObj, actors);
}
if(inStream.isInstanceValid(&inObj))
{
inStream.pushBackObjectRef(&owner, "Shapes", &inObj);
return;
}
inStream.createInstance(&inObj);
inStream.pushBackObjectRef(&owner, "Shapes", &inObj);
inStream.setPropertyValue(&inObj, "Actor", reinterpret_cast<const void*>(&owner));
sendAllProperties(inStream, inObj);
setGeometry(*this, inStream, inObj, pvd);
setMaterials(*this, inStream, inObj, pvd, mBindingData);
if(!inObj.isExclusive())
inStream.pushBackObjectRef(&ownerPhysics, "SharedShapes", &inObj);
}
void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxShape& inObj)
{
PxShapeGeneratedValues values(&inObj);
inStream.setPropertyMessage(&inObj, values);
}
void PvdMetaDataBinding::releaseAndRecreateGeometry(PvdDataStream& inStream, const PxShape& inObj, PxPhysics& /*ownerPhysics*/, PsPvd* pvd)
{
const void* geomInst = (reinterpret_cast<const PxU8*>(&inObj)) + 4;
inStream.destroyInstance(geomInst);
const PxGeometry& geom = inObj.getGeometry();
// Quick fix for HF modify, PxConvexMesh and PxTriangleMesh need recook, they should always be new if modified
if(geom.getType() == PxGeometryType::eHEIGHTFIELD)
{
const PxHeightFieldGeometry& hfGeom = static_cast<const PxHeightFieldGeometry&>(geom);
if(inStream.isInstanceValid(hfGeom.heightField))
sendAllProperties(inStream, *hfGeom.heightField);
}
setGeometry(*this, inStream, inObj, pvd);
// Need update actor cause PVD takes actor-shape as a pair.
{
PxRigidActor* actor = inObj.getActor();
if(actor != NULL)
{
if(const PxRigidStatic* rgS = actor->is<PxRigidStatic>())
sendAllProperties(inStream, *rgS);
else if(const PxRigidDynamic* rgD = actor->is<PxRigidDynamic>())
sendAllProperties(inStream, *rgD);
}
}
}
void PvdMetaDataBinding::updateMaterials(PvdDataStream& inStream, const PxShape& inObj, PsPvd* pvd)
{
// Clear the shape's materials array.
inStream.setPropertyValue(&inObj, "Materials", DataRef<const PxU8>(), getPvdNamespacedNameForType<ObjectRef>());
setMaterials(*this, inStream, inObj, pvd, mBindingData);
}
void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxShape& inObj, const PxRigidActor& owner)
{
if(inStream.isInstanceValid(&inObj))
{
inStream.removeObjectRef(&owner, "Shapes", &inObj);
bool bDestroy = true;
const OwnerActorsMap::Entry* entry0 = mBindingData->mOwnerActorsMap.find(&inObj);
if(entry0 != NULL)
{
entry0->second->erase(&owner);
if(entry0->second->size() > 0)
bDestroy = false;
else
{
mBindingData->mOwnerActorsMap[&inObj]->~OwnerActorsValueType();
PX_FREE(mBindingData->mOwnerActorsMap[&inObj]);
mBindingData->mOwnerActorsMap.erase(&inObj);
}
}
if(bDestroy)
{
if(!inObj.isExclusive())
inStream.removeObjectRef(&PxGetPhysics(), "SharedShapes", &inObj);
const void* geomInst = (reinterpret_cast<const PxU8*>(&inObj)) + 4;
inStream.destroyInstance(geomInst);
inStream.destroyInstance(&inObj);
const OwnerActorsMap::Entry* entry = mBindingData->mOwnerActorsMap.find(&inObj);
if(entry != NULL)
{
entry->second->~OwnerActorsValueType();
OwnerActorsValueType* ptr = entry->second;
PX_FREE(ptr);
mBindingData->mOwnerActorsMap.erase(&inObj);
}
}
}
}
template <typename TDataType>
static void addSceneGroupProperty(PvdDataStream& inStream, const char* groupName, const TDataType& inObj, const PxScene& inScene)
{
inStream.createInstance(&inObj);
inStream.pushBackObjectRef(&inScene, groupName, &inObj);
inStream.setPropertyValue(&inObj, "Scene", reinterpret_cast<const void*>(&inScene));
}
template <typename TDataType>
static void removeSceneGroupProperty(PvdDataStream& inStream, const char* groupName, const TDataType& inObj, const PxScene& inScene)
{
inStream.removeObjectRef(&inScene, groupName, &inObj);
inStream.destroyInstance(&inObj);
}
static void sendShapes(PvdMetaDataBinding& binding, PvdDataStream& inStream, const PxRigidActor& inObj, const PxPhysics& ownerPhysics, PsPvd* pvd)
{
PxInlineArray<PxShape*, 5> shapeData;
PxU32 nbShapes = inObj.getNbShapes();
shapeData.resize(nbShapes);
inObj.getShapes(shapeData.begin(), nbShapes);
for(PxU32 idx = 0; idx < nbShapes; ++idx)
binding.createInstance(inStream, *shapeData[idx], inObj, ownerPhysics, pvd);
}
static void releaseShapes(PvdMetaDataBinding& binding, PvdDataStream& inStream, const PxRigidActor& inObj)
{
PxInlineArray<PxShape*, 5> shapeData;
PxU32 nbShapes = inObj.getNbShapes();
shapeData.resize(nbShapes);
inObj.getShapes(shapeData.begin(), nbShapes);
for(PxU32 idx = 0; idx < nbShapes; ++idx)
binding.destroyInstance(inStream, *shapeData[idx], inObj);
}
void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxRigidStatic& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd)
{
addSceneGroupProperty(inStream, "RigidStatics", inObj, ownerScene);
sendAllProperties(inStream, inObj);
sendShapes(*this, inStream, inObj, ownerPhysics, pvd);
}
void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxRigidStatic& inObj)
{
PxRigidStaticGeneratedValues values(&inObj);
inStream.setPropertyMessage(&inObj, values);
}
void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxRigidStatic& inObj, const PxScene& ownerScene)
{
releaseShapes(*this, inStream, inObj);
removeSceneGroupProperty(inStream, "RigidStatics", inObj, ownerScene);
}
void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxRigidDynamic& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd)
{
addSceneGroupProperty(inStream, "RigidDynamics", inObj, ownerScene);
sendAllProperties(inStream, inObj);
sendShapes(*this, inStream, inObj, ownerPhysics, pvd);
}
void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxRigidDynamic& inObj)
{
PxRigidDynamicGeneratedValues values(&inObj);
inStream.setPropertyMessage(&inObj, values);
}
void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxRigidDynamic& inObj, const PxScene& ownerScene)
{
releaseShapes(*this, inStream, inObj);
removeSceneGroupProperty(inStream, "RigidDynamics", inObj, ownerScene);
}
static void addChild(PvdDataStream& inStream, const void* inParent, const PxArticulationLink& inChild)
{
inStream.pushBackObjectRef(inParent, "Links", &inChild);
inStream.setPropertyValue(&inChild, "Parent", inParent);
}
void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxArticulationReducedCoordinate& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd)
{
addSceneGroupProperty(inStream, "Articulations", inObj, ownerScene);
sendAllProperties(inStream, inObj);
PxU32 numLinks = inObj.getNbLinks();
mBindingData->mArticulationLinks.resize(numLinks);
inObj.getLinks(mBindingData->mArticulationLinks.begin(), numLinks);
// From Dilip Sequiera:
/*
No, there can only be one root, and in all the code I wrote (which is not 100% of the HL code for
articulations), the index of a child is always > the index of the parent.
*/
// Create all the links
for(PxU32 idx = 0; idx < numLinks; ++idx)
{
if(!inStream.isInstanceValid(mBindingData->mArticulationLinks[idx]))
createInstance(inStream, *mBindingData->mArticulationLinks[idx], ownerPhysics, pvd);
}
// Setup the link graph
for(PxU32 idx = 0; idx < numLinks; ++idx)
{
PxArticulationLink* link = mBindingData->mArticulationLinks[idx];
if(idx == 0)
addChild(inStream, &inObj, *link);
PxU32 numChildren = link->getNbChildren();
PxArticulationLink** children = mBindingData->allocateTemp<PxArticulationLink*>(numChildren);
link->getChildren(children, numChildren);
for(PxU32 i = 0; i < numChildren; ++i)
addChild(inStream, link, *children[i]);
}
}
void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxArticulationReducedCoordinate& inObj)
{
PxArticulationReducedCoordinateGeneratedValues values(&inObj);
inStream.setPropertyMessage(&inObj, values);
}
void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxArticulationReducedCoordinate& inObj, const PxScene& ownerScene)
{
removeSceneGroupProperty(inStream, "Articulations", inObj, ownerScene);
}
void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxArticulationLink& inObj, const PxPhysics& ownerPhysics, PsPvd* pvd)
{
inStream.createInstance(&inObj);
PxArticulationJointReducedCoordinate* joint(inObj.getInboundJoint());
if(joint)
{
inStream.createInstance(joint);
inStream.setPropertyValue(&inObj, "InboundJoint", reinterpret_cast<const void*>(joint));
inStream.setPropertyValue(joint, "Link", reinterpret_cast<const void*>(&inObj));
sendAllProperties(inStream, *joint);
}
sendAllProperties(inStream, inObj);
sendShapes(*this, inStream, inObj, ownerPhysics, pvd);
}
void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxArticulationLink& inObj)
{
PxArticulationLinkGeneratedValues values(&inObj);
inStream.setPropertyMessage(&inObj, values);
}
void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxArticulationLink& inObj)
{
PxArticulationJointReducedCoordinate* joint(inObj.getInboundJoint());
if(joint)
inStream.destroyInstance(joint);
releaseShapes(*this, inStream, inObj);
inStream.destroyInstance(&inObj);
}
// These are created as part of the articulation link's creation process, so outside entities don't need to
// create them.
void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxArticulationJointReducedCoordinate& inObj)
{
PxArticulationJointReducedCoordinateGeneratedValues values(&inObj);
inStream.setPropertyMessage(&inObj, values);
}
void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxSoftBody& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd)
{
PX_UNUSED(inStream);
PX_UNUSED(inObj);
PX_UNUSED(ownerScene);
PX_UNUSED(ownerPhysics);
PX_UNUSED(pvd);
}
void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxSoftBody& inObj)
{
PX_UNUSED(inStream);
PX_UNUSED(inObj);
}
void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxSoftBody& inObj, const PxScene& ownerScene)
{
PX_UNUSED(inStream);
PX_UNUSED(inObj);
PX_UNUSED(ownerScene);
}
void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxFEMCloth& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd)
{
PX_UNUSED(inStream);
PX_UNUSED(inObj);
PX_UNUSED(ownerScene);
PX_UNUSED(ownerPhysics);
PX_UNUSED(pvd);
}
void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxFEMCloth& inObj)
{
PX_UNUSED(inStream);
PX_UNUSED(inObj);
}
void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxFEMCloth& inObj, const PxScene& ownerScene)
{
PX_UNUSED(inStream);
PX_UNUSED(inObj);
PX_UNUSED(ownerScene);
}
void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxPBDParticleSystem& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd)
{
PX_UNUSED(inStream);
PX_UNUSED(inObj);
PX_UNUSED(ownerScene);
PX_UNUSED(ownerPhysics);
PX_UNUSED(pvd);
}
void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxPBDParticleSystem& inObj)
{
PX_UNUSED(inStream);
PX_UNUSED(inObj);
}
void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxPBDParticleSystem& inObj, const PxScene& ownerScene)
{
PX_UNUSED(inStream);
PX_UNUSED(inObj);
PX_UNUSED(ownerScene);
}
void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxFLIPParticleSystem& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd)
{
PX_UNUSED(inStream);
PX_UNUSED(inObj);
PX_UNUSED(ownerScene);
PX_UNUSED(ownerPhysics);
PX_UNUSED(pvd);
}
void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxFLIPParticleSystem& inObj)
{
PX_UNUSED(inStream);
PX_UNUSED(inObj);
}
void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxFLIPParticleSystem& inObj, const PxScene& ownerScene)
{
PX_UNUSED(inStream);
PX_UNUSED(inObj);
PX_UNUSED(ownerScene);
}
void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxMPMParticleSystem& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd)
{
PX_UNUSED(inStream);
PX_UNUSED(inObj);
PX_UNUSED(ownerScene);
PX_UNUSED(ownerPhysics);
PX_UNUSED(pvd);
}
void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxMPMParticleSystem& inObj)
{
PX_UNUSED(inStream);
PX_UNUSED(inObj);
}
void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxMPMParticleSystem& inObj, const PxScene& ownerScene)
{
PX_UNUSED(inStream);
PX_UNUSED(inObj);
PX_UNUSED(ownerScene);
}
void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxHairSystem& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd)
{
PX_UNUSED(inStream);
PX_UNUSED(inObj);
PX_UNUSED(ownerScene);
PX_UNUSED(ownerPhysics);
PX_UNUSED(pvd);
}
void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxHairSystem& inObj)
{
PX_UNUSED(inStream);
PX_UNUSED(inObj);
}
void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxHairSystem& inObj, const PxScene& ownerScene)
{
PX_UNUSED(inStream);
PX_UNUSED(inObj);
PX_UNUSED(ownerScene);
}
void PvdMetaDataBinding::originShift(PvdDataStream& inStream, const PxScene* inScene, PxVec3 shift)
{
inStream.originShift(inScene, shift);
}
template <typename TBlockType, typename TActorType, typename TOperator>
static void updateActor(PvdDataStream& inStream, TActorType** actorGroup, PxU32 numActors, TOperator sleepingOp, PvdMetaDataBindingData& bindingData)
{
TBlockType theBlock;
if(numActors == 0)
return;
for(PxU32 idx = 0; idx < numActors; ++idx)
{
TActorType* theActor(actorGroup[idx]);
bool sleeping = sleepingOp(theActor, theBlock);
bool wasSleeping = bindingData.mSleepingActors.contains(theActor);
if(sleeping == false || sleeping != wasSleeping)
{
theBlock.GlobalPose = theActor->getGlobalPose();
theBlock.AngularVelocity = theActor->getAngularVelocity();
theBlock.LinearVelocity = theActor->getLinearVelocity();
inStream.sendPropertyMessageFromGroup(theActor, theBlock);
if(sleeping != wasSleeping)
{
if(sleeping)
bindingData.mSleepingActors.insert(theActor);
else
bindingData.mSleepingActors.erase(theActor);
}
}
}
}
struct RigidDynamicUpdateOp
{
bool operator()(PxRigidDynamic* actor, PxRigidDynamicUpdateBlock& block)
{
bool sleeping = actor->isSleeping();
block.IsSleeping = sleeping;
return sleeping;
}
};
struct ArticulationLinkUpdateOp
{
bool sleeping;
ArticulationLinkUpdateOp(bool s) : sleeping(s)
{
}
bool operator()(PxArticulationLink*, PxArticulationLinkUpdateBlock&)
{
return sleeping;
}
};
void PvdMetaDataBinding::updateDynamicActorsAndArticulations(PvdDataStream& inStream, const PxScene* inScene, PvdVisualizer* linkJointViz)
{
PX_COMPILE_TIME_ASSERT(sizeof(PxRigidDynamicUpdateBlock) == 14 * 4);
{
PxU32 actorCount = inScene->getNbActors(PxActorTypeFlag::eRIGID_DYNAMIC);
if(actorCount)
{
inStream.beginPropertyMessageGroup<PxRigidDynamicUpdateBlock>();
mBindingData->mActors.resize(actorCount);
PxActor** theActors = mBindingData->mActors.begin();
inScene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC, theActors, actorCount);
updateActor<PxRigidDynamicUpdateBlock>(inStream, reinterpret_cast<PxRigidDynamic**>(theActors), actorCount, RigidDynamicUpdateOp(), *mBindingData);
inStream.endPropertyMessageGroup();
}
}
{
PxU32 articulationCount = inScene->getNbArticulations();
if(articulationCount)
{
mBindingData->mArticulations.resize(articulationCount);
PxArticulationReducedCoordinate** firstArticulation = mBindingData->mArticulations.begin();
PxArticulationReducedCoordinate** lastArticulation = firstArticulation + articulationCount;
inScene->getArticulations(firstArticulation, articulationCount);
inStream.beginPropertyMessageGroup<PxArticulationLinkUpdateBlock>();
for(; firstArticulation < lastArticulation; ++firstArticulation)
{
PxU32 linkCount = (*firstArticulation)->getNbLinks();
bool sleeping = (*firstArticulation)->isSleeping();
if(linkCount)
{
mBindingData->mArticulationLinks.resize(linkCount);
PxArticulationLink** theLink = mBindingData->mArticulationLinks.begin();
(*firstArticulation)->getLinks(theLink, linkCount);
updateActor<PxArticulationLinkUpdateBlock>(inStream, theLink, linkCount, ArticulationLinkUpdateOp(sleeping), *mBindingData);
if(linkJointViz)
{
for(PxU32 idx = 0; idx < linkCount; ++idx)
linkJointViz->visualize(*theLink[idx]);
}
}
}
inStream.endPropertyMessageGroup();
firstArticulation = mBindingData->mArticulations.begin();
for (; firstArticulation < lastArticulation; ++firstArticulation)
{
inStream.setPropertyValue(*firstArticulation, "IsSleeping", (*firstArticulation)->isSleeping());
inStream.setPropertyValue(*firstArticulation, "RootGlobalPose", (*firstArticulation)->getRootGlobalPose());
inStream.setPropertyValue(*firstArticulation, "RootLinearVelocity", (*firstArticulation)->getRootLinearVelocity());
inStream.setPropertyValue(*firstArticulation, "RootAngularVelocity", (*firstArticulation)->getRootAngularVelocity());
}
inStream.beginPropertyMessageGroup<PxArticulationJointUpdateBlock>();
firstArticulation = mBindingData->mArticulations.begin();
for (; firstArticulation < lastArticulation; ++firstArticulation)
{
PxU32 linkCount = (*firstArticulation)->getNbLinks();
bool sleeping = (*firstArticulation)->isSleeping();
if (!sleeping)
{
for (PxU32 idx = 1; idx < linkCount; ++idx)
{
mBindingData->mArticulationLinks.resize(linkCount);
PxArticulationLink** theLink = mBindingData->mArticulationLinks.begin();
(*firstArticulation)->getLinks(theLink, linkCount);
PxArticulationJointUpdateBlock jointBlock;
PxArticulationJointReducedCoordinate* joint = theLink[idx]->getInboundJoint();
jointBlock.JointPosition_eX = joint->getJointPosition(PxArticulationAxis::eX);
jointBlock.JointPosition_eY = joint->getJointPosition(PxArticulationAxis::eY);
jointBlock.JointPosition_eZ = joint->getJointPosition(PxArticulationAxis::eZ);
jointBlock.JointPosition_eTwist = joint->getJointPosition(PxArticulationAxis::eTWIST);
jointBlock.JointPosition_eSwing1 = joint->getJointPosition(PxArticulationAxis::eSWING1);
jointBlock.JointPosition_eSwing2 = joint->getJointPosition(PxArticulationAxis::eSWING2);
jointBlock.JointVelocity_eX = joint->getJointVelocity(PxArticulationAxis::eX);
jointBlock.JointVelocity_eY = joint->getJointVelocity(PxArticulationAxis::eY);
jointBlock.JointVelocity_eZ = joint->getJointVelocity(PxArticulationAxis::eZ);
jointBlock.JointVelocity_eTwist = joint->getJointVelocity(PxArticulationAxis::eTWIST);
jointBlock.JointVelocity_eSwing1 = joint->getJointVelocity(PxArticulationAxis::eSWING1);
jointBlock.JointVelocity_eSwing2 = joint->getJointVelocity(PxArticulationAxis::eSWING2);
inStream.sendPropertyMessageFromGroup(joint, jointBlock);
}
}
}
inStream.endPropertyMessageGroup();
}
}
}
template <typename TObjType>
struct CollectionOperator
{
PxArray<PxU8>& mTempArray;
const TObjType& mObject;
PvdDataStream& mStream;
CollectionOperator(PxArray<PxU8>& ary, const TObjType& obj, PvdDataStream& stream)
: mTempArray(ary), mObject(obj), mStream(stream)
{
}
void pushName(const char*)
{
}
void popName()
{
}
template <typename TAccessor>
void simpleProperty(PxU32 /*key*/, const TAccessor&)
{
}
template <typename TAccessor>
void flagsProperty(PxU32 /*key*/, const TAccessor&, const PxU32ToName*)
{
}
template <typename TColType, typename TDataType, typename TCollectionProp>
void handleCollection(const TCollectionProp& prop, NamespacedName dtype, PxU32 countMultiplier = 1)
{
PxU32 count = prop.size(&mObject);
mTempArray.resize(count * sizeof(TDataType));
TColType* start = reinterpret_cast<TColType*>(mTempArray.begin());
prop.get(&mObject, start, count * countMultiplier);
mStream.setPropertyValue(&mObject, prop.mName, DataRef<const PxU8>(mTempArray.begin(), mTempArray.size()), dtype);
}
template <PxU32 TKey, typename TObject, typename TColType>
void handleCollection(const PxReadOnlyCollectionPropertyInfo<TKey, TObject, TColType>& prop)
{
handleCollection<TColType, TColType>(prop, getPvdNamespacedNameForType<TColType>());
}
// Enumerations or bitflags.
template <PxU32 TKey, typename TObject, typename TColType>
void handleCollection(const PxReadOnlyCollectionPropertyInfo<TKey, TObject, TColType>& prop, const PxU32ToName*)
{
PX_COMPILE_TIME_ASSERT(sizeof(TColType) == sizeof(PxU32));
handleCollection<TColType, PxU32>(prop, getPvdNamespacedNameForType<PxU32>());
}
private:
CollectionOperator& operator=(const CollectionOperator&);
};
// per frame update
#define ENABLE_AGGREGATE_PVD_SUPPORT 1
#ifdef ENABLE_AGGREGATE_PVD_SUPPORT
void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxAggregate& inObj, const PxScene& ownerScene)
{
addSceneGroupProperty(inStream, "Aggregates", inObj, ownerScene);
sendAllProperties(inStream, inObj);
}
void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxAggregate& inObj)
{
PxAggregateGeneratedValues values(&inObj);
inStream.setPropertyMessage(&inObj, values);
}
void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxAggregate& inObj, const PxScene& ownerScene)
{
removeSceneGroupProperty(inStream, "Aggregates", inObj, ownerScene);
}
class ChangeOjectRefCmd : public PvdDataStream::PvdCommand
{
ChangeOjectRefCmd& operator=(const ChangeOjectRefCmd&)
{
PX_ASSERT(0);
return *this;
} // PX_NOCOPY doesn't work for local classes
public:
const void* mInstance;
String mPropName;
const void* mPropObj;
const bool mPushBack;
ChangeOjectRefCmd(const void* inInst, String inName, const void* inObj, bool pushBack)
: mInstance(inInst), mPropName(inName), mPropObj(inObj), mPushBack(pushBack)
{
}
// Assigned is needed for copying
ChangeOjectRefCmd(const ChangeOjectRefCmd& other)
: PvdDataStream::PvdCommand(other), mInstance(other.mInstance), mPropName(other.mPropName), mPropObj(other.mPropObj), mPushBack(other.mPushBack)
{
}
virtual bool canRun(PvdInstanceDataStream& inStream)
{
PX_ASSERT(inStream.isInstanceValid(mInstance));
return inStream.isInstanceValid(mPropObj);
}
virtual void run(PvdInstanceDataStream& inStream)
{
if(!inStream.isInstanceValid(mInstance))
return;
if(mPushBack)
{
if(inStream.isInstanceValid(mPropObj))
inStream.pushBackObjectRef(mInstance, mPropName, mPropObj);
}
else
{
// the called function will assert if propobj is already removed
inStream.removeObjectRef(mInstance, mPropName, mPropObj);
}
}
};
static void changeAggregateSubActors(PvdDataStream& inStream, const PxAggregate& inObj, const PxActor& inActor, bool pushBack)
{
const PxArticulationLink* link = inActor.is<PxArticulationLink>();
String propName = NULL;
const void* object = NULL;
if(link == NULL)
{
propName = "Actors";
object = &inActor;
}
else if(link->getInboundJoint() == NULL)
{
propName = "Articulations";
object = &link->getArticulation();
}
else
return;
ChangeOjectRefCmd* cmd = PX_PLACEMENT_NEW(inStream.allocateMemForCmd(sizeof(ChangeOjectRefCmd)), ChangeOjectRefCmd)(&inObj, propName, object, pushBack);
if(cmd->canRun(inStream))
cmd->run(inStream);
else
inStream.pushPvdCommand(*cmd);
}
void PvdMetaDataBinding::detachAggregateActor(PvdDataStream& inStream, const PxAggregate& inObj, const PxActor& inActor)
{
changeAggregateSubActors(inStream, inObj, inActor, false);
}
void PvdMetaDataBinding::attachAggregateActor(PvdDataStream& inStream, const PxAggregate& inObj, const PxActor& inActor)
{
changeAggregateSubActors(inStream, inObj, inActor, true);
}
#else
void PvdMetaDataBinding::createInstance(PvdDataStream&, const PxAggregate&, const PxScene&, ObjectRegistrar&)
{
}
void PvdMetaDataBinding::sendAllProperties(PvdDataStream&, const PxAggregate&)
{
}
void PvdMetaDataBinding::destroyInstance(PvdDataStream&, const PxAggregate&, const PxScene&)
{
}
void PvdMetaDataBinding::detachAggregateActor(PvdDataStream&, const PxAggregate&, const PxActor&)
{
}
void PvdMetaDataBinding::attachAggregateActor(PvdDataStream&, const PxAggregate&, const PxActor&)
{
}
#endif
template <typename TDataType>
static void sendSceneArray(PvdDataStream& inStream, const PxScene& inScene, const PxArray<TDataType>& inArray, const char* propName)
{
if(0 == inArray.size())
inStream.setPropertyValue(&inScene, propName, DataRef<const PxU8>(), getPvdNamespacedNameForType<TDataType>());
else
{
ScopedPropertyValueSender<TDataType, 32> sender(inStream, &inScene, propName);
for(PxU32 i = 0; i < inArray.size(); ++i)
sender.append(inArray[i]);
}
}
static void sendSceneArray(PvdDataStream& inStream, const PxScene& inScene, const PxArray<PvdSqHit>& inArray, const char* propName)
{
if(0 == inArray.size())
inStream.setPropertyValue(&inScene, propName, DataRef<const PxU8>(), getPvdNamespacedNameForType<PvdSqHit>());
else
{
ScopedPropertyValueSender<PvdSqHit, 32> sender(inStream, &inScene, propName);
for(PxU32 i = 0; i < inArray.size(); ++i)
{
if(!inStream.isInstanceValid(inArray[i].mShape) || !inStream.isInstanceValid(inArray[i].mActor))
{
PvdSqHit hit = inArray[i];
hit.mShape = NULL;
hit.mActor = NULL;
sender.append(hit);
}
else
sender.append(inArray[i]);
}
}
}
void PvdMetaDataBinding::sendSceneQueries(PvdDataStream& inStream, const PxScene& inScene, PsPvd* pvd)
{
if(!inStream.isConnected())
return;
const physx::NpScene& scene = static_cast<const NpScene&>(inScene);
{
PvdSceneQueryCollector& collector = scene.getNpSQ().getSingleSqCollector();
PxMutex::ScopedLock lock(collector.getLock());
String propName = collector.getArrayName(collector.mPvdSqHits);
sendSceneArray(inStream, inScene, collector.mPvdSqHits, propName);
propName = collector.getArrayName(collector.mPoses);
sendSceneArray(inStream, inScene, collector.mPoses, propName);
propName = collector.getArrayName(collector.mFilterData);
sendSceneArray(inStream, inScene, collector.mFilterData, propName);
const NamedArray<PxGeometryHolder>& geometriesToDestroy = collector.getPrevFrameGeometries();
propName = collector.getArrayName(geometriesToDestroy);
for(PxU32 k = 0; k < geometriesToDestroy.size(); ++k)
{
const PxGeometryHolder& inObj = geometriesToDestroy[k];
inStream.removeObjectRef(&inScene, propName, &inObj);
inStream.destroyInstance(&inObj);
}
const PxArray<PxGeometryHolder>& geometriesToCreate = collector.getCurrentFrameGeometries();
for(PxU32 k = 0; k < geometriesToCreate.size(); ++k)
{
const PxGeometry& geometry = geometriesToCreate[k].any();
switch(geometry.getType())
{
#define SEND_PVD_GEOM_TYPE(enumType, TGeomType, TValueType) \
case enumType: \
{ \
const TGeomType& inObj = static_cast<const TGeomType&>(geometry); \
inStream.createInstance(getPvdNamespacedNameForType<TGeomType>(), &inObj); \
registrarPhysicsObject<TGeomType>(inStream, inObj, pvd); \
TValueType values(&inObj); \
inStream.setPropertyMessage(&inObj, values); \
inStream.pushBackObjectRef(&inScene, propName, &inObj); \
} \
break;
SEND_PVD_GEOM_TYPE(PxGeometryType::eBOX, PxBoxGeometry, PxBoxGeometryGeneratedValues)
SEND_PVD_GEOM_TYPE(PxGeometryType::eSPHERE, PxSphereGeometry, PxSphereGeometryGeneratedValues)
SEND_PVD_GEOM_TYPE(PxGeometryType::eCAPSULE, PxCapsuleGeometry, PxCapsuleGeometryGeneratedValues)
SEND_PVD_GEOM_TYPE(PxGeometryType::eCONVEXMESH, PxConvexMeshGeometry, PxConvexMeshGeometryGeneratedValues)
#undef SEND_PVD_GEOM_TYPE
case PxGeometryType::ePLANE:
case PxGeometryType::eTRIANGLEMESH:
case PxGeometryType::eHEIGHTFIELD:
case PxGeometryType::eTETRAHEDRONMESH:
case PxGeometryType::ePARTICLESYSTEM:
case PxGeometryType::eHAIRSYSTEM:
case PxGeometryType::eCUSTOM:
case PxGeometryType::eGEOMETRY_COUNT:
case PxGeometryType::eINVALID:
PX_ALWAYS_ASSERT_MESSAGE("unsupported scene query geometry type");
break;
}
}
collector.prepareNextFrameGeometries();
propName = collector.getArrayName(collector.mAccumulatedRaycastQueries);
sendSceneArray(inStream, inScene, collector.mAccumulatedRaycastQueries, propName);
propName = collector.getArrayName(collector.mAccumulatedOverlapQueries);
sendSceneArray(inStream, inScene, collector.mAccumulatedOverlapQueries, propName);
propName = collector.getArrayName(collector.mAccumulatedSweepQueries);
sendSceneArray(inStream, inScene, collector.mAccumulatedSweepQueries, propName);
}
}
}
}
#endif
| 81,227 | C++ | 39.573427 | 180 | 0.77553 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/NpSoftBody.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "foundation/PxPreprocessor.h"
#if PX_SUPPORT_GPU_PHYSX
#include "NpSoftBody.h"
#include "NpParticleSystem.h"
#include "NpCheck.h"
#include "NpScene.h"
#include "NpShape.h"
#include "geometry/PxTetrahedronMesh.h"
#include "geometry/PxTetrahedronMeshGeometry.h"
#include "PxPhysXGpu.h"
#include "PxvGlobals.h"
#include "GuTetrahedronMesh.h"
#include "NpRigidDynamic.h"
#include "NpRigidStatic.h"
#include "NpArticulationLink.h"
#include "ScSoftBodySim.h"
#include "NpFEMSoftBodyMaterial.h"
#include "cudamanager/PxCudaContext.h"
using namespace physx;
namespace physx
{
NpSoftBody::NpSoftBody(PxCudaContextManager& cudaContextManager) :
NpActorTemplate (PxConcreteType::eSOFT_BODY, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE, NpType::eSOFTBODY),
mShape (NULL),
mCudaContextManager(&cudaContextManager)
{
}
NpSoftBody::NpSoftBody(PxBaseFlags baseFlags, PxCudaContextManager& cudaContextManager) :
NpActorTemplate (baseFlags),
mShape (NULL),
mCudaContextManager(&cudaContextManager)
{
}
PxBounds3 NpSoftBody::getWorldBounds(float inflation) const
{
NP_READ_CHECK(getNpScene());
if (!getNpScene())
{
PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "Querying bounds of a PxSoftBody which is not part of a PxScene is not supported.");
return PxBounds3::empty();
}
const Sc::SoftBodySim* sim = mCore.getSim();
PX_ASSERT(sim);
PX_SIMD_GUARD;
PxBounds3 bounds = sim->getBounds();
PX_ASSERT(bounds.isValid());
// PT: unfortunately we can't just scale the min/max vectors, we need to go through center/extents.
const PxVec3 center = bounds.getCenter();
const PxVec3 inflatedExtents = bounds.getExtents() * inflation;
return PxBounds3::centerExtents(center, inflatedExtents);
}
PxU32 NpSoftBody::getGpuSoftBodyIndex()
{
NP_READ_CHECK(getNpScene());
PX_CHECK_AND_RETURN_VAL(getNpScene(), "PxSoftBody::getGpuSoftBodyIndex: Soft body must be in a scene.", 0xffffffff);
return mCore.getGpuSoftBodyIndex();
}
void NpSoftBody::setSoftBodyFlag(PxSoftBodyFlag::Enum flag, bool val)
{
PxSoftBodyFlags flags = mCore.getFlags();
if (val)
flags.raise(flag);
else
flags.clear(flag);
mCore.setFlags(flags);
}
void NpSoftBody::setSoftBodyFlags(PxSoftBodyFlags flags)
{
mCore.setFlags(flags);
}
PxSoftBodyFlags NpSoftBody::getSoftBodyFlag() const
{
return mCore.getFlags();
}
void NpSoftBody::setParameter(PxFEMParameters paramters)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxSoftBody::setInternalIterationCount() not allowed while simulation is running. Call will be ignored.")
mCore.setParameter(paramters);
UPDATE_PVD_PROPERTY
}
PxFEMParameters NpSoftBody::getParameter() const
{
NP_READ_CHECK(getNpScene());
return mCore.getParameter();
}
PxVec4* NpSoftBody::getPositionInvMassBufferD()
{
PX_CHECK_AND_RETURN_NULL(mShape != NULL, "NpSoftBody::getPositionInvMassBufferD: Softbody does not have a shape, attach shape first.");
Dy::SoftBodyCore& core = mCore.getCore();
return core.mPositionInvMass;
}
PxVec4* NpSoftBody::getRestPositionBufferD()
{
PX_CHECK_AND_RETURN_NULL(mShape != NULL, "NpSoftBody::getRestPositionBufferD: Softbody does not have a shape, attach shape first.");
Dy::SoftBodyCore& core = mCore.getCore();
return core.mRestPosition;
}
PxVec4* NpSoftBody::getSimPositionInvMassBufferD()
{
PX_CHECK_AND_RETURN_NULL(mSimulationMesh != NULL, "NpSoftBody::getSimPositionInvMassBufferD: Softbody does not have a simulation mesh, attach simulation mesh first.");
Dy::SoftBodyCore& core = mCore.getCore();
return core.mSimPositionInvMass;
}
PxVec4* NpSoftBody::getSimVelocityBufferD()
{
PX_CHECK_AND_RETURN_NULL(mSimulationMesh != NULL, "NpSoftBody::getSimVelocityBufferD: Softbody does not have a simulation mesh, attach simulation mesh first.");
Dy::SoftBodyCore& core = mCore.getCore();
return core.mSimVelocity;
}
void NpSoftBody::markDirty(PxSoftBodyDataFlags flags)
{
NP_WRITE_CHECK(getNpScene());
Dy::SoftBodyCore& core = mCore.getCore();
core.mDirtyFlags |= flags;
}
void NpSoftBody::setKinematicTargetBufferD(const PxVec4* positions, PxSoftBodyFlags flags)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(!(positions == NULL && flags != PxSoftBodyFlags(0)), "NpSoftBody::setKinematicTargetBufferD: targets cannot be null if flags are set to be kinematic.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxSoftBody::setKinematicTargetBufferD() not allowed while simulation is running. Call will be ignored.")
mCore.setKinematicTargets(positions, flags);
}
PxCudaContextManager* NpSoftBody::getCudaContextManager() const
{
return mCudaContextManager;
}
void NpSoftBody::setWakeCounter(PxReal wakeCounterValue)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxSoftBody::setWakeCounter() not allowed while simulation is running. Call will be ignored.")
mCore.setWakeCounter(wakeCounterValue);
//UPDATE_PVD_PROPERTIES_OBJECT()
}
PxReal NpSoftBody::getWakeCounter() const
{
NP_READ_CHECK(getNpScene());
return mCore.getWakeCounter();
}
bool NpSoftBody::isSleeping() const
{
NP_READ_CHECK(getNpScene());
return mCore.isSleeping();
}
void NpSoftBody::setSolverIterationCounts(PxU32 positionIters, PxU32 velocityIters)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_AND_RETURN(positionIters > 0, "NpSoftBody::setSolverIterationCounts: positionIters must be more than zero!");
PX_CHECK_AND_RETURN(positionIters <= 255, "NpSoftBody::setSolverIterationCounts: positionIters must be no greater than 255!");
PX_CHECK_AND_RETURN(velocityIters <= 255, "NpSoftBody::setSolverIterationCounts: velocityIters must be no greater than 255!");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxSoftBody::setSolverIterationCounts() not allowed while simulation is running. Call will be ignored.")
mCore.setSolverIterationCounts((velocityIters & 0xff) << 8 | (positionIters & 0xff));
}
void NpSoftBody::getSolverIterationCounts(PxU32& positionIters, PxU32& velocityIters) const
{
NP_READ_CHECK(getNpScene());
PxU16 x = mCore.getSolverIterationCounts();
velocityIters = PxU32(x >> 8);
positionIters = PxU32(x & 0xff);
}
PxShape* NpSoftBody::getShape()
{
return mShape;
}
PxTetrahedronMesh* NpSoftBody::getCollisionMesh()
{
const PxTetrahedronMeshGeometry& tetMeshGeom = static_cast<const PxTetrahedronMeshGeometry&>(mShape->getGeometry());
return tetMeshGeom.tetrahedronMesh;
}
const PxTetrahedronMesh* NpSoftBody::getCollisionMesh() const
{
const PxTetrahedronMeshGeometry& tetMeshGeom = static_cast<const PxTetrahedronMeshGeometry&>(mShape->getGeometry());
return tetMeshGeom.tetrahedronMesh;
}
bool NpSoftBody::attachSimulationMesh(PxTetrahedronMesh& simulationMesh, PxSoftBodyAuxData& softBodyAuxData)
{
Dy::SoftBodyCore& core = mCore.getCore();
PX_CHECK_AND_RETURN_NULL(core.mSimPositionInvMass == NULL, "NpSoftBody::attachSimulationMesh: mSimPositionInvMass already exists, overwrite not allowed, call detachSimulationMesh first");
PX_CHECK_AND_RETURN_NULL(core.mSimVelocity == NULL, "NpSoftBody::attachSimulationMesh: mSimVelocity already exists, overwrite not allowed, call detachSimulationMesh first");
mSimulationMesh = static_cast<Gu::TetrahedronMesh*>(&simulationMesh);
mSoftBodyAuxData = static_cast<Gu::SoftBodyAuxData*>(&softBodyAuxData);
Gu::TetrahedronMesh* tetMesh = static_cast<Gu::TetrahedronMesh*>(&simulationMesh);
const PxU32 numVertsGM = tetMesh->getNbVerticesFast();
core.mSimPositionInvMass = PX_DEVICE_ALLOC_T(PxVec4, mCudaContextManager, numVertsGM);
core.mSimVelocity = PX_DEVICE_ALLOC_T(PxVec4, mCudaContextManager, numVertsGM);
return true;
}
void NpSoftBody::updateMaterials()
{
Dy::SoftBodyCore& core = mCore.getCore();
core.clearMaterials();
for (PxU32 i = 0; i < mShape->getNbMaterials(); ++i)
{
PxFEMSoftBodyMaterial* material;
mShape->getSoftBodyMaterials(&material, 1, i);
core.setMaterial(static_cast<NpFEMSoftBodyMaterial*>(material)->mMaterial.mMaterialIndex);
}
}
bool NpSoftBody::attachShape(PxShape& shape)
{
NpShape* npShape = static_cast<NpShape*>(&shape);
PX_CHECK_AND_RETURN_NULL(npShape->getGeometryTypeFast() == PxGeometryType::eTETRAHEDRONMESH, "NpSoftBody::attachShape: Geometry type must be tetrahedron mesh geometry");
PX_CHECK_AND_RETURN_NULL(mShape == NULL, "NpSoftBody::attachShape: soft body can just have one shape");
PX_CHECK_AND_RETURN_NULL(shape.isExclusive(), "NpSoftBody::attachShape: shape must be exclusive");
PX_CHECK_AND_RETURN_NULL(npShape->getCore().getCore().mShapeCoreFlags & PxShapeCoreFlag::eSOFT_BODY_SHAPE, "NpSoftBody::attachShape: shape must be a soft body shape!");
Dy::SoftBodyCore& core = mCore.getCore();
PX_CHECK_AND_RETURN_NULL(core.mPositionInvMass == NULL, "NpSoftBody::attachShape: mPositionInvMass already exists, overwrite not allowed, call detachShape first");
mShape = npShape;
PX_ASSERT(shape.getActor() == NULL);
npShape->onActorAttach(*this);
const PxGeometryHolder gh(mShape->getGeometry()); // PT: TODO: avoid that copy
const PxTetrahedronMeshGeometry& tetGeometry = gh.tetMesh();
Gu::BVTetrahedronMesh* tetMesh = static_cast<Gu::BVTetrahedronMesh*>(tetGeometry.tetrahedronMesh);
const PxU32 numVerts = tetMesh->getNbVerticesFast();
core.mPositionInvMass = PX_DEVICE_ALLOC_T(PxVec4, mCudaContextManager, numVerts);
core.mRestPosition = PX_DEVICE_ALLOC_T(PxVec4, mCudaContextManager, numVerts);
updateMaterials();
return true;
}
void NpSoftBody::detachShape()
{
PX_CHECK_MSG(getNpSceneFromActor(*this) == NULL, "Detaching a shape from a softbody is currenly only allowed as long as it is not part of a scene. Please remove the softbody from its scene first.");
Dy::SoftBodyCore& core = mCore.getCore();
if (core.mRestPosition)
{
PX_DEVICE_FREE(mCudaContextManager, core.mRestPosition);
core.mRestPosition = NULL;
}
if (core.mPositionInvMass)
{
PX_DEVICE_FREE(mCudaContextManager, core.mPositionInvMass);
core.mPositionInvMass = NULL;
}
if (mShape)
mShape->onActorDetach();
mShape = NULL;
}
void NpSoftBody::detachSimulationMesh()
{
Dy::SoftBodyCore& core = mCore.getCore();
if (core.mSimPositionInvMass)
{
PX_DEVICE_FREE(mCudaContextManager, core.mSimPositionInvMass);
core.mSimPositionInvMass = NULL;
}
if (core.mSimVelocity)
{
PX_DEVICE_FREE(mCudaContextManager, core.mSimVelocity);
core.mSimVelocity = NULL;
}
mSimulationMesh = NULL;
mSoftBodyAuxData = NULL;
}
void NpSoftBody::release()
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
// AD why is this commented out?
// NpPhysics::getInstance().notifyDeletionListenersUserRelease(this, PxArticulationBase::userData);
if (npScene)
{
npScene->scRemoveSoftBody(*this);
npScene->removeFromSoftBodyList(*this);
}
detachSimulationMesh();
detachShape();
PX_ASSERT(!isAPIWriteForbidden());
NpDestroySoftBody(this);
}
void NpSoftBody::setName(const char* debugName)
{
NP_WRITE_CHECK(getNpScene());
mName = debugName;
}
const char* NpSoftBody::getName() const
{
NP_READ_CHECK(getNpScene());
return mName;
}
void NpSoftBody::addParticleFilter(PxPBDParticleSystem* particlesystem, const PxParticleBuffer* buffer, PxU32 particleId, PxU32 tetId)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::addParticleFilter: Soft body must be inserted into the scene.");
PX_CHECK_AND_RETURN((particlesystem == NULL || particlesystem->getScene() != NULL), "NpSoftBody::addParticleFilter: actor must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::addParticleFilter: Illegal to call while simulation is running.");
NpPBDParticleSystem* npParticleSystem = static_cast<NpPBDParticleSystem*>(particlesystem);
Sc::ParticleSystemCore& core = npParticleSystem->getCore();
mCore.addParticleFilter(&core, particleId, buffer ? buffer->bufferUniqueId : 0, tetId);
}
void NpSoftBody::removeParticleFilter(PxPBDParticleSystem* particlesystem, const PxParticleBuffer* buffer, PxU32 particleId, PxU32 tetId)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::removeParticleFilter: Soft body must be inserted into the scene.");
PX_CHECK_AND_RETURN((particlesystem == NULL || particlesystem->getScene() != NULL), "NpSoftBody::removeParticleFilter: actor must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::removeParticleFilter: Illegal to call while simulation is running.");
NpPBDParticleSystem* npParticleSystem = static_cast<NpPBDParticleSystem*>(particlesystem);
Sc::ParticleSystemCore& core = npParticleSystem->getCore();
mCore.removeParticleFilter(&core, particleId, buffer ? buffer->bufferUniqueId : 0, tetId);
}
PxU32 NpSoftBody::addParticleAttachment(PxPBDParticleSystem* particlesystem, const PxParticleBuffer* buffer, PxU32 particleId, PxU32 tetId, const PxVec4& barycentric)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN_VAL(getNpScene() != NULL, "NpSoftBody::addParticleAttachment: Soft body must be inserted into the scene.", 0xFFFFFFFF);
PX_CHECK_AND_RETURN_VAL((particlesystem == NULL || particlesystem->getScene() != NULL), "NpSoftBody::addParticleAttachment: actor must be inserted into the scene.", 0xFFFFFFFF);
PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "NpSoftBody::addParticleAttachment: Illegal to call while simulation is running.", 0xFFFFFFFF);
NpPBDParticleSystem* npParticleSystem = static_cast<NpPBDParticleSystem*>(particlesystem);
Sc::ParticleSystemCore& core = npParticleSystem->getCore();
return mCore.addParticleAttachment(&core, particleId, buffer ? buffer->bufferUniqueId : 0, tetId, barycentric);
}
void NpSoftBody::removeParticleAttachment(PxPBDParticleSystem* particlesystem, PxU32 handle)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::addParticleAttachment: Soft body must be inserted into the scene.");
PX_CHECK_AND_RETURN((particlesystem == NULL || particlesystem->getScene() != NULL), "NpSoftBody::addParticleAttachment: actor must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::addParticleAttachment: Illegal to call while simulation is running.");
NpPBDParticleSystem* npParticleSystem = static_cast<NpPBDParticleSystem*>(particlesystem);
Sc::ParticleSystemCore& core = npParticleSystem->getCore();
mCore.removeParticleAttachment(&core, handle);
}
void NpSoftBody::addRigidFilter(PxRigidActor* actor, PxU32 vertId)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::addRigidFilter: Soft body must be inserted into the scene.");
PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpSoftBody::addRigidFilter: actor must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::addRigidFilter: Illegal to call while simulation is running.");
Sc::BodyCore* core = getBodyCore(actor);
mCore.addRigidFilter(core, vertId);
}
void NpSoftBody::removeRigidFilter(PxRigidActor* actor, PxU32 vertId)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::removeRigidFilter: soft body must be inserted into the scene.");
PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpSoftBody::removeRigidFilter: actor must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::removeRigidFilter: Illegal to call while simulation is running.");
Sc::BodyCore* core = getBodyCore(actor);
mCore.removeRigidFilter(core, vertId);
}
PxU32 NpSoftBody::addRigidAttachment(PxRigidActor* actor, PxU32 vertId, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN_VAL(getNpScene() != NULL, "NpSoftBody::addRigidAttachment: Soft body must be inserted into the scene.", 0xFFFFFFFF);
PX_CHECK_AND_RETURN_VAL((actor == NULL || actor->getScene() != NULL), "NpSoftBody::addRigidAttachment: actor must be inserted into the scene.", 0xFFFFFFFF);
PX_CHECK_AND_RETURN_VAL(constraint == NULL || constraint->isValid(), "NpSoftBody::addRigidAttachment: PxConeLimitedConstraint needs to be valid if specified.", 0xFFFFFFFF);
PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "NpSoftBody::addRigidAttachment: Illegal to call while simulation is running.", 0xFFFFFFFF);
Sc::BodyCore* core = getBodyCore(actor);
PxVec3 aPose = actorSpacePose;
if (actor && actor->getConcreteType()==PxConcreteType::eRIGID_STATIC)
{
NpRigidStatic* stat = static_cast<NpRigidStatic*>(actor);
aPose = stat->getGlobalPose().transform(aPose);
}
return mCore.addRigidAttachment(core, vertId, aPose, constraint);
}
void NpSoftBody::removeRigidAttachment(PxRigidActor* actor, PxU32 handle)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::removeRigidAttachment: soft body must be inserted into the scene.");
PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpSoftBody::removeRigidAttachment: actor must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::removeRigidAttachment: Illegal to call while simulation is running.");
Sc::BodyCore* core = getBodyCore(actor);
mCore.removeRigidAttachment(core, handle);
}
void NpSoftBody::addTetRigidFilter(PxRigidActor* actor, PxU32 tetIdx)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::addTetRigidFilter: Soft body must be inserted into the scene.");
PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpSoftBody::addTetRigidFilter: actor must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::addTetRigidFilter: Illegal to call while simulation is running.");
Sc::BodyCore* core = getBodyCore(actor);
return mCore.addTetRigidFilter(core, tetIdx);
}
void NpSoftBody::removeTetRigidFilter(PxRigidActor* actor, PxU32 tetIdx)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::removeTetRigidFilter: soft body must be inserted into the scene.");
PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpSoftBody::removeTetRigidFilter: actor must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::removeTetRigidFilter: Illegal to call while simulation is running.");
Sc::BodyCore* core = getBodyCore(actor);
mCore.removeTetRigidFilter(core, tetIdx);
}
PxU32 NpSoftBody::addTetRigidAttachment(PxRigidActor* actor, PxU32 tetIdx, const PxVec4& barycentric, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN_VAL(getNpScene() != NULL, "NpSoftBody::addTetRigidAttachment: Soft body must be inserted into the scene.", 0xFFFFFFFF);
PX_CHECK_AND_RETURN_VAL((actor == NULL || actor->getScene() != NULL), "NpSoftBody::addTetRigidAttachment: actor must be inserted into the scene.", 0xFFFFFFFF);
PX_CHECK_AND_RETURN_VAL(constraint == NULL || constraint->isValid(), "NpSoftBody::addTetRigidAttachment: PxConeLimitedConstraint needs to be valid if specified.", 0xFFFFFFFF);
PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "NpSoftBody::addTetRigidAttachment: Illegal to call while simulation is running.", 0xFFFFFFFF);
Sc::BodyCore* core = getBodyCore(actor);
PxVec3 aPose = actorSpacePose;
if (actor && actor->getConcreteType()==PxConcreteType::eRIGID_STATIC)
{
NpRigidStatic* stat = static_cast<NpRigidStatic*>(actor);
aPose = stat->getGlobalPose().transform(aPose);
}
return mCore.addTetRigidAttachment(core, tetIdx, barycentric, aPose, constraint);
}
void NpSoftBody::addSoftBodyFilter(PxSoftBody* softbody0, PxU32 tetIdx0, PxU32 tetIdx1)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(softbody0 != NULL, "NpSoftBody::addSoftBodyFilter: soft body must not be null");
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::addSoftBodyFilter: soft body must be inserted into the scene.");
PX_CHECK_AND_RETURN(softbody0->getScene() != NULL, "NpSoftBody::addSoftBodyFilter: soft body must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::addSoftBodyFilter: Illegal to call while simulation is running.");
NpSoftBody* dyn = static_cast<NpSoftBody*>(softbody0);
Sc::SoftBodyCore* core = &dyn->getCore();
mCore.addSoftBodyFilter(*core, tetIdx0, tetIdx1);
}
void NpSoftBody::removeSoftBodyFilter(PxSoftBody* softbody0, PxU32 tetIdx0, PxU32 tetIdx1)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(softbody0 != NULL, "NpSoftBody::removeSoftBodyFilter: soft body must not be null");
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::removeSoftBodyFilter: soft body must be inserted into the scene.");
PX_CHECK_AND_RETURN(softbody0->getScene() != NULL, "NpSoftBody::removeSoftBodyFilter: soft body must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::removeSoftBodyFilter: Illegal to call while simulation is running.");
NpSoftBody* dyn = static_cast<NpSoftBody*>(softbody0);
Sc::SoftBodyCore* core = &dyn->getCore();
mCore.removeSoftBodyFilter(*core, tetIdx0, tetIdx1);
}
void NpSoftBody::addSoftBodyFilters(PxSoftBody* softbody0, PxU32* tetIndices0, PxU32* tetIndices1, PxU32 tetIndicesSize)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(softbody0 != NULL, "NpSoftBody::addSoftBodyFilter: soft body must not be null");
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::addSoftBodyFilter: soft body must be inserted into the scene.");
PX_CHECK_AND_RETURN(softbody0->getScene() != NULL, "NpSoftBody::addSoftBodyFilter: soft body must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::addSoftBodyFilter: Illegal to call while simulation is running.");
NpSoftBody* dyn = static_cast<NpSoftBody*>(softbody0);
Sc::SoftBodyCore* core = &dyn->getCore();
mCore.addSoftBodyFilters(*core, tetIndices0, tetIndices1, tetIndicesSize);
}
void NpSoftBody::removeSoftBodyFilters(PxSoftBody* softbody0, PxU32* tetIndices0, PxU32* tetIndices1, PxU32 tetIndicesSize)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(softbody0 != NULL, "NpSoftBody::removeSoftBodyFilter: soft body must not be null");
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::removeSoftBodyFilter: soft body must be inserted into the scene.");
PX_CHECK_AND_RETURN(softbody0->getScene() != NULL, "NpSoftBody::removeSoftBodyFilter: soft body must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::removeSoftBodyFilter: Illegal to call while simulation is running.");
NpSoftBody* dyn = static_cast<NpSoftBody*>(softbody0);
Sc::SoftBodyCore* core = &dyn->getCore();
mCore.removeSoftBodyFilters(*core, tetIndices0, tetIndices1, tetIndicesSize);
}
PxU32 NpSoftBody::addSoftBodyAttachment(PxSoftBody* softbody0, PxU32 tetIdx0, const PxVec4& tetBarycentric0, PxU32 tetIdx1, const PxVec4& tetBarycentric1,
PxConeLimitedConstraint* constraint, PxReal constraintOffset)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN_VAL(softbody0 != NULL, "NpSoftBody::addSoftBodyAttachment: soft body must not be null", 0xFFFFFFFF);
PX_CHECK_AND_RETURN_VAL(getNpScene() != NULL, "NpSoftBody::addSoftBodyAttachment: soft body must be inserted into the scene.", 0xFFFFFFFF);
PX_CHECK_AND_RETURN_VAL(softbody0->getScene() != NULL, "NpSoftBody::addSoftBodyAttachment: soft body must be inserted into the scene.", 0xFFFFFFFF);
PX_CHECK_AND_RETURN_VAL(constraint == NULL || constraint->isValid(), "NpSoftBody::addSoftBodyAttachment: PxConeLimitedConstraint needs to be valid if specified.", 0xFFFFFFFF);
PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "NpSoftBody::addSoftBodyAttachment: Illegal to call while simulation is running.", 0xFFFFFFFF);
NpSoftBody* dyn = static_cast<NpSoftBody*>(softbody0);
Sc::SoftBodyCore* core = &dyn->getCore();
return mCore.addSoftBodyAttachment(*core, tetIdx0, tetBarycentric0, tetIdx1, tetBarycentric1, constraint, constraintOffset);
}
void NpSoftBody::removeSoftBodyAttachment(PxSoftBody* softbody0, PxU32 handle)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(softbody0 != NULL, "NpSoftBody::removeSoftBodyAttachment: soft body must not be null");
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::removeSoftBodyAttachment: soft body must be inserted into the scene.");
PX_CHECK_AND_RETURN(softbody0->getScene() != NULL, "NpSoftBody::removeSoftBodyAttachment: soft body must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::removeSoftBodyAttachment: Illegal to call while simulation is running.");
NpSoftBody* dyn = static_cast<NpSoftBody*>(softbody0);
Sc::SoftBodyCore* core = &dyn->getCore();
mCore.removeSoftBodyAttachment(*core, handle);
}
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
void NpSoftBody::addClothFilter(PxFEMCloth* cloth, PxU32 triIdx, PxU32 tetIdx)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(cloth != NULL, "NpSoftBody::addClothFilter: actor must not be null");
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::addClothFilter: Soft body must be inserted into the scene.");
PX_CHECK_AND_RETURN(cloth->getScene() != NULL, "NpSoftBody::addClothFilter: actor must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::addClothFilter: Illegal to call while simulation is running.");
NpFEMCloth* dyn = static_cast<NpFEMCloth*>(cloth);
Sc::FEMClothCore* core = &dyn->getCore();
return mCore.addClothFilter(*core, triIdx, tetIdx);
}
#else
void NpSoftBody::addClothFilter(PxFEMCloth*, PxU32, PxU32) {}
#endif
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
void NpSoftBody::removeClothFilter(PxFEMCloth* cloth, PxU32 triIdx, PxU32 tetIdx)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(cloth != NULL, "NpSoftBody::removeClothFilter: actor must not be null");
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::removeClothFilter: soft body must be inserted into the scene.");
PX_CHECK_AND_RETURN(cloth->getScene() != NULL, "NpSoftBody::removeClothFilter: actor must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::removeClothFilter: Illegal to call while simulation is running.");
NpFEMCloth* dyn = static_cast<NpFEMCloth*>(cloth);
Sc::FEMClothCore* core = &dyn->getCore();
mCore.removeClothFilter(*core, triIdx, tetIdx);
}
#else
void NpSoftBody::removeClothFilter(PxFEMCloth*, PxU32, PxU32) {}
#endif
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
void NpSoftBody::addVertClothFilter(PxFEMCloth* cloth, PxU32 vertIdx, PxU32 tetIdx)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(cloth != NULL, "NpSoftBody::addClothFilter: actor must not be null");
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::addClothFilter: Soft body must be inserted into the scene.");
PX_CHECK_AND_RETURN(cloth->getScene() != NULL, "NpSoftBody::addClothFilter: actor must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::addClothFilter: Illegal to call while simulation is running.");
NpFEMCloth* dyn = static_cast<NpFEMCloth*>(cloth);
Sc::FEMClothCore* core = &dyn->getCore();
return mCore.addVertClothFilter(*core, vertIdx, tetIdx);
}
#else
void NpSoftBody::addVertClothFilter(PxFEMCloth*, PxU32, PxU32) {}
#endif
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
void NpSoftBody::removeVertClothFilter(PxFEMCloth* cloth, PxU32 vertIdx, PxU32 tetIdx)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(cloth != NULL, "NpSoftBody::removeClothFilter: actor must not be null");
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::removeClothFilter: soft body must be inserted into the scene.");
PX_CHECK_AND_RETURN(cloth->getScene() != NULL, "NpSoftBody::removeClothFilter: actor must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::removeClothFilter: Illegal to call while simulation is running.");
NpFEMCloth* dyn = static_cast<NpFEMCloth*>(cloth);
Sc::FEMClothCore* core = &dyn->getCore();
mCore.removeVertClothFilter(*core, vertIdx, tetIdx);
}
#else
void NpSoftBody::removeVertClothFilter(PxFEMCloth*, PxU32, PxU32) {}
#endif
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
PxU32 NpSoftBody::addClothAttachment(PxFEMCloth* cloth, PxU32 triIdx, const PxVec4& triBarycentric, PxU32 tetIdx, const PxVec4& tetBarycentric,
PxConeLimitedConstraint* constraint, PxReal constraintOffset)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN_VAL(cloth != NULL, "NpSoftBody::addClothAttachment: actor must not be null", 0xFFFFFFFF);
PX_CHECK_AND_RETURN_VAL(getNpScene() != NULL, "NpSoftBody::addClothAttachment: Soft body must be inserted into the scene.", 0xFFFFFFFF);
PX_CHECK_AND_RETURN_VAL(cloth->getScene() != NULL, "NpSoftBody::addClothAttachment: actor must be inserted into the scene.", 0xFFFFFFFF);
PX_CHECK_AND_RETURN_VAL(constraint == NULL || constraint->isValid(), "NpSoftBody::addClothAttachment: PxConeLimitedConstraint needs to be valid if specified.", 0xFFFFFFFF);
PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "NpSoftBody::addClothAttachment: Illegal to call while simulation is running.", 0xFFFFFFFF);
NpFEMCloth* dyn = static_cast<NpFEMCloth*>(cloth);
Sc::FEMClothCore* core = &dyn->getCore();
return mCore.addClothAttachment(*core, triIdx, triBarycentric, tetIdx, tetBarycentric, constraint, constraintOffset);
}
#else
PxU32 NpSoftBody::addClothAttachment(PxFEMCloth*, PxU32, const PxVec4&, PxU32, const PxVec4&, PxConeLimitedConstraint*, PxReal) { return 0; }
#endif
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
void NpSoftBody::removeClothAttachment(PxFEMCloth* cloth, PxU32 handle)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(cloth != NULL, "NpSoftBody::releaseClothAttachment: actor must not be null");
PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::releaseClothAttachment: soft body must be inserted into the scene.");
PX_CHECK_AND_RETURN(cloth->getScene() != NULL, "NpSoftBody::releaseClothAttachment: actor must be inserted into the scene.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::releaseClothAttachment: Illegal to call while simulation is running.");
NpFEMCloth* dyn = static_cast<NpFEMCloth*>(cloth);
Sc::FEMClothCore* core = &dyn->getCore();
mCore.removeClothAttachment(*core, handle);
}
#else
void NpSoftBody::removeClothAttachment(PxFEMCloth*, PxU32) {}
#endif
}
#endif //PX_SUPPORT_GPU_PHYSX
| 32,822 | C++ | 42.53183 | 200 | 0.754768 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/NpFEMClothMaterial.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef NP_FEM_CLOTH_MATERIAL_H
#define NP_FEM_CLOTH_MATERIAL_H
#include "common/PxSerialFramework.h"
#include "foundation/PxUserAllocated.h"
#include "foundation/PxUtilities.h"
#include "CmRefCountable.h"
#include "PxsFEMClothMaterialCore.h"
namespace physx
{
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
// Compared to other objects, materials are special since they belong to the SDK and not to scenes
// (similar to meshes). That's why the NpFEMClothMaterial does have direct access to the core material instead
// of having a buffered interface for it. Scenes will have copies of the SDK material table and there
// the materials will be buffered.
class NpFEMClothMaterial : public PxFEMClothMaterial, public PxUserAllocated
{
public:
// PX_SERIALIZATION
NpFEMClothMaterial(PxBaseFlags baseFlags) : PxFEMClothMaterial(baseFlags), mMaterial(PxEmpty) {}
virtual void resolveReferences(PxDeserializationContext& context);
static NpFEMClothMaterial* createObject(PxU8*& address, PxDeserializationContext& context);
static void getBinaryMetaData(PxOutputStream& stream);
void preExportDataReset() { Cm::RefCountable_preExportDataReset(*this); }
void exportExtraData(PxSerializationContext&) {}
void importExtraData(PxDeserializationContext&) {}
virtual void requiresObjects(PxProcessPxBaseCallback&) {}
//~PX_SERIALIZATION
NpFEMClothMaterial(const PxsFEMClothMaterialCore& desc);
virtual ~NpFEMClothMaterial();
// PxBase
virtual void release() PX_OVERRIDE;
//~PxBase
// PxRefCounted
virtual void acquireReference() PX_OVERRIDE;
virtual PxU32 getReferenceCount() const PX_OVERRIDE;
virtual void onRefCountZero() PX_OVERRIDE;
//~PxRefCounted
// PxFEMMaterial
virtual void setYoungsModulus(PxReal young) PX_OVERRIDE;
virtual PxReal getYoungsModulus() const PX_OVERRIDE;
virtual void setPoissons(PxReal poisson) PX_OVERRIDE;
virtual PxReal getPoissons() const PX_OVERRIDE;
virtual void setDynamicFriction(PxReal threshold) PX_OVERRIDE;
virtual PxReal getDynamicFriction() const PX_OVERRIDE;
//~PxFEMMaterial
// PxFEMClothMaterial
virtual void setThickness(PxReal thickness) PX_OVERRIDE;
virtual PxReal getThickness() const PX_OVERRIDE;
//~PxFEMClothMaterial
PX_FORCE_INLINE static void getMaterialIndices(PxFEMClothMaterial*const* materials, PxU16* materialIndices, PxU32 materialCount);
private:
PX_INLINE void updateMaterial();
// PX_SERIALIZATION
public:
//~PX_SERIALIZATION
PxsFEMClothMaterialCore mMaterial;
};
PX_FORCE_INLINE void NpFEMClothMaterial::getMaterialIndices(PxFEMClothMaterial*const* materials, PxU16* materialIndices, PxU32 materialCount)
{
for (PxU32 i = 0; i < materialCount; i++)
materialIndices[i] = static_cast<NpFEMClothMaterial*>(materials[i])->mMaterial.mMaterialIndex;
}
#endif
}
#endif
| 4,630 | C | 42.280373 | 142 | 0.757235 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/NpBase.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef NP_BASE_H
#define NP_BASE_H
#include "foundation/PxUserAllocated.h"
#include "NpScene.h"
#if PX_SUPPORT_PVD
// PT: updatePvdProperties() is overloaded and the compiler needs to know 'this' type to do the right thing.
// Thus we can't just move this as an inlined Base function.
#define UPDATE_PVD_PROPERTY \
{ \
NpScene* scene = getNpScene(); /* shared shapes also return zero here */ \
if(scene) \
scene->getScenePvdClientInternal().updatePvdProperties(this); \
}
#else
#define UPDATE_PVD_PROPERTY
#endif
///////////////////////////////////////////////////////////////////////////////
// PT: technically the following macros should all be "NP" macros (they're not exposed to the public API)
// but I only renamed the local ones (used in NpBase.h) as "NP", while the other "PX" are used by clients
// of these macros in other Np files. The PX_CHECK names are very misleading, since these checks seem to
// stay in all builds, contrary to other macros like PX_CHECK_AND_RETURN.
///////////////////////////////////////////////////////////////////////////////
#define NP_API_READ_WRITE_ERROR_MSG(text) PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, text)
// some API read calls are not allowed while the simulation is running since the properties might get
// written to during simulation. Some of those are allowed while collision is running though or in callbacks
// like contact modification, contact reports etc. Furthermore, it is ok to read all of them between fetchCollide
// and advance.
#define NP_API_READ_FORBIDDEN(npScene) (npScene && npScene->isAPIReadForbidden())
#define NP_API_READ_FORBIDDEN_EXCEPT_COLLIDE(npScene) (npScene && npScene->isAPIReadForbidden() && (!npScene->isCollisionPhaseActive()))
///////////////////////////////////////////////////////////////////////////////
#define PX_CHECK_SCENE_API_READ_FORBIDDEN(npScene, text) \
if(NP_API_READ_FORBIDDEN(npScene)) \
{ \
NP_API_READ_WRITE_ERROR_MSG(text); \
return; \
}
#define PX_CHECK_SCENE_API_READ_FORBIDDEN_AND_RETURN_VAL(npScene, text, retValue) \
if(NP_API_READ_FORBIDDEN(npScene)) \
{ \
NP_API_READ_WRITE_ERROR_MSG(text); \
return retValue; \
}
#define PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE(npScene, text) \
if(NP_API_READ_FORBIDDEN_EXCEPT_COLLIDE(npScene)) \
{ \
NP_API_READ_WRITE_ERROR_MSG(text); \
return; \
}
#define PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE_AND_RETURN_VAL(npScene, text, retValue) \
if(NP_API_READ_FORBIDDEN_EXCEPT_COLLIDE(npScene)) \
{ \
NP_API_READ_WRITE_ERROR_MSG(text); \
return retValue; \
}
///////////////////////////////////////////////////////////////////////////////
#define NP_API_WRITE_FORBIDDEN(npScene) (npScene && npScene->isAPIWriteForbidden())
// some API write calls are allowed between fetchCollide and advance
#define NP_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(npScene) (npScene && npScene->isAPIWriteForbidden() && (npScene->getSimulationStage() != Sc::SimulationStage::eFETCHCOLLIDE))
///////////////////////////////////////////////////////////////////////////////
#define PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, text) \
if(NP_API_WRITE_FORBIDDEN(npScene)) \
{ \
NP_API_READ_WRITE_ERROR_MSG(text); \
return; \
}
#define PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(npScene, text, retValue) \
if(NP_API_WRITE_FORBIDDEN(npScene)) \
{ \
NP_API_READ_WRITE_ERROR_MSG(text); \
return retValue; \
}
#define PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(npScene, text) \
if(NP_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(npScene)) \
{ \
NP_API_READ_WRITE_ERROR_MSG(text); \
return; \
}
///////////////////////////////////////////////////////////////////////////////
#define NP_UNUSED_BASE_INDEX 0x07ffffff
#define NP_BASE_INDEX_MASK 0x07ffffff
#define NP_BASE_INDEX_SHIFT 27
namespace physx
{
struct NpType
{
enum Enum
{
eUNDEFINED,
eSHAPE,
eBODY,
eBODY_FROM_ARTICULATION_LINK,
eRIGID_STATIC,
eCONSTRAINT,
eARTICULATION,
eARTICULATION_JOINT,
eARTICULATION_SENSOR,
eARTICULATION_SPATIAL_TENDON,
eARTICULATION_ATTACHMENT,
eARTICULATION_FIXED_TENDON,
eARTICULATION_TENDON_JOINT,
eAGGREGATE,
eSOFTBODY,
eFEMCLOTH,
ePBD_PARTICLESYSTEM,
eFLIP_PARTICLESYSTEM,
eMPM_PARTICLESYSTEM,
eHAIRSYSTEM,
eTYPE_COUNT,
eFORCE_DWORD = 0x7fffffff
};
};
// PT: we're going to store that type on 5 bits, leaving 27 bits for the base index.
PX_COMPILE_TIME_ASSERT(NpType::eTYPE_COUNT<32);
class NpBase : public PxUserAllocated
{
PX_NOCOPY(NpBase)
public:
// PX_SERIALIZATION
NpBase(const PxEMPTY) :
mScene (NULL),
mFreeSlot (0)
{
// PT: preserve type, reset base index
setBaseIndex(NP_UNUSED_BASE_INDEX);
}
static void getBinaryMetaData(PxOutputStream& stream);
//~PX_SERIALIZATION
NpBase(NpType::Enum type) :
mScene (NULL),
mFreeSlot (0)
{
mBaseIndexAndType = (PxU32(type)<<NP_BASE_INDEX_SHIFT)|NP_UNUSED_BASE_INDEX;
}
PX_INLINE bool isAPIWriteForbidden() const { return NP_API_WRITE_FORBIDDEN(mScene); }
PX_INLINE bool isAPIWriteForbiddenExceptSplitSim() const { return NP_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(mScene); }
PX_FORCE_INLINE NpType::Enum getNpType() const { return NpType::Enum(mBaseIndexAndType>>NP_BASE_INDEX_SHIFT); }
PX_FORCE_INLINE void setNpScene(NpScene* scene) { mScene = scene; }
PX_FORCE_INLINE NpScene* getNpScene() const { return mScene; }
PX_FORCE_INLINE PxU32 getBaseIndex() const { return mBaseIndexAndType & NP_BASE_INDEX_MASK; }
PX_FORCE_INLINE void setBaseIndex(PxU32 index)
{
PX_ASSERT(!(index & ~NP_BASE_INDEX_MASK));
const PxU32 type = mBaseIndexAndType & ~NP_BASE_INDEX_MASK;
mBaseIndexAndType = index|type;
}
protected:
~NpBase(){}
private:
NpScene* mScene;
PxU32 mBaseIndexAndType;
protected:
PxU32 mFreeSlot;
};
}
#endif
| 8,183 | C | 37.78673 | 173 | 0.633264 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/NpRigidStatic.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "NpRigidStatic.h"
#include "NpRigidActorTemplateInternal.h"
#include "omnipvd/NpOmniPvdSetData.h"
using namespace physx;
NpRigidStatic::NpRigidStatic(const PxTransform& pose) :
NpRigidStaticT (PxConcreteType::eRIGID_STATIC, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE, NpType::eRIGID_STATIC),
mCore (pose)
{
}
NpRigidStatic::~NpRigidStatic()
{
}
// PX_SERIALIZATION
void NpRigidStatic::requiresObjects(PxProcessPxBaseCallback& c)
{
NpRigidStaticT::requiresObjects(c);
}
NpRigidStatic* NpRigidStatic::createObject(PxU8*& address, PxDeserializationContext& context)
{
NpRigidStatic* obj = PX_PLACEMENT_NEW(address, NpRigidStatic(PxBaseFlag::eIS_RELEASABLE));
address += sizeof(NpRigidStatic);
obj->importExtraData(context);
obj->resolveReferences(context);
return obj;
}
//~PX_SERIALIZATION
void NpRigidStatic::release()
{
if(releaseRigidActorT<PxRigidStatic>(*this))
{
PX_ASSERT(!isAPIWriteForbidden()); // the code above should return false in that case
NpDestroyRigidActor(this);
}
}
void NpRigidStatic::setGlobalPose(const PxTransform& pose, bool /*wake*/)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_AND_RETURN(pose.isSane(), "PxRigidStatic::setGlobalPose: pose is not valid.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidStatic::setGlobalPose() not allowed while simulation is running. Call will be ignored.")
#if PX_CHECKED
if(npScene)
npScene->checkPositionSanity(*this, pose, "PxRigidStatic::setGlobalPose");
#endif
const PxTransform newPose = pose.getNormalized(); //AM: added to fix 1461 where users read and write orientations for no reason.
mCore.setActor2World(newPose);
UPDATE_PVD_PROPERTY
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidActor, translation, *static_cast<PxRigidActor*>(this), newPose.p);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidActor, rotation, *static_cast<PxRigidActor*>(this), newPose.q);
OMNI_PVD_WRITE_SCOPE_END
if(npScene)
mShapeManager.markActorForSQUpdate(npScene->getSQAPI(), *this);
// invalidate the pruning structure if the actor bounds changed
if(mShapeManager.getPruningStructure())
{
PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxRigidStatic::setGlobalPose: Actor is part of a pruning structure, pruning structure is now invalid!");
mShapeManager.getPruningStructure()->invalidate(this);
}
updateShaderComs();
}
PxTransform NpRigidStatic::getGlobalPose() const
{
NP_READ_CHECK(getNpScene());
return mCore.getActor2World();
}
PxU32 physx::NpRigidStaticGetShapes(NpRigidStatic& rigid, NpShape* const *&shapes)
{
NpShapeManager& sm = rigid.getShapeManager();
shapes = sm.getShapes();
return sm.getNbShapes();
}
void NpRigidStatic::switchToNoSim()
{
NpActor::scSwitchToNoSim();
}
void NpRigidStatic::switchFromNoSim()
{
NpActor::scSwitchFromNoSim();
}
#if PX_CHECKED
bool NpRigidStatic::checkConstraintValidity() const
{
// Perhaps NpConnectorConstIterator would be worth it...
NpConnectorIterator iter = (const_cast<NpRigidStatic*>(this))->getConnectorIterator(NpConnectorType::eConstraint);
while (PxBase* ser = iter.getNext())
{
NpConstraint* c = static_cast<NpConstraint*>(ser);
if(!c->NpConstraint::isValid())
return false;
}
return true;
}
#endif
| 5,070 | C++ | 34.215278 | 171 | 0.765286 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/NpRigidDynamic.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef NP_RIGID_DYNAMIC_H
#define NP_RIGID_DYNAMIC_H
#include "common/PxMetaData.h"
#include "PxRigidDynamic.h"
#include "NpRigidBodyTemplate.h"
namespace physx
{
typedef NpRigidBodyTemplate<PxRigidDynamic> NpRigidDynamicT;
class NpRigidDynamic : public NpRigidDynamicT
{
public:
// PX_SERIALIZATION
NpRigidDynamic(PxBaseFlags baseFlags) : NpRigidDynamicT(baseFlags) {}
void preExportDataReset();
virtual void requiresObjects(PxProcessPxBaseCallback& c);
static NpRigidDynamic* createObject(PxU8*& address, PxDeserializationContext& context);
static void getBinaryMetaData(PxOutputStream& stream);
//~PX_SERIALIZATION
virtual ~NpRigidDynamic();
//---------------------------------------------------------------------------------
// PxActor implementation
//---------------------------------------------------------------------------------
virtual void release() PX_OVERRIDE;
//---------------------------------------------------------------------------------
// PxRigidDynamic implementation
//---------------------------------------------------------------------------------
virtual PxActorType::Enum getType() const PX_OVERRIDE { return PxActorType::eRIGID_DYNAMIC; }
// Pose
virtual void setGlobalPose(const PxTransform& pose, bool autowake) PX_OVERRIDE;
PX_FORCE_INLINE PxTransform getGlobalPoseFast() const
{
const Sc::BodyCore& body = getCore();
// PT:: tag: scalar transform*transform
return body.getBody2World() * body.getBody2Actor().getInverse();
}
virtual PxTransform getGlobalPose() const PX_OVERRIDE
{
NP_READ_CHECK(getNpScene());
PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE_AND_RETURN_VAL(getNpScene(), "PxRigidDynamic::getGlobalPose() not allowed while simulation is running (except during PxScene::collide()).", PxTransform(PxIdentity));
return getGlobalPoseFast();
}
virtual void setKinematicTarget(const PxTransform& destination) PX_OVERRIDE;
virtual bool getKinematicTarget(PxTransform& target) const PX_OVERRIDE;
// Center of mass pose
virtual void setCMassLocalPose(const PxTransform&) PX_OVERRIDE;
// Velocity
virtual void setLinearVelocity(const PxVec3&, bool autowake) PX_OVERRIDE;
virtual void setAngularVelocity(const PxVec3&, bool autowake) PX_OVERRIDE;
// Force/Torque modifiers
virtual void addForce(const PxVec3&, PxForceMode::Enum mode, bool autowake) PX_OVERRIDE;
virtual void clearForce(PxForceMode::Enum mode) PX_OVERRIDE;
virtual void addTorque(const PxVec3&, PxForceMode::Enum mode, bool autowake) PX_OVERRIDE;
virtual void clearTorque(PxForceMode::Enum mode) PX_OVERRIDE;
virtual void setForceAndTorque(const PxVec3& force, const PxVec3& torque, PxForceMode::Enum mode = PxForceMode::eFORCE) PX_OVERRIDE;
// Sleeping
virtual bool isSleeping() const PX_OVERRIDE;
virtual PxReal getSleepThreshold() const PX_OVERRIDE;
virtual void setSleepThreshold(PxReal threshold) PX_OVERRIDE;
virtual PxReal getStabilizationThreshold() const PX_OVERRIDE;
virtual void setStabilizationThreshold(PxReal threshold) PX_OVERRIDE;
virtual void setWakeCounter(PxReal wakeCounterValue) PX_OVERRIDE;
virtual PxReal getWakeCounter() const PX_OVERRIDE;
virtual void wakeUp() PX_OVERRIDE;
virtual void putToSleep() PX_OVERRIDE;
virtual void setSolverIterationCounts(PxU32 positionIters, PxU32 velocityIters) PX_OVERRIDE;
virtual void getSolverIterationCounts(PxU32 & positionIters, PxU32 & velocityIters) const PX_OVERRIDE;
virtual void setContactReportThreshold(PxReal threshold) PX_OVERRIDE;
virtual PxReal getContactReportThreshold() const PX_OVERRIDE;
virtual PxRigidDynamicLockFlags getRigidDynamicLockFlags() const PX_OVERRIDE;
virtual void setRigidDynamicLockFlags(PxRigidDynamicLockFlags flags) PX_OVERRIDE;
virtual void setRigidDynamicLockFlag(PxRigidDynamicLockFlag::Enum flag, bool value) PX_OVERRIDE;
//---------------------------------------------------------------------------------
// Miscellaneous
//---------------------------------------------------------------------------------
NpRigidDynamic(const PxTransform& bodyPose);
virtual void switchToNoSim() PX_OVERRIDE;
virtual void switchFromNoSim() PX_OVERRIDE;
PX_FORCE_INLINE void wakeUpInternal();
void wakeUpInternalNoKinematicTest(bool forceWakeUp, bool autowake);
static PX_FORCE_INLINE size_t getCoreOffset() { return PX_OFFSET_OF_RT(NpRigidDynamic, mCore); }
static PX_FORCE_INLINE size_t getNpShapeManagerOffset() { return PX_OFFSET_OF_RT(NpRigidDynamic, mShapeManager); }
#if PX_CHECKED
PX_FORCE_INLINE bool checkConstraintValidity() const { return true; }
#endif
private:
PX_FORCE_INLINE void setKinematicTargetInternal(const PxTransform& destination);
#if PX_ENABLE_DEBUG_VISUALIZATION
public:
void visualize(PxRenderOutput& out, NpScene& scene, float scale) const;
#else
PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION
#endif
};
PX_FORCE_INLINE void NpRigidDynamic::wakeUpInternal()
{
PX_ASSERT(getNpScene());
const Sc::BodyCore& body = getCore();
const PxRigidBodyFlags currentFlags = body.getFlags();
if (!(currentFlags & PxRigidBodyFlag::eKINEMATIC)) // kinematics are only awake when a target is set, else they are asleep
wakeUpInternalNoKinematicTest(false, true);
}
}
#endif
| 7,078 | C | 41.90303 | 216 | 0.709381 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/NpParticleSystem.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef NP_PARTICLE_SYSTEM_H
#define NP_PARTICLE_SYSTEM_H
#include "foundation/PxBounds3.h"
#include "foundation/PxErrors.h"
#include "foundation/PxSimpleTypes.h"
#include "foundation/PxUserAllocated.h"
#include "foundation/PxVec3.h"
#include "common/PxBase.h"
#include "common/PxRenderOutput.h"
#include "PxActor.h"
#include "PxFiltering.h"
#include "PxParticleBuffer.h"
//#include "PxParticlePhase.h"
#include "PxParticleSolverType.h"
#include "PxParticleSystem.h"
#include "PxPBDParticleSystem.h"
#include "PxPBDMaterial.h"
#include "PxSceneDesc.h"
#include "PxSparseGridParams.h"
#include "DyParticleSystem.h"
#include "NpActor.h"
#include "NpActorTemplate.h"
#include "NpBase.h"
#include "NpMaterialManager.h"
#include "NpPhysics.h"
#include "ScParticleSystemSim.h"
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
#include "PxFLIPParticleSystem.h"
#include "PxFLIPMaterial.h"
#include "PxMPMParticleSystem.h"
#include "PxMPMMaterial.h"
#endif
namespace physx
{
class NpScene;
class PxCudaContextManager;
class PxParticleMaterial;
class PxRigidActor;
class PxSerializationContext;
namespace Sc
{
class ParticleSystemSim;
}
template<class APIClass>
class NpParticleSystem : public NpActorTemplate<APIClass>
{
public:
NpParticleSystem(PxCudaContextManager& contextManager, PxType concreteType, NpType::Enum npType, PxActorType::Enum actorType) :
NpActorTemplate<APIClass>(concreteType, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE, npType),
mCore(actorType),
mCudaContextManager(&contextManager),
mNextPhaseGroupID(0)
{
}
NpParticleSystem(PxBaseFlags baseFlags) : NpActorTemplate<APIClass>(baseFlags)
{}
virtual ~NpParticleSystem()
{
//TODO!!!!! Do this correctly
//sParticleSystemIdPool.tryRemoveID(mID);
}
virtual void exportData(PxSerializationContext& /*context*/) const {}
//external API
virtual PxBounds3 getWorldBounds(float inflation = 1.01f) const
{
NP_READ_CHECK(NpBase::getNpScene());
if (!NpBase::getNpScene())
{
PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "Querying bounds of a PxParticleSystem which is not part of a PxScene is not supported.");
return PxBounds3::empty();
}
const Sc::ParticleSystemSim* sim = mCore.getSim();
PX_ASSERT(sim);
PX_SIMD_GUARD;
PxBounds3 bounds = sim->getBounds();
PX_ASSERT(bounds.isValid());
// PT: unfortunately we can't just scale the min/max vectors, we need to go through center/extents.
const PxVec3 center = bounds.getCenter();
const PxVec3 inflatedExtents = bounds.getExtents() * inflation;
return PxBounds3::centerExtents(center, inflatedExtents);
}
virtual void setSolverIterationCounts(PxU32 minPositionIters, PxU32 minVelocityIters = 1)
{
NpScene* npScene = NpBase::getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_AND_RETURN(minPositionIters > 0, "NpParticleSystem::setSolverIterationCounts: positionIters must be more than zero!");
PX_CHECK_AND_RETURN(minPositionIters <= 255, "NpParticleSystem::setSolverIterationCounts: positionIters must be no greater than 255!");
PX_CHECK_AND_RETURN(minVelocityIters <= 255, "NpParticleSystem::setSolverIterationCounts: velocityIters must be no greater than 255!");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxParticleSystem::setSolverIterationCounts() not allowed while simulation is running. Call will be ignored.")
mCore.setSolverIterationCounts((minVelocityIters & 0xff) << 8 | (minPositionIters & 0xff));
//UPDATE_PVD_PROPERTY
}
virtual void getSolverIterationCounts(PxU32& minPositionIters, PxU32& minVelocityIters) const
{
NP_READ_CHECK(NpBase::getNpScene());
PxU16 x = mCore.getSolverIterationCounts();
minVelocityIters = PxU32(x >> 8);
minPositionIters = PxU32(x & 0xff);
}
virtual PxCudaContextManager* getCudaContextManager() const { return mCudaContextManager; }
virtual void setRestOffset(PxReal restOffset) { scSetRestOffset(restOffset); }
virtual PxReal getRestOffset() const { return mCore.getRestOffset(); }
virtual void setContactOffset(PxReal contactOffset) { scSetContactOffset(contactOffset); }
virtual PxReal getContactOffset() const { return mCore.getContactOffset(); }
virtual void setParticleContactOffset(PxReal particleContactOffset) { scSetParticleContactOffset(particleContactOffset); }
virtual PxReal getParticleContactOffset() const { return mCore.getParticleContactOffset(); }
virtual void setSolidRestOffset(PxReal solidRestOffset) { scSetSolidRestOffset(solidRestOffset); }
virtual PxReal getSolidRestOffset() const { return mCore.getSolidRestOffset(); }
virtual void setMaxDepenetrationVelocity(PxReal v) {scSetMaxDepenetrationVelocity(v); }
virtual PxReal getMaxDepenetrationVelocity(){ return mCore.getMaxDepenetrationVelocity(); }
virtual void setMaxVelocity(PxReal v) { scSetMaxVelocity(v); }
virtual PxReal getMaxVelocity() { return mCore.getMaxVelocity(); }
virtual void setParticleSystemCallback(PxParticleSystemCallback* callback) { mCore.setParticleSystemCallback(callback); }
virtual PxParticleSystemCallback* getParticleSystemCallback() const { return mCore.getParticleSystemCallback(); }
// TOFIX
virtual void enableCCD(bool enable) { scSnableCCD(enable); }
virtual PxU32 createPhase(PxParticleMaterial* material, PxParticlePhaseFlags flags) = 0;
virtual PxFilterData getSimulationFilterData() const
{
return mCore.getShapeCore().getSimulationFilterData();
}
virtual void setSimulationFilterData(const PxFilterData& data)
{
mCore.getShapeCore().setSimulationFilterData(data);
}
virtual void setParticleFlag(PxParticleFlag::Enum flag, bool val)
{
PxParticleFlags flags = mCore.getFlags();
if (val)
flags.raise(flag);
else
flags.clear(flag);
mCore.setFlags(flags);
scSetDirtyFlag();
}
virtual void setParticleFlags(PxParticleFlags flags)
{
mCore.setFlags(flags);
scSetDirtyFlag();
}
virtual PxParticleFlags getParticleFlags() const
{
return mCore.getFlags();
}
void setSolverType(const PxParticleSolverType::Enum solverType) { scSetSolverType(solverType); }
virtual PxParticleSolverType::Enum getSolverType() const { return mCore.getSolverType(); }
virtual PxU32 getNbParticleMaterials() const
{
const Sc::ParticleSystemShapeCore& shapeCore = mCore.getShapeCore();
const Dy::ParticleSystemCore& core = shapeCore.getLLCore();
return core.mUniqueMaterialHandles.size();
}
virtual PxU32 getParticleMaterials(PxParticleMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0;
virtual void addParticleBuffer(PxParticleBuffer* userBuffer) = 0;
virtual void removeParticleBuffer(PxParticleBuffer* userBuffer) = 0;
virtual PxU32 getGpuParticleSystemIndex()
{
NP_READ_CHECK(NpBase::getNpScene());
PX_CHECK_AND_RETURN_VAL(NpBase::getNpScene(), "NpParticleSystem::getGpuParticleSystemIndex: particle system must be in a scene.", 0xffffffff);
if (NpBase::getNpScene()->getFlags() & PxSceneFlag::eENABLE_DIRECT_GPU_API)
return mCore.getSim()->getLowLevelParticleSystem()->getGpuRemapId();
return 0xffffffff;
}
PX_FORCE_INLINE const Sc::ParticleSystemCore& getCore() const { return mCore; }
PX_FORCE_INLINE Sc::ParticleSystemCore& getCore() { return mCore; }
static PX_FORCE_INLINE size_t getCoreOffset() { return PX_OFFSET_OF_RT(NpParticleSystem, mCore); }
PX_INLINE void scSetDirtyFlag()
{
NP_READ_CHECK(NpBase::getNpScene());
NpScene* scene = NpBase::getNpScene();
if (scene)
{
mCore.getSim()->getLowLevelParticleSystem()->mFlag |= Dy::ParticleSystemFlag::eUPDATE_PARAMS;
}
}
PX_INLINE void scSetSleepThreshold(const PxReal v)
{
PX_ASSERT(!NpBase::isAPIWriteForbidden());
mCore.setSleepThreshold(v);
//UPDATE_PVD_PROPERTY
}
PX_INLINE void scSetRestOffset(const PxReal v)
{
PX_ASSERT(!NpBase::isAPIWriteForbidden());
mCore.setRestOffset(v);
scSetDirtyFlag();
//UPDATE_PVD_PROPERTY
}
PX_INLINE void scSetContactOffset(const PxReal v)
{
PX_ASSERT(!NpBase::isAPIWriteForbidden());
mCore.setContactOffset(v);
scSetDirtyFlag();
//UPDATE_PVD_PROPERTY
}
PX_INLINE void scSetParticleContactOffset(const PxReal v)
{
PX_ASSERT(!NpBase::isAPIWriteForbidden());
mCore.setParticleContactOffset(v);
scSetDirtyFlag();
//UPDATE_PVD_PROPERTY
}
PX_INLINE void scSetSolidRestOffset(const PxReal v)
{
PX_ASSERT(!NpBase::isAPIWriteForbidden());
mCore.setSolidRestOffset(v);
scSetDirtyFlag();
//UPDATE_PVD_PROPERTY
}
PX_INLINE void scSetFluidRestOffset(const PxReal v)
{
PX_ASSERT(!NpBase::isAPIWriteForbidden());
mCore.setFluidRestOffset(v);
scSetDirtyFlag();
//UPDATE_PVD_PROPERTY
}
PX_INLINE void scSetGridSizeX(const PxU32 v)
{
PX_ASSERT(!NpBase::isAPIWriteForbidden());
mCore.setGridSizeX(v);
//UPDATE_PVD_PROPERTY
}
PX_INLINE void scSetGridSizeY(const PxU32 v)
{
PX_ASSERT(!NpBase::isAPIWriteForbidden());
mCore.setGridSizeY(v);
//UPDATE_PVD_PROPERTY
}
PX_INLINE void scSetGridSizeZ(const PxU32 v)
{
PX_ASSERT(!NpBase::isAPIWriteForbidden());
mCore.setGridSizeZ(v);
//UPDATE_PVD_PROPERTY
}
PX_INLINE void scSnableCCD(const bool enable)
{
PX_ASSERT(!NpBase::isAPIWriteForbidden());
mCore.enableCCD(enable);
scSetDirtyFlag();
//UPDATE_PVD_PROPERTY
}
PX_INLINE void scSetWind(const PxVec3& v)
{
PX_ASSERT(!NpBase::isAPIWriteForbidden());
mCore.setWind(v);
scSetDirtyFlag();
//UPDATE_PVD_PROPERTY
}
PX_INLINE void scSetMaxDepenetrationVelocity(const PxReal v)
{
PX_CHECK_AND_RETURN(v > 0.f, "PxParticleSystem::setMaxDepenetrationVelocity: Max Depenetration Velocity must be > 0!");
PX_ASSERT(!NpBase::isAPIWriteForbidden());
mCore.setMaxDepenetrationVelocity(v);
scSetDirtyFlag();
//UPDATE_PVD_PROPERTY
}
PX_INLINE void scSetMaxVelocity(const PxReal v)
{
PX_CHECK_AND_RETURN(v > 0.f, "PxParticleSystem::setMaxVelocity: Max Velocity must be > 0!");
PX_ASSERT(!NpBase::isAPIWriteForbidden());
mCore.setMaxVelocity(v);
scSetDirtyFlag();
//UPDATE_PVD_PROPERTY
}
PX_INLINE void scSetSolverType(const PxParticleSolverType::Enum solverType)
{
PX_ASSERT(!NpBase::isAPIWriteForbidden());
mCore.setSolverType(solverType);
//UPDATE_PVD_PROPERTY
}
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
PX_INLINE void scSetSparseGridParams(const PxSparseGridParams& params)
{
PX_CHECK_AND_RETURN(params.subgridSizeX > 1 && params.subgridSizeX % 2 == 0, "PxParticleSystem::setSparseGridParams: Sparse grid subgridSizeX must be > 1 and even number!");
PX_CHECK_AND_RETURN(params.subgridSizeY > 1 && params.subgridSizeY % 2 == 0, "PxParticleSystem::setSparseGridParams: Sparse grid subgridSizeY must be > 1 and even number!");
PX_CHECK_AND_RETURN(params.subgridSizeZ > 1 && params.subgridSizeZ % 2 == 0, "PxParticleSystem::setSparseGridParams: Sparse grid subgridSizeZ must be > 1 and even number!");
PX_ASSERT(!NpBase::isAPIWriteForbidden());
mCore.setSparseGridParams(params);
//UPDATE_PVD_PROPERTY
}
#endif
#if PX_ENABLE_DEBUG_VISUALIZATION
virtual void visualize(PxRenderOutput& out, NpScene& npScene) const = 0;
#else
PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION
#endif
// Debug name
void setName(const char* debugName)
{
NP_WRITE_CHECK(NpBase::getNpScene());
NpActor::mName = debugName;
}
const char* getName() const
{
NP_READ_CHECK(NpBase::getNpScene());
return NpActor::mName;
}
virtual void setGridSizeX(PxU32 gridSizeX) { scSetGridSizeX(gridSizeX); }
virtual void setGridSizeY(PxU32 gridSizeY) { scSetGridSizeY(gridSizeY); }
virtual void setGridSizeZ(PxU32 gridSizeZ) { scSetGridSizeZ(gridSizeZ); }
template<typename ParticleMaterialType>
PxU32 getParticleMaterialsInternal(PxParticleMaterial** userBuffer, PxU32 bufferSize,
PxU32 startIndex = 0) const
{
const Sc::ParticleSystemShapeCore& shapeCore = mCore.getShapeCore();
const Dy::ParticleSystemCore& core = shapeCore.getLLCore();
NpMaterialManager<ParticleMaterialType>& matManager =
NpMaterialAccessor<ParticleMaterialType>::getMaterialManager(NpPhysics::getInstance());
PxU32 size = core.mUniqueMaterialHandles.size();
const PxU32 remainder = PxU32(PxMax<PxI32>(PxI32(size - startIndex), 0));
const PxU32 writeCount = PxMin(remainder, bufferSize);
for(PxU32 i = 0; i < writeCount; i++)
{
userBuffer[i] = matManager.getMaterial(core.mUniqueMaterialHandles[startIndex + i]);
}
return writeCount;
}
protected:
Sc::ParticleSystemCore mCore;
PxCudaContextManager* mCudaContextManager;
PxU32 mNextPhaseGroupID;
};
class NpParticleClothPreProcessor : public PxParticleClothPreProcessor, public PxUserAllocated
{
public:
NpParticleClothPreProcessor(PxCudaContextManager* cudaContextManager) : mCudaContextManager(cudaContextManager), mNbPartitions(0){}
virtual ~NpParticleClothPreProcessor() {}
virtual void release();
virtual void partitionSprings(const PxParticleClothDesc& clothDesc, PxPartitionedParticleCloth& output) PX_OVERRIDE;
private:
PxU32 computeSpringPartition(const PxParticleSpring& springs, const PxU32 partitionStartIndex, PxU32* partitionProgresses);
PxU32* partitions(const PxParticleSpring* springs, PxU32* orderedSpringIndices);
PxU32 combinePartitions(const PxParticleSpring* springs, const PxU32* orderedSpringIndices, const PxU32* accumulatedSpringsPerPartition,
PxU32* accumulatedSpringsPerCombinedPartitions, PxParticleSpring* orderedSprings, PxU32* accumulatedCopiesPerParticles, PxU32* remapOutput);
void classifySprings(const PxParticleSpring* springs, PxU32* partitionProgresses, PxU32* tempSprings, physx::PxArray<PxU32>& springsPerPartition);
void writeSprings(const PxParticleSpring* springs, PxU32* partitionProgresses, PxU32* tempSprings, PxU32* orderedSprings,
PxU32* accumulatedSpringsPerPartition);
PxCudaContextManager* mCudaContextManager;
PxU32 mNumSprings;
PxU32 mNbPartitions;
PxU32 mNumParticles;
PxU32 mMaxSpringsPerPartition;
};
class NpPBDParticleSystem : public NpParticleSystem<PxPBDParticleSystem>
{
public:
NpPBDParticleSystem(PxU32 maxNeighborhood, PxCudaContextManager& contextManager);
virtual ~NpPBDParticleSystem(){}
virtual PxU32 createPhase(PxParticleMaterial* material, PxParticlePhaseFlags flags) PX_OVERRIDE;
virtual void release();
virtual void setWind(const PxVec3& wind) { scSetWind(wind); }
virtual PxVec3 getWind() const { return mCore.getWind(); }
virtual void setFluidBoundaryDensityScale(PxReal fluidBoundaryDensityScale) { scSetFluidBoundaryDensityScale(fluidBoundaryDensityScale); }
virtual PxReal getFluidBoundaryDensityScale() const { return mCore.getFluidBoundaryDensityScale(); }
virtual void setFluidRestOffset(PxReal fluidRestOffset) { scSetFluidRestOffset(fluidRestOffset); }
virtual PxReal getFluidRestOffset() const { return mCore.getFluidRestOffset(); }
#if PX_ENABLE_DEBUG_VISUALIZATION
virtual void visualize(PxRenderOutput& out, NpScene& npScene) const;
#else
PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION
#endif
//external API
virtual PxActorType::Enum getType() const { return PxActorType::ePBD_PARTICLESYSTEM; }
virtual PxU32 getParticleMaterials(PxParticleMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const PX_OVERRIDE;
virtual void addParticleBuffer(PxParticleBuffer* particleBuffer);
virtual void removeParticleBuffer(PxParticleBuffer* particleBuffer);
virtual void addRigidAttachment(PxRigidActor* actor);
virtual void removeRigidAttachment(PxRigidActor* actor);
private:
PX_FORCE_INLINE void scSetFluidBoundaryDensityScale(const PxReal v)
{
PX_ASSERT(!NpBase::isAPIWriteForbidden());
mCore.setFluidBoundaryDensityScale(v);
scSetDirtyFlag();
//UPDATE_PVD_PROPERTY
}
};
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
class NpFLIPParticleSystem : public NpParticleSystem<PxFLIPParticleSystem>
{
public:
NpFLIPParticleSystem(PxCudaContextManager& contextManager);
virtual ~NpFLIPParticleSystem() {}
virtual PxU32 createPhase(PxParticleMaterial* material, PxParticlePhaseFlags flags) PX_OVERRIDE;
virtual void release();
virtual void setSparseGridParams(const PxSparseGridParams& params) { scSetSparseGridParams(params); }
virtual PxSparseGridParams getSparseGridParams() const { return mCore.getSparseGridParams(); }
virtual void* getSparseGridDataPointer(PxSparseGridDataFlag::Enum flags);
virtual void getSparseGridCoord(PxI32& x, PxI32& y, PxI32& z, PxU32 id);
virtual void setFLIPParams(const PxFLIPParams& params) { scSetFLIPParams(params); }
virtual PxFLIPParams getFLIPParams() const { return mCore.getFLIPParams(); }
#if PX_ENABLE_DEBUG_VISUALIZATION
virtual void visualize(PxRenderOutput& out, NpScene& npScene) const;
#else
PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION
#endif
virtual PxU32 getParticleMaterials(PxParticleMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const PX_OVERRIDE;
virtual void addParticleBuffer(PxParticleBuffer* particleBuffer);
virtual void removeParticleBuffer(PxParticleBuffer* particleBuffer);
virtual void addRigidAttachment(PxRigidActor* /*actor*/) {}
virtual void removeRigidAttachment(PxRigidActor* /*actor*/) {}
//external API
virtual PxActorType::Enum getType() const { return PxActorType::eFLIP_PARTICLESYSTEM; }
private:
PX_FORCE_INLINE void scSetFLIPParams(const PxFLIPParams& params)
{
PX_CHECK_AND_RETURN(params.blendingFactor >= 0.f && params.blendingFactor <= 1.f, "PxParticleSystem::setFLIPParams: FLIP blending factor must be >= 0 and <= 1!");
PX_ASSERT(!isAPIWriteForbidden());
mCore.setFLIPParams(params);
//UPDATE_PVD_PROPERTY
}
};
class NpMPMParticleSystem :public NpParticleSystem<PxMPMParticleSystem>
{
public:
NpMPMParticleSystem(PxCudaContextManager& contextManager);
virtual ~NpMPMParticleSystem() {}
virtual PxU32 createPhase(PxParticleMaterial* material, PxParticlePhaseFlags flags) PX_OVERRIDE;
virtual void release();
virtual void setSparseGridParams(const PxSparseGridParams& params) { scSetSparseGridParams(params); }
virtual PxSparseGridParams getSparseGridParams() const { return mCore.getSparseGridParams(); }
virtual void* getSparseGridDataPointer(PxSparseGridDataFlag::Enum flags);
virtual void getSparseGridCoord(PxI32& x, PxI32& y, PxI32& z, PxU32 id);
virtual void setMPMParams(const PxMPMParams& params) { scSetMPMParams(params); }
virtual PxMPMParams getMPMParams() const { return mCore.getMPMParams(); }
virtual void* getMPMDataPointer(PxMPMParticleDataFlag::Enum flags);
#if PX_ENABLE_DEBUG_VISUALIZATION
virtual void visualize(PxRenderOutput& out, NpScene& npScene) const;
#else
PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION
#endif
virtual PxU32 getParticleMaterials(PxParticleMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const PX_OVERRIDE;
virtual void addParticleBuffer(PxParticleBuffer* particleBuffer);
virtual void removeParticleBuffer(PxParticleBuffer* particleBuffer);
virtual void addRigidAttachment(PxRigidActor* actor);
virtual void removeRigidAttachment(PxRigidActor* actor);
//external API
virtual PxActorType::Enum getType() const { return PxActorType::eMPM_PARTICLESYSTEM; }
private:
PX_INLINE void scSetMPMParams(const PxMPMParams& params)
{
mCore.setMPMParams(params);
//UPDATE_PVD_PROPERTY
}
};
#endif
}
#endif
| 21,537 | C | 34.19281 | 176 | 0.750569 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/NpShape.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "NpShape.h"
#include "NpCheck.h"
#include "NpRigidStatic.h"
#include "NpRigidDynamic.h"
#include "NpArticulationLink.h"
#include "GuConvexMesh.h"
#include "GuTriangleMesh.h"
#include "GuTetrahedronMesh.h"
#include "GuBounds.h"
#include "NpFEMCloth.h"
#include "NpSoftBody.h"
#include "omnipvd/NpOmniPvdSetData.h"
using namespace physx;
using namespace Sq;
using namespace Cm;
///////////////////////////////////////////////////////////////////////////////
PX_IMPLEMENT_OUTPUT_ERROR
///////////////////////////////////////////////////////////////////////////////
// PT: we're using mFreeSlot as a replacement for previous mExclusiveAndActorCount
static PX_FORCE_INLINE void increaseActorCount(PxU32* count)
{
volatile PxI32* val = reinterpret_cast<volatile PxI32*>(count);
PxAtomicIncrement(val);
}
static PX_FORCE_INLINE void decreaseActorCount(PxU32* count)
{
volatile PxI32* val = reinterpret_cast<volatile PxI32*>(count);
PxAtomicDecrement(val);
}
NpShape::NpShape(const PxGeometry& geometry, PxShapeFlags shapeFlags, const PxU16* materialIndices, PxU16 materialCount, bool isExclusive, PxShapeCoreFlag::Enum flag) :
PxShape (PxConcreteType::eSHAPE, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE),
NpBase (NpType::eSHAPE),
mExclusiveShapeActor (NULL),
mCore (geometry, shapeFlags, materialIndices, materialCount, isExclusive, flag)
{
//actor count
mFreeSlot = 0;
PX_ASSERT(mCore.getPxShape() == static_cast<PxShape*>(this));
PX_ASSERT(!PxShape::userData);
mCore.mName = NULL;
incMeshRefCount();
}
NpShape::~NpShape()
{
decMeshRefCount();
const PxU32 nbMaterials = scGetNbMaterials();
PxShapeCoreFlags flags = mCore.getCore().mShapeCoreFlags;
if (flags & PxShapeCoreFlag::eCLOTH_SHAPE)
{
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION && PX_SUPPORT_GPU_PHYSX
for (PxU32 i = 0; i < nbMaterials; i++)
RefCountable_decRefCount(*scGetMaterial<NpFEMClothMaterial>(i));
#endif
}
else if(flags & PxShapeCoreFlag::eSOFT_BODY_SHAPE)
{
#if PX_SUPPORT_GPU_PHYSX
for (PxU32 i = 0; i < nbMaterials; i++)
RefCountable_decRefCount(*scGetMaterial<NpFEMSoftBodyMaterial>(i));
#endif
}
else
{
for (PxU32 i = 0; i < nbMaterials; i++)
RefCountable_decRefCount(*scGetMaterial<NpMaterial>(i));
}
}
void NpShape::onRefCountZero()
{
NpFactory::getInstance().onShapeRelease(this);
// see NpShape.h for ref counting semantics for shapes
NpDestroyShape(this);
}
// PX_SERIALIZATION
NpShape::NpShape(PxBaseFlags baseFlags) : PxShape(baseFlags), NpBase(PxEmpty), mCore(PxEmpty), mQueryFilterData(PxEmpty)
{
}
void NpShape::preExportDataReset()
{
RefCountable_preExportDataReset(*this);
mExclusiveShapeActor = NULL;
mFreeSlot = 0;
}
void NpShape::exportExtraData(PxSerializationContext& context)
{
mCore.exportExtraData(context);
context.writeName(mCore.mName);
}
void NpShape::importExtraData(PxDeserializationContext& context)
{
mCore.importExtraData(context);
context.readName(mCore.mName);
}
void NpShape::requiresObjects(PxProcessPxBaseCallback& c)
{
//meshes
PxBase* mesh = NULL;
const PxGeometry& geometry = mCore.getGeometry();
switch(PxU32(mCore.getGeometryType()))
{
case PxGeometryType::eCONVEXMESH: mesh = static_cast<const PxConvexMeshGeometry&>(geometry).convexMesh; break;
case PxGeometryType::eHEIGHTFIELD: mesh = static_cast<const PxHeightFieldGeometry&>(geometry).heightField; break;
case PxGeometryType::eTRIANGLEMESH: mesh = static_cast<const PxTriangleMeshGeometry&>(geometry).triangleMesh; break;
case PxGeometryType::eTETRAHEDRONMESH: mesh = static_cast<const PxTetrahedronMeshGeometry&>(geometry).tetrahedronMesh; break;
}
if(mesh)
c.process(*mesh);
//material
const PxU32 nbMaterials = scGetNbMaterials();
for (PxU32 i=0; i < nbMaterials; i++)
{
NpMaterial* mat = scGetMaterial<NpMaterial>(i);
c.process(*mat);
}
}
void NpShape::resolveReferences(PxDeserializationContext& context)
{
// getMaterials() only works after material indices have been patched.
// in order to get to the new material indices, we need access to the new materials.
// this only leaves us with the option of acquiring the material through the context given an old material index (we do have the mapping)
{
PxU32 nbIndices = mCore.getNbMaterialIndices();
const PxU16* indices = mCore.getMaterialIndices();
for (PxU32 i=0; i < nbIndices; i++)
{
PxBase* base = context.resolveReference(PX_SERIAL_REF_KIND_MATERIAL_IDX, size_t(indices[i]));
PX_ASSERT(base && base->is<PxMaterial>());
NpMaterial& material = *static_cast<NpMaterial*>(base);
mCore.resolveMaterialReference(i, material.mMaterial.mMaterialIndex);
}
}
//we don't resolve mExclusiveShapeActor because it's set to NULL on export.
//it's recovered when the actors resolveReferences attaches to the shape
mCore.resolveReferences(context);
incMeshRefCount();
// Increment materials' refcounts in a second pass. Works better in case of failure above.
const PxU32 nbMaterials = scGetNbMaterials();
for (PxU32 i=0; i < nbMaterials; i++)
RefCountable_incRefCount(*scGetMaterial<NpMaterial>(i));
}
NpShape* NpShape::createObject(PxU8*& address, PxDeserializationContext& context)
{
NpShape* obj = PX_PLACEMENT_NEW(address, NpShape(PxBaseFlag::eIS_RELEASABLE));
address += sizeof(NpShape);
obj->importExtraData(context);
obj->resolveReferences(context);
return obj;
}
//~PX_SERIALIZATION
PxU32 NpShape::getReferenceCount() const
{
return RefCountable_getRefCount(*this);
}
void NpShape::acquireReference()
{
RefCountable_incRefCount(*this);
}
void NpShape::release()
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(RefCountable_getRefCount(*this) > 1 || getActorCount() == 0, "PxShape::release: last reference to a shape released while still attached to an actor!");
releaseInternal();
}
void NpShape::releaseInternal()
{
RefCountable_decRefCount(*this);
}
Sc::RigidCore& NpShape::getScRigidObjectExclusive() const
{
const PxType actorType = mExclusiveShapeActor->getConcreteType();
if (actorType == PxConcreteType::eRIGID_DYNAMIC)
return static_cast<NpRigidDynamic&>(*mExclusiveShapeActor).getCore();
else if (actorType == PxConcreteType::eARTICULATION_LINK)
return static_cast<NpArticulationLink&>(*mExclusiveShapeActor).getCore();
else
return static_cast<NpRigidStatic&>(*mExclusiveShapeActor).getCore();
}
void NpShape::updateSQ(const char* errorMessage)
{
PxRigidActor* actor = getActor();
if(actor && (mCore.getFlags() & PxShapeFlag::eSCENE_QUERY_SHAPE))
{
NpScene* scene = NpActor::getNpSceneFromActor(*actor);
NpShapeManager* shapeManager = NpActor::getShapeManager_(*actor);
if(scene)
shapeManager->markShapeForSQUpdate(scene->getSQAPI(), *this, static_cast<const PxRigidActor&>(*actor));
// invalidate the pruning structure if the actor bounds changed
if(shapeManager->getPruningStructure())
{
outputError<PxErrorCode::eINVALID_OPERATION>(__LINE__, errorMessage);
shapeManager->getPruningStructure()->invalidate(mExclusiveShapeActor);
}
}
}
#if PX_CHECKED
bool checkShape(const PxGeometry& g, const char* errorMsg);
#endif
void NpShape::setGeometry(const PxGeometry& g)
{
NpScene* ownerScene = getNpScene();
NP_WRITE_CHECK(ownerScene);
PX_CHECK_AND_RETURN(isWritable(), "PxShape::setGeometry: shared shapes attached to actors are not writable.");
#if PX_CHECKED
if(!checkShape(g, "PxShape::setGeometry(): Invalid geometry!"))
return;
#endif
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(ownerScene, "PxShape::setGeometry() not allowed while simulation is running. Call will be ignored.")
// PT: fixes US2117
if(g.getType() != getGeometryTypeFast())
{
outputError<PxErrorCode::eINVALID_PARAMETER>(__LINE__, "PxShape::setGeometry(): Invalid geometry type. Changing the type of the shape is not supported.");
return;
}
PX_SIMD_GUARD;
//Do not decrement ref count here, but instead cache the refcountable mesh pointer if we had one.
//We instead decrement the ref counter after incrementing the ref counter on the new geometry.
//This resolves a case where the user changed a property of a mesh geometry and set the same mesh geometry. If the user had
//called release() on the mesh, the ref count could hit 0 and be destroyed and then crash when we call incMeshRefCount().
PxRefCounted* mesh = getMeshRefCountable();
{
Sc::RigidCore* rigidCore = getScRigidObjectSLOW();
if(rigidCore)
rigidCore->unregisterShapeFromNphase(mCore);
mCore.setGeometry(g);
if (rigidCore)
{
rigidCore->registerShapeInNphase(mCore);
rigidCore->onShapeChange(mCore, Sc::ShapeChangeNotifyFlag::eGEOMETRY);
}
#if PX_SUPPORT_PVD
NpScene* npScene = getNpScene();
if(npScene)
npScene->getScenePvdClientInternal().releaseAndRecreateGeometry(this);
#endif
}
incMeshRefCount();
if(mesh)
RefCountable_decRefCount(*mesh);
updateSQ("PxShape::setGeometry: Shape is a part of pruning structure, pruning structure is now invalid!");
}
const PxGeometry& NpShape::getGeometry() const
{
NP_READ_CHECK(getNpScene());
return mCore.getGeometry();
}
PxRigidActor* NpShape::getActor() const
{
NP_READ_CHECK(getNpScene());
return mExclusiveShapeActor ? mExclusiveShapeActor->is<PxRigidActor>() : NULL;
}
void NpShape::setLocalPose(const PxTransform& newShape2Actor)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_AND_RETURN(newShape2Actor.isSane(), "PxShape::setLocalPose: pose is not valid.");
PX_CHECK_AND_RETURN(isWritable(), "PxShape::setLocalPose: shared shapes attached to actors are not writable.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxShape::setLocalPose() not allowed while simulation is running. Call will be ignored.");
PxTransform normalizedTransform = newShape2Actor.getNormalized();
mCore.setShape2Actor(normalizedTransform);
notifyActorAndUpdatePVD(Sc::ShapeChangeNotifyFlag::eSHAPE2BODY);
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxShape, translation, static_cast<PxShape &>(*this), normalizedTransform.p)
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxShape, rotation, static_cast<PxShape &>(*this), normalizedTransform.q)
OMNI_PVD_WRITE_SCOPE_END
updateSQ("PxShape::setLocalPose: Shape is a part of pruning structure, pruning structure is now invalid!");
}
PxTransform NpShape::getLocalPose() const
{
NP_READ_CHECK(getNpScene());
return mCore.getShape2Actor();
}
///////////////////////////////////////////////////////////////////////////////
void NpShape::setSimulationFilterData(const PxFilterData& data)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_AND_RETURN(isWritable(), "PxShape::setSimulationFilterData: shared shapes attached to actors are not writable.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxShape::setSimulationFilterData() not allowed while simulation is running. Call will be ignored.")
mCore.setSimulationFilterData(data);
notifyActorAndUpdatePVD(Sc::ShapeChangeNotifyFlag::eFILTERDATA);
OMNI_PVD_SET(OMNI_PVD_CONTEXT_HANDLE, PxShape, simulationFilterData, static_cast<PxShape&>(*this), data);
}
PxFilterData NpShape::getSimulationFilterData() const
{
NP_READ_CHECK(getNpScene());
return mCore.getSimulationFilterData();
}
void NpShape::setQueryFilterData(const PxFilterData& data)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_AND_RETURN(isWritable(), "PxShape::setQueryFilterData: shared shapes attached to actors are not writable.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxShape::setQueryFilterData() not allowed while simulation is running. Call will be ignored.")
OMNI_PVD_SET(OMNI_PVD_CONTEXT_HANDLE, PxShape, queryFilterData, static_cast<PxShape&>(*this), data);
mQueryFilterData = data;
UPDATE_PVD_PROPERTY
}
PxFilterData NpShape::getQueryFilterData() const
{
NP_READ_CHECK(getNpScene());
return getQueryFilterDataFast();
}
///////////////////////////////////////////////////////////////////////////////
template<typename PxMaterialType, typename NpMaterialType>
void NpShape::setMaterialsInternal(PxMaterialType* const * materials, PxU16 materialCount)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_AND_RETURN(isWritable(), "PxShape::setMaterials: shared shapes attached to actors are not writable.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxShape::setMaterials() not allowed while simulation is running. Call will be ignored.")
#if PX_CHECKED
if (!NpShape::checkMaterialSetup(mCore.getGeometry(), "PxShape::setMaterials()", materials, materialCount))
return;
#endif
const PxU32 oldMaterialCount = scGetNbMaterials();
PX_ALLOCA(oldMaterials, PxMaterialType*, oldMaterialCount);
PxU32 tmp = scGetMaterials<PxMaterialType, NpMaterialType>(oldMaterials, oldMaterialCount);
PX_ASSERT(tmp == oldMaterialCount);
PX_UNUSED(tmp);
const bool ret = setMaterialsHelper<PxMaterialType, NpMaterialType>(materials, materialCount);
#if PX_SUPPORT_PVD
if (npScene)
npScene->getScenePvdClientInternal().updateMaterials(this);
#endif
#if PX_SUPPORT_OMNI_PVD
streamShapeMaterials(static_cast<PxShape&>(*this), materials, materialCount);
#endif
if (ret)
{
for (PxU32 i = 0; i < materialCount; i++)
RefCountable_incRefCount(*materials[i]);
for (PxU32 i = 0; i < oldMaterialCount; i++)
RefCountable_decRefCount(*oldMaterials[i]);
}
}
void NpShape::setMaterials(PxMaterial*const* materials, PxU16 materialCount)
{
PX_CHECK_AND_RETURN(!(mCore.getCore().mShapeCoreFlags & PxShapeCoreFlag::eSOFT_BODY_SHAPE), "NpShape::setMaterials: cannot set rigid body materials to a soft body shape!");
PX_CHECK_AND_RETURN(!(mCore.getCore().mShapeCoreFlags & PxShapeCoreFlag::eCLOTH_SHAPE), "NpShape::setMaterials: cannot set rigid body materials to a cloth shape!");
setMaterialsInternal<PxMaterial, NpMaterial>(materials, materialCount);
}
void NpShape::setSoftBodyMaterials(PxFEMSoftBodyMaterial*const* materials, PxU16 materialCount)
{
#if PX_SUPPORT_GPU_PHYSX
PX_CHECK_AND_RETURN((mCore.getCore().mShapeCoreFlags & PxShapeCoreFlag::eSOFT_BODY_SHAPE), "NpShape::setMaterials: can only apply soft body materials to a soft body shape!");
setMaterialsInternal<PxFEMSoftBodyMaterial, NpFEMSoftBodyMaterial>(materials, materialCount);
if (this->mExclusiveShapeActor)
{
static_cast<NpSoftBody*>(mExclusiveShapeActor)->updateMaterials();
}
#else
PX_UNUSED(materials);
PX_UNUSED(materialCount);
#endif
}
void NpShape::setClothMaterials(PxFEMClothMaterial*const* materials, PxU16 materialCount)
{
#if PX_SUPPORT_GPU_PHYSX && PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
PX_CHECK_AND_RETURN((mCore.getCore().mShapeCoreFlags & PxShapeCoreFlag::eCLOTH_SHAPE), "NpShape::setMaterials: can only apply cloth materials to a cloth shape!");
setMaterialsInternal<PxFEMClothMaterial, NpFEMClothMaterial>(materials, materialCount);
#else
PX_UNUSED(materials);
PX_UNUSED(materialCount);
#endif
}
PxU16 NpShape::getNbMaterials() const
{
NP_READ_CHECK(getNpScene());
return scGetNbMaterials();
}
PxU32 NpShape::getMaterials(PxMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const
{
NP_READ_CHECK(getNpScene());
return scGetMaterials<PxMaterial, NpMaterial>(userBuffer, bufferSize, startIndex);
}
#if PX_SUPPORT_GPU_PHYSX
PxU32 NpShape::getSoftBodyMaterials(PxFEMSoftBodyMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const
{
NP_READ_CHECK(getNpScene());
return scGetMaterials<PxFEMSoftBodyMaterial, NpFEMSoftBodyMaterial>(userBuffer, bufferSize, startIndex);
}
#else
PxU32 NpShape::getSoftBodyMaterials(PxFEMSoftBodyMaterial**, PxU32, PxU32) const
{
return 0;
}
#endif
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION && PX_SUPPORT_GPU_PHYSX
PxU32 NpShape::getClothMaterials(PxFEMClothMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const
{
NP_READ_CHECK(getNpScene());
return scGetMaterials<PxFEMClothMaterial, NpFEMClothMaterial>(userBuffer, bufferSize, startIndex);
}
#else
PxU32 NpShape::getClothMaterials(PxFEMClothMaterial**, PxU32, PxU32) const
{
return 0;
}
#endif
PxBaseMaterial* NpShape::getMaterialFromInternalFaceIndex(PxU32 faceIndex) const
{
NP_READ_CHECK(getNpScene());
const PxGeometry& geom = mCore.getGeometry();
const PxGeometryType::Enum geomType = geom.getType();
bool isHf = (geomType == PxGeometryType::eHEIGHTFIELD);
bool isMesh = (geomType == PxGeometryType::eTRIANGLEMESH);
// if SDF tri-mesh, where no multi-material setup is allowed, return zero-index material
if (isMesh)
{
const PxTriangleMeshGeometry& triGeo = static_cast<const PxTriangleMeshGeometry&>(geom);
if (triGeo.triangleMesh->getSDF())
{
return getMaterial<PxMaterial, NpMaterial>(0);
}
}
if( faceIndex == 0xFFFFffff && (isHf || isMesh) )
{
outputError<PxErrorCode::eDEBUG_WARNING>(__LINE__, "PxShape::getMaterialFromInternalFaceIndex received 0xFFFFffff as input - returning NULL.");
return NULL;
}
PxMaterialTableIndex hitMatTableId = 0;
if(isHf)
{
const PxHeightFieldGeometry& hfGeom = static_cast<const PxHeightFieldGeometry&>(geom);
hitMatTableId = hfGeom.heightField->getTriangleMaterialIndex(faceIndex);
}
else if(isMesh)
{
const PxTriangleMeshGeometry& triGeo = static_cast<const PxTriangleMeshGeometry&>(geom);
Gu::TriangleMesh* tm = static_cast<Gu::TriangleMesh*>(triGeo.triangleMesh);
if(tm->hasPerTriangleMaterials())
hitMatTableId = triGeo.triangleMesh->getTriangleMaterialIndex(faceIndex);
}
// PT: TODO: what's going on here?
return getMaterial<PxMaterial, NpMaterial>(hitMatTableId);
}
void NpShape::setContactOffset(PxReal contactOffset)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_AND_RETURN(PxIsFinite(contactOffset), "PxShape::setContactOffset: invalid float");
PX_CHECK_AND_RETURN((contactOffset >= 0.0f && contactOffset > mCore.getRestOffset()), "PxShape::setContactOffset: contactOffset should be positive, and greater than restOffset!");
PX_CHECK_AND_RETURN(isWritable(), "PxShape::setContactOffset: shared shapes attached to actors are not writable.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxShape::setContactOffset() not allowed while simulation is running. Call will be ignored.")
mCore.setContactOffset(contactOffset);
notifyActorAndUpdatePVD(Sc::ShapeChangeNotifyFlag::eCONTACTOFFSET);
OMNI_PVD_SET(OMNI_PVD_CONTEXT_HANDLE, PxShape, contactOffset, static_cast<PxShape&>(*this), contactOffset)
}
PxReal NpShape::getContactOffset() const
{
NP_READ_CHECK(getNpScene());
return mCore.getContactOffset();
}
void NpShape::setRestOffset(PxReal restOffset)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_AND_RETURN(PxIsFinite(restOffset), "PxShape::setRestOffset: invalid float");
PX_CHECK_AND_RETURN((restOffset < mCore.getContactOffset()), "PxShape::setRestOffset: restOffset should be less than contactOffset!");
PX_CHECK_AND_RETURN(isWritable(), "PxShape::setRestOffset: shared shapes attached to actors are not writable.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxShape::setRestOffset() not allowed while simulation is running. Call will be ignored.")
mCore.setRestOffset(restOffset);
notifyActorAndUpdatePVD(Sc::ShapeChangeNotifyFlag::eRESTOFFSET);
OMNI_PVD_SET(OMNI_PVD_CONTEXT_HANDLE, PxShape, restOffset, static_cast<PxShape&>(*this), restOffset)
}
PxReal NpShape::getRestOffset() const
{
NP_READ_CHECK(getNpScene());
return mCore.getRestOffset();
}
void NpShape::setDensityForFluid(PxReal densityForFluid)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_AND_RETURN(PxIsFinite(densityForFluid), "PxShape::setDensityForFluid: invalid float");
PX_CHECK_AND_RETURN(isWritable(), "PxShape::setDensityForFluid: shared shapes attached to actors are not writable.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxShape::setDensityForFluid() not allowed while simulation is running. Call will be ignored.")
mCore.setDensityForFluid(densityForFluid);
///notifyActorAndUpdatePVD(Sc::ShapeChangeNotifyFlag::eRESTOFFSET);
OMNI_PVD_SET(OMNI_PVD_CONTEXT_HANDLE, PxShape, densityForFluid, static_cast<PxShape &>(*this), densityForFluid);
}
PxReal NpShape::getDensityForFluid() const
{
NP_READ_CHECK(getNpScene());
return mCore.getDensityForFluid();
}
void NpShape::setTorsionalPatchRadius(PxReal radius)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_AND_RETURN(PxIsFinite(radius), "PxShape::setTorsionalPatchRadius: invalid float");
PX_CHECK_AND_RETURN((radius >= 0.f), "PxShape::setTorsionalPatchRadius: must be >= 0.f");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxShape::setTorsionalPatchRadius() not allowed while simulation is running. Call will be ignored.")
// const PxShapeFlags oldShapeFlags = mShape.getFlags();
mCore.setTorsionalPatchRadius(radius);
OMNI_PVD_SET(OMNI_PVD_CONTEXT_HANDLE, PxShape, torsionalPatchRadius, static_cast<PxShape &>(*this), radius);
// shared shapes return NULL. But shared shapes aren't mutable when attached to an actor, so no notification needed.
// Sc::RigidCore* rigidCore = NpShapeGetScRigidObjectFromScSLOW();
// if(rigidCore)
// rigidCore->onShapeChange(mShape, Sc::ShapeChangeNotifyFlag::eFLAGS, oldShapeFlags);
UPDATE_PVD_PROPERTY
}
PxReal NpShape::getTorsionalPatchRadius() const
{
NP_READ_CHECK(getNpScene());
return mCore.getTorsionalPatchRadius();
}
void NpShape::setMinTorsionalPatchRadius(PxReal radius)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_AND_RETURN(PxIsFinite(radius), "PxShape::setMinTorsionalPatchRadius: invalid float");
PX_CHECK_AND_RETURN((radius >= 0.f), "PxShape::setMinTorsionalPatchRadius: must be >= 0.f");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxShape::setMinTorsionalPatchRadius() not allowed while simulation is running. Call will be ignored.")
// const PxShapeFlags oldShapeFlags = mShape.getFlags();
mCore.setMinTorsionalPatchRadius(radius);
OMNI_PVD_SET(OMNI_PVD_CONTEXT_HANDLE, PxShape, minTorsionalPatchRadius, static_cast<PxShape &>(*this), radius);
// Sc::RigidCore* rigidCore = NpShapeGetScRigidObjectFromSbSLOW();
// if(rigidCore)
// rigidCore->onShapeChange(mShape, Sc::ShapeChangeNotifyFlag::eFLAGS, oldShapeFlags);
UPDATE_PVD_PROPERTY
}
PxReal NpShape::getMinTorsionalPatchRadius() const
{
NP_READ_CHECK(getNpScene());
return mCore.getMinTorsionalPatchRadius();
}
PxU32 NpShape::getInternalShapeIndex() const
{
NP_READ_CHECK(getNpScene());
if (getNpScene())
{
PxsSimulationController* simulationController = getNpScene()->getSimulationController();
if (simulationController)
return mCore.getInternalShapeIndex(*simulationController);
}
return PX_INVALID_NODE;
}
void NpShape::setFlagsInternal(PxShapeFlags inFlags)
{
const bool hasMeshTypeGeom = mCore.getGeometryType() == PxGeometryType::eTRIANGLEMESH || mCore.getGeometryType() == PxGeometryType::eHEIGHTFIELD;
if(hasMeshTypeGeom && (inFlags & PxShapeFlag::eTRIGGER_SHAPE))
{
outputError<PxErrorCode::eINVALID_PARAMETER>(__LINE__, "PxShape::setFlag(s): triangle mesh and heightfield triggers are not supported!");
return;
}
if((inFlags & PxShapeFlag::eSIMULATION_SHAPE) && (inFlags & PxShapeFlag::eTRIGGER_SHAPE))
{
outputError<PxErrorCode::eINVALID_PARAMETER>(__LINE__, "PxShape::setFlag(s): shapes cannot simultaneously be trigger shapes and simulation shapes.");
return;
}
const PxShapeFlags oldFlags = mCore.getFlags();
const bool oldIsSimShape = oldFlags & PxShapeFlag::eSIMULATION_SHAPE;
const bool isSimShape = inFlags & PxShapeFlag::eSIMULATION_SHAPE;
if(mExclusiveShapeActor)
{
const PxType type = mExclusiveShapeActor->getConcreteType();
// PT: US5732 - support kinematic meshes
bool isKinematic = false;
if(type==PxConcreteType::eRIGID_DYNAMIC)
{
PxRigidDynamic* rigidDynamic = static_cast<PxRigidDynamic*>(mExclusiveShapeActor);
isKinematic = rigidDynamic->getRigidBodyFlags() & PxRigidBodyFlag::eKINEMATIC;
}
if((type != PxConcreteType::eRIGID_STATIC) && !isKinematic && isSimShape && !oldIsSimShape && (hasMeshTypeGeom || mCore.getGeometryType() == PxGeometryType::ePLANE))
{
outputError<PxErrorCode::eINVALID_PARAMETER>(__LINE__, "PxShape::setFlag(s): triangle mesh, heightfield and plane shapes can only be simulation shapes if part of a PxRigidStatic!");
return;
}
}
const bool oldHasSceneQuery = oldFlags & PxShapeFlag::eSCENE_QUERY_SHAPE;
const bool hasSceneQuery = inFlags & PxShapeFlag::eSCENE_QUERY_SHAPE;
{
PX_ASSERT(!isAPIWriteForbidden());
const PxShapeFlags oldShapeFlags = mCore.getFlags();
mCore.setFlags(inFlags);
notifyActorAndUpdatePVD(oldShapeFlags);
}
PxRigidActor* actor = getActor();
if(oldHasSceneQuery != hasSceneQuery && actor)
{
NpScene* npScene = getNpScene();
NpShapeManager* shapeManager = NpActor::getShapeManager_(*actor);
if(npScene)
{
if(hasSceneQuery)
{
// PT: SQ_CODEPATH3
shapeManager->setupSceneQuery(npScene->getSQAPI(), NpActor::getFromPxActor(*actor), *actor, *this);
}
else
{
shapeManager->teardownSceneQuery(npScene->getSQAPI(), *actor, *this);
}
}
// invalidate the pruning structure if the actor bounds changed
if(shapeManager->getPruningStructure())
{
outputError<PxErrorCode::eINVALID_OPERATION>(__LINE__, "PxShape::setFlag: Shape is a part of pruning structure, pruning structure is now invalid!");
shapeManager->getPruningStructure()->invalidate(mExclusiveShapeActor);
}
}
}
void NpShape::setFlag(PxShapeFlag::Enum flag, bool value)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_AND_RETURN(isWritable(), "PxShape::setFlag: shared shapes attached to actors are not writable.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxShape::setFlag() not allowed while simulation is running. Call will be ignored.")
PX_SIMD_GUARD;
PxShapeFlags shapeFlags = mCore.getFlags();
shapeFlags = value ? shapeFlags | flag : shapeFlags & ~flag;
setFlagsInternal(shapeFlags);
OMNI_PVD_SET(OMNI_PVD_CONTEXT_HANDLE, PxShape, shapeFlags, static_cast<PxShape&>(*this), shapeFlags);
}
void NpShape::setFlags(PxShapeFlags inFlags)
{
NpScene* npScene = getNpScene();
NP_WRITE_CHECK(npScene);
PX_CHECK_AND_RETURN(isWritable(), "PxShape::setFlags: shared shapes attached to actors are not writable.");
PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxShape::setFlags() not allowed while simulation is running. Call will be ignored.")
PX_SIMD_GUARD;
setFlagsInternal(inFlags);
OMNI_PVD_SET(OMNI_PVD_CONTEXT_HANDLE, PxShape, shapeFlags, static_cast<PxShape&>(*this), inFlags);
}
PxShapeFlags NpShape::getFlags() const
{
NP_READ_CHECK(getNpScene());
return mCore.getFlags();
}
bool NpShape::isExclusive() const
{
NP_READ_CHECK(getNpScene());
return isExclusiveFast();
}
void NpShape::onActorAttach(PxActor& actor)
{
RefCountable_incRefCount(*this);
if(isExclusiveFast())
mExclusiveShapeActor = &actor;
increaseActorCount(&mFreeSlot);
}
void NpShape::onActorDetach()
{
PX_ASSERT(getActorCount() > 0);
decreaseActorCount(&mFreeSlot);
if(isExclusiveFast())
mExclusiveShapeActor = NULL;
RefCountable_decRefCount(*this);
}
void NpShape::incActorCount()
{
RefCountable_incRefCount(*this);
increaseActorCount(&mFreeSlot);
}
void NpShape::decActorCount()
{
PX_ASSERT(getActorCount() > 0);
decreaseActorCount(&mFreeSlot);
RefCountable_decRefCount(*this);
}
void NpShape::setName(const char* debugName)
{
NP_WRITE_CHECK(getNpScene());
PX_CHECK_AND_RETURN(isWritable(), "PxShape::setName: shared shapes attached to actors are not writable.");
mCore.mName = debugName;
UPDATE_PVD_PROPERTY
}
const char* NpShape::getName() const
{
NP_READ_CHECK(getNpScene());
return mCore.mName;
}
///////////////////////////////////////////////////////////////////////////////
// see NpConvexMesh.h, NpHeightField.h, NpTriangleMesh.h for details on how ref counting works for meshes
PxRefCounted* NpShape::getMeshRefCountable()
{
const PxGeometry& geometry = mCore.getGeometry();
switch(PxU32(mCore.getGeometryType()))
{
case PxGeometryType::eCONVEXMESH: return static_cast<const PxConvexMeshGeometry&>(geometry).convexMesh;
case PxGeometryType::eHEIGHTFIELD: return static_cast<const PxHeightFieldGeometry&>(geometry).heightField;
case PxGeometryType::eTRIANGLEMESH: return static_cast<const PxTriangleMeshGeometry&>(geometry).triangleMesh;
case PxGeometryType::eTETRAHEDRONMESH: return static_cast<const PxTetrahedronMeshGeometry&>(geometry).tetrahedronMesh;
default:
break;
}
return NULL;
}
bool NpShape::isWritable()
{
// a shape is writable if it's exclusive, or it's not connected to any actors (which is true if the ref count is 1 and the user ref is not released.)
return isExclusiveFast() || (RefCountable_getRefCount(*this)==1 && (mBaseFlags & PxBaseFlag::eIS_RELEASABLE));
}
void NpShape::incMeshRefCount()
{
PxRefCounted* mesh = getMeshRefCountable();
if(mesh)
RefCountable_incRefCount(*mesh);
}
void NpShape::decMeshRefCount()
{
PxRefCounted* mesh = getMeshRefCountable();
if(mesh)
RefCountable_decRefCount(*mesh);
}
///////////////////////////////////////////////////////////////////////////////
template <typename PxMaterialType, typename NpMaterialType>
bool NpShape::setMaterialsHelper(PxMaterialType* const* materials, PxU16 materialCount)
{
PX_ASSERT(!isAPIWriteForbidden());
if(materialCount == 1)
{
const PxU16 materialIndex = static_cast<NpMaterialType*>(materials[0])->mMaterial.mMaterialIndex;
mCore.setMaterialIndices(&materialIndex, 1);
}
else
{
PX_ASSERT(materialCount > 1);
PX_ALLOCA(materialIndices, PxU16, materialCount);
if(materialIndices)
{
NpMaterialType::getMaterialIndices(materials, materialIndices, materialCount);
mCore.setMaterialIndices(materialIndices, materialCount);
}
else
return outputError<PxErrorCode::eOUT_OF_MEMORY>(__LINE__, "PxShape::setMaterials() failed. Out of memory. Call will be ignored.");
}
NpScene* npScene = getNpScene();
if(npScene)
npScene->getScScene().notifyNphaseOnUpdateShapeMaterial(mCore);
return true;
}
void NpShape::notifyActorAndUpdatePVD(Sc::ShapeChangeNotifyFlags notifyFlags)
{
// shared shapes return NULL. But shared shapes aren't mutable when attached to an actor, so no notification needed.
if(mExclusiveShapeActor)
{
Sc::RigidCore* rigidCore = getScRigidObjectSLOW();
if(rigidCore)
rigidCore->onShapeChange(mCore, notifyFlags);
#if PX_SUPPORT_GPU_PHYSX
const PxType type = mExclusiveShapeActor->getConcreteType();
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
if(type==PxConcreteType::eFEM_CLOTH)
static_cast<NpFEMCloth*>(mExclusiveShapeActor)->getCore().onShapeChange(mCore, notifyFlags);
#endif
if(type==PxConcreteType::eSOFT_BODY)
static_cast<NpSoftBody*>(mExclusiveShapeActor)->getCore().onShapeChange(mCore, notifyFlags);
#endif
}
UPDATE_PVD_PROPERTY
}
void NpShape::notifyActorAndUpdatePVD(const PxShapeFlags oldShapeFlags)
{
// shared shapes return NULL. But shared shapes aren't mutable when attached to an actor, so no notification needed.
Sc::RigidCore* rigidCore = getScRigidObjectSLOW();
if(rigidCore)
rigidCore->onShapeFlagsChange(mCore, oldShapeFlags);
UPDATE_PVD_PROPERTY
}
| 32,794 | C++ | 32.567042 | 184 | 0.751296 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/NpSceneQueries.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef NP_SCENE_QUERIES_H
#define NP_SCENE_QUERIES_H
#include "PxSceneQueryDesc.h"
#include "SqQuery.h"
#include "ScSqBoundsSync.h"
#if PX_SUPPORT_PVD
#include "NpPvdSceneQueryCollector.h"
#include "NpPvdSceneClient.h"
#endif
#include "PxSceneQuerySystem.h"
#include "NpBounds.h" // PT: for SQ_PRUNER_EPSILON
namespace physx
{
class PxScene;
class PxSceneDesc;
namespace Vd
{
class PvdSceneClient;
}
class NpSceneQueries : public Sc::SqBoundsSync
#if PX_SUPPORT_PVD
, public Sq::PVDCapture
#endif
{
PX_NOCOPY(NpSceneQueries)
public:
// PT: TODO: use PxSceneQueryDesc here, but we need some SQ-specific "scene limits"
NpSceneQueries(const PxSceneDesc& desc, Vd::PvdSceneClient* pvd, PxU64 contextID);
~NpSceneQueries();
PX_FORCE_INLINE PxSceneQuerySystem& getSQAPI() { PX_ASSERT(mSQ); return *mSQ; }
PX_FORCE_INLINE const PxSceneQuerySystem& getSQAPI() const { PX_ASSERT(mSQ); return *mSQ; }
protected:
// SqBoundsSync
virtual void sync(PxU32 prunerIndex, const ScPrunerHandle* handles, const PxU32* boundsIndices, const PxBounds3* bounds,
const PxTransform32* transforms, PxU32 count, const PxBitMap& ignoredIndices) PX_OVERRIDE;
//~SqBoundsSync
public:
PxSceneQuerySystem* mSQ;
#if PX_SUPPORT_PVD
Vd::PvdSceneClient* mPVDClient;
//Scene query and hits for pvd, collected in current frame
mutable Vd::PvdSceneQueryCollector mSingleSqCollector;
PX_FORCE_INLINE Vd::PvdSceneQueryCollector& getSingleSqCollector() const { return mSingleSqCollector; }
// PVDCapture
virtual bool transmitSceneQueries();
virtual void raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal distance, const PxRaycastHit* hit, PxU32 hitsNum, const PxQueryFilterData& filterData, bool multipleHits);
virtual void sweep(const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, PxReal distance, const PxSweepHit* hit, PxU32 hitsNum, const PxQueryFilterData& filterData, bool multipleHits);
virtual void overlap(const PxGeometry& geometry, const PxTransform& pose, const PxOverlapHit* hit, PxU32 hitsNum, const PxQueryFilterData& filterData);
//~PVDCapture
#endif // PX_SUPPORT_PVD
};
} // namespace physx, sq
#endif
| 3,958 | C | 39.814433 | 214 | 0.751642 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/NpConnector.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef NP_CONNECTOR_H
#define NP_CONNECTOR_H
#include "common/PxSerialFramework.h"
#include "foundation/PxInlineArray.h"
#include "foundation/PxUtilities.h"
#include "CmUtils.h"
namespace physx
{
struct NpConnectorType
{
enum Enum
{
eConstraint,
eAggregate,
eObserver,
eBvh,
eInvalid
};
};
class NpConnector
{
public:
NpConnector() : mType(NpConnectorType::eInvalid), mObject(NULL) {}
NpConnector(NpConnectorType::Enum type, PxBase* object) : mType(PxTo8(type)), mObject(object) {}
// PX_SERIALIZATION
NpConnector(const NpConnector& c)
{
//special copy constructor that initializes padding bytes for meta data verification (PX_CHECKED only)
PxMarkSerializedMemory(this, sizeof(NpConnector));
mType = c.mType;
mObject = c.mObject;
}
static void getBinaryMetaData(PxOutputStream& stream);
//~PX_SERIALIZATION
PxU8 mType; // Revisit whether the type is really necessary or whether the serializable type is enough.
// Since joints might gonna inherit from observers to register for constraint release events, the type
// is necessary because a joint has its own serializable type and could not be detected as observer anymore.
PxU8 mPadding[3]; // PT: padding from prev byte
PxBase* mObject; // So far the serialization framework only supports ptr resolve for PxBase objects.
// However, so far the observers all are PxBase, hence this choice of type.
};
class NpConnectorIterator
{
public:
PX_FORCE_INLINE NpConnectorIterator(NpConnector* c, PxU32 size, NpConnectorType::Enum type) : mConnectors(c), mSize(size), mIndex(0), mType(type) {}
PX_FORCE_INLINE PxBase* getNext()
{
PxBase* s = NULL;
while(mIndex < mSize)
{
NpConnector& c = mConnectors[mIndex];
mIndex++;
if (c.mType == mType)
return c.mObject;
}
return s;
}
private:
NpConnector* mConnectors;
PxU32 mSize;
PxU32 mIndex;
NpConnectorType::Enum mType;
};
class NpConnectorArray: public PxInlineArray<NpConnector, 4>
{
public:
// PX_SERIALIZATION
NpConnectorArray(const PxEMPTY) : PxInlineArray<NpConnector, 4> (PxEmpty) {}
static void getBinaryMetaData(PxOutputStream& stream);
//~PX_SERIALIZATION
NpConnectorArray() : PxInlineArray<NpConnector, 4>("connectorArray")
{
//special default constructor that initializes padding bytes for meta data verification (PX_CHECKED only)
PxMarkSerializedMemory(this->mData, 4*sizeof(NpConnector));
}
};
}
#endif
| 4,136 | C | 33.475 | 149 | 0.746857 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/NpBounds.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "foundation/PxTransform.h"
#include "NpBounds.h"
#include "CmTransformUtils.h"
#include "NpRigidStatic.h"
#include "NpRigidDynamic.h"
#include "NpArticulationLink.h"
#include "GuBounds.h"
using namespace physx;
using namespace Sq;
static void computeStaticWorldAABB(PxBounds3& bounds, const NpShape& npShape, const NpActor& npActor)
{
const PxTransform& shape2Actor = npShape.getCore().getShape2Actor();
PX_ALIGN(16, PxTransform) globalPose;
Cm::getStaticGlobalPoseAligned(static_cast<const NpRigidStatic&>(npActor).getCore().getActor2World(), shape2Actor, globalPose);
Gu::computeBounds(bounds, npShape.getCore().getGeometry(), globalPose, 0.0f, SQ_PRUNER_INFLATION);
}
static void computeDynamicWorldAABB(PxBounds3& bounds, const NpShape& npShape, const NpActor& npActor)
{
const PxTransform& shape2Actor = npShape.getCore().getShape2Actor();
PX_ALIGN(16, PxTransform) globalPose;
{
PX_ALIGN(16, PxTransform) kinematicTarget;
const PxU16 sqktFlags = PxRigidBodyFlag::eKINEMATIC | PxRigidBodyFlag::eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES;
// PT: TODO: revisit this once the dust has settled
PX_ASSERT(npActor.getNpType()==NpType::eBODY_FROM_ARTICULATION_LINK || npActor.getNpType()==NpType::eBODY);
const Sc::BodyCore& core = npActor.getNpType()==NpType::eBODY_FROM_ARTICULATION_LINK ? static_cast<const NpArticulationLink&>(npActor).getCore() : static_cast<const NpRigidDynamic&>(npActor).getCore();
const bool useTarget = (PxU16(core.getFlags()) & sqktFlags) == sqktFlags;
const PxTransform& body2World = (useTarget && core.getKinematicTarget(kinematicTarget)) ? kinematicTarget : core.getBody2World();
Cm::getDynamicGlobalPoseAligned(body2World, shape2Actor, core.getBody2Actor(), globalPose);
}
Gu::computeBounds(bounds, npShape.getCore().getGeometry(), globalPose, 0.0f, SQ_PRUNER_INFLATION);
}
const ComputeBoundsFunc Sq::gComputeBoundsTable[2] =
{
computeStaticWorldAABB,
computeDynamicWorldAABB
};
| 3,653 | C++ | 47.719999 | 203 | 0.7706 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/NpPhysics.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "NpPhysics.h"
// PX_SERIALIZATION
#include "foundation/PxProfiler.h"
#include "foundation/PxIO.h"
#include "foundation/PxErrorCallback.h"
#include "foundation/PxString.h"
#include "foundation/PxPhysicsVersion.h"
#include "common/PxTolerancesScale.h"
#include "CmCollection.h"
#include "CmUtils.h"
#include "NpRigidStatic.h"
#include "NpRigidDynamic.h"
#if PX_SUPPORT_GPU_PHYSX
#include "NpSoftBody.h"
#include "NpParticleSystem.h"
#include "NpHairSystem.h"
#endif
#include "NpArticulationReducedCoordinate.h"
#include "NpArticulationLink.h"
#include "NpMaterial.h"
#include "GuHeightFieldData.h"
#include "GuHeightField.h"
#include "GuConvexMesh.h"
#include "GuTriangleMesh.h"
#include "foundation/PxIntrinsics.h"
#include "PxvGlobals.h" // dynamic registration of HFs & articulations in LL
#include "GuOverlapTests.h" // dynamic registration of HFs in Gu
#include "PxDeletionListener.h"
#include "PxPhysicsSerialization.h"
#include "PvdPhysicsClient.h"
#include "omnipvd/NpOmniPvdSetData.h"
#if PX_SUPPORT_OMNI_PVD
#include "omnipvd/NpOmniPvd.h"
#include "OmniPvdWriter.h"
#endif
#if PX_SUPPORT_GPU_PHYSX
#include "PxPhysXGpu.h"
#endif
//~PX_SERIALIZATION
#include "NpFactory.h"
#if PX_SWITCH
#include "switch/NpMiddlewareInfo.h"
#endif
#if PX_SUPPORT_OMNI_PVD
# define OMNI_PVD_NOTIFY_ADD(OBJECT) mOmniPvdListener.onObjectAdd(OBJECT)
# define OMNI_PVD_NOTIFY_REMOVE(OBJECT) mOmniPvdListener.onObjectRemove(OBJECT)
#else
# define OMNI_PVD_NOTIFY_ADD(OBJECT)
# define OMNI_PVD_NOTIFY_REMOVE(OBJECT)
#endif
using namespace physx;
using namespace Cm;
bool NpPhysics::apiReentryLock = false;
NpPhysics* NpPhysics::mInstance = NULL;
PxU32 NpPhysics::mRefCount = 0;
NpPhysics::NpPhysics(const PxTolerancesScale& scale, const PxvOffsetTable& pxvOffsetTable, bool trackOutstandingAllocations, pvdsdk::PsPvd* pvd, PxFoundation& foundation, PxOmniPvd* omniPvd) :
mSceneArray ("physicsSceneArray"),
mPhysics (scale, pxvOffsetTable),
mDeletionListenersExist (false),
mFoundation (foundation)
#if PX_SUPPORT_GPU_PHYSX
, mNbRegisteredGpuClients (0)
#endif
{
PX_UNUSED(trackOutstandingAllocations);
//mMasterMaterialTable.reserve(10);
#if PX_SUPPORT_PVD
mPvd = pvd;
if(pvd)
{
mPvdPhysicsClient = PX_NEW(Vd::PvdPhysicsClient)(mPvd);
foundation.registerErrorCallback(*mPvdPhysicsClient);
foundation.registerAllocationListener(*mPvd);
}
else
{
mPvdPhysicsClient = NULL;
}
#else
PX_UNUSED(pvd);
#endif
// PT: please leave this commented-out block here.
/*
printf("sizeof(NpScene) = %d\n", sizeof(NpScene));
printf("sizeof(NpShape) = %d\n", sizeof(NpShape));
printf("sizeof(NpActor) = %d\n", sizeof(NpActor));
printf("sizeof(NpRigidStatic) = %d\n", sizeof(NpRigidStatic));
printf("sizeof(NpRigidDynamic) = %d\n", sizeof(NpRigidDynamic));
printf("sizeof(NpMaterial) = %d\n", sizeof(NpMaterial));
printf("sizeof(NpConstraint) = %d\n", sizeof(NpConstraint));
printf("sizeof(NpAggregate) = %d\n", sizeof(NpAggregate));
printf("sizeof(NpArticulationRC) = %d\n", sizeof(NpArticulationReducedCoordinate));
printf("sizeof(GeometryUnion) = %d\n", sizeof(GeometryUnion));
printf("sizeof(PxGeometry) = %d\n", sizeof(PxGeometry));
printf("sizeof(PxPlaneGeometry) = %d\n", sizeof(PxPlaneGeometry));
printf("sizeof(PxSphereGeometry) = %d\n", sizeof(PxSphereGeometry));
printf("sizeof(PxCapsuleGeometry) = %d\n", sizeof(PxCapsuleGeometry));
printf("sizeof(PxBoxGeometry) = %d\n", sizeof(PxBoxGeometry));
printf("sizeof(PxConvexMeshGeometry) = %d\n", sizeof(PxConvexMeshGeometry));
printf("sizeof(PxConvexMeshGeometryLL) = %d\n", sizeof(PxConvexMeshGeometryLL));
printf("sizeof(PxTriangleMeshGeometry) = %d\n", sizeof(PxTriangleMeshGeometry));
printf("sizeof(PxTriangleMeshGeometryLL) = %d\n", sizeof(PxTriangleMeshGeometryLL));
printf("sizeof(PxsShapeCore) = %d\n", sizeof(PxsShapeCore));
*/
#if PX_SUPPORT_OMNI_PVD
mOmniPvdSampler = NULL;
mOmniPvd = NULL;
if (omniPvd)
{
OmniPvdWriter* omniWriter = omniPvd->getWriter();
if (omniWriter && omniWriter->getWriteStream())
{
mOmniPvdSampler = PX_NEW(::OmniPvdPxSampler)();
mOmniPvd = omniPvd;
NpOmniPvd* npOmniPvd = static_cast<NpOmniPvd*>(mOmniPvd);
NpOmniPvd::incRefCount();
npOmniPvd->mPhysXSampler = mOmniPvdSampler; // Dirty hack to do startSampling from PxOmniPvd
mOmniPvdSampler->setOmniPvdInstance(npOmniPvd);
}
}
#else
PX_UNUSED(omniPvd);
#endif
}
NpPhysics::~NpPhysics()
{
// Release all scenes in case the user didn't do it
PxU32 nbScenes = mSceneArray.size();
NpScene** scenes = mSceneArray.begin();
for(PxU32 i=0;i<nbScenes;i++)
PX_DELETE(scenes[i]);
mSceneArray.clear();
//PxU32 matCount = mMasterMaterialTable.size();
//while (mMasterMaterialTable.size() > 0)
//{
// // It's done this way since the material destructor removes the material from the table and adjusts indices
// PX_ASSERT(mMasterMaterialTable[0]->getRefCount() == 1);
// mMasterMaterialTable[0]->decRefCount();
//}
//mMasterMaterialTable.clear();
mMasterMaterialManager.releaseMaterials();
#if PX_SUPPORT_GPU_PHYSX
mMasterFEMSoftBodyMaterialManager.releaseMaterials();
mMasterPBDMaterialManager.releaseMaterials();
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
mMasterFEMClothMaterialManager.releaseMaterials();
mMasterFLIPMaterialManager.releaseMaterials();
mMasterMPMMaterialManager.releaseMaterials();
#endif
#endif
#if PX_SUPPORT_PVD
if(mPvd)
{
mPvdPhysicsClient->destroyPvdInstance(this);
mPvd->removeClient(mPvdPhysicsClient);
mFoundation.deregisterErrorCallback(*mPvdPhysicsClient);
PX_DELETE(mPvdPhysicsClient);
mFoundation.deregisterAllocationListener(*mPvd);
}
#endif
const DeletionListenerMap::Entry* delListenerEntries = mDeletionListenerMap.getEntries();
const PxU32 delListenerEntryCount = mDeletionListenerMap.size();
for(PxU32 i=0; i < delListenerEntryCount; i++)
{
NpDelListenerEntry* listener = delListenerEntries[i].second;
PX_DELETE(listener);
}
mDeletionListenerMap.clear();
#if PX_SUPPORT_OMNI_PVD
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, static_cast<PxPhysics&>(*this))
PX_DELETE(mOmniPvdSampler);
if (mOmniPvd)
{
NpOmniPvd::decRefCount();
}
#endif
#if PX_SUPPORT_GPU_PHYSX
PxPhysXGpu* gpu = PxvGetPhysXGpu(false);
if (gpu)
PxvReleasePhysXGpu(gpu);
#endif
}
PxOmniPvd* NpPhysics::getOmniPvd()
{
#if PX_SUPPORT_OMNI_PVD
return mOmniPvd;
#else
return NULL;
#endif
}
void NpPhysics::initOffsetTables(PxvOffsetTable& pxvOffsetTable)
{
// init offset tables for Pxs/Sc/Px conversions
{
Sc::OffsetTable& offsetTable = Sc::gOffsetTable;
offsetTable.scRigidStatic2PxActor = -ptrdiff_t(NpRigidStatic::getCoreOffset());
offsetTable.scRigidDynamic2PxActor = -ptrdiff_t(NpRigidDynamic::getCoreOffset());
offsetTable.scArticulationLink2PxActor = -ptrdiff_t(NpArticulationLink::getCoreOffset());
#if PX_SUPPORT_GPU_PHYSX
offsetTable.scSoftBody2PxActor = -ptrdiff_t(NpSoftBody::getCoreOffset());
offsetTable.scPBDParticleSystem2PxActor = -ptrdiff_t(NpPBDParticleSystem::getCoreOffset());
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
offsetTable.scFLIPParticleSystem2PxActor = -ptrdiff_t(NpFLIPParticleSystem::getCoreOffset());
offsetTable.scMPMParticleSystem2PxActor = -ptrdiff_t(NpMPMParticleSystem::getCoreOffset());
offsetTable.scHairSystem2PxActor = -ptrdiff_t(NpHairSystem::getCoreOffset());
#endif
#endif
offsetTable.scArticulationRC2Px = -ptrdiff_t(NpArticulationReducedCoordinate::getCoreOffset());
offsetTable.scArticulationJointRC2Px = -ptrdiff_t(NpArticulationJointReducedCoordinate::getCoreOffset());
offsetTable.scConstraint2Px = -ptrdiff_t(NpConstraint::getCoreOffset());
offsetTable.scShape2Px = -ptrdiff_t(NpShape::getCoreOffset());
for(PxU32 i=0;i<PxActorType::eACTOR_COUNT;i++)
offsetTable.scCore2PxActor[i] = 0;
offsetTable.scCore2PxActor[PxActorType::eRIGID_STATIC] = offsetTable.scRigidStatic2PxActor;
offsetTable.scCore2PxActor[PxActorType::eRIGID_DYNAMIC] = offsetTable.scRigidDynamic2PxActor;
offsetTable.scCore2PxActor[PxActorType::eARTICULATION_LINK] = offsetTable.scArticulationLink2PxActor;
offsetTable.scCore2PxActor[PxActorType::eSOFTBODY] = offsetTable.scSoftBody2PxActor;
offsetTable.scCore2PxActor[PxActorType::ePBD_PARTICLESYSTEM] = offsetTable.scPBDParticleSystem2PxActor;
offsetTable.scCore2PxActor[PxActorType::eFLIP_PARTICLESYSTEM] = offsetTable.scFLIPParticleSystem2PxActor;
offsetTable.scCore2PxActor[PxActorType::eMPM_PARTICLESYSTEM] = offsetTable.scMPMParticleSystem2PxActor;
offsetTable.scCore2PxActor[PxActorType::eHAIRSYSTEM] = offsetTable.scHairSystem2PxActor;
}
{
Sc::OffsetTable& scOffsetTable = Sc::gOffsetTable;
pxvOffsetTable.pxsShapeCore2PxShape = scOffsetTable.scShape2Px - ptrdiff_t(Sc::ShapeCore::getCoreOffset());
pxvOffsetTable.pxsRigidCore2PxRigidBody = scOffsetTable.scRigidDynamic2PxActor - ptrdiff_t(Sc::BodyCore::getCoreOffset());
pxvOffsetTable.pxsRigidCore2PxRigidStatic = scOffsetTable.scRigidStatic2PxActor - ptrdiff_t(Sc::StaticCore::getCoreOffset());
}
}
NpPhysics* NpPhysics::createInstance(PxU32 version, PxFoundation& foundation, const PxTolerancesScale& scale, bool trackOutstandingAllocations, pvdsdk::PsPvd* pvd, PxOmniPvd* omniPvd)
{
#if PX_SWITCH
NpSetMiddlewareInfo(); // register middleware info such that PhysX usage can be tracked
#endif
if (version!=PX_PHYSICS_VERSION)
{
char buffer[256];
Pxsnprintf(buffer, 256, "Wrong version: PhysX version is 0x%08x, tried to create 0x%08x", PX_PHYSICS_VERSION, version);
foundation.getErrorCallback().reportError(PxErrorCode::eINVALID_PARAMETER, buffer, PX_FL);
return NULL;
}
if (!scale.isValid())
{
foundation.getErrorCallback().reportError(PxErrorCode::eINVALID_PARAMETER, "Scale invalid.\n", PX_FL);
return NULL;
}
if(0 == mRefCount)
{
PX_ASSERT(&foundation == &PxGetFoundation());
PxIncFoundationRefCount();
// init offset tables for Pxs/Sc/Px conversions
PxvOffsetTable pxvOffsetTable;
initOffsetTables(pxvOffsetTable);
//SerialFactory::createInstance();
mInstance = PX_NEW (NpPhysics)(scale, pxvOffsetTable, trackOutstandingAllocations, pvd, foundation, omniPvd);
NpFactory::createInstance();
#if PX_SUPPORT_OMNI_PVD
if (omniPvd)
NpFactory::getInstance().addFactoryListener(mInstance->mOmniPvdListener);
#endif
#if PX_SUPPORT_PVD
if(pvd)
{
NpFactory::getInstance().setNpFactoryListener( *mInstance->mPvdPhysicsClient );
pvd->addClient(mInstance->mPvdPhysicsClient);
}
#endif
NpFactory::getInstance().addFactoryListener(mInstance->mDeletionMeshListener);
}
++mRefCount;
return mInstance;
}
PxU32 NpPhysics::releaseInstance()
{
PX_ASSERT(mRefCount > 0);
if (--mRefCount)
return mRefCount;
#if PX_SUPPORT_PVD
if(mInstance->mPvd)
{
NpFactory::getInstance().removeFactoryListener( *mInstance->mPvdPhysicsClient );
}
#endif
NpFactory::destroyInstance();
PX_ASSERT(mInstance);
PX_DELETE(mInstance);
PxDecFoundationRefCount();
return mRefCount;
}
void NpPhysics::release()
{
NpPhysics::releaseInstance();
}
PxScene* NpPhysics::createScene(const PxSceneDesc& desc)
{
PX_CHECK_AND_RETURN_NULL(desc.isValid(), "Physics::createScene: desc.isValid() is false!");
const PxTolerancesScale& scale = mPhysics.getTolerancesScale();
const PxTolerancesScale& descScale = desc.getTolerancesScale();
PX_UNUSED(scale);
PX_UNUSED(descScale);
PX_CHECK_AND_RETURN_NULL((descScale.length == scale.length) && (descScale.speed == scale.speed), "Physics::createScene: PxTolerancesScale must be the same as used for creation of PxPhysics!");
PxMutex::ScopedLock lock(mSceneAndMaterialMutex); // done here because scene constructor accesses profiling manager of the SDK
NpScene* npScene = PX_NEW (NpScene)(desc, *this);
if(!npScene)
{
mFoundation.error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "Unable to create scene.");
return NULL;
}
if(!npScene->getTaskManagerFast())
{
mFoundation.error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "Unable to create scene. Task manager creation failed.");
return NULL;
}
npScene->loadFromDesc(desc);
OMNI_PVD_ADD(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, scenes, static_cast<PxPhysics&>(*this), static_cast<PxScene&>(*npScene))
#if PX_SUPPORT_PVD
if(mPvd)
{
npScene->getScenePvdClientInternal().setPsPvd(mPvd);
mPvd->addClient(&npScene->getScenePvdClientInternal());
}
#endif
if (!sendMaterialTable(*npScene) || !npScene->getScScene().isValid())
{
PX_DELETE(npScene);
mFoundation.error(PxErrorCode::eOUT_OF_MEMORY, PX_FL, "Unable to create scene.");
return NULL;
}
mSceneArray.pushBack(npScene);
return npScene;
}
void NpPhysics::releaseSceneInternal(PxScene& scene)
{
NpScene* pScene = static_cast<NpScene*>(&scene);
OMNI_PVD_REMOVE(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, scenes, static_cast<PxPhysics&>(*this), scene)
PxMutex::ScopedLock lock(mSceneAndMaterialMutex);
for(PxU32 i=0;i<mSceneArray.size();i++)
{
if(mSceneArray[i]==pScene)
{
mSceneArray.replaceWithLast(i);
PX_DELETE(pScene);
return;
}
}
}
PxU32 NpPhysics::getNbScenes() const
{
PxMutex::ScopedLock lock(const_cast<PxMutex&>(mSceneAndMaterialMutex));
return mSceneArray.size();
}
PxU32 NpPhysics::getScenes(PxScene** userBuffer, PxU32 bufferSize, PxU32 startIndex) const
{
PxMutex::ScopedLock lock(const_cast<PxMutex&>(mSceneAndMaterialMutex));
return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mSceneArray.begin(), mSceneArray.size());
}
PxRigidStatic* NpPhysics::createRigidStatic(const PxTransform& globalPose)
{
PX_CHECK_AND_RETURN_NULL(globalPose.isSane(), "PxPhysics::createRigidStatic: invalid transform");
return NpFactory::getInstance().createRigidStatic(globalPose.getNormalized());
}
PxShape* NpPhysics::createShape(const PxGeometry& geometry, PxMaterial*const * materials, PxU16 materialCount, bool isExclusive, PxShapeFlags shapeFlags)
{
PX_CHECK_AND_RETURN_NULL(materials, "createShape: material pointer is NULL");
PX_CHECK_AND_RETURN_NULL(materialCount>0, "createShape: material count is zero");
#if PX_CHECKED
const bool isHeightfield = geometry.getType() == PxGeometryType::eHEIGHTFIELD;
const bool hasMeshTypeGeom = isHeightfield || (geometry.getType() == PxGeometryType::eTRIANGLEMESH) || (geometry.getType() == PxGeometryType::eTETRAHEDRONMESH);
PX_CHECK_AND_RETURN_NULL(!(hasMeshTypeGeom && (shapeFlags & PxShapeFlag::eTRIGGER_SHAPE)), "NpPhysics::createShape: triangle mesh/heightfield/tetrahedron mesh triggers are not supported!");
PX_CHECK_AND_RETURN_NULL(!((shapeFlags & PxShapeFlag::eSIMULATION_SHAPE) && (shapeFlags & PxShapeFlag::eTRIGGER_SHAPE)), "NpPhysics::createShape: shapes cannot simultaneously be trigger shapes and simulation shapes.");
#endif
return NpFactory::getInstance().createShape(geometry, shapeFlags, materials, materialCount, isExclusive);
}
PxShape* NpPhysics::createShape(const PxGeometry& geometry, PxFEMSoftBodyMaterial*const * materials, PxU16 materialCount, bool isExclusive, PxShapeFlags shapeFlags)
{
PX_CHECK_AND_RETURN_NULL(materials, "createShape: material pointer is NULL");
PX_CHECK_AND_RETURN_NULL(materialCount > 0, "createShape: material count is zero");
PX_CHECK_AND_RETURN_NULL(geometry.getType() == PxGeometryType::eTETRAHEDRONMESH, "createShape: soft bodies only accept PxTetrahedronMeshGeometry");
PX_CHECK_AND_RETURN_NULL(shapeFlags & PxShapeFlag::eSIMULATION_SHAPE, "createShape: soft body shapes must be simulation shapes");
return NpFactory::getInstance().createShape(geometry, shapeFlags, materials, materialCount, isExclusive);
}
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION && PX_SUPPORT_GPU_PHYSX
PxShape* NpPhysics::createShape(const PxGeometry& geometry, PxFEMClothMaterial*const * materials, PxU16 materialCount, bool isExclusive, PxShapeFlags shapeFlags)
{
PX_CHECK_AND_RETURN_NULL(materials, "createShape: material pointer is NULL");
PX_CHECK_AND_RETURN_NULL(materialCount > 0, "createShape: material count is zero");
PX_CHECK_AND_RETURN_NULL(geometry.getType() == PxGeometryType::eTRIANGLEMESH, "createShape: cloth only accept PxTriangleMeshGeometry");
PX_CHECK_AND_RETURN_NULL(shapeFlags & PxShapeFlag::eSIMULATION_SHAPE, "createShape: cloth shapes must be simulation shapes");
return NpFactory::getInstance().createShape(geometry, shapeFlags, materials, materialCount, isExclusive);
}
#else
PxShape* NpPhysics::createShape(const PxGeometry&, PxFEMClothMaterial*const *, PxU16, bool, PxShapeFlags)
{
return NULL;
}
#endif
PxU32 NpPhysics::getNbShapes() const
{
return NpFactory::getInstance().getNbShapes();
}
PxU32 NpPhysics::getShapes(PxShape** userBuffer, PxU32 bufferSize, PxU32 startIndex) const
{
return NpFactory::getInstance().getShapes(userBuffer, bufferSize, startIndex);
}
PxRigidDynamic* NpPhysics::createRigidDynamic(const PxTransform& globalPose)
{
PX_CHECK_AND_RETURN_NULL(globalPose.isSane(), "PxPhysics::createRigidDynamic: invalid transform");
return NpFactory::getInstance().createRigidDynamic(globalPose.getNormalized());
}
PxConstraint* NpPhysics::createConstraint(PxRigidActor* actor0, PxRigidActor* actor1, PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize)
{
return NpFactory::getInstance().createConstraint(actor0, actor1, connector, shaders, dataSize);
}
PxArticulationReducedCoordinate* NpPhysics::createArticulationReducedCoordinate()
{
return NpFactory::getInstance().createArticulationRC();
}
PxSoftBody* NpPhysics::createSoftBody(PxCudaContextManager& cudaContextManager)
{
#if PX_SUPPORT_GPU_PHYSX
return NpFactory::getInstance().createSoftBody(cudaContextManager);
#else
PX_UNUSED(cudaContextManager);
return NULL;
#endif
}
PxPBDParticleSystem* NpPhysics::createPBDParticleSystem(PxCudaContextManager& cudaContextManager, PxU32 maxNeighborhood)
{
#if PX_SUPPORT_GPU_PHYSX
return NpFactory::getInstance().createPBDParticleSystem(maxNeighborhood, cudaContextManager);
#else
PX_UNUSED(cudaContextManager);
PX_UNUSED(maxNeighborhood);
return NULL;
#endif
}
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION && PX_SUPPORT_GPU_PHYSX
PxFLIPParticleSystem* NpPhysics::createFLIPParticleSystem(PxCudaContextManager& cudaContextManager)
{
return NpFactory::getInstance().createFLIPParticleSystem(cudaContextManager);
}
PxMPMParticleSystem* NpPhysics::createMPMParticleSystem(PxCudaContextManager& cudaContextManager)
{
return NpFactory::getInstance().createMPMParticleSystem( cudaContextManager);
}
PxFEMCloth* NpPhysics::createFEMCloth(PxCudaContextManager& cudaContextManager)
{
return NpFactory::getInstance().createFEMCloth(cudaContextManager);
}
PxHairSystem* NpPhysics::createHairSystem(PxCudaContextManager& cudaContextManager)
{
return NpFactory::getInstance().createHairSystem(cudaContextManager);
}
#else
PxFLIPParticleSystem* NpPhysics::createFLIPParticleSystem(PxCudaContextManager&) { return NULL; }
PxMPMParticleSystem* NpPhysics::createMPMParticleSystem(PxCudaContextManager&) { return NULL; }
PxFEMCloth* NpPhysics::createFEMCloth(PxCudaContextManager&) { return NULL; }
PxHairSystem* NpPhysics::createHairSystem(PxCudaContextManager&) { return NULL; }
#endif
PxAggregate* NpPhysics::createAggregate(PxU32 maxActors, PxU32 maxShapes, PxAggregateFilterHint filterHint)
{
PX_CHECK_AND_RETURN_VAL(!(PxGetAggregateSelfCollisionBit(filterHint) && PxGetAggregateType(filterHint)==PxAggregateType::eSTATIC),
"PxPhysics::createAggregate: static aggregates with self-collisions are not allowed.", NULL);
return NpFactory::getInstance().createAggregate(maxActors, maxShapes, filterHint);
}
///////////////////////////////////////////////////////////////////////////////
template<class NpMaterialT>
static NpMaterialT* addMaterial(
#if PX_SUPPORT_OMNI_PVD
NpPhysics::OmniPvdListener& mOmniPvdListener,
#endif
NpMaterialT* m, NpMaterialManager<NpMaterialT>& materialManager, PxMutex& mutex, PxArray<NpScene*>& sceneArray, const char* error)
{
if(!m)
return NULL;
OMNI_PVD_NOTIFY_ADD(m);
PxMutex::ScopedLock lock(mutex);
//the handle is set inside the setMaterial method
if(materialManager.setMaterial(*m))
{
// Let all scenes know of the new material
const PxU32 nbScenes = sceneArray.size();
for(PxU32 i=0; i<nbScenes; i++)
sceneArray[i]->addMaterial(*m);
return m;
}
else
{
PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, error);
m->release();
return NULL;
}
}
template<class NpMaterialT, class PxMaterialT>
static PxU32 getMaterials(const NpMaterialManager<NpMaterialT>& materialManager, const PxMutex& mutex, PxMaterialT** userBuffer, PxU32 bufferSize, PxU32 startIndex)
{
PxMutex::ScopedLock lock(const_cast<PxMutex&>(mutex));
NpMaterialManagerIterator<NpMaterialT> iter(materialManager);
PxU32 writeCount =0;
PxU32 index = 0;
NpMaterialT* mat;
while(iter.getNextMaterial(mat))
{
if(index++ < startIndex)
continue;
if(writeCount == bufferSize)
break;
userBuffer[writeCount++] = mat;
}
return writeCount;
}
template<class NpMaterialT>
static void removeMaterialFromTable(
#if PX_SUPPORT_OMNI_PVD
NpPhysics::OmniPvdListener& mOmniPvdListener,
#endif
NpMaterialT& m, NpMaterialManager<NpMaterialT>& materialManager, PxMutex& mutex, PxArray<NpScene*>& sceneArray)
{
OMNI_PVD_NOTIFY_REMOVE(&m);
PxMutex::ScopedLock lock(mutex);
// Let all scenes know of the deleted material
const PxU32 nbScenes = sceneArray.size();
for(PxU32 i=0; i<nbScenes; i++)
sceneArray[i]->removeMaterial(m);
materialManager.removeMaterial(m);
}
template<class NpMaterialT>
static void updateMaterial(NpMaterialT& m, NpMaterialManager<NpMaterialT>& materialManager, PxMutex& mutex, PxArray<NpScene*>& sceneArray)
{
PxMutex::ScopedLock lock(mutex);
// Let all scenes know of the updated material
const PxU32 nbScenes = sceneArray.size();
for(PxU32 i=0; i<nbScenes; i++)
sceneArray[i]->updateMaterial(m);
materialManager.updateMaterial(m);
}
#if PX_SUPPORT_OMNI_PVD
#define _addMaterial(p0, p1, p2, p3, p4) ::addMaterial(mOmniPvdListener, p0, p1, p2, p3, p4)
#define _removeMaterialFromTable(p0, p1, p2, p3) ::removeMaterialFromTable(mOmniPvdListener, p0, p1, p2, p3)
#else
#define _addMaterial(p0, p1, p2, p3, p4) ::addMaterial(p0, p1, p2, p3, p4)
#define _removeMaterialFromTable(p0, p1, p2, p3) ::removeMaterialFromTable(p0, p1, p2, p3)
#endif
#define IMPLEMENT_INTERNAL_MATERIAL_FUNCTIONS(NpMaterialT, manager, errorMsg) \
NpMaterialT* NpPhysics::addMaterial(NpMaterialT* m) \
{ \
return _addMaterial(m, manager, mSceneAndMaterialMutex, mSceneArray, errorMsg); \
} \
void NpPhysics::removeMaterialFromTable(NpMaterialT& m) \
{ \
_removeMaterialFromTable(m, manager, mSceneAndMaterialMutex, mSceneArray); \
} \
void NpPhysics::updateMaterial(NpMaterialT& m) \
{ \
::updateMaterial(m, manager, mSceneAndMaterialMutex, mSceneArray); \
}
///////////////////////////////////////////////////////////////////////////////
template<class NpMaterialT>
static void sendMaterialTable(NpScene& scene, const NpMaterialManager<NpMaterialT>& materialManager)
{
NpMaterialManagerIterator<NpMaterialT> iter(materialManager);
NpMaterialT* mat;
while(iter.getNextMaterial(mat))
scene.addMaterial(*mat);
}
bool NpPhysics::sendMaterialTable(NpScene& scene)
{
// note: no lock here because this method gets only called at scene creation and there we do lock
::sendMaterialTable(scene, mMasterMaterialManager);
#if PX_SUPPORT_GPU_PHYSX
::sendMaterialTable(scene, mMasterFEMSoftBodyMaterialManager);
::sendMaterialTable(scene, mMasterPBDMaterialManager);
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
::sendMaterialTable(scene, mMasterFEMClothMaterialManager);
::sendMaterialTable(scene, mMasterFLIPMaterialManager);
::sendMaterialTable(scene, mMasterMPMMaterialManager);
#endif
#endif
return true;
}
///////////////////////////////////////////////////////////////////////////////
PxMaterial* NpPhysics::createMaterial(PxReal staticFriction, PxReal dynamicFriction, PxReal restitution)
{
PxMaterial* m = NpFactory::getInstance().createMaterial(staticFriction, dynamicFriction, restitution);
return addMaterial(static_cast<NpMaterial*>(m));
}
PxU32 NpPhysics::getNbMaterials() const
{
PxMutex::ScopedLock lock(const_cast<PxMutex&>(mSceneAndMaterialMutex));
return mMasterMaterialManager.getNumMaterials();
}
PxU32 NpPhysics::getMaterials(PxMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const
{
return ::getMaterials(mMasterMaterialManager, mSceneAndMaterialMutex, userBuffer, bufferSize, startIndex);
}
IMPLEMENT_INTERNAL_MATERIAL_FUNCTIONS(NpMaterial, mMasterMaterialManager, "PxPhysics::createMaterial: limit of 64K materials reached.")
///////////////////////////////////////////////////////////////////////////////
// PT: all the virtual functions that are unconditionally defined in the API / virtual interface cannot be compiled away entirely.
// But the internal functions like addXXXX() can.
#if PX_SUPPORT_GPU_PHYSX
PxFEMSoftBodyMaterial* NpPhysics::createFEMSoftBodyMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction)
{
PxFEMSoftBodyMaterial* m = NpFactory::getInstance().createFEMSoftBodyMaterial(youngs, poissons, dynamicFriction);
return addMaterial(static_cast<NpFEMSoftBodyMaterial*>(m));
}
PxU32 NpPhysics::getNbFEMSoftBodyMaterials() const
{
PxMutex::ScopedLock lock(const_cast<PxMutex&>(mSceneAndMaterialMutex));
return mMasterFEMSoftBodyMaterialManager.getNumMaterials();
}
PxU32 NpPhysics::getFEMSoftBodyMaterials(PxFEMSoftBodyMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const
{
return ::getMaterials(mMasterFEMSoftBodyMaterialManager, mSceneAndMaterialMutex, userBuffer, bufferSize, startIndex);
}
IMPLEMENT_INTERNAL_MATERIAL_FUNCTIONS(NpFEMSoftBodyMaterial, mMasterFEMSoftBodyMaterialManager, "PxPhysics::createFEMSoftBodyMaterial: limit of 64K materials reached.")
#else
PxFEMSoftBodyMaterial* NpPhysics::createFEMSoftBodyMaterial(PxReal, PxReal, PxReal) { return NULL; }
PxU32 NpPhysics::getNbFEMSoftBodyMaterials() const { return 0; }
PxU32 NpPhysics::getFEMSoftBodyMaterials(PxFEMSoftBodyMaterial**, PxU32, PxU32) const { return 0; }
#endif
///////////////////////////////////////////////////////////////////////////////
#if PX_SUPPORT_GPU_PHYSX
PxPBDMaterial* NpPhysics::createPBDMaterial(PxReal friction, PxReal damping, PxReal adhesion, PxReal viscosity, PxReal vorticityConfinement, PxReal surfaceTension,
PxReal cohesion, PxReal lift, PxReal drag, PxReal cflCoefficient, PxReal gravityScale)
{
PxPBDMaterial* m = NpFactory::getInstance().createPBDMaterial(friction, damping, adhesion, viscosity, vorticityConfinement, surfaceTension, cohesion, lift, drag, cflCoefficient, gravityScale);
return addMaterial(static_cast<NpPBDMaterial*>(m));
}
PxU32 NpPhysics::getNbPBDMaterials() const
{
PxMutex::ScopedLock lock(const_cast<PxMutex&>(mSceneAndMaterialMutex));
return mMasterPBDMaterialManager.getNumMaterials();
}
PxU32 NpPhysics::getPBDMaterials(PxPBDMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const
{
return ::getMaterials(mMasterPBDMaterialManager, mSceneAndMaterialMutex, userBuffer, bufferSize, startIndex);
}
IMPLEMENT_INTERNAL_MATERIAL_FUNCTIONS(NpPBDMaterial, mMasterPBDMaterialManager, "PxPhysics::createPBDMaterial: limit of 64K materials reached.")
#else
PxPBDMaterial* NpPhysics::createPBDMaterial(PxReal, PxReal, PxReal, PxReal, PxReal, PxReal, PxReal, PxReal, PxReal, PxReal, PxReal) { return NULL; }
PxU32 NpPhysics::getNbPBDMaterials() const { return 0; }
PxU32 NpPhysics::getPBDMaterials(PxPBDMaterial**, PxU32, PxU32) const { return 0; }
#endif
///////////////////////////////////////////////////////////////////////////////
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION && PX_SUPPORT_GPU_PHYSX
PxFEMClothMaterial* NpPhysics::createFEMClothMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction, PxReal thickness)
{
PxFEMClothMaterial* m = NpFactory::getInstance().createFEMClothMaterial(youngs, poissons, dynamicFriction, thickness);
return addMaterial(static_cast<NpFEMClothMaterial*>(m));
}
PxU32 NpPhysics::getNbFEMClothMaterials() const
{
PxMutex::ScopedLock lock(const_cast<PxMutex&>(mSceneAndMaterialMutex));
return mMasterFEMClothMaterialManager.getNumMaterials();
}
PxU32 NpPhysics::getFEMClothMaterials(PxFEMClothMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const
{
return ::getMaterials(mMasterFEMClothMaterialManager, mSceneAndMaterialMutex, userBuffer, bufferSize, startIndex);
}
IMPLEMENT_INTERNAL_MATERIAL_FUNCTIONS(NpFEMClothMaterial, mMasterFEMClothMaterialManager, "PxPhysics::createFEMClothMaterial: limit of 64K materials reached.")
#else
PxFEMClothMaterial* NpPhysics::createFEMClothMaterial(PxReal, PxReal, PxReal, PxReal) { return NULL; }
PxU32 NpPhysics::getNbFEMClothMaterials() const { return 0; }
PxU32 NpPhysics::getFEMClothMaterials(PxFEMClothMaterial**, PxU32, PxU32) const { return 0; }
#endif
///////////////////////////////////////////////////////////////////////////////
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION && PX_SUPPORT_GPU_PHYSX
PxFLIPMaterial* NpPhysics::createFLIPMaterial(PxReal friction, PxReal damping, PxReal maxVelocity, PxReal viscosity, PxReal gravityScale)
{
PxFLIPMaterial* m = NpFactory::getInstance().createFLIPMaterial(friction, damping, maxVelocity, viscosity, gravityScale);
return addMaterial(static_cast<NpFLIPMaterial*>(m));
}
PxU32 NpPhysics::getNbFLIPMaterials() const
{
PxMutex::ScopedLock lock(const_cast<PxMutex&>(mSceneAndMaterialMutex));
return mMasterFLIPMaterialManager.getNumMaterials();
}
PxU32 NpPhysics::getFLIPMaterials(PxFLIPMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const
{
return ::getMaterials(mMasterFLIPMaterialManager, mSceneAndMaterialMutex, userBuffer, bufferSize, startIndex);
}
IMPLEMENT_INTERNAL_MATERIAL_FUNCTIONS(NpFLIPMaterial, mMasterFLIPMaterialManager, "PxPhysics::createFLIPMaterial: limit of 64K materials reached.")
#else
PxFLIPMaterial* NpPhysics::createFLIPMaterial(PxReal, PxReal, PxReal, PxReal, PxReal) { return NULL; }
PxU32 NpPhysics::getNbFLIPMaterials() const { return 0; }
PxU32 NpPhysics::getFLIPMaterials(PxFLIPMaterial**, PxU32, PxU32) const { return 0; }
#endif
///////////////////////////////////////////////////////////////////////////////
#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION && PX_SUPPORT_GPU_PHYSX
PxMPMMaterial* NpPhysics::createMPMMaterial(PxReal friction, PxReal damping, PxReal maxVelocity, bool isPlastic, PxReal youngsModulus, PxReal poissons, PxReal hardening, PxReal criticalCompression, PxReal criticalStretch, PxReal tensileDamageSensitivity, PxReal compressiveDamageSensitivity, PxReal attractiveForceResidual, PxReal gravityScale)
{
PxMPMMaterial* m = NpFactory::getInstance().createMPMMaterial(friction, damping, maxVelocity, isPlastic, youngsModulus, poissons, hardening, criticalCompression, criticalStretch, tensileDamageSensitivity, compressiveDamageSensitivity, attractiveForceResidual, gravityScale);
return addMaterial(static_cast<NpMPMMaterial*>(m));
}
PxU32 NpPhysics::getNbMPMMaterials() const
{
PxMutex::ScopedLock lock(const_cast<PxMutex&>(mSceneAndMaterialMutex));
return mMasterMPMMaterialManager.getNumMaterials();
}
PxU32 NpPhysics::getMPMMaterials(PxMPMMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const
{
return ::getMaterials(mMasterMPMMaterialManager, mSceneAndMaterialMutex, userBuffer, bufferSize, startIndex);
}
IMPLEMENT_INTERNAL_MATERIAL_FUNCTIONS(NpMPMMaterial, mMasterMPMMaterialManager, "PxPhysics::createMPMMaterial: limit of 64K materials reached.")
#else
PxMPMMaterial* NpPhysics::createMPMMaterial(PxReal, PxReal, PxReal, bool, PxReal, PxReal, PxReal, PxReal, PxReal, PxReal, PxReal, PxReal, PxReal) { return NULL; }
PxU32 NpPhysics::getNbMPMMaterials() const { return 0; }
PxU32 NpPhysics::getMPMMaterials(PxMPMMaterial**, PxU32, PxU32) const { return 0; }
#endif
///////////////////////////////////////////////////////////////////////////////
PxTriangleMesh* NpPhysics::createTriangleMesh(PxInputStream& stream)
{
return NpFactory::getInstance().createTriangleMesh(stream);
}
PxU32 NpPhysics::getNbTriangleMeshes() const
{
return NpFactory::getInstance().getNbTriangleMeshes();
}
PxU32 NpPhysics::getTriangleMeshes(PxTriangleMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex) const
{
return NpFactory::getInstance().getTriangleMeshes(userBuffer, bufferSize, startIndex);
}
///////////////////////////////////////////////////////////////////////////////
PxTetrahedronMesh* NpPhysics::createTetrahedronMesh(PxInputStream& stream)
{
return NpFactory::getInstance().createTetrahedronMesh(stream);
}
PxU32 NpPhysics::getNbTetrahedronMeshes() const
{
return NpFactory::getInstance().getNbTetrahedronMeshes();
}
PxU32 NpPhysics::getTetrahedronMeshes(PxTetrahedronMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex) const
{
return NpFactory::getInstance().getTetrahedronMeshes(userBuffer, bufferSize, startIndex);
}
PxSoftBodyMesh* NpPhysics::createSoftBodyMesh(PxInputStream& stream)
{
return NpFactory::getInstance().createSoftBodyMesh(stream);
}
///////////////////////////////////////////////////////////////////////////////
PxHeightField* NpPhysics::createHeightField(PxInputStream& stream)
{
return NpFactory::getInstance().createHeightField(stream);
}
PxU32 NpPhysics::getNbHeightFields() const
{
return NpFactory::getInstance().getNbHeightFields();
}
PxU32 NpPhysics::getHeightFields(PxHeightField** userBuffer, PxU32 bufferSize, PxU32 startIndex) const
{
return NpFactory::getInstance().getHeightFields(userBuffer, bufferSize, startIndex);
}
///////////////////////////////////////////////////////////////////////////////
PxConvexMesh* NpPhysics::createConvexMesh(PxInputStream& stream)
{
return NpFactory::getInstance().createConvexMesh(stream);
}
PxU32 NpPhysics::getNbConvexMeshes() const
{
return NpFactory::getInstance().getNbConvexMeshes();
}
PxU32 NpPhysics::getConvexMeshes(PxConvexMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex) const
{
return NpFactory::getInstance().getConvexMeshes(userBuffer, bufferSize, startIndex);
}
///////////////////////////////////////////////////////////////////////////////
PxBVH* NpPhysics::createBVH(PxInputStream& stream)
{
return NpFactory::getInstance().createBVH(stream);
}
PxU32 NpPhysics::getNbBVHs() const
{
return NpFactory::getInstance().getNbBVHs();
}
PxU32 NpPhysics::getBVHs(PxBVH** userBuffer, PxU32 bufferSize, PxU32 startIndex) const
{
return NpFactory::getInstance().getBVHs(userBuffer, bufferSize, startIndex);
}
///////////////////////////////////////////////////////////////////////////////
#if PX_SUPPORT_GPU_PHYSX
PxParticleBuffer* NpPhysics::createParticleBuffer(PxU32 maxParticles, PxU32 maxVolumes, PxCudaContextManager* cudaContextManager)
{
return NpFactory::getInstance().createParticleBuffer(maxParticles, maxVolumes, cudaContextManager);
}
PxParticleAndDiffuseBuffer* NpPhysics::createParticleAndDiffuseBuffer(PxU32 maxParticles, PxU32 maxVolumes, PxU32 maxDiffuseParticles, PxCudaContextManager* cudaContextManager)
{
return NpFactory::getInstance().createParticleAndDiffuseBuffer(maxParticles, maxVolumes, maxDiffuseParticles, cudaContextManager);
}
PxParticleClothBuffer* NpPhysics::createParticleClothBuffer(PxU32 maxParticles, PxU32 maxNumVolumes, PxU32 maxNumCloths, PxU32 maxNumTriangles, PxU32 maxNumSprings, PxCudaContextManager* cudaContextManager)
{
return NpFactory::getInstance().createParticleClothBuffer(maxParticles, maxNumVolumes, maxNumCloths, maxNumTriangles, maxNumSprings, cudaContextManager);
}
PxParticleRigidBuffer* NpPhysics::createParticleRigidBuffer(PxU32 maxParticles, PxU32 maxNumVolumes, PxU32 maxNumRigids, PxCudaContextManager* cudaContextManager)
{
return NpFactory::getInstance().createParticleRigidBuffer(maxParticles, maxNumVolumes, maxNumRigids, cudaContextManager);
}
#else
PxParticleBuffer* NpPhysics::createParticleBuffer(PxU32, PxU32, PxCudaContextManager*)
{
return NULL;
}
PxParticleAndDiffuseBuffer* NpPhysics::createParticleAndDiffuseBuffer(PxU32, PxU32, PxU32, PxCudaContextManager*)
{
return NULL;
}
PxParticleClothBuffer* NpPhysics::createParticleClothBuffer(PxU32, PxU32, PxU32, PxU32, PxU32, PxCudaContextManager*)
{
return NULL;
}
PxParticleRigidBuffer* NpPhysics::createParticleRigidBuffer(PxU32, PxU32, PxU32, PxCudaContextManager*)
{
return NULL;
}
#endif
///////////////////////////////////////////////////////////////////////////////
PxPruningStructure* NpPhysics::createPruningStructure(PxRigidActor*const* actors, PxU32 nbActors)
{
PX_SIMD_GUARD;
PX_ASSERT(actors);
PX_ASSERT(nbActors > 0);
Sq::PruningStructure* ps = PX_NEW(Sq::PruningStructure)();
if(!ps->build(actors, nbActors))
{
PX_DELETE(ps);
}
return ps;
}
///////////////////////////////////////////////////////////////////////////////
#if PX_SUPPORT_GPU_PHYSX
void NpPhysics::registerPhysXIndicatorGpuClient()
{
PxMutex::ScopedLock lock(mPhysXIndicatorMutex);
++mNbRegisteredGpuClients;
mPhysXIndicator.setIsGpu(mNbRegisteredGpuClients>0);
}
void NpPhysics::unregisterPhysXIndicatorGpuClient()
{
PxMutex::ScopedLock lock(mPhysXIndicatorMutex);
if (mNbRegisteredGpuClients)
--mNbRegisteredGpuClients;
mPhysXIndicator.setIsGpu(mNbRegisteredGpuClients>0);
}
#endif
///////////////////////////////////////////////////////////////////////////////
void NpPhysics::registerDeletionListener(PxDeletionListener& observer, const PxDeletionEventFlags& deletionEvents, bool restrictedObjectSet)
{
PxMutex::ScopedLock lock(mDeletionListenerMutex);
const DeletionListenerMap::Entry* entry = mDeletionListenerMap.find(&observer);
if(!entry)
{
NpDelListenerEntry* e = PX_NEW(NpDelListenerEntry)(deletionEvents, restrictedObjectSet);
if (e)
{
if (mDeletionListenerMap.insert(&observer, e))
mDeletionListenersExist = true;
else
{
PX_DELETE(e);
PX_ALWAYS_ASSERT();
}
}
}
else
PX_ASSERT(mDeletionListenersExist);
}
void NpPhysics::unregisterDeletionListener(PxDeletionListener& observer)
{
PxMutex::ScopedLock lock(mDeletionListenerMutex);
const DeletionListenerMap::Entry* entry = mDeletionListenerMap.find(&observer);
if(entry)
{
NpDelListenerEntry* e = entry->second;
mDeletionListenerMap.erase(&observer);
PX_DELETE(e);
}
mDeletionListenersExist = mDeletionListenerMap.size()>0;
}
void NpPhysics::registerDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount)
{
PxMutex::ScopedLock lock(mDeletionListenerMutex);
const DeletionListenerMap::Entry* entry = mDeletionListenerMap.find(&observer);
if(entry)
{
NpDelListenerEntry* e = entry->second;
PX_CHECK_AND_RETURN(e->restrictedObjectSet, "PxPhysics::registerDeletionListenerObjects: deletion listener is not configured to receive events from specific objects.");
e->registeredObjects.reserve(e->registeredObjects.size() + observableCount);
for(PxU32 i=0; i < observableCount; i++)
e->registeredObjects.insert(observables[i]);
}
else
{
PX_CHECK_AND_RETURN(false, "PxPhysics::registerDeletionListenerObjects: deletion listener has to be registered in PxPhysics first.");
}
}
void NpPhysics::unregisterDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount)
{
PxMutex::ScopedLock lock(mDeletionListenerMutex);
const DeletionListenerMap::Entry* entry = mDeletionListenerMap.find(&observer);
if(entry)
{
NpDelListenerEntry* e = entry->second;
if (e->restrictedObjectSet)
{
for(PxU32 i=0; i < observableCount; i++)
e->registeredObjects.erase(observables[i]);
}
else
{
PX_CHECK_AND_RETURN(false, "PxPhysics::unregisterDeletionListenerObjects: deletion listener is not configured to receive events from specific objects.");
}
}
else
{
PX_CHECK_AND_RETURN(false, "PxPhysics::unregisterDeletionListenerObjects: deletion listener has to be registered in PxPhysics first.");
}
}
void NpPhysics::notifyDeletionListeners(const PxBase* base, void* userData, PxDeletionEventFlag::Enum deletionEvent)
{
// we don't protect the check for whether there are any listeners, because we don't want to take a hit in the
// common case where there are no listeners. Note the API comments here, that users should not register or
// unregister deletion listeners while deletions are occurring
if(mDeletionListenersExist)
{
PxMutex::ScopedLock lock(mDeletionListenerMutex);
const DeletionListenerMap::Entry* delListenerEntries = mDeletionListenerMap.getEntries();
const PxU32 delListenerEntryCount = mDeletionListenerMap.size();
for(PxU32 i=0; i < delListenerEntryCount; i++)
{
const NpDelListenerEntry* entry = delListenerEntries[i].second;
if (entry->flags & deletionEvent)
{
if (entry->restrictedObjectSet)
{
if (entry->registeredObjects.contains(base))
delListenerEntries[i].first->onRelease(base, userData, deletionEvent);
}
else
delListenerEntries[i].first->onRelease(base, userData, deletionEvent);
}
}
}
}
#if PX_SUPPORT_OMNI_PVD
void NpPhysics::OmniPvdListener::onObjectAdd(const PxBase* object)
{
::OmniPvdPxSampler::getInstance()->onObjectAdd(*object);
}
void NpPhysics::OmniPvdListener::onObjectRemove(const PxBase* object)
{
::OmniPvdPxSampler::getInstance()->onObjectRemove(*object);
}
#endif
///////////////////////////////////////////////////////////////////////////////
const PxTolerancesScale& NpPhysics::getTolerancesScale() const
{
return mPhysics.getTolerancesScale();
}
PxFoundation& NpPhysics::getFoundation()
{
return mFoundation;
}
PxPhysics& PxGetPhysics()
{
return NpPhysics::getInstance();
}
PxPhysics* PxCreatePhysics(PxU32 version, PxFoundation& foundation, const physx::PxTolerancesScale& scale, bool trackOutstandingAllocations, PxPvd* pvd, PxOmniPvd* omniPvd)
{
return NpPhysics::createInstance(version, foundation, scale, trackOutstandingAllocations, static_cast<pvdsdk::PsPvd*>(pvd), omniPvd);
}
void PxAddCollectionToPhysics(const PxCollection& collection)
{
NpFactory& factory = NpFactory::getInstance();
const Cm::Collection& c = static_cast<const Cm::Collection&>(collection);
factory.addCollection(c);
}
| 44,227 | C++ | 35.918197 | 345 | 0.749384 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/NpCheck.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "NpCheck.h"
#include "NpScene.h"
using namespace physx;
NpReadCheck::NpReadCheck(const NpScene* scene, const char* functionName) : mScene(scene), mName(functionName), mErrorCount(0)
{
if(mScene)
{
if(!mScene->startRead())
{
if(mScene->getScScene().getFlags() & PxSceneFlag::eREQUIRE_RW_LOCK)
{
PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL,
"An API read call (%s) was made from thread %d but PxScene::lockRead() was not called first, note that "
"when PxSceneFlag::eREQUIRE_RW_LOCK is enabled all API reads and writes must be "
"wrapped in the appropriate locks.", mName, PxU32(PxThread::getId()));
}
else
{
PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL,
"Overlapping API read and write call detected during %s from thread %d! Note that read operations to "
"the SDK must not be overlapped with write calls, else the resulting behavior is undefined.", mName, PxU32(PxThread::getId()));
}
}
// Record the NpScene read/write error counter which is
// incremented any time a NpScene::startWrite/startRead fails
// (see destructor for additional error checking based on this count)
mErrorCount = mScene->getReadWriteErrorCount();
}
}
NpReadCheck::~NpReadCheck()
{
if(mScene)
{
// By checking if the NpScene::mConcurrentErrorCount has been incremented
// we can detect if an erroneous read/write was performed during
// this objects lifetime. In this case we also print this function's
// details so that the user can see which two API calls overlapped
if(mScene->getReadWriteErrorCount() != mErrorCount && !(mScene->getScScene().getFlags() & PxSceneFlag::eREQUIRE_RW_LOCK))
{
PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL,
"Leaving %s on thread %d, an API overlapping write on another thread was detected.", mName, PxU32(PxThread::getId()));
}
mScene->stopRead();
}
}
NpWriteCheck::NpWriteCheck(NpScene* scene, const char* functionName, bool allowReentry) : mScene(scene), mName(functionName), mAllowReentry(allowReentry), mErrorCount(0)
{
if(mScene)
{
switch(mScene->startWrite(mAllowReentry))
{
case NpScene::StartWriteResult::eOK:
break;
case NpScene::StartWriteResult::eNO_LOCK:
PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL,
"An API write call (%s) was made from thread %d but PxScene::lockWrite() was not called first, note that "
"when PxSceneFlag::eREQUIRE_RW_LOCK is enabled all API reads and writes must be "
"wrapped in the appropriate locks.", mName, PxU32(PxThread::getId()));
break;
case NpScene::StartWriteResult::eRACE_DETECTED:
PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL,
"Concurrent API write call or overlapping API read and write call detected during %s from thread %d! "
"Note that write operations to the SDK must be sequential, i.e., no overlap with "
"other write or read calls, else the resulting behavior is undefined. "
"Also note that API writes during a callback function are not permitted.", mName, PxU32(PxThread::getId()));
break;
case NpScene::StartWriteResult::eIN_FETCHRESULTS:
PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL,
"Illegal write call detected in %s from thread %d during split fetchResults! "
"Note that write operations to the SDK are not permitted between the start of fetchResultsStart() and end of fetchResultsFinish(). "
"Behavior will be undefined. ", mName, PxU32(PxThread::getId()));
break;
}
// Record the NpScene read/write error counter which is
// incremented any time a NpScene::startWrite/startRead fails
// (see destructor for additional error checking based on this count)
mErrorCount = mScene->getReadWriteErrorCount();
}
}
NpWriteCheck::~NpWriteCheck()
{
if(mScene)
{
// By checking if the NpScene::mConcurrentErrorCount has been incremented
// we can detect if an erroneous read/write was performed during
// this objects lifetime. In this case we also print this function's
// details so that the user can see which two API calls overlapped
if(mScene->getReadWriteErrorCount() != mErrorCount && !(mScene->getScScene().getFlags() & PxSceneFlag::eREQUIRE_RW_LOCK))
{
PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL,
"Leaving %s on thread %d, an overlapping API read or write by another thread was detected.", mName, PxU32(PxThread::getId()));
}
mScene->stopWrite(mAllowReentry);
}
}
| 6,191 | C++ | 45.208955 | 169 | 0.737684 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/windows/NpWindowsDelayLoadHook.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "common/windows/PxWindowsDelayLoadHook.h"
#include "foundation/windows/PxWindowsInclude.h"
#include "windows/CmWindowsLoadLibrary.h"
namespace physx
{
static const PxDelayLoadHook* gPhysXDelayLoadHook = NULL;
void PxSetPhysXDelayLoadHook(const PxDelayLoadHook* hook)
{
gPhysXDelayLoadHook = hook;
}
}
// delay loading is enabled only for non static configuration
#if !defined PX_PHYSX_STATIC_LIB
// Prior to Visual Studio 2015 Update 3, these hooks were non-const.
#define DELAYIMP_INSECURE_WRITABLE_HOOKS
#include <delayimp.h>
using namespace physx;
#pragma comment(lib, "delayimp")
FARPROC WINAPI physxDelayHook(unsigned dliNotify, PDelayLoadInfo pdli)
{
switch (dliNotify) {
case dliStartProcessing :
break;
case dliNotePreLoadLibrary :
{
return Cm::physXCommonDliNotePreLoadLibrary(pdli->szDll,gPhysXDelayLoadHook);
}
break;
case dliNotePreGetProcAddress :
break;
case dliFailLoadLib :
break;
case dliFailGetProc :
break;
case dliNoteEndProcessing :
break;
default :
return NULL;
}
return NULL;
}
PfnDliHook __pfnDliNotifyHook2 = physxDelayHook;
#endif
| 2,821 | C++ | 30.355555 | 80 | 0.76604 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/omnipvd/NpOmniPvd.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "NpOmniPvd.h"
#if PX_SUPPORT_OMNI_PVD
#include "OmniPvdPxSampler.h"
#include "OmniPvdLoader.h"
#include "OmniPvdFileWriteStream.h"
#endif
#include "foundation/PxUserAllocated.h"
physx::PxU32 physx::NpOmniPvd::mRefCount = 0;
physx::NpOmniPvd* physx::NpOmniPvd::mInstance = NULL;
namespace physx
{
NpOmniPvd::NpOmniPvd() :
mLoader (NULL),
mFileWriteStream(NULL),
mWriter (NULL),
mPhysXSampler (NULL)
{
}
NpOmniPvd::~NpOmniPvd()
{
#if PX_SUPPORT_OMNI_PVD
if (mFileWriteStream)
{
mFileWriteStream->closeStream();
mLoader->mDestroyOmniPvdFileWriteStream(*mFileWriteStream);
mFileWriteStream = NULL;
}
if (mWriter)
{
mLoader->mDestroyOmniPvdWriter(*mWriter);
mWriter = NULL;
}
if (mLoader)
{
mLoader->~OmniPvdLoader();
PX_FREE(mLoader);
mLoader = NULL;
}
#endif
}
void NpOmniPvd::destroyInstance()
{
PX_ASSERT(mInstance != NULL);
if (mInstance->mRefCount == 1)
{
mInstance->~NpOmniPvd();
PX_FREE(mInstance);
mInstance = NULL;
}
}
// Called once by physx::PxOmniPvd* PxCreateOmniPvd(...)
// Called once by NpPhysics::NpPhysics(...)
void NpOmniPvd::incRefCount()
{
PX_ASSERT(mInstance != NULL);
NpOmniPvd::mRefCount++;
}
// Called once by the Physics destructor in NpPhysics::~NpPhysics(...)
void NpOmniPvd::decRefCount()
{
PX_ASSERT(mInstance != NULL);
if (NpOmniPvd::mRefCount > 0)
{
NpOmniPvd::mRefCount--;
}
}
void NpOmniPvd::release()
{
NpOmniPvd::destroyInstance();
}
bool NpOmniPvd::initOmniPvd()
{
#if PX_SUPPORT_OMNI_PVD
if (mLoader)
{
return true;
}
mLoader = PX_PLACEMENT_NEW(PX_ALLOC(sizeof(OmniPvdLoader), "OmniPvdLoader"), OmniPvdLoader)();
if (!mLoader)
{
return false;
}
bool success;
#if PX_WIN64
success = mLoader->loadOmniPvd("PVDRuntime_64.dll");
#else
success = mLoader->loadOmniPvd("libPVDRuntime_64.so");
#endif
return success;
#else
return true;
#endif
}
OmniPvdWriter* NpOmniPvd::getWriter()
{
return blockingWriterLoad();
}
OmniPvdWriter* NpOmniPvd::blockingWriterLoad()
{
#if PX_SUPPORT_OMNI_PVD
PxMutex::ScopedLock lock(mWriterLoadMutex);
if (mWriter)
{
return mWriter;
}
if (mLoader == NULL)
{
return NULL;
}
mWriter = mLoader->mCreateOmniPvdWriter();
return mWriter;
#else
return NULL;
#endif
}
OmniPvdWriter* NpOmniPvd::acquireExclusiveWriterAccess()
{
#if PX_SUPPORT_OMNI_PVD
mMutex.lock();
return blockingWriterLoad();
#else
return NULL;
#endif
}
void NpOmniPvd::releaseExclusiveWriterAccess()
{
#if PX_SUPPORT_OMNI_PVD
mMutex.unlock();
#endif
}
OmniPvdFileWriteStream* NpOmniPvd::getFileWriteStream()
{
#if PX_SUPPORT_OMNI_PVD
if (mFileWriteStream)
{
return mFileWriteStream;
}
if (mLoader == NULL)
{
return NULL;
}
mFileWriteStream = mLoader->mCreateOmniPvdFileWriteStream();
return mFileWriteStream;
#else
return NULL;
#endif
}
bool NpOmniPvd::startSampling()
{
#if PX_SUPPORT_OMNI_PVD
if (mPhysXSampler)
{
mPhysXSampler->startSampling();
return true;
}
return false;
#else
return false;
#endif
}
}
physx::PxOmniPvd* PxCreateOmniPvd(physx::PxFoundation& foundation)
{
PX_UNUSED(foundation);
#if PX_SUPPORT_OMNI_PVD
if (physx::NpOmniPvd::mInstance)
{
// No need to call this function again
//foundation.getErrorCallback()
return physx::NpOmniPvd::mInstance;
}
physx::NpOmniPvd::mInstance = PX_PLACEMENT_NEW(PX_ALLOC(sizeof(physx::NpOmniPvd), "NpOmniPvd"), physx::NpOmniPvd)();
if (physx::NpOmniPvd::mInstance)
{
if (physx::NpOmniPvd::mInstance->initOmniPvd())
{
physx::NpOmniPvd::mRefCount = 1; // Sets the reference counter to exactly 1
return physx::NpOmniPvd::mInstance;
}
else
{
physx::NpOmniPvd::mInstance->~NpOmniPvd();
PX_FREE(physx::NpOmniPvd::mInstance);
physx::NpOmniPvd::mInstance = NULL;
physx::NpOmniPvd::mRefCount = 0;
return NULL;
}
}
else
{
return NULL;
}
#else
return NULL;
#endif
}
| 5,663 | C++ | 21.83871 | 117 | 0.708105 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/omnipvd/NpOmniPvdRegistrationData.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef NP_OMNI_PVD_REGISTRATION_DATA_H
#define NP_OMNI_PVD_REGISTRATION_DATA_H
#if PX_SUPPORT_OMNI_PVD
#include "OmniPvdWriter.h"
#include "foundation/PxSimpleTypes.h"
#include "foundation/PxVec3.h"
#include "foundation/PxTransform.h"
#include "foundation/PxBounds3.h"
#include "PxSceneDesc.h" // for PxgDynamicsMemoryConfig
#include "PxActor.h"// for PxDominanceGroup
#include "PxClient.h" // for PxClientID
#include "PxMaterial.h" // for PxMaterialFlags, PxCombineMode
#include "PxRigidBody.h" // for PxRigidBodyFlags
#include "PxRigidDynamic.h" // for PxRigidDynamicLockFlags
#include "PxShape.h" // for PxShapeFlags
#include "solver/PxSolverDefs.h" // for PxArticulationMotion
#include "geometry/PxCustomGeometry.h" // for PxCustomGeometry::Callbacks
namespace physx
{
class PxAggregate;
class PxArticulationJointReducedCoordinate;
class PxArticulationReducedCoordinate;
class PxBaseMaterial;
class PxBoxGeometry;
class PxBVH;
class PxCapsuleGeometry;
class PxConvexMesh;
class PxConvexMeshGeometry;
class PxFEMClothMaterial;
class PxFEMSoftBodyMaterial;
class PxFLIPMaterial;
class PxGeometry;
class PxHeightField;
class PxHeightFieldGeometry;
class PxMPMMaterial;
class PxPBDMaterial;
class PxPhysics;
class PxPlaneGeometry;
class PxRigidActor;
class PxRigidStatic;
class PxScene;
class PxSoftBodyMesh;
class PxSphereGeometry;
class PxTetrahedronMesh;
class PxTetrahedronMeshGeometry;
class PxTolerancesScale;
class PxTriangleMesh;
class PxTriangleMeshGeometry;
struct OmniPvdPxCoreRegistrationData
{
void registerData(OmniPvdWriter&);
// auto-generate members and setter methods from object definition file
#include "omnipvd/CmOmniPvdAutoGenCreateRegistrationStruct.h"
#include "OmniPvdTypes.h"
#include "omnipvd/CmOmniPvdAutoGenClearDefines.h"
};
}
#endif // PX_SUPPORT_OMNI_PVD
#endif // NP_OMNI_PVD_REGISTRATION_DATA_H
| 3,554 | C | 33.852941 | 74 | 0.791221 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/omnipvd/OmniPvdChunkAlloc.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "OmniPvdChunkAlloc.h"
#include <string.h> // memcpy
#include "foundation/PxAllocator.h"
OmniPvdChunkElement::OmniPvdChunkElement()
{
}
OmniPvdChunkElement::~OmniPvdChunkElement()
{
}
OmniPvdChunk::OmniPvdChunk() :
mData (NULL),
mNbrBytesAllocated (0),
mNbrBytesFree (0),
mBytePtr (NULL),
mNextChunk (NULL)
{
}
OmniPvdChunk::~OmniPvdChunk()
{
PX_FREE(mData);
}
void OmniPvdChunk::resetChunk(int nbrBytes)
{
if (nbrBytes>mNbrBytesAllocated)
{
PX_FREE(mData);
mData = static_cast<unsigned char*>(PX_ALLOC(sizeof(unsigned char)*(nbrBytes), "m_data"));
mNbrBytesAllocated=nbrBytes;
}
mNbrBytesFree=mNbrBytesAllocated;
mBytePtr=mData;
}
int OmniPvdChunk::nbrBytesUSed()
{
return mNbrBytesAllocated-mNbrBytesFree;
}
OmniPvdChunkList::OmniPvdChunkList()
{
resetList();
}
OmniPvdChunkList::~OmniPvdChunkList()
{
}
void OmniPvdChunkList::resetList()
{
mFirstChunk=0;
mLastChunk=0;
mNbrChunks=0;
}
OmniPvdChunk* OmniPvdChunkList::removeFirst()
{
if (mFirstChunk)
{
OmniPvdChunk* chunk=mFirstChunk;
mFirstChunk=mFirstChunk->mNextChunk;
if (!mFirstChunk)
{ // Did we remove the last one?
mLastChunk=NULL;
}
chunk->mNextChunk=NULL;
mNbrChunks--;
return chunk;
}
else
{
return 0;
}
}
void OmniPvdChunkList::appendList(OmniPvdChunkList* list)
{
if (!list) return;
if (list->mNbrChunks==0) return;
if (list->mFirstChunk==NULL) return;
if (mFirstChunk)
{
mLastChunk->mNextChunk=list->mFirstChunk;
mLastChunk=list->mLastChunk;
} else
{
mFirstChunk=list->mFirstChunk;
mLastChunk=list->mLastChunk;
}
mNbrChunks+=list->mNbrChunks;
list->resetList();
}
void OmniPvdChunkList::appendChunk(OmniPvdChunk* chunk)
{
if (!chunk) return;
if (mFirstChunk)
{
mLastChunk->mNextChunk=chunk;
mLastChunk=chunk;
} else
{
mFirstChunk=chunk;
mLastChunk=chunk;
}
chunk->mNextChunk=NULL;
mNbrChunks++;
}
OmniPvdChunkPool::OmniPvdChunkPool()
{
mNbrAllocatedChunks = 0;
mChunkSize = 65536; // random default value :-)
}
OmniPvdChunkPool::~OmniPvdChunkPool()
{
OmniPvdChunk* chunk=mFreeChunks.mFirstChunk;
while (chunk)
{
OmniPvdChunk* nextChunk=chunk->mNextChunk;
PX_DELETE(chunk);
chunk=nextChunk;
}
mNbrAllocatedChunks = 0;
}
void OmniPvdChunkPool::setChunkSize(int chunkSize)
{
if (mNbrAllocatedChunks > 0) return; // makes it impossible to re-set the size of a chunk once a chunk was already allocated
mChunkSize = chunkSize;
}
OmniPvdChunk* OmniPvdChunkPool::getChunk()
{
OmniPvdChunk* chunk=mFreeChunks.removeFirst();
if (!chunk)
{
chunk= PX_NEW(OmniPvdChunk);
mNbrAllocatedChunks++;
}
chunk->resetChunk(mChunkSize);
return chunk;
}
OmniPvdChunkByteAllocator::OmniPvdChunkByteAllocator()
{
mPool = NULL;
}
OmniPvdChunkByteAllocator::~OmniPvdChunkByteAllocator()
{
freeChunks();
}
OmniPvdChunkElement* OmniPvdChunkByteAllocator::allocChunkElement(int totalStructSize)
{
return reinterpret_cast<OmniPvdChunkElement*>(allocBytes(totalStructSize));
}
void OmniPvdChunkByteAllocator::setPool(OmniPvdChunkPool* pool)
{
mPool = pool;
}
unsigned char* OmniPvdChunkByteAllocator::allocBytes(int nbrBytes)
{
if (!mPool) return 0;
if (mPool->mChunkSize < nbrBytes)
{
return 0; // impossible request!
}
if (mUsedChunks.mLastChunk)
{ // If a chunk is free
if (mUsedChunks.mLastChunk->mNbrBytesFree< nbrBytes)
{
// The last chunk has not enough space, so get a fresh one from the pool
mUsedChunks.appendChunk(mPool->getChunk());
}
}
else
{ // No last chunk is available, allocate a fresh one
mUsedChunks.appendChunk(mPool->getChunk());
}
// Use the last chunk to allocate the data necessary
unsigned char* pSubChunk=mUsedChunks.mLastChunk->mBytePtr;
mUsedChunks.mLastChunk->mNbrBytesFree-= nbrBytes;
mUsedChunks.mLastChunk->mBytePtr+= nbrBytes;
return pSubChunk;
}
void OmniPvdChunkByteAllocator::freeChunks()
{
if (!mPool) return;
mPool->mFreeChunks.appendList(&mUsedChunks);
}
| 5,619 | C++ | 23.541485 | 125 | 0.745862 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/omnipvd/OmniPvdPxSampler.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#if PX_SUPPORT_OMNI_PVD
#include <stdio.h>
#include "foundation/PxPreprocessor.h"
#include "foundation/PxAllocator.h"
#include "ScIterators.h"
#include "omnipvd/NpOmniPvd.h"
#include "OmniPvdPxSampler.h"
#include "OmniPvdWriteStream.h"
#include "NpOmniPvdSetData.h"
#include "NpPhysics.h"
#include "NpScene.h"
#include "NpAggregate.h"
#include "NpRigidStatic.h"
#include "NpArticulationJointReducedCoordinate.h"
#include "NpArticulationLink.h"
using namespace physx;
class OmniPvdStreamContainer
{
public:
OmniPvdStreamContainer();
~OmniPvdStreamContainer();
bool initOmniPvd();
void registerClasses();
void setOmniPvdInstance(NpOmniPvd* omniPvdInstance);
NpOmniPvd* mOmniPvdInstance;
physx::PxMutex mMutex;
OmniPvdPxCoreRegistrationData mRegistrationData;
bool mClassesRegistered;
};
class OmniPvdSamplerInternals : public physx::PxUserAllocated
{
public:
OmniPvdStreamContainer mPvdStream;
bool addSharedMeshIfNotSeen(const void* geom, OmniPvdSharedMeshEnum geomEnum); // Returns true if the Geom was not yet seen and added
physx::PxMutex mSampleMutex;
bool mIsSampling;
physx::PxMutex mSampledScenesMutex;
physx::PxHashMap<physx::NpScene*, OmniPvdPxScene*> mSampledScenes;
physx::PxMutex mSharedGeomsMutex;
physx::PxHashMap<const void*, OmniPvdSharedMeshEnum> mSharedMeshesMap;
};
OmniPvdSamplerInternals * samplerInternals = NULL;
class OmniPvdPxScene : public physx::PxUserAllocated
{
public:
OmniPvdPxScene() : mFrameId(0) {}
~OmniPvdPxScene() {}
void sampleScene()
{
mFrameId++;
samplerInternals->mPvdStream.mOmniPvdInstance->getWriter()->startFrame(OMNI_PVD_CONTEXT_HANDLE, mFrameId);
}
physx::PxU64 mFrameId;
};
OmniPvdStreamContainer::OmniPvdStreamContainer()
{
physx::PxMutex::ScopedLock myLock(mMutex);
mClassesRegistered = false;
mOmniPvdInstance = NULL;
}
OmniPvdStreamContainer::~OmniPvdStreamContainer()
{
}
void OmniPvdStreamContainer::setOmniPvdInstance(NpOmniPvd* omniPvdInstance)
{
mOmniPvdInstance = omniPvdInstance;
}
bool OmniPvdStreamContainer::initOmniPvd()
{
physx::PxMutex::ScopedLock myLock(mMutex);
registerClasses();
PxPhysics& physicsRef = static_cast<PxPhysics&>(NpPhysics::getInstance());
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_CREATE_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxPhysics, physicsRef);
const physx::PxTolerancesScale& tolScale = physicsRef.getTolerancesScale();
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxPhysics, tolerancesScale, physicsRef, tolScale);
OMNI_PVD_WRITE_SCOPE_END
return true;
}
void OmniPvdStreamContainer::registerClasses()
{
if (mClassesRegistered) return;
OmniPvdWriter* writer = mOmniPvdInstance->acquireExclusiveWriterAccess();
if (writer)
{
mRegistrationData.registerData(*writer);
mClassesRegistered = true;
}
mOmniPvdInstance->releaseExclusiveWriterAccess();
}
int streamStringLength(const char* name)
{
#if PX_SUPPORT_OMNI_PVD
if (NpPhysics::getInstance().mOmniPvdSampler == NULL)
{
return 0;
}
if (name == NULL)
{
return 0;
}
int len = static_cast<int>(strlen(name));
if (len > 0)
{
return len;
}
else
{
return 0;
}
#else
return 0;
#endif
}
void streamActorName(const physx::PxActor & a, const char* name)
{
#if PX_SUPPORT_OMNI_PVD
int strLen = streamStringLength(name);
if (strLen)
{
OMNI_PVD_SET_ARRAY(OMNI_PVD_CONTEXT_HANDLE, PxActor, name, a, name, strLen + 1); // copies over the trailing zero too
}
#endif
}
void streamSceneName(const physx::PxScene & s, const char* name)
{
#if PX_SUPPORT_OMNI_PVD
int strLen = streamStringLength(name);
if (strLen)
{
OMNI_PVD_SET_ARRAY(OMNI_PVD_CONTEXT_HANDLE, PxScene, name, s, name, strLen + 1); // copies over the trailing zero too
}
#endif
}
void streamSphereGeometry(const physx::PxSphereGeometry& g)
{
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_CREATE_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxSphereGeometry, g);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxSphereGeometry, radius, g, g.radius);
OMNI_PVD_WRITE_SCOPE_END
}
void streamCapsuleGeometry(const physx::PxCapsuleGeometry& g)
{
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_CREATE_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxCapsuleGeometry, g);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxCapsuleGeometry, halfHeight, g, g.halfHeight);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxCapsuleGeometry, radius, g, g.radius);
OMNI_PVD_WRITE_SCOPE_END
}
void streamBoxGeometry(const physx::PxBoxGeometry& g)
{
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_CREATE_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxBoxGeometry, g);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxBoxGeometry, halfExtents, g, g.halfExtents);
OMNI_PVD_WRITE_SCOPE_END
}
void streamPlaneGeometry(const physx::PxPlaneGeometry& g)
{
OMNI_PVD_CREATE(OMNI_PVD_CONTEXT_HANDLE, PxPlaneGeometry, g);
}
void streamCustomGeometry(const physx::PxCustomGeometry& g)
{
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_CREATE_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxCustomGeometry, g);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxCustomGeometry, callbacks, g, g.callbacks);
OMNI_PVD_WRITE_SCOPE_END
}
void streamConvexMesh(const physx::PxConvexMesh& mesh)
{
if (samplerInternals->addSharedMeshIfNotSeen(&mesh, OmniPvdSharedMeshEnum::eOmniPvdConvexMesh))
{
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_CREATE_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxConvexMesh, mesh);
const PxU32 nbPolys = mesh.getNbPolygons();
const PxU8* polygons = mesh.getIndexBuffer();
const PxVec3* verts = mesh.getVertices();
const PxU32 nbrVerts = mesh.getNbVertices();
PxU32 totalTris = 0;
for (PxU32 i = 0; i < nbPolys; i++)
{
physx::PxHullPolygon data;
mesh.getPolygonData(i, data);
totalTris += data.mNbVerts - 2;
}
float* tmpVerts = (float*)PX_ALLOC(sizeof(float)*(nbrVerts * 3), "tmpVerts");
PxU32* tmpIndices = (PxU32*)PX_ALLOC(sizeof(PxU32)*(totalTris * 3), "tmpIndices");
//TODO: this copy is useless
PxU32 vertIndex = 0;
for (PxU32 v = 0; v < nbrVerts; v++)
{
tmpVerts[vertIndex + 0] = verts[v].x;
tmpVerts[vertIndex + 1] = verts[v].y;
tmpVerts[vertIndex + 2] = verts[v].z;
vertIndex += 3;
}
PxU32 triIndex = 0;
for (PxU32 p = 0; p < nbPolys; p++)
{
physx::PxHullPolygon data;
mesh.getPolygonData(p, data);
PxU32 nbTris = data.mNbVerts - 2;
const PxU32 vref0 = polygons[data.mIndexBase + 0 + 0];
for (PxU32 t = 0; t < nbTris; t++)
{
const PxU32 vref1 = polygons[data.mIndexBase + t + 1];
const PxU32 vref2 = polygons[data.mIndexBase + t + 2];
tmpIndices[triIndex + 0] = vref0;
tmpIndices[triIndex + 1] = vref1;
tmpIndices[triIndex + 2] = vref2;
triIndex += 3;
}
}
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxConvexMesh, verts, mesh, tmpVerts, 3 * nbrVerts);
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxConvexMesh, tris, mesh, tmpIndices, 3 * totalTris);
PX_FREE(tmpVerts);
PX_FREE(tmpIndices);
OMNI_PVD_WRITE_SCOPE_END
}
}
void streamConvexMeshGeometry(const physx::PxConvexMeshGeometry& g)
{
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_CREATE_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxConvexMeshGeometry, g);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxConvexMeshGeometry, scale, g, g.scale.scale);
streamConvexMesh(*g.convexMesh);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxConvexMeshGeometry, convexMesh, g, g.convexMesh);
OMNI_PVD_WRITE_SCOPE_END
}
void streamHeightField(const physx::PxHeightField& hf)
{
if (samplerInternals->addSharedMeshIfNotSeen(&hf, OmniPvdSharedMeshEnum::eOmniPvdHeightField))
{
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_CREATE_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxHeightField, hf);
const PxU32 nbCols = hf.getNbColumns();
const PxU32 nbRows = hf.getNbRows();
const PxU32 nbVerts = nbRows * nbCols;
const PxU32 nbFaces = (nbCols - 1) * (nbRows - 1) * 2;
physx::PxHeightFieldSample* sampleBuffer = (physx::PxHeightFieldSample*)PX_ALLOC(sizeof(physx::PxHeightFieldSample)*(nbVerts), "sampleBuffer");
hf.saveCells(sampleBuffer, nbVerts * sizeof(physx::PxHeightFieldSample));
//TODO: are the copies necessary?
float* tmpVerts = (float*)PX_ALLOC(sizeof(float)*(nbVerts * 3), "tmpVerts");
PxU32* tmpIndices = (PxU32*)PX_ALLOC(sizeof(PxU32)*(nbFaces * 3), "tmpIndices");
for (PxU32 i = 0; i < nbRows; i++)
{
for (PxU32 j = 0; j < nbCols; j++)
{
const float x = PxReal(i);// *rs;
const float y = PxReal(sampleBuffer[j + (i*nbCols)].height);// *hs;
const float z = PxReal(j);// *cs;
const PxU32 vertexIndex = 3 * (i * nbCols + j);
float* vert = &tmpVerts[vertexIndex];
vert[0] = x;
vert[1] = y;
vert[2] = z;
}
}
for (PxU32 i = 0; i < (nbCols - 1); ++i)
{
for (PxU32 j = 0; j < (nbRows - 1); ++j)
{
PxU8 tessFlag = sampleBuffer[i + j * nbCols].tessFlag();
PxU32 i0 = j * nbCols + i;
PxU32 i1 = j * nbCols + i + 1;
PxU32 i2 = (j + 1) * nbCols + i;
PxU32 i3 = (j + 1) * nbCols + i + 1;
// i2---i3
// | |
// | |
// i0---i1
// this is really a corner vertex index, not triangle index
PxU32 mat0 = hf.getTriangleMaterialIndex((j*nbCols + i) * 2);
PxU32 mat1 = hf.getTriangleMaterialIndex((j*nbCols + i) * 2 + 1);
bool hole0 = (mat0 == PxHeightFieldMaterial::eHOLE);
bool hole1 = (mat1 == PxHeightFieldMaterial::eHOLE);
// first triangle
tmpIndices[6 * (i * (nbRows - 1) + j) + 0] = hole0 ? i0 : i2; // duplicate i0 to make a hole
tmpIndices[6 * (i * (nbRows - 1) + j) + 1] = i0;
tmpIndices[6 * (i * (nbRows - 1) + j) + 2] = tessFlag ? i3 : i1;
// second triangle
tmpIndices[6 * (i * (nbRows - 1) + j) + 3] = hole1 ? i1 : i3; // duplicate i1 to make a hole
tmpIndices[6 * (i * (nbRows - 1) + j) + 4] = tessFlag ? i0 : i2;
tmpIndices[6 * (i * (nbRows - 1) + j) + 5] = i1;
}
}
PX_FREE(sampleBuffer);
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxHeightField, verts, hf, tmpVerts, 3 * nbVerts);
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxHeightField, tris, hf, tmpIndices, 3 * nbFaces);
PX_FREE(tmpVerts);
PX_FREE(tmpIndices);
OMNI_PVD_WRITE_SCOPE_END
}
}
void streamHeightFieldGeometry(const physx::PxHeightFieldGeometry& g)
{
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_CREATE_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxHeightFieldGeometry, g);
PxVec3 vertScale(g.rowScale, g.heightScale, g.columnScale);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxHeightFieldGeometry, scale, g, vertScale);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxHeightFieldGeometry, heightField, g, g.heightField);
OMNI_PVD_WRITE_SCOPE_END
}
void streamActorAttributes(const physx::PxActor& actor)
{
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxActor, flags, actor, actor.getActorFlags());
streamActorName(actor, actor.getName());
// Should we stream the worldBounds if the actor is not part of a Scene yet?
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxActor, worldBounds, actor, actor.getWorldBounds())
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxActor, dominance, actor, actor.getDominanceGroup())
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxActor, ownerClient, actor, actor.getOwnerClient())
OMNI_PVD_WRITE_SCOPE_END
}
void streamRigidActorAttributes(const PxRigidActor &ra)
{
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
if (ra.is<PxArticulationLink>())
{
const PxArticulationLink& link = static_cast<const PxArticulationLink&>(ra);
PxTransform TArtLinkLocal;
PxArticulationJointReducedCoordinate* joint = link.getInboundJoint();
if (joint)
{
PxArticulationLink& parentLink = joint->getParentArticulationLink();
// TGlobal = TFatherGlobal * TLocal
// Inv(TFatherGlobal)* TGlobal = Inv(TFatherGlobal)*TFatherGlobal * TLocal
// Inv(TFatherGlobal)* TGlobal = TLocal
// TLocal = Inv(TFatherGlobal) * TGlobal
//physx::PxTransform TParentGlobal = pxArticulationParentLink->getGlobalPose();
PxTransform TParentGlobalInv = parentLink.getGlobalPose().getInverse();
PxTransform TArtLinkGlobal = link.getGlobalPose();
// PT:: tag: scalar transform*transform
TArtLinkLocal = TParentGlobalInv * TArtLinkGlobal;
}
else
{
TArtLinkLocal = link.getGlobalPose();
}
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidActor, translation, ra, TArtLinkLocal.p)
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidActor, rotation, ra, TArtLinkLocal.q)
}
else
{
PxTransform t = ra.getGlobalPose();
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidActor, translation, ra, t.p);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidActor, rotation, ra, t.q);
}
// Stream shapes too
const int nbrShapes = ra.getNbShapes();
for (int s = 0; s < nbrShapes; s++)
{
PxShape* shape[1];
ra.getShapes(shape, 1, s);
OMNI_PVD_ADD_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidActor, shapes, ra, *shape[0])
}
OMNI_PVD_WRITE_SCOPE_END
}
void streamRigidBodyAttributes(const physx::PxRigidBody& rigidBody)
{
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidBody, cMassLocalPose, rigidBody, rigidBody.getCMassLocalPose());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidBody, mass, rigidBody, rigidBody.getMass());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidBody, massSpaceInertiaTensor, rigidBody, rigidBody.getMassSpaceInertiaTensor());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidBody, linearDamping, rigidBody, rigidBody.getLinearDamping());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidBody, angularDamping, rigidBody, rigidBody.getAngularDamping());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidBody, linearVelocity, rigidBody, rigidBody.getLinearVelocity());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidBody, angularVelocity, rigidBody, rigidBody.getAngularVelocity());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidBody, maxLinearVelocity, rigidBody, rigidBody.getMaxLinearVelocity());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidBody, maxAngularVelocity, rigidBody, rigidBody.getMaxAngularVelocity());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidBody, rigidBodyFlags, rigidBody, rigidBody.getRigidBodyFlags());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidBody, minAdvancedCCDCoefficient, rigidBody, rigidBody.getMinCCDAdvanceCoefficient());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidBody, maxDepenetrationVelocity, rigidBody, rigidBody.getMaxDepenetrationVelocity());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidBody, maxContactImpulse, rigidBody, rigidBody.getMaxContactImpulse());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidBody, contactSlopCoefficient, rigidBody, rigidBody.getContactSlopCoefficient());
OMNI_PVD_WRITE_SCOPE_END
}
void streamRigidDynamicAttributes(const physx::PxRigidDynamic& rd)
{
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
if (rd.getScene())
{
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidDynamic, isSleeping, rd, rd.isSleeping());
}
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidDynamic, sleepThreshold, rd, rd.getSleepThreshold());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidDynamic, stabilizationThreshold, rd, rd.getStabilizationThreshold());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidDynamic, rigidDynamicLockFlags, rd, rd.getRigidDynamicLockFlags());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidDynamic, wakeCounter, rd, rd.getWakeCounter());
PxU32 positionIters, velocityIters; rd.getSolverIterationCounts(positionIters, velocityIters);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidDynamic, positionIterations, rd, positionIters);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidDynamic, velocityIterations, rd, velocityIters);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidDynamic, contactReportThreshold, rd, rd.getContactReportThreshold());
OMNI_PVD_WRITE_SCOPE_END
}
void streamRigidDynamic(const physx::PxRigidDynamic& rd)
{
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
const PxActor& a = rd;
PX_ASSERT(&a == &rd); // if this changes, we would have to cast in a way such that the addresses are the same
OMNI_PVD_CREATE_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidDynamic, rd);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxActor, type, a, PxActorType::eRIGID_DYNAMIC);
OMNI_PVD_WRITE_SCOPE_END
streamActorAttributes(rd);
streamRigidActorAttributes(rd);
streamRigidBodyAttributes(rd);
streamRigidDynamicAttributes(rd);
}
void streamRigidStatic(const physx::PxRigidStatic& rs)
{
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
const PxActor& a = rs;
PX_ASSERT(&a == &rs); // if this changes, we would have to cast in a way such that the addresses are the same
OMNI_PVD_CREATE_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxRigidStatic, rs);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxActor, type, a, PxActorType::eRIGID_STATIC);
OMNI_PVD_WRITE_SCOPE_END
streamActorAttributes(rs);
streamRigidActorAttributes(rs);
}
void streamArticulationJoint(const physx::PxArticulationJointReducedCoordinate& jointRef)
{
const PxU32 degreesOfFreedom = PxArticulationAxis::eCOUNT;
// make sure size matches the size used in the PVD description
PX_ASSERT(sizeof(PxArticulationMotion::Enum) == getOmniPvdDataTypeSize<OmniPvdDataType::eUINT32>());
PX_ASSERT(sizeof(PxArticulationDriveType::Enum) == getOmniPvdDataTypeSize<OmniPvdDataType::eUINT32>());
PxArticulationJointType::Enum jointType = jointRef.getJointType();
const PxArticulationLink* parentPxLinkPtr = &jointRef.getParentArticulationLink();
const PxArticulationLink* childPxLinkPtr = &jointRef.getChildArticulationLink();
PxArticulationMotion::Enum motions[degreesOfFreedom];
for (PxU32 ax = 0; ax < degreesOfFreedom; ++ax)
motions[ax] = jointRef.getMotion(static_cast<PxArticulationAxis::Enum>(ax));
PxReal armatures[degreesOfFreedom];
for (PxU32 ax = 0; ax < degreesOfFreedom; ++ax)
armatures[ax] = jointRef.getArmature(static_cast<PxArticulationAxis::Enum>(ax));
PxReal coefficient = jointRef.getFrictionCoefficient();
PxReal maxJointV = jointRef.getMaxJointVelocity();
PxReal positions[degreesOfFreedom];
for (PxU32 ax = 0; ax < degreesOfFreedom; ++ax)
positions[ax] = jointRef.getJointPosition(static_cast<PxArticulationAxis::Enum>(ax));
PxReal velocitys[degreesOfFreedom];
for (PxU32 ax = 0; ax < degreesOfFreedom; ++ax)
velocitys[ax] = jointRef.getJointVelocity(static_cast<PxArticulationAxis::Enum>(ax));
const char* concreteTypeName = jointRef.getConcreteTypeName();
PxU32 concreteTypeNameLen = PxU32(strlen(concreteTypeName)) + 1;
PxReal lowlimits[degreesOfFreedom];
for (PxU32 ax = 0; ax < degreesOfFreedom; ++ax)
lowlimits[ax] = jointRef.getLimitParams(static_cast<PxArticulationAxis::Enum>(ax)).low;
PxReal highlimits[degreesOfFreedom];
for (PxU32 ax = 0; ax < degreesOfFreedom; ++ax)
highlimits[ax] = jointRef.getLimitParams(static_cast<PxArticulationAxis::Enum>(ax)).high;
PxReal stiffnesss[degreesOfFreedom];
for (PxU32 ax = 0; ax < degreesOfFreedom; ++ax)
stiffnesss[ax] = jointRef.getDriveParams(static_cast<PxArticulationAxis::Enum>(ax)).stiffness;
PxReal dampings[degreesOfFreedom];
for (PxU32 ax = 0; ax < degreesOfFreedom; ++ax)
dampings[ax] = jointRef.getDriveParams(static_cast<PxArticulationAxis::Enum>(ax)).damping;
PxReal maxforces[degreesOfFreedom];
for (PxU32 ax = 0; ax < degreesOfFreedom; ++ax)
maxforces[ax] = jointRef.getDriveParams(static_cast<PxArticulationAxis::Enum>(ax)).maxForce;
PxArticulationDriveType::Enum drivetypes[degreesOfFreedom];
for (PxU32 ax = 0; ax < degreesOfFreedom; ++ax)
drivetypes[ax] = jointRef.getDriveParams(static_cast<PxArticulationAxis::Enum>(ax)).driveType;
PxReal drivetargets[degreesOfFreedom];
for (PxU32 ax = 0; ax < degreesOfFreedom; ++ax)
drivetargets[ax] = jointRef.getDriveTarget(static_cast<PxArticulationAxis::Enum>(ax));
PxReal drivevelocitys[degreesOfFreedom];
for (PxU32 ax = 0; ax < degreesOfFreedom; ++ax)
drivevelocitys[ax] = jointRef.getDriveVelocity(static_cast<PxArticulationAxis::Enum>(ax));
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_CREATE_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationJointReducedCoordinate, jointRef);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationJointReducedCoordinate, type, jointRef, jointType);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationJointReducedCoordinate, parentLink, jointRef, parentPxLinkPtr);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationJointReducedCoordinate, childLink, jointRef, childPxLinkPtr);
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationJointReducedCoordinate, motion, jointRef, motions, degreesOfFreedom);
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationJointReducedCoordinate, armature, jointRef, armatures, degreesOfFreedom);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationJointReducedCoordinate, frictionCoefficient, jointRef, coefficient);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationJointReducedCoordinate, maxJointVelocity, jointRef, maxJointV);
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationJointReducedCoordinate, jointPosition, jointRef, positions, degreesOfFreedom);
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationJointReducedCoordinate, jointVelocity, jointRef, velocitys, degreesOfFreedom);
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationJointReducedCoordinate, concreteTypeName, jointRef, concreteTypeName, concreteTypeNameLen);
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationJointReducedCoordinate, limitLow, jointRef, lowlimits, degreesOfFreedom);
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationJointReducedCoordinate, limitHigh, jointRef, highlimits, degreesOfFreedom);
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationJointReducedCoordinate, driveStiffness, jointRef, stiffnesss, degreesOfFreedom);
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationJointReducedCoordinate, driveDamping, jointRef, dampings, degreesOfFreedom);
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationJointReducedCoordinate, driveMaxForce, jointRef, maxforces, degreesOfFreedom);
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationJointReducedCoordinate, driveType, jointRef, drivetypes, degreesOfFreedom);
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationJointReducedCoordinate, driveTarget, jointRef, drivetargets, degreesOfFreedom);
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationJointReducedCoordinate, driveVelocity, jointRef, drivevelocitys, degreesOfFreedom);
OMNI_PVD_WRITE_SCOPE_END
}
void streamArticulationLink(const physx::PxArticulationLink& al)
{
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
const PxActor& a = al;
PX_ASSERT(&a == &al); // if this changes, we would have to cast in a way such that the addresses are the same
OMNI_PVD_CREATE_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationLink, al);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxActor, type, a, PxActorType::eARTICULATION_LINK);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationLink, articulation, al, &al.getArticulation());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationLink, CFMScale, al, al.getCfmScale());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationLink, inboundJointDOF, al, al.getInboundJointDof());
OMNI_PVD_WRITE_SCOPE_END
streamActorAttributes(al);
streamRigidActorAttributes(al);
streamRigidBodyAttributes(al);
}
void streamArticulation(const physx::PxArticulationReducedCoordinate& art)
{
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_CREATE_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationReducedCoordinate, art);
PxU32 solverIterations[2]; art.getSolverIterationCounts(solverIterations[0], solverIterations[1]);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationReducedCoordinate, positionIterations, art, solverIterations[0]);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationReducedCoordinate, velocityIterations, art, solverIterations[1]);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationReducedCoordinate, isSleeping, art, false);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationReducedCoordinate, sleepThreshold, art, art.getSleepThreshold());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationReducedCoordinate, stabilizationThreshold, art, art.getStabilizationThreshold());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationReducedCoordinate, wakeCounter, art, art.getWakeCounter());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationReducedCoordinate, maxLinearVelocity, art, art.getMaxCOMLinearVelocity());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationReducedCoordinate, maxAngularVelocity, art, art.getMaxCOMAngularVelocity());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationReducedCoordinate, worldBounds, art, art.getWorldBounds());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationReducedCoordinate, articulationFlags, art, art.getArticulationFlags());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxArticulationReducedCoordinate, dofs, art, art.getDofs());
OMNI_PVD_WRITE_SCOPE_END
}
void streamAggregate(const physx::PxAggregate& agg)
{
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_CREATE_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxAggregate, agg);
PxU32 actorCount = agg.getNbActors();
for (PxU32 i = 0; i < actorCount; ++i)
{
PxActor* a; agg.getActors(&a, 1, i);
OMNI_PVD_ADD_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxAggregate, actors, agg, *a);
}
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxAggregate, selfCollision, agg, agg.getSelfCollision());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxAggregate, maxNbShapes, agg, agg.getMaxNbShapes());
PxScene* scene = static_cast<const NpAggregate&>(agg).getNpScene(); // because PxAggregate::getScene() is not marked const
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxAggregate, scene, agg, scene);
OMNI_PVD_WRITE_SCOPE_END
}
void streamMPMMaterial(const physx::PxMPMMaterial& m)
{
OMNI_PVD_CREATE(OMNI_PVD_CONTEXT_HANDLE, PxMPMMaterial, m);
}
void streamFLIPMaterial(const physx::PxFLIPMaterial& m)
{
OMNI_PVD_CREATE(OMNI_PVD_CONTEXT_HANDLE, PxFLIPMaterial, m);
}
void streamPBDMaterial(const physx::PxPBDMaterial& m)
{
OMNI_PVD_CREATE(OMNI_PVD_CONTEXT_HANDLE, PxPBDMaterial, m);
}
void streamFEMClothMaterial(const physx::PxFEMClothMaterial& m)
{
OMNI_PVD_CREATE(OMNI_PVD_CONTEXT_HANDLE, PxFEMClothMaterial, m);
}
void streamFEMSoBoMaterial(const physx::PxFEMSoftBodyMaterial& m)
{
OMNI_PVD_CREATE(OMNI_PVD_CONTEXT_HANDLE, PxFEMSoftBodyMaterial, m);
}
void streamMaterial(const physx::PxMaterial& m)
{
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_CREATE_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxMaterial, m);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxMaterial, flags, m, m.getFlags());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxMaterial, frictionCombineMode, m, m.getFrictionCombineMode());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxMaterial, restitutionCombineMode, m, m.getRestitutionCombineMode());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxMaterial, staticFriction, m, m.getStaticFriction());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxMaterial, dynamicFriction, m, m.getDynamicFriction());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxMaterial, restitution, m, m.getRestitution());
OMNI_PVD_WRITE_SCOPE_END
}
void streamShapeMaterials(const physx::PxShape& shape, physx::PxMaterial* const * mats, physx::PxU32 nbrMaterials)
{
OMNI_PVD_SET_ARRAY(OMNI_PVD_CONTEXT_HANDLE, PxShape, materials, shape, mats, nbrMaterials);
}
void streamShapeMaterials(const physx::PxShape& shape, physx::PxFEMClothMaterial* const * mats, physx::PxU32 nbrMaterials)
{
PX_UNUSED(shape);
PX_UNUSED(mats);
PX_UNUSED(nbrMaterials);
}
void streamShapeMaterials(const physx::PxShape& shape, physx::PxFEMMaterial* const * mats, physx::PxU32 nbrMaterials)
{
PX_UNUSED(shape);
PX_UNUSED(mats);
PX_UNUSED(nbrMaterials);
}
void streamShapeMaterials(const physx::PxShape& shape, physx::PxFEMSoftBodyMaterial* const * mats, physx::PxU32 nbrMaterials)
{
PX_UNUSED(shape);
PX_UNUSED(mats);
PX_UNUSED(nbrMaterials);
}
void streamShapeMaterials(const physx::PxShape& shape, physx::PxFLIPMaterial* const * mats, physx::PxU32 nbrMaterials)
{
PX_UNUSED(shape);
PX_UNUSED(mats);
PX_UNUSED(nbrMaterials);
}
void streamShapeMaterials(const physx::PxShape& shape, physx::PxMPMMaterial* const * mats, physx::PxU32 nbrMaterials)
{
PX_UNUSED(shape);
PX_UNUSED(mats);
PX_UNUSED(nbrMaterials);
}
void streamShapeMaterials(const physx::PxShape& shape, physx::PxParticleMaterial* const * mats, physx::PxU32 nbrMaterials)
{
PX_UNUSED(shape);
PX_UNUSED(mats);
PX_UNUSED(nbrMaterials);
}
void streamShapeMaterials(const physx::PxShape& shape, physx::PxPBDMaterial* const * mats, physx::PxU32 nbrMaterials)
{
PX_UNUSED(shape);
PX_UNUSED(mats);
PX_UNUSED(nbrMaterials);
}
void streamShape(const physx::PxShape& shape)
{
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_CREATE_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxShape, shape);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxShape, isExclusive, shape, shape.isExclusive());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxShape, geom, shape, &shape.getGeometry());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxShape, contactOffset, shape, shape.getContactOffset());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxShape, restOffset, shape, shape.getRestOffset());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxShape, densityForFluid, shape, shape.getDensityForFluid());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxShape, torsionalPatchRadius, shape, shape.getTorsionalPatchRadius());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxShape, minTorsionalPatchRadius, shape, shape.getMinTorsionalPatchRadius());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxShape, shapeFlags, shape, shape.getFlags());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxShape, simulationFilterData, shape, shape.getSimulationFilterData());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxShape, queryFilterData, shape, shape.getQueryFilterData());
const int nbrMaterials = shape.getNbMaterials();
PxMaterial** tmpMaterials = (PxMaterial**)PX_ALLOC(sizeof(PxMaterial*) * nbrMaterials, "tmpMaterials");
physx::PxU32 nbrMats = shape.getMaterials(tmpMaterials, nbrMaterials);
streamShapeMaterials(shape, tmpMaterials, nbrMats);
PX_FREE(tmpMaterials);
OMNI_PVD_WRITE_SCOPE_END
}
void streamBVH(const physx::PxBVH& bvh)
{
OMNI_PVD_CREATE(OMNI_PVD_CONTEXT_HANDLE, PxBVH, bvh);
}
void streamSoBoMesh(const physx::PxSoftBodyMesh& mesh)
{
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_CREATE_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxSoftBodyMesh, mesh);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxSoftBodyMesh, collisionMesh, mesh, mesh.getCollisionMesh());
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxSoftBodyMesh, simulationMesh, mesh, mesh.getSimulationMesh());
OMNI_PVD_WRITE_SCOPE_END
}
void streamTetMesh(const physx::PxTetrahedronMesh& mesh)
{
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_CREATE_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxTetrahedronMesh, mesh);
//this gets done at the bottom now
const PxU32 tetrahedronCount = mesh.getNbTetrahedrons();
const PxU32 has16BitIndices = mesh.getTetrahedronMeshFlags() & physx::PxTetrahedronMeshFlag::e16_BIT_INDICES;
const void* indexBuffer = mesh.getTetrahedrons();
const PxVec3* vertexBuffer = mesh.getVertices();
const PxU32* intIndices = reinterpret_cast<const PxU32*>(indexBuffer);
const PxU16* shortIndices = reinterpret_cast<const PxU16*>(indexBuffer);
//TODO: not needed to copy this
const PxU32 nbrVerts = mesh.getNbVertices();
const PxU32 nbrTets = mesh.getNbTetrahedrons();
float* tmpVerts = (float*)PX_ALLOC(sizeof(float)*(nbrVerts * 3), "tmpVerts");
PxU32 vertIndex = 0;
for (PxU32 v = 0; v < nbrVerts; v++)
{
tmpVerts[vertIndex + 0] = vertexBuffer[v].x;
tmpVerts[vertIndex + 1] = vertexBuffer[v].y;
tmpVerts[vertIndex + 2] = vertexBuffer[v].z;
vertIndex += 3;
}
PxU32* tmpIndices = (PxU32*)PX_ALLOC(sizeof(PxU32)*(nbrTets * 4), "tmpIndices");
const PxU32 totalIndexCount = tetrahedronCount * 4;
if (has16BitIndices)
{
for (PxU32 i = 0; i < totalIndexCount; ++i)
{
tmpIndices[i] = shortIndices[i];
}
}
else
{
for (PxU32 i = 0; i < totalIndexCount; ++i)
{
tmpIndices[i] = intIndices[i];
}
}
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxTetrahedronMesh, verts, mesh, tmpVerts, 3 * nbrVerts);
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxTetrahedronMesh, tets, mesh, tmpIndices, 4 * nbrTets);
PX_FREE(tmpVerts);
PX_FREE(tmpIndices);
OMNI_PVD_WRITE_SCOPE_END
}
void streamTriMesh(const physx::PxTriangleMesh& mesh)
{
if (samplerInternals->addSharedMeshIfNotSeen(&mesh, OmniPvdSharedMeshEnum::eOmniPvdTriMesh))
{
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_CREATE_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxTriangleMesh, mesh);
//this gets done at the bottom now
const PxU32 triangleCount = mesh.getNbTriangles();
const PxU32 has16BitIndices = mesh.getTriangleMeshFlags() & physx::PxTriangleMeshFlag::e16_BIT_INDICES;
const void* indexBuffer = mesh.getTriangles();
const PxVec3* vertexBuffer = mesh.getVertices();
const PxU32* intIndices = reinterpret_cast<const PxU32*>(indexBuffer);
const PxU16* shortIndices = reinterpret_cast<const PxU16*>(indexBuffer);
//TODO: not needed to copy this
const PxU32 nbrVerts = mesh.getNbVertices();
const PxU32 nbrTris = mesh.getNbTriangles();
float* tmpVerts = (float*)PX_ALLOC(sizeof(float)*(nbrVerts * 3), "tmpVerts");
PxU32 vertIndex = 0;
for (PxU32 v = 0; v < nbrVerts; v++)
{
tmpVerts[vertIndex + 0] = vertexBuffer[v].x;
tmpVerts[vertIndex + 1] = vertexBuffer[v].y;
tmpVerts[vertIndex + 2] = vertexBuffer[v].z;
vertIndex += 3;
}
PxU32* tmpIndices = (PxU32*)PX_ALLOC(sizeof(PxU32)*(nbrTris * 3), "tmpIndices");
const PxU32 totalIndexCount = triangleCount * 3;
if (has16BitIndices)
{
for (PxU32 i = 0; i < totalIndexCount; ++i)
{
tmpIndices[i] = shortIndices[i];
}
}
else
{
for (PxU32 i = 0; i < totalIndexCount; ++i)
{
tmpIndices[i] = intIndices[i];
}
}
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxTriangleMesh, verts, mesh, tmpVerts, 3 * nbrVerts);
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxTriangleMesh, tris, mesh, tmpIndices, 3 * nbrTris);
PX_FREE(tmpVerts);
PX_FREE(tmpIndices);
OMNI_PVD_WRITE_SCOPE_END
}
}
void streamTriMeshGeometry(const physx::PxTriangleMeshGeometry& g)
{
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_CREATE_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxTriangleMeshGeometry, g);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxTriangleMeshGeometry, scale, g, g.scale.scale);
streamTriMesh(*g.triangleMesh);
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxTriangleMeshGeometry, triangleMesh, g, g.triangleMesh);
OMNI_PVD_WRITE_SCOPE_END
}
void OmniPvdPxSampler::streamSceneContacts(physx::NpScene& scene)
{
if (!isSampling()) return;
PxsContactManagerOutputIterator outputIter;
Sc::ContactIterator contactIter;
scene.getScScene().initContactsIterator(contactIter, outputIter);
Sc::ContactIterator::Pair* pair;
PxU32 pairCount = 0;
PxArray<PxActor*> pairsActors;
PxArray<PxU32> pairsContactCounts;
PxArray<PxVec3> pairsContactPoints;
PxArray<PxVec3> pairsContactNormals;
PxArray<PxReal> pairsContactSeparations;
PxArray<PxShape*> pairsContactShapes;
PxArray<PxU32> pairsContactFacesIndices;
while ((pair = contactIter.getNextPair()) != NULL)
{
PxU32 pairContactCount = 0;
Sc::Contact* contact = NULL;
bool firstContact = true;
while ((contact = pair->getNextContact()) != NULL)
{
if (firstContact) {
pairsActors.pushBack(pair->getActor0());
pairsActors.pushBack(pair->getActor1());
++pairCount;
firstContact = false;
}
++pairContactCount;
pairsContactPoints.pushBack(contact->point);
pairsContactNormals.pushBack(contact->normal);
pairsContactSeparations.pushBack(contact->separation);
pairsContactShapes.pushBack(contact->shape0);
pairsContactShapes.pushBack(contact->shape1);
pairsContactFacesIndices.pushBack(contact->faceIndex0);
pairsContactFacesIndices.pushBack(contact->faceIndex1);
}
if (pairContactCount)
{
pairsContactCounts.pushBack(pairContactCount);
}
}
if (pairCount == 0) return;
OMNI_PVD_WRITE_SCOPE_BEGIN(pvdWriter, pvdRegData)
OMNI_PVD_SET_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxScene, pairCount, scene, pairCount);
const PxU32 actorCount = pairsActors.size();
const PxActor** actors = actorCount ? const_cast<const PxActor**>(pairsActors.begin()) : NULL;
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxScene, pairsActors, scene, actors, actorCount);
PxU32 nbContactCount = pairsContactCounts.size();
PxU32* contactCounts = nbContactCount ? pairsContactCounts.begin() : NULL;
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxScene, pairsContactCounts, scene, contactCounts, nbContactCount);
PxU32 contactPointFloatCount = pairsContactPoints.size() * 3;
PxReal* contactPoints = contactPointFloatCount ? &pairsContactPoints[0].x : NULL;
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxScene, pairsContactPoints, scene, contactPoints, contactPointFloatCount);
PxU32 contactNormalFloatCount = pairsContactNormals.size() * 3;
PxReal* contactNormals = contactNormalFloatCount ? &pairsContactNormals[0].x : NULL;
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxScene, pairsContactNormals, scene, contactNormals, contactNormalFloatCount);
PxU32 contactSeparationCount = pairsContactSeparations.size();
PxReal* contactSeparations = contactSeparationCount ? pairsContactSeparations.begin() : NULL;
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxScene, pairsContactSeparations, scene, contactSeparations, contactSeparationCount);
PxU32 contactShapeCount = pairsContactShapes.size();
const PxShape** contactShapes = contactShapeCount ? const_cast<const PxShape**>(pairsContactShapes.begin()) : NULL;
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxScene, pairsContactShapes, scene, contactShapes, contactShapeCount);
PxU32 contactFacesIndexCount = pairsContactFacesIndices.size();
PxU32* contactFacesIndices = contactFacesIndexCount ? pairsContactFacesIndices.begin() : NULL;
OMNI_PVD_SET_ARRAY_EXPLICIT(pvdWriter, pvdRegData, OMNI_PVD_CONTEXT_HANDLE, PxScene, pairsContactFacesIndices, scene, contactFacesIndices, contactFacesIndexCount);
OMNI_PVD_WRITE_SCOPE_END
}
OmniPvdPxSampler::OmniPvdPxSampler()
{
samplerInternals = PX_NEW(OmniPvdSamplerInternals)();
physx::PxMutex::ScopedLock myLock(samplerInternals->mSampleMutex);
samplerInternals->mIsSampling = false;
}
OmniPvdPxSampler::~OmniPvdPxSampler()
{
physx::PxHashMap<physx::NpScene*, OmniPvdPxScene*>::Iterator iterScenes = samplerInternals->mSampledScenes.getIterator();
while (!iterScenes.done())
{
OmniPvdPxScene* scene = iterScenes->second;
PX_DELETE(scene);
iterScenes++;
}
PX_DELETE(samplerInternals);
}
void OmniPvdPxSampler::startSampling()
{
physx::PxMutex::ScopedLock myLock(samplerInternals->mSampleMutex);
if (samplerInternals->mIsSampling)
{
return;
}
if (samplerInternals->mPvdStream.initOmniPvd())
{
samplerInternals->mIsSampling = true;
}
}
bool OmniPvdPxSampler::isSampling()
{
if (!samplerInternals) return false;
physx::PxMutex::ScopedLock myLock(samplerInternals->mSampleMutex);
return samplerInternals->mIsSampling;
}
void OmniPvdPxSampler::setOmniPvdInstance(physx::NpOmniPvd* omniPvdInstance)
{
samplerInternals->mPvdStream.setOmniPvdInstance(omniPvdInstance);
}
void createGeometry(const physx::PxGeometry & pxGeom)
{
switch (pxGeom.getType())
{
case physx::PxGeometryType::eSPHERE:
{
streamSphereGeometry((const physx::PxSphereGeometry &)pxGeom);
}
break;
case physx::PxGeometryType::eCAPSULE:
{
streamCapsuleGeometry((const physx::PxCapsuleGeometry &)pxGeom);
}
break;
case physx::PxGeometryType::eBOX:
{
streamBoxGeometry((const physx::PxBoxGeometry &)pxGeom);
}
break;
case physx::PxGeometryType::eTRIANGLEMESH:
{
streamTriMeshGeometry((const physx::PxTriangleMeshGeometry &)pxGeom);
}
break;
case physx::PxGeometryType::eCONVEXMESH:
{
streamConvexMeshGeometry((const physx::PxConvexMeshGeometry &)pxGeom);
}
break;
case physx::PxGeometryType::eHEIGHTFIELD:
{
streamHeightFieldGeometry((const physx::PxHeightFieldGeometry &)pxGeom);
}
break;
case physx::PxGeometryType::ePLANE:
{
streamPlaneGeometry((const physx::PxPlaneGeometry &)pxGeom);
}
break;
case physx::PxGeometryType::eCUSTOM:
{
streamCustomGeometry((const physx::PxCustomGeometry &)pxGeom);
}
break;
default:
break;
}
}
void destroyGeometry(const physx::PxGeometry& pxGeom)
{
switch (pxGeom.getType())
{
case physx::PxGeometryType::eSPHERE:
{
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxSphereGeometry, static_cast<const PxSphereGeometry&>(pxGeom));
}
break;
case physx::PxGeometryType::eCAPSULE:
{
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxCapsuleGeometry, static_cast<const PxCapsuleGeometry&>(pxGeom));
}
break;
case physx::PxGeometryType::eBOX:
{
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxBoxGeometry, static_cast<const PxBoxGeometry&>(pxGeom));
}
break;
case physx::PxGeometryType::eTRIANGLEMESH:
{
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxTriangleMeshGeometry, static_cast<const PxTriangleMeshGeometry&>(pxGeom));
}
break;
case physx::PxGeometryType::eCONVEXMESH:
{
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxConvexMeshGeometry, static_cast<const PxConvexMeshGeometry&>(pxGeom));
}
break;
case physx::PxGeometryType::eHEIGHTFIELD:
{
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxHeightFieldGeometry, static_cast<const PxHeightFieldGeometry&>(pxGeom));
}
break;
case physx::PxGeometryType::ePLANE:
{
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxPlaneGeometry, static_cast<const PxPlaneGeometry&>(pxGeom));
}
break;
case physx::PxGeometryType::eCUSTOM:
{
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxCustomGeometry, static_cast<const PxCustomGeometry&>(pxGeom));
}
break;
default:
break;
}
}
void OmniPvdPxSampler::sampleScene(physx::NpScene* scene)
{
{
physx::PxMutex::ScopedLock myLock(samplerInternals->mSampleMutex);
if (!samplerInternals->mIsSampling) return;
}
OmniPvdPxScene* ovdScene = getSampledScene(scene);
ovdScene->sampleScene();
}
void OmniPvdPxSampler::onObjectAdd(const physx::PxBase& object)
{
if (!isSampling()) return;
const PxPhysics& physics = static_cast<PxPhysics&>(NpPhysics::getInstance());
switch (object.getConcreteType())
{
case physx::PxConcreteType::eHEIGHTFIELD:
{
const PxHeightField& hf = static_cast<const PxHeightField&>(object);
streamHeightField(hf);
OMNI_PVD_ADD(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, heightFields, physics, hf);
}
break;
case physx::PxConcreteType::eCONVEX_MESH:
{
const PxConvexMesh& cm = static_cast<const PxConvexMesh&>(object);
streamConvexMesh(cm);
OMNI_PVD_ADD(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, convexMeshes, physics, cm);
}
break;
case physx::PxConcreteType::eTRIANGLE_MESH_BVH33:
case physx::PxConcreteType::eTRIANGLE_MESH_BVH34:
{
const PxTriangleMesh& m = static_cast<const PxTriangleMesh&>(object);
streamTriMesh(m);
OMNI_PVD_ADD(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, triangleMeshes, physics, m);
}
break;
case physx::PxConcreteType::eTETRAHEDRON_MESH:
{
const PxTetrahedronMesh& tm = static_cast<const PxTetrahedronMesh&>(object);
streamTetMesh(tm);
OMNI_PVD_ADD(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, tetrahedronMeshes, physics, tm);
}
break;
case physx::PxConcreteType::eSOFTBODY_MESH:
{
const PxSoftBodyMesh& sm = static_cast<const PxSoftBodyMesh&>(object);
streamSoBoMesh(sm);
OMNI_PVD_ADD(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, softBodyMeshes, physics, sm);
}
break;
case physx::PxConcreteType::eBVH:
{
const PxBVH& bvh = static_cast<const PxBVH&>(object);
streamBVH(bvh);
OMNI_PVD_ADD(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, bvhs, physics, bvh);
}
break;
case physx::PxConcreteType::eSHAPE:
{
const PxShape& shape = static_cast<const physx::PxShape&>(object);
createGeometry(shape.getGeometry());
streamShape(shape);
OMNI_PVD_ADD(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, shapes, physics, shape);
}
break;
case physx::PxConcreteType::eMATERIAL:
{
const PxMaterial& mat = static_cast<const PxMaterial&>(object);
streamMaterial(mat);
OMNI_PVD_ADD(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, materials, physics, mat);
}
break;
case physx::PxConcreteType::eSOFTBODY_MATERIAL:
{
const PxFEMSoftBodyMaterial& sbMat = static_cast<const PxFEMSoftBodyMaterial&>(object);
streamFEMSoBoMaterial(sbMat);
OMNI_PVD_ADD(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, FEMSoftBodyMaterials, physics, sbMat);
}
break;
case physx::PxConcreteType::eCLOTH_MATERIAL:
{
const PxFEMClothMaterial& clothMat = static_cast<const PxFEMClothMaterial&>(object);
streamFEMClothMaterial(clothMat);
OMNI_PVD_ADD(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, FEMClothMaterials, physics, clothMat);
}
break;
case physx::PxConcreteType::ePBD_MATERIAL:
{
const PxPBDMaterial& pbdhMat = static_cast<const PxPBDMaterial&>(object);
streamPBDMaterial(pbdhMat);
OMNI_PVD_ADD(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, PBDMaterials, physics, pbdhMat);
}
break;
case physx::PxConcreteType::eFLIP_MATERIAL:
{
const PxFLIPMaterial& flipMat = static_cast<const PxFLIPMaterial&>(object);
streamFLIPMaterial(flipMat);
OMNI_PVD_ADD(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, FLIPMaterials, physics, flipMat);
}
break;
case physx::PxConcreteType::eMPM_MATERIAL:
{
const PxMPMMaterial& mpmMat = static_cast<const PxMPMMaterial&>(object);
streamMPMMaterial(mpmMat);
OMNI_PVD_ADD(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, MPMMaterials, physics, mpmMat);
}
break;
case physx::PxConcreteType::eAGGREGATE:
{
const PxAggregate& agg = static_cast<const PxAggregate&>(object);
streamAggregate(agg);
OMNI_PVD_ADD(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, aggregates, physics, agg);
}
break;
case physx::PxConcreteType::eARTICULATION_REDUCED_COORDINATE:
{
const PxArticulationReducedCoordinate& art = static_cast<const PxArticulationReducedCoordinate&>(object);
streamArticulation(art);
OMNI_PVD_ADD(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, articulations, physics, art);
}
break;
case physx::PxConcreteType::eARTICULATION_LINK:
{
const PxArticulationLink& artLink = static_cast<const PxArticulationLink&>(object);
streamArticulationLink(artLink);
OMNI_PVD_ADD(OMNI_PVD_CONTEXT_HANDLE, PxArticulationReducedCoordinate, links, artLink.getArticulation(), artLink);
}
break;
case physx::PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE:
{
const PxArticulationJointReducedCoordinate& artJoint = static_cast<const PxArticulationJointReducedCoordinate&>(object);
streamArticulationJoint(artJoint);
break;
}
case physx::PxConcreteType::eRIGID_DYNAMIC:
{
const PxRigidDynamic& rd = static_cast<const PxRigidDynamic&>(object);
streamRigidDynamic(rd);
OMNI_PVD_ADD(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, rigidDynamics, physics, rd);
}
break;
case physx::PxConcreteType::eRIGID_STATIC:
{
const PxRigidStatic& rs = static_cast<const PxRigidStatic&>(object);
streamRigidStatic(rs);
OMNI_PVD_ADD(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, rigidStatics, physics, rs);
}
break;
}
}
void OmniPvdPxSampler::onObjectRemove(const physx::PxBase& object)
{
if (!isSampling()) return;
const PxPhysics& physics = static_cast<PxPhysics&>(NpPhysics::getInstance());
switch (object.getConcreteType())
{
case physx::PxConcreteType::eHEIGHTFIELD:
{
const PxHeightField& hf = static_cast<const PxHeightField&>(object);
OMNI_PVD_REMOVE(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, heightFields, physics, hf);
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxHeightField, hf);
}
break;
case physx::PxConcreteType::eCONVEX_MESH:
{
const PxConvexMesh& cm = static_cast<const PxConvexMesh&>(object);
OMNI_PVD_REMOVE(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, convexMeshes, physics, cm);
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxConvexMesh, cm);
}
break;
case physx::PxConcreteType::eTRIANGLE_MESH_BVH33:
case physx::PxConcreteType::eTRIANGLE_MESH_BVH34:
{
const PxTriangleMesh& m = static_cast<const PxTriangleMesh&>(object);
OMNI_PVD_REMOVE(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, triangleMeshes, physics, m);
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxTriangleMesh, m);
}
break;
case physx::PxConcreteType::eTETRAHEDRON_MESH:
{
const PxTetrahedronMesh& tm = static_cast<const PxTetrahedronMesh&>(object);
OMNI_PVD_REMOVE(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, tetrahedronMeshes, physics, tm);
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxTetrahedronMesh, tm);
}
break;
case physx::PxConcreteType::eSOFTBODY_MESH:
{
const PxSoftBodyMesh& sm = static_cast<const PxSoftBodyMesh&>(object);
OMNI_PVD_REMOVE(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, softBodyMeshes, physics, sm);
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxSoftBodyMesh, sm);
}
break;
case physx::PxConcreteType::eBVH:
{
const PxBVH& bvh = static_cast<const PxBVH&>(object);
OMNI_PVD_REMOVE(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, bvhs, physics, bvh);
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxBVH, bvh);
}
break;
case physx::PxConcreteType::eSHAPE:
{
const PxShape& shape = static_cast<const physx::PxShape&>(object);
OMNI_PVD_REMOVE(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, shapes, physics, shape);
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxShape, shape);
destroyGeometry(shape.getGeometry());
}
break;
case physx::PxConcreteType::eMATERIAL:
{
const PxMaterial& mat = static_cast<const PxMaterial&>(object);
OMNI_PVD_REMOVE(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, materials, physics, mat);
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxMaterial, mat);
}
break;
case physx::PxConcreteType::eSOFTBODY_MATERIAL:
{
const PxFEMSoftBodyMaterial& sbMat = static_cast<const PxFEMSoftBodyMaterial&>(object);
OMNI_PVD_REMOVE(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, FEMSoftBodyMaterials, physics, sbMat);
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxFEMSoftBodyMaterial, sbMat);
}
break;
case physx::PxConcreteType::eCLOTH_MATERIAL:
{
const PxFEMClothMaterial& clothMat = static_cast<const PxFEMClothMaterial&>(object);
OMNI_PVD_REMOVE(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, FEMClothMaterials, physics, clothMat);
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxFEMClothMaterial, clothMat);
}
break;
case physx::PxConcreteType::ePBD_MATERIAL:
{
const PxPBDMaterial& pbdhMat = static_cast<const PxPBDMaterial&>(object);
OMNI_PVD_REMOVE(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, PBDMaterials, physics, pbdhMat);
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxPBDMaterial, pbdhMat);
}
break;
case physx::PxConcreteType::eFLIP_MATERIAL:
{
const PxFLIPMaterial& flipMat = static_cast<const PxFLIPMaterial&>(object);
OMNI_PVD_REMOVE(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, FLIPMaterials, physics, flipMat);
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxFLIPMaterial, flipMat);
}
break;
case physx::PxConcreteType::eMPM_MATERIAL:
{
const PxMPMMaterial& mpmMat = static_cast<const PxMPMMaterial&>(object);
OMNI_PVD_REMOVE(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, MPMMaterials, physics, mpmMat);
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxMPMMaterial, mpmMat);
}
break;
case physx::PxConcreteType::eAGGREGATE:
{
const PxAggregate& agg = static_cast<const PxAggregate&>(object);
OMNI_PVD_REMOVE(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, aggregates, physics, agg);
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxAggregate, agg);
}
break;
case physx::PxConcreteType::eARTICULATION_REDUCED_COORDINATE:
{
const PxArticulationReducedCoordinate& art = static_cast<const PxArticulationReducedCoordinate&>(object);
OMNI_PVD_REMOVE(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, articulations, physics, art);
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxArticulationReducedCoordinate, art);
}
break;
case physx::PxConcreteType::eARTICULATION_LINK:
{
const PxArticulationLink& artLink = static_cast<const PxArticulationLink&>(object);
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxActor, artLink);
}
break;
case physx::PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE:
{
const PxArticulationJointReducedCoordinate& artJoint = static_cast<const PxArticulationJointReducedCoordinate&>(object);
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxArticulationJointReducedCoordinate, artJoint);
}
break;
case physx::PxConcreteType::eRIGID_DYNAMIC:
{
const PxRigidDynamic& rd = static_cast<const PxRigidDynamic&>(object);
OMNI_PVD_REMOVE(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, rigidDynamics, physics, rd);
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxActor, rd);
}
break;
case physx::PxConcreteType::eRIGID_STATIC:
{
const PxRigidStatic& rs = static_cast<const PxRigidStatic&>(object);
OMNI_PVD_REMOVE(OMNI_PVD_CONTEXT_HANDLE, PxPhysics, rigidStatics, physics, rs);
OMNI_PVD_DESTROY(OMNI_PVD_CONTEXT_HANDLE, PxActor, rs);
}
break;
}
}
OmniPvdPxScene* OmniPvdPxSampler::getSampledScene(physx::NpScene* scene)
{
physx::PxMutex::ScopedLock myLock(samplerInternals->mSampledScenesMutex);
const physx::PxHashMap<physx::NpScene*, OmniPvdPxScene*>::Entry* entry = samplerInternals->mSampledScenes.find(scene);
if (entry)
{
return entry->second;
}
else
{
OmniPvdPxScene* ovdScene = PX_NEW(OmniPvdPxScene)();
samplerInternals->mSampledScenes[scene] = ovdScene;
return ovdScene;
}
}
// Returns true if the Geom was not yet seen and added
bool OmniPvdSamplerInternals::addSharedMeshIfNotSeen(const void* geom, OmniPvdSharedMeshEnum geomEnum)
{
physx::PxMutex::ScopedLock myLock(samplerInternals->mSharedGeomsMutex);
const physx::PxHashMap<const void*, OmniPvdSharedMeshEnum>::Entry* entry = samplerInternals->mSharedMeshesMap.find(geom);
if (entry)
{
return false;
}
else
{
samplerInternals->mSharedMeshesMap[geom] = geomEnum;
return true;
}
}
///////////////////////////////////////////////////////////////////////////////
OmniPvdPxSampler* OmniPvdPxSampler::getInstance()
{
PX_ASSERT(&physx::NpPhysics::getInstance() != NULL);
return &physx::NpPhysics::getInstance() ? physx::NpPhysics::getInstance().mOmniPvdSampler : NULL;
}
namespace physx
{
const OmniPvdPxCoreRegistrationData* NpOmniPvdGetPxCoreRegistrationData()
{
if (samplerInternals)
{
return &samplerInternals->mPvdStream.mRegistrationData;
}
else
{
return NULL;
}
}
physx::NpOmniPvd* NpOmniPvdGetInstance()
{
if (samplerInternals)
{
return samplerInternals->mPvdStream.mOmniPvdInstance;
}
else
{
return NULL;
}
}
}
#endif
| 60,308 | C++ | 39.448692 | 182 | 0.7598 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/omnipvd/OmniPvdPxSampler.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef OMNI_PVD_PX_SAMPLER_H
#define OMNI_PVD_PX_SAMPLER_H
#if PX_SUPPORT_OMNI_PVD
#include "foundation/PxSimpleTypes.h"
#include "foundation/PxHashMap.h"
#include "foundation/PxMutex.h"
#include "foundation/PxUserAllocated.h"
#include "OmniPvdChunkAlloc.h"
namespace physx
{
class PxScene;
class PxBase;
class NpScene;
class PxActor;
class PxShape;
class PxMaterial;
class PxFEMClothMaterial;
class PxFEMMaterial;
class PxFEMSoftBodyMaterial;
class PxFLIPMaterial;
class PxMPMMaterial;
class PxParticleMaterial;
class PxPBDMaterial;
struct OmniPvdPxCoreRegistrationData;
class NpOmniPvd;
}
void streamActorName(const physx::PxActor & a, const char* name);
void streamSceneName(const physx::PxScene & s, const char* name);
void streamShapeMaterials(const physx::PxShape&, physx::PxMaterial* const * mats, physx::PxU32 nbrMaterials);
void streamShapeMaterials(const physx::PxShape&, physx::PxFEMClothMaterial* const * mats, physx::PxU32 nbrMaterials);
void streamShapeMaterials(const physx::PxShape&, physx::PxFEMMaterial* const * mats, physx::PxU32 nbrMaterials);
void streamShapeMaterials(const physx::PxShape&, physx::PxFEMSoftBodyMaterial* const * mats, physx::PxU32 nbrMaterials);
void streamShapeMaterials(const physx::PxShape&, physx::PxFLIPMaterial* const * mats, physx::PxU32 nbrMaterials);
void streamShapeMaterials(const physx::PxShape&, physx::PxMPMMaterial* const * mats, physx::PxU32 nbrMaterials);
void streamShapeMaterials(const physx::PxShape&, physx::PxParticleMaterial* const * mats, physx::PxU32 nbrMaterials);
void streamShapeMaterials(const physx::PxShape&, physx::PxPBDMaterial* const * mats, physx::PxU32 nbrMaterials);
enum OmniPvdSharedMeshEnum {
eOmniPvdTriMesh = 0,
eOmniPvdConvexMesh = 1,
eOmniPvdHeightField = 2,
};
class OmniPvdWriter;
class OmniPvdPxScene;
class OmniPvdPxSampler : public physx::PxUserAllocated
{
public:
OmniPvdPxSampler();
~OmniPvdPxSampler();
void startSampling();
bool isSampling();
void setOmniPvdInstance(physx::NpOmniPvd* omniPvdIntance);
// writes all contacts to the stream
void streamSceneContacts(physx::NpScene& scene);
// call at the end of a simulation step:
void sampleScene(physx::NpScene* scene);
static OmniPvdPxSampler* getInstance();
void onObjectAdd(const physx::PxBase& object);
void onObjectRemove(const physx::PxBase& object);
private:
OmniPvdPxScene* getSampledScene(physx::NpScene* scene);
};
namespace physx
{
const OmniPvdPxCoreRegistrationData* NpOmniPvdGetPxCoreRegistrationData();
NpOmniPvd* NpOmniPvdGetInstance();
}
#endif
#endif
| 4,271 | C | 34.305785 | 120 | 0.777336 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/omnipvd/OmniPvdTypes.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
// Declare OMNI_PVD Types and Attributes here!
// The last two attribute parameters could now be derived from the other data, so could be removed in a refactor,
// though explicit control may be better.
// Note that HANDLE attributes have to use (Type const *) style, otherwise it won't compile!
////////////////////////////////////////////////////////////////////////////////
// Bitfields
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_ENUM_BEGIN (PxSceneFlag)
OMNI_PVD_ENUM_VALUE (PxSceneFlag, eENABLE_ACTIVE_ACTORS)
OMNI_PVD_ENUM_VALUE (PxSceneFlag, eENABLE_CCD)
OMNI_PVD_ENUM_VALUE (PxSceneFlag, eDISABLE_CCD_RESWEEP)
OMNI_PVD_ENUM_VALUE (PxSceneFlag, eENABLE_PCM)
OMNI_PVD_ENUM_VALUE (PxSceneFlag, eDISABLE_CONTACT_REPORT_BUFFER_RESIZE)
OMNI_PVD_ENUM_VALUE (PxSceneFlag, eDISABLE_CONTACT_CACHE)
OMNI_PVD_ENUM_VALUE (PxSceneFlag, eREQUIRE_RW_LOCK)
OMNI_PVD_ENUM_VALUE (PxSceneFlag, eENABLE_STABILIZATION)
OMNI_PVD_ENUM_VALUE (PxSceneFlag, eENABLE_AVERAGE_POINT)
OMNI_PVD_ENUM_VALUE (PxSceneFlag, eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS)
OMNI_PVD_ENUM_VALUE (PxSceneFlag, eENABLE_GPU_DYNAMICS)
OMNI_PVD_ENUM_VALUE (PxSceneFlag, eENABLE_ENHANCED_DETERMINISM)
OMNI_PVD_ENUM_VALUE (PxSceneFlag, eENABLE_FRICTION_EVERY_ITERATION)
OMNI_PVD_ENUM_VALUE (PxSceneFlag, eENABLE_DIRECT_GPU_API)
OMNI_PVD_ENUM_END (PxSceneFlag)
OMNI_PVD_ENUM_BEGIN (PxMaterialFlag)
OMNI_PVD_ENUM_VALUE (PxMaterialFlag, eDISABLE_FRICTION)
OMNI_PVD_ENUM_VALUE (PxMaterialFlag, eDISABLE_STRONG_FRICTION)
OMNI_PVD_ENUM_VALUE (PxMaterialFlag, eIMPROVED_PATCH_FRICTION)
OMNI_PVD_ENUM_END (PxMaterialFlag)
OMNI_PVD_ENUM_BEGIN (PxActorFlag)
OMNI_PVD_ENUM_VALUE (PxActorFlag, eVISUALIZATION)
OMNI_PVD_ENUM_VALUE (PxActorFlag, eDISABLE_GRAVITY)
OMNI_PVD_ENUM_VALUE (PxActorFlag, eSEND_SLEEP_NOTIFIES)
OMNI_PVD_ENUM_VALUE (PxActorFlag, eDISABLE_SIMULATION)
OMNI_PVD_ENUM_END (PxActorFlag)
OMNI_PVD_ENUM_BEGIN (PxRigidBodyFlag)
OMNI_PVD_ENUM_VALUE (PxRigidBodyFlag, eKINEMATIC)
OMNI_PVD_ENUM_VALUE (PxRigidBodyFlag, eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES)
OMNI_PVD_ENUM_VALUE (PxRigidBodyFlag, eENABLE_CCD)
OMNI_PVD_ENUM_VALUE (PxRigidBodyFlag, eENABLE_CCD_FRICTION)
OMNI_PVD_ENUM_VALUE (PxRigidBodyFlag, eENABLE_POSE_INTEGRATION_PREVIEW)
OMNI_PVD_ENUM_VALUE (PxRigidBodyFlag, eENABLE_SPECULATIVE_CCD)
OMNI_PVD_ENUM_VALUE (PxRigidBodyFlag, eENABLE_CCD_MAX_CONTACT_IMPULSE)
OMNI_PVD_ENUM_VALUE (PxRigidBodyFlag, eRETAIN_ACCELERATIONS)
OMNI_PVD_ENUM_VALUE (PxRigidBodyFlag, eFORCE_KINE_KINE_NOTIFICATIONS)
OMNI_PVD_ENUM_VALUE (PxRigidBodyFlag, eFORCE_STATIC_KINE_NOTIFICATIONS)
OMNI_PVD_ENUM_VALUE (PxRigidBodyFlag, eENABLE_GYROSCOPIC_FORCES)
OMNI_PVD_ENUM_VALUE (PxRigidBodyFlag, eRESERVED)
OMNI_PVD_ENUM_END (PxRigidBodyFlag)
OMNI_PVD_ENUM_BEGIN (PxArticulationFlag)
OMNI_PVD_ENUM_VALUE (PxArticulationFlag, eFIX_BASE)
OMNI_PVD_ENUM_VALUE (PxArticulationFlag, eDRIVE_LIMITS_ARE_FORCES)
OMNI_PVD_ENUM_VALUE (PxArticulationFlag, eDISABLE_SELF_COLLISION)
OMNI_PVD_ENUM_VALUE (PxArticulationFlag, eCOMPUTE_JOINT_FORCES)
OMNI_PVD_ENUM_END (PxArticulationFlag)
OMNI_PVD_ENUM_BEGIN (PxRigidDynamicLockFlag)
OMNI_PVD_ENUM_VALUE (PxRigidDynamicLockFlag, eLOCK_LINEAR_X)
OMNI_PVD_ENUM_VALUE (PxRigidDynamicLockFlag, eLOCK_LINEAR_Y)
OMNI_PVD_ENUM_VALUE (PxRigidDynamicLockFlag, eLOCK_LINEAR_Z)
OMNI_PVD_ENUM_VALUE (PxRigidDynamicLockFlag, eLOCK_ANGULAR_X)
OMNI_PVD_ENUM_VALUE (PxRigidDynamicLockFlag, eLOCK_ANGULAR_Y)
OMNI_PVD_ENUM_VALUE (PxRigidDynamicLockFlag, eLOCK_ANGULAR_Z)
OMNI_PVD_ENUM_END (PxRigidDynamicLockFlag)
OMNI_PVD_ENUM_BEGIN (PxShapeFlag)
OMNI_PVD_ENUM_VALUE (PxShapeFlag, eSIMULATION_SHAPE)
OMNI_PVD_ENUM_VALUE (PxShapeFlag, eSCENE_QUERY_SHAPE)
OMNI_PVD_ENUM_VALUE (PxShapeFlag, eTRIGGER_SHAPE)
OMNI_PVD_ENUM_VALUE (PxShapeFlag, eVISUALIZATION)
OMNI_PVD_ENUM_END (PxShapeFlag)
////////////////////////////////////////////////////////////////////////////////
// Single value enums
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_ENUM_BEGIN (PxFrictionType)
OMNI_PVD_ENUM_VALUE (PxFrictionType, ePATCH)
OMNI_PVD_ENUM_VALUE (PxFrictionType, eONE_DIRECTIONAL)
OMNI_PVD_ENUM_VALUE (PxFrictionType, eTWO_DIRECTIONAL)
OMNI_PVD_ENUM_END (PxFrictionType)
OMNI_PVD_ENUM_BEGIN (PxBroadPhaseType)
OMNI_PVD_ENUM_VALUE (PxBroadPhaseType, eSAP)
OMNI_PVD_ENUM_VALUE (PxBroadPhaseType, eMBP)
OMNI_PVD_ENUM_VALUE (PxBroadPhaseType, eABP)
OMNI_PVD_ENUM_VALUE (PxBroadPhaseType, eGPU)
OMNI_PVD_ENUM_END (PxBroadPhaseType)
OMNI_PVD_ENUM_BEGIN (PxSolverType)
OMNI_PVD_ENUM_VALUE (PxSolverType, ePGS)
OMNI_PVD_ENUM_VALUE (PxSolverType, eTGS)
OMNI_PVD_ENUM_END (PxSolverType)
OMNI_PVD_ENUM_BEGIN (PxPairFilteringMode)
OMNI_PVD_ENUM_VALUE (PxPairFilteringMode, eKEEP)
OMNI_PVD_ENUM_VALUE (PxPairFilteringMode, eSUPPRESS)
OMNI_PVD_ENUM_VALUE (PxPairFilteringMode, eKILL)
OMNI_PVD_ENUM_END (PxPairFilteringMode)
OMNI_PVD_ENUM_BEGIN (PxCombineMode)
OMNI_PVD_ENUM_VALUE (PxCombineMode, eAVERAGE)
OMNI_PVD_ENUM_VALUE (PxCombineMode, eMIN)
OMNI_PVD_ENUM_VALUE (PxCombineMode, eMULTIPLY)
OMNI_PVD_ENUM_VALUE (PxCombineMode, eMAX)
OMNI_PVD_ENUM_END (PxCombineMode)
OMNI_PVD_ENUM_BEGIN (PxActorType)
OMNI_PVD_ENUM_VALUE (PxActorType, eRIGID_STATIC)
OMNI_PVD_ENUM_VALUE (PxActorType, eRIGID_DYNAMIC)
OMNI_PVD_ENUM_VALUE (PxActorType, eARTICULATION_LINK)
OMNI_PVD_ENUM_VALUE (PxActorType, eSOFTBODY)
OMNI_PVD_ENUM_VALUE (PxActorType, eFEMCLOTH)
OMNI_PVD_ENUM_VALUE (PxActorType, ePBD_PARTICLESYSTEM)
OMNI_PVD_ENUM_VALUE (PxActorType, eFLIP_PARTICLESYSTEM)
OMNI_PVD_ENUM_VALUE (PxActorType, eMPM_PARTICLESYSTEM)
OMNI_PVD_ENUM_VALUE (PxActorType, eHAIRSYSTEM)
OMNI_PVD_ENUM_END (PxActorType)
OMNI_PVD_ENUM_BEGIN (PxArticulationJointType)
OMNI_PVD_ENUM_VALUE (PxArticulationJointType, eFIX)
OMNI_PVD_ENUM_VALUE (PxArticulationJointType, ePRISMATIC)
OMNI_PVD_ENUM_VALUE (PxArticulationJointType, eREVOLUTE)
OMNI_PVD_ENUM_VALUE (PxArticulationJointType, eREVOLUTE_UNWRAPPED)
OMNI_PVD_ENUM_VALUE (PxArticulationJointType, eSPHERICAL)
OMNI_PVD_ENUM_VALUE (PxArticulationJointType, eUNDEFINED)
OMNI_PVD_ENUM_END (PxArticulationJointType)
OMNI_PVD_ENUM_BEGIN (PxArticulationMotion)
OMNI_PVD_ENUM_VALUE (PxArticulationMotion, eLOCKED)
OMNI_PVD_ENUM_VALUE (PxArticulationMotion, eLIMITED)
OMNI_PVD_ENUM_VALUE (PxArticulationMotion, eFREE)
OMNI_PVD_ENUM_END (PxArticulationMotion)
OMNI_PVD_ENUM_BEGIN (PxArticulationDriveType)
OMNI_PVD_ENUM_VALUE (PxArticulationDriveType, eFORCE)
OMNI_PVD_ENUM_VALUE (PxArticulationDriveType, eACCELERATION)
OMNI_PVD_ENUM_VALUE (PxArticulationDriveType, eTARGET)
OMNI_PVD_ENUM_VALUE (PxArticulationDriveType, eVELOCITY)
OMNI_PVD_ENUM_VALUE (PxArticulationDriveType, eNONE)
OMNI_PVD_ENUM_END (PxArticulationDriveType)
////////////////////////////////////////////////////////////////////////////////
// Classes
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// PxPhysics
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_BEGIN (PxPhysics)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxPhysics, scenes, PxScene)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxPhysics, heightFields, PxHeightField)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxPhysics, convexMeshes, PxConvexMesh)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxPhysics, triangleMeshes, PxTriangleMesh)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxPhysics, tetrahedronMeshes, PxTetrahedronMesh)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxPhysics, softBodyMeshes, PxSoftBodyMesh)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxPhysics, shapes, PxShape)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxPhysics, bvhs, PxBVH)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxPhysics, materials, PxMaterial)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxPhysics, FEMSoftBodyMaterials, PxFEMSoftBodyMaterial)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxPhysics, FEMClothMaterials, PxFEMClothMaterial)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxPhysics, PBDMaterials, PxPBDMaterial)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxPhysics, FLIPMaterials, PxFLIPMaterial)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxPhysics, MPMMaterials, PxMPMMaterial)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxPhysics, rigidDynamics, PxActor)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxPhysics, rigidStatics, PxActor)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxPhysics, aggregates, PxAggregate)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxPhysics, articulations, PxArticulationReducedCoordinate)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxPhysics, tolerancesScale, PxTolerancesScale, OmniPvdDataType::eFLOAT32, 2)
OMNI_PVD_CLASS_END (PxPhysics)
////////////////////////////////////////////////////////////////////////////////
// PxScene
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_BEGIN (PxScene)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxScene, actors, PxActor)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxScene, articulations, PxArticulationReducedCoordinate)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxScene, aggregates, PxAggregate)
OMNI_PVD_ATTRIBUTE_FLAG (PxScene, flags, PxSceneFlags, PxSceneFlag)
OMNI_PVD_ATTRIBUTE_FLAG (PxScene, frictionType, PxFrictionType::Enum, PxFrictionType)
OMNI_PVD_ATTRIBUTE_FLAG (PxScene, broadPhaseType, PxBroadPhaseType::Enum, PxBroadPhaseType)
OMNI_PVD_ATTRIBUTE_FLAG (PxScene, kineKineFilteringMode, PxPairFilteringMode::Enum, PxPairFilteringMode)
OMNI_PVD_ATTRIBUTE_FLAG (PxScene, staticKineFilteringMode,PxPairFilteringMode::Enum, PxPairFilteringMode)
OMNI_PVD_ATTRIBUTE_FLAG (PxScene, solverType, PxSolverType::Enum, PxSolverType)
OMNI_PVD_ATTRIBUTE_STRING (PxScene, name)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxScene, gravity, PxVec3, OmniPvdDataType::eFLOAT32, 3)
OMNI_PVD_ATTRIBUTE (PxScene, bounceThresholdVelocity,PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxScene, frictionOffsetThreshold,PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxScene, frictionCorrelationDistance, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxScene, solverOffsetSlop, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxScene, solverBatchSize, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE (PxScene, solverArticulationBatchSize, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE (PxScene, nbContactDataBlocks, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE (PxScene, maxNbContactDataBlocks, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE (PxScene, maxBiasCoefficient, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxScene, contactReportStreamBufferSize, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE (PxScene, ccdMaxPasses, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE (PxScene, ccdThreshold, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxScene, ccdMaxSeparation, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxScene, wakeCounterResetValue, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxScene, hasCPUDispatcher, bool, OmniPvdDataType::eUINT8)
OMNI_PVD_ATTRIBUTE (PxScene, hasCUDAContextManager, bool, OmniPvdDataType::eUINT8)
OMNI_PVD_ATTRIBUTE (PxScene, hasSimulationEventCallback, bool, OmniPvdDataType::eUINT8)
OMNI_PVD_ATTRIBUTE (PxScene, hasContactModifyCallback, bool, OmniPvdDataType::eUINT8)
OMNI_PVD_ATTRIBUTE (PxScene, hasCCDContactModifyCallback, bool, OmniPvdDataType::eUINT8)
OMNI_PVD_ATTRIBUTE (PxScene, hasBroadPhaseCallback, bool, OmniPvdDataType::eUINT8)
OMNI_PVD_ATTRIBUTE (PxScene, hasFilterCallback, bool, OmniPvdDataType::eUINT8)
OMNI_PVD_ATTRIBUTE (PxScene, limitsMaxNbActors, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE (PxScene, limitsMaxNbBodies, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE (PxScene, limitsMaxNbStaticShapes,PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE (PxScene, limitsMaxNbDynamicShapes, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE (PxScene, limitsMaxNbAggregates, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE (PxScene, limitsMaxNbConstraints, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE (PxScene, limitsMaxNbRegions, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE (PxScene, limitsMaxNbBroadPhaseOverlaps, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxScene, sanityBounds, PxBounds3, OmniPvdDataType::eFLOAT32, 6)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxScene, gpuDynamicsConfig, PxgDynamicsMemoryConfig, OmniPvdDataType::eUINT32, 12)
OMNI_PVD_ATTRIBUTE (PxScene, gpuMaxNumPartitions, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE (PxScene, gpuMaxNumStaticPartitions, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE (PxScene, gpuComputeVersion, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE (PxScene, contactPairSlabSize, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxScene, tolerancesScale, PxTolerancesScale, OmniPvdDataType::eFLOAT32, 2)
OMNI_PVD_ATTRIBUTE (PxScene, pairCount, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxScene, pairsActors, PxActor*, OmniPvdDataType::eOBJECT_HANDLE) // 2 for each pair
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxScene, pairsContactCounts, PxU32, OmniPvdDataType::eUINT32) // 1 for each pair
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxScene, pairsContactPoints, PxReal, OmniPvdDataType::eFLOAT32) // 3 for each contact
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxScene, pairsContactNormals, PxReal, OmniPvdDataType::eFLOAT32) // 3 for each contact
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxScene, pairsContactSeparations, PxReal, OmniPvdDataType::eFLOAT32) // 1 for each contact
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxScene, pairsContactShapes, PxShape*, OmniPvdDataType::eOBJECT_HANDLE) // 2 for each contact
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxScene, pairsContactFacesIndices, PxU32, OmniPvdDataType::eUINT32) // 2 for each contact
OMNI_PVD_CLASS_END (PxScene)
////////////////////////////////////////////////////////////////////////////////
// PxBaseMaterial
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_BEGIN (PxBaseMaterial)
OMNI_PVD_CLASS_END (PxBaseMaterial)
////////////////////////////////////////////////////////////////////////////////
// PxMaterial
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_DERIVED_BEGIN (PxMaterial, PxBaseMaterial)
OMNI_PVD_ATTRIBUTE_FLAG (PxMaterial, flags, PxMaterialFlags, PxMaterialFlag)
OMNI_PVD_ATTRIBUTE_FLAG (PxMaterial, frictionCombineMode, PxCombineMode::Enum, PxCombineMode)
OMNI_PVD_ATTRIBUTE_FLAG (PxMaterial, restitutionCombineMode,PxCombineMode::Enum, PxCombineMode)
OMNI_PVD_ATTRIBUTE (PxMaterial, staticFriction, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxMaterial, dynamicFriction, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxMaterial, restitution, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxMaterial, damping, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_CLASS_END (PxMaterial)
////////////////////////////////////////////////////////////////////////////////
// PxFEMSoftBodyMaterial
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_DERIVED_BEGIN (PxFEMSoftBodyMaterial, PxBaseMaterial)
OMNI_PVD_CLASS_END (PxFEMSoftBodyMaterial)
////////////////////////////////////////////////////////////////////////////////
// PxFEMClothMaterial
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_DERIVED_BEGIN (PxFEMClothMaterial, PxBaseMaterial)
OMNI_PVD_CLASS_END (PxFEMClothMaterial)
////////////////////////////////////////////////////////////////////////////////
// PxPBDMaterial
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_DERIVED_BEGIN (PxPBDMaterial, PxBaseMaterial)
OMNI_PVD_CLASS_END (PxPBDMaterial)
////////////////////////////////////////////////////////////////////////////////
// PxFLIPMaterial
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_DERIVED_BEGIN (PxFLIPMaterial, PxBaseMaterial)
OMNI_PVD_CLASS_END (PxFLIPMaterial)
////////////////////////////////////////////////////////////////////////////////
// PxMPMMaterial
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_DERIVED_BEGIN (PxMPMMaterial, PxBaseMaterial)
OMNI_PVD_CLASS_END (PxMPMMaterial)
////////////////////////////////////////////////////////////////////////////////
// PxAggregate
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_BEGIN (PxAggregate)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxAggregate, actors, PxActor)
OMNI_PVD_ATTRIBUTE (PxAggregate, selfCollision, bool, OmniPvdDataType::eUINT8)
OMNI_PVD_ATTRIBUTE (PxAggregate, maxNbShapes, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE (PxAggregate, scene, PxScene* const, OmniPvdDataType::eOBJECT_HANDLE)
OMNI_PVD_CLASS_END (PxAggregate)
////////////////////////////////////////////////////////////////////////////////
// PxActor
// Missing
// aggregate?
// scene?
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_BEGIN (PxActor)
OMNI_PVD_ATTRIBUTE_FLAG (PxActor, type, PxActorType::Enum, PxActorType)
OMNI_PVD_ATTRIBUTE_FLAG (PxActor, flags, PxActorFlags, PxActorFlag)
OMNI_PVD_ATTRIBUTE_STRING (PxActor, name)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxActor, worldBounds, PxBounds3, OmniPvdDataType::eFLOAT32, 6)
OMNI_PVD_ATTRIBUTE (PxActor, dominance, PxDominanceGroup, OmniPvdDataType::eUINT8)
OMNI_PVD_ATTRIBUTE (PxActor, ownerClient, PxClientID, OmniPvdDataType::eUINT8)
OMNI_PVD_CLASS_END (PxActor)
////////////////////////////////////////////////////////////////////////////////
// PxRigidActor
// Missing
// internalActorIndex?
// constraints?
// Remap
// translation + rotation -> globalPose?
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_DERIVED_BEGIN (PxRigidActor, PxActor)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxRigidActor, translation, PxVec3, OmniPvdDataType::eFLOAT32, 3)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxRigidActor, rotation, PxQuat, OmniPvdDataType::eFLOAT32, 4)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxRigidActor, shapes, PxShape)
OMNI_PVD_CLASS_END (PxRigidActor)
////////////////////////////////////////////////////////////////////////////////
// PxRigidStatic
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_DERIVED_BEGIN (PxRigidStatic, PxRigidActor)
OMNI_PVD_CLASS_END (PxRigidStatic)
////////////////////////////////////////////////////////////////////////////////
// PxRigidBody
// Missing
// islandNodeIndex?
// force?
// torque?
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_DERIVED_BEGIN (PxRigidBody, PxRigidActor)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxRigidBody, cMassLocalPose, PxTransform, OmniPvdDataType::eFLOAT32, 7)
OMNI_PVD_ATTRIBUTE (PxRigidBody, mass, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxRigidBody, massSpaceInertiaTensor, PxVec3, OmniPvdDataType::eFLOAT32, 3)
OMNI_PVD_ATTRIBUTE (PxRigidBody, linearDamping, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxRigidBody, angularDamping, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxRigidBody, linearVelocity, PxVec3, OmniPvdDataType::eFLOAT32, 3)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxRigidBody, angularVelocity, PxVec3, OmniPvdDataType::eFLOAT32, 3)
OMNI_PVD_ATTRIBUTE (PxRigidBody, maxLinearVelocity, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxRigidBody, maxAngularVelocity, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE_FLAG (PxRigidBody, rigidBodyFlags, PxRigidBodyFlags, PxRigidBodyFlag)
OMNI_PVD_ATTRIBUTE (PxRigidBody, minAdvancedCCDCoefficient, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxRigidBody, maxDepenetrationVelocity, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxRigidBody, maxContactImpulse, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxRigidBody, contactSlopCoefficient, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_CLASS_END (PxRigidBody)
////////////////////////////////////////////////////////////////////////////////
// PxRigidDynamic
// Missing
// kinematicTarget?
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_DERIVED_BEGIN (PxRigidDynamic, PxRigidBody)
OMNI_PVD_ATTRIBUTE (PxRigidDynamic, isSleeping, bool, OmniPvdDataType::eUINT8)
OMNI_PVD_ATTRIBUTE (PxRigidDynamic, sleepThreshold, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxRigidDynamic, stabilizationThreshold, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE_FLAG (PxRigidDynamic, rigidDynamicLockFlags, PxRigidDynamicLockFlags, PxRigidDynamicLockFlag)
OMNI_PVD_ATTRIBUTE (PxRigidDynamic, wakeCounter, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxRigidDynamic, positionIterations, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE (PxRigidDynamic, velocityIterations, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE (PxRigidDynamic, contactReportThreshold, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_CLASS_END (PxRigidDynamic)
////////////////////////////////////////////////////////////////////////////////
// PxArticulationLink
// Missing
// inboundJoint?
// children?
// linkIndex?
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_DERIVED_BEGIN (PxArticulationLink, PxRigidBody)
OMNI_PVD_ATTRIBUTE (PxArticulationLink, articulation, PxArticulationReducedCoordinate* const, OmniPvdDataType::eOBJECT_HANDLE)
OMNI_PVD_ATTRIBUTE (PxArticulationLink, inboundJointDOF, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE (PxArticulationLink, CFMScale, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_CLASS_END (PxArticulationLink)
////////////////////////////////////////////////////////////////////////////////
// PxArticulationReducedCoordinate
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_BEGIN (PxArticulationReducedCoordinate)
OMNI_PVD_ATTRIBUTE (PxArticulationReducedCoordinate, positionIterations, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE (PxArticulationReducedCoordinate, velocityIterations, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE (PxArticulationReducedCoordinate, isSleeping, bool, OmniPvdDataType::eUINT8)
OMNI_PVD_ATTRIBUTE (PxArticulationReducedCoordinate, sleepThreshold, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxArticulationReducedCoordinate, stabilizationThreshold, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxArticulationReducedCoordinate, wakeCounter, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxArticulationReducedCoordinate, maxLinearVelocity, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxArticulationReducedCoordinate, maxAngularVelocity, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE_UNIQUE_LIST (PxArticulationReducedCoordinate, links, PxArticulationLink)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxArticulationReducedCoordinate, worldBounds, PxBounds3, OmniPvdDataType::eFLOAT32, 6)
OMNI_PVD_ATTRIBUTE_FLAG (PxArticulationReducedCoordinate, articulationFlags, PxArticulationFlags, PxArticulationFlag)
OMNI_PVD_ATTRIBUTE (PxArticulationReducedCoordinate, dofs, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_CLASS_END (PxArticulationReducedCoordinate)
////////////////////////////////////////////////////////////////////////////////
// PxArticulationJointReducedCoordinate
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_BEGIN (PxArticulationJointReducedCoordinate)
OMNI_PVD_ATTRIBUTE (PxArticulationJointReducedCoordinate, parentLink, PxArticulationLink* const, OmniPvdDataType::eOBJECT_HANDLE)
OMNI_PVD_ATTRIBUTE (PxArticulationJointReducedCoordinate, childLink, PxArticulationLink* const, OmniPvdDataType::eOBJECT_HANDLE)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxArticulationJointReducedCoordinate, parentTranslation, PxVec3, OmniPvdDataType::eFLOAT32, 3)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxArticulationJointReducedCoordinate, parentRotation, PxQuat, OmniPvdDataType::eFLOAT32, 4)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxArticulationJointReducedCoordinate, childTranslation, PxVec3, OmniPvdDataType::eFLOAT32, 3)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxArticulationJointReducedCoordinate, childRotation, PxQuat, OmniPvdDataType::eFLOAT32, 4)
OMNI_PVD_ATTRIBUTE_FLAG (PxArticulationJointReducedCoordinate, type, PxArticulationJointType::Enum, PxArticulationJointType)
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxArticulationJointReducedCoordinate, motion, PxArticulationMotion::Enum, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxArticulationJointReducedCoordinate, armature, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxArticulationJointReducedCoordinate, frictionCoefficient, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxArticulationJointReducedCoordinate, maxJointVelocity, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxArticulationJointReducedCoordinate, jointPosition, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxArticulationJointReducedCoordinate, jointVelocity, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE_STRING (PxArticulationJointReducedCoordinate, concreteTypeName)
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxArticulationJointReducedCoordinate, limitLow, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxArticulationJointReducedCoordinate, limitHigh, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxArticulationJointReducedCoordinate, driveStiffness, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxArticulationJointReducedCoordinate, driveDamping, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxArticulationJointReducedCoordinate, driveMaxForce, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxArticulationJointReducedCoordinate, driveType, PxArticulationDriveType::Enum, OmniPvdDataType::eUINT32)
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxArticulationJointReducedCoordinate, driveTarget, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxArticulationJointReducedCoordinate, driveVelocity, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_CLASS_END (PxArticulationJointReducedCoordinate)
////////////////////////////////////////////////////////////////////////////////
// PxShape
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_BEGIN (PxShape)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxShape, translation, PxVec3, OmniPvdDataType::eFLOAT32, 3)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxShape, rotation, PxQuat, OmniPvdDataType::eFLOAT32, 4)
OMNI_PVD_ATTRIBUTE (PxShape, isExclusive, bool, OmniPvdDataType::eUINT8)
OMNI_PVD_ATTRIBUTE (PxShape, geom, PxGeometry* const, OmniPvdDataType::eOBJECT_HANDLE)
OMNI_PVD_ATTRIBUTE (PxShape, contactOffset, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxShape, restOffset, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxShape, densityForFluid, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxShape, torsionalPatchRadius, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxShape, minTorsionalPatchRadius, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE_FLAG (PxShape, shapeFlags, PxShapeFlags, PxShapeFlag)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxShape, simulationFilterData, PxFilterData, OmniPvdDataType::eUINT32, 4)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxShape, queryFilterData, PxFilterData, OmniPvdDataType::eUINT32, 4)
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxShape, materials, PxMaterial* const, OmniPvdDataType::eOBJECT_HANDLE)
OMNI_PVD_CLASS_END (PxShape)
////////////////////////////////////////////////////////////////////////////////
// PxGeometry
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_BEGIN (PxGeometry)
OMNI_PVD_CLASS_END (PxGeometry)
////////////////////////////////////////////////////////////////////////////////
// PxSphereGeometry
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_DERIVED_BEGIN (PxSphereGeometry, PxGeometry)
OMNI_PVD_ATTRIBUTE (PxSphereGeometry, radius, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_CLASS_END (PxSphereGeometry)
////////////////////////////////////////////////////////////////////////////////
// PxCapsuleGeometry
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_DERIVED_BEGIN (PxCapsuleGeometry, PxGeometry)
OMNI_PVD_ATTRIBUTE (PxCapsuleGeometry, halfHeight, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE (PxCapsuleGeometry, radius, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_CLASS_END (PxCapsuleGeometry)
////////////////////////////////////////////////////////////////////////////////
// PxBoxGeometry
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_DERIVED_BEGIN (PxBoxGeometry, PxGeometry)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxBoxGeometry, halfExtents, PxVec3, OmniPvdDataType::eFLOAT32, 3)
OMNI_PVD_CLASS_END (PxBoxGeometry)
////////////////////////////////////////////////////////////////////////////////
// PxPlaneGeometry
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_DERIVED_BEGIN (PxPlaneGeometry, PxGeometry)
OMNI_PVD_CLASS_END (PxPlaneGeometry)
////////////////////////////////////////////////////////////////////////////////
// PxConvexMeshGeometry
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_DERIVED_BEGIN (PxConvexMeshGeometry, PxGeometry)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxConvexMeshGeometry, scale, PxVec3, OmniPvdDataType::eFLOAT32, 3)
OMNI_PVD_ATTRIBUTE (PxConvexMeshGeometry, convexMesh, PxConvexMesh* const, OmniPvdDataType::eOBJECT_HANDLE)
OMNI_PVD_CLASS_END (PxConvexMeshGeometry)
////////////////////////////////////////////////////////////////////////////////
// PxConvexMesh
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_BEGIN (PxConvexMesh)
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxConvexMesh, verts, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxConvexMesh, tris, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_CLASS_END (PxConvexMesh)
////////////////////////////////////////////////////////////////////////////////
// PxHeightFieldGeometry
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_DERIVED_BEGIN (PxHeightFieldGeometry, PxGeometry)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxHeightFieldGeometry, scale, PxVec3, OmniPvdDataType::eFLOAT32, 3)
OMNI_PVD_ATTRIBUTE (PxHeightFieldGeometry, heightField, PxHeightField* const, OmniPvdDataType::eOBJECT_HANDLE)
OMNI_PVD_CLASS_END (PxHeightFieldGeometry)
////////////////////////////////////////////////////////////////////////////////
// PxHeightField
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_BEGIN (PxHeightField)
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxHeightField, verts, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxHeightField, tris, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_CLASS_END (PxHeightField)
////////////////////////////////////////////////////////////////////////////////
// PxTriangleMeshGeometry
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_DERIVED_BEGIN (PxTriangleMeshGeometry, PxGeometry)
OMNI_PVD_ATTRIBUTE_ARRAY_FIXED_SIZE (PxTriangleMeshGeometry, scale, PxVec3, OmniPvdDataType::eFLOAT32, 3)
OMNI_PVD_ATTRIBUTE (PxTriangleMeshGeometry, triangleMesh, PxTriangleMesh* const, OmniPvdDataType::eOBJECT_HANDLE)
OMNI_PVD_CLASS_END (PxTriangleMeshGeometry)
////////////////////////////////////////////////////////////////////////////////
// PxTriangleMesh
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_BEGIN (PxTriangleMesh)
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxTriangleMesh, verts, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxTriangleMesh, tris, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_CLASS_END (PxTriangleMesh)
////////////////////////////////////////////////////////////////////////////////
// PxTetrahedronMeshGeometry
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_DERIVED_BEGIN (PxTetrahedronMeshGeometry, PxGeometry)
OMNI_PVD_ATTRIBUTE (PxTetrahedronMeshGeometry, tetrahedronMesh, PxTetrahedronMesh* const, OmniPvdDataType::eOBJECT_HANDLE)
OMNI_PVD_CLASS_END (PxTetrahedronMeshGeometry)
////////////////////////////////////////////////////////////////////////////////
// PxTetrahedronMesh
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_BEGIN (PxTetrahedronMesh)
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxTetrahedronMesh, verts, PxReal, OmniPvdDataType::eFLOAT32)
OMNI_PVD_ATTRIBUTE_ARRAY_VARIABLE_SIZE (PxTetrahedronMesh, tets, PxU32, OmniPvdDataType::eUINT32)
OMNI_PVD_CLASS_END (PxTetrahedronMesh)
////////////////////////////////////////////////////////////////////////////////
// PxCustomGeometry
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_DERIVED_BEGIN (PxCustomGeometry, PxGeometry)
OMNI_PVD_ATTRIBUTE (PxCustomGeometry, callbacks, PxCustomGeometry::Callbacks* const, OmniPvdDataType::eOBJECT_HANDLE)
OMNI_PVD_CLASS_END (PxCustomGeometry)
////////////////////////////////////////////////////////////////////////////////
// PxSoftBodyMesh
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_BEGIN (PxSoftBodyMesh)
OMNI_PVD_ATTRIBUTE (PxSoftBodyMesh, collisionMesh, PxTetrahedronMesh* const, OmniPvdDataType::eOBJECT_HANDLE)
OMNI_PVD_ATTRIBUTE (PxSoftBodyMesh, simulationMesh,PxTetrahedronMesh* const, OmniPvdDataType::eOBJECT_HANDLE)
OMNI_PVD_CLASS_END (PxSoftBodyMesh)
////////////////////////////////////////////////////////////////////////////////
// PxBVH
////////////////////////////////////////////////////////////////////////////////
OMNI_PVD_CLASS_BEGIN (PxBVH)
OMNI_PVD_CLASS_END (PxBVH)
| 37,269 | C | 61.428811 | 148 | 0.6602 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/omnipvd/OmniPvdChunkAlloc.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef OMNI_PVD_CHUNK_ALLOC_H
#define OMNI_PVD_CHUNK_ALLOC_H
#include "foundation/PxUserAllocated.h"
////////////////////////////////////////////////////////////////////////////////
// The usage reason for splitting the Chunk allocator into a ChunkPool and a
// ByteAllocator is so that similarly accessed objects get allocated next to each
// other within the same Chunk, which is managed by the ByteAllocator. The
// ChunkPool is basically just a resource pool. Not thread safe anything :-)
// Locking is bad mkkk...
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Usage example of setting up a ChunkPool, a ByteAllocator and allocating some
// bytes, for the lulz.
////////////////////////////////////////////////////////////////////////////////
/*
OmniPvdChunkPool pool;
// set the individual Chunks to a size of 100k bytes
pool.setChunkSize(100000);
// all allocations must go through a ByteAllocator, so create one
OmniPvdChunkByteAllocator allocator;
// connect the ByteAllocator to the pool
allocator.setPool(&pool);
// we allocate 100 bytes through the ByteAllocator
unsigned char *someBytes=allocator.allocBytes(100);
*/
////////////////////////////////////////////////////////////////////////////////
// Once we want to cleanup the allocations, return the Chunks to the ChunkPool,
// which is also done silently in the destructor of the ByteAllocator.
////////////////////////////////////////////////////////////////////////////////
/*
allocator.freeChunks();
*/
////////////////////////////////////////////////////////////////////////////////
// Memory management warning! The ByteAllocator does not deallocate the Chunks,
// but must return the Chunks to the ChunkPool before going out of scope. The
// ChunkPool can only deallocate the Chunks that is has in its free Chunks list,
// so all ByteAllocators must either all go out of scope before the ChunkPool
// goes out of scope or the ByteAllocators must all call the function freeChunks
// before the ChunkPool goes out of scope.
////////////////////////////////////////////////////////////////////////////////
class OmniPvdChunkElement
{
public:
OmniPvdChunkElement();
~OmniPvdChunkElement();
OmniPvdChunkElement* mNextElement;
};
class OmniPvdChunk : public physx::PxUserAllocated
{
public:
OmniPvdChunk();
~OmniPvdChunk();
void resetChunk(int nbrBytes);
int nbrBytesUSed();
unsigned char* mData;
int mNbrBytesAllocated;
int mNbrBytesFree;
unsigned char* mBytePtr;
OmniPvdChunk* mNextChunk;
};
class OmniPvdChunkList
{
public:
OmniPvdChunkList();
~OmniPvdChunkList();
void resetList();
void appendList(OmniPvdChunkList* list);
void appendChunk(OmniPvdChunk* chunk);
OmniPvdChunk* removeFirst();
OmniPvdChunk* mFirstChunk;
OmniPvdChunk* mLastChunk;
int mNbrChunks;
};
class OmniPvdChunkPool
{
public:
OmniPvdChunkPool();
~OmniPvdChunkPool();
void setChunkSize(int chunkSize);
OmniPvdChunk* getChunk();
OmniPvdChunkList mFreeChunks;
int mChunkSize;
int mNbrAllocatedChunks;
};
class OmniPvdChunkByteAllocator
{
public:
OmniPvdChunkByteAllocator();
~OmniPvdChunkByteAllocator();
OmniPvdChunkElement* allocChunkElement(int totalStructSize);
void setPool(OmniPvdChunkPool* pool);
unsigned char* allocBytes(int nbrBytes);
void freeChunks();
OmniPvdChunkList mUsedChunks;
OmniPvdChunkPool* mPool;
};
#endif
| 5,205 | C | 33.25 | 81 | 0.667819 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/omnipvd/NpOmniPvd.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef NP_OMNI_PVD_H
#define NP_OMNI_PVD_H
#include "omnipvd/PxOmniPvd.h"
#include "foundation/PxMutex.h"
class OmniPvdReader;
class OmniPvdWriter;
class OmniPvdLoader;
class OmniPvdFileWriteStream;
class OmniPvdPxSampler;
namespace physx
{
class NpOmniPvd : public PxOmniPvd
{
public:
NpOmniPvd();
~NpOmniPvd();
static void destroyInstance();
static void incRefCount();
static void decRefCount();
void release();
bool initOmniPvd();
OmniPvdWriter* getWriter();
OmniPvdWriter* blockingWriterLoad();
OmniPvdWriter* acquireExclusiveWriterAccess();
void releaseExclusiveWriterAccess();
OmniPvdFileWriteStream* getFileWriteStream();
bool startSampling();
OmniPvdLoader* mLoader;
OmniPvdFileWriteStream* mFileWriteStream;
OmniPvdWriter* mWriter;
OmniPvdPxSampler* mPhysXSampler;
static PxU32 mRefCount;
static NpOmniPvd* mInstance;
PxMutex mMutex;
PxMutex mWriterLoadMutex;
};
}
#endif
| 2,617 | C | 32.13924 | 74 | 0.771494 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/device/nvPhysXtoDrv.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef __NVPHYSXTODRV_H__
#define __NVPHYSXTODRV_H__
// The puprose of this interface is to provide graphics drivers with information
// about PhysX state to draw PhysX visual indicator
// We share information between modules using a memory section object. PhysX creates
// such object, graphics drivers try to open it. The name of the object has
// fixed part (NvPhysXToDrv_SectionName) followed by the process id. This allows
// each process to have its own communication channel.
namespace physx
{
#define NvPhysXToDrv_SectionName "PH71828182845_"
// Vista apps cannot create stuff in Global\\ namespace when NOT elevated, so use local scope
#define NvPhysXToDrv_Build_SectionName(PID, buf) sprintf(buf, NvPhysXToDrv_SectionName "%x", static_cast<unsigned int>(PID))
#define NvPhysXToDrv_Build_SectionNameXP(PID, buf) sprintf(buf, "Global\\" NvPhysXToDrv_SectionName "%x", static_cast<unsigned int>(PID))
typedef struct NvPhysXToDrv_Header_
{
int signature; // header interface signature
int version; // version of the interface
int size; // size of the structure
int reserved; // reserved, must be zero
} NvPhysXToDrv_Header;
// this structure describes layout of data in the shared memory section
typedef struct NvPhysXToDrv_Data_V1_
{
NvPhysXToDrv_Header header; // keep this member first in all versions of the interface.
int bCpuPhysicsPresent; // nonzero if cpu physics is initialized
int bGpuPhysicsPresent; // nonzero if gpu physics is initialized
} NvPhysXToDrv_Data_V1;
// some random magic number as our interface signature
#define NvPhysXToDrv_Header_Signature 0xA7AB
// use the macro to setup the header to the latest version of the interface
// update the macro when a new verson of the interface is added
#define NvPhysXToDrv_Header_Init(header) \
{ \
header.signature = NvPhysXToDrv_Header_Signature; \
header.version = 1; \
header.size = sizeof(NvPhysXToDrv_Data_V1); \
header.reserved = 0; \
}
// validate the header against all known interface versions
// add validation checks when new interfaces are added
#define NvPhysXToDrv_Header_Validate(header, curVersion) \
( \
(header.signature == NvPhysXToDrv_Header_Signature) && \
(header.version == curVersion) && \
(curVersion == 1) && \
(header.size == sizeof(NvPhysXToDrv_Data_V1)) \
)
}
#endif // __NVPHYSXTODRV_H__
| 4,354 | C | 45.827956 | 138 | 0.703721 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/device/windows/PhysXIndicatorWindows.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "PhysXIndicator.h"
#include "nvPhysXtoDrv.h"
#include "foundation/windows/PxWindowsInclude.h"
#include <stdio.h>
#if _MSC_VER >= 1800
#include <VersionHelpers.h>
#endif
// Scope-based to indicate to NV driver that CPU PhysX is happening
physx::PhysXIndicator::PhysXIndicator(bool isGpu)
: mPhysXDataPtr(0), mFileHandle(0), mIsGpu(isGpu)
{
// Get the windows version (we can only create Global\\ namespace objects in XP)
/**
Operating system Version number
---------------- --------------
Windows 7 6.1
Windows Server 2008 R2 6.1
Windows Server 2008 6.0
Windows Vista 6.0
Windows Server 2003 R2 5.2
Windows Server 2003 5.2
Windows XP 5.1
Windows 2000 5.0
**/
char configName[128];
#if _MSC_VER >= 1800
if (!IsWindowsVistaOrGreater())
#else
OSVERSIONINFOEX windowsVersionInfo;
windowsVersionInfo.dwOSVersionInfoSize = sizeof (windowsVersionInfo);
GetVersionEx((LPOSVERSIONINFO)&windowsVersionInfo);
if (windowsVersionInfo.dwMajorVersion < 6)
#endif
NvPhysXToDrv_Build_SectionNameXP(GetCurrentProcessId(), configName);
else
NvPhysXToDrv_Build_SectionName(GetCurrentProcessId(), configName);
mFileHandle = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL,
PAGE_READWRITE, 0, sizeof(NvPhysXToDrv_Data_V1), configName);
if (!mFileHandle || mFileHandle == INVALID_HANDLE_VALUE)
return;
bool alreadyExists = ERROR_ALREADY_EXISTS == GetLastError();
mPhysXDataPtr = (physx::NvPhysXToDrv_Data_V1*)MapViewOfFile(mFileHandle,
FILE_MAP_READ|FILE_MAP_WRITE, 0, 0, sizeof(NvPhysXToDrv_Data_V1));
if(!mPhysXDataPtr)
return;
if (!alreadyExists)
{
mPhysXDataPtr->bCpuPhysicsPresent = 0;
mPhysXDataPtr->bGpuPhysicsPresent = 0;
}
updateCounter(1);
// init header last to prevent race conditions
// this must be done because the driver may have already created the shared memory block,
// thus alreadyExists may be true, even if PhysX hasn't been initialized
NvPhysXToDrv_Header_Init(mPhysXDataPtr->header);
}
physx::PhysXIndicator::~PhysXIndicator()
{
if(mPhysXDataPtr)
{
updateCounter(-1);
UnmapViewOfFile(mPhysXDataPtr);
}
if(mFileHandle && mFileHandle != INVALID_HANDLE_VALUE)
CloseHandle(mFileHandle);
}
void physx::PhysXIndicator::setIsGpu(bool isGpu)
{
if(!mPhysXDataPtr)
return;
updateCounter(-1);
mIsGpu = isGpu;
updateCounter(1);
}
PX_INLINE void physx::PhysXIndicator::updateCounter(int delta)
{
(mIsGpu ? mPhysXDataPtr->bGpuPhysicsPresent
: mPhysXDataPtr->bCpuPhysicsPresent) += delta;
}
| 4,203 | C++ | 31.84375 | 90 | 0.748037 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/gpu/PxPhysXGpuModuleLoader.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#include "PxPhysXConfig.h"
#if PX_SUPPORT_GPU_PHYSX
#include "foundation/Px.h"
#include "gpu/PxGpu.h"
#include "cudamanager/PxCudaContextManager.h"
#include "PxPhysics.h"
#if PX_WINDOWS
#include "common/windows/PxWindowsDelayLoadHook.h"
#include "foundation/windows/PxWindowsInclude.h"
#include "windows/CmWindowsModuleUpdateLoader.h"
#elif PX_LINUX
#include <dlfcn.h>
#endif // ~PX_LINUX
#include "stdio.h"
#if PX_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundefined-reinterpret-cast"
#endif
#define STRINGIFY(x) #x
#define GETSTRING(x) STRINGIFY(x)
#define PHYSX_GPU_SHARED_LIB_NAME GETSTRING(PX_PHYSX_GPU_SHARED_LIB_NAME)
static const char* gPhysXGpuLibraryName = PHYSX_GPU_SHARED_LIB_NAME;
#undef GETSTRING
#undef STRINGIFY
// Use reportError to handle cases where PxFoundation has not been created yet
static void reportError(const char* file, int line, const char* format, ...)
{
va_list args;
va_start(args, format);
physx::PxFoundation* foundation = PxIsFoundationValid();
if(foundation)
{
foundation->error(physx::PxErrorCode::eINTERNAL_ERROR, file, line, format, args);
}
else
{
fprintf(stderr, "Error in %s:%i: ", file, line);
vfprintf(stderr, format, args);
}
va_end(args);
}
void PxSetPhysXGpuLoadHook(const PxGpuLoadHook* hook)
{
gPhysXGpuLibraryName = hook->getPhysXGpuDllName();
}
namespace physx
{
#if PX_VC
#pragma warning(disable: 4191) //'operator/operation' : unsafe conversion from 'type of expression' to 'type required'
#endif
class PxFoundation;
class PxPhysXGpu;
class PxPhysicsGpu;
typedef physx::PxPhysXGpu* (PxCreatePhysXGpu_FUNC)();
typedef physx::PxCudaContextManager* (PxCreateCudaContextManager_FUNC)(physx::PxFoundation& foundation, const physx::PxCudaContextManagerDesc& desc, physx::PxProfilerCallback* profilerCallback, bool launchSynchronous);
typedef int (PxGetSuggestedCudaDeviceOrdinal_FUNC)(physx::PxErrorCallback& errc);
typedef void (PxSetPhysXGpuProfilerCallback_FUNC)(physx::PxProfilerCallback* cbk);
typedef void (PxCudaRegisterFunction_FUNC)(int, const char*);
typedef void** (PxCudaRegisterFatBinary_FUNC)(void*);
typedef physx::PxKernelIndex* (PxGetCudaFunctionTable_FUNC)();
typedef PxU32 (PxGetCudaFunctionTableSize_FUNC)();
typedef void** PxGetCudaModuleTable_FUNC();
typedef PxPhysicsGpu* PxCreatePhysicsGpu_FUNC();
PxCreatePhysXGpu_FUNC* g_PxCreatePhysXGpu_Func = NULL;
PxCreateCudaContextManager_FUNC* g_PxCreateCudaContextManager_Func = NULL;
PxGetSuggestedCudaDeviceOrdinal_FUNC* g_PxGetSuggestedCudaDeviceOrdinal_Func = NULL;
PxSetPhysXGpuProfilerCallback_FUNC* g_PxSetPhysXGpuProfilerCallback_Func = NULL;
PxCudaRegisterFunction_FUNC* g_PxCudaRegisterFunction_Func = NULL;
PxCudaRegisterFatBinary_FUNC* g_PxCudaRegisterFatBinary_Func = NULL;
PxGetCudaFunctionTable_FUNC* g_PxGetCudaFunctionTable_Func = NULL;
PxGetCudaFunctionTableSize_FUNC* g_PxGetCudaFunctionTableSize_Func = NULL;
PxGetCudaFunctionTableSize_FUNC* g_PxGetCudaModuleTableSize_Func = NULL;
PxGetCudaModuleTable_FUNC* g_PxGetCudaModuleTable_Func = NULL;
PxCreatePhysicsGpu_FUNC* g_PxCreatePhysicsGpu_Func = NULL;
void PxUnloadPhysxGPUModule()
{
g_PxCreatePhysXGpu_Func = NULL;
g_PxCreateCudaContextManager_Func = NULL;
g_PxGetSuggestedCudaDeviceOrdinal_Func = NULL;
g_PxSetPhysXGpuProfilerCallback_Func = NULL;
g_PxCudaRegisterFunction_Func = NULL;
g_PxCudaRegisterFatBinary_Func = NULL;
g_PxGetCudaFunctionTable_Func = NULL;
g_PxGetCudaFunctionTableSize_Func = NULL;
g_PxGetCudaModuleTableSize_Func = NULL;
g_PxGetCudaModuleTable_Func = NULL;
g_PxCreatePhysicsGpu_Func = NULL;
}
#if PX_WINDOWS
typedef void (PxSetPhysXGpuDelayLoadHook_FUNC)(const PxDelayLoadHook* delayLoadHook);
#define DEFAULT_PHYSX_GPU_GUID "D79FA4BF-177C-4841-8091-4375D311D6A3"
void PxLoadPhysxGPUModule(const char* appGUID)
{
HMODULE s_library = GetModuleHandle(gPhysXGpuLibraryName);
bool freshlyLoaded = false;
if (s_library == NULL)
{
Cm::CmModuleUpdateLoader moduleLoader(UPDATE_LOADER_DLL_NAME);
s_library = moduleLoader.LoadModule(gPhysXGpuLibraryName, appGUID == NULL ? DEFAULT_PHYSX_GPU_GUID : appGUID);
freshlyLoaded = true;
}
if (s_library && (freshlyLoaded || g_PxCreatePhysXGpu_Func == NULL))
{
g_PxCreatePhysXGpu_Func = (PxCreatePhysXGpu_FUNC*)GetProcAddress(s_library, "PxCreatePhysXGpu");
g_PxCreateCudaContextManager_Func = (PxCreateCudaContextManager_FUNC*)GetProcAddress(s_library, "PxCreateCudaContextManager");
g_PxGetSuggestedCudaDeviceOrdinal_Func = (PxGetSuggestedCudaDeviceOrdinal_FUNC*)GetProcAddress(s_library, "PxGetSuggestedCudaDeviceOrdinal");
g_PxSetPhysXGpuProfilerCallback_Func = (PxSetPhysXGpuProfilerCallback_FUNC*)GetProcAddress(s_library, "PxSetPhysXGpuProfilerCallback");
g_PxCudaRegisterFunction_Func = (PxCudaRegisterFunction_FUNC*)GetProcAddress(s_library, "PxGpuCudaRegisterFunction");
g_PxCudaRegisterFatBinary_Func = (PxCudaRegisterFatBinary_FUNC*)GetProcAddress(s_library, "PxGpuCudaRegisterFatBinary");
g_PxGetCudaFunctionTable_Func = (PxGetCudaFunctionTable_FUNC*)GetProcAddress(s_library, "PxGpuGetCudaFunctionTable");
g_PxGetCudaFunctionTableSize_Func = (PxGetCudaFunctionTableSize_FUNC*)GetProcAddress(s_library, "PxGpuGetCudaFunctionTableSize");
g_PxGetCudaModuleTableSize_Func = (PxGetCudaFunctionTableSize_FUNC*)GetProcAddress(s_library, "PxGpuGetCudaModuleTableSize");
g_PxGetCudaModuleTable_Func = (PxGetCudaModuleTable_FUNC*)GetProcAddress(s_library, "PxGpuGetCudaModuleTable");
g_PxCreatePhysicsGpu_Func = (PxCreatePhysicsGpu_FUNC*)GetProcAddress(s_library, "PxGpuCreatePhysicsGpu");
}
// Check for errors
if (s_library == NULL)
{
reportError(PX_FL, "Failed to load %s!\n", gPhysXGpuLibraryName);
return;
}
if (g_PxCreatePhysXGpu_Func == NULL || g_PxCreateCudaContextManager_Func == NULL || g_PxGetSuggestedCudaDeviceOrdinal_Func == NULL || g_PxSetPhysXGpuProfilerCallback_Func == NULL)
{
reportError(PX_FL, "PhysXGpu dll is incompatible with this version of PhysX!\n");
return;
}
}
#elif PX_LINUX
void PxLoadPhysxGPUModule(const char*)
{
static void* s_library = NULL;
if (s_library == NULL)
{
// load libcuda.so here since gcc configured with --as-needed won't link to it
// if there is no call from the binary to it.
void* hLibCuda = dlopen("libcuda.so", RTLD_NOW | RTLD_GLOBAL);
if (hLibCuda)
{
s_library = dlopen(gPhysXGpuLibraryName, RTLD_NOW);
}
else
{
char* error = dlerror();
reportError(PX_FL, "Could not load libcuda.so: %s\n", error);
return;
}
}
// no UpdateLoader
if (s_library)
{
*reinterpret_cast<void**>(&g_PxCreatePhysXGpu_Func) = dlsym(s_library, "PxCreatePhysXGpu");
*reinterpret_cast<void**>(&g_PxCreateCudaContextManager_Func) = dlsym(s_library, "PxCreateCudaContextManager");
*reinterpret_cast<void**>(&g_PxGetSuggestedCudaDeviceOrdinal_Func) = dlsym(s_library, "PxGetSuggestedCudaDeviceOrdinal");
*reinterpret_cast<void**>(&g_PxSetPhysXGpuProfilerCallback_Func) = dlsym(s_library, "PxSetPhysXGpuProfilerCallback");
*reinterpret_cast<void**>(&g_PxCudaRegisterFunction_Func) = dlsym(s_library, "PxGpuCudaRegisterFunction");
*reinterpret_cast<void**>(&g_PxCudaRegisterFatBinary_Func) = dlsym(s_library, "PxGpuCudaRegisterFatBinary");
*reinterpret_cast<void**>(&g_PxGetCudaFunctionTable_Func) = dlsym(s_library, "PxGpuGetCudaFunctionTable");
*reinterpret_cast<void**>(&g_PxGetCudaFunctionTableSize_Func) = dlsym(s_library, "PxGpuGetCudaFunctionTableSize");
*reinterpret_cast<void**>(&g_PxGetCudaModuleTableSize_Func) = dlsym(s_library, "PxGpuGetCudaModuleTableSize");
*reinterpret_cast<void**>(&g_PxGetCudaModuleTable_Func) = dlsym(s_library, "PxGpuGetCudaModuleTable");
*reinterpret_cast<void**>(&g_PxCreatePhysicsGpu_Func) = dlsym(s_library, "PxGpuCreatePhysicsGpu");
}
// Check for errors
if (s_library == NULL)
{
char* error = dlerror();
reportError(PX_FL, "Failed to load %s!: %s\n", gPhysXGpuLibraryName, error);
return;
}
if (g_PxCreatePhysXGpu_Func == NULL || g_PxCreateCudaContextManager_Func == NULL || g_PxGetSuggestedCudaDeviceOrdinal_Func == NULL)
{
reportError(PX_FL, "%s is incompatible with this version of PhysX!\n", gPhysXGpuLibraryName);
return;
}
}
#endif // PX_LINUX
} // end physx namespace
#if PX_CLANG
#pragma clang diagnostic pop
#endif
#endif // PX_SUPPORT_GPU_PHYSX
| 9,989 | C++ | 39.942623 | 219 | 0.76404 |
NVIDIA-Omniverse/PhysX/physx/source/physx/src/gpu/PxGpu.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#include "PxPhysXConfig.h"
#if PX_SUPPORT_GPU_PHYSX
#include "gpu/PxGpu.h"
#ifndef PX_PHYSX_GPU_STATIC
namespace physx
{
//forward declare stuff from PxPhysXGpuModuleLoader.cpp
void PxLoadPhysxGPUModule(const char* appGUID);
typedef physx::PxCudaContextManager* (PxCreateCudaContextManager_FUNC)(physx::PxFoundation& foundation, const physx::PxCudaContextManagerDesc& desc, physx::PxProfilerCallback* profilerCallback, bool launchSynchronous);
typedef int (PxGetSuggestedCudaDeviceOrdinal_FUNC)(physx::PxErrorCallback& errc);
typedef void (PxSetPhysXGpuProfilerCallback_FUNC)(physx::PxProfilerCallback* cbk);
typedef void (PxCudaRegisterFunction_FUNC)(int, const char*);
typedef void** (PxCudaRegisterFatBinary_FUNC)(void*);
typedef physx::PxKernelIndex* (PxGetCudaFunctionTable_FUNC)();
typedef PxU32 (PxGetCudaFunctionTableSize_FUNC)();
typedef void** PxGetCudaModuleTable_FUNC();
typedef PxPhysicsGpu* PxCreatePhysicsGpu_FUNC();
extern PxCreateCudaContextManager_FUNC* g_PxCreateCudaContextManager_Func;
extern PxGetSuggestedCudaDeviceOrdinal_FUNC* g_PxGetSuggestedCudaDeviceOrdinal_Func;
extern PxSetPhysXGpuProfilerCallback_FUNC* g_PxSetPhysXGpuProfilerCallback_Func;
extern PxCudaRegisterFunction_FUNC* g_PxCudaRegisterFunction_Func;
extern PxCudaRegisterFatBinary_FUNC* g_PxCudaRegisterFatBinary_Func;
extern PxGetCudaFunctionTable_FUNC* g_PxGetCudaFunctionTable_Func;
extern PxGetCudaFunctionTableSize_FUNC* g_PxGetCudaFunctionTableSize_Func;
extern PxGetCudaFunctionTableSize_FUNC* g_PxGetCudaModuleTableSize_Func;
extern PxGetCudaModuleTable_FUNC* g_PxGetCudaModuleTable_Func;
extern PxCreatePhysicsGpu_FUNC* g_PxCreatePhysicsGpu_Func;
} // end of physx namespace
physx::PxCudaContextManager* PxCreateCudaContextManager(physx::PxFoundation& foundation, const physx::PxCudaContextManagerDesc& desc, physx::PxProfilerCallback* profilerCallback, bool launchSynchronous)
{
physx::PxLoadPhysxGPUModule(desc.appGUID);
if (physx::g_PxCreateCudaContextManager_Func)
return physx::g_PxCreateCudaContextManager_Func(foundation, desc, profilerCallback, launchSynchronous);
else
return NULL;
}
int PxGetSuggestedCudaDeviceOrdinal(physx::PxErrorCallback& errc)
{
physx::PxLoadPhysxGPUModule(NULL);
if (physx::g_PxGetSuggestedCudaDeviceOrdinal_Func)
return physx::g_PxGetSuggestedCudaDeviceOrdinal_Func(errc);
else
return -1;
}
void PxSetPhysXGpuProfilerCallback(physx::PxProfilerCallback* profilerCallback)
{
physx::PxLoadPhysxGPUModule(NULL);
if (physx::g_PxSetPhysXGpuProfilerCallback_Func)
physx::g_PxSetPhysXGpuProfilerCallback_Func(profilerCallback);
}
void PxCudaRegisterFunction(int moduleIndex, const char* functionName)
{
physx::PxLoadPhysxGPUModule(NULL);
if (physx::g_PxCudaRegisterFunction_Func)
physx::g_PxCudaRegisterFunction_Func(moduleIndex, functionName);
}
void** PxCudaRegisterFatBinary(void* fatBin)
{
physx::PxLoadPhysxGPUModule(NULL);
if (physx::g_PxCudaRegisterFatBinary_Func)
return physx::g_PxCudaRegisterFatBinary_Func(fatBin);
return NULL;
}
physx::PxKernelIndex* PxGetCudaFunctionTable()
{
physx::PxLoadPhysxGPUModule(NULL);
if(physx::g_PxGetCudaFunctionTable_Func)
return physx::g_PxGetCudaFunctionTable_Func();
return NULL;
}
physx::PxU32 PxGetCudaFunctionTableSize()
{
physx::PxLoadPhysxGPUModule(NULL);
if(physx::g_PxGetCudaFunctionTableSize_Func)
return physx::g_PxGetCudaFunctionTableSize_Func();
return 0;
}
void** PxGetCudaModuleTable()
{
physx::PxLoadPhysxGPUModule(NULL);
if(physx::g_PxGetCudaModuleTable_Func)
return physx::g_PxGetCudaModuleTable_Func();
return NULL;
}
physx::PxU32 PxGetCudaModuleTableSize()
{
physx::PxLoadPhysxGPUModule(NULL);
if(physx::g_PxGetCudaModuleTableSize_Func)
return physx::g_PxGetCudaModuleTableSize_Func();
return 0;
}
physx::PxPhysicsGpu* PxGetPhysicsGpu()
{
physx::PxLoadPhysxGPUModule(NULL);
if (physx::g_PxCreatePhysicsGpu_Func)
return physx::g_PxCreatePhysicsGpu_Func();
return NULL;
}
#endif // PX_PHYSX_GPU_STATIC
#endif // PX_SUPPORT_GPU_PHYSX
| 5,599 | C++ | 32.333333 | 219 | 0.795856 |
NVIDIA-Omniverse/PhysX/physx/source/physxmetadata/extensions/src/PxExtensionAutoGeneratedMetaDataObjects.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
// This code is auto-generated by the PhysX Clang metadata generator. Do not edit or be
// prepared for your edits to be quietly ignored next time the clang metadata generator is
// run. You can find the most recent version of clang metadata generator by contacting
// Chris Nuernberger <[email protected]> or Dilip or Adam.
// The source code for the generate was at one time checked into:
// physx/PhysXMetaDataGenerator/llvm/tools/clang/lib/Frontend/PhysXMetaDataAction.cpp
#include "foundation/PxPreprocessor.h"
#if PX_LINUX && PX_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wreserved-identifier"
#endif
#include "PxExtensionMetaDataObjects.h"
#if PX_LINUX && PX_CLANG
#pragma clang diagnostic pop
#endif
#include "PxMetaDataCppPrefix.h"
#include "extensions/PxExtensionsAPI.h"
using namespace physx;
void setPxJoint_Actors( PxJoint* inObj, PxRigidActor * inArg0, PxRigidActor * inArg1 ) { inObj->setActors( inArg0, inArg1 ); }
void getPxJoint_Actors( const PxJoint* inObj, PxRigidActor *& inArg0, PxRigidActor *& inArg1 ) { inObj->getActors( inArg0, inArg1 ); }
void setPxJoint_LocalPose( PxJoint* inObj, PxJointActorIndex::Enum inIndex, PxTransform inArg ){ inObj->setLocalPose( inIndex, inArg ); }
PxTransform getPxJoint_LocalPose( const PxJoint* inObj, PxJointActorIndex::Enum inIndex ) { return inObj->getLocalPose( inIndex ); }
PxTransform getPxJoint_RelativeTransform( const PxJoint* inObj ) { return inObj->getRelativeTransform(); }
PxVec3 getPxJoint_RelativeLinearVelocity( const PxJoint* inObj ) { return inObj->getRelativeLinearVelocity(); }
PxVec3 getPxJoint_RelativeAngularVelocity( const PxJoint* inObj ) { return inObj->getRelativeAngularVelocity(); }
void setPxJoint_BreakForce( PxJoint* inObj, PxReal inArg0, PxReal inArg1 ) { inObj->setBreakForce( inArg0, inArg1 ); }
void getPxJoint_BreakForce( const PxJoint* inObj, PxReal& inArg0, PxReal& inArg1 ) { inObj->getBreakForce( inArg0, inArg1 ); }
void setPxJoint_ConstraintFlags( PxJoint* inObj, PxConstraintFlags inArg){ inObj->setConstraintFlags( inArg ); }
PxConstraintFlags getPxJoint_ConstraintFlags( const PxJoint* inObj ) { return inObj->getConstraintFlags(); }
void setPxJoint_InvMassScale0( PxJoint* inObj, PxReal inArg){ inObj->setInvMassScale0( inArg ); }
PxReal getPxJoint_InvMassScale0( const PxJoint* inObj ) { return inObj->getInvMassScale0(); }
void setPxJoint_InvInertiaScale0( PxJoint* inObj, PxReal inArg){ inObj->setInvInertiaScale0( inArg ); }
PxReal getPxJoint_InvInertiaScale0( const PxJoint* inObj ) { return inObj->getInvInertiaScale0(); }
void setPxJoint_InvMassScale1( PxJoint* inObj, PxReal inArg){ inObj->setInvMassScale1( inArg ); }
PxReal getPxJoint_InvMassScale1( const PxJoint* inObj ) { return inObj->getInvMassScale1(); }
void setPxJoint_InvInertiaScale1( PxJoint* inObj, PxReal inArg){ inObj->setInvInertiaScale1( inArg ); }
PxReal getPxJoint_InvInertiaScale1( const PxJoint* inObj ) { return inObj->getInvInertiaScale1(); }
PxConstraint * getPxJoint_Constraint( const PxJoint* inObj ) { return inObj->getConstraint(); }
void setPxJoint_Name( PxJoint* inObj, const char * inArg){ inObj->setName( inArg ); }
const char * getPxJoint_Name( const PxJoint* inObj ) { return inObj->getName(); }
PxScene * getPxJoint_Scene( const PxJoint* inObj ) { return inObj->getScene(); }
inline void * getPxJointUserData( const PxJoint* inOwner ) { return inOwner->userData; }
inline void setPxJointUserData( PxJoint* inOwner, void * inData) { inOwner->userData = inData; }
PxJointGeneratedInfo::PxJointGeneratedInfo()
: Actors( "Actors", "actor0", "actor1", setPxJoint_Actors, getPxJoint_Actors)
, LocalPose( "LocalPose", setPxJoint_LocalPose, getPxJoint_LocalPose)
, RelativeTransform( "RelativeTransform", getPxJoint_RelativeTransform)
, RelativeLinearVelocity( "RelativeLinearVelocity", getPxJoint_RelativeLinearVelocity)
, RelativeAngularVelocity( "RelativeAngularVelocity", getPxJoint_RelativeAngularVelocity)
, BreakForce( "BreakForce", "force", "torque", setPxJoint_BreakForce, getPxJoint_BreakForce)
, ConstraintFlags( "ConstraintFlags", setPxJoint_ConstraintFlags, getPxJoint_ConstraintFlags)
, InvMassScale0( "InvMassScale0", setPxJoint_InvMassScale0, getPxJoint_InvMassScale0)
, InvInertiaScale0( "InvInertiaScale0", setPxJoint_InvInertiaScale0, getPxJoint_InvInertiaScale0)
, InvMassScale1( "InvMassScale1", setPxJoint_InvMassScale1, getPxJoint_InvMassScale1)
, InvInertiaScale1( "InvInertiaScale1", setPxJoint_InvInertiaScale1, getPxJoint_InvInertiaScale1)
, Constraint( "Constraint", getPxJoint_Constraint)
, Name( "Name", setPxJoint_Name, getPxJoint_Name)
, Scene( "Scene", getPxJoint_Scene)
, UserData( "UserData", setPxJointUserData, getPxJointUserData )
{}
PxJointGeneratedValues::PxJointGeneratedValues( const PxJoint* inSource )
:RelativeTransform( getPxJoint_RelativeTransform( inSource ) )
,RelativeLinearVelocity( getPxJoint_RelativeLinearVelocity( inSource ) )
,RelativeAngularVelocity( getPxJoint_RelativeAngularVelocity( inSource ) )
,ConstraintFlags( getPxJoint_ConstraintFlags( inSource ) )
,InvMassScale0( getPxJoint_InvMassScale0( inSource ) )
,InvInertiaScale0( getPxJoint_InvInertiaScale0( inSource ) )
,InvMassScale1( getPxJoint_InvMassScale1( inSource ) )
,InvInertiaScale1( getPxJoint_InvInertiaScale1( inSource ) )
,Constraint( getPxJoint_Constraint( inSource ) )
,Name( getPxJoint_Name( inSource ) )
,Scene( getPxJoint_Scene( inSource ) )
,UserData( inSource->userData )
{
PX_UNUSED(inSource);
getPxJoint_Actors( inSource, Actors[0], Actors[1] );
for ( PxU32 idx = 0; idx < static_cast<PxU32>( physx::PxJointActorIndex::COUNT ); ++idx )
LocalPose[idx] = getPxJoint_LocalPose( inSource, static_cast< PxJointActorIndex::Enum >( idx ) );
getPxJoint_BreakForce( inSource, BreakForce[0], BreakForce[1] );
}
void setPxRackAndPinionJoint_Ratio( PxRackAndPinionJoint* inObj, float inArg){ inObj->setRatio( inArg ); }
float getPxRackAndPinionJoint_Ratio( const PxRackAndPinionJoint* inObj ) { return inObj->getRatio(); }
const char * getPxRackAndPinionJoint_ConcreteTypeName( const PxRackAndPinionJoint* inObj ) { return inObj->getConcreteTypeName(); }
PxRackAndPinionJointGeneratedInfo::PxRackAndPinionJointGeneratedInfo()
: Ratio( "Ratio", setPxRackAndPinionJoint_Ratio, getPxRackAndPinionJoint_Ratio)
, ConcreteTypeName( "ConcreteTypeName", getPxRackAndPinionJoint_ConcreteTypeName)
{}
PxRackAndPinionJointGeneratedValues::PxRackAndPinionJointGeneratedValues( const PxRackAndPinionJoint* inSource )
:PxJointGeneratedValues( inSource )
,Ratio( getPxRackAndPinionJoint_Ratio( inSource ) )
,ConcreteTypeName( getPxRackAndPinionJoint_ConcreteTypeName( inSource ) )
{
PX_UNUSED(inSource);
}
void setPxGearJoint_GearRatio( PxGearJoint* inObj, float inArg){ inObj->setGearRatio( inArg ); }
float getPxGearJoint_GearRatio( const PxGearJoint* inObj ) { return inObj->getGearRatio(); }
const char * getPxGearJoint_ConcreteTypeName( const PxGearJoint* inObj ) { return inObj->getConcreteTypeName(); }
PxGearJointGeneratedInfo::PxGearJointGeneratedInfo()
: GearRatio( "GearRatio", setPxGearJoint_GearRatio, getPxGearJoint_GearRatio)
, ConcreteTypeName( "ConcreteTypeName", getPxGearJoint_ConcreteTypeName)
{}
PxGearJointGeneratedValues::PxGearJointGeneratedValues( const PxGearJoint* inSource )
:PxJointGeneratedValues( inSource )
,GearRatio( getPxGearJoint_GearRatio( inSource ) )
,ConcreteTypeName( getPxGearJoint_ConcreteTypeName( inSource ) )
{
PX_UNUSED(inSource);
}
void setPxD6Joint_Motion( PxD6Joint* inObj, PxD6Axis::Enum inIndex, PxD6Motion::Enum inArg ){ inObj->setMotion( inIndex, inArg ); }
PxD6Motion::Enum getPxD6Joint_Motion( const PxD6Joint* inObj, PxD6Axis::Enum inIndex ) { return inObj->getMotion( inIndex ); }
PxReal getPxD6Joint_TwistAngle( const PxD6Joint* inObj ) { return inObj->getTwistAngle(); }
PxReal getPxD6Joint_Twist( const PxD6Joint* inObj ) { return inObj->getTwist(); }
PxReal getPxD6Joint_SwingYAngle( const PxD6Joint* inObj ) { return inObj->getSwingYAngle(); }
PxReal getPxD6Joint_SwingZAngle( const PxD6Joint* inObj ) { return inObj->getSwingZAngle(); }
void setPxD6Joint_DistanceLimit( PxD6Joint* inObj, const PxJointLinearLimit & inArg){ inObj->setDistanceLimit( inArg ); }
PxJointLinearLimit getPxD6Joint_DistanceLimit( const PxD6Joint* inObj ) { return inObj->getDistanceLimit(); }
void setPxD6Joint_LinearLimit( PxD6Joint* inObj, const PxJointLinearLimit & inArg){ inObj->setLinearLimit( inArg ); }
PxJointLinearLimit getPxD6Joint_LinearLimit( const PxD6Joint* inObj ) { return inObj->getLinearLimit(); }
void setPxD6Joint_TwistLimit( PxD6Joint* inObj, const PxJointAngularLimitPair & inArg){ inObj->setTwistLimit( inArg ); }
PxJointAngularLimitPair getPxD6Joint_TwistLimit( const PxD6Joint* inObj ) { return inObj->getTwistLimit(); }
void setPxD6Joint_SwingLimit( PxD6Joint* inObj, const PxJointLimitCone & inArg){ inObj->setSwingLimit( inArg ); }
PxJointLimitCone getPxD6Joint_SwingLimit( const PxD6Joint* inObj ) { return inObj->getSwingLimit(); }
void setPxD6Joint_PyramidSwingLimit( PxD6Joint* inObj, const PxJointLimitPyramid & inArg){ inObj->setPyramidSwingLimit( inArg ); }
PxJointLimitPyramid getPxD6Joint_PyramidSwingLimit( const PxD6Joint* inObj ) { return inObj->getPyramidSwingLimit(); }
void setPxD6Joint_Drive( PxD6Joint* inObj, PxD6Drive::Enum inIndex, PxD6JointDrive inArg ){ inObj->setDrive( inIndex, inArg ); }
PxD6JointDrive getPxD6Joint_Drive( const PxD6Joint* inObj, PxD6Drive::Enum inIndex ) { return inObj->getDrive( inIndex ); }
void setPxD6Joint_DrivePosition( PxD6Joint* inObj, const PxTransform & inArg){ inObj->setDrivePosition( inArg ); }
PxTransform getPxD6Joint_DrivePosition( const PxD6Joint* inObj ) { return inObj->getDrivePosition(); }
const char * getPxD6Joint_ConcreteTypeName( const PxD6Joint* inObj ) { return inObj->getConcreteTypeName(); }
PxD6JointGeneratedInfo::PxD6JointGeneratedInfo()
: Motion( "Motion", setPxD6Joint_Motion, getPxD6Joint_Motion)
, TwistAngle( "TwistAngle", getPxD6Joint_TwistAngle)
, Twist( "Twist", getPxD6Joint_Twist)
, SwingYAngle( "SwingYAngle", getPxD6Joint_SwingYAngle)
, SwingZAngle( "SwingZAngle", getPxD6Joint_SwingZAngle)
, DistanceLimit( "DistanceLimit", setPxD6Joint_DistanceLimit, getPxD6Joint_DistanceLimit)
, LinearLimit( "LinearLimit", setPxD6Joint_LinearLimit, getPxD6Joint_LinearLimit)
, TwistLimit( "TwistLimit", setPxD6Joint_TwistLimit, getPxD6Joint_TwistLimit)
, SwingLimit( "SwingLimit", setPxD6Joint_SwingLimit, getPxD6Joint_SwingLimit)
, PyramidSwingLimit( "PyramidSwingLimit", setPxD6Joint_PyramidSwingLimit, getPxD6Joint_PyramidSwingLimit)
, Drive( "Drive", setPxD6Joint_Drive, getPxD6Joint_Drive)
, DrivePosition( "DrivePosition", setPxD6Joint_DrivePosition, getPxD6Joint_DrivePosition)
, ConcreteTypeName( "ConcreteTypeName", getPxD6Joint_ConcreteTypeName)
{}
PxD6JointGeneratedValues::PxD6JointGeneratedValues( const PxD6Joint* inSource )
:PxJointGeneratedValues( inSource )
,TwistAngle( getPxD6Joint_TwistAngle( inSource ) )
,Twist( getPxD6Joint_Twist( inSource ) )
,SwingYAngle( getPxD6Joint_SwingYAngle( inSource ) )
,SwingZAngle( getPxD6Joint_SwingZAngle( inSource ) )
,DistanceLimit( getPxD6Joint_DistanceLimit( inSource ) )
,LinearLimit( getPxD6Joint_LinearLimit( inSource ) )
,TwistLimit( getPxD6Joint_TwistLimit( inSource ) )
,SwingLimit( getPxD6Joint_SwingLimit( inSource ) )
,PyramidSwingLimit( getPxD6Joint_PyramidSwingLimit( inSource ) )
,DrivePosition( getPxD6Joint_DrivePosition( inSource ) )
,ConcreteTypeName( getPxD6Joint_ConcreteTypeName( inSource ) )
{
PX_UNUSED(inSource);
for ( PxU32 idx = 0; idx < static_cast<PxU32>( physx::PxD6Axis::eCOUNT ); ++idx )
Motion[idx] = getPxD6Joint_Motion( inSource, static_cast< PxD6Axis::Enum >( idx ) );
for ( PxU32 idx = 0; idx < static_cast<PxU32>( physx::PxD6Drive::eCOUNT ); ++idx )
Drive[idx] = getPxD6Joint_Drive( inSource, static_cast< PxD6Drive::Enum >( idx ) );
}
PxReal getPxDistanceJoint_Distance( const PxDistanceJoint* inObj ) { return inObj->getDistance(); }
void setPxDistanceJoint_MinDistance( PxDistanceJoint* inObj, PxReal inArg){ inObj->setMinDistance( inArg ); }
PxReal getPxDistanceJoint_MinDistance( const PxDistanceJoint* inObj ) { return inObj->getMinDistance(); }
void setPxDistanceJoint_MaxDistance( PxDistanceJoint* inObj, PxReal inArg){ inObj->setMaxDistance( inArg ); }
PxReal getPxDistanceJoint_MaxDistance( const PxDistanceJoint* inObj ) { return inObj->getMaxDistance(); }
void setPxDistanceJoint_Tolerance( PxDistanceJoint* inObj, PxReal inArg){ inObj->setTolerance( inArg ); }
PxReal getPxDistanceJoint_Tolerance( const PxDistanceJoint* inObj ) { return inObj->getTolerance(); }
void setPxDistanceJoint_Stiffness( PxDistanceJoint* inObj, PxReal inArg){ inObj->setStiffness( inArg ); }
PxReal getPxDistanceJoint_Stiffness( const PxDistanceJoint* inObj ) { return inObj->getStiffness(); }
void setPxDistanceJoint_Damping( PxDistanceJoint* inObj, PxReal inArg){ inObj->setDamping( inArg ); }
PxReal getPxDistanceJoint_Damping( const PxDistanceJoint* inObj ) { return inObj->getDamping(); }
void setPxDistanceJoint_DistanceJointFlags( PxDistanceJoint* inObj, PxDistanceJointFlags inArg){ inObj->setDistanceJointFlags( inArg ); }
PxDistanceJointFlags getPxDistanceJoint_DistanceJointFlags( const PxDistanceJoint* inObj ) { return inObj->getDistanceJointFlags(); }
const char * getPxDistanceJoint_ConcreteTypeName( const PxDistanceJoint* inObj ) { return inObj->getConcreteTypeName(); }
PxDistanceJointGeneratedInfo::PxDistanceJointGeneratedInfo()
: Distance( "Distance", getPxDistanceJoint_Distance)
, MinDistance( "MinDistance", setPxDistanceJoint_MinDistance, getPxDistanceJoint_MinDistance)
, MaxDistance( "MaxDistance", setPxDistanceJoint_MaxDistance, getPxDistanceJoint_MaxDistance)
, Tolerance( "Tolerance", setPxDistanceJoint_Tolerance, getPxDistanceJoint_Tolerance)
, Stiffness( "Stiffness", setPxDistanceJoint_Stiffness, getPxDistanceJoint_Stiffness)
, Damping( "Damping", setPxDistanceJoint_Damping, getPxDistanceJoint_Damping)
, DistanceJointFlags( "DistanceJointFlags", setPxDistanceJoint_DistanceJointFlags, getPxDistanceJoint_DistanceJointFlags)
, ConcreteTypeName( "ConcreteTypeName", getPxDistanceJoint_ConcreteTypeName)
{}
PxDistanceJointGeneratedValues::PxDistanceJointGeneratedValues( const PxDistanceJoint* inSource )
:PxJointGeneratedValues( inSource )
,Distance( getPxDistanceJoint_Distance( inSource ) )
,MinDistance( getPxDistanceJoint_MinDistance( inSource ) )
,MaxDistance( getPxDistanceJoint_MaxDistance( inSource ) )
,Tolerance( getPxDistanceJoint_Tolerance( inSource ) )
,Stiffness( getPxDistanceJoint_Stiffness( inSource ) )
,Damping( getPxDistanceJoint_Damping( inSource ) )
,DistanceJointFlags( getPxDistanceJoint_DistanceJointFlags( inSource ) )
,ConcreteTypeName( getPxDistanceJoint_ConcreteTypeName( inSource ) )
{
PX_UNUSED(inSource);
}
void setPxContactJoint_Contact( PxContactJoint* inObj, const PxVec3 & inArg){ inObj->setContact( inArg ); }
PxVec3 getPxContactJoint_Contact( const PxContactJoint* inObj ) { return inObj->getContact(); }
void setPxContactJoint_ContactNormal( PxContactJoint* inObj, const PxVec3 & inArg){ inObj->setContactNormal( inArg ); }
PxVec3 getPxContactJoint_ContactNormal( const PxContactJoint* inObj ) { return inObj->getContactNormal(); }
void setPxContactJoint_Penetration( PxContactJoint* inObj, const PxReal inArg){ inObj->setPenetration( inArg ); }
PxReal getPxContactJoint_Penetration( const PxContactJoint* inObj ) { return inObj->getPenetration(); }
void setPxContactJoint_Restitution( PxContactJoint* inObj, const PxReal inArg){ inObj->setRestitution( inArg ); }
PxReal getPxContactJoint_Restitution( const PxContactJoint* inObj ) { return inObj->getRestitution(); }
void setPxContactJoint_BounceThreshold( PxContactJoint* inObj, const PxReal inArg){ inObj->setBounceThreshold( inArg ); }
PxReal getPxContactJoint_BounceThreshold( const PxContactJoint* inObj ) { return inObj->getBounceThreshold(); }
const char * getPxContactJoint_ConcreteTypeName( const PxContactJoint* inObj ) { return inObj->getConcreteTypeName(); }
PxContactJointGeneratedInfo::PxContactJointGeneratedInfo()
: Contact( "Contact", setPxContactJoint_Contact, getPxContactJoint_Contact)
, ContactNormal( "ContactNormal", setPxContactJoint_ContactNormal, getPxContactJoint_ContactNormal)
, Penetration( "Penetration", setPxContactJoint_Penetration, getPxContactJoint_Penetration)
, Restitution( "Restitution", setPxContactJoint_Restitution, getPxContactJoint_Restitution)
, BounceThreshold( "BounceThreshold", setPxContactJoint_BounceThreshold, getPxContactJoint_BounceThreshold)
, ConcreteTypeName( "ConcreteTypeName", getPxContactJoint_ConcreteTypeName)
{}
PxContactJointGeneratedValues::PxContactJointGeneratedValues( const PxContactJoint* inSource )
:PxJointGeneratedValues( inSource )
,Contact( getPxContactJoint_Contact( inSource ) )
,ContactNormal( getPxContactJoint_ContactNormal( inSource ) )
,Penetration( getPxContactJoint_Penetration( inSource ) )
,Restitution( getPxContactJoint_Restitution( inSource ) )
,BounceThreshold( getPxContactJoint_BounceThreshold( inSource ) )
,ConcreteTypeName( getPxContactJoint_ConcreteTypeName( inSource ) )
{
PX_UNUSED(inSource);
}
const char * getPxFixedJoint_ConcreteTypeName( const PxFixedJoint* inObj ) { return inObj->getConcreteTypeName(); }
PxFixedJointGeneratedInfo::PxFixedJointGeneratedInfo()
: ConcreteTypeName( "ConcreteTypeName", getPxFixedJoint_ConcreteTypeName)
{}
PxFixedJointGeneratedValues::PxFixedJointGeneratedValues( const PxFixedJoint* inSource )
:PxJointGeneratedValues( inSource )
,ConcreteTypeName( getPxFixedJoint_ConcreteTypeName( inSource ) )
{
PX_UNUSED(inSource);
}
PxReal getPxPrismaticJoint_Position( const PxPrismaticJoint* inObj ) { return inObj->getPosition(); }
PxReal getPxPrismaticJoint_Velocity( const PxPrismaticJoint* inObj ) { return inObj->getVelocity(); }
void setPxPrismaticJoint_Limit( PxPrismaticJoint* inObj, const PxJointLinearLimitPair & inArg){ inObj->setLimit( inArg ); }
PxJointLinearLimitPair getPxPrismaticJoint_Limit( const PxPrismaticJoint* inObj ) { return inObj->getLimit(); }
void setPxPrismaticJoint_PrismaticJointFlags( PxPrismaticJoint* inObj, PxPrismaticJointFlags inArg){ inObj->setPrismaticJointFlags( inArg ); }
PxPrismaticJointFlags getPxPrismaticJoint_PrismaticJointFlags( const PxPrismaticJoint* inObj ) { return inObj->getPrismaticJointFlags(); }
const char * getPxPrismaticJoint_ConcreteTypeName( const PxPrismaticJoint* inObj ) { return inObj->getConcreteTypeName(); }
PxPrismaticJointGeneratedInfo::PxPrismaticJointGeneratedInfo()
: Position( "Position", getPxPrismaticJoint_Position)
, Velocity( "Velocity", getPxPrismaticJoint_Velocity)
, Limit( "Limit", setPxPrismaticJoint_Limit, getPxPrismaticJoint_Limit)
, PrismaticJointFlags( "PrismaticJointFlags", setPxPrismaticJoint_PrismaticJointFlags, getPxPrismaticJoint_PrismaticJointFlags)
, ConcreteTypeName( "ConcreteTypeName", getPxPrismaticJoint_ConcreteTypeName)
{}
PxPrismaticJointGeneratedValues::PxPrismaticJointGeneratedValues( const PxPrismaticJoint* inSource )
:PxJointGeneratedValues( inSource )
,Position( getPxPrismaticJoint_Position( inSource ) )
,Velocity( getPxPrismaticJoint_Velocity( inSource ) )
,Limit( getPxPrismaticJoint_Limit( inSource ) )
,PrismaticJointFlags( getPxPrismaticJoint_PrismaticJointFlags( inSource ) )
,ConcreteTypeName( getPxPrismaticJoint_ConcreteTypeName( inSource ) )
{
PX_UNUSED(inSource);
}
PxReal getPxRevoluteJoint_Angle( const PxRevoluteJoint* inObj ) { return inObj->getAngle(); }
PxReal getPxRevoluteJoint_Velocity( const PxRevoluteJoint* inObj ) { return inObj->getVelocity(); }
void setPxRevoluteJoint_Limit( PxRevoluteJoint* inObj, const PxJointAngularLimitPair & inArg){ inObj->setLimit( inArg ); }
PxJointAngularLimitPair getPxRevoluteJoint_Limit( const PxRevoluteJoint* inObj ) { return inObj->getLimit(); }
void setPxRevoluteJoint_DriveVelocity( PxRevoluteJoint* inObj, PxReal inArg){ inObj->setDriveVelocity( inArg ); }
PxReal getPxRevoluteJoint_DriveVelocity( const PxRevoluteJoint* inObj ) { return inObj->getDriveVelocity(); }
void setPxRevoluteJoint_DriveForceLimit( PxRevoluteJoint* inObj, PxReal inArg){ inObj->setDriveForceLimit( inArg ); }
PxReal getPxRevoluteJoint_DriveForceLimit( const PxRevoluteJoint* inObj ) { return inObj->getDriveForceLimit(); }
void setPxRevoluteJoint_DriveGearRatio( PxRevoluteJoint* inObj, PxReal inArg){ inObj->setDriveGearRatio( inArg ); }
PxReal getPxRevoluteJoint_DriveGearRatio( const PxRevoluteJoint* inObj ) { return inObj->getDriveGearRatio(); }
void setPxRevoluteJoint_RevoluteJointFlags( PxRevoluteJoint* inObj, PxRevoluteJointFlags inArg){ inObj->setRevoluteJointFlags( inArg ); }
PxRevoluteJointFlags getPxRevoluteJoint_RevoluteJointFlags( const PxRevoluteJoint* inObj ) { return inObj->getRevoluteJointFlags(); }
const char * getPxRevoluteJoint_ConcreteTypeName( const PxRevoluteJoint* inObj ) { return inObj->getConcreteTypeName(); }
PxRevoluteJointGeneratedInfo::PxRevoluteJointGeneratedInfo()
: Angle( "Angle", getPxRevoluteJoint_Angle)
, Velocity( "Velocity", getPxRevoluteJoint_Velocity)
, Limit( "Limit", setPxRevoluteJoint_Limit, getPxRevoluteJoint_Limit)
, DriveVelocity( "DriveVelocity", setPxRevoluteJoint_DriveVelocity, getPxRevoluteJoint_DriveVelocity)
, DriveForceLimit( "DriveForceLimit", setPxRevoluteJoint_DriveForceLimit, getPxRevoluteJoint_DriveForceLimit)
, DriveGearRatio( "DriveGearRatio", setPxRevoluteJoint_DriveGearRatio, getPxRevoluteJoint_DriveGearRatio)
, RevoluteJointFlags( "RevoluteJointFlags", setPxRevoluteJoint_RevoluteJointFlags, getPxRevoluteJoint_RevoluteJointFlags)
, ConcreteTypeName( "ConcreteTypeName", getPxRevoluteJoint_ConcreteTypeName)
{}
PxRevoluteJointGeneratedValues::PxRevoluteJointGeneratedValues( const PxRevoluteJoint* inSource )
:PxJointGeneratedValues( inSource )
,Angle( getPxRevoluteJoint_Angle( inSource ) )
,Velocity( getPxRevoluteJoint_Velocity( inSource ) )
,Limit( getPxRevoluteJoint_Limit( inSource ) )
,DriveVelocity( getPxRevoluteJoint_DriveVelocity( inSource ) )
,DriveForceLimit( getPxRevoluteJoint_DriveForceLimit( inSource ) )
,DriveGearRatio( getPxRevoluteJoint_DriveGearRatio( inSource ) )
,RevoluteJointFlags( getPxRevoluteJoint_RevoluteJointFlags( inSource ) )
,ConcreteTypeName( getPxRevoluteJoint_ConcreteTypeName( inSource ) )
{
PX_UNUSED(inSource);
}
void setPxSphericalJoint_LimitCone( PxSphericalJoint* inObj, const PxJointLimitCone & inArg){ inObj->setLimitCone( inArg ); }
PxJointLimitCone getPxSphericalJoint_LimitCone( const PxSphericalJoint* inObj ) { return inObj->getLimitCone(); }
PxReal getPxSphericalJoint_SwingYAngle( const PxSphericalJoint* inObj ) { return inObj->getSwingYAngle(); }
PxReal getPxSphericalJoint_SwingZAngle( const PxSphericalJoint* inObj ) { return inObj->getSwingZAngle(); }
void setPxSphericalJoint_SphericalJointFlags( PxSphericalJoint* inObj, PxSphericalJointFlags inArg){ inObj->setSphericalJointFlags( inArg ); }
PxSphericalJointFlags getPxSphericalJoint_SphericalJointFlags( const PxSphericalJoint* inObj ) { return inObj->getSphericalJointFlags(); }
const char * getPxSphericalJoint_ConcreteTypeName( const PxSphericalJoint* inObj ) { return inObj->getConcreteTypeName(); }
PxSphericalJointGeneratedInfo::PxSphericalJointGeneratedInfo()
: LimitCone( "LimitCone", setPxSphericalJoint_LimitCone, getPxSphericalJoint_LimitCone)
, SwingYAngle( "SwingYAngle", getPxSphericalJoint_SwingYAngle)
, SwingZAngle( "SwingZAngle", getPxSphericalJoint_SwingZAngle)
, SphericalJointFlags( "SphericalJointFlags", setPxSphericalJoint_SphericalJointFlags, getPxSphericalJoint_SphericalJointFlags)
, ConcreteTypeName( "ConcreteTypeName", getPxSphericalJoint_ConcreteTypeName)
{}
PxSphericalJointGeneratedValues::PxSphericalJointGeneratedValues( const PxSphericalJoint* inSource )
:PxJointGeneratedValues( inSource )
,LimitCone( getPxSphericalJoint_LimitCone( inSource ) )
,SwingYAngle( getPxSphericalJoint_SwingYAngle( inSource ) )
,SwingZAngle( getPxSphericalJoint_SwingZAngle( inSource ) )
,SphericalJointFlags( getPxSphericalJoint_SphericalJointFlags( inSource ) )
,ConcreteTypeName( getPxSphericalJoint_ConcreteTypeName( inSource ) )
{
PX_UNUSED(inSource);
}
inline PxReal getPxJointLimitParametersRestitution( const PxJointLimitParameters* inOwner ) { return inOwner->restitution; }
inline void setPxJointLimitParametersRestitution( PxJointLimitParameters* inOwner, PxReal inData) { inOwner->restitution = inData; }
inline PxReal getPxJointLimitParametersBounceThreshold( const PxJointLimitParameters* inOwner ) { return inOwner->bounceThreshold; }
inline void setPxJointLimitParametersBounceThreshold( PxJointLimitParameters* inOwner, PxReal inData) { inOwner->bounceThreshold = inData; }
inline PxReal getPxJointLimitParametersStiffness( const PxJointLimitParameters* inOwner ) { return inOwner->stiffness; }
inline void setPxJointLimitParametersStiffness( PxJointLimitParameters* inOwner, PxReal inData) { inOwner->stiffness = inData; }
inline PxReal getPxJointLimitParametersDamping( const PxJointLimitParameters* inOwner ) { return inOwner->damping; }
inline void setPxJointLimitParametersDamping( PxJointLimitParameters* inOwner, PxReal inData) { inOwner->damping = inData; }
PxJointLimitParametersGeneratedInfo::PxJointLimitParametersGeneratedInfo()
: Restitution( "Restitution", setPxJointLimitParametersRestitution, getPxJointLimitParametersRestitution )
, BounceThreshold( "BounceThreshold", setPxJointLimitParametersBounceThreshold, getPxJointLimitParametersBounceThreshold )
, Stiffness( "Stiffness", setPxJointLimitParametersStiffness, getPxJointLimitParametersStiffness )
, Damping( "Damping", setPxJointLimitParametersDamping, getPxJointLimitParametersDamping )
{}
PxJointLimitParametersGeneratedValues::PxJointLimitParametersGeneratedValues( const PxJointLimitParameters* inSource )
:Restitution( inSource->restitution )
,BounceThreshold( inSource->bounceThreshold )
,Stiffness( inSource->stiffness )
,Damping( inSource->damping )
{
PX_UNUSED(inSource);
}
inline PxReal getPxJointLinearLimitValue( const PxJointLinearLimit* inOwner ) { return inOwner->value; }
inline void setPxJointLinearLimitValue( PxJointLinearLimit* inOwner, PxReal inData) { inOwner->value = inData; }
PxJointLinearLimitGeneratedInfo::PxJointLinearLimitGeneratedInfo()
: Value( "Value", setPxJointLinearLimitValue, getPxJointLinearLimitValue )
{}
PxJointLinearLimitGeneratedValues::PxJointLinearLimitGeneratedValues( const PxJointLinearLimit* inSource )
:PxJointLimitParametersGeneratedValues( inSource )
,Value( inSource->value )
{
PX_UNUSED(inSource);
}
inline PxReal getPxJointLinearLimitPairUpper( const PxJointLinearLimitPair* inOwner ) { return inOwner->upper; }
inline void setPxJointLinearLimitPairUpper( PxJointLinearLimitPair* inOwner, PxReal inData) { inOwner->upper = inData; }
inline PxReal getPxJointLinearLimitPairLower( const PxJointLinearLimitPair* inOwner ) { return inOwner->lower; }
inline void setPxJointLinearLimitPairLower( PxJointLinearLimitPair* inOwner, PxReal inData) { inOwner->lower = inData; }
PxJointLinearLimitPairGeneratedInfo::PxJointLinearLimitPairGeneratedInfo()
: Upper( "Upper", setPxJointLinearLimitPairUpper, getPxJointLinearLimitPairUpper )
, Lower( "Lower", setPxJointLinearLimitPairLower, getPxJointLinearLimitPairLower )
{}
PxJointLinearLimitPairGeneratedValues::PxJointLinearLimitPairGeneratedValues( const PxJointLinearLimitPair* inSource )
:PxJointLimitParametersGeneratedValues( inSource )
,Upper( inSource->upper )
,Lower( inSource->lower )
{
PX_UNUSED(inSource);
}
inline PxReal getPxJointAngularLimitPairUpper( const PxJointAngularLimitPair* inOwner ) { return inOwner->upper; }
inline void setPxJointAngularLimitPairUpper( PxJointAngularLimitPair* inOwner, PxReal inData) { inOwner->upper = inData; }
inline PxReal getPxJointAngularLimitPairLower( const PxJointAngularLimitPair* inOwner ) { return inOwner->lower; }
inline void setPxJointAngularLimitPairLower( PxJointAngularLimitPair* inOwner, PxReal inData) { inOwner->lower = inData; }
PxJointAngularLimitPairGeneratedInfo::PxJointAngularLimitPairGeneratedInfo()
: Upper( "Upper", setPxJointAngularLimitPairUpper, getPxJointAngularLimitPairUpper )
, Lower( "Lower", setPxJointAngularLimitPairLower, getPxJointAngularLimitPairLower )
{}
PxJointAngularLimitPairGeneratedValues::PxJointAngularLimitPairGeneratedValues( const PxJointAngularLimitPair* inSource )
:PxJointLimitParametersGeneratedValues( inSource )
,Upper( inSource->upper )
,Lower( inSource->lower )
{
PX_UNUSED(inSource);
}
inline PxReal getPxJointLimitConeYAngle( const PxJointLimitCone* inOwner ) { return inOwner->yAngle; }
inline void setPxJointLimitConeYAngle( PxJointLimitCone* inOwner, PxReal inData) { inOwner->yAngle = inData; }
inline PxReal getPxJointLimitConeZAngle( const PxJointLimitCone* inOwner ) { return inOwner->zAngle; }
inline void setPxJointLimitConeZAngle( PxJointLimitCone* inOwner, PxReal inData) { inOwner->zAngle = inData; }
PxJointLimitConeGeneratedInfo::PxJointLimitConeGeneratedInfo()
: YAngle( "YAngle", setPxJointLimitConeYAngle, getPxJointLimitConeYAngle )
, ZAngle( "ZAngle", setPxJointLimitConeZAngle, getPxJointLimitConeZAngle )
{}
PxJointLimitConeGeneratedValues::PxJointLimitConeGeneratedValues( const PxJointLimitCone* inSource )
:PxJointLimitParametersGeneratedValues( inSource )
,YAngle( inSource->yAngle )
,ZAngle( inSource->zAngle )
{
PX_UNUSED(inSource);
}
inline PxReal getPxJointLimitPyramidYAngleMin( const PxJointLimitPyramid* inOwner ) { return inOwner->yAngleMin; }
inline void setPxJointLimitPyramidYAngleMin( PxJointLimitPyramid* inOwner, PxReal inData) { inOwner->yAngleMin = inData; }
inline PxReal getPxJointLimitPyramidYAngleMax( const PxJointLimitPyramid* inOwner ) { return inOwner->yAngleMax; }
inline void setPxJointLimitPyramidYAngleMax( PxJointLimitPyramid* inOwner, PxReal inData) { inOwner->yAngleMax = inData; }
inline PxReal getPxJointLimitPyramidZAngleMin( const PxJointLimitPyramid* inOwner ) { return inOwner->zAngleMin; }
inline void setPxJointLimitPyramidZAngleMin( PxJointLimitPyramid* inOwner, PxReal inData) { inOwner->zAngleMin = inData; }
inline PxReal getPxJointLimitPyramidZAngleMax( const PxJointLimitPyramid* inOwner ) { return inOwner->zAngleMax; }
inline void setPxJointLimitPyramidZAngleMax( PxJointLimitPyramid* inOwner, PxReal inData) { inOwner->zAngleMax = inData; }
PxJointLimitPyramidGeneratedInfo::PxJointLimitPyramidGeneratedInfo()
: YAngleMin( "YAngleMin", setPxJointLimitPyramidYAngleMin, getPxJointLimitPyramidYAngleMin )
, YAngleMax( "YAngleMax", setPxJointLimitPyramidYAngleMax, getPxJointLimitPyramidYAngleMax )
, ZAngleMin( "ZAngleMin", setPxJointLimitPyramidZAngleMin, getPxJointLimitPyramidZAngleMin )
, ZAngleMax( "ZAngleMax", setPxJointLimitPyramidZAngleMax, getPxJointLimitPyramidZAngleMax )
{}
PxJointLimitPyramidGeneratedValues::PxJointLimitPyramidGeneratedValues( const PxJointLimitPyramid* inSource )
:PxJointLimitParametersGeneratedValues( inSource )
,YAngleMin( inSource->yAngleMin )
,YAngleMax( inSource->yAngleMax )
,ZAngleMin( inSource->zAngleMin )
,ZAngleMax( inSource->zAngleMax )
{
PX_UNUSED(inSource);
}
inline PxReal getPxSpringStiffness( const PxSpring* inOwner ) { return inOwner->stiffness; }
inline void setPxSpringStiffness( PxSpring* inOwner, PxReal inData) { inOwner->stiffness = inData; }
inline PxReal getPxSpringDamping( const PxSpring* inOwner ) { return inOwner->damping; }
inline void setPxSpringDamping( PxSpring* inOwner, PxReal inData) { inOwner->damping = inData; }
PxSpringGeneratedInfo::PxSpringGeneratedInfo()
: Stiffness( "Stiffness", setPxSpringStiffness, getPxSpringStiffness )
, Damping( "Damping", setPxSpringDamping, getPxSpringDamping )
{}
PxSpringGeneratedValues::PxSpringGeneratedValues( const PxSpring* inSource )
:Stiffness( inSource->stiffness )
,Damping( inSource->damping )
{
PX_UNUSED(inSource);
}
inline PxReal getPxD6JointDriveForceLimit( const PxD6JointDrive* inOwner ) { return inOwner->forceLimit; }
inline void setPxD6JointDriveForceLimit( PxD6JointDrive* inOwner, PxReal inData) { inOwner->forceLimit = inData; }
inline PxD6JointDriveFlags getPxD6JointDriveFlags( const PxD6JointDrive* inOwner ) { return inOwner->flags; }
inline void setPxD6JointDriveFlags( PxD6JointDrive* inOwner, PxD6JointDriveFlags inData) { inOwner->flags = inData; }
PxD6JointDriveGeneratedInfo::PxD6JointDriveGeneratedInfo()
: ForceLimit( "ForceLimit", setPxD6JointDriveForceLimit, getPxD6JointDriveForceLimit )
, Flags( "Flags", setPxD6JointDriveFlags, getPxD6JointDriveFlags )
{}
PxD6JointDriveGeneratedValues::PxD6JointDriveGeneratedValues( const PxD6JointDrive* inSource )
:PxSpringGeneratedValues( inSource )
,ForceLimit( inSource->forceLimit )
,Flags( inSource->flags )
{
PX_UNUSED(inSource);
}
| 34,601 | C++ | 70.34433 | 142 | 0.80411 |
NVIDIA-Omniverse/PhysX/physx/source/physxmetadata/extensions/include/PxExtensionAutoGeneratedMetaDataObjects.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
// This code is auto-generated by the PhysX Clang metadata generator. Do not edit or be
// prepared for your edits to be quietly ignored next time the clang metadata generator is
// run. You can find the most recent version of clang metadata generator by contacting
// Chris Nuernberger <[email protected]> or Dilip or Adam.
// The source code for the generate was at one time checked into:
// physx/PhysXMetaDataGenerator/llvm/tools/clang/lib/Frontend/PhysXMetaDataAction.cpp
#define THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON
#define PX_PROPERTY_INFO_NAME PxExtensionsPropertyInfoName
static PxU32ToName g_physx__PxJointActorIndex__EnumConversion[] = {
{ "eACTOR0", static_cast<PxU32>( physx::PxJointActorIndex::eACTOR0 ) },
{ "eACTOR1", static_cast<PxU32>( physx::PxJointActorIndex::eACTOR1 ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxJointActorIndex::Enum > { PxEnumTraits() : NameConversion( g_physx__PxJointActorIndex__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxJoint;
struct PxJointGeneratedValues
{
PxRigidActor * Actors[2];
PxTransform LocalPose[physx::PxJointActorIndex::COUNT];
PxTransform RelativeTransform;
PxVec3 RelativeLinearVelocity;
PxVec3 RelativeAngularVelocity;
PxReal BreakForce[2];
PxConstraintFlags ConstraintFlags;
PxReal InvMassScale0;
PxReal InvInertiaScale0;
PxReal InvMassScale1;
PxReal InvInertiaScale1;
PxConstraint * Constraint;
const char * Name;
PxScene * Scene;
void * UserData;
PxJointGeneratedValues( const PxJoint* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, Actors, PxJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, LocalPose, PxJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, RelativeTransform, PxJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, RelativeLinearVelocity, PxJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, RelativeAngularVelocity, PxJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, BreakForce, PxJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, ConstraintFlags, PxJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, InvMassScale0, PxJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, InvInertiaScale0, PxJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, InvMassScale1, PxJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, InvInertiaScale1, PxJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, Constraint, PxJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, Name, PxJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, Scene, PxJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, UserData, PxJointGeneratedValues)
struct PxJointGeneratedInfo
{
static const char* getClassName() { return "PxJoint"; }
PxRangePropertyInfo<PX_PROPERTY_INFO_NAME::PxJoint_Actors, PxJoint, PxRigidActor * > Actors;
PxIndexedPropertyInfo<PX_PROPERTY_INFO_NAME::PxJoint_LocalPose, PxJoint, PxJointActorIndex::Enum, PxTransform > LocalPose;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxJoint_RelativeTransform, PxJoint, PxTransform > RelativeTransform;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxJoint_RelativeLinearVelocity, PxJoint, PxVec3 > RelativeLinearVelocity;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxJoint_RelativeAngularVelocity, PxJoint, PxVec3 > RelativeAngularVelocity;
PxRangePropertyInfo<PX_PROPERTY_INFO_NAME::PxJoint_BreakForce, PxJoint, PxReal > BreakForce;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxJoint_ConstraintFlags, PxJoint, PxConstraintFlags, PxConstraintFlags > ConstraintFlags;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxJoint_InvMassScale0, PxJoint, PxReal, PxReal > InvMassScale0;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxJoint_InvInertiaScale0, PxJoint, PxReal, PxReal > InvInertiaScale0;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxJoint_InvMassScale1, PxJoint, PxReal, PxReal > InvMassScale1;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxJoint_InvInertiaScale1, PxJoint, PxReal, PxReal > InvInertiaScale1;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxJoint_Constraint, PxJoint, PxConstraint * > Constraint;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxJoint_Name, PxJoint, const char *, const char * > Name;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxJoint_Scene, PxJoint, PxScene * > Scene;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxJoint_UserData, PxJoint, void *, void * > UserData;
PxJointGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxJoint*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 15; }
static PxU32 totalPropertyCount() { return instancePropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Actors, inStartIndex + 0 );;
inOperator( LocalPose, inStartIndex + 1 );;
inOperator( RelativeTransform, inStartIndex + 2 );;
inOperator( RelativeLinearVelocity, inStartIndex + 3 );;
inOperator( RelativeAngularVelocity, inStartIndex + 4 );;
inOperator( BreakForce, inStartIndex + 5 );;
inOperator( ConstraintFlags, inStartIndex + 6 );;
inOperator( InvMassScale0, inStartIndex + 7 );;
inOperator( InvInertiaScale0, inStartIndex + 8 );;
inOperator( InvMassScale1, inStartIndex + 9 );;
inOperator( InvInertiaScale1, inStartIndex + 10 );;
inOperator( Constraint, inStartIndex + 11 );;
inOperator( Name, inStartIndex + 12 );;
inOperator( Scene, inStartIndex + 13 );;
inOperator( UserData, inStartIndex + 14 );;
return 15 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxJoint>
{
PxJointGeneratedInfo Info;
const PxJointGeneratedInfo* getInfo() { return &Info; }
};
class PxRackAndPinionJoint;
struct PxRackAndPinionJointGeneratedValues
: PxJointGeneratedValues {
float Ratio;
const char * ConcreteTypeName;
PxRackAndPinionJointGeneratedValues( const PxRackAndPinionJoint* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRackAndPinionJoint, Ratio, PxRackAndPinionJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRackAndPinionJoint, ConcreteTypeName, PxRackAndPinionJointGeneratedValues)
struct PxRackAndPinionJointGeneratedInfo
: PxJointGeneratedInfo
{
static const char* getClassName() { return "PxRackAndPinionJoint"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRackAndPinionJoint_Ratio, PxRackAndPinionJoint, float, float > Ratio;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxRackAndPinionJoint_ConcreteTypeName, PxRackAndPinionJoint, const char * > ConcreteTypeName;
PxRackAndPinionJointGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxRackAndPinionJoint*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxJointGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxJointGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxJointGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 2; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxJointGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Ratio, inStartIndex + 0 );;
inOperator( ConcreteTypeName, inStartIndex + 1 );;
return 2 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxRackAndPinionJoint>
{
PxRackAndPinionJointGeneratedInfo Info;
const PxRackAndPinionJointGeneratedInfo* getInfo() { return &Info; }
};
class PxGearJoint;
struct PxGearJointGeneratedValues
: PxJointGeneratedValues {
float GearRatio;
const char * ConcreteTypeName;
PxGearJointGeneratedValues( const PxGearJoint* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxGearJoint, GearRatio, PxGearJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxGearJoint, ConcreteTypeName, PxGearJointGeneratedValues)
struct PxGearJointGeneratedInfo
: PxJointGeneratedInfo
{
static const char* getClassName() { return "PxGearJoint"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxGearJoint_GearRatio, PxGearJoint, float, float > GearRatio;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxGearJoint_ConcreteTypeName, PxGearJoint, const char * > ConcreteTypeName;
PxGearJointGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxGearJoint*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxJointGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxJointGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxJointGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 2; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxJointGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( GearRatio, inStartIndex + 0 );;
inOperator( ConcreteTypeName, inStartIndex + 1 );;
return 2 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxGearJoint>
{
PxGearJointGeneratedInfo Info;
const PxGearJointGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxD6Axis__EnumConversion[] = {
{ "eX", static_cast<PxU32>( physx::PxD6Axis::eX ) },
{ "eY", static_cast<PxU32>( physx::PxD6Axis::eY ) },
{ "eZ", static_cast<PxU32>( physx::PxD6Axis::eZ ) },
{ "eTWIST", static_cast<PxU32>( physx::PxD6Axis::eTWIST ) },
{ "eSWING1", static_cast<PxU32>( physx::PxD6Axis::eSWING1 ) },
{ "eSWING2", static_cast<PxU32>( physx::PxD6Axis::eSWING2 ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxD6Axis::Enum > { PxEnumTraits() : NameConversion( g_physx__PxD6Axis__EnumConversion ) {} const PxU32ToName* NameConversion; };
static PxU32ToName g_physx__PxD6Motion__EnumConversion[] = {
{ "eLOCKED", static_cast<PxU32>( physx::PxD6Motion::eLOCKED ) },
{ "eLIMITED", static_cast<PxU32>( physx::PxD6Motion::eLIMITED ) },
{ "eFREE", static_cast<PxU32>( physx::PxD6Motion::eFREE ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxD6Motion::Enum > { PxEnumTraits() : NameConversion( g_physx__PxD6Motion__EnumConversion ) {} const PxU32ToName* NameConversion; };
static PxU32ToName g_physx__PxD6Drive__EnumConversion[] = {
{ "eX", static_cast<PxU32>( physx::PxD6Drive::eX ) },
{ "eY", static_cast<PxU32>( physx::PxD6Drive::eY ) },
{ "eZ", static_cast<PxU32>( physx::PxD6Drive::eZ ) },
{ "eSWING", static_cast<PxU32>( physx::PxD6Drive::eSWING ) },
{ "eTWIST", static_cast<PxU32>( physx::PxD6Drive::eTWIST ) },
{ "eSLERP", static_cast<PxU32>( physx::PxD6Drive::eSLERP ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxD6Drive::Enum > { PxEnumTraits() : NameConversion( g_physx__PxD6Drive__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxD6Joint;
struct PxD6JointGeneratedValues
: PxJointGeneratedValues {
PxD6Motion::Enum Motion[physx::PxD6Axis::eCOUNT];
PxReal TwistAngle;
PxReal Twist;
PxReal SwingYAngle;
PxReal SwingZAngle;
PxJointLinearLimit DistanceLimit;
PxJointLinearLimit LinearLimit;
PxJointAngularLimitPair TwistLimit;
PxJointLimitCone SwingLimit;
PxJointLimitPyramid PyramidSwingLimit;
PxD6JointDrive Drive[physx::PxD6Drive::eCOUNT];
PxTransform DrivePosition;
const char * ConcreteTypeName;
PxD6JointGeneratedValues( const PxD6Joint* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, Motion, PxD6JointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, TwistAngle, PxD6JointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, Twist, PxD6JointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, SwingYAngle, PxD6JointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, SwingZAngle, PxD6JointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, DistanceLimit, PxD6JointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, LinearLimit, PxD6JointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, TwistLimit, PxD6JointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, SwingLimit, PxD6JointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, PyramidSwingLimit, PxD6JointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, Drive, PxD6JointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, DrivePosition, PxD6JointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, ConcreteTypeName, PxD6JointGeneratedValues)
struct PxD6JointGeneratedInfo
: PxJointGeneratedInfo
{
static const char* getClassName() { return "PxD6Joint"; }
PxIndexedPropertyInfo<PX_PROPERTY_INFO_NAME::PxD6Joint_Motion, PxD6Joint, PxD6Axis::Enum, PxD6Motion::Enum > Motion;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxD6Joint_TwistAngle, PxD6Joint, PxReal > TwistAngle;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxD6Joint_Twist, PxD6Joint, PxReal > Twist;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxD6Joint_SwingYAngle, PxD6Joint, PxReal > SwingYAngle;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxD6Joint_SwingZAngle, PxD6Joint, PxReal > SwingZAngle;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxD6Joint_DistanceLimit, PxD6Joint, const PxJointLinearLimit &, PxJointLinearLimit > DistanceLimit;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxD6Joint_LinearLimit, PxD6Joint, const PxJointLinearLimit &, PxJointLinearLimit > LinearLimit;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxD6Joint_TwistLimit, PxD6Joint, const PxJointAngularLimitPair &, PxJointAngularLimitPair > TwistLimit;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxD6Joint_SwingLimit, PxD6Joint, const PxJointLimitCone &, PxJointLimitCone > SwingLimit;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxD6Joint_PyramidSwingLimit, PxD6Joint, const PxJointLimitPyramid &, PxJointLimitPyramid > PyramidSwingLimit;
PxIndexedPropertyInfo<PX_PROPERTY_INFO_NAME::PxD6Joint_Drive, PxD6Joint, PxD6Drive::Enum, PxD6JointDrive > Drive;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxD6Joint_DrivePosition, PxD6Joint, const PxTransform &, PxTransform > DrivePosition;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxD6Joint_ConcreteTypeName, PxD6Joint, const char * > ConcreteTypeName;
PxD6JointGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxD6Joint*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxJointGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxJointGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxJointGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 13; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxJointGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Motion, inStartIndex + 0 );;
inOperator( TwistAngle, inStartIndex + 1 );;
inOperator( Twist, inStartIndex + 2 );;
inOperator( SwingYAngle, inStartIndex + 3 );;
inOperator( SwingZAngle, inStartIndex + 4 );;
inOperator( DistanceLimit, inStartIndex + 5 );;
inOperator( LinearLimit, inStartIndex + 6 );;
inOperator( TwistLimit, inStartIndex + 7 );;
inOperator( SwingLimit, inStartIndex + 8 );;
inOperator( PyramidSwingLimit, inStartIndex + 9 );;
inOperator( Drive, inStartIndex + 10 );;
inOperator( DrivePosition, inStartIndex + 11 );;
inOperator( ConcreteTypeName, inStartIndex + 12 );;
return 13 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxD6Joint>
{
PxD6JointGeneratedInfo Info;
const PxD6JointGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxDistanceJointFlag__EnumConversion[] = {
{ "eMAX_DISTANCE_ENABLED", static_cast<PxU32>( physx::PxDistanceJointFlag::eMAX_DISTANCE_ENABLED ) },
{ "eMIN_DISTANCE_ENABLED", static_cast<PxU32>( physx::PxDistanceJointFlag::eMIN_DISTANCE_ENABLED ) },
{ "eSPRING_ENABLED", static_cast<PxU32>( physx::PxDistanceJointFlag::eSPRING_ENABLED ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxDistanceJointFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxDistanceJointFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxDistanceJoint;
struct PxDistanceJointGeneratedValues
: PxJointGeneratedValues {
PxReal Distance;
PxReal MinDistance;
PxReal MaxDistance;
PxReal Tolerance;
PxReal Stiffness;
PxReal Damping;
PxDistanceJointFlags DistanceJointFlags;
const char * ConcreteTypeName;
PxDistanceJointGeneratedValues( const PxDistanceJoint* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxDistanceJoint, Distance, PxDistanceJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxDistanceJoint, MinDistance, PxDistanceJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxDistanceJoint, MaxDistance, PxDistanceJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxDistanceJoint, Tolerance, PxDistanceJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxDistanceJoint, Stiffness, PxDistanceJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxDistanceJoint, Damping, PxDistanceJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxDistanceJoint, DistanceJointFlags, PxDistanceJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxDistanceJoint, ConcreteTypeName, PxDistanceJointGeneratedValues)
struct PxDistanceJointGeneratedInfo
: PxJointGeneratedInfo
{
static const char* getClassName() { return "PxDistanceJoint"; }
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxDistanceJoint_Distance, PxDistanceJoint, PxReal > Distance;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxDistanceJoint_MinDistance, PxDistanceJoint, PxReal, PxReal > MinDistance;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxDistanceJoint_MaxDistance, PxDistanceJoint, PxReal, PxReal > MaxDistance;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxDistanceJoint_Tolerance, PxDistanceJoint, PxReal, PxReal > Tolerance;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxDistanceJoint_Stiffness, PxDistanceJoint, PxReal, PxReal > Stiffness;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxDistanceJoint_Damping, PxDistanceJoint, PxReal, PxReal > Damping;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxDistanceJoint_DistanceJointFlags, PxDistanceJoint, PxDistanceJointFlags, PxDistanceJointFlags > DistanceJointFlags;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxDistanceJoint_ConcreteTypeName, PxDistanceJoint, const char * > ConcreteTypeName;
PxDistanceJointGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxDistanceJoint*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxJointGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxJointGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxJointGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 8; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxJointGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Distance, inStartIndex + 0 );;
inOperator( MinDistance, inStartIndex + 1 );;
inOperator( MaxDistance, inStartIndex + 2 );;
inOperator( Tolerance, inStartIndex + 3 );;
inOperator( Stiffness, inStartIndex + 4 );;
inOperator( Damping, inStartIndex + 5 );;
inOperator( DistanceJointFlags, inStartIndex + 6 );;
inOperator( ConcreteTypeName, inStartIndex + 7 );;
return 8 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxDistanceJoint>
{
PxDistanceJointGeneratedInfo Info;
const PxDistanceJointGeneratedInfo* getInfo() { return &Info; }
};
class PxContactJoint;
struct PxContactJointGeneratedValues
: PxJointGeneratedValues {
PxVec3 Contact;
PxVec3 ContactNormal;
PxReal Penetration;
PxReal Restitution;
PxReal BounceThreshold;
const char * ConcreteTypeName;
PxContactJointGeneratedValues( const PxContactJoint* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxContactJoint, Contact, PxContactJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxContactJoint, ContactNormal, PxContactJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxContactJoint, Penetration, PxContactJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxContactJoint, Restitution, PxContactJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxContactJoint, BounceThreshold, PxContactJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxContactJoint, ConcreteTypeName, PxContactJointGeneratedValues)
struct PxContactJointGeneratedInfo
: PxJointGeneratedInfo
{
static const char* getClassName() { return "PxContactJoint"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxContactJoint_Contact, PxContactJoint, const PxVec3 &, PxVec3 > Contact;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxContactJoint_ContactNormal, PxContactJoint, const PxVec3 &, PxVec3 > ContactNormal;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxContactJoint_Penetration, PxContactJoint, const PxReal, PxReal > Penetration;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxContactJoint_Restitution, PxContactJoint, const PxReal, PxReal > Restitution;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxContactJoint_BounceThreshold, PxContactJoint, const PxReal, PxReal > BounceThreshold;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxContactJoint_ConcreteTypeName, PxContactJoint, const char * > ConcreteTypeName;
PxContactJointGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxContactJoint*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxJointGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxJointGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxJointGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 6; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxJointGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Contact, inStartIndex + 0 );;
inOperator( ContactNormal, inStartIndex + 1 );;
inOperator( Penetration, inStartIndex + 2 );;
inOperator( Restitution, inStartIndex + 3 );;
inOperator( BounceThreshold, inStartIndex + 4 );;
inOperator( ConcreteTypeName, inStartIndex + 5 );;
return 6 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxContactJoint>
{
PxContactJointGeneratedInfo Info;
const PxContactJointGeneratedInfo* getInfo() { return &Info; }
};
class PxFixedJoint;
struct PxFixedJointGeneratedValues
: PxJointGeneratedValues {
const char * ConcreteTypeName;
PxFixedJointGeneratedValues( const PxFixedJoint* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxFixedJoint, ConcreteTypeName, PxFixedJointGeneratedValues)
struct PxFixedJointGeneratedInfo
: PxJointGeneratedInfo
{
static const char* getClassName() { return "PxFixedJoint"; }
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxFixedJoint_ConcreteTypeName, PxFixedJoint, const char * > ConcreteTypeName;
PxFixedJointGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxFixedJoint*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxJointGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxJointGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxJointGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 1; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxJointGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( ConcreteTypeName, inStartIndex + 0 );;
return 1 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxFixedJoint>
{
PxFixedJointGeneratedInfo Info;
const PxFixedJointGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxPrismaticJointFlag__EnumConversion[] = {
{ "eLIMIT_ENABLED", static_cast<PxU32>( physx::PxPrismaticJointFlag::eLIMIT_ENABLED ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxPrismaticJointFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxPrismaticJointFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxPrismaticJoint;
struct PxPrismaticJointGeneratedValues
: PxJointGeneratedValues {
PxReal Position;
PxReal Velocity;
PxJointLinearLimitPair Limit;
PxPrismaticJointFlags PrismaticJointFlags;
const char * ConcreteTypeName;
PxPrismaticJointGeneratedValues( const PxPrismaticJoint* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPrismaticJoint, Position, PxPrismaticJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPrismaticJoint, Velocity, PxPrismaticJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPrismaticJoint, Limit, PxPrismaticJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPrismaticJoint, PrismaticJointFlags, PxPrismaticJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPrismaticJoint, ConcreteTypeName, PxPrismaticJointGeneratedValues)
struct PxPrismaticJointGeneratedInfo
: PxJointGeneratedInfo
{
static const char* getClassName() { return "PxPrismaticJoint"; }
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxPrismaticJoint_Position, PxPrismaticJoint, PxReal > Position;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxPrismaticJoint_Velocity, PxPrismaticJoint, PxReal > Velocity;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxPrismaticJoint_Limit, PxPrismaticJoint, const PxJointLinearLimitPair &, PxJointLinearLimitPair > Limit;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxPrismaticJoint_PrismaticJointFlags, PxPrismaticJoint, PxPrismaticJointFlags, PxPrismaticJointFlags > PrismaticJointFlags;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxPrismaticJoint_ConcreteTypeName, PxPrismaticJoint, const char * > ConcreteTypeName;
PxPrismaticJointGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxPrismaticJoint*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxJointGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxJointGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxJointGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 5; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxJointGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Position, inStartIndex + 0 );;
inOperator( Velocity, inStartIndex + 1 );;
inOperator( Limit, inStartIndex + 2 );;
inOperator( PrismaticJointFlags, inStartIndex + 3 );;
inOperator( ConcreteTypeName, inStartIndex + 4 );;
return 5 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxPrismaticJoint>
{
PxPrismaticJointGeneratedInfo Info;
const PxPrismaticJointGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxRevoluteJointFlag__EnumConversion[] = {
{ "eLIMIT_ENABLED", static_cast<PxU32>( physx::PxRevoluteJointFlag::eLIMIT_ENABLED ) },
{ "eDRIVE_ENABLED", static_cast<PxU32>( physx::PxRevoluteJointFlag::eDRIVE_ENABLED ) },
{ "eDRIVE_FREESPIN", static_cast<PxU32>( physx::PxRevoluteJointFlag::eDRIVE_FREESPIN ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxRevoluteJointFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxRevoluteJointFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxRevoluteJoint;
struct PxRevoluteJointGeneratedValues
: PxJointGeneratedValues {
PxReal Angle;
PxReal Velocity;
PxJointAngularLimitPair Limit;
PxReal DriveVelocity;
PxReal DriveForceLimit;
PxReal DriveGearRatio;
PxRevoluteJointFlags RevoluteJointFlags;
const char * ConcreteTypeName;
PxRevoluteJointGeneratedValues( const PxRevoluteJoint* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRevoluteJoint, Angle, PxRevoluteJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRevoluteJoint, Velocity, PxRevoluteJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRevoluteJoint, Limit, PxRevoluteJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRevoluteJoint, DriveVelocity, PxRevoluteJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRevoluteJoint, DriveForceLimit, PxRevoluteJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRevoluteJoint, DriveGearRatio, PxRevoluteJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRevoluteJoint, RevoluteJointFlags, PxRevoluteJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRevoluteJoint, ConcreteTypeName, PxRevoluteJointGeneratedValues)
struct PxRevoluteJointGeneratedInfo
: PxJointGeneratedInfo
{
static const char* getClassName() { return "PxRevoluteJoint"; }
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxRevoluteJoint_Angle, PxRevoluteJoint, PxReal > Angle;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxRevoluteJoint_Velocity, PxRevoluteJoint, PxReal > Velocity;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRevoluteJoint_Limit, PxRevoluteJoint, const PxJointAngularLimitPair &, PxJointAngularLimitPair > Limit;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRevoluteJoint_DriveVelocity, PxRevoluteJoint, PxReal, PxReal > DriveVelocity;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRevoluteJoint_DriveForceLimit, PxRevoluteJoint, PxReal, PxReal > DriveForceLimit;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRevoluteJoint_DriveGearRatio, PxRevoluteJoint, PxReal, PxReal > DriveGearRatio;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRevoluteJoint_RevoluteJointFlags, PxRevoluteJoint, PxRevoluteJointFlags, PxRevoluteJointFlags > RevoluteJointFlags;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxRevoluteJoint_ConcreteTypeName, PxRevoluteJoint, const char * > ConcreteTypeName;
PxRevoluteJointGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxRevoluteJoint*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxJointGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxJointGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxJointGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 8; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxJointGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Angle, inStartIndex + 0 );;
inOperator( Velocity, inStartIndex + 1 );;
inOperator( Limit, inStartIndex + 2 );;
inOperator( DriveVelocity, inStartIndex + 3 );;
inOperator( DriveForceLimit, inStartIndex + 4 );;
inOperator( DriveGearRatio, inStartIndex + 5 );;
inOperator( RevoluteJointFlags, inStartIndex + 6 );;
inOperator( ConcreteTypeName, inStartIndex + 7 );;
return 8 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxRevoluteJoint>
{
PxRevoluteJointGeneratedInfo Info;
const PxRevoluteJointGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxSphericalJointFlag__EnumConversion[] = {
{ "eLIMIT_ENABLED", static_cast<PxU32>( physx::PxSphericalJointFlag::eLIMIT_ENABLED ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxSphericalJointFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxSphericalJointFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxSphericalJoint;
struct PxSphericalJointGeneratedValues
: PxJointGeneratedValues {
PxJointLimitCone LimitCone;
PxReal SwingYAngle;
PxReal SwingZAngle;
PxSphericalJointFlags SphericalJointFlags;
const char * ConcreteTypeName;
PxSphericalJointGeneratedValues( const PxSphericalJoint* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSphericalJoint, LimitCone, PxSphericalJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSphericalJoint, SwingYAngle, PxSphericalJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSphericalJoint, SwingZAngle, PxSphericalJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSphericalJoint, SphericalJointFlags, PxSphericalJointGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSphericalJoint, ConcreteTypeName, PxSphericalJointGeneratedValues)
struct PxSphericalJointGeneratedInfo
: PxJointGeneratedInfo
{
static const char* getClassName() { return "PxSphericalJoint"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSphericalJoint_LimitCone, PxSphericalJoint, const PxJointLimitCone &, PxJointLimitCone > LimitCone;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxSphericalJoint_SwingYAngle, PxSphericalJoint, PxReal > SwingYAngle;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxSphericalJoint_SwingZAngle, PxSphericalJoint, PxReal > SwingZAngle;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSphericalJoint_SphericalJointFlags, PxSphericalJoint, PxSphericalJointFlags, PxSphericalJointFlags > SphericalJointFlags;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxSphericalJoint_ConcreteTypeName, PxSphericalJoint, const char * > ConcreteTypeName;
PxSphericalJointGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxSphericalJoint*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxJointGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxJointGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxJointGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 5; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxJointGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( LimitCone, inStartIndex + 0 );;
inOperator( SwingYAngle, inStartIndex + 1 );;
inOperator( SwingZAngle, inStartIndex + 2 );;
inOperator( SphericalJointFlags, inStartIndex + 3 );;
inOperator( ConcreteTypeName, inStartIndex + 4 );;
return 5 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxSphericalJoint>
{
PxSphericalJointGeneratedInfo Info;
const PxSphericalJointGeneratedInfo* getInfo() { return &Info; }
};
class PxJointLimitParameters;
struct PxJointLimitParametersGeneratedValues
{
PxReal Restitution;
PxReal BounceThreshold;
PxReal Stiffness;
PxReal Damping;
PxJointLimitParametersGeneratedValues( const PxJointLimitParameters* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLimitParameters, Restitution, PxJointLimitParametersGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLimitParameters, BounceThreshold, PxJointLimitParametersGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLimitParameters, Stiffness, PxJointLimitParametersGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLimitParameters, Damping, PxJointLimitParametersGeneratedValues)
struct PxJointLimitParametersGeneratedInfo
{
static const char* getClassName() { return "PxJointLimitParameters"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxJointLimitParameters_Restitution, PxJointLimitParameters, PxReal, PxReal > Restitution;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxJointLimitParameters_BounceThreshold, PxJointLimitParameters, PxReal, PxReal > BounceThreshold;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxJointLimitParameters_Stiffness, PxJointLimitParameters, PxReal, PxReal > Stiffness;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxJointLimitParameters_Damping, PxJointLimitParameters, PxReal, PxReal > Damping;
PxJointLimitParametersGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxJointLimitParameters*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 4; }
static PxU32 totalPropertyCount() { return instancePropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Restitution, inStartIndex + 0 );;
inOperator( BounceThreshold, inStartIndex + 1 );;
inOperator( Stiffness, inStartIndex + 2 );;
inOperator( Damping, inStartIndex + 3 );;
return 4 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxJointLimitParameters>
{
PxJointLimitParametersGeneratedInfo Info;
const PxJointLimitParametersGeneratedInfo* getInfo() { return &Info; }
};
class PxJointLinearLimit;
struct PxJointLinearLimitGeneratedValues
: PxJointLimitParametersGeneratedValues {
PxReal Value;
PxJointLinearLimitGeneratedValues( const PxJointLinearLimit* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLinearLimit, Value, PxJointLinearLimitGeneratedValues)
struct PxJointLinearLimitGeneratedInfo
: PxJointLimitParametersGeneratedInfo
{
static const char* getClassName() { return "PxJointLinearLimit"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxJointLinearLimit_Value, PxJointLinearLimit, PxReal, PxReal > Value;
PxJointLinearLimitGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxJointLinearLimit*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxJointLimitParametersGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxJointLimitParametersGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxJointLimitParametersGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 1; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxJointLimitParametersGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Value, inStartIndex + 0 );;
return 1 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxJointLinearLimit>
{
PxJointLinearLimitGeneratedInfo Info;
const PxJointLinearLimitGeneratedInfo* getInfo() { return &Info; }
};
class PxJointLinearLimitPair;
struct PxJointLinearLimitPairGeneratedValues
: PxJointLimitParametersGeneratedValues {
PxReal Upper;
PxReal Lower;
PxJointLinearLimitPairGeneratedValues( const PxJointLinearLimitPair* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLinearLimitPair, Upper, PxJointLinearLimitPairGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLinearLimitPair, Lower, PxJointLinearLimitPairGeneratedValues)
struct PxJointLinearLimitPairGeneratedInfo
: PxJointLimitParametersGeneratedInfo
{
static const char* getClassName() { return "PxJointLinearLimitPair"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxJointLinearLimitPair_Upper, PxJointLinearLimitPair, PxReal, PxReal > Upper;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxJointLinearLimitPair_Lower, PxJointLinearLimitPair, PxReal, PxReal > Lower;
PxJointLinearLimitPairGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxJointLinearLimitPair*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxJointLimitParametersGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxJointLimitParametersGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxJointLimitParametersGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 2; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxJointLimitParametersGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Upper, inStartIndex + 0 );;
inOperator( Lower, inStartIndex + 1 );;
return 2 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxJointLinearLimitPair>
{
PxJointLinearLimitPairGeneratedInfo Info;
const PxJointLinearLimitPairGeneratedInfo* getInfo() { return &Info; }
};
class PxJointAngularLimitPair;
struct PxJointAngularLimitPairGeneratedValues
: PxJointLimitParametersGeneratedValues {
PxReal Upper;
PxReal Lower;
PxJointAngularLimitPairGeneratedValues( const PxJointAngularLimitPair* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointAngularLimitPair, Upper, PxJointAngularLimitPairGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointAngularLimitPair, Lower, PxJointAngularLimitPairGeneratedValues)
struct PxJointAngularLimitPairGeneratedInfo
: PxJointLimitParametersGeneratedInfo
{
static const char* getClassName() { return "PxJointAngularLimitPair"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxJointAngularLimitPair_Upper, PxJointAngularLimitPair, PxReal, PxReal > Upper;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxJointAngularLimitPair_Lower, PxJointAngularLimitPair, PxReal, PxReal > Lower;
PxJointAngularLimitPairGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxJointAngularLimitPair*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxJointLimitParametersGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxJointLimitParametersGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxJointLimitParametersGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 2; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxJointLimitParametersGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Upper, inStartIndex + 0 );;
inOperator( Lower, inStartIndex + 1 );;
return 2 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxJointAngularLimitPair>
{
PxJointAngularLimitPairGeneratedInfo Info;
const PxJointAngularLimitPairGeneratedInfo* getInfo() { return &Info; }
};
class PxJointLimitCone;
struct PxJointLimitConeGeneratedValues
: PxJointLimitParametersGeneratedValues {
PxReal YAngle;
PxReal ZAngle;
PxJointLimitConeGeneratedValues( const PxJointLimitCone* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLimitCone, YAngle, PxJointLimitConeGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLimitCone, ZAngle, PxJointLimitConeGeneratedValues)
struct PxJointLimitConeGeneratedInfo
: PxJointLimitParametersGeneratedInfo
{
static const char* getClassName() { return "PxJointLimitCone"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxJointLimitCone_YAngle, PxJointLimitCone, PxReal, PxReal > YAngle;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxJointLimitCone_ZAngle, PxJointLimitCone, PxReal, PxReal > ZAngle;
PxJointLimitConeGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxJointLimitCone*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxJointLimitParametersGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxJointLimitParametersGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxJointLimitParametersGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 2; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxJointLimitParametersGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( YAngle, inStartIndex + 0 );;
inOperator( ZAngle, inStartIndex + 1 );;
return 2 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxJointLimitCone>
{
PxJointLimitConeGeneratedInfo Info;
const PxJointLimitConeGeneratedInfo* getInfo() { return &Info; }
};
class PxJointLimitPyramid;
struct PxJointLimitPyramidGeneratedValues
: PxJointLimitParametersGeneratedValues {
PxReal YAngleMin;
PxReal YAngleMax;
PxReal ZAngleMin;
PxReal ZAngleMax;
PxJointLimitPyramidGeneratedValues( const PxJointLimitPyramid* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLimitPyramid, YAngleMin, PxJointLimitPyramidGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLimitPyramid, YAngleMax, PxJointLimitPyramidGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLimitPyramid, ZAngleMin, PxJointLimitPyramidGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLimitPyramid, ZAngleMax, PxJointLimitPyramidGeneratedValues)
struct PxJointLimitPyramidGeneratedInfo
: PxJointLimitParametersGeneratedInfo
{
static const char* getClassName() { return "PxJointLimitPyramid"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxJointLimitPyramid_YAngleMin, PxJointLimitPyramid, PxReal, PxReal > YAngleMin;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxJointLimitPyramid_YAngleMax, PxJointLimitPyramid, PxReal, PxReal > YAngleMax;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxJointLimitPyramid_ZAngleMin, PxJointLimitPyramid, PxReal, PxReal > ZAngleMin;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxJointLimitPyramid_ZAngleMax, PxJointLimitPyramid, PxReal, PxReal > ZAngleMax;
PxJointLimitPyramidGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxJointLimitPyramid*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxJointLimitParametersGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxJointLimitParametersGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxJointLimitParametersGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 4; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxJointLimitParametersGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( YAngleMin, inStartIndex + 0 );;
inOperator( YAngleMax, inStartIndex + 1 );;
inOperator( ZAngleMin, inStartIndex + 2 );;
inOperator( ZAngleMax, inStartIndex + 3 );;
return 4 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxJointLimitPyramid>
{
PxJointLimitPyramidGeneratedInfo Info;
const PxJointLimitPyramidGeneratedInfo* getInfo() { return &Info; }
};
class PxSpring;
struct PxSpringGeneratedValues
{
PxReal Stiffness;
PxReal Damping;
PxSpringGeneratedValues( const PxSpring* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSpring, Stiffness, PxSpringGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSpring, Damping, PxSpringGeneratedValues)
struct PxSpringGeneratedInfo
{
static const char* getClassName() { return "PxSpring"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSpring_Stiffness, PxSpring, PxReal, PxReal > Stiffness;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSpring_Damping, PxSpring, PxReal, PxReal > Damping;
PxSpringGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxSpring*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 2; }
static PxU32 totalPropertyCount() { return instancePropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Stiffness, inStartIndex + 0 );;
inOperator( Damping, inStartIndex + 1 );;
return 2 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxSpring>
{
PxSpringGeneratedInfo Info;
const PxSpringGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxD6JointDriveFlag__EnumConversion[] = {
{ "eACCELERATION", static_cast<PxU32>( physx::PxD6JointDriveFlag::eACCELERATION ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxD6JointDriveFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxD6JointDriveFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxD6JointDrive;
struct PxD6JointDriveGeneratedValues
: PxSpringGeneratedValues {
PxReal ForceLimit;
PxD6JointDriveFlags Flags;
PxD6JointDriveGeneratedValues( const PxD6JointDrive* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6JointDrive, ForceLimit, PxD6JointDriveGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6JointDrive, Flags, PxD6JointDriveGeneratedValues)
struct PxD6JointDriveGeneratedInfo
: PxSpringGeneratedInfo
{
static const char* getClassName() { return "PxD6JointDrive"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxD6JointDrive_ForceLimit, PxD6JointDrive, PxReal, PxReal > ForceLimit;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxD6JointDrive_Flags, PxD6JointDrive, PxD6JointDriveFlags, PxD6JointDriveFlags > Flags;
PxD6JointDriveGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxD6JointDrive*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxSpringGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxSpringGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxSpringGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 2; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxSpringGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( ForceLimit, inStartIndex + 0 );;
inOperator( Flags, inStartIndex + 1 );;
return 2 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxD6JointDrive>
{
PxD6JointDriveGeneratedInfo Info;
const PxD6JointDriveGeneratedInfo* getInfo() { return &Info; }
};
#undef THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON
#undef PX_PROPERTY_INFO_NAME
| 59,955 | C | 45.08455 | 192 | 0.780252 |
NVIDIA-Omniverse/PhysX/physx/source/physxmetadata/extensions/include/PxExtensionMetaDataObjects.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_EXTENSION_METADATAOBJECTS_H
#define PX_EXTENSION_METADATAOBJECTS_H
#include "PxPhysicsAPI.h"
#include "extensions/PxExtensionsAPI.h"
#include "PxMetaDataObjects.h"
/** \addtogroup physics
@{
*/
namespace physx
{
class PxD6Joint;
class PxJointLimitCone;
struct PxExtensionsPropertyInfoName
{
enum Enum
{
Unnamed = PxPropertyInfoName::LastPxPropertyInfoName,
#include "PxExtensionAutoGeneratedMetaDataObjectNames.h"
LastPxPropertyInfoName
};
};
#define DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( type, prop, valueStruct ) \
template<> struct PxPropertyToValueStructMemberMap< PxExtensionsPropertyInfoName::type##_##prop > \
{ \
PxU32 Offset; \
PxPropertyToValueStructMemberMap< PxExtensionsPropertyInfoName::type##_##prop >() : Offset( PX_OFFSET_OF_RT( valueStruct, prop ) ) {} \
template<typename TOperator> void visitProp( TOperator inOperator, valueStruct& inStruct ) { inOperator( inStruct.prop ); } \
};
#if PX_LINUX && PX_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wreserved-identifier"
#endif
#include "PxExtensionAutoGeneratedMetaDataObjects.h"
#if PX_LINUX && PX_CLANG
#pragma clang diagnostic pop
#endif
#undef DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP
}
/** @} */
#endif
| 3,022 | C | 37.75641 | 137 | 0.742886 |
NVIDIA-Omniverse/PhysX/physx/source/physxmetadata/extensions/include/PxExtensionAutoGeneratedMetaDataObjectNames.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
// This code is auto-generated by the PhysX Clang metadata generator. Do not edit or be
// prepared for your edits to be quietly ignored next time the clang metadata generator is
// run. You can find the most recent version of clang metadata generator by contacting
// Chris Nuernberger <[email protected]> or Dilip or Adam.
// The source code for the generate was at one time checked into:
// physx/PhysXMetaDataGenerator/llvm/tools/clang/lib/Frontend/PhysXMetaDataAction.cpp
#define THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON
PxJoint_PropertiesStart,
PxJoint_Actors,
PxJoint_LocalPose,
PxJoint_RelativeTransform,
PxJoint_RelativeLinearVelocity,
PxJoint_RelativeAngularVelocity,
PxJoint_BreakForce,
PxJoint_ConstraintFlags,
PxJoint_InvMassScale0,
PxJoint_InvInertiaScale0,
PxJoint_InvMassScale1,
PxJoint_InvInertiaScale1,
PxJoint_Constraint,
PxJoint_Name,
PxJoint_Scene,
PxJoint_UserData,
PxJoint_PropertiesStop,
PxRackAndPinionJoint_PropertiesStart,
PxRackAndPinionJoint_Ratio,
PxRackAndPinionJoint_ConcreteTypeName,
PxRackAndPinionJoint_PropertiesStop,
PxGearJoint_PropertiesStart,
PxGearJoint_GearRatio,
PxGearJoint_ConcreteTypeName,
PxGearJoint_PropertiesStop,
PxD6Joint_PropertiesStart,
PxD6Joint_Motion,
PxD6Joint_TwistAngle,
PxD6Joint_Twist,
PxD6Joint_SwingYAngle,
PxD6Joint_SwingZAngle,
PxD6Joint_DistanceLimit,
PxD6Joint_LinearLimit,
PxD6Joint_TwistLimit,
PxD6Joint_SwingLimit,
PxD6Joint_PyramidSwingLimit,
PxD6Joint_Drive,
PxD6Joint_DrivePosition,
PxD6Joint_ConcreteTypeName,
PxD6Joint_PropertiesStop,
PxDistanceJoint_PropertiesStart,
PxDistanceJoint_Distance,
PxDistanceJoint_MinDistance,
PxDistanceJoint_MaxDistance,
PxDistanceJoint_Tolerance,
PxDistanceJoint_Stiffness,
PxDistanceJoint_Damping,
PxDistanceJoint_DistanceJointFlags,
PxDistanceJoint_ConcreteTypeName,
PxDistanceJoint_PropertiesStop,
PxContactJoint_PropertiesStart,
PxContactJoint_Contact,
PxContactJoint_ContactNormal,
PxContactJoint_Penetration,
PxContactJoint_Restitution,
PxContactJoint_BounceThreshold,
PxContactJoint_ConcreteTypeName,
PxContactJoint_PropertiesStop,
PxFixedJoint_PropertiesStart,
PxFixedJoint_ConcreteTypeName,
PxFixedJoint_PropertiesStop,
PxPrismaticJoint_PropertiesStart,
PxPrismaticJoint_Position,
PxPrismaticJoint_Velocity,
PxPrismaticJoint_Limit,
PxPrismaticJoint_PrismaticJointFlags,
PxPrismaticJoint_ConcreteTypeName,
PxPrismaticJoint_PropertiesStop,
PxRevoluteJoint_PropertiesStart,
PxRevoluteJoint_Angle,
PxRevoluteJoint_Velocity,
PxRevoluteJoint_Limit,
PxRevoluteJoint_DriveVelocity,
PxRevoluteJoint_DriveForceLimit,
PxRevoluteJoint_DriveGearRatio,
PxRevoluteJoint_RevoluteJointFlags,
PxRevoluteJoint_ConcreteTypeName,
PxRevoluteJoint_PropertiesStop,
PxSphericalJoint_PropertiesStart,
PxSphericalJoint_LimitCone,
PxSphericalJoint_SwingYAngle,
PxSphericalJoint_SwingZAngle,
PxSphericalJoint_SphericalJointFlags,
PxSphericalJoint_ConcreteTypeName,
PxSphericalJoint_PropertiesStop,
PxJointLimitParameters_PropertiesStart,
PxJointLimitParameters_Restitution,
PxJointLimitParameters_BounceThreshold,
PxJointLimitParameters_Stiffness,
PxJointLimitParameters_Damping,
PxJointLimitParameters_PropertiesStop,
PxJointLinearLimit_PropertiesStart,
PxJointLinearLimit_Value,
PxJointLinearLimit_PropertiesStop,
PxJointLinearLimitPair_PropertiesStart,
PxJointLinearLimitPair_Upper,
PxJointLinearLimitPair_Lower,
PxJointLinearLimitPair_PropertiesStop,
PxJointAngularLimitPair_PropertiesStart,
PxJointAngularLimitPair_Upper,
PxJointAngularLimitPair_Lower,
PxJointAngularLimitPair_PropertiesStop,
PxJointLimitCone_PropertiesStart,
PxJointLimitCone_YAngle,
PxJointLimitCone_ZAngle,
PxJointLimitCone_PropertiesStop,
PxJointLimitPyramid_PropertiesStart,
PxJointLimitPyramid_YAngleMin,
PxJointLimitPyramid_YAngleMax,
PxJointLimitPyramid_ZAngleMin,
PxJointLimitPyramid_ZAngleMax,
PxJointLimitPyramid_PropertiesStop,
PxSpring_PropertiesStart,
PxSpring_Stiffness,
PxSpring_Damping,
PxSpring_PropertiesStop,
PxD6JointDrive_PropertiesStart,
PxD6JointDrive_ForceLimit,
PxD6JointDrive_Flags,
PxD6JointDrive_PropertiesStop,
#undef THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON
| 5,756 | C | 34.98125 | 90 | 0.846942 |
NVIDIA-Omniverse/PhysX/physx/source/physxmetadata/core/src/PxMetaDataObjects.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "foundation/PxUtilities.h"
#include "foundation/PxFoundation.h"
#include "foundation/PxErrors.h"
#include "PxMetaDataObjects.h"
using namespace physx;
namespace {
template<class T>
PX_FORCE_INLINE bool getGeometryT(PxGeometryType::Enum type, const PxShape* inShape, T& geom)
{
const PxGeometry& inGeometry = inShape->getGeometry();
if(inShape == NULL || inGeometry.getType() != type)
return false;
geom = static_cast<const T&>(inGeometry);
return true;
}
}
PX_PHYSX_CORE_API PxGeometryType::Enum PxShapeGeomPropertyHelper::getGeometryType(const PxShape* inShape) const { return inShape->getGeometry().getType(); }
PX_PHYSX_CORE_API bool PxShapeGeomPropertyHelper::getGeometry(const PxShape* inShape, PxBoxGeometry& geometry) const { return getGeometryT(PxGeometryType::eBOX, inShape, geometry); }
PX_PHYSX_CORE_API bool PxShapeGeomPropertyHelper::getGeometry(const PxShape* inShape, PxSphereGeometry& geometry) const { return getGeometryT(PxGeometryType::eSPHERE, inShape, geometry); }
PX_PHYSX_CORE_API bool PxShapeGeomPropertyHelper::getGeometry(const PxShape* inShape, PxCapsuleGeometry& geometry) const { return getGeometryT(PxGeometryType::eCAPSULE, inShape, geometry); }
PX_PHYSX_CORE_API bool PxShapeGeomPropertyHelper::getGeometry(const PxShape* inShape, PxPlaneGeometry& geometry) const { return getGeometryT(PxGeometryType::ePLANE, inShape, geometry); }
PX_PHYSX_CORE_API bool PxShapeGeomPropertyHelper::getGeometry(const PxShape* inShape, PxConvexMeshGeometry& geometry) const { return getGeometryT(PxGeometryType::eCONVEXMESH, inShape, geometry); }
PX_PHYSX_CORE_API bool PxShapeGeomPropertyHelper::getGeometry(const PxShape* inShape, PxTetrahedronMeshGeometry& geometry) const { return getGeometryT(PxGeometryType::eTETRAHEDRONMESH, inShape, geometry); }
PX_PHYSX_CORE_API bool PxShapeGeomPropertyHelper::getGeometry(const PxShape* inShape, PxParticleSystemGeometry& geometry) const { return getGeometryT(PxGeometryType::ePARTICLESYSTEM, inShape, geometry); }
PX_PHYSX_CORE_API bool PxShapeGeomPropertyHelper::getGeometry(const PxShape* inShape, PxTriangleMeshGeometry& geometry) const { return getGeometryT(PxGeometryType::eTRIANGLEMESH, inShape, geometry); }
PX_PHYSX_CORE_API bool PxShapeGeomPropertyHelper::getGeometry(const PxShape* inShape, PxHeightFieldGeometry& geometry) const { return getGeometryT(PxGeometryType::eHEIGHTFIELD, inShape, geometry); }
PX_PHYSX_CORE_API void PxShapeMaterialsPropertyHelper::setMaterials(PxShape* inShape, PxMaterial*const* materials, PxU16 materialCount) const
{
inShape->setMaterials( materials, materialCount );
}
PX_PHYSX_CORE_API PxShape* PxRigidActorShapeCollectionHelper::createShape(PxRigidActor* inActor, const PxGeometry& geometry, PxMaterial& material,
PxShapeFlags shapeFlags ) const
{
PxMaterial* materialPtr = const_cast<PxMaterial*>(&material);
PxShape* shape = PxGetPhysics().createShape(geometry, &materialPtr, 1, true, shapeFlags);
if (shape)
{
inActor->attachShape(*shape); // attach can fail, if e.g. we try and attach a trimesh simulation shape to a dynamic actor
shape->release(); // if attach fails, we hold the only counted reference, and so this cleans up properly
}
return shape;
}
PX_PHYSX_CORE_API PxShape* PxRigidActorShapeCollectionHelper::createShape(PxRigidActor* inActor, const PxGeometry& geometry, PxMaterial *const* materials,
PxU16 materialCount, PxShapeFlags shapeFlags ) const
{
PxShape* shape = PxGetPhysics().createShape(geometry, materials, materialCount, true, shapeFlags);
if (shape)
{
inActor->attachShape(*shape); // attach can fail, if e.g. we try and attach a trimesh simulation shape to a dynamic actor
shape->release(); // if attach fails, we hold the only counted reference, and so this cleans up properly
}
return shape;
}
PX_PHYSX_CORE_API PxArticulationLink* PxArticulationReducedCoordinateLinkCollectionPropHelper::createLink(PxArticulationReducedCoordinate* inArticulation, PxArticulationLink* parent,
const PxTransform& pose) const
{
PX_CHECK_AND_RETURN_NULL(pose.isValid(), "PxArticulationReducedCoordinateLinkCollectionPropHelper::createLink pose is not valid.");
return inArticulation->createLink(parent, pose );
}
inline void SetNbShape( PxSimulationStatistics* inStats, PxGeometryType::Enum data, PxU32 val ) { inStats->nbShapes[data] = val; }
inline PxU32 GetNbShape( const PxSimulationStatistics* inStats, PxGeometryType::Enum data) { return inStats->nbShapes[data]; }
PX_PHYSX_CORE_API NbShapesProperty::NbShapesProperty()
: PxIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbShapes
, PxSimulationStatistics
, PxGeometryType::Enum
, PxU32> ( "NbShapes", SetNbShape, GetNbShape )
{
}
inline void SetNbDiscreteContactPairs( PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2, PxU32 val ) { inStats->nbDiscreteContactPairs[idx1][idx2] = val; }
inline PxU32 GetNbDiscreteContactPairs( const PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2 ) { return inStats->nbDiscreteContactPairs[idx1][idx2]; }
PX_PHYSX_CORE_API NbDiscreteContactPairsProperty::NbDiscreteContactPairsProperty()
: PxDualIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbDiscreteContactPairs
, PxSimulationStatistics
, PxGeometryType::Enum
, PxGeometryType::Enum
, PxU32> ( "NbDiscreteContactPairs", SetNbDiscreteContactPairs, GetNbDiscreteContactPairs )
{
}
inline void SetNbModifiedContactPairs( PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2, PxU32 val ) { inStats->nbModifiedContactPairs[idx1][idx2] = val; }
inline PxU32 GetNbModifiedContactPairs( const PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2 ) { return inStats->nbModifiedContactPairs[idx1][idx2]; }
PX_PHYSX_CORE_API NbModifiedContactPairsProperty::NbModifiedContactPairsProperty()
: PxDualIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbModifiedContactPairs
, PxSimulationStatistics
, PxGeometryType::Enum
, PxGeometryType::Enum
, PxU32> ( "NbModifiedContactPairs", SetNbModifiedContactPairs, GetNbModifiedContactPairs )
{
}
inline void SetNbCCDPairs( PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2, PxU32 val ) { inStats->nbCCDPairs[idx1][idx2] = val; }
inline PxU32 GetNbCCDPairs( const PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2 ) { return inStats->nbCCDPairs[idx1][idx2]; }
PX_PHYSX_CORE_API NbCCDPairsProperty::NbCCDPairsProperty()
: PxDualIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbCCDPairs
, PxSimulationStatistics
, PxGeometryType::Enum
, PxGeometryType::Enum
, PxU32> ( "NbCCDPairs", SetNbCCDPairs, GetNbCCDPairs )
{
}
inline void SetNbTriggerPairs( PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2, PxU32 val ) { inStats->nbTriggerPairs[idx1][idx2] = val; }
inline PxU32 GetNbTriggerPairs( const PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2 ) { return inStats->nbTriggerPairs[idx1][idx2]; }
PX_PHYSX_CORE_API NbTriggerPairsProperty::NbTriggerPairsProperty()
: PxDualIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbTriggerPairs
, PxSimulationStatistics
, PxGeometryType::Enum
, PxGeometryType::Enum
, PxU32> ( "NbTriggerPairs", SetNbTriggerPairs, GetNbTriggerPairs )
{
}
inline PxSimulationStatistics GetStats( const PxScene* inScene ) { PxSimulationStatistics stats; inScene->getSimulationStatistics( stats ); return stats; }
PX_PHYSX_CORE_API SimulationStatisticsProperty::SimulationStatisticsProperty()
: PxReadOnlyPropertyInfo<PxPropertyInfoName::PxScene_SimulationStatistics, PxScene, PxSimulationStatistics >( "SimulationStatistics", GetStats )
{
}
inline PxU32 GetCustomType(const PxCustomGeometry* inGeom) { PxCustomGeometry::Type t = inGeom->callbacks->getCustomType(); return *reinterpret_cast<const PxU32*>(&t); }
PX_PHYSX_CORE_API PxCustomGeometryCustomTypeProperty::PxCustomGeometryCustomTypeProperty()
: PxReadOnlyPropertyInfo<PxPropertyInfoName::PxCustomGeometry_CustomType, PxCustomGeometry, PxU32 >("CustomType", GetCustomType)
{
}
| 10,195 | C++ | 58.625731 | 206 | 0.777146 |
NVIDIA-Omniverse/PhysX/physx/source/physxmetadata/core/src/PxAutoGeneratedMetaDataObjects.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
// This code is auto-generated by the PhysX Clang metadata generator. Do not edit or be
// prepared for your edits to be quietly ignored next time the clang metadata generator is
// run. You can find the most recent version of clang metadata generator by contacting
// Chris Nuernberger <[email protected]> or Dilip or Adam.
// The source code for the generate was at one time checked into:
// physx/PhysXMetaDataGenerator/llvm/tools/clang/lib/Frontend/PhysXMetaDataAction.cpp
#include "foundation/PxPreprocessor.h"
#if PX_LINUX && PX_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wreserved-identifier"
#endif
#include "PxMetaDataObjects.h"
#if PX_LINUX && PX_CLANG
#pragma clang diagnostic pop
#endif
#include "PxMetaDataCppPrefix.h"
using namespace physx;
const PxTolerancesScale getPxPhysics_TolerancesScale( const PxPhysics* inObj ) { return inObj->getTolerancesScale(); }
PxU32 getPxPhysics_TriangleMeshes( const PxPhysics* inObj, PxTriangleMesh ** outBuffer, PxU32 inBufSize ) { return inObj->getTriangleMeshes( outBuffer, inBufSize ); }
PxU32 getNbPxPhysics_TriangleMeshes( const PxPhysics* inObj ) { return inObj->getNbTriangleMeshes( ); }
PxTriangleMesh * createPxPhysics_TriangleMeshes( PxPhysics* inObj, PxInputStream & inCreateParam ){ return inObj->createTriangleMesh( inCreateParam ); }
PxU32 getPxPhysics_TetrahedronMeshes( const PxPhysics* inObj, PxTetrahedronMesh ** outBuffer, PxU32 inBufSize ) { return inObj->getTetrahedronMeshes( outBuffer, inBufSize ); }
PxU32 getNbPxPhysics_TetrahedronMeshes( const PxPhysics* inObj ) { return inObj->getNbTetrahedronMeshes( ); }
PxTetrahedronMesh * createPxPhysics_TetrahedronMeshes( PxPhysics* inObj, PxInputStream & inCreateParam ){ return inObj->createTetrahedronMesh( inCreateParam ); }
PxU32 getPxPhysics_HeightFields( const PxPhysics* inObj, PxHeightField ** outBuffer, PxU32 inBufSize ) { return inObj->getHeightFields( outBuffer, inBufSize ); }
PxU32 getNbPxPhysics_HeightFields( const PxPhysics* inObj ) { return inObj->getNbHeightFields( ); }
PxHeightField * createPxPhysics_HeightFields( PxPhysics* inObj, PxInputStream & inCreateParam ){ return inObj->createHeightField( inCreateParam ); }
PxU32 getPxPhysics_ConvexMeshes( const PxPhysics* inObj, PxConvexMesh ** outBuffer, PxU32 inBufSize ) { return inObj->getConvexMeshes( outBuffer, inBufSize ); }
PxU32 getNbPxPhysics_ConvexMeshes( const PxPhysics* inObj ) { return inObj->getNbConvexMeshes( ); }
PxConvexMesh * createPxPhysics_ConvexMeshes( PxPhysics* inObj, PxInputStream & inCreateParam ){ return inObj->createConvexMesh( inCreateParam ); }
PxU32 getPxPhysics_BVHs( const PxPhysics* inObj, PxBVH ** outBuffer, PxU32 inBufSize ) { return inObj->getBVHs( outBuffer, inBufSize ); }
PxU32 getNbPxPhysics_BVHs( const PxPhysics* inObj ) { return inObj->getNbBVHs( ); }
PxBVH * createPxPhysics_BVHs( PxPhysics* inObj, PxInputStream & inCreateParam ){ return inObj->createBVH( inCreateParam ); }
PxU32 getPxPhysics_Scenes( const PxPhysics* inObj, PxScene ** outBuffer, PxU32 inBufSize ) { return inObj->getScenes( outBuffer, inBufSize ); }
PxU32 getNbPxPhysics_Scenes( const PxPhysics* inObj ) { return inObj->getNbScenes( ); }
PxScene * createPxPhysics_Scenes( PxPhysics* inObj, const PxSceneDesc & inCreateParam ){ return inObj->createScene( inCreateParam ); }
PxU32 getPxPhysics_Shapes( const PxPhysics* inObj, PxShape ** outBuffer, PxU32 inBufSize ) { return inObj->getShapes( outBuffer, inBufSize ); }
PxU32 getNbPxPhysics_Shapes( const PxPhysics* inObj ) { return inObj->getNbShapes( ); }
PxU32 getPxPhysics_Materials( const PxPhysics* inObj, PxMaterial ** outBuffer, PxU32 inBufSize ) { return inObj->getMaterials( outBuffer, inBufSize ); }
PxU32 getNbPxPhysics_Materials( const PxPhysics* inObj ) { return inObj->getNbMaterials( ); }
PxU32 getPxPhysics_FEMSoftBodyMaterials( const PxPhysics* inObj, PxFEMSoftBodyMaterial ** outBuffer, PxU32 inBufSize ) { return inObj->getFEMSoftBodyMaterials( outBuffer, inBufSize ); }
PxU32 getNbPxPhysics_FEMSoftBodyMaterials( const PxPhysics* inObj ) { return inObj->getNbFEMSoftBodyMaterials( ); }
PxU32 getPxPhysics_FEMClothMaterials( const PxPhysics* inObj, PxFEMClothMaterial ** outBuffer, PxU32 inBufSize ) { return inObj->getFEMClothMaterials( outBuffer, inBufSize ); }
PxU32 getNbPxPhysics_FEMClothMaterials( const PxPhysics* inObj ) { return inObj->getNbFEMClothMaterials( ); }
PxU32 getPxPhysics_PBDMaterials( const PxPhysics* inObj, PxPBDMaterial ** outBuffer, PxU32 inBufSize ) { return inObj->getPBDMaterials( outBuffer, inBufSize ); }
PxU32 getNbPxPhysics_PBDMaterials( const PxPhysics* inObj ) { return inObj->getNbPBDMaterials( ); }
PX_PHYSX_CORE_API PxPhysicsGeneratedInfo::PxPhysicsGeneratedInfo()
: TolerancesScale( "TolerancesScale", getPxPhysics_TolerancesScale)
, TriangleMeshes( "TriangleMeshes", getPxPhysics_TriangleMeshes, getNbPxPhysics_TriangleMeshes, createPxPhysics_TriangleMeshes )
, TetrahedronMeshes( "TetrahedronMeshes", getPxPhysics_TetrahedronMeshes, getNbPxPhysics_TetrahedronMeshes, createPxPhysics_TetrahedronMeshes )
, HeightFields( "HeightFields", getPxPhysics_HeightFields, getNbPxPhysics_HeightFields, createPxPhysics_HeightFields )
, ConvexMeshes( "ConvexMeshes", getPxPhysics_ConvexMeshes, getNbPxPhysics_ConvexMeshes, createPxPhysics_ConvexMeshes )
, BVHs( "BVHs", getPxPhysics_BVHs, getNbPxPhysics_BVHs, createPxPhysics_BVHs )
, Scenes( "Scenes", getPxPhysics_Scenes, getNbPxPhysics_Scenes, createPxPhysics_Scenes )
, Shapes( "Shapes", getPxPhysics_Shapes, getNbPxPhysics_Shapes )
, Materials( "Materials", getPxPhysics_Materials, getNbPxPhysics_Materials )
, FEMSoftBodyMaterials( "FEMSoftBodyMaterials", getPxPhysics_FEMSoftBodyMaterials, getNbPxPhysics_FEMSoftBodyMaterials )
, FEMClothMaterials( "FEMClothMaterials", getPxPhysics_FEMClothMaterials, getNbPxPhysics_FEMClothMaterials )
, PBDMaterials( "PBDMaterials", getPxPhysics_PBDMaterials, getNbPxPhysics_PBDMaterials )
{}
PX_PHYSX_CORE_API PxPhysicsGeneratedValues::PxPhysicsGeneratedValues( const PxPhysics* inSource )
:TolerancesScale( getPxPhysics_TolerancesScale( inSource ) )
{
PX_UNUSED(inSource);
}
PxU32 getPxRefCounted_ReferenceCount( const PxRefCounted* inObj ) { return inObj->getReferenceCount(); }
PX_PHYSX_CORE_API PxRefCountedGeneratedInfo::PxRefCountedGeneratedInfo()
: ReferenceCount( "ReferenceCount", getPxRefCounted_ReferenceCount)
{}
PX_PHYSX_CORE_API PxRefCountedGeneratedValues::PxRefCountedGeneratedValues( const PxRefCounted* inSource )
:ReferenceCount( getPxRefCounted_ReferenceCount( inSource ) )
{
PX_UNUSED(inSource);
}
inline void * getPxBaseMaterialUserData( const PxBaseMaterial* inOwner ) { return inOwner->userData; }
inline void setPxBaseMaterialUserData( PxBaseMaterial* inOwner, void * inData) { inOwner->userData = inData; }
PX_PHYSX_CORE_API PxBaseMaterialGeneratedInfo::PxBaseMaterialGeneratedInfo()
: UserData( "UserData", setPxBaseMaterialUserData, getPxBaseMaterialUserData )
{}
PX_PHYSX_CORE_API PxBaseMaterialGeneratedValues::PxBaseMaterialGeneratedValues( const PxBaseMaterial* inSource )
:PxRefCountedGeneratedValues( inSource )
,UserData( inSource->userData )
{
PX_UNUSED(inSource);
}
void setPxMaterial_DynamicFriction( PxMaterial* inObj, PxReal inArg){ inObj->setDynamicFriction( inArg ); }
PxReal getPxMaterial_DynamicFriction( const PxMaterial* inObj ) { return inObj->getDynamicFriction(); }
void setPxMaterial_StaticFriction( PxMaterial* inObj, PxReal inArg){ inObj->setStaticFriction( inArg ); }
PxReal getPxMaterial_StaticFriction( const PxMaterial* inObj ) { return inObj->getStaticFriction(); }
void setPxMaterial_Restitution( PxMaterial* inObj, PxReal inArg){ inObj->setRestitution( inArg ); }
PxReal getPxMaterial_Restitution( const PxMaterial* inObj ) { return inObj->getRestitution(); }
void setPxMaterial_Damping( PxMaterial* inObj, PxReal inArg){ inObj->setDamping( inArg ); }
PxReal getPxMaterial_Damping( const PxMaterial* inObj ) { return inObj->getDamping(); }
void setPxMaterial_Flags( PxMaterial* inObj, PxMaterialFlags inArg){ inObj->setFlags( inArg ); }
PxMaterialFlags getPxMaterial_Flags( const PxMaterial* inObj ) { return inObj->getFlags(); }
void setPxMaterial_FrictionCombineMode( PxMaterial* inObj, PxCombineMode::Enum inArg){ inObj->setFrictionCombineMode( inArg ); }
PxCombineMode::Enum getPxMaterial_FrictionCombineMode( const PxMaterial* inObj ) { return inObj->getFrictionCombineMode(); }
void setPxMaterial_RestitutionCombineMode( PxMaterial* inObj, PxCombineMode::Enum inArg){ inObj->setRestitutionCombineMode( inArg ); }
PxCombineMode::Enum getPxMaterial_RestitutionCombineMode( const PxMaterial* inObj ) { return inObj->getRestitutionCombineMode(); }
const char * getPxMaterial_ConcreteTypeName( const PxMaterial* inObj ) { return inObj->getConcreteTypeName(); }
PX_PHYSX_CORE_API PxMaterialGeneratedInfo::PxMaterialGeneratedInfo()
: DynamicFriction( "DynamicFriction", setPxMaterial_DynamicFriction, getPxMaterial_DynamicFriction)
, StaticFriction( "StaticFriction", setPxMaterial_StaticFriction, getPxMaterial_StaticFriction)
, Restitution( "Restitution", setPxMaterial_Restitution, getPxMaterial_Restitution)
, Damping( "Damping", setPxMaterial_Damping, getPxMaterial_Damping)
, Flags( "Flags", setPxMaterial_Flags, getPxMaterial_Flags)
, FrictionCombineMode( "FrictionCombineMode", setPxMaterial_FrictionCombineMode, getPxMaterial_FrictionCombineMode)
, RestitutionCombineMode( "RestitutionCombineMode", setPxMaterial_RestitutionCombineMode, getPxMaterial_RestitutionCombineMode)
, ConcreteTypeName( "ConcreteTypeName", getPxMaterial_ConcreteTypeName)
{}
PX_PHYSX_CORE_API PxMaterialGeneratedValues::PxMaterialGeneratedValues( const PxMaterial* inSource )
:PxBaseMaterialGeneratedValues( inSource )
,DynamicFriction( getPxMaterial_DynamicFriction( inSource ) )
,StaticFriction( getPxMaterial_StaticFriction( inSource ) )
,Restitution( getPxMaterial_Restitution( inSource ) )
,Damping( getPxMaterial_Damping( inSource ) )
,Flags( getPxMaterial_Flags( inSource ) )
,FrictionCombineMode( getPxMaterial_FrictionCombineMode( inSource ) )
,RestitutionCombineMode( getPxMaterial_RestitutionCombineMode( inSource ) )
,ConcreteTypeName( getPxMaterial_ConcreteTypeName( inSource ) )
{
PX_UNUSED(inSource);
}
void setPxFEMMaterial_YoungsModulus( PxFEMMaterial* inObj, PxReal inArg){ inObj->setYoungsModulus( inArg ); }
PxReal getPxFEMMaterial_YoungsModulus( const PxFEMMaterial* inObj ) { return inObj->getYoungsModulus(); }
void setPxFEMMaterial_Poissons( PxFEMMaterial* inObj, PxReal inArg){ inObj->setPoissons( inArg ); }
PxReal getPxFEMMaterial_Poissons( const PxFEMMaterial* inObj ) { return inObj->getPoissons(); }
void setPxFEMMaterial_DynamicFriction( PxFEMMaterial* inObj, PxReal inArg){ inObj->setDynamicFriction( inArg ); }
PxReal getPxFEMMaterial_DynamicFriction( const PxFEMMaterial* inObj ) { return inObj->getDynamicFriction(); }
PX_PHYSX_CORE_API PxFEMMaterialGeneratedInfo::PxFEMMaterialGeneratedInfo()
: YoungsModulus( "YoungsModulus", setPxFEMMaterial_YoungsModulus, getPxFEMMaterial_YoungsModulus)
, Poissons( "Poissons", setPxFEMMaterial_Poissons, getPxFEMMaterial_Poissons)
, DynamicFriction( "DynamicFriction", setPxFEMMaterial_DynamicFriction, getPxFEMMaterial_DynamicFriction)
{}
PX_PHYSX_CORE_API PxFEMMaterialGeneratedValues::PxFEMMaterialGeneratedValues( const PxFEMMaterial* inSource )
:PxBaseMaterialGeneratedValues( inSource )
,YoungsModulus( getPxFEMMaterial_YoungsModulus( inSource ) )
,Poissons( getPxFEMMaterial_Poissons( inSource ) )
,DynamicFriction( getPxFEMMaterial_DynamicFriction( inSource ) )
{
PX_UNUSED(inSource);
}
void setPxFEMSoftBodyMaterial_Damping( PxFEMSoftBodyMaterial* inObj, PxReal inArg){ inObj->setDamping( inArg ); }
PxReal getPxFEMSoftBodyMaterial_Damping( const PxFEMSoftBodyMaterial* inObj ) { return inObj->getDamping(); }
void setPxFEMSoftBodyMaterial_DampingScale( PxFEMSoftBodyMaterial* inObj, PxReal inArg){ inObj->setDampingScale( inArg ); }
PxReal getPxFEMSoftBodyMaterial_DampingScale( const PxFEMSoftBodyMaterial* inObj ) { return inObj->getDampingScale(); }
void setPxFEMSoftBodyMaterial_MaterialModel( PxFEMSoftBodyMaterial* inObj, PxFEMSoftBodyMaterialModel::Enum inArg){ inObj->setMaterialModel( inArg ); }
PxFEMSoftBodyMaterialModel::Enum getPxFEMSoftBodyMaterial_MaterialModel( const PxFEMSoftBodyMaterial* inObj ) { return inObj->getMaterialModel(); }
const char * getPxFEMSoftBodyMaterial_ConcreteTypeName( const PxFEMSoftBodyMaterial* inObj ) { return inObj->getConcreteTypeName(); }
PX_PHYSX_CORE_API PxFEMSoftBodyMaterialGeneratedInfo::PxFEMSoftBodyMaterialGeneratedInfo()
: Damping( "Damping", setPxFEMSoftBodyMaterial_Damping, getPxFEMSoftBodyMaterial_Damping)
, DampingScale( "DampingScale", setPxFEMSoftBodyMaterial_DampingScale, getPxFEMSoftBodyMaterial_DampingScale)
, MaterialModel( "MaterialModel", setPxFEMSoftBodyMaterial_MaterialModel, getPxFEMSoftBodyMaterial_MaterialModel)
, ConcreteTypeName( "ConcreteTypeName", getPxFEMSoftBodyMaterial_ConcreteTypeName)
{}
PX_PHYSX_CORE_API PxFEMSoftBodyMaterialGeneratedValues::PxFEMSoftBodyMaterialGeneratedValues( const PxFEMSoftBodyMaterial* inSource )
:PxFEMMaterialGeneratedValues( inSource )
,Damping( getPxFEMSoftBodyMaterial_Damping( inSource ) )
,DampingScale( getPxFEMSoftBodyMaterial_DampingScale( inSource ) )
,MaterialModel( getPxFEMSoftBodyMaterial_MaterialModel( inSource ) )
,ConcreteTypeName( getPxFEMSoftBodyMaterial_ConcreteTypeName( inSource ) )
{
PX_UNUSED(inSource);
}
void setPxParticleMaterial_Friction( PxParticleMaterial* inObj, PxReal inArg){ inObj->setFriction( inArg ); }
PxReal getPxParticleMaterial_Friction( const PxParticleMaterial* inObj ) { return inObj->getFriction(); }
void setPxParticleMaterial_Damping( PxParticleMaterial* inObj, PxReal inArg){ inObj->setDamping( inArg ); }
PxReal getPxParticleMaterial_Damping( const PxParticleMaterial* inObj ) { return inObj->getDamping(); }
void setPxParticleMaterial_Adhesion( PxParticleMaterial* inObj, PxReal inArg){ inObj->setAdhesion( inArg ); }
PxReal getPxParticleMaterial_Adhesion( const PxParticleMaterial* inObj ) { return inObj->getAdhesion(); }
void setPxParticleMaterial_GravityScale( PxParticleMaterial* inObj, PxReal inArg){ inObj->setGravityScale( inArg ); }
PxReal getPxParticleMaterial_GravityScale( const PxParticleMaterial* inObj ) { return inObj->getGravityScale(); }
void setPxParticleMaterial_AdhesionRadiusScale( PxParticleMaterial* inObj, PxReal inArg){ inObj->setAdhesionRadiusScale( inArg ); }
PxReal getPxParticleMaterial_AdhesionRadiusScale( const PxParticleMaterial* inObj ) { return inObj->getAdhesionRadiusScale(); }
PX_PHYSX_CORE_API PxParticleMaterialGeneratedInfo::PxParticleMaterialGeneratedInfo()
: Friction( "Friction", setPxParticleMaterial_Friction, getPxParticleMaterial_Friction)
, Damping( "Damping", setPxParticleMaterial_Damping, getPxParticleMaterial_Damping)
, Adhesion( "Adhesion", setPxParticleMaterial_Adhesion, getPxParticleMaterial_Adhesion)
, GravityScale( "GravityScale", setPxParticleMaterial_GravityScale, getPxParticleMaterial_GravityScale)
, AdhesionRadiusScale( "AdhesionRadiusScale", setPxParticleMaterial_AdhesionRadiusScale, getPxParticleMaterial_AdhesionRadiusScale)
{}
PX_PHYSX_CORE_API PxParticleMaterialGeneratedValues::PxParticleMaterialGeneratedValues( const PxParticleMaterial* inSource )
:PxBaseMaterialGeneratedValues( inSource )
,Friction( getPxParticleMaterial_Friction( inSource ) )
,Damping( getPxParticleMaterial_Damping( inSource ) )
,Adhesion( getPxParticleMaterial_Adhesion( inSource ) )
,GravityScale( getPxParticleMaterial_GravityScale( inSource ) )
,AdhesionRadiusScale( getPxParticleMaterial_AdhesionRadiusScale( inSource ) )
{
PX_UNUSED(inSource);
}
void setPxPBDMaterial_Viscosity( PxPBDMaterial* inObj, PxReal inArg){ inObj->setViscosity( inArg ); }
PxReal getPxPBDMaterial_Viscosity( const PxPBDMaterial* inObj ) { return inObj->getViscosity(); }
void setPxPBDMaterial_VorticityConfinement( PxPBDMaterial* inObj, PxReal inArg){ inObj->setVorticityConfinement( inArg ); }
PxReal getPxPBDMaterial_VorticityConfinement( const PxPBDMaterial* inObj ) { return inObj->getVorticityConfinement(); }
void setPxPBDMaterial_SurfaceTension( PxPBDMaterial* inObj, PxReal inArg){ inObj->setSurfaceTension( inArg ); }
PxReal getPxPBDMaterial_SurfaceTension( const PxPBDMaterial* inObj ) { return inObj->getSurfaceTension(); }
void setPxPBDMaterial_Cohesion( PxPBDMaterial* inObj, PxReal inArg){ inObj->setCohesion( inArg ); }
PxReal getPxPBDMaterial_Cohesion( const PxPBDMaterial* inObj ) { return inObj->getCohesion(); }
void setPxPBDMaterial_Lift( PxPBDMaterial* inObj, PxReal inArg){ inObj->setLift( inArg ); }
PxReal getPxPBDMaterial_Lift( const PxPBDMaterial* inObj ) { return inObj->getLift(); }
void setPxPBDMaterial_Drag( PxPBDMaterial* inObj, PxReal inArg){ inObj->setDrag( inArg ); }
PxReal getPxPBDMaterial_Drag( const PxPBDMaterial* inObj ) { return inObj->getDrag(); }
void setPxPBDMaterial_CFLCoefficient( PxPBDMaterial* inObj, PxReal inArg){ inObj->setCFLCoefficient( inArg ); }
PxReal getPxPBDMaterial_CFLCoefficient( const PxPBDMaterial* inObj ) { return inObj->getCFLCoefficient(); }
void setPxPBDMaterial_ParticleFrictionScale( PxPBDMaterial* inObj, PxReal inArg){ inObj->setParticleFrictionScale( inArg ); }
PxReal getPxPBDMaterial_ParticleFrictionScale( const PxPBDMaterial* inObj ) { return inObj->getParticleFrictionScale(); }
void setPxPBDMaterial_ParticleAdhesionScale( PxPBDMaterial* inObj, PxReal inArg){ inObj->setParticleAdhesionScale( inArg ); }
PxReal getPxPBDMaterial_ParticleAdhesionScale( const PxPBDMaterial* inObj ) { return inObj->getParticleAdhesionScale(); }
const char * getPxPBDMaterial_ConcreteTypeName( const PxPBDMaterial* inObj ) { return inObj->getConcreteTypeName(); }
PX_PHYSX_CORE_API PxPBDMaterialGeneratedInfo::PxPBDMaterialGeneratedInfo()
: Viscosity( "Viscosity", setPxPBDMaterial_Viscosity, getPxPBDMaterial_Viscosity)
, VorticityConfinement( "VorticityConfinement", setPxPBDMaterial_VorticityConfinement, getPxPBDMaterial_VorticityConfinement)
, SurfaceTension( "SurfaceTension", setPxPBDMaterial_SurfaceTension, getPxPBDMaterial_SurfaceTension)
, Cohesion( "Cohesion", setPxPBDMaterial_Cohesion, getPxPBDMaterial_Cohesion)
, Lift( "Lift", setPxPBDMaterial_Lift, getPxPBDMaterial_Lift)
, Drag( "Drag", setPxPBDMaterial_Drag, getPxPBDMaterial_Drag)
, CFLCoefficient( "CFLCoefficient", setPxPBDMaterial_CFLCoefficient, getPxPBDMaterial_CFLCoefficient)
, ParticleFrictionScale( "ParticleFrictionScale", setPxPBDMaterial_ParticleFrictionScale, getPxPBDMaterial_ParticleFrictionScale)
, ParticleAdhesionScale( "ParticleAdhesionScale", setPxPBDMaterial_ParticleAdhesionScale, getPxPBDMaterial_ParticleAdhesionScale)
, ConcreteTypeName( "ConcreteTypeName", getPxPBDMaterial_ConcreteTypeName)
{}
PX_PHYSX_CORE_API PxPBDMaterialGeneratedValues::PxPBDMaterialGeneratedValues( const PxPBDMaterial* inSource )
:PxParticleMaterialGeneratedValues( inSource )
,Viscosity( getPxPBDMaterial_Viscosity( inSource ) )
,VorticityConfinement( getPxPBDMaterial_VorticityConfinement( inSource ) )
,SurfaceTension( getPxPBDMaterial_SurfaceTension( inSource ) )
,Cohesion( getPxPBDMaterial_Cohesion( inSource ) )
,Lift( getPxPBDMaterial_Lift( inSource ) )
,Drag( getPxPBDMaterial_Drag( inSource ) )
,CFLCoefficient( getPxPBDMaterial_CFLCoefficient( inSource ) )
,ParticleFrictionScale( getPxPBDMaterial_ParticleFrictionScale( inSource ) )
,ParticleAdhesionScale( getPxPBDMaterial_ParticleAdhesionScale( inSource ) )
,ConcreteTypeName( getPxPBDMaterial_ConcreteTypeName( inSource ) )
{
PX_UNUSED(inSource);
}
PxScene * getPxActor_Scene( const PxActor* inObj ) { return inObj->getScene(); }
void setPxActor_Name( PxActor* inObj, const char * inArg){ inObj->setName( inArg ); }
const char * getPxActor_Name( const PxActor* inObj ) { return inObj->getName(); }
void setPxActor_ActorFlags( PxActor* inObj, PxActorFlags inArg){ inObj->setActorFlags( inArg ); }
PxActorFlags getPxActor_ActorFlags( const PxActor* inObj ) { return inObj->getActorFlags(); }
void setPxActor_DominanceGroup( PxActor* inObj, PxDominanceGroup inArg){ inObj->setDominanceGroup( inArg ); }
PxDominanceGroup getPxActor_DominanceGroup( const PxActor* inObj ) { return inObj->getDominanceGroup(); }
void setPxActor_OwnerClient( PxActor* inObj, PxClientID inArg){ inObj->setOwnerClient( inArg ); }
PxClientID getPxActor_OwnerClient( const PxActor* inObj ) { return inObj->getOwnerClient(); }
PxAggregate * getPxActor_Aggregate( const PxActor* inObj ) { return inObj->getAggregate(); }
inline void * getPxActorUserData( const PxActor* inOwner ) { return inOwner->userData; }
inline void setPxActorUserData( PxActor* inOwner, void * inData) { inOwner->userData = inData; }
PX_PHYSX_CORE_API PxActorGeneratedInfo::PxActorGeneratedInfo()
: Scene( "Scene", getPxActor_Scene)
, Name( "Name", setPxActor_Name, getPxActor_Name)
, ActorFlags( "ActorFlags", setPxActor_ActorFlags, getPxActor_ActorFlags)
, DominanceGroup( "DominanceGroup", setPxActor_DominanceGroup, getPxActor_DominanceGroup)
, OwnerClient( "OwnerClient", setPxActor_OwnerClient, getPxActor_OwnerClient)
, Aggregate( "Aggregate", getPxActor_Aggregate)
, UserData( "UserData", setPxActorUserData, getPxActorUserData )
{}
PX_PHYSX_CORE_API PxActorGeneratedValues::PxActorGeneratedValues( const PxActor* inSource )
:Scene( getPxActor_Scene( inSource ) )
,Name( getPxActor_Name( inSource ) )
,ActorFlags( getPxActor_ActorFlags( inSource ) )
,DominanceGroup( getPxActor_DominanceGroup( inSource ) )
,OwnerClient( getPxActor_OwnerClient( inSource ) )
,Aggregate( getPxActor_Aggregate( inSource ) )
,UserData( inSource->userData )
{
PX_UNUSED(inSource);
}
void setPxRigidActor_GlobalPose( PxRigidActor* inObj, const PxTransform & inArg){ inObj->setGlobalPose( inArg ); }
PxTransform getPxRigidActor_GlobalPose( const PxRigidActor* inObj ) { return inObj->getGlobalPose(); }
PxU32 getPxRigidActor_Shapes( const PxRigidActor* inObj, PxShape ** outBuffer, PxU32 inBufSize ) { return inObj->getShapes( outBuffer, inBufSize ); }
PxU32 getNbPxRigidActor_Shapes( const PxRigidActor* inObj ) { return inObj->getNbShapes( ); }
PxU32 getPxRigidActor_Constraints( const PxRigidActor* inObj, PxConstraint ** outBuffer, PxU32 inBufSize ) { return inObj->getConstraints( outBuffer, inBufSize ); }
PxU32 getNbPxRigidActor_Constraints( const PxRigidActor* inObj ) { return inObj->getNbConstraints( ); }
PX_PHYSX_CORE_API PxRigidActorGeneratedInfo::PxRigidActorGeneratedInfo()
: GlobalPose( "GlobalPose", setPxRigidActor_GlobalPose, getPxRigidActor_GlobalPose)
, Shapes( "Shapes", getPxRigidActor_Shapes, getNbPxRigidActor_Shapes )
, Constraints( "Constraints", getPxRigidActor_Constraints, getNbPxRigidActor_Constraints )
{}
PX_PHYSX_CORE_API PxRigidActorGeneratedValues::PxRigidActorGeneratedValues( const PxRigidActor* inSource )
:PxActorGeneratedValues( inSource )
,GlobalPose( getPxRigidActor_GlobalPose( inSource ) )
{
PX_UNUSED(inSource);
}
void setPxRigidBody_CMassLocalPose( PxRigidBody* inObj, const PxTransform & inArg){ inObj->setCMassLocalPose( inArg ); }
PxTransform getPxRigidBody_CMassLocalPose( const PxRigidBody* inObj ) { return inObj->getCMassLocalPose(); }
void setPxRigidBody_Mass( PxRigidBody* inObj, PxReal inArg){ inObj->setMass( inArg ); }
PxReal getPxRigidBody_Mass( const PxRigidBody* inObj ) { return inObj->getMass(); }
PxReal getPxRigidBody_InvMass( const PxRigidBody* inObj ) { return inObj->getInvMass(); }
void setPxRigidBody_MassSpaceInertiaTensor( PxRigidBody* inObj, const PxVec3 & inArg){ inObj->setMassSpaceInertiaTensor( inArg ); }
PxVec3 getPxRigidBody_MassSpaceInertiaTensor( const PxRigidBody* inObj ) { return inObj->getMassSpaceInertiaTensor(); }
PxVec3 getPxRigidBody_MassSpaceInvInertiaTensor( const PxRigidBody* inObj ) { return inObj->getMassSpaceInvInertiaTensor(); }
void setPxRigidBody_LinearDamping( PxRigidBody* inObj, PxReal inArg){ inObj->setLinearDamping( inArg ); }
PxReal getPxRigidBody_LinearDamping( const PxRigidBody* inObj ) { return inObj->getLinearDamping(); }
void setPxRigidBody_AngularDamping( PxRigidBody* inObj, PxReal inArg){ inObj->setAngularDamping( inArg ); }
PxReal getPxRigidBody_AngularDamping( const PxRigidBody* inObj ) { return inObj->getAngularDamping(); }
void setPxRigidBody_MaxLinearVelocity( PxRigidBody* inObj, PxReal inArg){ inObj->setMaxLinearVelocity( inArg ); }
PxReal getPxRigidBody_MaxLinearVelocity( const PxRigidBody* inObj ) { return inObj->getMaxLinearVelocity(); }
void setPxRigidBody_MaxAngularVelocity( PxRigidBody* inObj, PxReal inArg){ inObj->setMaxAngularVelocity( inArg ); }
PxReal getPxRigidBody_MaxAngularVelocity( const PxRigidBody* inObj ) { return inObj->getMaxAngularVelocity(); }
void setPxRigidBody_RigidBodyFlags( PxRigidBody* inObj, PxRigidBodyFlags inArg){ inObj->setRigidBodyFlags( inArg ); }
PxRigidBodyFlags getPxRigidBody_RigidBodyFlags( const PxRigidBody* inObj ) { return inObj->getRigidBodyFlags(); }
void setPxRigidBody_MinCCDAdvanceCoefficient( PxRigidBody* inObj, PxReal inArg){ inObj->setMinCCDAdvanceCoefficient( inArg ); }
PxReal getPxRigidBody_MinCCDAdvanceCoefficient( const PxRigidBody* inObj ) { return inObj->getMinCCDAdvanceCoefficient(); }
void setPxRigidBody_MaxDepenetrationVelocity( PxRigidBody* inObj, PxReal inArg){ inObj->setMaxDepenetrationVelocity( inArg ); }
PxReal getPxRigidBody_MaxDepenetrationVelocity( const PxRigidBody* inObj ) { return inObj->getMaxDepenetrationVelocity(); }
void setPxRigidBody_MaxContactImpulse( PxRigidBody* inObj, PxReal inArg){ inObj->setMaxContactImpulse( inArg ); }
PxReal getPxRigidBody_MaxContactImpulse( const PxRigidBody* inObj ) { return inObj->getMaxContactImpulse(); }
void setPxRigidBody_ContactSlopCoefficient( PxRigidBody* inObj, PxReal inArg){ inObj->setContactSlopCoefficient( inArg ); }
PxReal getPxRigidBody_ContactSlopCoefficient( const PxRigidBody* inObj ) { return inObj->getContactSlopCoefficient(); }
PX_PHYSX_CORE_API PxRigidBodyGeneratedInfo::PxRigidBodyGeneratedInfo()
: CMassLocalPose( "CMassLocalPose", setPxRigidBody_CMassLocalPose, getPxRigidBody_CMassLocalPose)
, Mass( "Mass", setPxRigidBody_Mass, getPxRigidBody_Mass)
, InvMass( "InvMass", getPxRigidBody_InvMass)
, MassSpaceInertiaTensor( "MassSpaceInertiaTensor", setPxRigidBody_MassSpaceInertiaTensor, getPxRigidBody_MassSpaceInertiaTensor)
, MassSpaceInvInertiaTensor( "MassSpaceInvInertiaTensor", getPxRigidBody_MassSpaceInvInertiaTensor)
, LinearDamping( "LinearDamping", setPxRigidBody_LinearDamping, getPxRigidBody_LinearDamping)
, AngularDamping( "AngularDamping", setPxRigidBody_AngularDamping, getPxRigidBody_AngularDamping)
, MaxLinearVelocity( "MaxLinearVelocity", setPxRigidBody_MaxLinearVelocity, getPxRigidBody_MaxLinearVelocity)
, MaxAngularVelocity( "MaxAngularVelocity", setPxRigidBody_MaxAngularVelocity, getPxRigidBody_MaxAngularVelocity)
, RigidBodyFlags( "RigidBodyFlags", setPxRigidBody_RigidBodyFlags, getPxRigidBody_RigidBodyFlags)
, MinCCDAdvanceCoefficient( "MinCCDAdvanceCoefficient", setPxRigidBody_MinCCDAdvanceCoefficient, getPxRigidBody_MinCCDAdvanceCoefficient)
, MaxDepenetrationVelocity( "MaxDepenetrationVelocity", setPxRigidBody_MaxDepenetrationVelocity, getPxRigidBody_MaxDepenetrationVelocity)
, MaxContactImpulse( "MaxContactImpulse", setPxRigidBody_MaxContactImpulse, getPxRigidBody_MaxContactImpulse)
, ContactSlopCoefficient( "ContactSlopCoefficient", setPxRigidBody_ContactSlopCoefficient, getPxRigidBody_ContactSlopCoefficient)
{}
PX_PHYSX_CORE_API PxRigidBodyGeneratedValues::PxRigidBodyGeneratedValues( const PxRigidBody* inSource )
:PxRigidActorGeneratedValues( inSource )
,CMassLocalPose( getPxRigidBody_CMassLocalPose( inSource ) )
,Mass( getPxRigidBody_Mass( inSource ) )
,InvMass( getPxRigidBody_InvMass( inSource ) )
,MassSpaceInertiaTensor( getPxRigidBody_MassSpaceInertiaTensor( inSource ) )
,MassSpaceInvInertiaTensor( getPxRigidBody_MassSpaceInvInertiaTensor( inSource ) )
,LinearDamping( getPxRigidBody_LinearDamping( inSource ) )
,AngularDamping( getPxRigidBody_AngularDamping( inSource ) )
,MaxLinearVelocity( getPxRigidBody_MaxLinearVelocity( inSource ) )
,MaxAngularVelocity( getPxRigidBody_MaxAngularVelocity( inSource ) )
,RigidBodyFlags( getPxRigidBody_RigidBodyFlags( inSource ) )
,MinCCDAdvanceCoefficient( getPxRigidBody_MinCCDAdvanceCoefficient( inSource ) )
,MaxDepenetrationVelocity( getPxRigidBody_MaxDepenetrationVelocity( inSource ) )
,MaxContactImpulse( getPxRigidBody_MaxContactImpulse( inSource ) )
,ContactSlopCoefficient( getPxRigidBody_ContactSlopCoefficient( inSource ) )
{
PX_UNUSED(inSource);
}
_Bool getPxRigidDynamic_IsSleeping( const PxRigidDynamic* inObj ) { return inObj->isSleeping(); }
void setPxRigidDynamic_SleepThreshold( PxRigidDynamic* inObj, PxReal inArg){ inObj->setSleepThreshold( inArg ); }
PxReal getPxRigidDynamic_SleepThreshold( const PxRigidDynamic* inObj ) { return inObj->getSleepThreshold(); }
void setPxRigidDynamic_StabilizationThreshold( PxRigidDynamic* inObj, PxReal inArg){ inObj->setStabilizationThreshold( inArg ); }
PxReal getPxRigidDynamic_StabilizationThreshold( const PxRigidDynamic* inObj ) { return inObj->getStabilizationThreshold(); }
void setPxRigidDynamic_RigidDynamicLockFlags( PxRigidDynamic* inObj, PxRigidDynamicLockFlags inArg){ inObj->setRigidDynamicLockFlags( inArg ); }
PxRigidDynamicLockFlags getPxRigidDynamic_RigidDynamicLockFlags( const PxRigidDynamic* inObj ) { return inObj->getRigidDynamicLockFlags(); }
void setPxRigidDynamic_LinearVelocity( PxRigidDynamic* inObj, const PxVec3 & inArg){ inObj->setLinearVelocity( inArg ); }
PxVec3 getPxRigidDynamic_LinearVelocity( const PxRigidDynamic* inObj ) { return inObj->getLinearVelocity(); }
void setPxRigidDynamic_AngularVelocity( PxRigidDynamic* inObj, const PxVec3 & inArg){ inObj->setAngularVelocity( inArg ); }
PxVec3 getPxRigidDynamic_AngularVelocity( const PxRigidDynamic* inObj ) { return inObj->getAngularVelocity(); }
void setPxRigidDynamic_WakeCounter( PxRigidDynamic* inObj, PxReal inArg){ inObj->setWakeCounter( inArg ); }
PxReal getPxRigidDynamic_WakeCounter( const PxRigidDynamic* inObj ) { return inObj->getWakeCounter(); }
void setPxRigidDynamic_SolverIterationCounts( PxRigidDynamic* inObj, PxU32 inArg0, PxU32 inArg1 ) { inObj->setSolverIterationCounts( inArg0, inArg1 ); }
void getPxRigidDynamic_SolverIterationCounts( const PxRigidDynamic* inObj, PxU32& inArg0, PxU32& inArg1 ) { inObj->getSolverIterationCounts( inArg0, inArg1 ); }
void setPxRigidDynamic_ContactReportThreshold( PxRigidDynamic* inObj, PxReal inArg){ inObj->setContactReportThreshold( inArg ); }
PxReal getPxRigidDynamic_ContactReportThreshold( const PxRigidDynamic* inObj ) { return inObj->getContactReportThreshold(); }
const char * getPxRigidDynamic_ConcreteTypeName( const PxRigidDynamic* inObj ) { return inObj->getConcreteTypeName(); }
PX_PHYSX_CORE_API PxRigidDynamicGeneratedInfo::PxRigidDynamicGeneratedInfo()
: IsSleeping( "IsSleeping", getPxRigidDynamic_IsSleeping)
, SleepThreshold( "SleepThreshold", setPxRigidDynamic_SleepThreshold, getPxRigidDynamic_SleepThreshold)
, StabilizationThreshold( "StabilizationThreshold", setPxRigidDynamic_StabilizationThreshold, getPxRigidDynamic_StabilizationThreshold)
, RigidDynamicLockFlags( "RigidDynamicLockFlags", setPxRigidDynamic_RigidDynamicLockFlags, getPxRigidDynamic_RigidDynamicLockFlags)
, LinearVelocity( "LinearVelocity", setPxRigidDynamic_LinearVelocity, getPxRigidDynamic_LinearVelocity)
, AngularVelocity( "AngularVelocity", setPxRigidDynamic_AngularVelocity, getPxRigidDynamic_AngularVelocity)
, WakeCounter( "WakeCounter", setPxRigidDynamic_WakeCounter, getPxRigidDynamic_WakeCounter)
, SolverIterationCounts( "SolverIterationCounts", "minPositionIters", "minVelocityIters", setPxRigidDynamic_SolverIterationCounts, getPxRigidDynamic_SolverIterationCounts)
, ContactReportThreshold( "ContactReportThreshold", setPxRigidDynamic_ContactReportThreshold, getPxRigidDynamic_ContactReportThreshold)
, ConcreteTypeName( "ConcreteTypeName", getPxRigidDynamic_ConcreteTypeName)
{}
PX_PHYSX_CORE_API PxRigidDynamicGeneratedValues::PxRigidDynamicGeneratedValues( const PxRigidDynamic* inSource )
:PxRigidBodyGeneratedValues( inSource )
,IsSleeping( getPxRigidDynamic_IsSleeping( inSource ) )
,SleepThreshold( getPxRigidDynamic_SleepThreshold( inSource ) )
,StabilizationThreshold( getPxRigidDynamic_StabilizationThreshold( inSource ) )
,RigidDynamicLockFlags( getPxRigidDynamic_RigidDynamicLockFlags( inSource ) )
,LinearVelocity( getPxRigidDynamic_LinearVelocity( inSource ) )
,AngularVelocity( getPxRigidDynamic_AngularVelocity( inSource ) )
,WakeCounter( getPxRigidDynamic_WakeCounter( inSource ) )
,ContactReportThreshold( getPxRigidDynamic_ContactReportThreshold( inSource ) )
,ConcreteTypeName( getPxRigidDynamic_ConcreteTypeName( inSource ) )
{
PX_UNUSED(inSource);
getPxRigidDynamic_SolverIterationCounts( inSource, SolverIterationCounts[0], SolverIterationCounts[1] );
}
const char * getPxRigidStatic_ConcreteTypeName( const PxRigidStatic* inObj ) { return inObj->getConcreteTypeName(); }
PX_PHYSX_CORE_API PxRigidStaticGeneratedInfo::PxRigidStaticGeneratedInfo()
: ConcreteTypeName( "ConcreteTypeName", getPxRigidStatic_ConcreteTypeName)
{}
PX_PHYSX_CORE_API PxRigidStaticGeneratedValues::PxRigidStaticGeneratedValues( const PxRigidStatic* inSource )
:PxRigidActorGeneratedValues( inSource )
,ConcreteTypeName( getPxRigidStatic_ConcreteTypeName( inSource ) )
{
PX_UNUSED(inSource);
}
PxArticulationJointReducedCoordinate * getPxArticulationLink_InboundJoint( const PxArticulationLink* inObj ) { return inObj->getInboundJoint(); }
PxU32 getPxArticulationLink_InboundJointDof( const PxArticulationLink* inObj ) { return inObj->getInboundJointDof(); }
PxU32 getPxArticulationLink_LinkIndex( const PxArticulationLink* inObj ) { return inObj->getLinkIndex(); }
PxU32 getPxArticulationLink_Children( const PxArticulationLink* inObj, PxArticulationLink ** outBuffer, PxU32 inBufSize ) { return inObj->getChildren( outBuffer, inBufSize ); }
PxU32 getNbPxArticulationLink_Children( const PxArticulationLink* inObj ) { return inObj->getNbChildren( ); }
void setPxArticulationLink_CfmScale( PxArticulationLink* inObj, const PxReal inArg){ inObj->setCfmScale( inArg ); }
PxReal getPxArticulationLink_CfmScale( const PxArticulationLink* inObj ) { return inObj->getCfmScale(); }
PxVec3 getPxArticulationLink_LinearVelocity( const PxArticulationLink* inObj ) { return inObj->getLinearVelocity(); }
PxVec3 getPxArticulationLink_AngularVelocity( const PxArticulationLink* inObj ) { return inObj->getAngularVelocity(); }
const char * getPxArticulationLink_ConcreteTypeName( const PxArticulationLink* inObj ) { return inObj->getConcreteTypeName(); }
PX_PHYSX_CORE_API PxArticulationLinkGeneratedInfo::PxArticulationLinkGeneratedInfo()
: InboundJoint( "InboundJoint", getPxArticulationLink_InboundJoint)
, InboundJointDof( "InboundJointDof", getPxArticulationLink_InboundJointDof)
, LinkIndex( "LinkIndex", getPxArticulationLink_LinkIndex)
, Children( "Children", getPxArticulationLink_Children, getNbPxArticulationLink_Children )
, CfmScale( "CfmScale", setPxArticulationLink_CfmScale, getPxArticulationLink_CfmScale)
, LinearVelocity( "LinearVelocity", getPxArticulationLink_LinearVelocity)
, AngularVelocity( "AngularVelocity", getPxArticulationLink_AngularVelocity)
, ConcreteTypeName( "ConcreteTypeName", getPxArticulationLink_ConcreteTypeName)
{}
PX_PHYSX_CORE_API PxArticulationLinkGeneratedValues::PxArticulationLinkGeneratedValues( const PxArticulationLink* inSource )
:PxRigidBodyGeneratedValues( inSource )
,InboundJoint( getPxArticulationLink_InboundJoint( inSource ) )
,InboundJointDof( getPxArticulationLink_InboundJointDof( inSource ) )
,LinkIndex( getPxArticulationLink_LinkIndex( inSource ) )
,CfmScale( getPxArticulationLink_CfmScale( inSource ) )
,LinearVelocity( getPxArticulationLink_LinearVelocity( inSource ) )
,AngularVelocity( getPxArticulationLink_AngularVelocity( inSource ) )
,ConcreteTypeName( getPxArticulationLink_ConcreteTypeName( inSource ) )
{
PX_UNUSED(inSource);
}
void setPxArticulationJointReducedCoordinate_ParentPose( PxArticulationJointReducedCoordinate* inObj, const PxTransform & inArg){ inObj->setParentPose( inArg ); }
PxTransform getPxArticulationJointReducedCoordinate_ParentPose( const PxArticulationJointReducedCoordinate* inObj ) { return inObj->getParentPose(); }
void setPxArticulationJointReducedCoordinate_ChildPose( PxArticulationJointReducedCoordinate* inObj, const PxTransform & inArg){ inObj->setChildPose( inArg ); }
PxTransform getPxArticulationJointReducedCoordinate_ChildPose( const PxArticulationJointReducedCoordinate* inObj ) { return inObj->getChildPose(); }
void setPxArticulationJointReducedCoordinate_JointType( PxArticulationJointReducedCoordinate* inObj, PxArticulationJointType::Enum inArg){ inObj->setJointType( inArg ); }
PxArticulationJointType::Enum getPxArticulationJointReducedCoordinate_JointType( const PxArticulationJointReducedCoordinate* inObj ) { return inObj->getJointType(); }
void setPxArticulationJointReducedCoordinate_Motion( PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex, PxArticulationMotion::Enum inArg ){ inObj->setMotion( inIndex, inArg ); }
PxArticulationMotion::Enum getPxArticulationJointReducedCoordinate_Motion( const PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex ) { return inObj->getMotion( inIndex ); }
void setPxArticulationJointReducedCoordinate_LimitParams( PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex, PxArticulationLimit inArg ){ inObj->setLimitParams( inIndex, inArg ); }
PxArticulationLimit getPxArticulationJointReducedCoordinate_LimitParams( const PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex ) { return inObj->getLimitParams( inIndex ); }
void setPxArticulationJointReducedCoordinate_DriveParams( PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex, PxArticulationDrive inArg ){ inObj->setDriveParams( inIndex, inArg ); }
PxArticulationDrive getPxArticulationJointReducedCoordinate_DriveParams( const PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex ) { return inObj->getDriveParams( inIndex ); }
void setPxArticulationJointReducedCoordinate_Armature( PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex, PxReal inArg ){ inObj->setArmature( inIndex, inArg ); }
PxReal getPxArticulationJointReducedCoordinate_Armature( const PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex ) { return inObj->getArmature( inIndex ); }
void setPxArticulationJointReducedCoordinate_FrictionCoefficient( PxArticulationJointReducedCoordinate* inObj, const PxReal inArg){ inObj->setFrictionCoefficient( inArg ); }
PxReal getPxArticulationJointReducedCoordinate_FrictionCoefficient( const PxArticulationJointReducedCoordinate* inObj ) { return inObj->getFrictionCoefficient(); }
void setPxArticulationJointReducedCoordinate_MaxJointVelocity( PxArticulationJointReducedCoordinate* inObj, const PxReal inArg){ inObj->setMaxJointVelocity( inArg ); }
PxReal getPxArticulationJointReducedCoordinate_MaxJointVelocity( const PxArticulationJointReducedCoordinate* inObj ) { return inObj->getMaxJointVelocity(); }
void setPxArticulationJointReducedCoordinate_JointPosition( PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex, PxReal inArg ){ inObj->setJointPosition( inIndex, inArg ); }
PxReal getPxArticulationJointReducedCoordinate_JointPosition( const PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex ) { return inObj->getJointPosition( inIndex ); }
void setPxArticulationJointReducedCoordinate_JointVelocity( PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex, PxReal inArg ){ inObj->setJointVelocity( inIndex, inArg ); }
PxReal getPxArticulationJointReducedCoordinate_JointVelocity( const PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex ) { return inObj->getJointVelocity( inIndex ); }
const char * getPxArticulationJointReducedCoordinate_ConcreteTypeName( const PxArticulationJointReducedCoordinate* inObj ) { return inObj->getConcreteTypeName(); }
inline void * getPxArticulationJointReducedCoordinateUserData( const PxArticulationJointReducedCoordinate* inOwner ) { return inOwner->userData; }
inline void setPxArticulationJointReducedCoordinateUserData( PxArticulationJointReducedCoordinate* inOwner, void * inData) { inOwner->userData = inData; }
PX_PHYSX_CORE_API PxArticulationJointReducedCoordinateGeneratedInfo::PxArticulationJointReducedCoordinateGeneratedInfo()
: ParentPose( "ParentPose", setPxArticulationJointReducedCoordinate_ParentPose, getPxArticulationJointReducedCoordinate_ParentPose)
, ChildPose( "ChildPose", setPxArticulationJointReducedCoordinate_ChildPose, getPxArticulationJointReducedCoordinate_ChildPose)
, JointType( "JointType", setPxArticulationJointReducedCoordinate_JointType, getPxArticulationJointReducedCoordinate_JointType)
, Motion( "Motion", setPxArticulationJointReducedCoordinate_Motion, getPxArticulationJointReducedCoordinate_Motion)
, LimitParams( "LimitParams", setPxArticulationJointReducedCoordinate_LimitParams, getPxArticulationJointReducedCoordinate_LimitParams)
, DriveParams( "DriveParams", setPxArticulationJointReducedCoordinate_DriveParams, getPxArticulationJointReducedCoordinate_DriveParams)
, Armature( "Armature", setPxArticulationJointReducedCoordinate_Armature, getPxArticulationJointReducedCoordinate_Armature)
, FrictionCoefficient( "FrictionCoefficient", setPxArticulationJointReducedCoordinate_FrictionCoefficient, getPxArticulationJointReducedCoordinate_FrictionCoefficient)
, MaxJointVelocity( "MaxJointVelocity", setPxArticulationJointReducedCoordinate_MaxJointVelocity, getPxArticulationJointReducedCoordinate_MaxJointVelocity)
, JointPosition( "JointPosition", setPxArticulationJointReducedCoordinate_JointPosition, getPxArticulationJointReducedCoordinate_JointPosition)
, JointVelocity( "JointVelocity", setPxArticulationJointReducedCoordinate_JointVelocity, getPxArticulationJointReducedCoordinate_JointVelocity)
, ConcreteTypeName( "ConcreteTypeName", getPxArticulationJointReducedCoordinate_ConcreteTypeName)
, UserData( "UserData", setPxArticulationJointReducedCoordinateUserData, getPxArticulationJointReducedCoordinateUserData )
{}
PX_PHYSX_CORE_API PxArticulationJointReducedCoordinateGeneratedValues::PxArticulationJointReducedCoordinateGeneratedValues( const PxArticulationJointReducedCoordinate* inSource )
:ParentPose( getPxArticulationJointReducedCoordinate_ParentPose( inSource ) )
,ChildPose( getPxArticulationJointReducedCoordinate_ChildPose( inSource ) )
,JointType( getPxArticulationJointReducedCoordinate_JointType( inSource ) )
,FrictionCoefficient( getPxArticulationJointReducedCoordinate_FrictionCoefficient( inSource ) )
,MaxJointVelocity( getPxArticulationJointReducedCoordinate_MaxJointVelocity( inSource ) )
,ConcreteTypeName( getPxArticulationJointReducedCoordinate_ConcreteTypeName( inSource ) )
,UserData( inSource->userData )
{
PX_UNUSED(inSource);
for ( PxU32 idx = 0; idx < static_cast<PxU32>( physx::PxArticulationAxis::eCOUNT ); ++idx )
Motion[idx] = getPxArticulationJointReducedCoordinate_Motion( inSource, static_cast< PxArticulationAxis::Enum >( idx ) );
for ( PxU32 idx = 0; idx < static_cast<PxU32>( physx::PxArticulationAxis::eCOUNT ); ++idx )
LimitParams[idx] = getPxArticulationJointReducedCoordinate_LimitParams( inSource, static_cast< PxArticulationAxis::Enum >( idx ) );
for ( PxU32 idx = 0; idx < static_cast<PxU32>( physx::PxArticulationAxis::eCOUNT ); ++idx )
DriveParams[idx] = getPxArticulationJointReducedCoordinate_DriveParams( inSource, static_cast< PxArticulationAxis::Enum >( idx ) );
for ( PxU32 idx = 0; idx < static_cast<PxU32>( physx::PxArticulationAxis::eCOUNT ); ++idx )
Armature[idx] = getPxArticulationJointReducedCoordinate_Armature( inSource, static_cast< PxArticulationAxis::Enum >( idx ) );
for ( PxU32 idx = 0; idx < static_cast<PxU32>( physx::PxArticulationAxis::eCOUNT ); ++idx )
JointPosition[idx] = getPxArticulationJointReducedCoordinate_JointPosition( inSource, static_cast< PxArticulationAxis::Enum >( idx ) );
for ( PxU32 idx = 0; idx < static_cast<PxU32>( physx::PxArticulationAxis::eCOUNT ); ++idx )
JointVelocity[idx] = getPxArticulationJointReducedCoordinate_JointVelocity( inSource, static_cast< PxArticulationAxis::Enum >( idx ) );
}
PxScene * getPxArticulationReducedCoordinate_Scene( const PxArticulationReducedCoordinate* inObj ) { return inObj->getScene(); }
void setPxArticulationReducedCoordinate_SolverIterationCounts( PxArticulationReducedCoordinate* inObj, PxU32 inArg0, PxU32 inArg1 ) { inObj->setSolverIterationCounts( inArg0, inArg1 ); }
void getPxArticulationReducedCoordinate_SolverIterationCounts( const PxArticulationReducedCoordinate* inObj, PxU32& inArg0, PxU32& inArg1 ) { inObj->getSolverIterationCounts( inArg0, inArg1 ); }
_Bool getPxArticulationReducedCoordinate_IsSleeping( const PxArticulationReducedCoordinate* inObj ) { return inObj->isSleeping(); }
void setPxArticulationReducedCoordinate_SleepThreshold( PxArticulationReducedCoordinate* inObj, PxReal inArg){ inObj->setSleepThreshold( inArg ); }
PxReal getPxArticulationReducedCoordinate_SleepThreshold( const PxArticulationReducedCoordinate* inObj ) { return inObj->getSleepThreshold(); }
void setPxArticulationReducedCoordinate_StabilizationThreshold( PxArticulationReducedCoordinate* inObj, PxReal inArg){ inObj->setStabilizationThreshold( inArg ); }
PxReal getPxArticulationReducedCoordinate_StabilizationThreshold( const PxArticulationReducedCoordinate* inObj ) { return inObj->getStabilizationThreshold(); }
void setPxArticulationReducedCoordinate_WakeCounter( PxArticulationReducedCoordinate* inObj, PxReal inArg){ inObj->setWakeCounter( inArg ); }
PxReal getPxArticulationReducedCoordinate_WakeCounter( const PxArticulationReducedCoordinate* inObj ) { return inObj->getWakeCounter(); }
void setPxArticulationReducedCoordinate_MaxCOMLinearVelocity( PxArticulationReducedCoordinate* inObj, const PxReal inArg){ inObj->setMaxCOMLinearVelocity( inArg ); }
PxReal getPxArticulationReducedCoordinate_MaxCOMLinearVelocity( const PxArticulationReducedCoordinate* inObj ) { return inObj->getMaxCOMLinearVelocity(); }
void setPxArticulationReducedCoordinate_MaxCOMAngularVelocity( PxArticulationReducedCoordinate* inObj, const PxReal inArg){ inObj->setMaxCOMAngularVelocity( inArg ); }
PxReal getPxArticulationReducedCoordinate_MaxCOMAngularVelocity( const PxArticulationReducedCoordinate* inObj ) { return inObj->getMaxCOMAngularVelocity(); }
PxU32 getPxArticulationReducedCoordinate_Links( const PxArticulationReducedCoordinate* inObj, PxArticulationLink ** outBuffer, PxU32 inBufSize ) { return inObj->getLinks( outBuffer, inBufSize ); }
PxU32 getNbPxArticulationReducedCoordinate_Links( const PxArticulationReducedCoordinate* inObj ) { return inObj->getNbLinks( ); }
void setPxArticulationReducedCoordinate_Name( PxArticulationReducedCoordinate* inObj, const char * inArg){ inObj->setName( inArg ); }
const char * getPxArticulationReducedCoordinate_Name( const PxArticulationReducedCoordinate* inObj ) { return inObj->getName(); }
PxAggregate * getPxArticulationReducedCoordinate_Aggregate( const PxArticulationReducedCoordinate* inObj ) { return inObj->getAggregate(); }
void setPxArticulationReducedCoordinate_ArticulationFlags( PxArticulationReducedCoordinate* inObj, PxArticulationFlags inArg){ inObj->setArticulationFlags( inArg ); }
PxArticulationFlags getPxArticulationReducedCoordinate_ArticulationFlags( const PxArticulationReducedCoordinate* inObj ) { return inObj->getArticulationFlags(); }
void setPxArticulationReducedCoordinate_RootGlobalPose( PxArticulationReducedCoordinate* inObj, const PxTransform & inArg){ inObj->setRootGlobalPose( inArg ); }
PxTransform getPxArticulationReducedCoordinate_RootGlobalPose( const PxArticulationReducedCoordinate* inObj ) { return inObj->getRootGlobalPose(); }
void setPxArticulationReducedCoordinate_RootLinearVelocity( PxArticulationReducedCoordinate* inObj, const PxVec3 & inArg){ inObj->setRootLinearVelocity( inArg ); }
PxVec3 getPxArticulationReducedCoordinate_RootLinearVelocity( const PxArticulationReducedCoordinate* inObj ) { return inObj->getRootLinearVelocity(); }
void setPxArticulationReducedCoordinate_RootAngularVelocity( PxArticulationReducedCoordinate* inObj, const PxVec3 & inArg){ inObj->setRootAngularVelocity( inArg ); }
PxVec3 getPxArticulationReducedCoordinate_RootAngularVelocity( const PxArticulationReducedCoordinate* inObj ) { return inObj->getRootAngularVelocity(); }
inline void * getPxArticulationReducedCoordinateUserData( const PxArticulationReducedCoordinate* inOwner ) { return inOwner->userData; }
inline void setPxArticulationReducedCoordinateUserData( PxArticulationReducedCoordinate* inOwner, void * inData) { inOwner->userData = inData; }
PX_PHYSX_CORE_API PxArticulationReducedCoordinateGeneratedInfo::PxArticulationReducedCoordinateGeneratedInfo()
: Scene( "Scene", getPxArticulationReducedCoordinate_Scene)
, SolverIterationCounts( "SolverIterationCounts", "minPositionIters", "minVelocityIters", setPxArticulationReducedCoordinate_SolverIterationCounts, getPxArticulationReducedCoordinate_SolverIterationCounts)
, IsSleeping( "IsSleeping", getPxArticulationReducedCoordinate_IsSleeping)
, SleepThreshold( "SleepThreshold", setPxArticulationReducedCoordinate_SleepThreshold, getPxArticulationReducedCoordinate_SleepThreshold)
, StabilizationThreshold( "StabilizationThreshold", setPxArticulationReducedCoordinate_StabilizationThreshold, getPxArticulationReducedCoordinate_StabilizationThreshold)
, WakeCounter( "WakeCounter", setPxArticulationReducedCoordinate_WakeCounter, getPxArticulationReducedCoordinate_WakeCounter)
, MaxCOMLinearVelocity( "MaxCOMLinearVelocity", setPxArticulationReducedCoordinate_MaxCOMLinearVelocity, getPxArticulationReducedCoordinate_MaxCOMLinearVelocity)
, MaxCOMAngularVelocity( "MaxCOMAngularVelocity", setPxArticulationReducedCoordinate_MaxCOMAngularVelocity, getPxArticulationReducedCoordinate_MaxCOMAngularVelocity)
, Links( "Links", getPxArticulationReducedCoordinate_Links, getNbPxArticulationReducedCoordinate_Links )
, Name( "Name", setPxArticulationReducedCoordinate_Name, getPxArticulationReducedCoordinate_Name)
, Aggregate( "Aggregate", getPxArticulationReducedCoordinate_Aggregate)
, ArticulationFlags( "ArticulationFlags", setPxArticulationReducedCoordinate_ArticulationFlags, getPxArticulationReducedCoordinate_ArticulationFlags)
, RootGlobalPose( "RootGlobalPose", setPxArticulationReducedCoordinate_RootGlobalPose, getPxArticulationReducedCoordinate_RootGlobalPose)
, RootLinearVelocity( "RootLinearVelocity", setPxArticulationReducedCoordinate_RootLinearVelocity, getPxArticulationReducedCoordinate_RootLinearVelocity)
, RootAngularVelocity( "RootAngularVelocity", setPxArticulationReducedCoordinate_RootAngularVelocity, getPxArticulationReducedCoordinate_RootAngularVelocity)
, UserData( "UserData", setPxArticulationReducedCoordinateUserData, getPxArticulationReducedCoordinateUserData )
{}
PX_PHYSX_CORE_API PxArticulationReducedCoordinateGeneratedValues::PxArticulationReducedCoordinateGeneratedValues( const PxArticulationReducedCoordinate* inSource )
:Scene( getPxArticulationReducedCoordinate_Scene( inSource ) )
,IsSleeping( getPxArticulationReducedCoordinate_IsSleeping( inSource ) )
,SleepThreshold( getPxArticulationReducedCoordinate_SleepThreshold( inSource ) )
,StabilizationThreshold( getPxArticulationReducedCoordinate_StabilizationThreshold( inSource ) )
,WakeCounter( getPxArticulationReducedCoordinate_WakeCounter( inSource ) )
,MaxCOMLinearVelocity( getPxArticulationReducedCoordinate_MaxCOMLinearVelocity( inSource ) )
,MaxCOMAngularVelocity( getPxArticulationReducedCoordinate_MaxCOMAngularVelocity( inSource ) )
,Name( getPxArticulationReducedCoordinate_Name( inSource ) )
,Aggregate( getPxArticulationReducedCoordinate_Aggregate( inSource ) )
,ArticulationFlags( getPxArticulationReducedCoordinate_ArticulationFlags( inSource ) )
,RootGlobalPose( getPxArticulationReducedCoordinate_RootGlobalPose( inSource ) )
,RootLinearVelocity( getPxArticulationReducedCoordinate_RootLinearVelocity( inSource ) )
,RootAngularVelocity( getPxArticulationReducedCoordinate_RootAngularVelocity( inSource ) )
,UserData( inSource->userData )
{
PX_UNUSED(inSource);
getPxArticulationReducedCoordinate_SolverIterationCounts( inSource, SolverIterationCounts[0], SolverIterationCounts[1] );
}
PxU32 getPxAggregate_MaxNbActors( const PxAggregate* inObj ) { return inObj->getMaxNbActors(); }
PxU32 getPxAggregate_MaxNbShapes( const PxAggregate* inObj ) { return inObj->getMaxNbShapes(); }
PxU32 getPxAggregate_Actors( const PxAggregate* inObj, PxActor ** outBuffer, PxU32 inBufSize ) { return inObj->getActors( outBuffer, inBufSize ); }
PxU32 getNbPxAggregate_Actors( const PxAggregate* inObj ) { return inObj->getNbActors( ); }
_Bool getPxAggregate_SelfCollision( const PxAggregate* inObj ) { return inObj->getSelfCollision(); }
const char * getPxAggregate_ConcreteTypeName( const PxAggregate* inObj ) { return inObj->getConcreteTypeName(); }
inline void * getPxAggregateUserData( const PxAggregate* inOwner ) { return inOwner->userData; }
inline void setPxAggregateUserData( PxAggregate* inOwner, void * inData) { inOwner->userData = inData; }
PX_PHYSX_CORE_API PxAggregateGeneratedInfo::PxAggregateGeneratedInfo()
: MaxNbActors( "MaxNbActors", getPxAggregate_MaxNbActors)
, MaxNbShapes( "MaxNbShapes", getPxAggregate_MaxNbShapes)
, Actors( "Actors", getPxAggregate_Actors, getNbPxAggregate_Actors )
, SelfCollision( "SelfCollision", getPxAggregate_SelfCollision)
, ConcreteTypeName( "ConcreteTypeName", getPxAggregate_ConcreteTypeName)
, UserData( "UserData", setPxAggregateUserData, getPxAggregateUserData )
{}
PX_PHYSX_CORE_API PxAggregateGeneratedValues::PxAggregateGeneratedValues( const PxAggregate* inSource )
:MaxNbActors( getPxAggregate_MaxNbActors( inSource ) )
,MaxNbShapes( getPxAggregate_MaxNbShapes( inSource ) )
,SelfCollision( getPxAggregate_SelfCollision( inSource ) )
,ConcreteTypeName( getPxAggregate_ConcreteTypeName( inSource ) )
,UserData( inSource->userData )
{
PX_UNUSED(inSource);
}
PxScene * getPxConstraint_Scene( const PxConstraint* inObj ) { return inObj->getScene(); }
void setPxConstraint_Actors( PxConstraint* inObj, PxRigidActor * inArg0, PxRigidActor * inArg1 ) { inObj->setActors( inArg0, inArg1 ); }
void getPxConstraint_Actors( const PxConstraint* inObj, PxRigidActor *& inArg0, PxRigidActor *& inArg1 ) { inObj->getActors( inArg0, inArg1 ); }
void setPxConstraint_Flags( PxConstraint* inObj, PxConstraintFlags inArg){ inObj->setFlags( inArg ); }
PxConstraintFlags getPxConstraint_Flags( const PxConstraint* inObj ) { return inObj->getFlags(); }
_Bool getPxConstraint_IsValid( const PxConstraint* inObj ) { return inObj->isValid(); }
void setPxConstraint_BreakForce( PxConstraint* inObj, PxReal inArg0, PxReal inArg1 ) { inObj->setBreakForce( inArg0, inArg1 ); }
void getPxConstraint_BreakForce( const PxConstraint* inObj, PxReal& inArg0, PxReal& inArg1 ) { inObj->getBreakForce( inArg0, inArg1 ); }
void setPxConstraint_MinResponseThreshold( PxConstraint* inObj, PxReal inArg){ inObj->setMinResponseThreshold( inArg ); }
PxReal getPxConstraint_MinResponseThreshold( const PxConstraint* inObj ) { return inObj->getMinResponseThreshold(); }
const char * getPxConstraint_ConcreteTypeName( const PxConstraint* inObj ) { return inObj->getConcreteTypeName(); }
inline void * getPxConstraintUserData( const PxConstraint* inOwner ) { return inOwner->userData; }
inline void setPxConstraintUserData( PxConstraint* inOwner, void * inData) { inOwner->userData = inData; }
PX_PHYSX_CORE_API PxConstraintGeneratedInfo::PxConstraintGeneratedInfo()
: Scene( "Scene", getPxConstraint_Scene)
, Actors( "Actors", "actor0", "actor1", setPxConstraint_Actors, getPxConstraint_Actors)
, Flags( "Flags", setPxConstraint_Flags, getPxConstraint_Flags)
, IsValid( "IsValid", getPxConstraint_IsValid)
, BreakForce( "BreakForce", "linear", "angular", setPxConstraint_BreakForce, getPxConstraint_BreakForce)
, MinResponseThreshold( "MinResponseThreshold", setPxConstraint_MinResponseThreshold, getPxConstraint_MinResponseThreshold)
, ConcreteTypeName( "ConcreteTypeName", getPxConstraint_ConcreteTypeName)
, UserData( "UserData", setPxConstraintUserData, getPxConstraintUserData )
{}
PX_PHYSX_CORE_API PxConstraintGeneratedValues::PxConstraintGeneratedValues( const PxConstraint* inSource )
:Scene( getPxConstraint_Scene( inSource ) )
,Flags( getPxConstraint_Flags( inSource ) )
,IsValid( getPxConstraint_IsValid( inSource ) )
,MinResponseThreshold( getPxConstraint_MinResponseThreshold( inSource ) )
,ConcreteTypeName( getPxConstraint_ConcreteTypeName( inSource ) )
,UserData( inSource->userData )
{
PX_UNUSED(inSource);
getPxConstraint_Actors( inSource, Actors[0], Actors[1] );
getPxConstraint_BreakForce( inSource, BreakForce[0], BreakForce[1] );
}
void setPxShape_LocalPose( PxShape* inObj, const PxTransform & inArg){ inObj->setLocalPose( inArg ); }
PxTransform getPxShape_LocalPose( const PxShape* inObj ) { return inObj->getLocalPose(); }
void setPxShape_SimulationFilterData( PxShape* inObj, const PxFilterData & inArg){ inObj->setSimulationFilterData( inArg ); }
PxFilterData getPxShape_SimulationFilterData( const PxShape* inObj ) { return inObj->getSimulationFilterData(); }
void setPxShape_QueryFilterData( PxShape* inObj, const PxFilterData & inArg){ inObj->setQueryFilterData( inArg ); }
PxFilterData getPxShape_QueryFilterData( const PxShape* inObj ) { return inObj->getQueryFilterData(); }
PxU32 getPxShape_Materials( const PxShape* inObj, PxMaterial ** outBuffer, PxU32 inBufSize ) { return inObj->getMaterials( outBuffer, inBufSize ); }
PxU32 getNbPxShape_Materials( const PxShape* inObj ) { return inObj->getNbMaterials( ); }
void setPxShape_ContactOffset( PxShape* inObj, PxReal inArg){ inObj->setContactOffset( inArg ); }
PxReal getPxShape_ContactOffset( const PxShape* inObj ) { return inObj->getContactOffset(); }
void setPxShape_RestOffset( PxShape* inObj, PxReal inArg){ inObj->setRestOffset( inArg ); }
PxReal getPxShape_RestOffset( const PxShape* inObj ) { return inObj->getRestOffset(); }
void setPxShape_DensityForFluid( PxShape* inObj, PxReal inArg){ inObj->setDensityForFluid( inArg ); }
PxReal getPxShape_DensityForFluid( const PxShape* inObj ) { return inObj->getDensityForFluid(); }
void setPxShape_TorsionalPatchRadius( PxShape* inObj, PxReal inArg){ inObj->setTorsionalPatchRadius( inArg ); }
PxReal getPxShape_TorsionalPatchRadius( const PxShape* inObj ) { return inObj->getTorsionalPatchRadius(); }
void setPxShape_MinTorsionalPatchRadius( PxShape* inObj, PxReal inArg){ inObj->setMinTorsionalPatchRadius( inArg ); }
PxReal getPxShape_MinTorsionalPatchRadius( const PxShape* inObj ) { return inObj->getMinTorsionalPatchRadius(); }
PxU32 getPxShape_InternalShapeIndex( const PxShape* inObj ) { return inObj->getInternalShapeIndex(); }
void setPxShape_Flags( PxShape* inObj, PxShapeFlags inArg){ inObj->setFlags( inArg ); }
PxShapeFlags getPxShape_Flags( const PxShape* inObj ) { return inObj->getFlags(); }
_Bool getPxShape_IsExclusive( const PxShape* inObj ) { return inObj->isExclusive(); }
void setPxShape_Name( PxShape* inObj, const char * inArg){ inObj->setName( inArg ); }
const char * getPxShape_Name( const PxShape* inObj ) { return inObj->getName(); }
const char * getPxShape_ConcreteTypeName( const PxShape* inObj ) { return inObj->getConcreteTypeName(); }
inline void * getPxShapeUserData( const PxShape* inOwner ) { return inOwner->userData; }
inline void setPxShapeUserData( PxShape* inOwner, void * inData) { inOwner->userData = inData; }
PX_PHYSX_CORE_API PxShapeGeneratedInfo::PxShapeGeneratedInfo()
: LocalPose( "LocalPose", setPxShape_LocalPose, getPxShape_LocalPose)
, SimulationFilterData( "SimulationFilterData", setPxShape_SimulationFilterData, getPxShape_SimulationFilterData)
, QueryFilterData( "QueryFilterData", setPxShape_QueryFilterData, getPxShape_QueryFilterData)
, Materials( "Materials", getPxShape_Materials, getNbPxShape_Materials )
, ContactOffset( "ContactOffset", setPxShape_ContactOffset, getPxShape_ContactOffset)
, RestOffset( "RestOffset", setPxShape_RestOffset, getPxShape_RestOffset)
, DensityForFluid( "DensityForFluid", setPxShape_DensityForFluid, getPxShape_DensityForFluid)
, TorsionalPatchRadius( "TorsionalPatchRadius", setPxShape_TorsionalPatchRadius, getPxShape_TorsionalPatchRadius)
, MinTorsionalPatchRadius( "MinTorsionalPatchRadius", setPxShape_MinTorsionalPatchRadius, getPxShape_MinTorsionalPatchRadius)
, InternalShapeIndex( "InternalShapeIndex", getPxShape_InternalShapeIndex)
, Flags( "Flags", setPxShape_Flags, getPxShape_Flags)
, IsExclusive( "IsExclusive", getPxShape_IsExclusive)
, Name( "Name", setPxShape_Name, getPxShape_Name)
, ConcreteTypeName( "ConcreteTypeName", getPxShape_ConcreteTypeName)
, UserData( "UserData", setPxShapeUserData, getPxShapeUserData )
{}
PX_PHYSX_CORE_API PxShapeGeneratedValues::PxShapeGeneratedValues( const PxShape* inSource )
:PxRefCountedGeneratedValues( inSource )
,LocalPose( getPxShape_LocalPose( inSource ) )
,SimulationFilterData( getPxShape_SimulationFilterData( inSource ) )
,QueryFilterData( getPxShape_QueryFilterData( inSource ) )
,ContactOffset( getPxShape_ContactOffset( inSource ) )
,RestOffset( getPxShape_RestOffset( inSource ) )
,DensityForFluid( getPxShape_DensityForFluid( inSource ) )
,TorsionalPatchRadius( getPxShape_TorsionalPatchRadius( inSource ) )
,MinTorsionalPatchRadius( getPxShape_MinTorsionalPatchRadius( inSource ) )
,InternalShapeIndex( getPxShape_InternalShapeIndex( inSource ) )
,Flags( getPxShape_Flags( inSource ) )
,IsExclusive( getPxShape_IsExclusive( inSource ) )
,Name( getPxShape_Name( inSource ) )
,ConcreteTypeName( getPxShape_ConcreteTypeName( inSource ) )
,UserData( inSource->userData )
{
PX_UNUSED(inSource);
Geom = PxGeometryHolder(inSource->getGeometry());
}
PxU32 getPxPruningStructure_RigidActors( const PxPruningStructure* inObj, PxRigidActor ** outBuffer, PxU32 inBufSize ) { return inObj->getRigidActors( outBuffer, inBufSize ); }
PxU32 getNbPxPruningStructure_RigidActors( const PxPruningStructure* inObj ) { return inObj->getNbRigidActors( ); }
const void * getPxPruningStructure_StaticMergeData( const PxPruningStructure* inObj ) { return inObj->getStaticMergeData(); }
const void * getPxPruningStructure_DynamicMergeData( const PxPruningStructure* inObj ) { return inObj->getDynamicMergeData(); }
const char * getPxPruningStructure_ConcreteTypeName( const PxPruningStructure* inObj ) { return inObj->getConcreteTypeName(); }
PX_PHYSX_CORE_API PxPruningStructureGeneratedInfo::PxPruningStructureGeneratedInfo()
: RigidActors( "RigidActors", getPxPruningStructure_RigidActors, getNbPxPruningStructure_RigidActors )
, StaticMergeData( "StaticMergeData", getPxPruningStructure_StaticMergeData)
, DynamicMergeData( "DynamicMergeData", getPxPruningStructure_DynamicMergeData)
, ConcreteTypeName( "ConcreteTypeName", getPxPruningStructure_ConcreteTypeName)
{}
PX_PHYSX_CORE_API PxPruningStructureGeneratedValues::PxPruningStructureGeneratedValues( const PxPruningStructure* inSource )
:StaticMergeData( getPxPruningStructure_StaticMergeData( inSource ) )
,DynamicMergeData( getPxPruningStructure_DynamicMergeData( inSource ) )
,ConcreteTypeName( getPxPruningStructure_ConcreteTypeName( inSource ) )
{
PX_UNUSED(inSource);
}
_Bool getPxTolerancesScale_IsValid( const PxTolerancesScale* inObj ) { return inObj->isValid(); }
inline PxReal getPxTolerancesScaleLength( const PxTolerancesScale* inOwner ) { return inOwner->length; }
inline void setPxTolerancesScaleLength( PxTolerancesScale* inOwner, PxReal inData) { inOwner->length = inData; }
inline PxReal getPxTolerancesScaleSpeed( const PxTolerancesScale* inOwner ) { return inOwner->speed; }
inline void setPxTolerancesScaleSpeed( PxTolerancesScale* inOwner, PxReal inData) { inOwner->speed = inData; }
PX_PHYSX_CORE_API PxTolerancesScaleGeneratedInfo::PxTolerancesScaleGeneratedInfo()
: IsValid( "IsValid", getPxTolerancesScale_IsValid)
, Length( "Length", setPxTolerancesScaleLength, getPxTolerancesScaleLength )
, Speed( "Speed", setPxTolerancesScaleSpeed, getPxTolerancesScaleSpeed )
{}
PX_PHYSX_CORE_API PxTolerancesScaleGeneratedValues::PxTolerancesScaleGeneratedValues( const PxTolerancesScale* inSource )
:IsValid( getPxTolerancesScale_IsValid( inSource ) )
,Length( inSource->length )
,Speed( inSource->speed )
{
PX_UNUSED(inSource);
}
PX_PHYSX_CORE_API PxGeometryGeneratedInfo::PxGeometryGeneratedInfo()
{}
PX_PHYSX_CORE_API PxGeometryGeneratedValues::PxGeometryGeneratedValues( const PxGeometry* inSource )
{
PX_UNUSED(inSource);
}
inline PxVec3 getPxBoxGeometryHalfExtents( const PxBoxGeometry* inOwner ) { return inOwner->halfExtents; }
inline void setPxBoxGeometryHalfExtents( PxBoxGeometry* inOwner, PxVec3 inData) { inOwner->halfExtents = inData; }
PX_PHYSX_CORE_API PxBoxGeometryGeneratedInfo::PxBoxGeometryGeneratedInfo()
: HalfExtents( "HalfExtents", setPxBoxGeometryHalfExtents, getPxBoxGeometryHalfExtents )
{}
PX_PHYSX_CORE_API PxBoxGeometryGeneratedValues::PxBoxGeometryGeneratedValues( const PxBoxGeometry* inSource )
:PxGeometryGeneratedValues( inSource )
,HalfExtents( inSource->halfExtents )
{
PX_UNUSED(inSource);
}
inline PxReal getPxCapsuleGeometryRadius( const PxCapsuleGeometry* inOwner ) { return inOwner->radius; }
inline void setPxCapsuleGeometryRadius( PxCapsuleGeometry* inOwner, PxReal inData) { inOwner->radius = inData; }
inline PxReal getPxCapsuleGeometryHalfHeight( const PxCapsuleGeometry* inOwner ) { return inOwner->halfHeight; }
inline void setPxCapsuleGeometryHalfHeight( PxCapsuleGeometry* inOwner, PxReal inData) { inOwner->halfHeight = inData; }
PX_PHYSX_CORE_API PxCapsuleGeometryGeneratedInfo::PxCapsuleGeometryGeneratedInfo()
: Radius( "Radius", setPxCapsuleGeometryRadius, getPxCapsuleGeometryRadius )
, HalfHeight( "HalfHeight", setPxCapsuleGeometryHalfHeight, getPxCapsuleGeometryHalfHeight )
{}
PX_PHYSX_CORE_API PxCapsuleGeometryGeneratedValues::PxCapsuleGeometryGeneratedValues( const PxCapsuleGeometry* inSource )
:PxGeometryGeneratedValues( inSource )
,Radius( inSource->radius )
,HalfHeight( inSource->halfHeight )
{
PX_UNUSED(inSource);
}
inline PxVec3 getPxMeshScaleScale( const PxMeshScale* inOwner ) { return inOwner->scale; }
inline void setPxMeshScaleScale( PxMeshScale* inOwner, PxVec3 inData) { inOwner->scale = inData; }
inline PxQuat getPxMeshScaleRotation( const PxMeshScale* inOwner ) { return inOwner->rotation; }
inline void setPxMeshScaleRotation( PxMeshScale* inOwner, PxQuat inData) { inOwner->rotation = inData; }
PX_PHYSX_CORE_API PxMeshScaleGeneratedInfo::PxMeshScaleGeneratedInfo()
: Scale( "Scale", setPxMeshScaleScale, getPxMeshScaleScale )
, Rotation( "Rotation", setPxMeshScaleRotation, getPxMeshScaleRotation )
{}
PX_PHYSX_CORE_API PxMeshScaleGeneratedValues::PxMeshScaleGeneratedValues( const PxMeshScale* inSource )
:Scale( inSource->scale )
,Rotation( inSource->rotation )
{
PX_UNUSED(inSource);
}
inline PxMeshScale getPxConvexMeshGeometryScale( const PxConvexMeshGeometry* inOwner ) { return inOwner->scale; }
inline void setPxConvexMeshGeometryScale( PxConvexMeshGeometry* inOwner, PxMeshScale inData) { inOwner->scale = inData; }
inline PxConvexMesh * getPxConvexMeshGeometryConvexMesh( const PxConvexMeshGeometry* inOwner ) { return inOwner->convexMesh; }
inline void setPxConvexMeshGeometryConvexMesh( PxConvexMeshGeometry* inOwner, PxConvexMesh * inData) { inOwner->convexMesh = inData; }
inline PxConvexMeshGeometryFlags getPxConvexMeshGeometryMeshFlags( const PxConvexMeshGeometry* inOwner ) { return inOwner->meshFlags; }
inline void setPxConvexMeshGeometryMeshFlags( PxConvexMeshGeometry* inOwner, PxConvexMeshGeometryFlags inData) { inOwner->meshFlags = inData; }
PX_PHYSX_CORE_API PxConvexMeshGeometryGeneratedInfo::PxConvexMeshGeometryGeneratedInfo()
: Scale( "Scale", setPxConvexMeshGeometryScale, getPxConvexMeshGeometryScale )
, ConvexMesh( "ConvexMesh", setPxConvexMeshGeometryConvexMesh, getPxConvexMeshGeometryConvexMesh )
, MeshFlags( "MeshFlags", setPxConvexMeshGeometryMeshFlags, getPxConvexMeshGeometryMeshFlags )
{}
PX_PHYSX_CORE_API PxConvexMeshGeometryGeneratedValues::PxConvexMeshGeometryGeneratedValues( const PxConvexMeshGeometry* inSource )
:PxGeometryGeneratedValues( inSource )
,Scale( inSource->scale )
,ConvexMesh( inSource->convexMesh )
,MeshFlags( inSource->meshFlags )
{
PX_UNUSED(inSource);
}
inline PxReal getPxSphereGeometryRadius( const PxSphereGeometry* inOwner ) { return inOwner->radius; }
inline void setPxSphereGeometryRadius( PxSphereGeometry* inOwner, PxReal inData) { inOwner->radius = inData; }
PX_PHYSX_CORE_API PxSphereGeometryGeneratedInfo::PxSphereGeometryGeneratedInfo()
: Radius( "Radius", setPxSphereGeometryRadius, getPxSphereGeometryRadius )
{}
PX_PHYSX_CORE_API PxSphereGeometryGeneratedValues::PxSphereGeometryGeneratedValues( const PxSphereGeometry* inSource )
:PxGeometryGeneratedValues( inSource )
,Radius( inSource->radius )
{
PX_UNUSED(inSource);
}
PX_PHYSX_CORE_API PxPlaneGeometryGeneratedInfo::PxPlaneGeometryGeneratedInfo()
{}
PX_PHYSX_CORE_API PxPlaneGeometryGeneratedValues::PxPlaneGeometryGeneratedValues( const PxPlaneGeometry* inSource )
:PxGeometryGeneratedValues( inSource )
{
PX_UNUSED(inSource);
}
inline PxMeshScale getPxTriangleMeshGeometryScale( const PxTriangleMeshGeometry* inOwner ) { return inOwner->scale; }
inline void setPxTriangleMeshGeometryScale( PxTriangleMeshGeometry* inOwner, PxMeshScale inData) { inOwner->scale = inData; }
inline PxMeshGeometryFlags getPxTriangleMeshGeometryMeshFlags( const PxTriangleMeshGeometry* inOwner ) { return inOwner->meshFlags; }
inline void setPxTriangleMeshGeometryMeshFlags( PxTriangleMeshGeometry* inOwner, PxMeshGeometryFlags inData) { inOwner->meshFlags = inData; }
inline PxTriangleMesh * getPxTriangleMeshGeometryTriangleMesh( const PxTriangleMeshGeometry* inOwner ) { return inOwner->triangleMesh; }
inline void setPxTriangleMeshGeometryTriangleMesh( PxTriangleMeshGeometry* inOwner, PxTriangleMesh * inData) { inOwner->triangleMesh = inData; }
PX_PHYSX_CORE_API PxTriangleMeshGeometryGeneratedInfo::PxTriangleMeshGeometryGeneratedInfo()
: Scale( "Scale", setPxTriangleMeshGeometryScale, getPxTriangleMeshGeometryScale )
, MeshFlags( "MeshFlags", setPxTriangleMeshGeometryMeshFlags, getPxTriangleMeshGeometryMeshFlags )
, TriangleMesh( "TriangleMesh", setPxTriangleMeshGeometryTriangleMesh, getPxTriangleMeshGeometryTriangleMesh )
{}
PX_PHYSX_CORE_API PxTriangleMeshGeometryGeneratedValues::PxTriangleMeshGeometryGeneratedValues( const PxTriangleMeshGeometry* inSource )
:PxGeometryGeneratedValues( inSource )
,Scale( inSource->scale )
,MeshFlags( inSource->meshFlags )
,TriangleMesh( inSource->triangleMesh )
{
PX_UNUSED(inSource);
}
inline PxHeightField * getPxHeightFieldGeometryHeightField( const PxHeightFieldGeometry* inOwner ) { return inOwner->heightField; }
inline void setPxHeightFieldGeometryHeightField( PxHeightFieldGeometry* inOwner, PxHeightField * inData) { inOwner->heightField = inData; }
inline PxReal getPxHeightFieldGeometryHeightScale( const PxHeightFieldGeometry* inOwner ) { return inOwner->heightScale; }
inline void setPxHeightFieldGeometryHeightScale( PxHeightFieldGeometry* inOwner, PxReal inData) { inOwner->heightScale = inData; }
inline PxReal getPxHeightFieldGeometryRowScale( const PxHeightFieldGeometry* inOwner ) { return inOwner->rowScale; }
inline void setPxHeightFieldGeometryRowScale( PxHeightFieldGeometry* inOwner, PxReal inData) { inOwner->rowScale = inData; }
inline PxReal getPxHeightFieldGeometryColumnScale( const PxHeightFieldGeometry* inOwner ) { return inOwner->columnScale; }
inline void setPxHeightFieldGeometryColumnScale( PxHeightFieldGeometry* inOwner, PxReal inData) { inOwner->columnScale = inData; }
inline PxMeshGeometryFlags getPxHeightFieldGeometryHeightFieldFlags( const PxHeightFieldGeometry* inOwner ) { return inOwner->heightFieldFlags; }
inline void setPxHeightFieldGeometryHeightFieldFlags( PxHeightFieldGeometry* inOwner, PxMeshGeometryFlags inData) { inOwner->heightFieldFlags = inData; }
PX_PHYSX_CORE_API PxHeightFieldGeometryGeneratedInfo::PxHeightFieldGeometryGeneratedInfo()
: HeightField( "HeightField", setPxHeightFieldGeometryHeightField, getPxHeightFieldGeometryHeightField )
, HeightScale( "HeightScale", setPxHeightFieldGeometryHeightScale, getPxHeightFieldGeometryHeightScale )
, RowScale( "RowScale", setPxHeightFieldGeometryRowScale, getPxHeightFieldGeometryRowScale )
, ColumnScale( "ColumnScale", setPxHeightFieldGeometryColumnScale, getPxHeightFieldGeometryColumnScale )
, HeightFieldFlags( "HeightFieldFlags", setPxHeightFieldGeometryHeightFieldFlags, getPxHeightFieldGeometryHeightFieldFlags )
{}
PX_PHYSX_CORE_API PxHeightFieldGeometryGeneratedValues::PxHeightFieldGeometryGeneratedValues( const PxHeightFieldGeometry* inSource )
:PxGeometryGeneratedValues( inSource )
,HeightField( inSource->heightField )
,HeightScale( inSource->heightScale )
,RowScale( inSource->rowScale )
,ColumnScale( inSource->columnScale )
,HeightFieldFlags( inSource->heightFieldFlags )
{
PX_UNUSED(inSource);
}
void setPxSceneQuerySystemBase_DynamicTreeRebuildRateHint( PxSceneQuerySystemBase* inObj, PxU32 inArg){ inObj->setDynamicTreeRebuildRateHint( inArg ); }
PxU32 getPxSceneQuerySystemBase_DynamicTreeRebuildRateHint( const PxSceneQuerySystemBase* inObj ) { return inObj->getDynamicTreeRebuildRateHint(); }
void setPxSceneQuerySystemBase_UpdateMode( PxSceneQuerySystemBase* inObj, PxSceneQueryUpdateMode::Enum inArg){ inObj->setUpdateMode( inArg ); }
PxSceneQueryUpdateMode::Enum getPxSceneQuerySystemBase_UpdateMode( const PxSceneQuerySystemBase* inObj ) { return inObj->getUpdateMode(); }
PxU32 getPxSceneQuerySystemBase_StaticTimestamp( const PxSceneQuerySystemBase* inObj ) { return inObj->getStaticTimestamp(); }
PX_PHYSX_CORE_API PxSceneQuerySystemBaseGeneratedInfo::PxSceneQuerySystemBaseGeneratedInfo()
: DynamicTreeRebuildRateHint( "DynamicTreeRebuildRateHint", setPxSceneQuerySystemBase_DynamicTreeRebuildRateHint, getPxSceneQuerySystemBase_DynamicTreeRebuildRateHint)
, UpdateMode( "UpdateMode", setPxSceneQuerySystemBase_UpdateMode, getPxSceneQuerySystemBase_UpdateMode)
, StaticTimestamp( "StaticTimestamp", getPxSceneQuerySystemBase_StaticTimestamp)
{}
PX_PHYSX_CORE_API PxSceneQuerySystemBaseGeneratedValues::PxSceneQuerySystemBaseGeneratedValues( const PxSceneQuerySystemBase* inSource )
:DynamicTreeRebuildRateHint( getPxSceneQuerySystemBase_DynamicTreeRebuildRateHint( inSource ) )
,UpdateMode( getPxSceneQuerySystemBase_UpdateMode( inSource ) )
,StaticTimestamp( getPxSceneQuerySystemBase_StaticTimestamp( inSource ) )
{
PX_UNUSED(inSource);
}
void setPxSceneSQSystem_SceneQueryUpdateMode( PxSceneSQSystem* inObj, PxSceneQueryUpdateMode::Enum inArg){ inObj->setSceneQueryUpdateMode( inArg ); }
PxSceneQueryUpdateMode::Enum getPxSceneSQSystem_SceneQueryUpdateMode( const PxSceneSQSystem* inObj ) { return inObj->getSceneQueryUpdateMode(); }
PxU32 getPxSceneSQSystem_SceneQueryStaticTimestamp( const PxSceneSQSystem* inObj ) { return inObj->getSceneQueryStaticTimestamp(); }
PxPruningStructureType::Enum getPxSceneSQSystem_StaticStructure( const PxSceneSQSystem* inObj ) { return inObj->getStaticStructure(); }
PxPruningStructureType::Enum getPxSceneSQSystem_DynamicStructure( const PxSceneSQSystem* inObj ) { return inObj->getDynamicStructure(); }
PX_PHYSX_CORE_API PxSceneSQSystemGeneratedInfo::PxSceneSQSystemGeneratedInfo()
: SceneQueryUpdateMode( "SceneQueryUpdateMode", setPxSceneSQSystem_SceneQueryUpdateMode, getPxSceneSQSystem_SceneQueryUpdateMode)
, SceneQueryStaticTimestamp( "SceneQueryStaticTimestamp", getPxSceneSQSystem_SceneQueryStaticTimestamp)
, StaticStructure( "StaticStructure", getPxSceneSQSystem_StaticStructure)
, DynamicStructure( "DynamicStructure", getPxSceneSQSystem_DynamicStructure)
{}
PX_PHYSX_CORE_API PxSceneSQSystemGeneratedValues::PxSceneSQSystemGeneratedValues( const PxSceneSQSystem* inSource )
:PxSceneQuerySystemBaseGeneratedValues( inSource )
,SceneQueryUpdateMode( getPxSceneSQSystem_SceneQueryUpdateMode( inSource ) )
,SceneQueryStaticTimestamp( getPxSceneSQSystem_SceneQueryStaticTimestamp( inSource ) )
,StaticStructure( getPxSceneSQSystem_StaticStructure( inSource ) )
,DynamicStructure( getPxSceneSQSystem_DynamicStructure( inSource ) )
{
PX_UNUSED(inSource);
}
PxSceneFlags getPxScene_Flags( const PxScene* inObj ) { return inObj->getFlags(); }
void setPxScene_Limits( PxScene* inObj, const PxSceneLimits & inArg){ inObj->setLimits( inArg ); }
PxSceneLimits getPxScene_Limits( const PxScene* inObj ) { return inObj->getLimits(); }
PxU32 getPxScene_Timestamp( const PxScene* inObj ) { return inObj->getTimestamp(); }
void setPxScene_Name( PxScene* inObj, const char * inArg){ inObj->setName( inArg ); }
const char * getPxScene_Name( const PxScene* inObj ) { return inObj->getName(); }
PxU32 getPxScene_Actors( const PxScene* inObj, PxActorTypeFlags inFilter, PxActor ** outBuffer, PxU32 inBufSize ) { return inObj->getActors( inFilter, outBuffer, inBufSize ); }
PxU32 getNbPxScene_Actors( const PxScene* inObj, PxActorTypeFlags inFilter ) { return inObj->getNbActors( inFilter ); }
PxU32 getPxScene_SoftBodies( const PxScene* inObj, PxSoftBody ** outBuffer, PxU32 inBufSize ) { return inObj->getSoftBodies( outBuffer, inBufSize ); }
PxU32 getNbPxScene_SoftBodies( const PxScene* inObj ) { return inObj->getNbSoftBodies( ); }
PxU32 getPxScene_Articulations( const PxScene* inObj, PxArticulationReducedCoordinate ** outBuffer, PxU32 inBufSize ) { return inObj->getArticulations( outBuffer, inBufSize ); }
PxU32 getNbPxScene_Articulations( const PxScene* inObj ) { return inObj->getNbArticulations( ); }
PxU32 getPxScene_Constraints( const PxScene* inObj, PxConstraint ** outBuffer, PxU32 inBufSize ) { return inObj->getConstraints( outBuffer, inBufSize ); }
PxU32 getNbPxScene_Constraints( const PxScene* inObj ) { return inObj->getNbConstraints( ); }
PxU32 getPxScene_Aggregates( const PxScene* inObj, PxAggregate ** outBuffer, PxU32 inBufSize ) { return inObj->getAggregates( outBuffer, inBufSize ); }
PxU32 getNbPxScene_Aggregates( const PxScene* inObj ) { return inObj->getNbAggregates( ); }
PxCpuDispatcher * getPxScene_CpuDispatcher( const PxScene* inObj ) { return inObj->getCpuDispatcher(); }
PxCudaContextManager * getPxScene_CudaContextManager( const PxScene* inObj ) { return inObj->getCudaContextManager(); }
void setPxScene_SimulationEventCallback( PxScene* inObj, PxSimulationEventCallback * inArg){ inObj->setSimulationEventCallback( inArg ); }
PxSimulationEventCallback * getPxScene_SimulationEventCallback( const PxScene* inObj ) { return inObj->getSimulationEventCallback(); }
void setPxScene_ContactModifyCallback( PxScene* inObj, PxContactModifyCallback * inArg){ inObj->setContactModifyCallback( inArg ); }
PxContactModifyCallback * getPxScene_ContactModifyCallback( const PxScene* inObj ) { return inObj->getContactModifyCallback(); }
void setPxScene_CCDContactModifyCallback( PxScene* inObj, PxCCDContactModifyCallback * inArg){ inObj->setCCDContactModifyCallback( inArg ); }
PxCCDContactModifyCallback * getPxScene_CCDContactModifyCallback( const PxScene* inObj ) { return inObj->getCCDContactModifyCallback(); }
void setPxScene_BroadPhaseCallback( PxScene* inObj, PxBroadPhaseCallback * inArg){ inObj->setBroadPhaseCallback( inArg ); }
PxBroadPhaseCallback * getPxScene_BroadPhaseCallback( const PxScene* inObj ) { return inObj->getBroadPhaseCallback(); }
PxU32 getPxScene_FilterShaderDataSize( const PxScene* inObj ) { return inObj->getFilterShaderDataSize(); }
PxSimulationFilterShader getPxScene_FilterShader( const PxScene* inObj ) { return inObj->getFilterShader(); }
PxSimulationFilterCallback * getPxScene_FilterCallback( const PxScene* inObj ) { return inObj->getFilterCallback(); }
PxPairFilteringMode::Enum getPxScene_KinematicKinematicFilteringMode( const PxScene* inObj ) { return inObj->getKinematicKinematicFilteringMode(); }
PxPairFilteringMode::Enum getPxScene_StaticKinematicFilteringMode( const PxScene* inObj ) { return inObj->getStaticKinematicFilteringMode(); }
void setPxScene_Gravity( PxScene* inObj, const PxVec3 & inArg){ inObj->setGravity( inArg ); }
PxVec3 getPxScene_Gravity( const PxScene* inObj ) { return inObj->getGravity(); }
void setPxScene_BounceThresholdVelocity( PxScene* inObj, const PxReal inArg){ inObj->setBounceThresholdVelocity( inArg ); }
PxReal getPxScene_BounceThresholdVelocity( const PxScene* inObj ) { return inObj->getBounceThresholdVelocity(); }
void setPxScene_CCDMaxPasses( PxScene* inObj, PxU32 inArg){ inObj->setCCDMaxPasses( inArg ); }
PxU32 getPxScene_CCDMaxPasses( const PxScene* inObj ) { return inObj->getCCDMaxPasses(); }
void setPxScene_CCDMaxSeparation( PxScene* inObj, const PxReal inArg){ inObj->setCCDMaxSeparation( inArg ); }
PxReal getPxScene_CCDMaxSeparation( const PxScene* inObj ) { return inObj->getCCDMaxSeparation(); }
void setPxScene_CCDThreshold( PxScene* inObj, const PxReal inArg){ inObj->setCCDThreshold( inArg ); }
PxReal getPxScene_CCDThreshold( const PxScene* inObj ) { return inObj->getCCDThreshold(); }
void setPxScene_MaxBiasCoefficient( PxScene* inObj, const PxReal inArg){ inObj->setMaxBiasCoefficient( inArg ); }
PxReal getPxScene_MaxBiasCoefficient( const PxScene* inObj ) { return inObj->getMaxBiasCoefficient(); }
void setPxScene_FrictionOffsetThreshold( PxScene* inObj, const PxReal inArg){ inObj->setFrictionOffsetThreshold( inArg ); }
PxReal getPxScene_FrictionOffsetThreshold( const PxScene* inObj ) { return inObj->getFrictionOffsetThreshold(); }
void setPxScene_FrictionCorrelationDistance( PxScene* inObj, const PxReal inArg){ inObj->setFrictionCorrelationDistance( inArg ); }
PxReal getPxScene_FrictionCorrelationDistance( const PxScene* inObj ) { return inObj->getFrictionCorrelationDistance(); }
PxFrictionType::Enum getPxScene_FrictionType( const PxScene* inObj ) { return inObj->getFrictionType(); }
PxSolverType::Enum getPxScene_SolverType( const PxScene* inObj ) { return inObj->getSolverType(); }
void setPxScene_VisualizationCullingBox( PxScene* inObj, const PxBounds3 & inArg){ inObj->setVisualizationCullingBox( inArg ); }
PxBounds3 getPxScene_VisualizationCullingBox( const PxScene* inObj ) { return inObj->getVisualizationCullingBox(); }
PxBroadPhaseType::Enum getPxScene_BroadPhaseType( const PxScene* inObj ) { return inObj->getBroadPhaseType(); }
PxU32 getPxScene_BroadPhaseRegions( const PxScene* inObj, PxBroadPhaseRegionInfo* outBuffer, PxU32 inBufSize ) { return inObj->getBroadPhaseRegions( outBuffer, inBufSize ); }
PxU32 getNbPxScene_BroadPhaseRegions( const PxScene* inObj ) { return inObj->getNbBroadPhaseRegions( ); }
PxTaskManager * getPxScene_TaskManager( const PxScene* inObj ) { return inObj->getTaskManager(); }
void setPxScene_NbContactDataBlocks( PxScene* inObj, PxU32 inArg){ inObj->setNbContactDataBlocks( inArg ); }
PxU32 getPxScene_MaxNbContactDataBlocksUsed( const PxScene* inObj ) { return inObj->getMaxNbContactDataBlocksUsed(); }
PxU32 getPxScene_ContactReportStreamBufferSize( const PxScene* inObj ) { return inObj->getContactReportStreamBufferSize(); }
void setPxScene_SolverBatchSize( PxScene* inObj, PxU32 inArg){ inObj->setSolverBatchSize( inArg ); }
PxU32 getPxScene_SolverBatchSize( const PxScene* inObj ) { return inObj->getSolverBatchSize(); }
void setPxScene_SolverArticulationBatchSize( PxScene* inObj, PxU32 inArg){ inObj->setSolverArticulationBatchSize( inArg ); }
PxU32 getPxScene_SolverArticulationBatchSize( const PxScene* inObj ) { return inObj->getSolverArticulationBatchSize(); }
PxReal getPxScene_WakeCounterResetValue( const PxScene* inObj ) { return inObj->getWakeCounterResetValue(); }
PxgDynamicsMemoryConfig getPxScene_GpuDynamicsConfig( const PxScene* inObj ) { return inObj->getGpuDynamicsConfig(); }
inline void * getPxSceneUserData( const PxScene* inOwner ) { return inOwner->userData; }
inline void setPxSceneUserData( PxScene* inOwner, void * inData) { inOwner->userData = inData; }
PX_PHYSX_CORE_API PxSceneGeneratedInfo::PxSceneGeneratedInfo()
: Flags( "Flags", getPxScene_Flags)
, Limits( "Limits", setPxScene_Limits, getPxScene_Limits)
, Timestamp( "Timestamp", getPxScene_Timestamp)
, Name( "Name", setPxScene_Name, getPxScene_Name)
, Actors( "Actors", getPxScene_Actors, getNbPxScene_Actors )
, SoftBodies( "SoftBodies", getPxScene_SoftBodies, getNbPxScene_SoftBodies )
, Articulations( "Articulations", getPxScene_Articulations, getNbPxScene_Articulations )
, Constraints( "Constraints", getPxScene_Constraints, getNbPxScene_Constraints )
, Aggregates( "Aggregates", getPxScene_Aggregates, getNbPxScene_Aggregates )
, CpuDispatcher( "CpuDispatcher", getPxScene_CpuDispatcher)
, CudaContextManager( "CudaContextManager", getPxScene_CudaContextManager)
, SimulationEventCallback( "SimulationEventCallback", setPxScene_SimulationEventCallback, getPxScene_SimulationEventCallback)
, ContactModifyCallback( "ContactModifyCallback", setPxScene_ContactModifyCallback, getPxScene_ContactModifyCallback)
, CCDContactModifyCallback( "CCDContactModifyCallback", setPxScene_CCDContactModifyCallback, getPxScene_CCDContactModifyCallback)
, BroadPhaseCallback( "BroadPhaseCallback", setPxScene_BroadPhaseCallback, getPxScene_BroadPhaseCallback)
, FilterShaderDataSize( "FilterShaderDataSize", getPxScene_FilterShaderDataSize)
, FilterShader( "FilterShader", getPxScene_FilterShader)
, FilterCallback( "FilterCallback", getPxScene_FilterCallback)
, KinematicKinematicFilteringMode( "KinematicKinematicFilteringMode", getPxScene_KinematicKinematicFilteringMode)
, StaticKinematicFilteringMode( "StaticKinematicFilteringMode", getPxScene_StaticKinematicFilteringMode)
, Gravity( "Gravity", setPxScene_Gravity, getPxScene_Gravity)
, BounceThresholdVelocity( "BounceThresholdVelocity", setPxScene_BounceThresholdVelocity, getPxScene_BounceThresholdVelocity)
, CCDMaxPasses( "CCDMaxPasses", setPxScene_CCDMaxPasses, getPxScene_CCDMaxPasses)
, CCDMaxSeparation( "CCDMaxSeparation", setPxScene_CCDMaxSeparation, getPxScene_CCDMaxSeparation)
, CCDThreshold( "CCDThreshold", setPxScene_CCDThreshold, getPxScene_CCDThreshold)
, MaxBiasCoefficient( "MaxBiasCoefficient", setPxScene_MaxBiasCoefficient, getPxScene_MaxBiasCoefficient)
, FrictionOffsetThreshold( "FrictionOffsetThreshold", setPxScene_FrictionOffsetThreshold, getPxScene_FrictionOffsetThreshold)
, FrictionCorrelationDistance( "FrictionCorrelationDistance", setPxScene_FrictionCorrelationDistance, getPxScene_FrictionCorrelationDistance)
, FrictionType( "FrictionType", getPxScene_FrictionType)
, SolverType( "SolverType", getPxScene_SolverType)
, VisualizationCullingBox( "VisualizationCullingBox", setPxScene_VisualizationCullingBox, getPxScene_VisualizationCullingBox)
, BroadPhaseType( "BroadPhaseType", getPxScene_BroadPhaseType)
, BroadPhaseRegions( "BroadPhaseRegions", getPxScene_BroadPhaseRegions, getNbPxScene_BroadPhaseRegions )
, TaskManager( "TaskManager", getPxScene_TaskManager)
, NbContactDataBlocks( "NbContactDataBlocks", setPxScene_NbContactDataBlocks)
, MaxNbContactDataBlocksUsed( "MaxNbContactDataBlocksUsed", getPxScene_MaxNbContactDataBlocksUsed)
, ContactReportStreamBufferSize( "ContactReportStreamBufferSize", getPxScene_ContactReportStreamBufferSize)
, SolverBatchSize( "SolverBatchSize", setPxScene_SolverBatchSize, getPxScene_SolverBatchSize)
, SolverArticulationBatchSize( "SolverArticulationBatchSize", setPxScene_SolverArticulationBatchSize, getPxScene_SolverArticulationBatchSize)
, WakeCounterResetValue( "WakeCounterResetValue", getPxScene_WakeCounterResetValue)
, GpuDynamicsConfig( "GpuDynamicsConfig", getPxScene_GpuDynamicsConfig)
, UserData( "UserData", setPxSceneUserData, getPxSceneUserData )
{}
PX_PHYSX_CORE_API PxSceneGeneratedValues::PxSceneGeneratedValues( const PxScene* inSource )
:PxSceneSQSystemGeneratedValues( inSource )
,Flags( getPxScene_Flags( inSource ) )
,Limits( getPxScene_Limits( inSource ) )
,Timestamp( getPxScene_Timestamp( inSource ) )
,Name( getPxScene_Name( inSource ) )
,CpuDispatcher( getPxScene_CpuDispatcher( inSource ) )
,CudaContextManager( getPxScene_CudaContextManager( inSource ) )
,SimulationEventCallback( getPxScene_SimulationEventCallback( inSource ) )
,ContactModifyCallback( getPxScene_ContactModifyCallback( inSource ) )
,CCDContactModifyCallback( getPxScene_CCDContactModifyCallback( inSource ) )
,BroadPhaseCallback( getPxScene_BroadPhaseCallback( inSource ) )
,FilterShaderDataSize( getPxScene_FilterShaderDataSize( inSource ) )
,FilterShader( getPxScene_FilterShader( inSource ) )
,FilterCallback( getPxScene_FilterCallback( inSource ) )
,KinematicKinematicFilteringMode( getPxScene_KinematicKinematicFilteringMode( inSource ) )
,StaticKinematicFilteringMode( getPxScene_StaticKinematicFilteringMode( inSource ) )
,Gravity( getPxScene_Gravity( inSource ) )
,BounceThresholdVelocity( getPxScene_BounceThresholdVelocity( inSource ) )
,CCDMaxPasses( getPxScene_CCDMaxPasses( inSource ) )
,CCDMaxSeparation( getPxScene_CCDMaxSeparation( inSource ) )
,CCDThreshold( getPxScene_CCDThreshold( inSource ) )
,MaxBiasCoefficient( getPxScene_MaxBiasCoefficient( inSource ) )
,FrictionOffsetThreshold( getPxScene_FrictionOffsetThreshold( inSource ) )
,FrictionCorrelationDistance( getPxScene_FrictionCorrelationDistance( inSource ) )
,FrictionType( getPxScene_FrictionType( inSource ) )
,SolverType( getPxScene_SolverType( inSource ) )
,VisualizationCullingBox( getPxScene_VisualizationCullingBox( inSource ) )
,BroadPhaseType( getPxScene_BroadPhaseType( inSource ) )
,TaskManager( getPxScene_TaskManager( inSource ) )
,MaxNbContactDataBlocksUsed( getPxScene_MaxNbContactDataBlocksUsed( inSource ) )
,ContactReportStreamBufferSize( getPxScene_ContactReportStreamBufferSize( inSource ) )
,SolverBatchSize( getPxScene_SolverBatchSize( inSource ) )
,SolverArticulationBatchSize( getPxScene_SolverArticulationBatchSize( inSource ) )
,WakeCounterResetValue( getPxScene_WakeCounterResetValue( inSource ) )
,GpuDynamicsConfig( getPxScene_GpuDynamicsConfig( inSource ) )
,UserData( inSource->userData )
{
PX_UNUSED(inSource);
inSource->getSimulationStatistics(SimulationStatistics);
}
inline PxTetrahedronMesh * getPxTetrahedronMeshGeometryTetrahedronMesh( const PxTetrahedronMeshGeometry* inOwner ) { return inOwner->tetrahedronMesh; }
inline void setPxTetrahedronMeshGeometryTetrahedronMesh( PxTetrahedronMeshGeometry* inOwner, PxTetrahedronMesh * inData) { inOwner->tetrahedronMesh = inData; }
PX_PHYSX_CORE_API PxTetrahedronMeshGeometryGeneratedInfo::PxTetrahedronMeshGeometryGeneratedInfo()
: TetrahedronMesh( "TetrahedronMesh", setPxTetrahedronMeshGeometryTetrahedronMesh, getPxTetrahedronMeshGeometryTetrahedronMesh )
{}
PX_PHYSX_CORE_API PxTetrahedronMeshGeometryGeneratedValues::PxTetrahedronMeshGeometryGeneratedValues( const PxTetrahedronMeshGeometry* inSource )
:PxGeometryGeneratedValues( inSource )
,TetrahedronMesh( inSource->tetrahedronMesh )
{
PX_UNUSED(inSource);
}
PX_PHYSX_CORE_API PxCustomGeometryGeneratedInfo::PxCustomGeometryGeneratedInfo()
{}
PX_PHYSX_CORE_API PxCustomGeometryGeneratedValues::PxCustomGeometryGeneratedValues( const PxCustomGeometry* inSource )
:PxGeometryGeneratedValues( inSource )
{
PX_UNUSED(inSource);
PxCustomGeometry::Type t = inSource->callbacks->getCustomType(); CustomType = *reinterpret_cast<const PxU32*>(&t);
}
inline PxU32 getPxHeightFieldDescNbRows( const PxHeightFieldDesc* inOwner ) { return inOwner->nbRows; }
inline void setPxHeightFieldDescNbRows( PxHeightFieldDesc* inOwner, PxU32 inData) { inOwner->nbRows = inData; }
inline PxU32 getPxHeightFieldDescNbColumns( const PxHeightFieldDesc* inOwner ) { return inOwner->nbColumns; }
inline void setPxHeightFieldDescNbColumns( PxHeightFieldDesc* inOwner, PxU32 inData) { inOwner->nbColumns = inData; }
inline PxHeightFieldFormat::Enum getPxHeightFieldDescFormat( const PxHeightFieldDesc* inOwner ) { return inOwner->format; }
inline void setPxHeightFieldDescFormat( PxHeightFieldDesc* inOwner, PxHeightFieldFormat::Enum inData) { inOwner->format = inData; }
inline PxStridedData getPxHeightFieldDescSamples( const PxHeightFieldDesc* inOwner ) { return inOwner->samples; }
inline void setPxHeightFieldDescSamples( PxHeightFieldDesc* inOwner, PxStridedData inData) { inOwner->samples = inData; }
inline PxReal getPxHeightFieldDescConvexEdgeThreshold( const PxHeightFieldDesc* inOwner ) { return inOwner->convexEdgeThreshold; }
inline void setPxHeightFieldDescConvexEdgeThreshold( PxHeightFieldDesc* inOwner, PxReal inData) { inOwner->convexEdgeThreshold = inData; }
inline PxHeightFieldFlags getPxHeightFieldDescFlags( const PxHeightFieldDesc* inOwner ) { return inOwner->flags; }
inline void setPxHeightFieldDescFlags( PxHeightFieldDesc* inOwner, PxHeightFieldFlags inData) { inOwner->flags = inData; }
PX_PHYSX_CORE_API PxHeightFieldDescGeneratedInfo::PxHeightFieldDescGeneratedInfo()
: NbRows( "NbRows", setPxHeightFieldDescNbRows, getPxHeightFieldDescNbRows )
, NbColumns( "NbColumns", setPxHeightFieldDescNbColumns, getPxHeightFieldDescNbColumns )
, Format( "Format", setPxHeightFieldDescFormat, getPxHeightFieldDescFormat )
, Samples( "Samples", setPxHeightFieldDescSamples, getPxHeightFieldDescSamples )
, ConvexEdgeThreshold( "ConvexEdgeThreshold", setPxHeightFieldDescConvexEdgeThreshold, getPxHeightFieldDescConvexEdgeThreshold )
, Flags( "Flags", setPxHeightFieldDescFlags, getPxHeightFieldDescFlags )
{}
PX_PHYSX_CORE_API PxHeightFieldDescGeneratedValues::PxHeightFieldDescGeneratedValues( const PxHeightFieldDesc* inSource )
:NbRows( inSource->nbRows )
,NbColumns( inSource->nbColumns )
,Format( inSource->format )
,Samples( inSource->samples )
,ConvexEdgeThreshold( inSource->convexEdgeThreshold )
,Flags( inSource->flags )
{
PX_UNUSED(inSource);
}
inline PxReal getPxArticulationLimitLow( const PxArticulationLimit* inOwner ) { return inOwner->low; }
inline void setPxArticulationLimitLow( PxArticulationLimit* inOwner, PxReal inData) { inOwner->low = inData; }
inline PxReal getPxArticulationLimitHigh( const PxArticulationLimit* inOwner ) { return inOwner->high; }
inline void setPxArticulationLimitHigh( PxArticulationLimit* inOwner, PxReal inData) { inOwner->high = inData; }
PX_PHYSX_CORE_API PxArticulationLimitGeneratedInfo::PxArticulationLimitGeneratedInfo()
: Low( "Low", setPxArticulationLimitLow, getPxArticulationLimitLow )
, High( "High", setPxArticulationLimitHigh, getPxArticulationLimitHigh )
{}
PX_PHYSX_CORE_API PxArticulationLimitGeneratedValues::PxArticulationLimitGeneratedValues( const PxArticulationLimit* inSource )
:Low( inSource->low )
,High( inSource->high )
{
PX_UNUSED(inSource);
}
inline PxReal getPxArticulationDriveStiffness( const PxArticulationDrive* inOwner ) { return inOwner->stiffness; }
inline void setPxArticulationDriveStiffness( PxArticulationDrive* inOwner, PxReal inData) { inOwner->stiffness = inData; }
inline PxReal getPxArticulationDriveDamping( const PxArticulationDrive* inOwner ) { return inOwner->damping; }
inline void setPxArticulationDriveDamping( PxArticulationDrive* inOwner, PxReal inData) { inOwner->damping = inData; }
inline PxReal getPxArticulationDriveMaxForce( const PxArticulationDrive* inOwner ) { return inOwner->maxForce; }
inline void setPxArticulationDriveMaxForce( PxArticulationDrive* inOwner, PxReal inData) { inOwner->maxForce = inData; }
inline PxArticulationDriveType::Enum getPxArticulationDriveDriveType( const PxArticulationDrive* inOwner ) { return inOwner->driveType; }
inline void setPxArticulationDriveDriveType( PxArticulationDrive* inOwner, PxArticulationDriveType::Enum inData) { inOwner->driveType = inData; }
PX_PHYSX_CORE_API PxArticulationDriveGeneratedInfo::PxArticulationDriveGeneratedInfo()
: Stiffness( "Stiffness", setPxArticulationDriveStiffness, getPxArticulationDriveStiffness )
, Damping( "Damping", setPxArticulationDriveDamping, getPxArticulationDriveDamping )
, MaxForce( "MaxForce", setPxArticulationDriveMaxForce, getPxArticulationDriveMaxForce )
, DriveType( "DriveType", setPxArticulationDriveDriveType, getPxArticulationDriveDriveType )
{}
PX_PHYSX_CORE_API PxArticulationDriveGeneratedValues::PxArticulationDriveGeneratedValues( const PxArticulationDrive* inSource )
:Stiffness( inSource->stiffness )
,Damping( inSource->damping )
,MaxForce( inSource->maxForce )
,DriveType( inSource->driveType )
{
PX_UNUSED(inSource);
}
_Bool getPxSceneQueryDesc_IsValid( const PxSceneQueryDesc* inObj ) { return inObj->isValid(); }
inline PxPruningStructureType::Enum getPxSceneQueryDescStaticStructure( const PxSceneQueryDesc* inOwner ) { return inOwner->staticStructure; }
inline void setPxSceneQueryDescStaticStructure( PxSceneQueryDesc* inOwner, PxPruningStructureType::Enum inData) { inOwner->staticStructure = inData; }
inline PxPruningStructureType::Enum getPxSceneQueryDescDynamicStructure( const PxSceneQueryDesc* inOwner ) { return inOwner->dynamicStructure; }
inline void setPxSceneQueryDescDynamicStructure( PxSceneQueryDesc* inOwner, PxPruningStructureType::Enum inData) { inOwner->dynamicStructure = inData; }
inline PxU32 getPxSceneQueryDescDynamicTreeRebuildRateHint( const PxSceneQueryDesc* inOwner ) { return inOwner->dynamicTreeRebuildRateHint; }
inline void setPxSceneQueryDescDynamicTreeRebuildRateHint( PxSceneQueryDesc* inOwner, PxU32 inData) { inOwner->dynamicTreeRebuildRateHint = inData; }
inline PxDynamicTreeSecondaryPruner::Enum getPxSceneQueryDescDynamicTreeSecondaryPruner( const PxSceneQueryDesc* inOwner ) { return inOwner->dynamicTreeSecondaryPruner; }
inline void setPxSceneQueryDescDynamicTreeSecondaryPruner( PxSceneQueryDesc* inOwner, PxDynamicTreeSecondaryPruner::Enum inData) { inOwner->dynamicTreeSecondaryPruner = inData; }
inline PxBVHBuildStrategy::Enum getPxSceneQueryDescStaticBVHBuildStrategy( const PxSceneQueryDesc* inOwner ) { return inOwner->staticBVHBuildStrategy; }
inline void setPxSceneQueryDescStaticBVHBuildStrategy( PxSceneQueryDesc* inOwner, PxBVHBuildStrategy::Enum inData) { inOwner->staticBVHBuildStrategy = inData; }
inline PxBVHBuildStrategy::Enum getPxSceneQueryDescDynamicBVHBuildStrategy( const PxSceneQueryDesc* inOwner ) { return inOwner->dynamicBVHBuildStrategy; }
inline void setPxSceneQueryDescDynamicBVHBuildStrategy( PxSceneQueryDesc* inOwner, PxBVHBuildStrategy::Enum inData) { inOwner->dynamicBVHBuildStrategy = inData; }
inline PxU32 getPxSceneQueryDescStaticNbObjectsPerNode( const PxSceneQueryDesc* inOwner ) { return inOwner->staticNbObjectsPerNode; }
inline void setPxSceneQueryDescStaticNbObjectsPerNode( PxSceneQueryDesc* inOwner, PxU32 inData) { inOwner->staticNbObjectsPerNode = inData; }
inline PxU32 getPxSceneQueryDescDynamicNbObjectsPerNode( const PxSceneQueryDesc* inOwner ) { return inOwner->dynamicNbObjectsPerNode; }
inline void setPxSceneQueryDescDynamicNbObjectsPerNode( PxSceneQueryDesc* inOwner, PxU32 inData) { inOwner->dynamicNbObjectsPerNode = inData; }
inline PxSceneQueryUpdateMode::Enum getPxSceneQueryDescSceneQueryUpdateMode( const PxSceneQueryDesc* inOwner ) { return inOwner->sceneQueryUpdateMode; }
inline void setPxSceneQueryDescSceneQueryUpdateMode( PxSceneQueryDesc* inOwner, PxSceneQueryUpdateMode::Enum inData) { inOwner->sceneQueryUpdateMode = inData; }
PX_PHYSX_CORE_API PxSceneQueryDescGeneratedInfo::PxSceneQueryDescGeneratedInfo()
: IsValid( "IsValid", getPxSceneQueryDesc_IsValid)
, StaticStructure( "StaticStructure", setPxSceneQueryDescStaticStructure, getPxSceneQueryDescStaticStructure )
, DynamicStructure( "DynamicStructure", setPxSceneQueryDescDynamicStructure, getPxSceneQueryDescDynamicStructure )
, DynamicTreeRebuildRateHint( "DynamicTreeRebuildRateHint", setPxSceneQueryDescDynamicTreeRebuildRateHint, getPxSceneQueryDescDynamicTreeRebuildRateHint )
, DynamicTreeSecondaryPruner( "DynamicTreeSecondaryPruner", setPxSceneQueryDescDynamicTreeSecondaryPruner, getPxSceneQueryDescDynamicTreeSecondaryPruner )
, StaticBVHBuildStrategy( "StaticBVHBuildStrategy", setPxSceneQueryDescStaticBVHBuildStrategy, getPxSceneQueryDescStaticBVHBuildStrategy )
, DynamicBVHBuildStrategy( "DynamicBVHBuildStrategy", setPxSceneQueryDescDynamicBVHBuildStrategy, getPxSceneQueryDescDynamicBVHBuildStrategy )
, StaticNbObjectsPerNode( "StaticNbObjectsPerNode", setPxSceneQueryDescStaticNbObjectsPerNode, getPxSceneQueryDescStaticNbObjectsPerNode )
, DynamicNbObjectsPerNode( "DynamicNbObjectsPerNode", setPxSceneQueryDescDynamicNbObjectsPerNode, getPxSceneQueryDescDynamicNbObjectsPerNode )
, SceneQueryUpdateMode( "SceneQueryUpdateMode", setPxSceneQueryDescSceneQueryUpdateMode, getPxSceneQueryDescSceneQueryUpdateMode )
{}
PX_PHYSX_CORE_API PxSceneQueryDescGeneratedValues::PxSceneQueryDescGeneratedValues( const PxSceneQueryDesc* inSource )
:IsValid( getPxSceneQueryDesc_IsValid( inSource ) )
,StaticStructure( inSource->staticStructure )
,DynamicStructure( inSource->dynamicStructure )
,DynamicTreeRebuildRateHint( inSource->dynamicTreeRebuildRateHint )
,DynamicTreeSecondaryPruner( inSource->dynamicTreeSecondaryPruner )
,StaticBVHBuildStrategy( inSource->staticBVHBuildStrategy )
,DynamicBVHBuildStrategy( inSource->dynamicBVHBuildStrategy )
,StaticNbObjectsPerNode( inSource->staticNbObjectsPerNode )
,DynamicNbObjectsPerNode( inSource->dynamicNbObjectsPerNode )
,SceneQueryUpdateMode( inSource->sceneQueryUpdateMode )
{
PX_UNUSED(inSource);
}
void setPxSceneDesc_ToDefault( PxSceneDesc* inObj, const PxTolerancesScale & inArg){ inObj->setToDefault( inArg ); }
inline PxVec3 getPxSceneDescGravity( const PxSceneDesc* inOwner ) { return inOwner->gravity; }
inline void setPxSceneDescGravity( PxSceneDesc* inOwner, PxVec3 inData) { inOwner->gravity = inData; }
inline PxSimulationEventCallback * getPxSceneDescSimulationEventCallback( const PxSceneDesc* inOwner ) { return inOwner->simulationEventCallback; }
inline void setPxSceneDescSimulationEventCallback( PxSceneDesc* inOwner, PxSimulationEventCallback * inData) { inOwner->simulationEventCallback = inData; }
inline PxContactModifyCallback * getPxSceneDescContactModifyCallback( const PxSceneDesc* inOwner ) { return inOwner->contactModifyCallback; }
inline void setPxSceneDescContactModifyCallback( PxSceneDesc* inOwner, PxContactModifyCallback * inData) { inOwner->contactModifyCallback = inData; }
inline PxCCDContactModifyCallback * getPxSceneDescCcdContactModifyCallback( const PxSceneDesc* inOwner ) { return inOwner->ccdContactModifyCallback; }
inline void setPxSceneDescCcdContactModifyCallback( PxSceneDesc* inOwner, PxCCDContactModifyCallback * inData) { inOwner->ccdContactModifyCallback = inData; }
inline const void * getPxSceneDescFilterShaderData( const PxSceneDesc* inOwner ) { return inOwner->filterShaderData; }
inline void setPxSceneDescFilterShaderData( PxSceneDesc* inOwner, const void * inData) { inOwner->filterShaderData = inData; }
inline PxU32 getPxSceneDescFilterShaderDataSize( const PxSceneDesc* inOwner ) { return inOwner->filterShaderDataSize; }
inline void setPxSceneDescFilterShaderDataSize( PxSceneDesc* inOwner, PxU32 inData) { inOwner->filterShaderDataSize = inData; }
inline PxSimulationFilterShader getPxSceneDescFilterShader( const PxSceneDesc* inOwner ) { return inOwner->filterShader; }
inline void setPxSceneDescFilterShader( PxSceneDesc* inOwner, PxSimulationFilterShader inData) { inOwner->filterShader = inData; }
inline PxSimulationFilterCallback * getPxSceneDescFilterCallback( const PxSceneDesc* inOwner ) { return inOwner->filterCallback; }
inline void setPxSceneDescFilterCallback( PxSceneDesc* inOwner, PxSimulationFilterCallback * inData) { inOwner->filterCallback = inData; }
inline PxPairFilteringMode::Enum getPxSceneDescKineKineFilteringMode( const PxSceneDesc* inOwner ) { return inOwner->kineKineFilteringMode; }
inline void setPxSceneDescKineKineFilteringMode( PxSceneDesc* inOwner, PxPairFilteringMode::Enum inData) { inOwner->kineKineFilteringMode = inData; }
inline PxPairFilteringMode::Enum getPxSceneDescStaticKineFilteringMode( const PxSceneDesc* inOwner ) { return inOwner->staticKineFilteringMode; }
inline void setPxSceneDescStaticKineFilteringMode( PxSceneDesc* inOwner, PxPairFilteringMode::Enum inData) { inOwner->staticKineFilteringMode = inData; }
inline PxBroadPhaseType::Enum getPxSceneDescBroadPhaseType( const PxSceneDesc* inOwner ) { return inOwner->broadPhaseType; }
inline void setPxSceneDescBroadPhaseType( PxSceneDesc* inOwner, PxBroadPhaseType::Enum inData) { inOwner->broadPhaseType = inData; }
inline PxBroadPhaseCallback * getPxSceneDescBroadPhaseCallback( const PxSceneDesc* inOwner ) { return inOwner->broadPhaseCallback; }
inline void setPxSceneDescBroadPhaseCallback( PxSceneDesc* inOwner, PxBroadPhaseCallback * inData) { inOwner->broadPhaseCallback = inData; }
inline PxSceneLimits getPxSceneDescLimits( const PxSceneDesc* inOwner ) { return inOwner->limits; }
inline void setPxSceneDescLimits( PxSceneDesc* inOwner, PxSceneLimits inData) { inOwner->limits = inData; }
inline PxFrictionType::Enum getPxSceneDescFrictionType( const PxSceneDesc* inOwner ) { return inOwner->frictionType; }
inline void setPxSceneDescFrictionType( PxSceneDesc* inOwner, PxFrictionType::Enum inData) { inOwner->frictionType = inData; }
inline PxSolverType::Enum getPxSceneDescSolverType( const PxSceneDesc* inOwner ) { return inOwner->solverType; }
inline void setPxSceneDescSolverType( PxSceneDesc* inOwner, PxSolverType::Enum inData) { inOwner->solverType = inData; }
inline PxReal getPxSceneDescBounceThresholdVelocity( const PxSceneDesc* inOwner ) { return inOwner->bounceThresholdVelocity; }
inline void setPxSceneDescBounceThresholdVelocity( PxSceneDesc* inOwner, PxReal inData) { inOwner->bounceThresholdVelocity = inData; }
inline PxReal getPxSceneDescFrictionOffsetThreshold( const PxSceneDesc* inOwner ) { return inOwner->frictionOffsetThreshold; }
inline void setPxSceneDescFrictionOffsetThreshold( PxSceneDesc* inOwner, PxReal inData) { inOwner->frictionOffsetThreshold = inData; }
inline PxReal getPxSceneDescFrictionCorrelationDistance( const PxSceneDesc* inOwner ) { return inOwner->frictionCorrelationDistance; }
inline void setPxSceneDescFrictionCorrelationDistance( PxSceneDesc* inOwner, PxReal inData) { inOwner->frictionCorrelationDistance = inData; }
inline PxSceneFlags getPxSceneDescFlags( const PxSceneDesc* inOwner ) { return inOwner->flags; }
inline void setPxSceneDescFlags( PxSceneDesc* inOwner, PxSceneFlags inData) { inOwner->flags = inData; }
inline PxCpuDispatcher * getPxSceneDescCpuDispatcher( const PxSceneDesc* inOwner ) { return inOwner->cpuDispatcher; }
inline void setPxSceneDescCpuDispatcher( PxSceneDesc* inOwner, PxCpuDispatcher * inData) { inOwner->cpuDispatcher = inData; }
inline PxCudaContextManager * getPxSceneDescCudaContextManager( const PxSceneDesc* inOwner ) { return inOwner->cudaContextManager; }
inline void setPxSceneDescCudaContextManager( PxSceneDesc* inOwner, PxCudaContextManager * inData) { inOwner->cudaContextManager = inData; }
inline void * getPxSceneDescUserData( const PxSceneDesc* inOwner ) { return inOwner->userData; }
inline void setPxSceneDescUserData( PxSceneDesc* inOwner, void * inData) { inOwner->userData = inData; }
inline PxU32 getPxSceneDescSolverBatchSize( const PxSceneDesc* inOwner ) { return inOwner->solverBatchSize; }
inline void setPxSceneDescSolverBatchSize( PxSceneDesc* inOwner, PxU32 inData) { inOwner->solverBatchSize = inData; }
inline PxU32 getPxSceneDescSolverArticulationBatchSize( const PxSceneDesc* inOwner ) { return inOwner->solverArticulationBatchSize; }
inline void setPxSceneDescSolverArticulationBatchSize( PxSceneDesc* inOwner, PxU32 inData) { inOwner->solverArticulationBatchSize = inData; }
inline PxU32 getPxSceneDescNbContactDataBlocks( const PxSceneDesc* inOwner ) { return inOwner->nbContactDataBlocks; }
inline void setPxSceneDescNbContactDataBlocks( PxSceneDesc* inOwner, PxU32 inData) { inOwner->nbContactDataBlocks = inData; }
inline PxU32 getPxSceneDescMaxNbContactDataBlocks( const PxSceneDesc* inOwner ) { return inOwner->maxNbContactDataBlocks; }
inline void setPxSceneDescMaxNbContactDataBlocks( PxSceneDesc* inOwner, PxU32 inData) { inOwner->maxNbContactDataBlocks = inData; }
inline PxReal getPxSceneDescMaxBiasCoefficient( const PxSceneDesc* inOwner ) { return inOwner->maxBiasCoefficient; }
inline void setPxSceneDescMaxBiasCoefficient( PxSceneDesc* inOwner, PxReal inData) { inOwner->maxBiasCoefficient = inData; }
inline PxU32 getPxSceneDescContactReportStreamBufferSize( const PxSceneDesc* inOwner ) { return inOwner->contactReportStreamBufferSize; }
inline void setPxSceneDescContactReportStreamBufferSize( PxSceneDesc* inOwner, PxU32 inData) { inOwner->contactReportStreamBufferSize = inData; }
inline PxU32 getPxSceneDescCcdMaxPasses( const PxSceneDesc* inOwner ) { return inOwner->ccdMaxPasses; }
inline void setPxSceneDescCcdMaxPasses( PxSceneDesc* inOwner, PxU32 inData) { inOwner->ccdMaxPasses = inData; }
inline PxReal getPxSceneDescCcdThreshold( const PxSceneDesc* inOwner ) { return inOwner->ccdThreshold; }
inline void setPxSceneDescCcdThreshold( PxSceneDesc* inOwner, PxReal inData) { inOwner->ccdThreshold = inData; }
inline PxReal getPxSceneDescCcdMaxSeparation( const PxSceneDesc* inOwner ) { return inOwner->ccdMaxSeparation; }
inline void setPxSceneDescCcdMaxSeparation( PxSceneDesc* inOwner, PxReal inData) { inOwner->ccdMaxSeparation = inData; }
inline PxReal getPxSceneDescWakeCounterResetValue( const PxSceneDesc* inOwner ) { return inOwner->wakeCounterResetValue; }
inline void setPxSceneDescWakeCounterResetValue( PxSceneDesc* inOwner, PxReal inData) { inOwner->wakeCounterResetValue = inData; }
inline PxBounds3 getPxSceneDescSanityBounds( const PxSceneDesc* inOwner ) { return inOwner->sanityBounds; }
inline void setPxSceneDescSanityBounds( PxSceneDesc* inOwner, PxBounds3 inData) { inOwner->sanityBounds = inData; }
inline PxgDynamicsMemoryConfig getPxSceneDescGpuDynamicsConfig( const PxSceneDesc* inOwner ) { return inOwner->gpuDynamicsConfig; }
inline void setPxSceneDescGpuDynamicsConfig( PxSceneDesc* inOwner, PxgDynamicsMemoryConfig inData) { inOwner->gpuDynamicsConfig = inData; }
inline PxU32 getPxSceneDescGpuMaxNumPartitions( const PxSceneDesc* inOwner ) { return inOwner->gpuMaxNumPartitions; }
inline void setPxSceneDescGpuMaxNumPartitions( PxSceneDesc* inOwner, PxU32 inData) { inOwner->gpuMaxNumPartitions = inData; }
inline PxU32 getPxSceneDescGpuMaxNumStaticPartitions( const PxSceneDesc* inOwner ) { return inOwner->gpuMaxNumStaticPartitions; }
inline void setPxSceneDescGpuMaxNumStaticPartitions( PxSceneDesc* inOwner, PxU32 inData) { inOwner->gpuMaxNumStaticPartitions = inData; }
inline PxU32 getPxSceneDescGpuComputeVersion( const PxSceneDesc* inOwner ) { return inOwner->gpuComputeVersion; }
inline void setPxSceneDescGpuComputeVersion( PxSceneDesc* inOwner, PxU32 inData) { inOwner->gpuComputeVersion = inData; }
inline PxU32 getPxSceneDescContactPairSlabSize( const PxSceneDesc* inOwner ) { return inOwner->contactPairSlabSize; }
inline void setPxSceneDescContactPairSlabSize( PxSceneDesc* inOwner, PxU32 inData) { inOwner->contactPairSlabSize = inData; }
PX_PHYSX_CORE_API PxSceneDescGeneratedInfo::PxSceneDescGeneratedInfo()
: ToDefault( "ToDefault", setPxSceneDesc_ToDefault)
, Gravity( "Gravity", setPxSceneDescGravity, getPxSceneDescGravity )
, SimulationEventCallback( "SimulationEventCallback", setPxSceneDescSimulationEventCallback, getPxSceneDescSimulationEventCallback )
, ContactModifyCallback( "ContactModifyCallback", setPxSceneDescContactModifyCallback, getPxSceneDescContactModifyCallback )
, CcdContactModifyCallback( "CcdContactModifyCallback", setPxSceneDescCcdContactModifyCallback, getPxSceneDescCcdContactModifyCallback )
, FilterShaderData( "FilterShaderData", setPxSceneDescFilterShaderData, getPxSceneDescFilterShaderData )
, FilterShaderDataSize( "FilterShaderDataSize", setPxSceneDescFilterShaderDataSize, getPxSceneDescFilterShaderDataSize )
, FilterShader( "FilterShader", setPxSceneDescFilterShader, getPxSceneDescFilterShader )
, FilterCallback( "FilterCallback", setPxSceneDescFilterCallback, getPxSceneDescFilterCallback )
, KineKineFilteringMode( "KineKineFilteringMode", setPxSceneDescKineKineFilteringMode, getPxSceneDescKineKineFilteringMode )
, StaticKineFilteringMode( "StaticKineFilteringMode", setPxSceneDescStaticKineFilteringMode, getPxSceneDescStaticKineFilteringMode )
, BroadPhaseType( "BroadPhaseType", setPxSceneDescBroadPhaseType, getPxSceneDescBroadPhaseType )
, BroadPhaseCallback( "BroadPhaseCallback", setPxSceneDescBroadPhaseCallback, getPxSceneDescBroadPhaseCallback )
, Limits( "Limits", setPxSceneDescLimits, getPxSceneDescLimits )
, FrictionType( "FrictionType", setPxSceneDescFrictionType, getPxSceneDescFrictionType )
, SolverType( "SolverType", setPxSceneDescSolverType, getPxSceneDescSolverType )
, BounceThresholdVelocity( "BounceThresholdVelocity", setPxSceneDescBounceThresholdVelocity, getPxSceneDescBounceThresholdVelocity )
, FrictionOffsetThreshold( "FrictionOffsetThreshold", setPxSceneDescFrictionOffsetThreshold, getPxSceneDescFrictionOffsetThreshold )
, FrictionCorrelationDistance( "FrictionCorrelationDistance", setPxSceneDescFrictionCorrelationDistance, getPxSceneDescFrictionCorrelationDistance )
, Flags( "Flags", setPxSceneDescFlags, getPxSceneDescFlags )
, CpuDispatcher( "CpuDispatcher", setPxSceneDescCpuDispatcher, getPxSceneDescCpuDispatcher )
, CudaContextManager( "CudaContextManager", setPxSceneDescCudaContextManager, getPxSceneDescCudaContextManager )
, UserData( "UserData", setPxSceneDescUserData, getPxSceneDescUserData )
, SolverBatchSize( "SolverBatchSize", setPxSceneDescSolverBatchSize, getPxSceneDescSolverBatchSize )
, SolverArticulationBatchSize( "SolverArticulationBatchSize", setPxSceneDescSolverArticulationBatchSize, getPxSceneDescSolverArticulationBatchSize )
, NbContactDataBlocks( "NbContactDataBlocks", setPxSceneDescNbContactDataBlocks, getPxSceneDescNbContactDataBlocks )
, MaxNbContactDataBlocks( "MaxNbContactDataBlocks", setPxSceneDescMaxNbContactDataBlocks, getPxSceneDescMaxNbContactDataBlocks )
, MaxBiasCoefficient( "MaxBiasCoefficient", setPxSceneDescMaxBiasCoefficient, getPxSceneDescMaxBiasCoefficient )
, ContactReportStreamBufferSize( "ContactReportStreamBufferSize", setPxSceneDescContactReportStreamBufferSize, getPxSceneDescContactReportStreamBufferSize )
, CcdMaxPasses( "CcdMaxPasses", setPxSceneDescCcdMaxPasses, getPxSceneDescCcdMaxPasses )
, CcdThreshold( "CcdThreshold", setPxSceneDescCcdThreshold, getPxSceneDescCcdThreshold )
, CcdMaxSeparation( "CcdMaxSeparation", setPxSceneDescCcdMaxSeparation, getPxSceneDescCcdMaxSeparation )
, WakeCounterResetValue( "WakeCounterResetValue", setPxSceneDescWakeCounterResetValue, getPxSceneDescWakeCounterResetValue )
, SanityBounds( "SanityBounds", setPxSceneDescSanityBounds, getPxSceneDescSanityBounds )
, GpuDynamicsConfig( "GpuDynamicsConfig", setPxSceneDescGpuDynamicsConfig, getPxSceneDescGpuDynamicsConfig )
, GpuMaxNumPartitions( "GpuMaxNumPartitions", setPxSceneDescGpuMaxNumPartitions, getPxSceneDescGpuMaxNumPartitions )
, GpuMaxNumStaticPartitions( "GpuMaxNumStaticPartitions", setPxSceneDescGpuMaxNumStaticPartitions, getPxSceneDescGpuMaxNumStaticPartitions )
, GpuComputeVersion( "GpuComputeVersion", setPxSceneDescGpuComputeVersion, getPxSceneDescGpuComputeVersion )
, ContactPairSlabSize( "ContactPairSlabSize", setPxSceneDescContactPairSlabSize, getPxSceneDescContactPairSlabSize )
{}
PX_PHYSX_CORE_API PxSceneDescGeneratedValues::PxSceneDescGeneratedValues( const PxSceneDesc* inSource )
:PxSceneQueryDescGeneratedValues( inSource )
,Gravity( inSource->gravity )
,SimulationEventCallback( inSource->simulationEventCallback )
,ContactModifyCallback( inSource->contactModifyCallback )
,CcdContactModifyCallback( inSource->ccdContactModifyCallback )
,FilterShaderData( inSource->filterShaderData )
,FilterShaderDataSize( inSource->filterShaderDataSize )
,FilterShader( inSource->filterShader )
,FilterCallback( inSource->filterCallback )
,KineKineFilteringMode( inSource->kineKineFilteringMode )
,StaticKineFilteringMode( inSource->staticKineFilteringMode )
,BroadPhaseType( inSource->broadPhaseType )
,BroadPhaseCallback( inSource->broadPhaseCallback )
,Limits( inSource->limits )
,FrictionType( inSource->frictionType )
,SolverType( inSource->solverType )
,BounceThresholdVelocity( inSource->bounceThresholdVelocity )
,FrictionOffsetThreshold( inSource->frictionOffsetThreshold )
,FrictionCorrelationDistance( inSource->frictionCorrelationDistance )
,Flags( inSource->flags )
,CpuDispatcher( inSource->cpuDispatcher )
,CudaContextManager( inSource->cudaContextManager )
,UserData( inSource->userData )
,SolverBatchSize( inSource->solverBatchSize )
,SolverArticulationBatchSize( inSource->solverArticulationBatchSize )
,NbContactDataBlocks( inSource->nbContactDataBlocks )
,MaxNbContactDataBlocks( inSource->maxNbContactDataBlocks )
,MaxBiasCoefficient( inSource->maxBiasCoefficient )
,ContactReportStreamBufferSize( inSource->contactReportStreamBufferSize )
,CcdMaxPasses( inSource->ccdMaxPasses )
,CcdThreshold( inSource->ccdThreshold )
,CcdMaxSeparation( inSource->ccdMaxSeparation )
,WakeCounterResetValue( inSource->wakeCounterResetValue )
,SanityBounds( inSource->sanityBounds )
,GpuDynamicsConfig( inSource->gpuDynamicsConfig )
,GpuMaxNumPartitions( inSource->gpuMaxNumPartitions )
,GpuMaxNumStaticPartitions( inSource->gpuMaxNumStaticPartitions )
,GpuComputeVersion( inSource->gpuComputeVersion )
,ContactPairSlabSize( inSource->contactPairSlabSize )
{
PX_UNUSED(inSource);
}
_Bool getPxBroadPhaseDesc_IsValid( const PxBroadPhaseDesc* inObj ) { return inObj->isValid(); }
inline PxBroadPhaseType::Enum getPxBroadPhaseDescMType( const PxBroadPhaseDesc* inOwner ) { return inOwner->mType; }
inline void setPxBroadPhaseDescMType( PxBroadPhaseDesc* inOwner, PxBroadPhaseType::Enum inData) { inOwner->mType = inData; }
inline PxU64 getPxBroadPhaseDescMContextID( const PxBroadPhaseDesc* inOwner ) { return inOwner->mContextID; }
inline void setPxBroadPhaseDescMContextID( PxBroadPhaseDesc* inOwner, PxU64 inData) { inOwner->mContextID = inData; }
inline PxCudaContextManager * getPxBroadPhaseDescMContextManager( const PxBroadPhaseDesc* inOwner ) { return inOwner->mContextManager; }
inline void setPxBroadPhaseDescMContextManager( PxBroadPhaseDesc* inOwner, PxCudaContextManager * inData) { inOwner->mContextManager = inData; }
inline PxU32 getPxBroadPhaseDescMFoundLostPairsCapacity( const PxBroadPhaseDesc* inOwner ) { return inOwner->mFoundLostPairsCapacity; }
inline void setPxBroadPhaseDescMFoundLostPairsCapacity( PxBroadPhaseDesc* inOwner, PxU32 inData) { inOwner->mFoundLostPairsCapacity = inData; }
inline _Bool getPxBroadPhaseDescMDiscardStaticVsKinematic( const PxBroadPhaseDesc* inOwner ) { return inOwner->mDiscardStaticVsKinematic; }
inline void setPxBroadPhaseDescMDiscardStaticVsKinematic( PxBroadPhaseDesc* inOwner, _Bool inData) { inOwner->mDiscardStaticVsKinematic = inData; }
inline _Bool getPxBroadPhaseDescMDiscardKinematicVsKinematic( const PxBroadPhaseDesc* inOwner ) { return inOwner->mDiscardKinematicVsKinematic; }
inline void setPxBroadPhaseDescMDiscardKinematicVsKinematic( PxBroadPhaseDesc* inOwner, _Bool inData) { inOwner->mDiscardKinematicVsKinematic = inData; }
PX_PHYSX_CORE_API PxBroadPhaseDescGeneratedInfo::PxBroadPhaseDescGeneratedInfo()
: IsValid( "IsValid", getPxBroadPhaseDesc_IsValid)
, MType( "MType", setPxBroadPhaseDescMType, getPxBroadPhaseDescMType )
, MContextID( "MContextID", setPxBroadPhaseDescMContextID, getPxBroadPhaseDescMContextID )
, MContextManager( "MContextManager", setPxBroadPhaseDescMContextManager, getPxBroadPhaseDescMContextManager )
, MFoundLostPairsCapacity( "MFoundLostPairsCapacity", setPxBroadPhaseDescMFoundLostPairsCapacity, getPxBroadPhaseDescMFoundLostPairsCapacity )
, MDiscardStaticVsKinematic( "MDiscardStaticVsKinematic", setPxBroadPhaseDescMDiscardStaticVsKinematic, getPxBroadPhaseDescMDiscardStaticVsKinematic )
, MDiscardKinematicVsKinematic( "MDiscardKinematicVsKinematic", setPxBroadPhaseDescMDiscardKinematicVsKinematic, getPxBroadPhaseDescMDiscardKinematicVsKinematic )
{}
PX_PHYSX_CORE_API PxBroadPhaseDescGeneratedValues::PxBroadPhaseDescGeneratedValues( const PxBroadPhaseDesc* inSource )
:IsValid( getPxBroadPhaseDesc_IsValid( inSource ) )
,MType( inSource->mType )
,MContextID( inSource->mContextID )
,MContextManager( inSource->mContextManager )
,MFoundLostPairsCapacity( inSource->mFoundLostPairsCapacity )
,MDiscardStaticVsKinematic( inSource->mDiscardStaticVsKinematic )
,MDiscardKinematicVsKinematic( inSource->mDiscardKinematicVsKinematic )
{
PX_UNUSED(inSource);
}
inline PxU32 getPxSceneLimitsMaxNbActors( const PxSceneLimits* inOwner ) { return inOwner->maxNbActors; }
inline void setPxSceneLimitsMaxNbActors( PxSceneLimits* inOwner, PxU32 inData) { inOwner->maxNbActors = inData; }
inline PxU32 getPxSceneLimitsMaxNbBodies( const PxSceneLimits* inOwner ) { return inOwner->maxNbBodies; }
inline void setPxSceneLimitsMaxNbBodies( PxSceneLimits* inOwner, PxU32 inData) { inOwner->maxNbBodies = inData; }
inline PxU32 getPxSceneLimitsMaxNbStaticShapes( const PxSceneLimits* inOwner ) { return inOwner->maxNbStaticShapes; }
inline void setPxSceneLimitsMaxNbStaticShapes( PxSceneLimits* inOwner, PxU32 inData) { inOwner->maxNbStaticShapes = inData; }
inline PxU32 getPxSceneLimitsMaxNbDynamicShapes( const PxSceneLimits* inOwner ) { return inOwner->maxNbDynamicShapes; }
inline void setPxSceneLimitsMaxNbDynamicShapes( PxSceneLimits* inOwner, PxU32 inData) { inOwner->maxNbDynamicShapes = inData; }
inline PxU32 getPxSceneLimitsMaxNbAggregates( const PxSceneLimits* inOwner ) { return inOwner->maxNbAggregates; }
inline void setPxSceneLimitsMaxNbAggregates( PxSceneLimits* inOwner, PxU32 inData) { inOwner->maxNbAggregates = inData; }
inline PxU32 getPxSceneLimitsMaxNbConstraints( const PxSceneLimits* inOwner ) { return inOwner->maxNbConstraints; }
inline void setPxSceneLimitsMaxNbConstraints( PxSceneLimits* inOwner, PxU32 inData) { inOwner->maxNbConstraints = inData; }
inline PxU32 getPxSceneLimitsMaxNbRegions( const PxSceneLimits* inOwner ) { return inOwner->maxNbRegions; }
inline void setPxSceneLimitsMaxNbRegions( PxSceneLimits* inOwner, PxU32 inData) { inOwner->maxNbRegions = inData; }
inline PxU32 getPxSceneLimitsMaxNbBroadPhaseOverlaps( const PxSceneLimits* inOwner ) { return inOwner->maxNbBroadPhaseOverlaps; }
inline void setPxSceneLimitsMaxNbBroadPhaseOverlaps( PxSceneLimits* inOwner, PxU32 inData) { inOwner->maxNbBroadPhaseOverlaps = inData; }
PX_PHYSX_CORE_API PxSceneLimitsGeneratedInfo::PxSceneLimitsGeneratedInfo()
: MaxNbActors( "MaxNbActors", setPxSceneLimitsMaxNbActors, getPxSceneLimitsMaxNbActors )
, MaxNbBodies( "MaxNbBodies", setPxSceneLimitsMaxNbBodies, getPxSceneLimitsMaxNbBodies )
, MaxNbStaticShapes( "MaxNbStaticShapes", setPxSceneLimitsMaxNbStaticShapes, getPxSceneLimitsMaxNbStaticShapes )
, MaxNbDynamicShapes( "MaxNbDynamicShapes", setPxSceneLimitsMaxNbDynamicShapes, getPxSceneLimitsMaxNbDynamicShapes )
, MaxNbAggregates( "MaxNbAggregates", setPxSceneLimitsMaxNbAggregates, getPxSceneLimitsMaxNbAggregates )
, MaxNbConstraints( "MaxNbConstraints", setPxSceneLimitsMaxNbConstraints, getPxSceneLimitsMaxNbConstraints )
, MaxNbRegions( "MaxNbRegions", setPxSceneLimitsMaxNbRegions, getPxSceneLimitsMaxNbRegions )
, MaxNbBroadPhaseOverlaps( "MaxNbBroadPhaseOverlaps", setPxSceneLimitsMaxNbBroadPhaseOverlaps, getPxSceneLimitsMaxNbBroadPhaseOverlaps )
{}
PX_PHYSX_CORE_API PxSceneLimitsGeneratedValues::PxSceneLimitsGeneratedValues( const PxSceneLimits* inSource )
:MaxNbActors( inSource->maxNbActors )
,MaxNbBodies( inSource->maxNbBodies )
,MaxNbStaticShapes( inSource->maxNbStaticShapes )
,MaxNbDynamicShapes( inSource->maxNbDynamicShapes )
,MaxNbAggregates( inSource->maxNbAggregates )
,MaxNbConstraints( inSource->maxNbConstraints )
,MaxNbRegions( inSource->maxNbRegions )
,MaxNbBroadPhaseOverlaps( inSource->maxNbBroadPhaseOverlaps )
{
PX_UNUSED(inSource);
}
_Bool getPxgDynamicsMemoryConfig_IsValid( const PxgDynamicsMemoryConfig* inObj ) { return inObj->isValid(); }
inline PxU32 getPxgDynamicsMemoryConfigTempBufferCapacity( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->tempBufferCapacity; }
inline void setPxgDynamicsMemoryConfigTempBufferCapacity( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->tempBufferCapacity = inData; }
inline PxU32 getPxgDynamicsMemoryConfigMaxRigidContactCount( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->maxRigidContactCount; }
inline void setPxgDynamicsMemoryConfigMaxRigidContactCount( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->maxRigidContactCount = inData; }
inline PxU32 getPxgDynamicsMemoryConfigMaxRigidPatchCount( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->maxRigidPatchCount; }
inline void setPxgDynamicsMemoryConfigMaxRigidPatchCount( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->maxRigidPatchCount = inData; }
inline PxU32 getPxgDynamicsMemoryConfigHeapCapacity( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->heapCapacity; }
inline void setPxgDynamicsMemoryConfigHeapCapacity( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->heapCapacity = inData; }
inline PxU32 getPxgDynamicsMemoryConfigFoundLostPairsCapacity( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->foundLostPairsCapacity; }
inline void setPxgDynamicsMemoryConfigFoundLostPairsCapacity( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->foundLostPairsCapacity = inData; }
inline PxU32 getPxgDynamicsMemoryConfigFoundLostAggregatePairsCapacity( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->foundLostAggregatePairsCapacity; }
inline void setPxgDynamicsMemoryConfigFoundLostAggregatePairsCapacity( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->foundLostAggregatePairsCapacity = inData; }
inline PxU32 getPxgDynamicsMemoryConfigTotalAggregatePairsCapacity( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->totalAggregatePairsCapacity; }
inline void setPxgDynamicsMemoryConfigTotalAggregatePairsCapacity( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->totalAggregatePairsCapacity = inData; }
inline PxU32 getPxgDynamicsMemoryConfigMaxSoftBodyContacts( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->maxSoftBodyContacts; }
inline void setPxgDynamicsMemoryConfigMaxSoftBodyContacts( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->maxSoftBodyContacts = inData; }
inline PxU32 getPxgDynamicsMemoryConfigMaxFemClothContacts( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->maxFemClothContacts; }
inline void setPxgDynamicsMemoryConfigMaxFemClothContacts( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->maxFemClothContacts = inData; }
inline PxU32 getPxgDynamicsMemoryConfigMaxParticleContacts( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->maxParticleContacts; }
inline void setPxgDynamicsMemoryConfigMaxParticleContacts( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->maxParticleContacts = inData; }
inline PxU32 getPxgDynamicsMemoryConfigCollisionStackSize( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->collisionStackSize; }
inline void setPxgDynamicsMemoryConfigCollisionStackSize( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->collisionStackSize = inData; }
inline PxU32 getPxgDynamicsMemoryConfigMaxHairContacts( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->maxHairContacts; }
inline void setPxgDynamicsMemoryConfigMaxHairContacts( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->maxHairContacts = inData; }
PX_PHYSX_CORE_API PxgDynamicsMemoryConfigGeneratedInfo::PxgDynamicsMemoryConfigGeneratedInfo()
: IsValid( "IsValid", getPxgDynamicsMemoryConfig_IsValid)
, TempBufferCapacity( "TempBufferCapacity", setPxgDynamicsMemoryConfigTempBufferCapacity, getPxgDynamicsMemoryConfigTempBufferCapacity )
, MaxRigidContactCount( "MaxRigidContactCount", setPxgDynamicsMemoryConfigMaxRigidContactCount, getPxgDynamicsMemoryConfigMaxRigidContactCount )
, MaxRigidPatchCount( "MaxRigidPatchCount", setPxgDynamicsMemoryConfigMaxRigidPatchCount, getPxgDynamicsMemoryConfigMaxRigidPatchCount )
, HeapCapacity( "HeapCapacity", setPxgDynamicsMemoryConfigHeapCapacity, getPxgDynamicsMemoryConfigHeapCapacity )
, FoundLostPairsCapacity( "FoundLostPairsCapacity", setPxgDynamicsMemoryConfigFoundLostPairsCapacity, getPxgDynamicsMemoryConfigFoundLostPairsCapacity )
, FoundLostAggregatePairsCapacity( "FoundLostAggregatePairsCapacity", setPxgDynamicsMemoryConfigFoundLostAggregatePairsCapacity, getPxgDynamicsMemoryConfigFoundLostAggregatePairsCapacity )
, TotalAggregatePairsCapacity( "TotalAggregatePairsCapacity", setPxgDynamicsMemoryConfigTotalAggregatePairsCapacity, getPxgDynamicsMemoryConfigTotalAggregatePairsCapacity )
, MaxSoftBodyContacts( "MaxSoftBodyContacts", setPxgDynamicsMemoryConfigMaxSoftBodyContacts, getPxgDynamicsMemoryConfigMaxSoftBodyContacts )
, MaxFemClothContacts( "MaxFemClothContacts", setPxgDynamicsMemoryConfigMaxFemClothContacts, getPxgDynamicsMemoryConfigMaxFemClothContacts )
, MaxParticleContacts( "MaxParticleContacts", setPxgDynamicsMemoryConfigMaxParticleContacts, getPxgDynamicsMemoryConfigMaxParticleContacts )
, CollisionStackSize( "CollisionStackSize", setPxgDynamicsMemoryConfigCollisionStackSize, getPxgDynamicsMemoryConfigCollisionStackSize )
, MaxHairContacts( "MaxHairContacts", setPxgDynamicsMemoryConfigMaxHairContacts, getPxgDynamicsMemoryConfigMaxHairContacts )
{}
PX_PHYSX_CORE_API PxgDynamicsMemoryConfigGeneratedValues::PxgDynamicsMemoryConfigGeneratedValues( const PxgDynamicsMemoryConfig* inSource )
:IsValid( getPxgDynamicsMemoryConfig_IsValid( inSource ) )
,TempBufferCapacity( inSource->tempBufferCapacity )
,MaxRigidContactCount( inSource->maxRigidContactCount )
,MaxRigidPatchCount( inSource->maxRigidPatchCount )
,HeapCapacity( inSource->heapCapacity )
,FoundLostPairsCapacity( inSource->foundLostPairsCapacity )
,FoundLostAggregatePairsCapacity( inSource->foundLostAggregatePairsCapacity )
,TotalAggregatePairsCapacity( inSource->totalAggregatePairsCapacity )
,MaxSoftBodyContacts( inSource->maxSoftBodyContacts )
,MaxFemClothContacts( inSource->maxFemClothContacts )
,MaxParticleContacts( inSource->maxParticleContacts )
,CollisionStackSize( inSource->collisionStackSize )
,MaxHairContacts( inSource->maxHairContacts )
{
PX_UNUSED(inSource);
}
inline PxU32 getPxSimulationStatisticsNbActiveConstraints( const PxSimulationStatistics* inOwner ) { return inOwner->nbActiveConstraints; }
inline void setPxSimulationStatisticsNbActiveConstraints( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbActiveConstraints = inData; }
inline PxU32 getPxSimulationStatisticsNbActiveDynamicBodies( const PxSimulationStatistics* inOwner ) { return inOwner->nbActiveDynamicBodies; }
inline void setPxSimulationStatisticsNbActiveDynamicBodies( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbActiveDynamicBodies = inData; }
inline PxU32 getPxSimulationStatisticsNbActiveKinematicBodies( const PxSimulationStatistics* inOwner ) { return inOwner->nbActiveKinematicBodies; }
inline void setPxSimulationStatisticsNbActiveKinematicBodies( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbActiveKinematicBodies = inData; }
inline PxU32 getPxSimulationStatisticsNbStaticBodies( const PxSimulationStatistics* inOwner ) { return inOwner->nbStaticBodies; }
inline void setPxSimulationStatisticsNbStaticBodies( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbStaticBodies = inData; }
inline PxU32 getPxSimulationStatisticsNbDynamicBodies( const PxSimulationStatistics* inOwner ) { return inOwner->nbDynamicBodies; }
inline void setPxSimulationStatisticsNbDynamicBodies( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbDynamicBodies = inData; }
inline PxU32 getPxSimulationStatisticsNbKinematicBodies( const PxSimulationStatistics* inOwner ) { return inOwner->nbKinematicBodies; }
inline void setPxSimulationStatisticsNbKinematicBodies( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbKinematicBodies = inData; }
inline PxU32 getPxSimulationStatisticsNbAggregates( const PxSimulationStatistics* inOwner ) { return inOwner->nbAggregates; }
inline void setPxSimulationStatisticsNbAggregates( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbAggregates = inData; }
inline PxU32 getPxSimulationStatisticsNbArticulations( const PxSimulationStatistics* inOwner ) { return inOwner->nbArticulations; }
inline void setPxSimulationStatisticsNbArticulations( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbArticulations = inData; }
inline PxU32 getPxSimulationStatisticsNbAxisSolverConstraints( const PxSimulationStatistics* inOwner ) { return inOwner->nbAxisSolverConstraints; }
inline void setPxSimulationStatisticsNbAxisSolverConstraints( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbAxisSolverConstraints = inData; }
inline PxU32 getPxSimulationStatisticsCompressedContactSize( const PxSimulationStatistics* inOwner ) { return inOwner->compressedContactSize; }
inline void setPxSimulationStatisticsCompressedContactSize( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->compressedContactSize = inData; }
inline PxU32 getPxSimulationStatisticsRequiredContactConstraintMemory( const PxSimulationStatistics* inOwner ) { return inOwner->requiredContactConstraintMemory; }
inline void setPxSimulationStatisticsRequiredContactConstraintMemory( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->requiredContactConstraintMemory = inData; }
inline PxU32 getPxSimulationStatisticsPeakConstraintMemory( const PxSimulationStatistics* inOwner ) { return inOwner->peakConstraintMemory; }
inline void setPxSimulationStatisticsPeakConstraintMemory( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->peakConstraintMemory = inData; }
inline PxU32 getPxSimulationStatisticsNbDiscreteContactPairsTotal( const PxSimulationStatistics* inOwner ) { return inOwner->nbDiscreteContactPairsTotal; }
inline void setPxSimulationStatisticsNbDiscreteContactPairsTotal( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbDiscreteContactPairsTotal = inData; }
inline PxU32 getPxSimulationStatisticsNbDiscreteContactPairsWithCacheHits( const PxSimulationStatistics* inOwner ) { return inOwner->nbDiscreteContactPairsWithCacheHits; }
inline void setPxSimulationStatisticsNbDiscreteContactPairsWithCacheHits( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbDiscreteContactPairsWithCacheHits = inData; }
inline PxU32 getPxSimulationStatisticsNbDiscreteContactPairsWithContacts( const PxSimulationStatistics* inOwner ) { return inOwner->nbDiscreteContactPairsWithContacts; }
inline void setPxSimulationStatisticsNbDiscreteContactPairsWithContacts( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbDiscreteContactPairsWithContacts = inData; }
inline PxU32 getPxSimulationStatisticsNbNewPairs( const PxSimulationStatistics* inOwner ) { return inOwner->nbNewPairs; }
inline void setPxSimulationStatisticsNbNewPairs( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbNewPairs = inData; }
inline PxU32 getPxSimulationStatisticsNbLostPairs( const PxSimulationStatistics* inOwner ) { return inOwner->nbLostPairs; }
inline void setPxSimulationStatisticsNbLostPairs( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbLostPairs = inData; }
inline PxU32 getPxSimulationStatisticsNbNewTouches( const PxSimulationStatistics* inOwner ) { return inOwner->nbNewTouches; }
inline void setPxSimulationStatisticsNbNewTouches( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbNewTouches = inData; }
inline PxU32 getPxSimulationStatisticsNbLostTouches( const PxSimulationStatistics* inOwner ) { return inOwner->nbLostTouches; }
inline void setPxSimulationStatisticsNbLostTouches( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbLostTouches = inData; }
inline PxU32 getPxSimulationStatisticsNbPartitions( const PxSimulationStatistics* inOwner ) { return inOwner->nbPartitions; }
inline void setPxSimulationStatisticsNbPartitions( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbPartitions = inData; }
inline PxU64 getPxSimulationStatisticsGpuMemParticles( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemParticles; }
inline void setPxSimulationStatisticsGpuMemParticles( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemParticles = inData; }
inline PxU64 getPxSimulationStatisticsGpuMemSoftBodies( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemSoftBodies; }
inline void setPxSimulationStatisticsGpuMemSoftBodies( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemSoftBodies = inData; }
inline PxU64 getPxSimulationStatisticsGpuMemFEMCloths( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemFEMCloths; }
inline void setPxSimulationStatisticsGpuMemFEMCloths( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemFEMCloths = inData; }
inline PxU64 getPxSimulationStatisticsGpuMemHairSystems( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHairSystems; }
inline void setPxSimulationStatisticsGpuMemHairSystems( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHairSystems = inData; }
inline PxU64 getPxSimulationStatisticsGpuMemHeap( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeap; }
inline void setPxSimulationStatisticsGpuMemHeap( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeap = inData; }
inline PxU64 getPxSimulationStatisticsGpuMemHeapBroadPhase( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapBroadPhase; }
inline void setPxSimulationStatisticsGpuMemHeapBroadPhase( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapBroadPhase = inData; }
inline PxU64 getPxSimulationStatisticsGpuMemHeapNarrowPhase( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapNarrowPhase; }
inline void setPxSimulationStatisticsGpuMemHeapNarrowPhase( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapNarrowPhase = inData; }
inline PxU64 getPxSimulationStatisticsGpuMemHeapSolver( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapSolver; }
inline void setPxSimulationStatisticsGpuMemHeapSolver( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapSolver = inData; }
inline PxU64 getPxSimulationStatisticsGpuMemHeapArticulation( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapArticulation; }
inline void setPxSimulationStatisticsGpuMemHeapArticulation( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapArticulation = inData; }
inline PxU64 getPxSimulationStatisticsGpuMemHeapSimulation( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapSimulation; }
inline void setPxSimulationStatisticsGpuMemHeapSimulation( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapSimulation = inData; }
inline PxU64 getPxSimulationStatisticsGpuMemHeapSimulationArticulation( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapSimulationArticulation; }
inline void setPxSimulationStatisticsGpuMemHeapSimulationArticulation( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapSimulationArticulation = inData; }
inline PxU64 getPxSimulationStatisticsGpuMemHeapSimulationParticles( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapSimulationParticles; }
inline void setPxSimulationStatisticsGpuMemHeapSimulationParticles( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapSimulationParticles = inData; }
inline PxU64 getPxSimulationStatisticsGpuMemHeapSimulationSoftBody( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapSimulationSoftBody; }
inline void setPxSimulationStatisticsGpuMemHeapSimulationSoftBody( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapSimulationSoftBody = inData; }
inline PxU64 getPxSimulationStatisticsGpuMemHeapSimulationFEMCloth( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapSimulationFEMCloth; }
inline void setPxSimulationStatisticsGpuMemHeapSimulationFEMCloth( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapSimulationFEMCloth = inData; }
inline PxU64 getPxSimulationStatisticsGpuMemHeapSimulationHairSystem( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapSimulationHairSystem; }
inline void setPxSimulationStatisticsGpuMemHeapSimulationHairSystem( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapSimulationHairSystem = inData; }
inline PxU64 getPxSimulationStatisticsGpuMemHeapParticles( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapParticles; }
inline void setPxSimulationStatisticsGpuMemHeapParticles( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapParticles = inData; }
inline PxU64 getPxSimulationStatisticsGpuMemHeapSoftBodies( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapSoftBodies; }
inline void setPxSimulationStatisticsGpuMemHeapSoftBodies( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapSoftBodies = inData; }
inline PxU64 getPxSimulationStatisticsGpuMemHeapFEMCloths( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapFEMCloths; }
inline void setPxSimulationStatisticsGpuMemHeapFEMCloths( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapFEMCloths = inData; }
inline PxU64 getPxSimulationStatisticsGpuMemHeapHairSystems( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapHairSystems; }
inline void setPxSimulationStatisticsGpuMemHeapHairSystems( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapHairSystems = inData; }
inline PxU64 getPxSimulationStatisticsGpuMemHeapOther( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapOther; }
inline void setPxSimulationStatisticsGpuMemHeapOther( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapOther = inData; }
inline PxU32 getPxSimulationStatisticsNbBroadPhaseAdds( const PxSimulationStatistics* inOwner ) { return inOwner->nbBroadPhaseAdds; }
inline void setPxSimulationStatisticsNbBroadPhaseAdds( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbBroadPhaseAdds = inData; }
inline PxU32 getPxSimulationStatisticsNbBroadPhaseRemoves( const PxSimulationStatistics* inOwner ) { return inOwner->nbBroadPhaseRemoves; }
inline void setPxSimulationStatisticsNbBroadPhaseRemoves( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbBroadPhaseRemoves = inData; }
PX_PHYSX_CORE_API PxSimulationStatisticsGeneratedInfo::PxSimulationStatisticsGeneratedInfo()
: NbActiveConstraints( "NbActiveConstraints", setPxSimulationStatisticsNbActiveConstraints, getPxSimulationStatisticsNbActiveConstraints )
, NbActiveDynamicBodies( "NbActiveDynamicBodies", setPxSimulationStatisticsNbActiveDynamicBodies, getPxSimulationStatisticsNbActiveDynamicBodies )
, NbActiveKinematicBodies( "NbActiveKinematicBodies", setPxSimulationStatisticsNbActiveKinematicBodies, getPxSimulationStatisticsNbActiveKinematicBodies )
, NbStaticBodies( "NbStaticBodies", setPxSimulationStatisticsNbStaticBodies, getPxSimulationStatisticsNbStaticBodies )
, NbDynamicBodies( "NbDynamicBodies", setPxSimulationStatisticsNbDynamicBodies, getPxSimulationStatisticsNbDynamicBodies )
, NbKinematicBodies( "NbKinematicBodies", setPxSimulationStatisticsNbKinematicBodies, getPxSimulationStatisticsNbKinematicBodies )
, NbAggregates( "NbAggregates", setPxSimulationStatisticsNbAggregates, getPxSimulationStatisticsNbAggregates )
, NbArticulations( "NbArticulations", setPxSimulationStatisticsNbArticulations, getPxSimulationStatisticsNbArticulations )
, NbAxisSolverConstraints( "NbAxisSolverConstraints", setPxSimulationStatisticsNbAxisSolverConstraints, getPxSimulationStatisticsNbAxisSolverConstraints )
, CompressedContactSize( "CompressedContactSize", setPxSimulationStatisticsCompressedContactSize, getPxSimulationStatisticsCompressedContactSize )
, RequiredContactConstraintMemory( "RequiredContactConstraintMemory", setPxSimulationStatisticsRequiredContactConstraintMemory, getPxSimulationStatisticsRequiredContactConstraintMemory )
, PeakConstraintMemory( "PeakConstraintMemory", setPxSimulationStatisticsPeakConstraintMemory, getPxSimulationStatisticsPeakConstraintMemory )
, NbDiscreteContactPairsTotal( "NbDiscreteContactPairsTotal", setPxSimulationStatisticsNbDiscreteContactPairsTotal, getPxSimulationStatisticsNbDiscreteContactPairsTotal )
, NbDiscreteContactPairsWithCacheHits( "NbDiscreteContactPairsWithCacheHits", setPxSimulationStatisticsNbDiscreteContactPairsWithCacheHits, getPxSimulationStatisticsNbDiscreteContactPairsWithCacheHits )
, NbDiscreteContactPairsWithContacts( "NbDiscreteContactPairsWithContacts", setPxSimulationStatisticsNbDiscreteContactPairsWithContacts, getPxSimulationStatisticsNbDiscreteContactPairsWithContacts )
, NbNewPairs( "NbNewPairs", setPxSimulationStatisticsNbNewPairs, getPxSimulationStatisticsNbNewPairs )
, NbLostPairs( "NbLostPairs", setPxSimulationStatisticsNbLostPairs, getPxSimulationStatisticsNbLostPairs )
, NbNewTouches( "NbNewTouches", setPxSimulationStatisticsNbNewTouches, getPxSimulationStatisticsNbNewTouches )
, NbLostTouches( "NbLostTouches", setPxSimulationStatisticsNbLostTouches, getPxSimulationStatisticsNbLostTouches )
, NbPartitions( "NbPartitions", setPxSimulationStatisticsNbPartitions, getPxSimulationStatisticsNbPartitions )
, GpuMemParticles( "GpuMemParticles", setPxSimulationStatisticsGpuMemParticles, getPxSimulationStatisticsGpuMemParticles )
, GpuMemSoftBodies( "GpuMemSoftBodies", setPxSimulationStatisticsGpuMemSoftBodies, getPxSimulationStatisticsGpuMemSoftBodies )
, GpuMemFEMCloths( "GpuMemFEMCloths", setPxSimulationStatisticsGpuMemFEMCloths, getPxSimulationStatisticsGpuMemFEMCloths )
, GpuMemHairSystems( "GpuMemHairSystems", setPxSimulationStatisticsGpuMemHairSystems, getPxSimulationStatisticsGpuMemHairSystems )
, GpuMemHeap( "GpuMemHeap", setPxSimulationStatisticsGpuMemHeap, getPxSimulationStatisticsGpuMemHeap )
, GpuMemHeapBroadPhase( "GpuMemHeapBroadPhase", setPxSimulationStatisticsGpuMemHeapBroadPhase, getPxSimulationStatisticsGpuMemHeapBroadPhase )
, GpuMemHeapNarrowPhase( "GpuMemHeapNarrowPhase", setPxSimulationStatisticsGpuMemHeapNarrowPhase, getPxSimulationStatisticsGpuMemHeapNarrowPhase )
, GpuMemHeapSolver( "GpuMemHeapSolver", setPxSimulationStatisticsGpuMemHeapSolver, getPxSimulationStatisticsGpuMemHeapSolver )
, GpuMemHeapArticulation( "GpuMemHeapArticulation", setPxSimulationStatisticsGpuMemHeapArticulation, getPxSimulationStatisticsGpuMemHeapArticulation )
, GpuMemHeapSimulation( "GpuMemHeapSimulation", setPxSimulationStatisticsGpuMemHeapSimulation, getPxSimulationStatisticsGpuMemHeapSimulation )
, GpuMemHeapSimulationArticulation( "GpuMemHeapSimulationArticulation", setPxSimulationStatisticsGpuMemHeapSimulationArticulation, getPxSimulationStatisticsGpuMemHeapSimulationArticulation )
, GpuMemHeapSimulationParticles( "GpuMemHeapSimulationParticles", setPxSimulationStatisticsGpuMemHeapSimulationParticles, getPxSimulationStatisticsGpuMemHeapSimulationParticles )
, GpuMemHeapSimulationSoftBody( "GpuMemHeapSimulationSoftBody", setPxSimulationStatisticsGpuMemHeapSimulationSoftBody, getPxSimulationStatisticsGpuMemHeapSimulationSoftBody )
, GpuMemHeapSimulationFEMCloth( "GpuMemHeapSimulationFEMCloth", setPxSimulationStatisticsGpuMemHeapSimulationFEMCloth, getPxSimulationStatisticsGpuMemHeapSimulationFEMCloth )
, GpuMemHeapSimulationHairSystem( "GpuMemHeapSimulationHairSystem", setPxSimulationStatisticsGpuMemHeapSimulationHairSystem, getPxSimulationStatisticsGpuMemHeapSimulationHairSystem )
, GpuMemHeapParticles( "GpuMemHeapParticles", setPxSimulationStatisticsGpuMemHeapParticles, getPxSimulationStatisticsGpuMemHeapParticles )
, GpuMemHeapSoftBodies( "GpuMemHeapSoftBodies", setPxSimulationStatisticsGpuMemHeapSoftBodies, getPxSimulationStatisticsGpuMemHeapSoftBodies )
, GpuMemHeapFEMCloths( "GpuMemHeapFEMCloths", setPxSimulationStatisticsGpuMemHeapFEMCloths, getPxSimulationStatisticsGpuMemHeapFEMCloths )
, GpuMemHeapHairSystems( "GpuMemHeapHairSystems", setPxSimulationStatisticsGpuMemHeapHairSystems, getPxSimulationStatisticsGpuMemHeapHairSystems )
, GpuMemHeapOther( "GpuMemHeapOther", setPxSimulationStatisticsGpuMemHeapOther, getPxSimulationStatisticsGpuMemHeapOther )
, NbBroadPhaseAdds( "NbBroadPhaseAdds", setPxSimulationStatisticsNbBroadPhaseAdds, getPxSimulationStatisticsNbBroadPhaseAdds )
, NbBroadPhaseRemoves( "NbBroadPhaseRemoves", setPxSimulationStatisticsNbBroadPhaseRemoves, getPxSimulationStatisticsNbBroadPhaseRemoves )
{}
PX_PHYSX_CORE_API PxSimulationStatisticsGeneratedValues::PxSimulationStatisticsGeneratedValues( const PxSimulationStatistics* inSource )
:NbActiveConstraints( inSource->nbActiveConstraints )
,NbActiveDynamicBodies( inSource->nbActiveDynamicBodies )
,NbActiveKinematicBodies( inSource->nbActiveKinematicBodies )
,NbStaticBodies( inSource->nbStaticBodies )
,NbDynamicBodies( inSource->nbDynamicBodies )
,NbKinematicBodies( inSource->nbKinematicBodies )
,NbAggregates( inSource->nbAggregates )
,NbArticulations( inSource->nbArticulations )
,NbAxisSolverConstraints( inSource->nbAxisSolverConstraints )
,CompressedContactSize( inSource->compressedContactSize )
,RequiredContactConstraintMemory( inSource->requiredContactConstraintMemory )
,PeakConstraintMemory( inSource->peakConstraintMemory )
,NbDiscreteContactPairsTotal( inSource->nbDiscreteContactPairsTotal )
,NbDiscreteContactPairsWithCacheHits( inSource->nbDiscreteContactPairsWithCacheHits )
,NbDiscreteContactPairsWithContacts( inSource->nbDiscreteContactPairsWithContacts )
,NbNewPairs( inSource->nbNewPairs )
,NbLostPairs( inSource->nbLostPairs )
,NbNewTouches( inSource->nbNewTouches )
,NbLostTouches( inSource->nbLostTouches )
,NbPartitions( inSource->nbPartitions )
,GpuMemParticles( inSource->gpuMemParticles )
,GpuMemSoftBodies( inSource->gpuMemSoftBodies )
,GpuMemFEMCloths( inSource->gpuMemFEMCloths )
,GpuMemHairSystems( inSource->gpuMemHairSystems )
,GpuMemHeap( inSource->gpuMemHeap )
,GpuMemHeapBroadPhase( inSource->gpuMemHeapBroadPhase )
,GpuMemHeapNarrowPhase( inSource->gpuMemHeapNarrowPhase )
,GpuMemHeapSolver( inSource->gpuMemHeapSolver )
,GpuMemHeapArticulation( inSource->gpuMemHeapArticulation )
,GpuMemHeapSimulation( inSource->gpuMemHeapSimulation )
,GpuMemHeapSimulationArticulation( inSource->gpuMemHeapSimulationArticulation )
,GpuMemHeapSimulationParticles( inSource->gpuMemHeapSimulationParticles )
,GpuMemHeapSimulationSoftBody( inSource->gpuMemHeapSimulationSoftBody )
,GpuMemHeapSimulationFEMCloth( inSource->gpuMemHeapSimulationFEMCloth )
,GpuMemHeapSimulationHairSystem( inSource->gpuMemHeapSimulationHairSystem )
,GpuMemHeapParticles( inSource->gpuMemHeapParticles )
,GpuMemHeapSoftBodies( inSource->gpuMemHeapSoftBodies )
,GpuMemHeapFEMCloths( inSource->gpuMemHeapFEMCloths )
,GpuMemHeapHairSystems( inSource->gpuMemHeapHairSystems )
,GpuMemHeapOther( inSource->gpuMemHeapOther )
,NbBroadPhaseAdds( inSource->nbBroadPhaseAdds )
,NbBroadPhaseRemoves( inSource->nbBroadPhaseRemoves )
{
PX_UNUSED(inSource);
PxMemCopy( NbDiscreteContactPairs, inSource->nbDiscreteContactPairs, sizeof( NbDiscreteContactPairs ) );
PxMemCopy( NbModifiedContactPairs, inSource->nbModifiedContactPairs, sizeof( NbModifiedContactPairs ) );
PxMemCopy( NbCCDPairs, inSource->nbCCDPairs, sizeof( NbCCDPairs ) );
PxMemCopy( NbTriggerPairs, inSource->nbTriggerPairs, sizeof( NbTriggerPairs ) );
PxMemCopy( NbShapes, inSource->nbShapes, sizeof( NbShapes ) );
}
| 154,103 | C++ | 91.443911 | 208 | 0.831859 |
NVIDIA-Omniverse/PhysX/physx/source/physxmetadata/core/include/PvdMetaDataPropertyVisitor.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_META_DATA_PROPERTY_VISITOR_H
#define PX_META_DATA_PROPERTY_VISITOR_H
#include <stdio.h>
#include "PvdMetaDataExtensions.h"
namespace physx
{
namespace Vd
{
//PVD only deals with read-only properties, indexed, and properties like this by in large.
//so we have a filter that expands properties to a level where we can get to them and expands them into
//named functions that make more sense and are easier to read than operator()
template<typename TOperatorType>
struct PvdPropertyFilter
{
private:
PvdPropertyFilter& operator=(const PvdPropertyFilter&);
public:
TOperatorType mOperator;
PxU32* mKeyOverride;
PxU32* mOffsetOverride;
PvdPropertyFilter( TOperatorType& inOperator )
: mOperator( inOperator )
, mKeyOverride( 0 )
, mOffsetOverride( 0 ) {}
PvdPropertyFilter( TOperatorType& inOperator, PxU32* inKeyOverride, PxU32* inOffsetOverride )
: mOperator( inOperator )
, mKeyOverride( inKeyOverride )
, mOffsetOverride( inOffsetOverride ) {}
PvdPropertyFilter( const PvdPropertyFilter& inOther ) : mOperator( inOther.mOperator ), mKeyOverride( inOther.mKeyOverride ), mOffsetOverride( inOther.mOffsetOverride ) {}
template<PxU32 TKey, typename TAccessorType>
void dispatchAccessor( PxU32 inKey, const TAccessorType& inAccessor, bool, bool, bool)
{
mOperator.simpleProperty(inKey, inAccessor );
}
template<PxU32 TKey, typename TAccessorType>
void dispatchAccessor( PxU32 inKey, const TAccessorType& inAccessor, bool, bool, const PxU32ToName* inConversions )
{
mOperator.flagsProperty(inKey, inAccessor, inConversions );
}
template<PxU32 TKey, typename TAccessorType>
void dispatchAccessor( PxU32 inKey, const TAccessorType& inAccessor, const PxU32ToName* inConversions, bool, bool )
{
mOperator.enumProperty( inKey, inAccessor, inConversions );
}
template<PxU32 TKey, typename TAccessorType, typename TInfoType>
void dispatchAccessor(PxU32, const TAccessorType& inAccessor, bool, const TInfoType* inInfo, bool )
{
PxU32 rangeStart = TKey;
PxU32& propIdx = mKeyOverride == NULL ? rangeStart : *mKeyOverride;
mOperator.complexProperty( &propIdx, inAccessor, *inInfo );
}
PxU32 getKeyValue( PxU32 inPropertyKey )
{
PxU32 retval = inPropertyKey;
if ( mKeyOverride )
{
retval = *mKeyOverride;
(*mKeyOverride)++;
}
return retval;
}
void setupValueStructOffset( const ValueStructOffsetRecord&, bool, PxU32* ) {}
void setupValueStructOffset( const ValueStructOffsetRecord& inAccessor, PxU32 inOffset, PxU32* inAdditionalOffset )
{
//This allows us to nest properties correctly.
if ( inAdditionalOffset ) inOffset += *inAdditionalOffset;
inAccessor.setupValueStructOffset( inOffset );
}
template<PxU32 TKey, typename TAccessorType>
void handleAccessor( PxU32 inKey, const TAccessorType& inAccessor )
{
typedef typename TAccessorType::prop_type TPropertyType;
dispatchAccessor<TKey>( inKey
, inAccessor
, PxEnumTraits<TPropertyType>().NameConversion
, PxClassInfoTraits<TPropertyType>().getInfo()
, IsFlagsType<TPropertyType>().FlagData );
}
template<PxU32 TKey, typename TAccessorType>
void handleAccessor( const TAccessorType& inAccessor )
{
setupValueStructOffset( inAccessor, PxPropertyToValueStructMemberMap<TKey>().Offset, mOffsetOverride );
handleAccessor<TKey>( getKeyValue( TKey ), inAccessor );
}
template<PxU32 TKey, typename TObjType, typename TPropertyType>
void operator()( const PxReadOnlyPropertyInfo<TKey,TObjType,TPropertyType>& inProperty, PxU32 )
{
PxPvdReadOnlyPropertyAccessor< TKey, TObjType, TPropertyType > theAccessor( inProperty );
mOperator.pushName( inProperty.mName );
handleAccessor<TKey>( theAccessor );
mOperator.popName();
}
//We don't handle unbounded indexed properties
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType, typename TValueConversionType, typename TInfoType>
void indexedProperty( PxU32, const PxIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropertyType >&, bool, TValueConversionType, const TInfoType& ) {}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType>
void indexedProperty( PxU32, const PxIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropertyType >& inProp, const PxU32ToName* theConversions, const PxUnknownClassInfo& )
{
mOperator.pushName( inProp.mName );
PxU32 rangeStart = TKey;
PxU32& propIdx = mKeyOverride == NULL ? rangeStart : *mKeyOverride;
PxU32 theOffset = 0;
if ( mOffsetOverride ) theOffset = *mOffsetOverride;
while( theConversions->mName != NULL )
{
mOperator.pushBracketedName( theConversions->mName );
PxPvdIndexedPropertyAccessor<TKey, TObjType, TIndexType, TPropertyType> theAccessor( inProp, theConversions->mValue );
setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap<TKey>().Offset, &theOffset );
handleAccessor<TKey>( propIdx, theAccessor );
mOperator.popName();
++propIdx;
++theConversions;
theOffset += sizeof( TPropertyType );
}
mOperator.popName();
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType, typename TInfoType>
void indexedProperty( PxU32, const PxIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropertyType >& inProp, const PxU32ToName* theConversions, const TInfoType& inInfo )
{
//ouch, not nice. Indexed complex property.
mOperator.pushName( inProp.mName );
PxU32 propIdx = TKey;
PxU32 theOffset = 0;
if ( mOffsetOverride ) theOffset = *mOffsetOverride;
while( theConversions->mName != NULL )
{
mOperator.pushBracketedName( theConversions->mName );
PxPvdIndexedPropertyAccessor<TKey, TObjType, TIndexType, TPropertyType> theAccessor( inProp, theConversions->mValue );
setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap<TKey>().Offset, &theOffset );
PX_ASSERT( theAccessor.mHasValidOffset );
mOperator.complexProperty( &propIdx, theAccessor, inInfo );
mOperator.popName();
++theConversions;
theOffset += sizeof( TPropertyType );
}
mOperator.popName();
}
static char* myStrcat(const char* a,const char * b)
{
size_t len = strlen(a)+strlen(b);
char* result = new char[len+1];
strcpy(result,a);
strcat(result,b);
result[len] = 0;
return result;
}
template<PxU32 TKey, typename TObjType, typename TPropertyType, typename TInfoType>
void handleBufferCollectionProperty(PxU32 , const PxBufferCollectionPropertyInfo<TKey, TObjType, TPropertyType >& inProp, const TInfoType& inInfo)
{
//append 'Collection' to buffer properties
char* name = myStrcat(inProp.mName, "Collection");
mOperator.pushName(name);
PxU32 propIdx = TKey;
PxU32 theOffset = 0;
PxBufferCollectionPropertyAccessor<TKey, TObjType, TPropertyType> theAccessor( inProp, inProp.mName );
setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap<TKey>().Offset, &theOffset );
mOperator.bufferCollectionProperty( &propIdx, theAccessor, inInfo );
mOperator.popName();
delete []name;
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType>
void operator()( const PxIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropertyType >& inProp, PxU32 inIndex )
{
indexedProperty( inIndex, inProp, IndexerToNameMap<TKey,TIndexType>().Converter.NameConversion
, PxClassInfoTraits<TPropertyType>().Info );
}
template<PxU32 TKey, typename TObjType, typename TPropertyType, typename TIndexType, typename TInfoType>
void handleExtendedIndexProperty(PxU32 inIndex, const PxExtendedIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropertyType >& inProp, const TInfoType& inInfo)
{
mOperator.pushName(inProp.mName);
PxU32 propIdx = TKey;
PxU32 theOffset = 0;
PxPvdExtendedIndexedPropertyAccessor<TKey, TObjType, TIndexType, TPropertyType> theAccessor( inProp, inIndex );
setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap<TKey>().Offset, &theOffset );
mOperator.extendedIndexedProperty( &propIdx, theAccessor, inInfo );
mOperator.popName();
}
template<PxU32 TKey, typename TObjType, typename TPropertyType, typename TIndexType, typename TInfoType>
void handlePxFixedSizeLookupTableProperty( const PxU32 inIndex, const PxFixedSizeLookupTablePropertyInfo<TKey, TObjType, TIndexType, TPropertyType >& inProp, const TInfoType& inInfo)
{
mOperator.pushName(inProp.mName);
PxU32 propIdx = TKey;
PxU32 theOffset = 0;
PxPvdFixedSizeLookupTablePropertyAccessor<TKey, TObjType, TIndexType, TPropertyType> theAccessor( inProp, inIndex );
setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap<TKey>().Offset, &theOffset );
mOperator.PxFixedSizeLookupTableProperty( &propIdx, theAccessor, inInfo );
mOperator.popName();
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType>
void operator()( const PxExtendedIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropertyType >& inProp, PxU32 inIndex )
{
handleExtendedIndexProperty( inIndex, inProp, PxClassInfoTraits<TPropertyType>().Info );
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType>
void operator()( const PxFixedSizeLookupTablePropertyInfo<TKey, TObjType, TIndexType, TPropertyType >& inProp, PxU32 inIndex)
{
handlePxFixedSizeLookupTableProperty(inIndex, inProp, PxClassInfoTraits<TPropertyType>().Info);
}
//We don't handle unbounded indexed properties
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TIndex2Type, typename TPropertyType, typename TNameConv, typename TNameConv2 >
void dualIndexedProperty( PxU32 idx, const PxDualIndexedPropertyInfo<TKey, TObjType, TIndexType, TIndex2Type, TPropertyType >&, TNameConv, TNameConv2 ) { PX_UNUSED(idx); }
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TIndex2Type, typename TPropertyType>
void dualIndexedProperty( PxU32 /*idx*/, const PxDualIndexedPropertyInfo<TKey, TObjType, TIndexType, TIndex2Type, TPropertyType >& inProp, const PxU32ToName* c1, const PxU32ToName* c2 )
{
mOperator.pushName( inProp.mName );
PxU32 rangeStart = TKey;
PxU32& propIdx = mKeyOverride == NULL ? rangeStart : *mKeyOverride;
PxU32 theOffset = 0;
if ( mOffsetOverride ) theOffset = *mOffsetOverride;
while( c1->mName != NULL )
{
mOperator.pushBracketedName( c1->mName );
const PxU32ToName* c2Idx = c2;
while( c2Idx->mName != NULL )
{
mOperator.pushBracketedName( c2Idx->mName );
PxPvdDualIndexedPropertyAccessor<TKey, TObjType, TIndexType, TIndex2Type, TPropertyType> theAccessor( inProp, c1->mValue, c2Idx->mValue );
setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap<TKey>().Offset, &theOffset );
handleAccessor<TKey>( propIdx, theAccessor );
mOperator.popName();
++propIdx;
++c2Idx;
theOffset += sizeof( TPropertyType );
}
mOperator.popName();
++c1;
}
mOperator.popName();
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TIndex2Type, typename TPropertyType>
void extendedDualIndexedProperty( PxU32 /*idx*/, const PxExtendedDualIndexedPropertyInfo<TKey, TObjType, TIndexType, TIndex2Type, TPropertyType >& inProp, PxU32 id0Count, PxU32 id1Count )
{
mOperator.pushName( inProp.mName );
PxU32 rangeStart = TKey;
PxU32& propIdx = mKeyOverride == NULL ? rangeStart : *mKeyOverride;
PxU32 theOffset = 0;
if ( mOffsetOverride ) theOffset = *mOffsetOverride;
for(PxU32 i = 0; i < id0Count; ++i)
{
char buffer1[32] = { 0 };
sprintf( buffer1, "eId1_%u", i );
mOperator.pushBracketedName( buffer1 );
for(PxU32 j = 0; j < id1Count; ++j)
{
char buffer2[32] = { 0 };
sprintf( buffer2, "eId2_%u", j );
mOperator.pushBracketedName( buffer2 );
PxPvdExtendedDualIndexedPropertyAccessor<TKey, TObjType, TIndexType, TIndex2Type, TPropertyType> theAccessor( inProp, i, j );
setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap<TKey>().Offset, &theOffset );
handleAccessor<TKey>( propIdx, theAccessor );
mOperator.popName();
++propIdx;
theOffset += sizeof( TPropertyType );
}
mOperator.popName();
}
mOperator.popName();
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TIndex2Type, typename TPropertyType>
void operator()( const PxDualIndexedPropertyInfo<TKey, TObjType, TIndexType, TIndex2Type, TPropertyType >& inProp, PxU32 idx )
{
dualIndexedProperty( idx, inProp
, IndexerToNameMap<TKey,TIndexType>().Converter.NameConversion
, IndexerToNameMap<TKey,TIndex2Type>().Converter.NameConversion );
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TIndex2Type, typename TPropertyType>
void operator()( const PxExtendedDualIndexedPropertyInfo<TKey, TObjType, TIndexType, TIndex2Type, TPropertyType >& inProp, PxU32 idx )
{
extendedDualIndexedProperty( idx, inProp, inProp.mId0Count, inProp.mId1Count );
}
template<PxU32 TKey, typename TObjType, typename TPropertyType>
void operator()( const PxRangePropertyInfo<TKey, TObjType, TPropertyType>& inProperty, PxU32 /*idx*/)
{
PxU32 rangeStart = TKey;
PxU32& propIdx = mKeyOverride == NULL ? rangeStart : *mKeyOverride;
PxU32 theOffset = 0;
if ( mOffsetOverride ) theOffset = *mOffsetOverride;
mOperator.pushName( inProperty.mName );
mOperator.pushName( inProperty.mArg0Name );
PxPvdRangePropertyAccessor<TKey, TObjType, TPropertyType> theAccessor( inProperty, true );
setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap<TKey>().Offset, &theOffset );
handleAccessor<TKey>( propIdx, theAccessor );
++propIdx;
theOffset += sizeof( TPropertyType );
mOperator.popName();
mOperator.pushName( inProperty.mArg1Name );
theAccessor.mFirstValue = false;
setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap<TKey>().Offset, &theOffset );
handleAccessor<TKey>( propIdx, theAccessor );
mOperator.popName();
mOperator.popName();
}
template<PxU32 TKey, typename TObjType, typename TPropertyType>
void operator()( const PxBufferCollectionPropertyInfo<TKey, TObjType, TPropertyType>& inProp, PxU32 count )
{
handleBufferCollectionProperty( count, inProp, PxClassInfoTraits<TPropertyType>().Info );
}
template<PxU32 TKey, typename TObjectType, typename TPropertyType, PxU32 TEnableFlag>
void handleBuffer( const PxBufferPropertyInfo<TKey, TObjectType, TPropertyType, TEnableFlag>& inProp )
{
mOperator.handleBuffer( inProp );
}
template<PxU32 TKey, typename TObjectType, typename TPropertyType, PxU32 TEnableFlag>
void operator()( const PxBufferPropertyInfo<TKey, TObjectType, TPropertyType, TEnableFlag>& inProp, PxU32 )
{
handleBuffer( inProp );
}
template<PxU32 TKey, typename TObjType>
void operator()( const PxReadOnlyCollectionPropertyInfo<TKey, TObjType, PxU32>& prop, PxU32 )
{
mOperator.handleCollection( prop );
}
template<PxU32 TKey, typename TObjType>
void operator()( const PxReadOnlyCollectionPropertyInfo<TKey, TObjType, PxReal>& prop, PxU32 )
{
mOperator.handleCollection( prop );
}
template<PxU32 TKey, typename TObjType, typename TPropertyType>
void operator()( const PxWriteOnlyPropertyInfo<TKey,TObjType,TPropertyType>&, PxU32 ) {}
template<PxU32 TKey, typename TObjType, typename TCollectionType>
void operator()( const PxReadOnlyCollectionPropertyInfo<TKey, TObjType, TCollectionType>&, PxU32 ) {}
template<PxU32 TKey, typename TObjType, typename TCollectionType, typename TFilterType>
void operator()( const PxReadOnlyFilteredCollectionPropertyInfo<TKey, TObjType, TCollectionType, TFilterType >&, PxU32 ) {}
//We don't deal with these property datatypes.
#define DEFINE_PVD_PROPERTY_NOP(datatype) \
template<PxU32 TKey, typename TObjType> \
void operator()( const PxReadOnlyPropertyInfo<TKey,TObjType,datatype>& inProperty, PxU32 ){PX_UNUSED(inProperty); }
DEFINE_PVD_PROPERTY_NOP( const void* )
DEFINE_PVD_PROPERTY_NOP( void* )
DEFINE_PVD_PROPERTY_NOP( PxSimulationFilterCallback * )
DEFINE_PVD_PROPERTY_NOP( physx::PxTaskManager * )
DEFINE_PVD_PROPERTY_NOP( PxSimulationFilterShader * )
DEFINE_PVD_PROPERTY_NOP( PxSimulationFilterShader)
DEFINE_PVD_PROPERTY_NOP( PxContactModifyCallback * )
DEFINE_PVD_PROPERTY_NOP( PxCCDContactModifyCallback * )
DEFINE_PVD_PROPERTY_NOP( PxSimulationEventCallback * )
DEFINE_PVD_PROPERTY_NOP( physx::PxCudaContextManager* )
DEFINE_PVD_PROPERTY_NOP( physx::PxCpuDispatcher * )
DEFINE_PVD_PROPERTY_NOP( PxRigidActor )
DEFINE_PVD_PROPERTY_NOP( const PxRigidActor )
DEFINE_PVD_PROPERTY_NOP( PxRigidActor& )
DEFINE_PVD_PROPERTY_NOP( const PxRigidActor& )
DEFINE_PVD_PROPERTY_NOP( PxScene* )
DEFINE_PVD_PROPERTY_NOP( PxConstraint )
DEFINE_PVD_PROPERTY_NOP( PxConstraint* )
DEFINE_PVD_PROPERTY_NOP( PxConstraint& )
DEFINE_PVD_PROPERTY_NOP( const PxConstraint& )
DEFINE_PVD_PROPERTY_NOP( PxAggregate * )
DEFINE_PVD_PROPERTY_NOP( PxArticulationReducedCoordinate&)
DEFINE_PVD_PROPERTY_NOP( const PxArticulationLink * )
DEFINE_PVD_PROPERTY_NOP( const PxRigidDynamic * )
DEFINE_PVD_PROPERTY_NOP( const PxRigidStatic * )
DEFINE_PVD_PROPERTY_NOP( PxArticulationJointReducedCoordinate * )
DEFINE_PVD_PROPERTY_NOP( PxBroadPhaseCallback * )
DEFINE_PVD_PROPERTY_NOP( const PxBroadPhaseRegion * )
DEFINE_PVD_PROPERTY_NOP( PxU32 * )
};
template<typename TOperator>
inline PvdPropertyFilter<TOperator> makePvdPropertyFilter( TOperator inOperator )
{
return PvdPropertyFilter<TOperator>( inOperator );
}
template<typename TOperator>
inline PvdPropertyFilter<TOperator> makePvdPropertyFilter( TOperator inOperator, PxU32* inKey, PxU32* inOffset )
{
return PvdPropertyFilter<TOperator>( inOperator, inKey, inOffset );
}
template<typename TOperator, typename TFuncType>
inline void visitWithPvdFilter( TOperator inOperator, TFuncType inFuncType )
{
PX_UNUSED(inFuncType);
TFuncType( makePvdPropertyFilter( inOperator ) );
}
template<typename TObjType, typename TOperator>
inline void visitInstancePvdProperties( TOperator inOperator )
{
visitInstanceProperties<TObjType>( makePvdPropertyFilter( inOperator ) );
}
template<typename TOperator>
struct PvdAllPropertyVisitor
{
TOperator mOperator;
PvdAllPropertyVisitor( TOperator op ) : mOperator( op ) {}
template<typename TObjectType>
bool operator()( const TObjectType* ) { visitInstancePvdProperties<TObjectType>( mOperator ); return false; }
};
template<typename TOperator>
struct PvdAllInfoVisitor
{
TOperator mOperator;
PvdAllInfoVisitor( TOperator op ) : mOperator( op ) {}
template<typename TInfoType>
void operator()( TInfoType inInfo )
{
inInfo.template visitType<bool>( PvdAllPropertyVisitor<TOperator>( mOperator ) );
inInfo.visitBases( *this );
}
};
template<typename TObjType, typename TOperator>
inline void visitAllPvdProperties( TOperator inOperator )
{
visitAllProperties<TObjType>( makePvdPropertyFilter( inOperator ) );
}
template<typename TOperator>
inline void visitRigidDynamicPerFrameProperties( TOperator inOperator )
{
PvdPropertyFilter<TOperator> theFilter( inOperator );
PxRigidDynamicGeneratedInfo theInfo;
theFilter( theInfo.GlobalPose, 0 );
theFilter( theInfo.LinearVelocity, 1 );
theFilter( theInfo.AngularVelocity, 2 );
theFilter( theInfo.IsSleeping, 3 );
}
template<typename TOperator>
inline void visitArticulationLinkPerFrameProperties( TOperator inOperator )
{
PvdPropertyFilter<TOperator> theFilter( inOperator );
PxArticulationLinkGeneratedInfo theInfo;
theFilter( theInfo.GlobalPose, 0 );
}
}
}
#endif
| 21,250 | C | 38.945489 | 188 | 0.766306 |
NVIDIA-Omniverse/PhysX/physx/source/physxmetadata/core/include/PxAutoGeneratedMetaDataObjectNames.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
// This code is auto-generated by the PhysX Clang metadata generator. Do not edit or be
// prepared for your edits to be quietly ignored next time the clang metadata generator is
// run. You can find the most recent version of clang metadata generator by contacting
// Chris Nuernberger <[email protected]> or Dilip or Adam.
// The source code for the generate was at one time checked into:
// physx/PhysXMetaDataGenerator/llvm/tools/clang/lib/Frontend/PhysXMetaDataAction.cpp
#define THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON
PxPhysics_PropertiesStart,
PxPhysics_TolerancesScale,
PxPhysics_TriangleMeshes,
PxPhysics_TetrahedronMeshes,
PxPhysics_HeightFields,
PxPhysics_ConvexMeshes,
PxPhysics_BVHs,
PxPhysics_Scenes,
PxPhysics_Shapes,
PxPhysics_Materials,
PxPhysics_FEMSoftBodyMaterials,
PxPhysics_FEMClothMaterials,
PxPhysics_PBDMaterials,
PxPhysics_PropertiesStop,
PxRefCounted_PropertiesStart,
PxRefCounted_ReferenceCount,
PxRefCounted_PropertiesStop,
PxBaseMaterial_PropertiesStart,
PxBaseMaterial_UserData,
PxBaseMaterial_PropertiesStop,
PxMaterial_PropertiesStart,
PxMaterial_DynamicFriction,
PxMaterial_StaticFriction,
PxMaterial_Restitution,
PxMaterial_Damping,
PxMaterial_Flags,
PxMaterial_FrictionCombineMode,
PxMaterial_RestitutionCombineMode,
PxMaterial_ConcreteTypeName,
PxMaterial_PropertiesStop,
PxFEMMaterial_PropertiesStart,
PxFEMMaterial_YoungsModulus,
PxFEMMaterial_Poissons,
PxFEMMaterial_DynamicFriction,
PxFEMMaterial_PropertiesStop,
PxFEMSoftBodyMaterial_PropertiesStart,
PxFEMSoftBodyMaterial_Damping,
PxFEMSoftBodyMaterial_DampingScale,
PxFEMSoftBodyMaterial_MaterialModel,
PxFEMSoftBodyMaterial_ConcreteTypeName,
PxFEMSoftBodyMaterial_PropertiesStop,
PxParticleMaterial_PropertiesStart,
PxParticleMaterial_Friction,
PxParticleMaterial_Damping,
PxParticleMaterial_Adhesion,
PxParticleMaterial_GravityScale,
PxParticleMaterial_AdhesionRadiusScale,
PxParticleMaterial_PropertiesStop,
PxPBDMaterial_PropertiesStart,
PxPBDMaterial_Viscosity,
PxPBDMaterial_VorticityConfinement,
PxPBDMaterial_SurfaceTension,
PxPBDMaterial_Cohesion,
PxPBDMaterial_Lift,
PxPBDMaterial_Drag,
PxPBDMaterial_CFLCoefficient,
PxPBDMaterial_ParticleFrictionScale,
PxPBDMaterial_ParticleAdhesionScale,
PxPBDMaterial_ConcreteTypeName,
PxPBDMaterial_PropertiesStop,
PxActor_PropertiesStart,
PxActor_Scene,
PxActor_Name,
PxActor_ActorFlags,
PxActor_DominanceGroup,
PxActor_OwnerClient,
PxActor_Aggregate,
PxActor_UserData,
PxActor_PropertiesStop,
PxRigidActor_PropertiesStart,
PxRigidActor_GlobalPose,
PxRigidActor_Shapes,
PxRigidActor_Constraints,
PxRigidActor_PropertiesStop,
PxRigidBody_PropertiesStart,
PxRigidBody_CMassLocalPose,
PxRigidBody_Mass,
PxRigidBody_InvMass,
PxRigidBody_MassSpaceInertiaTensor,
PxRigidBody_MassSpaceInvInertiaTensor,
PxRigidBody_LinearDamping,
PxRigidBody_AngularDamping,
PxRigidBody_MaxLinearVelocity,
PxRigidBody_MaxAngularVelocity,
PxRigidBody_RigidBodyFlags,
PxRigidBody_MinCCDAdvanceCoefficient,
PxRigidBody_MaxDepenetrationVelocity,
PxRigidBody_MaxContactImpulse,
PxRigidBody_ContactSlopCoefficient,
PxRigidBody_PropertiesStop,
PxRigidDynamic_PropertiesStart,
PxRigidDynamic_IsSleeping,
PxRigidDynamic_SleepThreshold,
PxRigidDynamic_StabilizationThreshold,
PxRigidDynamic_RigidDynamicLockFlags,
PxRigidDynamic_LinearVelocity,
PxRigidDynamic_AngularVelocity,
PxRigidDynamic_WakeCounter,
PxRigidDynamic_SolverIterationCounts,
PxRigidDynamic_ContactReportThreshold,
PxRigidDynamic_ConcreteTypeName,
PxRigidDynamic_PropertiesStop,
PxRigidStatic_PropertiesStart,
PxRigidStatic_ConcreteTypeName,
PxRigidStatic_PropertiesStop,
PxArticulationLink_PropertiesStart,
PxArticulationLink_InboundJoint,
PxArticulationLink_InboundJointDof,
PxArticulationLink_LinkIndex,
PxArticulationLink_Children,
PxArticulationLink_CfmScale,
PxArticulationLink_LinearVelocity,
PxArticulationLink_AngularVelocity,
PxArticulationLink_ConcreteTypeName,
PxArticulationLink_PropertiesStop,
PxArticulationJointReducedCoordinate_PropertiesStart,
PxArticulationJointReducedCoordinate_ParentPose,
PxArticulationJointReducedCoordinate_ChildPose,
PxArticulationJointReducedCoordinate_JointType,
PxArticulationJointReducedCoordinate_Motion,
PxArticulationJointReducedCoordinate_LimitParams,
PxArticulationJointReducedCoordinate_DriveParams,
PxArticulationJointReducedCoordinate_Armature,
PxArticulationJointReducedCoordinate_FrictionCoefficient,
PxArticulationJointReducedCoordinate_MaxJointVelocity,
PxArticulationJointReducedCoordinate_JointPosition,
PxArticulationJointReducedCoordinate_JointVelocity,
PxArticulationJointReducedCoordinate_ConcreteTypeName,
PxArticulationJointReducedCoordinate_UserData,
PxArticulationJointReducedCoordinate_PropertiesStop,
PxArticulationReducedCoordinate_PropertiesStart,
PxArticulationReducedCoordinate_Scene,
PxArticulationReducedCoordinate_SolverIterationCounts,
PxArticulationReducedCoordinate_IsSleeping,
PxArticulationReducedCoordinate_SleepThreshold,
PxArticulationReducedCoordinate_StabilizationThreshold,
PxArticulationReducedCoordinate_WakeCounter,
PxArticulationReducedCoordinate_MaxCOMLinearVelocity,
PxArticulationReducedCoordinate_MaxCOMAngularVelocity,
PxArticulationReducedCoordinate_Links,
PxArticulationReducedCoordinate_Name,
PxArticulationReducedCoordinate_Aggregate,
PxArticulationReducedCoordinate_ArticulationFlags,
PxArticulationReducedCoordinate_RootGlobalPose,
PxArticulationReducedCoordinate_RootLinearVelocity,
PxArticulationReducedCoordinate_RootAngularVelocity,
PxArticulationReducedCoordinate_UserData,
PxArticulationReducedCoordinate_PropertiesStop,
PxAggregate_PropertiesStart,
PxAggregate_MaxNbActors,
PxAggregate_MaxNbShapes,
PxAggregate_Actors,
PxAggregate_SelfCollision,
PxAggregate_ConcreteTypeName,
PxAggregate_UserData,
PxAggregate_PropertiesStop,
PxConstraint_PropertiesStart,
PxConstraint_Scene,
PxConstraint_Actors,
PxConstraint_Flags,
PxConstraint_IsValid,
PxConstraint_BreakForce,
PxConstraint_MinResponseThreshold,
PxConstraint_ConcreteTypeName,
PxConstraint_UserData,
PxConstraint_PropertiesStop,
PxShape_PropertiesStart,
PxShape_LocalPose,
PxShape_SimulationFilterData,
PxShape_QueryFilterData,
PxShape_Materials,
PxShape_ContactOffset,
PxShape_RestOffset,
PxShape_DensityForFluid,
PxShape_TorsionalPatchRadius,
PxShape_MinTorsionalPatchRadius,
PxShape_InternalShapeIndex,
PxShape_Flags,
PxShape_IsExclusive,
PxShape_Name,
PxShape_ConcreteTypeName,
PxShape_UserData,
PxShape_Geom,
PxShape_PropertiesStop,
PxPruningStructure_PropertiesStart,
PxPruningStructure_RigidActors,
PxPruningStructure_StaticMergeData,
PxPruningStructure_DynamicMergeData,
PxPruningStructure_ConcreteTypeName,
PxPruningStructure_PropertiesStop,
PxTolerancesScale_PropertiesStart,
PxTolerancesScale_IsValid,
PxTolerancesScale_Length,
PxTolerancesScale_Speed,
PxTolerancesScale_PropertiesStop,
PxGeometry_PropertiesStart,
PxGeometry_PropertiesStop,
PxBoxGeometry_PropertiesStart,
PxBoxGeometry_HalfExtents,
PxBoxGeometry_PropertiesStop,
PxCapsuleGeometry_PropertiesStart,
PxCapsuleGeometry_Radius,
PxCapsuleGeometry_HalfHeight,
PxCapsuleGeometry_PropertiesStop,
PxMeshScale_PropertiesStart,
PxMeshScale_Scale,
PxMeshScale_Rotation,
PxMeshScale_PropertiesStop,
PxConvexMeshGeometry_PropertiesStart,
PxConvexMeshGeometry_Scale,
PxConvexMeshGeometry_ConvexMesh,
PxConvexMeshGeometry_MeshFlags,
PxConvexMeshGeometry_PropertiesStop,
PxSphereGeometry_PropertiesStart,
PxSphereGeometry_Radius,
PxSphereGeometry_PropertiesStop,
PxPlaneGeometry_PropertiesStart,
PxPlaneGeometry_PropertiesStop,
PxTriangleMeshGeometry_PropertiesStart,
PxTriangleMeshGeometry_Scale,
PxTriangleMeshGeometry_MeshFlags,
PxTriangleMeshGeometry_TriangleMesh,
PxTriangleMeshGeometry_PropertiesStop,
PxHeightFieldGeometry_PropertiesStart,
PxHeightFieldGeometry_HeightField,
PxHeightFieldGeometry_HeightScale,
PxHeightFieldGeometry_RowScale,
PxHeightFieldGeometry_ColumnScale,
PxHeightFieldGeometry_HeightFieldFlags,
PxHeightFieldGeometry_PropertiesStop,
PxSceneQuerySystemBase_PropertiesStart,
PxSceneQuerySystemBase_DynamicTreeRebuildRateHint,
PxSceneQuerySystemBase_UpdateMode,
PxSceneQuerySystemBase_StaticTimestamp,
PxSceneQuerySystemBase_PropertiesStop,
PxSceneSQSystem_PropertiesStart,
PxSceneSQSystem_SceneQueryUpdateMode,
PxSceneSQSystem_SceneQueryStaticTimestamp,
PxSceneSQSystem_StaticStructure,
PxSceneSQSystem_DynamicStructure,
PxSceneSQSystem_PropertiesStop,
PxScene_PropertiesStart,
PxScene_Flags,
PxScene_Limits,
PxScene_Timestamp,
PxScene_Name,
PxScene_Actors,
PxScene_SoftBodies,
PxScene_Articulations,
PxScene_Constraints,
PxScene_Aggregates,
PxScene_CpuDispatcher,
PxScene_CudaContextManager,
PxScene_SimulationEventCallback,
PxScene_ContactModifyCallback,
PxScene_CCDContactModifyCallback,
PxScene_BroadPhaseCallback,
PxScene_FilterShaderDataSize,
PxScene_FilterShader,
PxScene_FilterCallback,
PxScene_KinematicKinematicFilteringMode,
PxScene_StaticKinematicFilteringMode,
PxScene_Gravity,
PxScene_BounceThresholdVelocity,
PxScene_CCDMaxPasses,
PxScene_CCDMaxSeparation,
PxScene_CCDThreshold,
PxScene_MaxBiasCoefficient,
PxScene_FrictionOffsetThreshold,
PxScene_FrictionCorrelationDistance,
PxScene_FrictionType,
PxScene_SolverType,
PxScene_VisualizationCullingBox,
PxScene_BroadPhaseType,
PxScene_BroadPhaseRegions,
PxScene_TaskManager,
PxScene_NbContactDataBlocks,
PxScene_MaxNbContactDataBlocksUsed,
PxScene_ContactReportStreamBufferSize,
PxScene_SolverBatchSize,
PxScene_SolverArticulationBatchSize,
PxScene_WakeCounterResetValue,
PxScene_GpuDynamicsConfig,
PxScene_UserData,
PxScene_SimulationStatistics,
PxScene_PropertiesStop,
PxTetrahedronMeshGeometry_PropertiesStart,
PxTetrahedronMeshGeometry_TetrahedronMesh,
PxTetrahedronMeshGeometry_PropertiesStop,
PxCustomGeometry_PropertiesStart,
PxCustomGeometry_CustomType,
PxCustomGeometry_PropertiesStop,
PxHeightFieldDesc_PropertiesStart,
PxHeightFieldDesc_NbRows,
PxHeightFieldDesc_NbColumns,
PxHeightFieldDesc_Format,
PxHeightFieldDesc_Samples,
PxHeightFieldDesc_ConvexEdgeThreshold,
PxHeightFieldDesc_Flags,
PxHeightFieldDesc_PropertiesStop,
PxArticulationLimit_PropertiesStart,
PxArticulationLimit_Low,
PxArticulationLimit_High,
PxArticulationLimit_PropertiesStop,
PxArticulationDrive_PropertiesStart,
PxArticulationDrive_Stiffness,
PxArticulationDrive_Damping,
PxArticulationDrive_MaxForce,
PxArticulationDrive_DriveType,
PxArticulationDrive_PropertiesStop,
PxSceneQueryDesc_PropertiesStart,
PxSceneQueryDesc_IsValid,
PxSceneQueryDesc_StaticStructure,
PxSceneQueryDesc_DynamicStructure,
PxSceneQueryDesc_DynamicTreeRebuildRateHint,
PxSceneQueryDesc_DynamicTreeSecondaryPruner,
PxSceneQueryDesc_StaticBVHBuildStrategy,
PxSceneQueryDesc_DynamicBVHBuildStrategy,
PxSceneQueryDesc_StaticNbObjectsPerNode,
PxSceneQueryDesc_DynamicNbObjectsPerNode,
PxSceneQueryDesc_SceneQueryUpdateMode,
PxSceneQueryDesc_PropertiesStop,
PxSceneDesc_PropertiesStart,
PxSceneDesc_ToDefault,
PxSceneDesc_Gravity,
PxSceneDesc_SimulationEventCallback,
PxSceneDesc_ContactModifyCallback,
PxSceneDesc_CcdContactModifyCallback,
PxSceneDesc_FilterShaderData,
PxSceneDesc_FilterShaderDataSize,
PxSceneDesc_FilterShader,
PxSceneDesc_FilterCallback,
PxSceneDesc_KineKineFilteringMode,
PxSceneDesc_StaticKineFilteringMode,
PxSceneDesc_BroadPhaseType,
PxSceneDesc_BroadPhaseCallback,
PxSceneDesc_Limits,
PxSceneDesc_FrictionType,
PxSceneDesc_SolverType,
PxSceneDesc_BounceThresholdVelocity,
PxSceneDesc_FrictionOffsetThreshold,
PxSceneDesc_FrictionCorrelationDistance,
PxSceneDesc_Flags,
PxSceneDesc_CpuDispatcher,
PxSceneDesc_CudaContextManager,
PxSceneDesc_UserData,
PxSceneDesc_SolverBatchSize,
PxSceneDesc_SolverArticulationBatchSize,
PxSceneDesc_NbContactDataBlocks,
PxSceneDesc_MaxNbContactDataBlocks,
PxSceneDesc_MaxBiasCoefficient,
PxSceneDesc_ContactReportStreamBufferSize,
PxSceneDesc_CcdMaxPasses,
PxSceneDesc_CcdThreshold,
PxSceneDesc_CcdMaxSeparation,
PxSceneDesc_WakeCounterResetValue,
PxSceneDesc_SanityBounds,
PxSceneDesc_GpuDynamicsConfig,
PxSceneDesc_GpuMaxNumPartitions,
PxSceneDesc_GpuMaxNumStaticPartitions,
PxSceneDesc_GpuComputeVersion,
PxSceneDesc_ContactPairSlabSize,
PxSceneDesc_PropertiesStop,
PxBroadPhaseDesc_PropertiesStart,
PxBroadPhaseDesc_IsValid,
PxBroadPhaseDesc_MType,
PxBroadPhaseDesc_MContextID,
PxBroadPhaseDesc_MContextManager,
PxBroadPhaseDesc_MFoundLostPairsCapacity,
PxBroadPhaseDesc_MDiscardStaticVsKinematic,
PxBroadPhaseDesc_MDiscardKinematicVsKinematic,
PxBroadPhaseDesc_PropertiesStop,
PxSceneLimits_PropertiesStart,
PxSceneLimits_MaxNbActors,
PxSceneLimits_MaxNbBodies,
PxSceneLimits_MaxNbStaticShapes,
PxSceneLimits_MaxNbDynamicShapes,
PxSceneLimits_MaxNbAggregates,
PxSceneLimits_MaxNbConstraints,
PxSceneLimits_MaxNbRegions,
PxSceneLimits_MaxNbBroadPhaseOverlaps,
PxSceneLimits_PropertiesStop,
PxgDynamicsMemoryConfig_PropertiesStart,
PxgDynamicsMemoryConfig_IsValid,
PxgDynamicsMemoryConfig_TempBufferCapacity,
PxgDynamicsMemoryConfig_MaxRigidContactCount,
PxgDynamicsMemoryConfig_MaxRigidPatchCount,
PxgDynamicsMemoryConfig_HeapCapacity,
PxgDynamicsMemoryConfig_FoundLostPairsCapacity,
PxgDynamicsMemoryConfig_FoundLostAggregatePairsCapacity,
PxgDynamicsMemoryConfig_TotalAggregatePairsCapacity,
PxgDynamicsMemoryConfig_MaxSoftBodyContacts,
PxgDynamicsMemoryConfig_MaxFemClothContacts,
PxgDynamicsMemoryConfig_MaxParticleContacts,
PxgDynamicsMemoryConfig_CollisionStackSize,
PxgDynamicsMemoryConfig_MaxHairContacts,
PxgDynamicsMemoryConfig_PropertiesStop,
PxSimulationStatistics_PropertiesStart,
PxSimulationStatistics_NbActiveConstraints,
PxSimulationStatistics_NbActiveDynamicBodies,
PxSimulationStatistics_NbActiveKinematicBodies,
PxSimulationStatistics_NbStaticBodies,
PxSimulationStatistics_NbDynamicBodies,
PxSimulationStatistics_NbKinematicBodies,
PxSimulationStatistics_NbAggregates,
PxSimulationStatistics_NbArticulations,
PxSimulationStatistics_NbAxisSolverConstraints,
PxSimulationStatistics_CompressedContactSize,
PxSimulationStatistics_RequiredContactConstraintMemory,
PxSimulationStatistics_PeakConstraintMemory,
PxSimulationStatistics_NbDiscreteContactPairsTotal,
PxSimulationStatistics_NbDiscreteContactPairsWithCacheHits,
PxSimulationStatistics_NbDiscreteContactPairsWithContacts,
PxSimulationStatistics_NbNewPairs,
PxSimulationStatistics_NbLostPairs,
PxSimulationStatistics_NbNewTouches,
PxSimulationStatistics_NbLostTouches,
PxSimulationStatistics_NbPartitions,
PxSimulationStatistics_GpuMemParticles,
PxSimulationStatistics_GpuMemSoftBodies,
PxSimulationStatistics_GpuMemFEMCloths,
PxSimulationStatistics_GpuMemHairSystems,
PxSimulationStatistics_GpuMemHeap,
PxSimulationStatistics_GpuMemHeapBroadPhase,
PxSimulationStatistics_GpuMemHeapNarrowPhase,
PxSimulationStatistics_GpuMemHeapSolver,
PxSimulationStatistics_GpuMemHeapArticulation,
PxSimulationStatistics_GpuMemHeapSimulation,
PxSimulationStatistics_GpuMemHeapSimulationArticulation,
PxSimulationStatistics_GpuMemHeapSimulationParticles,
PxSimulationStatistics_GpuMemHeapSimulationSoftBody,
PxSimulationStatistics_GpuMemHeapSimulationFEMCloth,
PxSimulationStatistics_GpuMemHeapSimulationHairSystem,
PxSimulationStatistics_GpuMemHeapParticles,
PxSimulationStatistics_GpuMemHeapSoftBodies,
PxSimulationStatistics_GpuMemHeapFEMCloths,
PxSimulationStatistics_GpuMemHeapHairSystems,
PxSimulationStatistics_GpuMemHeapOther,
PxSimulationStatistics_NbBroadPhaseAdds,
PxSimulationStatistics_NbBroadPhaseRemoves,
PxSimulationStatistics_NbDiscreteContactPairs,
PxSimulationStatistics_NbModifiedContactPairs,
PxSimulationStatistics_NbCCDPairs,
PxSimulationStatistics_NbTriggerPairs,
PxSimulationStatistics_NbShapes,
PxSimulationStatistics_PropertiesStop,
#undef THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON
| 17,181 | C | 34.353909 | 90 | 0.891799 |
NVIDIA-Omniverse/PhysX/physx/source/physxmetadata/core/include/PxAutoGeneratedMetaDataObjects.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
// This code is auto-generated by the PhysX Clang metadata generator. Do not edit or be
// prepared for your edits to be quietly ignored next time the clang metadata generator is
// run. You can find the most recent version of clang metadata generator by contacting
// Chris Nuernberger <[email protected]> or Dilip or Adam.
// The source code for the generate was at one time checked into:
// physx/PhysXMetaDataGenerator/llvm/tools/clang/lib/Frontend/PhysXMetaDataAction.cpp
#define THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON
#define PX_PROPERTY_INFO_NAME PxPropertyInfoName
static PxU32ToName g_physx__PxShapeFlag__EnumConversion[] = {
{ "eSIMULATION_SHAPE", static_cast<PxU32>( physx::PxShapeFlag::eSIMULATION_SHAPE ) },
{ "eSCENE_QUERY_SHAPE", static_cast<PxU32>( physx::PxShapeFlag::eSCENE_QUERY_SHAPE ) },
{ "eTRIGGER_SHAPE", static_cast<PxU32>( physx::PxShapeFlag::eTRIGGER_SHAPE ) },
{ "eVISUALIZATION", static_cast<PxU32>( physx::PxShapeFlag::eVISUALIZATION ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxShapeFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxShapeFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxPhysics;
struct PxPhysicsGeneratedValues
{
PxTolerancesScale TolerancesScale;
PX_PHYSX_CORE_API PxPhysicsGeneratedValues( const PxPhysics* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPhysics, TolerancesScale, PxPhysicsGeneratedValues)
struct PxPhysicsGeneratedInfo
{
static const char* getClassName() { return "PxPhysics"; }
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxPhysics_TolerancesScale, PxPhysics, const PxTolerancesScale > TolerancesScale;
PxFactoryCollectionPropertyInfo<PX_PROPERTY_INFO_NAME::PxPhysics_TriangleMeshes, PxPhysics, PxTriangleMesh *, PxInputStream & > TriangleMeshes;
PxFactoryCollectionPropertyInfo<PX_PROPERTY_INFO_NAME::PxPhysics_TetrahedronMeshes, PxPhysics, PxTetrahedronMesh *, PxInputStream & > TetrahedronMeshes;
PxFactoryCollectionPropertyInfo<PX_PROPERTY_INFO_NAME::PxPhysics_HeightFields, PxPhysics, PxHeightField *, PxInputStream & > HeightFields;
PxFactoryCollectionPropertyInfo<PX_PROPERTY_INFO_NAME::PxPhysics_ConvexMeshes, PxPhysics, PxConvexMesh *, PxInputStream & > ConvexMeshes;
PxFactoryCollectionPropertyInfo<PX_PROPERTY_INFO_NAME::PxPhysics_BVHs, PxPhysics, PxBVH *, PxInputStream & > BVHs;
PxFactoryCollectionPropertyInfo<PX_PROPERTY_INFO_NAME::PxPhysics_Scenes, PxPhysics, PxScene *, const PxSceneDesc & > Scenes;
PxReadOnlyCollectionPropertyInfo<PX_PROPERTY_INFO_NAME::PxPhysics_Shapes, PxPhysics, PxShape * > Shapes;
PxReadOnlyCollectionPropertyInfo<PX_PROPERTY_INFO_NAME::PxPhysics_Materials, PxPhysics, PxMaterial * > Materials;
PxReadOnlyCollectionPropertyInfo<PX_PROPERTY_INFO_NAME::PxPhysics_FEMSoftBodyMaterials, PxPhysics, PxFEMSoftBodyMaterial * > FEMSoftBodyMaterials;
PxReadOnlyCollectionPropertyInfo<PX_PROPERTY_INFO_NAME::PxPhysics_FEMClothMaterials, PxPhysics, PxFEMClothMaterial * > FEMClothMaterials;
PxReadOnlyCollectionPropertyInfo<PX_PROPERTY_INFO_NAME::PxPhysics_PBDMaterials, PxPhysics, PxPBDMaterial * > PBDMaterials;
PX_PHYSX_CORE_API PxPhysicsGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxPhysics*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 12; }
static PxU32 totalPropertyCount() { return instancePropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( TolerancesScale, inStartIndex + 0 );;
inOperator( TriangleMeshes, inStartIndex + 1 );;
inOperator( TetrahedronMeshes, inStartIndex + 2 );;
inOperator( HeightFields, inStartIndex + 3 );;
inOperator( ConvexMeshes, inStartIndex + 4 );;
inOperator( BVHs, inStartIndex + 5 );;
inOperator( Scenes, inStartIndex + 6 );;
inOperator( Shapes, inStartIndex + 7 );;
inOperator( Materials, inStartIndex + 8 );;
inOperator( FEMSoftBodyMaterials, inStartIndex + 9 );;
inOperator( FEMClothMaterials, inStartIndex + 10 );;
inOperator( PBDMaterials, inStartIndex + 11 );;
return 12 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxPhysics>
{
PxPhysicsGeneratedInfo Info;
const PxPhysicsGeneratedInfo* getInfo() { return &Info; }
};
class PxRefCounted;
struct PxRefCountedGeneratedValues
{
PxU32 ReferenceCount;
PX_PHYSX_CORE_API PxRefCountedGeneratedValues( const PxRefCounted* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRefCounted, ReferenceCount, PxRefCountedGeneratedValues)
struct PxRefCountedGeneratedInfo
{
static const char* getClassName() { return "PxRefCounted"; }
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxRefCounted_ReferenceCount, PxRefCounted, PxU32 > ReferenceCount;
PX_PHYSX_CORE_API PxRefCountedGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxRefCounted*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 1; }
static PxU32 totalPropertyCount() { return instancePropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( ReferenceCount, inStartIndex + 0 );;
return 1 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxRefCounted>
{
PxRefCountedGeneratedInfo Info;
const PxRefCountedGeneratedInfo* getInfo() { return &Info; }
};
class PxBaseMaterial;
struct PxBaseMaterialGeneratedValues
: PxRefCountedGeneratedValues {
void * UserData;
PX_PHYSX_CORE_API PxBaseMaterialGeneratedValues( const PxBaseMaterial* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxBaseMaterial, UserData, PxBaseMaterialGeneratedValues)
struct PxBaseMaterialGeneratedInfo
: PxRefCountedGeneratedInfo
{
static const char* getClassName() { return "PxBaseMaterial"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxBaseMaterial_UserData, PxBaseMaterial, void *, void * > UserData;
PX_PHYSX_CORE_API PxBaseMaterialGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxBaseMaterial*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxRefCountedGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxRefCountedGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxRefCountedGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 1; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxRefCountedGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( UserData, inStartIndex + 0 );;
return 1 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxBaseMaterial>
{
PxBaseMaterialGeneratedInfo Info;
const PxBaseMaterialGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxMaterialFlag__EnumConversion[] = {
{ "eDISABLE_FRICTION", static_cast<PxU32>( physx::PxMaterialFlag::eDISABLE_FRICTION ) },
{ "eDISABLE_STRONG_FRICTION", static_cast<PxU32>( physx::PxMaterialFlag::eDISABLE_STRONG_FRICTION ) },
{ "eIMPROVED_PATCH_FRICTION", static_cast<PxU32>( physx::PxMaterialFlag::eIMPROVED_PATCH_FRICTION ) },
{ "eCOMPLIANT_CONTACT", static_cast<PxU32>( physx::PxMaterialFlag::eCOMPLIANT_CONTACT ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxMaterialFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxMaterialFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
static PxU32ToName g_physx__PxCombineMode__EnumConversion[] = {
{ "eAVERAGE", static_cast<PxU32>( physx::PxCombineMode::eAVERAGE ) },
{ "eMIN", static_cast<PxU32>( physx::PxCombineMode::eMIN ) },
{ "eMULTIPLY", static_cast<PxU32>( physx::PxCombineMode::eMULTIPLY ) },
{ "eMAX", static_cast<PxU32>( physx::PxCombineMode::eMAX ) },
{ "eN_VALUES", static_cast<PxU32>( physx::PxCombineMode::eN_VALUES ) },
{ "ePAD_32", static_cast<PxU32>( physx::PxCombineMode::ePAD_32 ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxCombineMode::Enum > { PxEnumTraits() : NameConversion( g_physx__PxCombineMode__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxMaterial;
struct PxMaterialGeneratedValues
: PxBaseMaterialGeneratedValues {
PxReal DynamicFriction;
PxReal StaticFriction;
PxReal Restitution;
PxReal Damping;
PxMaterialFlags Flags;
PxCombineMode::Enum FrictionCombineMode;
PxCombineMode::Enum RestitutionCombineMode;
const char * ConcreteTypeName;
PX_PHYSX_CORE_API PxMaterialGeneratedValues( const PxMaterial* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxMaterial, DynamicFriction, PxMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxMaterial, StaticFriction, PxMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxMaterial, Restitution, PxMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxMaterial, Damping, PxMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxMaterial, Flags, PxMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxMaterial, FrictionCombineMode, PxMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxMaterial, RestitutionCombineMode, PxMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxMaterial, ConcreteTypeName, PxMaterialGeneratedValues)
struct PxMaterialGeneratedInfo
: PxBaseMaterialGeneratedInfo
{
static const char* getClassName() { return "PxMaterial"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxMaterial_DynamicFriction, PxMaterial, PxReal, PxReal > DynamicFriction;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxMaterial_StaticFriction, PxMaterial, PxReal, PxReal > StaticFriction;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxMaterial_Restitution, PxMaterial, PxReal, PxReal > Restitution;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxMaterial_Damping, PxMaterial, PxReal, PxReal > Damping;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxMaterial_Flags, PxMaterial, PxMaterialFlags, PxMaterialFlags > Flags;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxMaterial_FrictionCombineMode, PxMaterial, PxCombineMode::Enum, PxCombineMode::Enum > FrictionCombineMode;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxMaterial_RestitutionCombineMode, PxMaterial, PxCombineMode::Enum, PxCombineMode::Enum > RestitutionCombineMode;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxMaterial_ConcreteTypeName, PxMaterial, const char * > ConcreteTypeName;
PX_PHYSX_CORE_API PxMaterialGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxMaterial*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxBaseMaterialGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxBaseMaterialGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxBaseMaterialGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 8; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxBaseMaterialGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( DynamicFriction, inStartIndex + 0 );;
inOperator( StaticFriction, inStartIndex + 1 );;
inOperator( Restitution, inStartIndex + 2 );;
inOperator( Damping, inStartIndex + 3 );;
inOperator( Flags, inStartIndex + 4 );;
inOperator( FrictionCombineMode, inStartIndex + 5 );;
inOperator( RestitutionCombineMode, inStartIndex + 6 );;
inOperator( ConcreteTypeName, inStartIndex + 7 );;
return 8 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxMaterial>
{
PxMaterialGeneratedInfo Info;
const PxMaterialGeneratedInfo* getInfo() { return &Info; }
};
class PxFEMMaterial;
struct PxFEMMaterialGeneratedValues
: PxBaseMaterialGeneratedValues {
PxReal YoungsModulus;
PxReal Poissons;
PxReal DynamicFriction;
PX_PHYSX_CORE_API PxFEMMaterialGeneratedValues( const PxFEMMaterial* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxFEMMaterial, YoungsModulus, PxFEMMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxFEMMaterial, Poissons, PxFEMMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxFEMMaterial, DynamicFriction, PxFEMMaterialGeneratedValues)
struct PxFEMMaterialGeneratedInfo
: PxBaseMaterialGeneratedInfo
{
static const char* getClassName() { return "PxFEMMaterial"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxFEMMaterial_YoungsModulus, PxFEMMaterial, PxReal, PxReal > YoungsModulus;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxFEMMaterial_Poissons, PxFEMMaterial, PxReal, PxReal > Poissons;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxFEMMaterial_DynamicFriction, PxFEMMaterial, PxReal, PxReal > DynamicFriction;
PX_PHYSX_CORE_API PxFEMMaterialGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxFEMMaterial*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxBaseMaterialGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxBaseMaterialGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxBaseMaterialGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 3; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxBaseMaterialGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( YoungsModulus, inStartIndex + 0 );;
inOperator( Poissons, inStartIndex + 1 );;
inOperator( DynamicFriction, inStartIndex + 2 );;
return 3 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxFEMMaterial>
{
PxFEMMaterialGeneratedInfo Info;
const PxFEMMaterialGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxFEMSoftBodyMaterialModel__EnumConversion[] = {
{ "eCO_ROTATIONAL", static_cast<PxU32>( physx::PxFEMSoftBodyMaterialModel::eCO_ROTATIONAL ) },
{ "eNEO_HOOKEAN", static_cast<PxU32>( physx::PxFEMSoftBodyMaterialModel::eNEO_HOOKEAN ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxFEMSoftBodyMaterialModel::Enum > { PxEnumTraits() : NameConversion( g_physx__PxFEMSoftBodyMaterialModel__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxFEMSoftBodyMaterial;
struct PxFEMSoftBodyMaterialGeneratedValues
: PxFEMMaterialGeneratedValues {
PxReal Damping;
PxReal DampingScale;
PxFEMSoftBodyMaterialModel::Enum MaterialModel;
const char * ConcreteTypeName;
PX_PHYSX_CORE_API PxFEMSoftBodyMaterialGeneratedValues( const PxFEMSoftBodyMaterial* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxFEMSoftBodyMaterial, Damping, PxFEMSoftBodyMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxFEMSoftBodyMaterial, DampingScale, PxFEMSoftBodyMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxFEMSoftBodyMaterial, MaterialModel, PxFEMSoftBodyMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxFEMSoftBodyMaterial, ConcreteTypeName, PxFEMSoftBodyMaterialGeneratedValues)
struct PxFEMSoftBodyMaterialGeneratedInfo
: PxFEMMaterialGeneratedInfo
{
static const char* getClassName() { return "PxFEMSoftBodyMaterial"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxFEMSoftBodyMaterial_Damping, PxFEMSoftBodyMaterial, PxReal, PxReal > Damping;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxFEMSoftBodyMaterial_DampingScale, PxFEMSoftBodyMaterial, PxReal, PxReal > DampingScale;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxFEMSoftBodyMaterial_MaterialModel, PxFEMSoftBodyMaterial, PxFEMSoftBodyMaterialModel::Enum, PxFEMSoftBodyMaterialModel::Enum > MaterialModel;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxFEMSoftBodyMaterial_ConcreteTypeName, PxFEMSoftBodyMaterial, const char * > ConcreteTypeName;
PX_PHYSX_CORE_API PxFEMSoftBodyMaterialGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxFEMSoftBodyMaterial*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxFEMMaterialGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxFEMMaterialGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxFEMMaterialGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 4; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxFEMMaterialGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Damping, inStartIndex + 0 );;
inOperator( DampingScale, inStartIndex + 1 );;
inOperator( MaterialModel, inStartIndex + 2 );;
inOperator( ConcreteTypeName, inStartIndex + 3 );;
return 4 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxFEMSoftBodyMaterial>
{
PxFEMSoftBodyMaterialGeneratedInfo Info;
const PxFEMSoftBodyMaterialGeneratedInfo* getInfo() { return &Info; }
};
class PxParticleMaterial;
struct PxParticleMaterialGeneratedValues
: PxBaseMaterialGeneratedValues {
PxReal Friction;
PxReal Damping;
PxReal Adhesion;
PxReal GravityScale;
PxReal AdhesionRadiusScale;
PX_PHYSX_CORE_API PxParticleMaterialGeneratedValues( const PxParticleMaterial* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxParticleMaterial, Friction, PxParticleMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxParticleMaterial, Damping, PxParticleMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxParticleMaterial, Adhesion, PxParticleMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxParticleMaterial, GravityScale, PxParticleMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxParticleMaterial, AdhesionRadiusScale, PxParticleMaterialGeneratedValues)
struct PxParticleMaterialGeneratedInfo
: PxBaseMaterialGeneratedInfo
{
static const char* getClassName() { return "PxParticleMaterial"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxParticleMaterial_Friction, PxParticleMaterial, PxReal, PxReal > Friction;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxParticleMaterial_Damping, PxParticleMaterial, PxReal, PxReal > Damping;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxParticleMaterial_Adhesion, PxParticleMaterial, PxReal, PxReal > Adhesion;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxParticleMaterial_GravityScale, PxParticleMaterial, PxReal, PxReal > GravityScale;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxParticleMaterial_AdhesionRadiusScale, PxParticleMaterial, PxReal, PxReal > AdhesionRadiusScale;
PX_PHYSX_CORE_API PxParticleMaterialGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxParticleMaterial*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxBaseMaterialGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxBaseMaterialGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxBaseMaterialGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 5; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxBaseMaterialGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Friction, inStartIndex + 0 );;
inOperator( Damping, inStartIndex + 1 );;
inOperator( Adhesion, inStartIndex + 2 );;
inOperator( GravityScale, inStartIndex + 3 );;
inOperator( AdhesionRadiusScale, inStartIndex + 4 );;
return 5 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxParticleMaterial>
{
PxParticleMaterialGeneratedInfo Info;
const PxParticleMaterialGeneratedInfo* getInfo() { return &Info; }
};
class PxPBDMaterial;
struct PxPBDMaterialGeneratedValues
: PxParticleMaterialGeneratedValues {
PxReal Viscosity;
PxReal VorticityConfinement;
PxReal SurfaceTension;
PxReal Cohesion;
PxReal Lift;
PxReal Drag;
PxReal CFLCoefficient;
PxReal ParticleFrictionScale;
PxReal ParticleAdhesionScale;
const char * ConcreteTypeName;
PX_PHYSX_CORE_API PxPBDMaterialGeneratedValues( const PxPBDMaterial* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPBDMaterial, Viscosity, PxPBDMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPBDMaterial, VorticityConfinement, PxPBDMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPBDMaterial, SurfaceTension, PxPBDMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPBDMaterial, Cohesion, PxPBDMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPBDMaterial, Lift, PxPBDMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPBDMaterial, Drag, PxPBDMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPBDMaterial, CFLCoefficient, PxPBDMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPBDMaterial, ParticleFrictionScale, PxPBDMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPBDMaterial, ParticleAdhesionScale, PxPBDMaterialGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPBDMaterial, ConcreteTypeName, PxPBDMaterialGeneratedValues)
struct PxPBDMaterialGeneratedInfo
: PxParticleMaterialGeneratedInfo
{
static const char* getClassName() { return "PxPBDMaterial"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxPBDMaterial_Viscosity, PxPBDMaterial, PxReal, PxReal > Viscosity;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxPBDMaterial_VorticityConfinement, PxPBDMaterial, PxReal, PxReal > VorticityConfinement;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxPBDMaterial_SurfaceTension, PxPBDMaterial, PxReal, PxReal > SurfaceTension;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxPBDMaterial_Cohesion, PxPBDMaterial, PxReal, PxReal > Cohesion;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxPBDMaterial_Lift, PxPBDMaterial, PxReal, PxReal > Lift;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxPBDMaterial_Drag, PxPBDMaterial, PxReal, PxReal > Drag;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxPBDMaterial_CFLCoefficient, PxPBDMaterial, PxReal, PxReal > CFLCoefficient;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxPBDMaterial_ParticleFrictionScale, PxPBDMaterial, PxReal, PxReal > ParticleFrictionScale;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxPBDMaterial_ParticleAdhesionScale, PxPBDMaterial, PxReal, PxReal > ParticleAdhesionScale;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxPBDMaterial_ConcreteTypeName, PxPBDMaterial, const char * > ConcreteTypeName;
PX_PHYSX_CORE_API PxPBDMaterialGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxPBDMaterial*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxParticleMaterialGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxParticleMaterialGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxParticleMaterialGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 10; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxParticleMaterialGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Viscosity, inStartIndex + 0 );;
inOperator( VorticityConfinement, inStartIndex + 1 );;
inOperator( SurfaceTension, inStartIndex + 2 );;
inOperator( Cohesion, inStartIndex + 3 );;
inOperator( Lift, inStartIndex + 4 );;
inOperator( Drag, inStartIndex + 5 );;
inOperator( CFLCoefficient, inStartIndex + 6 );;
inOperator( ParticleFrictionScale, inStartIndex + 7 );;
inOperator( ParticleAdhesionScale, inStartIndex + 8 );;
inOperator( ConcreteTypeName, inStartIndex + 9 );;
return 10 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxPBDMaterial>
{
PxPBDMaterialGeneratedInfo Info;
const PxPBDMaterialGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxActorType__EnumConversion[] = {
{ "eRIGID_STATIC", static_cast<PxU32>( physx::PxActorType::eRIGID_STATIC ) },
{ "eRIGID_DYNAMIC", static_cast<PxU32>( physx::PxActorType::eRIGID_DYNAMIC ) },
{ "eARTICULATION_LINK", static_cast<PxU32>( physx::PxActorType::eARTICULATION_LINK ) },
{ "eSOFTBODY", static_cast<PxU32>( physx::PxActorType::eSOFTBODY ) },
{ "eFEMCLOTH", static_cast<PxU32>( physx::PxActorType::eFEMCLOTH ) },
{ "ePBD_PARTICLESYSTEM", static_cast<PxU32>( physx::PxActorType::ePBD_PARTICLESYSTEM ) },
{ "eFLIP_PARTICLESYSTEM", static_cast<PxU32>( physx::PxActorType::eFLIP_PARTICLESYSTEM ) },
{ "eMPM_PARTICLESYSTEM", static_cast<PxU32>( physx::PxActorType::eMPM_PARTICLESYSTEM ) },
{ "eHAIRSYSTEM", static_cast<PxU32>( physx::PxActorType::eHAIRSYSTEM ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxActorType::Enum > { PxEnumTraits() : NameConversion( g_physx__PxActorType__EnumConversion ) {} const PxU32ToName* NameConversion; };
static PxU32ToName g_physx__PxActorFlag__EnumConversion[] = {
{ "eVISUALIZATION", static_cast<PxU32>( physx::PxActorFlag::eVISUALIZATION ) },
{ "eDISABLE_GRAVITY", static_cast<PxU32>( physx::PxActorFlag::eDISABLE_GRAVITY ) },
{ "eSEND_SLEEP_NOTIFIES", static_cast<PxU32>( physx::PxActorFlag::eSEND_SLEEP_NOTIFIES ) },
{ "eDISABLE_SIMULATION", static_cast<PxU32>( physx::PxActorFlag::eDISABLE_SIMULATION ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxActorFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxActorFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxActor;
struct PxActorGeneratedValues
{
PxScene * Scene;
const char * Name;
PxActorFlags ActorFlags;
PxDominanceGroup DominanceGroup;
PxClientID OwnerClient;
PxAggregate * Aggregate;
void * UserData;
PX_PHYSX_CORE_API PxActorGeneratedValues( const PxActor* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxActor, Scene, PxActorGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxActor, Name, PxActorGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxActor, ActorFlags, PxActorGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxActor, DominanceGroup, PxActorGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxActor, OwnerClient, PxActorGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxActor, Aggregate, PxActorGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxActor, UserData, PxActorGeneratedValues)
struct PxActorGeneratedInfo
{
static const char* getClassName() { return "PxActor"; }
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxActor_Scene, PxActor, PxScene * > Scene;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxActor_Name, PxActor, const char *, const char * > Name;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxActor_ActorFlags, PxActor, PxActorFlags, PxActorFlags > ActorFlags;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxActor_DominanceGroup, PxActor, PxDominanceGroup, PxDominanceGroup > DominanceGroup;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxActor_OwnerClient, PxActor, PxClientID, PxClientID > OwnerClient;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxActor_Aggregate, PxActor, PxAggregate * > Aggregate;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxActor_UserData, PxActor, void *, void * > UserData;
PX_PHYSX_CORE_API PxActorGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxActor*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 7; }
static PxU32 totalPropertyCount() { return instancePropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Scene, inStartIndex + 0 );;
inOperator( Name, inStartIndex + 1 );;
inOperator( ActorFlags, inStartIndex + 2 );;
inOperator( DominanceGroup, inStartIndex + 3 );;
inOperator( OwnerClient, inStartIndex + 4 );;
inOperator( Aggregate, inStartIndex + 5 );;
inOperator( UserData, inStartIndex + 6 );;
return 7 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxActor>
{
PxActorGeneratedInfo Info;
const PxActorGeneratedInfo* getInfo() { return &Info; }
};
class PxRigidActor;
struct PxRigidActorGeneratedValues
: PxActorGeneratedValues {
PxTransform GlobalPose;
PX_PHYSX_CORE_API PxRigidActorGeneratedValues( const PxRigidActor* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidActor, GlobalPose, PxRigidActorGeneratedValues)
struct PxRigidActorGeneratedInfo
: PxActorGeneratedInfo
{
static const char* getClassName() { return "PxRigidActor"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidActor_GlobalPose, PxRigidActor, const PxTransform &, PxTransform > GlobalPose;
PxRigidActorShapeCollection Shapes;
PxReadOnlyCollectionPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidActor_Constraints, PxRigidActor, PxConstraint * > Constraints;
PX_PHYSX_CORE_API PxRigidActorGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxRigidActor*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxActorGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxActorGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxActorGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 3; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxActorGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( GlobalPose, inStartIndex + 0 );;
inOperator( Shapes, inStartIndex + 1 );;
inOperator( Constraints, inStartIndex + 2 );;
return 3 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxRigidActor>
{
PxRigidActorGeneratedInfo Info;
const PxRigidActorGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxForceMode__EnumConversion[] = {
{ "eFORCE", static_cast<PxU32>( physx::PxForceMode::eFORCE ) },
{ "eIMPULSE", static_cast<PxU32>( physx::PxForceMode::eIMPULSE ) },
{ "eVELOCITY_CHANGE", static_cast<PxU32>( physx::PxForceMode::eVELOCITY_CHANGE ) },
{ "eACCELERATION", static_cast<PxU32>( physx::PxForceMode::eACCELERATION ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxForceMode::Enum > { PxEnumTraits() : NameConversion( g_physx__PxForceMode__EnumConversion ) {} const PxU32ToName* NameConversion; };
static PxU32ToName g_physx__PxRigidBodyFlag__EnumConversion[] = {
{ "eKINEMATIC", static_cast<PxU32>( physx::PxRigidBodyFlag::eKINEMATIC ) },
{ "eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES", static_cast<PxU32>( physx::PxRigidBodyFlag::eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES ) },
{ "eENABLE_CCD", static_cast<PxU32>( physx::PxRigidBodyFlag::eENABLE_CCD ) },
{ "eENABLE_CCD_FRICTION", static_cast<PxU32>( physx::PxRigidBodyFlag::eENABLE_CCD_FRICTION ) },
{ "eENABLE_SPECULATIVE_CCD", static_cast<PxU32>( physx::PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD ) },
{ "eENABLE_POSE_INTEGRATION_PREVIEW", static_cast<PxU32>( physx::PxRigidBodyFlag::eENABLE_POSE_INTEGRATION_PREVIEW ) },
{ "eENABLE_CCD_MAX_CONTACT_IMPULSE", static_cast<PxU32>( physx::PxRigidBodyFlag::eENABLE_CCD_MAX_CONTACT_IMPULSE ) },
{ "eRETAIN_ACCELERATIONS", static_cast<PxU32>( physx::PxRigidBodyFlag::eRETAIN_ACCELERATIONS ) },
{ "eFORCE_KINE_KINE_NOTIFICATIONS", static_cast<PxU32>( physx::PxRigidBodyFlag::eFORCE_KINE_KINE_NOTIFICATIONS ) },
{ "eFORCE_STATIC_KINE_NOTIFICATIONS", static_cast<PxU32>( physx::PxRigidBodyFlag::eFORCE_STATIC_KINE_NOTIFICATIONS ) },
{ "eENABLE_GYROSCOPIC_FORCES", static_cast<PxU32>( physx::PxRigidBodyFlag::eENABLE_GYROSCOPIC_FORCES ) },
{ "eRESERVED", static_cast<PxU32>( physx::PxRigidBodyFlag::eRESERVED ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxRigidBodyFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxRigidBodyFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxRigidBody;
struct PxRigidBodyGeneratedValues
: PxRigidActorGeneratedValues {
PxTransform CMassLocalPose;
PxReal Mass;
PxReal InvMass;
PxVec3 MassSpaceInertiaTensor;
PxVec3 MassSpaceInvInertiaTensor;
PxReal LinearDamping;
PxReal AngularDamping;
PxReal MaxLinearVelocity;
PxReal MaxAngularVelocity;
PxRigidBodyFlags RigidBodyFlags;
PxReal MinCCDAdvanceCoefficient;
PxReal MaxDepenetrationVelocity;
PxReal MaxContactImpulse;
PxReal ContactSlopCoefficient;
PX_PHYSX_CORE_API PxRigidBodyGeneratedValues( const PxRigidBody* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, CMassLocalPose, PxRigidBodyGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, Mass, PxRigidBodyGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, InvMass, PxRigidBodyGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, MassSpaceInertiaTensor, PxRigidBodyGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, MassSpaceInvInertiaTensor, PxRigidBodyGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, LinearDamping, PxRigidBodyGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, AngularDamping, PxRigidBodyGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, MaxLinearVelocity, PxRigidBodyGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, MaxAngularVelocity, PxRigidBodyGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, RigidBodyFlags, PxRigidBodyGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, MinCCDAdvanceCoefficient, PxRigidBodyGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, MaxDepenetrationVelocity, PxRigidBodyGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, MaxContactImpulse, PxRigidBodyGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, ContactSlopCoefficient, PxRigidBodyGeneratedValues)
struct PxRigidBodyGeneratedInfo
: PxRigidActorGeneratedInfo
{
static const char* getClassName() { return "PxRigidBody"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidBody_CMassLocalPose, PxRigidBody, const PxTransform &, PxTransform > CMassLocalPose;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidBody_Mass, PxRigidBody, PxReal, PxReal > Mass;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidBody_InvMass, PxRigidBody, PxReal > InvMass;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidBody_MassSpaceInertiaTensor, PxRigidBody, const PxVec3 &, PxVec3 > MassSpaceInertiaTensor;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidBody_MassSpaceInvInertiaTensor, PxRigidBody, PxVec3 > MassSpaceInvInertiaTensor;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidBody_LinearDamping, PxRigidBody, PxReal, PxReal > LinearDamping;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidBody_AngularDamping, PxRigidBody, PxReal, PxReal > AngularDamping;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidBody_MaxLinearVelocity, PxRigidBody, PxReal, PxReal > MaxLinearVelocity;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidBody_MaxAngularVelocity, PxRigidBody, PxReal, PxReal > MaxAngularVelocity;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidBody_RigidBodyFlags, PxRigidBody, PxRigidBodyFlags, PxRigidBodyFlags > RigidBodyFlags;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidBody_MinCCDAdvanceCoefficient, PxRigidBody, PxReal, PxReal > MinCCDAdvanceCoefficient;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidBody_MaxDepenetrationVelocity, PxRigidBody, PxReal, PxReal > MaxDepenetrationVelocity;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidBody_MaxContactImpulse, PxRigidBody, PxReal, PxReal > MaxContactImpulse;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidBody_ContactSlopCoefficient, PxRigidBody, PxReal, PxReal > ContactSlopCoefficient;
PX_PHYSX_CORE_API PxRigidBodyGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxRigidBody*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxRigidActorGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxRigidActorGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxRigidActorGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 14; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxRigidActorGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( CMassLocalPose, inStartIndex + 0 );;
inOperator( Mass, inStartIndex + 1 );;
inOperator( InvMass, inStartIndex + 2 );;
inOperator( MassSpaceInertiaTensor, inStartIndex + 3 );;
inOperator( MassSpaceInvInertiaTensor, inStartIndex + 4 );;
inOperator( LinearDamping, inStartIndex + 5 );;
inOperator( AngularDamping, inStartIndex + 6 );;
inOperator( MaxLinearVelocity, inStartIndex + 7 );;
inOperator( MaxAngularVelocity, inStartIndex + 8 );;
inOperator( RigidBodyFlags, inStartIndex + 9 );;
inOperator( MinCCDAdvanceCoefficient, inStartIndex + 10 );;
inOperator( MaxDepenetrationVelocity, inStartIndex + 11 );;
inOperator( MaxContactImpulse, inStartIndex + 12 );;
inOperator( ContactSlopCoefficient, inStartIndex + 13 );;
return 14 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxRigidBody>
{
PxRigidBodyGeneratedInfo Info;
const PxRigidBodyGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxRigidDynamicLockFlag__EnumConversion[] = {
{ "eLOCK_LINEAR_X", static_cast<PxU32>( physx::PxRigidDynamicLockFlag::eLOCK_LINEAR_X ) },
{ "eLOCK_LINEAR_Y", static_cast<PxU32>( physx::PxRigidDynamicLockFlag::eLOCK_LINEAR_Y ) },
{ "eLOCK_LINEAR_Z", static_cast<PxU32>( physx::PxRigidDynamicLockFlag::eLOCK_LINEAR_Z ) },
{ "eLOCK_ANGULAR_X", static_cast<PxU32>( physx::PxRigidDynamicLockFlag::eLOCK_ANGULAR_X ) },
{ "eLOCK_ANGULAR_Y", static_cast<PxU32>( physx::PxRigidDynamicLockFlag::eLOCK_ANGULAR_Y ) },
{ "eLOCK_ANGULAR_Z", static_cast<PxU32>( physx::PxRigidDynamicLockFlag::eLOCK_ANGULAR_Z ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxRigidDynamicLockFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxRigidDynamicLockFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxRigidDynamic;
struct PxRigidDynamicGeneratedValues
: PxRigidBodyGeneratedValues {
_Bool IsSleeping;
PxReal SleepThreshold;
PxReal StabilizationThreshold;
PxRigidDynamicLockFlags RigidDynamicLockFlags;
PxVec3 LinearVelocity;
PxVec3 AngularVelocity;
PxReal WakeCounter;
PxU32 SolverIterationCounts[2];
PxReal ContactReportThreshold;
const char * ConcreteTypeName;
PX_PHYSX_CORE_API PxRigidDynamicGeneratedValues( const PxRigidDynamic* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidDynamic, IsSleeping, PxRigidDynamicGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidDynamic, SleepThreshold, PxRigidDynamicGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidDynamic, StabilizationThreshold, PxRigidDynamicGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidDynamic, RigidDynamicLockFlags, PxRigidDynamicGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidDynamic, LinearVelocity, PxRigidDynamicGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidDynamic, AngularVelocity, PxRigidDynamicGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidDynamic, WakeCounter, PxRigidDynamicGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidDynamic, SolverIterationCounts, PxRigidDynamicGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidDynamic, ContactReportThreshold, PxRigidDynamicGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidDynamic, ConcreteTypeName, PxRigidDynamicGeneratedValues)
struct PxRigidDynamicGeneratedInfo
: PxRigidBodyGeneratedInfo
{
static const char* getClassName() { return "PxRigidDynamic"; }
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidDynamic_IsSleeping, PxRigidDynamic, _Bool > IsSleeping;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidDynamic_SleepThreshold, PxRigidDynamic, PxReal, PxReal > SleepThreshold;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidDynamic_StabilizationThreshold, PxRigidDynamic, PxReal, PxReal > StabilizationThreshold;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidDynamic_RigidDynamicLockFlags, PxRigidDynamic, PxRigidDynamicLockFlags, PxRigidDynamicLockFlags > RigidDynamicLockFlags;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidDynamic_LinearVelocity, PxRigidDynamic, const PxVec3 &, PxVec3 > LinearVelocity;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidDynamic_AngularVelocity, PxRigidDynamic, const PxVec3 &, PxVec3 > AngularVelocity;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidDynamic_WakeCounter, PxRigidDynamic, PxReal, PxReal > WakeCounter;
PxRangePropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidDynamic_SolverIterationCounts, PxRigidDynamic, PxU32 > SolverIterationCounts;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidDynamic_ContactReportThreshold, PxRigidDynamic, PxReal, PxReal > ContactReportThreshold;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidDynamic_ConcreteTypeName, PxRigidDynamic, const char * > ConcreteTypeName;
PX_PHYSX_CORE_API PxRigidDynamicGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxRigidDynamic*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxRigidBodyGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxRigidBodyGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxRigidBodyGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 10; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxRigidBodyGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( IsSleeping, inStartIndex + 0 );;
inOperator( SleepThreshold, inStartIndex + 1 );;
inOperator( StabilizationThreshold, inStartIndex + 2 );;
inOperator( RigidDynamicLockFlags, inStartIndex + 3 );;
inOperator( LinearVelocity, inStartIndex + 4 );;
inOperator( AngularVelocity, inStartIndex + 5 );;
inOperator( WakeCounter, inStartIndex + 6 );;
inOperator( SolverIterationCounts, inStartIndex + 7 );;
inOperator( ContactReportThreshold, inStartIndex + 8 );;
inOperator( ConcreteTypeName, inStartIndex + 9 );;
return 10 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxRigidDynamic>
{
PxRigidDynamicGeneratedInfo Info;
const PxRigidDynamicGeneratedInfo* getInfo() { return &Info; }
};
class PxRigidStatic;
struct PxRigidStaticGeneratedValues
: PxRigidActorGeneratedValues {
const char * ConcreteTypeName;
PX_PHYSX_CORE_API PxRigidStaticGeneratedValues( const PxRigidStatic* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidStatic, ConcreteTypeName, PxRigidStaticGeneratedValues)
struct PxRigidStaticGeneratedInfo
: PxRigidActorGeneratedInfo
{
static const char* getClassName() { return "PxRigidStatic"; }
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxRigidStatic_ConcreteTypeName, PxRigidStatic, const char * > ConcreteTypeName;
PX_PHYSX_CORE_API PxRigidStaticGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxRigidStatic*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxRigidActorGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxRigidActorGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxRigidActorGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 1; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxRigidActorGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( ConcreteTypeName, inStartIndex + 0 );;
return 1 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxRigidStatic>
{
PxRigidStaticGeneratedInfo Info;
const PxRigidStaticGeneratedInfo* getInfo() { return &Info; }
};
class PxArticulationLink;
struct PxArticulationLinkGeneratedValues
: PxRigidBodyGeneratedValues {
PxArticulationJointReducedCoordinate * InboundJoint;
PxU32 InboundJointDof;
PxU32 LinkIndex;
PxReal CfmScale;
PxVec3 LinearVelocity;
PxVec3 AngularVelocity;
const char * ConcreteTypeName;
PX_PHYSX_CORE_API PxArticulationLinkGeneratedValues( const PxArticulationLink* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationLink, InboundJoint, PxArticulationLinkGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationLink, InboundJointDof, PxArticulationLinkGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationLink, LinkIndex, PxArticulationLinkGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationLink, CfmScale, PxArticulationLinkGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationLink, LinearVelocity, PxArticulationLinkGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationLink, AngularVelocity, PxArticulationLinkGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationLink, ConcreteTypeName, PxArticulationLinkGeneratedValues)
struct PxArticulationLinkGeneratedInfo
: PxRigidBodyGeneratedInfo
{
static const char* getClassName() { return "PxArticulationLink"; }
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationLink_InboundJoint, PxArticulationLink, PxArticulationJointReducedCoordinate * > InboundJoint;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationLink_InboundJointDof, PxArticulationLink, PxU32 > InboundJointDof;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationLink_LinkIndex, PxArticulationLink, PxU32 > LinkIndex;
PxReadOnlyCollectionPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationLink_Children, PxArticulationLink, PxArticulationLink * > Children;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationLink_CfmScale, PxArticulationLink, const PxReal, PxReal > CfmScale;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationLink_LinearVelocity, PxArticulationLink, PxVec3 > LinearVelocity;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationLink_AngularVelocity, PxArticulationLink, PxVec3 > AngularVelocity;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationLink_ConcreteTypeName, PxArticulationLink, const char * > ConcreteTypeName;
PX_PHYSX_CORE_API PxArticulationLinkGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxArticulationLink*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxRigidBodyGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxRigidBodyGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxRigidBodyGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 8; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxRigidBodyGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( InboundJoint, inStartIndex + 0 );;
inOperator( InboundJointDof, inStartIndex + 1 );;
inOperator( LinkIndex, inStartIndex + 2 );;
inOperator( Children, inStartIndex + 3 );;
inOperator( CfmScale, inStartIndex + 4 );;
inOperator( LinearVelocity, inStartIndex + 5 );;
inOperator( AngularVelocity, inStartIndex + 6 );;
inOperator( ConcreteTypeName, inStartIndex + 7 );;
return 8 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxArticulationLink>
{
PxArticulationLinkGeneratedInfo Info;
const PxArticulationLinkGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxArticulationJointType__EnumConversion[] = {
{ "eFIX", static_cast<PxU32>( physx::PxArticulationJointType::eFIX ) },
{ "ePRISMATIC", static_cast<PxU32>( physx::PxArticulationJointType::ePRISMATIC ) },
{ "eREVOLUTE", static_cast<PxU32>( physx::PxArticulationJointType::eREVOLUTE ) },
{ "eREVOLUTE_UNWRAPPED", static_cast<PxU32>( physx::PxArticulationJointType::eREVOLUTE_UNWRAPPED ) },
{ "eSPHERICAL", static_cast<PxU32>( physx::PxArticulationJointType::eSPHERICAL ) },
{ "eUNDEFINED", static_cast<PxU32>( physx::PxArticulationJointType::eUNDEFINED ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxArticulationJointType::Enum > { PxEnumTraits() : NameConversion( g_physx__PxArticulationJointType__EnumConversion ) {} const PxU32ToName* NameConversion; };
static PxU32ToName g_physx__PxArticulationAxis__EnumConversion[] = {
{ "eTWIST", static_cast<PxU32>( physx::PxArticulationAxis::eTWIST ) },
{ "eSWING1", static_cast<PxU32>( physx::PxArticulationAxis::eSWING1 ) },
{ "eSWING2", static_cast<PxU32>( physx::PxArticulationAxis::eSWING2 ) },
{ "eX", static_cast<PxU32>( physx::PxArticulationAxis::eX ) },
{ "eY", static_cast<PxU32>( physx::PxArticulationAxis::eY ) },
{ "eZ", static_cast<PxU32>( physx::PxArticulationAxis::eZ ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxArticulationAxis::Enum > { PxEnumTraits() : NameConversion( g_physx__PxArticulationAxis__EnumConversion ) {} const PxU32ToName* NameConversion; };
static PxU32ToName g_physx__PxArticulationMotion__EnumConversion[] = {
{ "eLOCKED", static_cast<PxU32>( physx::PxArticulationMotion::eLOCKED ) },
{ "eLIMITED", static_cast<PxU32>( physx::PxArticulationMotion::eLIMITED ) },
{ "eFREE", static_cast<PxU32>( physx::PxArticulationMotion::eFREE ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxArticulationMotion::Enum > { PxEnumTraits() : NameConversion( g_physx__PxArticulationMotion__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxArticulationJointReducedCoordinate;
struct PxArticulationJointReducedCoordinateGeneratedValues
{
PxTransform ParentPose;
PxTransform ChildPose;
PxArticulationJointType::Enum JointType;
PxArticulationMotion::Enum Motion[physx::PxArticulationAxis::eCOUNT];
PxArticulationLimit LimitParams[physx::PxArticulationAxis::eCOUNT];
PxArticulationDrive DriveParams[physx::PxArticulationAxis::eCOUNT];
PxReal Armature[physx::PxArticulationAxis::eCOUNT];
PxReal FrictionCoefficient;
PxReal MaxJointVelocity;
PxReal JointPosition[physx::PxArticulationAxis::eCOUNT];
PxReal JointVelocity[physx::PxArticulationAxis::eCOUNT];
const char * ConcreteTypeName;
void * UserData;
PX_PHYSX_CORE_API PxArticulationJointReducedCoordinateGeneratedValues( const PxArticulationJointReducedCoordinate* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, ParentPose, PxArticulationJointReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, ChildPose, PxArticulationJointReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, JointType, PxArticulationJointReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, Motion, PxArticulationJointReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, LimitParams, PxArticulationJointReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, DriveParams, PxArticulationJointReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, Armature, PxArticulationJointReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, FrictionCoefficient, PxArticulationJointReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, MaxJointVelocity, PxArticulationJointReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, JointPosition, PxArticulationJointReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, JointVelocity, PxArticulationJointReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, ConcreteTypeName, PxArticulationJointReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, UserData, PxArticulationJointReducedCoordinateGeneratedValues)
struct PxArticulationJointReducedCoordinateGeneratedInfo
{
static const char* getClassName() { return "PxArticulationJointReducedCoordinate"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationJointReducedCoordinate_ParentPose, PxArticulationJointReducedCoordinate, const PxTransform &, PxTransform > ParentPose;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationJointReducedCoordinate_ChildPose, PxArticulationJointReducedCoordinate, const PxTransform &, PxTransform > ChildPose;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationJointReducedCoordinate_JointType, PxArticulationJointReducedCoordinate, PxArticulationJointType::Enum, PxArticulationJointType::Enum > JointType;
PxIndexedPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationJointReducedCoordinate_Motion, PxArticulationJointReducedCoordinate, PxArticulationAxis::Enum, PxArticulationMotion::Enum > Motion;
PxIndexedPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationJointReducedCoordinate_LimitParams, PxArticulationJointReducedCoordinate, PxArticulationAxis::Enum, PxArticulationLimit > LimitParams;
PxIndexedPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationJointReducedCoordinate_DriveParams, PxArticulationJointReducedCoordinate, PxArticulationAxis::Enum, PxArticulationDrive > DriveParams;
PxIndexedPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationJointReducedCoordinate_Armature, PxArticulationJointReducedCoordinate, PxArticulationAxis::Enum, PxReal > Armature;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationJointReducedCoordinate_FrictionCoefficient, PxArticulationJointReducedCoordinate, const PxReal, PxReal > FrictionCoefficient;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationJointReducedCoordinate_MaxJointVelocity, PxArticulationJointReducedCoordinate, const PxReal, PxReal > MaxJointVelocity;
PxIndexedPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationJointReducedCoordinate_JointPosition, PxArticulationJointReducedCoordinate, PxArticulationAxis::Enum, PxReal > JointPosition;
PxIndexedPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationJointReducedCoordinate_JointVelocity, PxArticulationJointReducedCoordinate, PxArticulationAxis::Enum, PxReal > JointVelocity;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationJointReducedCoordinate_ConcreteTypeName, PxArticulationJointReducedCoordinate, const char * > ConcreteTypeName;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationJointReducedCoordinate_UserData, PxArticulationJointReducedCoordinate, void *, void * > UserData;
PX_PHYSX_CORE_API PxArticulationJointReducedCoordinateGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxArticulationJointReducedCoordinate*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 13; }
static PxU32 totalPropertyCount() { return instancePropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( ParentPose, inStartIndex + 0 );;
inOperator( ChildPose, inStartIndex + 1 );;
inOperator( JointType, inStartIndex + 2 );;
inOperator( Motion, inStartIndex + 3 );;
inOperator( LimitParams, inStartIndex + 4 );;
inOperator( DriveParams, inStartIndex + 5 );;
inOperator( Armature, inStartIndex + 6 );;
inOperator( FrictionCoefficient, inStartIndex + 7 );;
inOperator( MaxJointVelocity, inStartIndex + 8 );;
inOperator( JointPosition, inStartIndex + 9 );;
inOperator( JointVelocity, inStartIndex + 10 );;
inOperator( ConcreteTypeName, inStartIndex + 11 );;
inOperator( UserData, inStartIndex + 12 );;
return 13 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxArticulationJointReducedCoordinate>
{
PxArticulationJointReducedCoordinateGeneratedInfo Info;
const PxArticulationJointReducedCoordinateGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxArticulationFlag__EnumConversion[] = {
{ "eFIX_BASE", static_cast<PxU32>( physx::PxArticulationFlag::eFIX_BASE ) },
{ "eDRIVE_LIMITS_ARE_FORCES", static_cast<PxU32>( physx::PxArticulationFlag::eDRIVE_LIMITS_ARE_FORCES ) },
{ "eDISABLE_SELF_COLLISION", static_cast<PxU32>( physx::PxArticulationFlag::eDISABLE_SELF_COLLISION ) },
{ "eCOMPUTE_JOINT_FORCES", static_cast<PxU32>( physx::PxArticulationFlag::eCOMPUTE_JOINT_FORCES ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxArticulationFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxArticulationFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
static PxU32ToName g_physx__PxArticulationCacheFlag__EnumConversion[] = {
{ "eVELOCITY", static_cast<PxU32>( physx::PxArticulationCacheFlag::eVELOCITY ) },
{ "eACCELERATION", static_cast<PxU32>( physx::PxArticulationCacheFlag::eACCELERATION ) },
{ "ePOSITION", static_cast<PxU32>( physx::PxArticulationCacheFlag::ePOSITION ) },
{ "eFORCE", static_cast<PxU32>( physx::PxArticulationCacheFlag::eFORCE ) },
{ "eLINK_VELOCITY", static_cast<PxU32>( physx::PxArticulationCacheFlag::eLINK_VELOCITY ) },
{ "eLINK_ACCELERATION", static_cast<PxU32>( physx::PxArticulationCacheFlag::eLINK_ACCELERATION ) },
{ "eROOT_TRANSFORM", static_cast<PxU32>( physx::PxArticulationCacheFlag::eROOT_TRANSFORM ) },
{ "eROOT_VELOCITIES", static_cast<PxU32>( physx::PxArticulationCacheFlag::eROOT_VELOCITIES ) },
{ "eSENSOR_FORCES", static_cast<PxU32>( physx::PxArticulationCacheFlag::eSENSOR_FORCES ) },
{ "eJOINT_SOLVER_FORCES", static_cast<PxU32>( physx::PxArticulationCacheFlag::eJOINT_SOLVER_FORCES ) },
{ "eLINK_INCOMING_JOINT_FORCE", static_cast<PxU32>( physx::PxArticulationCacheFlag::eLINK_INCOMING_JOINT_FORCE ) },
{ "eJOINT_TARGET_POSITIONS", static_cast<PxU32>( physx::PxArticulationCacheFlag::eJOINT_TARGET_POSITIONS ) },
{ "eJOINT_TARGET_VELOCITIES", static_cast<PxU32>( physx::PxArticulationCacheFlag::eJOINT_TARGET_VELOCITIES ) },
{ "eALL", static_cast<PxU32>( physx::PxArticulationCacheFlag::eALL ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxArticulationCacheFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxArticulationCacheFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxArticulationReducedCoordinate;
struct PxArticulationReducedCoordinateGeneratedValues
{
PxScene * Scene;
PxU32 SolverIterationCounts[2];
_Bool IsSleeping;
PxReal SleepThreshold;
PxReal StabilizationThreshold;
PxReal WakeCounter;
PxReal MaxCOMLinearVelocity;
PxReal MaxCOMAngularVelocity;
const char * Name;
PxAggregate * Aggregate;
PxArticulationFlags ArticulationFlags;
PxTransform RootGlobalPose;
PxVec3 RootLinearVelocity;
PxVec3 RootAngularVelocity;
void * UserData;
PX_PHYSX_CORE_API PxArticulationReducedCoordinateGeneratedValues( const PxArticulationReducedCoordinate* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, Scene, PxArticulationReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, SolverIterationCounts, PxArticulationReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, IsSleeping, PxArticulationReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, SleepThreshold, PxArticulationReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, StabilizationThreshold, PxArticulationReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, WakeCounter, PxArticulationReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, MaxCOMLinearVelocity, PxArticulationReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, MaxCOMAngularVelocity, PxArticulationReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, Name, PxArticulationReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, Aggregate, PxArticulationReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, ArticulationFlags, PxArticulationReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, RootGlobalPose, PxArticulationReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, RootLinearVelocity, PxArticulationReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, RootAngularVelocity, PxArticulationReducedCoordinateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, UserData, PxArticulationReducedCoordinateGeneratedValues)
struct PxArticulationReducedCoordinateGeneratedInfo
{
static const char* getClassName() { return "PxArticulationReducedCoordinate"; }
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationReducedCoordinate_Scene, PxArticulationReducedCoordinate, PxScene * > Scene;
PxRangePropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationReducedCoordinate_SolverIterationCounts, PxArticulationReducedCoordinate, PxU32 > SolverIterationCounts;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationReducedCoordinate_IsSleeping, PxArticulationReducedCoordinate, _Bool > IsSleeping;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationReducedCoordinate_SleepThreshold, PxArticulationReducedCoordinate, PxReal, PxReal > SleepThreshold;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationReducedCoordinate_StabilizationThreshold, PxArticulationReducedCoordinate, PxReal, PxReal > StabilizationThreshold;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationReducedCoordinate_WakeCounter, PxArticulationReducedCoordinate, PxReal, PxReal > WakeCounter;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationReducedCoordinate_MaxCOMLinearVelocity, PxArticulationReducedCoordinate, const PxReal, PxReal > MaxCOMLinearVelocity;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationReducedCoordinate_MaxCOMAngularVelocity, PxArticulationReducedCoordinate, const PxReal, PxReal > MaxCOMAngularVelocity;
PxArticulationLinkCollectionProp Links;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationReducedCoordinate_Name, PxArticulationReducedCoordinate, const char *, const char * > Name;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationReducedCoordinate_Aggregate, PxArticulationReducedCoordinate, PxAggregate * > Aggregate;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationReducedCoordinate_ArticulationFlags, PxArticulationReducedCoordinate, PxArticulationFlags, PxArticulationFlags > ArticulationFlags;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationReducedCoordinate_RootGlobalPose, PxArticulationReducedCoordinate, const PxTransform &, PxTransform > RootGlobalPose;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationReducedCoordinate_RootLinearVelocity, PxArticulationReducedCoordinate, const PxVec3 &, PxVec3 > RootLinearVelocity;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationReducedCoordinate_RootAngularVelocity, PxArticulationReducedCoordinate, const PxVec3 &, PxVec3 > RootAngularVelocity;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationReducedCoordinate_UserData, PxArticulationReducedCoordinate, void *, void * > UserData;
PX_PHYSX_CORE_API PxArticulationReducedCoordinateGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxArticulationReducedCoordinate*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 16; }
static PxU32 totalPropertyCount() { return instancePropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Scene, inStartIndex + 0 );;
inOperator( SolverIterationCounts, inStartIndex + 1 );;
inOperator( IsSleeping, inStartIndex + 2 );;
inOperator( SleepThreshold, inStartIndex + 3 );;
inOperator( StabilizationThreshold, inStartIndex + 4 );;
inOperator( WakeCounter, inStartIndex + 5 );;
inOperator( MaxCOMLinearVelocity, inStartIndex + 6 );;
inOperator( MaxCOMAngularVelocity, inStartIndex + 7 );;
inOperator( Links, inStartIndex + 8 );;
inOperator( Name, inStartIndex + 9 );;
inOperator( Aggregate, inStartIndex + 10 );;
inOperator( ArticulationFlags, inStartIndex + 11 );;
inOperator( RootGlobalPose, inStartIndex + 12 );;
inOperator( RootLinearVelocity, inStartIndex + 13 );;
inOperator( RootAngularVelocity, inStartIndex + 14 );;
inOperator( UserData, inStartIndex + 15 );;
return 16 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxArticulationReducedCoordinate>
{
PxArticulationReducedCoordinateGeneratedInfo Info;
const PxArticulationReducedCoordinateGeneratedInfo* getInfo() { return &Info; }
};
class PxAggregate;
struct PxAggregateGeneratedValues
{
PxU32 MaxNbActors;
PxU32 MaxNbShapes;
_Bool SelfCollision;
const char * ConcreteTypeName;
void * UserData;
PX_PHYSX_CORE_API PxAggregateGeneratedValues( const PxAggregate* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxAggregate, MaxNbActors, PxAggregateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxAggregate, MaxNbShapes, PxAggregateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxAggregate, SelfCollision, PxAggregateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxAggregate, ConcreteTypeName, PxAggregateGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxAggregate, UserData, PxAggregateGeneratedValues)
struct PxAggregateGeneratedInfo
{
static const char* getClassName() { return "PxAggregate"; }
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxAggregate_MaxNbActors, PxAggregate, PxU32 > MaxNbActors;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxAggregate_MaxNbShapes, PxAggregate, PxU32 > MaxNbShapes;
PxReadOnlyCollectionPropertyInfo<PX_PROPERTY_INFO_NAME::PxAggregate_Actors, PxAggregate, PxActor * > Actors;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxAggregate_SelfCollision, PxAggregate, _Bool > SelfCollision;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxAggregate_ConcreteTypeName, PxAggregate, const char * > ConcreteTypeName;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxAggregate_UserData, PxAggregate, void *, void * > UserData;
PX_PHYSX_CORE_API PxAggregateGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxAggregate*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 6; }
static PxU32 totalPropertyCount() { return instancePropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( MaxNbActors, inStartIndex + 0 );;
inOperator( MaxNbShapes, inStartIndex + 1 );;
inOperator( Actors, inStartIndex + 2 );;
inOperator( SelfCollision, inStartIndex + 3 );;
inOperator( ConcreteTypeName, inStartIndex + 4 );;
inOperator( UserData, inStartIndex + 5 );;
return 6 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxAggregate>
{
PxAggregateGeneratedInfo Info;
const PxAggregateGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxConstraintFlag__EnumConversion[] = {
{ "eBROKEN", static_cast<PxU32>( physx::PxConstraintFlag::eBROKEN ) },
{ "eCOLLISION_ENABLED", static_cast<PxU32>( physx::PxConstraintFlag::eCOLLISION_ENABLED ) },
{ "eVISUALIZATION", static_cast<PxU32>( physx::PxConstraintFlag::eVISUALIZATION ) },
{ "eDRIVE_LIMITS_ARE_FORCES", static_cast<PxU32>( physx::PxConstraintFlag::eDRIVE_LIMITS_ARE_FORCES ) },
{ "eIMPROVED_SLERP", static_cast<PxU32>( physx::PxConstraintFlag::eIMPROVED_SLERP ) },
{ "eDISABLE_PREPROCESSING", static_cast<PxU32>( physx::PxConstraintFlag::eDISABLE_PREPROCESSING ) },
{ "eENABLE_EXTENDED_LIMITS", static_cast<PxU32>( physx::PxConstraintFlag::eENABLE_EXTENDED_LIMITS ) },
{ "eGPU_COMPATIBLE", static_cast<PxU32>( physx::PxConstraintFlag::eGPU_COMPATIBLE ) },
{ "eALWAYS_UPDATE", static_cast<PxU32>( physx::PxConstraintFlag::eALWAYS_UPDATE ) },
{ "eDISABLE_CONSTRAINT", static_cast<PxU32>( physx::PxConstraintFlag::eDISABLE_CONSTRAINT ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxConstraintFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxConstraintFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxConstraint;
struct PxConstraintGeneratedValues
{
PxScene * Scene;
PxRigidActor * Actors[2];
PxConstraintFlags Flags;
_Bool IsValid;
PxReal BreakForce[2];
PxReal MinResponseThreshold;
const char * ConcreteTypeName;
void * UserData;
PX_PHYSX_CORE_API PxConstraintGeneratedValues( const PxConstraint* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxConstraint, Scene, PxConstraintGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxConstraint, Actors, PxConstraintGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxConstraint, Flags, PxConstraintGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxConstraint, IsValid, PxConstraintGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxConstraint, BreakForce, PxConstraintGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxConstraint, MinResponseThreshold, PxConstraintGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxConstraint, ConcreteTypeName, PxConstraintGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxConstraint, UserData, PxConstraintGeneratedValues)
struct PxConstraintGeneratedInfo
{
static const char* getClassName() { return "PxConstraint"; }
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxConstraint_Scene, PxConstraint, PxScene * > Scene;
PxRangePropertyInfo<PX_PROPERTY_INFO_NAME::PxConstraint_Actors, PxConstraint, PxRigidActor * > Actors;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxConstraint_Flags, PxConstraint, PxConstraintFlags, PxConstraintFlags > Flags;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxConstraint_IsValid, PxConstraint, _Bool > IsValid;
PxRangePropertyInfo<PX_PROPERTY_INFO_NAME::PxConstraint_BreakForce, PxConstraint, PxReal > BreakForce;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxConstraint_MinResponseThreshold, PxConstraint, PxReal, PxReal > MinResponseThreshold;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxConstraint_ConcreteTypeName, PxConstraint, const char * > ConcreteTypeName;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxConstraint_UserData, PxConstraint, void *, void * > UserData;
PX_PHYSX_CORE_API PxConstraintGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxConstraint*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 8; }
static PxU32 totalPropertyCount() { return instancePropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Scene, inStartIndex + 0 );;
inOperator( Actors, inStartIndex + 1 );;
inOperator( Flags, inStartIndex + 2 );;
inOperator( IsValid, inStartIndex + 3 );;
inOperator( BreakForce, inStartIndex + 4 );;
inOperator( MinResponseThreshold, inStartIndex + 5 );;
inOperator( ConcreteTypeName, inStartIndex + 6 );;
inOperator( UserData, inStartIndex + 7 );;
return 8 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxConstraint>
{
PxConstraintGeneratedInfo Info;
const PxConstraintGeneratedInfo* getInfo() { return &Info; }
};
class PxShape;
struct PxShapeGeneratedValues
: PxRefCountedGeneratedValues {
PxTransform LocalPose;
PxFilterData SimulationFilterData;
PxFilterData QueryFilterData;
PxReal ContactOffset;
PxReal RestOffset;
PxReal DensityForFluid;
PxReal TorsionalPatchRadius;
PxReal MinTorsionalPatchRadius;
PxU32 InternalShapeIndex;
PxShapeFlags Flags;
_Bool IsExclusive;
const char * Name;
const char * ConcreteTypeName;
void * UserData;
PxGeometryHolder Geom;
PX_PHYSX_CORE_API PxShapeGeneratedValues( const PxShape* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, LocalPose, PxShapeGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, SimulationFilterData, PxShapeGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, QueryFilterData, PxShapeGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, ContactOffset, PxShapeGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, RestOffset, PxShapeGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, DensityForFluid, PxShapeGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, TorsionalPatchRadius, PxShapeGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, MinTorsionalPatchRadius, PxShapeGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, InternalShapeIndex, PxShapeGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, Flags, PxShapeGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, IsExclusive, PxShapeGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, Name, PxShapeGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, ConcreteTypeName, PxShapeGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, UserData, PxShapeGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, Geom, PxShapeGeneratedValues)
struct PxShapeGeneratedInfo
: PxRefCountedGeneratedInfo
{
static const char* getClassName() { return "PxShape"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxShape_LocalPose, PxShape, const PxTransform &, PxTransform > LocalPose;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxShape_SimulationFilterData, PxShape, const PxFilterData &, PxFilterData > SimulationFilterData;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxShape_QueryFilterData, PxShape, const PxFilterData &, PxFilterData > QueryFilterData;
PxShapeMaterialsProperty Materials;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxShape_ContactOffset, PxShape, PxReal, PxReal > ContactOffset;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxShape_RestOffset, PxShape, PxReal, PxReal > RestOffset;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxShape_DensityForFluid, PxShape, PxReal, PxReal > DensityForFluid;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxShape_TorsionalPatchRadius, PxShape, PxReal, PxReal > TorsionalPatchRadius;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxShape_MinTorsionalPatchRadius, PxShape, PxReal, PxReal > MinTorsionalPatchRadius;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxShape_InternalShapeIndex, PxShape, PxU32 > InternalShapeIndex;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxShape_Flags, PxShape, PxShapeFlags, PxShapeFlags > Flags;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxShape_IsExclusive, PxShape, _Bool > IsExclusive;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxShape_Name, PxShape, const char *, const char * > Name;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxShape_ConcreteTypeName, PxShape, const char * > ConcreteTypeName;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxShape_UserData, PxShape, void *, void * > UserData;
PxShapeGeomProperty Geom;
PX_PHYSX_CORE_API PxShapeGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxShape*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxRefCountedGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxRefCountedGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxRefCountedGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 16; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxRefCountedGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( LocalPose, inStartIndex + 0 );;
inOperator( SimulationFilterData, inStartIndex + 1 );;
inOperator( QueryFilterData, inStartIndex + 2 );;
inOperator( Materials, inStartIndex + 3 );;
inOperator( ContactOffset, inStartIndex + 4 );;
inOperator( RestOffset, inStartIndex + 5 );;
inOperator( DensityForFluid, inStartIndex + 6 );;
inOperator( TorsionalPatchRadius, inStartIndex + 7 );;
inOperator( MinTorsionalPatchRadius, inStartIndex + 8 );;
inOperator( InternalShapeIndex, inStartIndex + 9 );;
inOperator( Flags, inStartIndex + 10 );;
inOperator( IsExclusive, inStartIndex + 11 );;
inOperator( Name, inStartIndex + 12 );;
inOperator( ConcreteTypeName, inStartIndex + 13 );;
inOperator( UserData, inStartIndex + 14 );;
inOperator( Geom, inStartIndex + 15 );;
return 16 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxShape>
{
PxShapeGeneratedInfo Info;
const PxShapeGeneratedInfo* getInfo() { return &Info; }
};
class PxPruningStructure;
struct PxPruningStructureGeneratedValues
{
const void * StaticMergeData;
const void * DynamicMergeData;
const char * ConcreteTypeName;
PX_PHYSX_CORE_API PxPruningStructureGeneratedValues( const PxPruningStructure* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPruningStructure, StaticMergeData, PxPruningStructureGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPruningStructure, DynamicMergeData, PxPruningStructureGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPruningStructure, ConcreteTypeName, PxPruningStructureGeneratedValues)
struct PxPruningStructureGeneratedInfo
{
static const char* getClassName() { return "PxPruningStructure"; }
PxReadOnlyCollectionPropertyInfo<PX_PROPERTY_INFO_NAME::PxPruningStructure_RigidActors, PxPruningStructure, PxRigidActor * > RigidActors;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxPruningStructure_StaticMergeData, PxPruningStructure, const void * > StaticMergeData;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxPruningStructure_DynamicMergeData, PxPruningStructure, const void * > DynamicMergeData;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxPruningStructure_ConcreteTypeName, PxPruningStructure, const char * > ConcreteTypeName;
PX_PHYSX_CORE_API PxPruningStructureGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxPruningStructure*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 4; }
static PxU32 totalPropertyCount() { return instancePropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( RigidActors, inStartIndex + 0 );;
inOperator( StaticMergeData, inStartIndex + 1 );;
inOperator( DynamicMergeData, inStartIndex + 2 );;
inOperator( ConcreteTypeName, inStartIndex + 3 );;
return 4 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxPruningStructure>
{
PxPruningStructureGeneratedInfo Info;
const PxPruningStructureGeneratedInfo* getInfo() { return &Info; }
};
class PxTolerancesScale;
struct PxTolerancesScaleGeneratedValues
{
_Bool IsValid;
PxReal Length;
PxReal Speed;
PX_PHYSX_CORE_API PxTolerancesScaleGeneratedValues( const PxTolerancesScale* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxTolerancesScale, IsValid, PxTolerancesScaleGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxTolerancesScale, Length, PxTolerancesScaleGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxTolerancesScale, Speed, PxTolerancesScaleGeneratedValues)
struct PxTolerancesScaleGeneratedInfo
{
static const char* getClassName() { return "PxTolerancesScale"; }
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxTolerancesScale_IsValid, PxTolerancesScale, _Bool > IsValid;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxTolerancesScale_Length, PxTolerancesScale, PxReal, PxReal > Length;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxTolerancesScale_Speed, PxTolerancesScale, PxReal, PxReal > Speed;
PX_PHYSX_CORE_API PxTolerancesScaleGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxTolerancesScale*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 3; }
static PxU32 totalPropertyCount() { return instancePropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( IsValid, inStartIndex + 0 );;
inOperator( Length, inStartIndex + 1 );;
inOperator( Speed, inStartIndex + 2 );;
return 3 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxTolerancesScale>
{
PxTolerancesScaleGeneratedInfo Info;
const PxTolerancesScaleGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxGeometryType__EnumConversion[] = {
{ "eSPHERE", static_cast<PxU32>( physx::PxGeometryType::eSPHERE ) },
{ "ePLANE", static_cast<PxU32>( physx::PxGeometryType::ePLANE ) },
{ "eCAPSULE", static_cast<PxU32>( physx::PxGeometryType::eCAPSULE ) },
{ "eBOX", static_cast<PxU32>( physx::PxGeometryType::eBOX ) },
{ "eCONVEXMESH", static_cast<PxU32>( physx::PxGeometryType::eCONVEXMESH ) },
{ "ePARTICLESYSTEM", static_cast<PxU32>( physx::PxGeometryType::ePARTICLESYSTEM ) },
{ "eTETRAHEDRONMESH", static_cast<PxU32>( physx::PxGeometryType::eTETRAHEDRONMESH ) },
{ "eTRIANGLEMESH", static_cast<PxU32>( physx::PxGeometryType::eTRIANGLEMESH ) },
{ "eHEIGHTFIELD", static_cast<PxU32>( physx::PxGeometryType::eHEIGHTFIELD ) },
{ "eHAIRSYSTEM", static_cast<PxU32>( physx::PxGeometryType::eHAIRSYSTEM ) },
{ "eCUSTOM", static_cast<PxU32>( physx::PxGeometryType::eCUSTOM ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxGeometryType::Enum > { PxEnumTraits() : NameConversion( g_physx__PxGeometryType__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxGeometry;
struct PxGeometryGeneratedValues
{
PX_PHYSX_CORE_API PxGeometryGeneratedValues( const PxGeometry* inSource );
};
struct PxGeometryGeneratedInfo
{
static const char* getClassName() { return "PxGeometry"; }
PX_PHYSX_CORE_API PxGeometryGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxGeometry*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 0; }
static PxU32 totalPropertyCount() { return instancePropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return 0 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxGeometry>
{
PxGeometryGeneratedInfo Info;
const PxGeometryGeneratedInfo* getInfo() { return &Info; }
};
class PxBoxGeometry;
struct PxBoxGeometryGeneratedValues
: PxGeometryGeneratedValues {
PxVec3 HalfExtents;
PX_PHYSX_CORE_API PxBoxGeometryGeneratedValues( const PxBoxGeometry* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxBoxGeometry, HalfExtents, PxBoxGeometryGeneratedValues)
struct PxBoxGeometryGeneratedInfo
: PxGeometryGeneratedInfo
{
static const char* getClassName() { return "PxBoxGeometry"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxBoxGeometry_HalfExtents, PxBoxGeometry, PxVec3, PxVec3 > HalfExtents;
PX_PHYSX_CORE_API PxBoxGeometryGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxBoxGeometry*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxGeometryGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxGeometryGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxGeometryGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 1; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxGeometryGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( HalfExtents, inStartIndex + 0 );;
return 1 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxBoxGeometry>
{
PxBoxGeometryGeneratedInfo Info;
const PxBoxGeometryGeneratedInfo* getInfo() { return &Info; }
};
class PxCapsuleGeometry;
struct PxCapsuleGeometryGeneratedValues
: PxGeometryGeneratedValues {
PxReal Radius;
PxReal HalfHeight;
PX_PHYSX_CORE_API PxCapsuleGeometryGeneratedValues( const PxCapsuleGeometry* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxCapsuleGeometry, Radius, PxCapsuleGeometryGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxCapsuleGeometry, HalfHeight, PxCapsuleGeometryGeneratedValues)
struct PxCapsuleGeometryGeneratedInfo
: PxGeometryGeneratedInfo
{
static const char* getClassName() { return "PxCapsuleGeometry"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxCapsuleGeometry_Radius, PxCapsuleGeometry, PxReal, PxReal > Radius;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxCapsuleGeometry_HalfHeight, PxCapsuleGeometry, PxReal, PxReal > HalfHeight;
PX_PHYSX_CORE_API PxCapsuleGeometryGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxCapsuleGeometry*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxGeometryGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxGeometryGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxGeometryGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 2; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxGeometryGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Radius, inStartIndex + 0 );;
inOperator( HalfHeight, inStartIndex + 1 );;
return 2 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxCapsuleGeometry>
{
PxCapsuleGeometryGeneratedInfo Info;
const PxCapsuleGeometryGeneratedInfo* getInfo() { return &Info; }
};
class PxMeshScale;
struct PxMeshScaleGeneratedValues
{
PxVec3 Scale;
PxQuat Rotation;
PX_PHYSX_CORE_API PxMeshScaleGeneratedValues( const PxMeshScale* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxMeshScale, Scale, PxMeshScaleGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxMeshScale, Rotation, PxMeshScaleGeneratedValues)
struct PxMeshScaleGeneratedInfo
{
static const char* getClassName() { return "PxMeshScale"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxMeshScale_Scale, PxMeshScale, PxVec3, PxVec3 > Scale;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxMeshScale_Rotation, PxMeshScale, PxQuat, PxQuat > Rotation;
PX_PHYSX_CORE_API PxMeshScaleGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxMeshScale*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 2; }
static PxU32 totalPropertyCount() { return instancePropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Scale, inStartIndex + 0 );;
inOperator( Rotation, inStartIndex + 1 );;
return 2 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxMeshScale>
{
PxMeshScaleGeneratedInfo Info;
const PxMeshScaleGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxConvexMeshGeometryFlag__EnumConversion[] = {
{ "eTIGHT_BOUNDS", static_cast<PxU32>( physx::PxConvexMeshGeometryFlag::eTIGHT_BOUNDS ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxConvexMeshGeometryFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxConvexMeshGeometryFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxConvexMeshGeometry;
struct PxConvexMeshGeometryGeneratedValues
: PxGeometryGeneratedValues {
PxMeshScale Scale;
PxConvexMesh * ConvexMesh;
PxConvexMeshGeometryFlags MeshFlags;
PX_PHYSX_CORE_API PxConvexMeshGeometryGeneratedValues( const PxConvexMeshGeometry* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxConvexMeshGeometry, Scale, PxConvexMeshGeometryGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxConvexMeshGeometry, ConvexMesh, PxConvexMeshGeometryGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxConvexMeshGeometry, MeshFlags, PxConvexMeshGeometryGeneratedValues)
struct PxConvexMeshGeometryGeneratedInfo
: PxGeometryGeneratedInfo
{
static const char* getClassName() { return "PxConvexMeshGeometry"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxConvexMeshGeometry_Scale, PxConvexMeshGeometry, PxMeshScale, PxMeshScale > Scale;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxConvexMeshGeometry_ConvexMesh, PxConvexMeshGeometry, PxConvexMesh *, PxConvexMesh * > ConvexMesh;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxConvexMeshGeometry_MeshFlags, PxConvexMeshGeometry, PxConvexMeshGeometryFlags, PxConvexMeshGeometryFlags > MeshFlags;
PX_PHYSX_CORE_API PxConvexMeshGeometryGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxConvexMeshGeometry*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxGeometryGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxGeometryGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxGeometryGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 3; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxGeometryGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Scale, inStartIndex + 0 );;
inOperator( ConvexMesh, inStartIndex + 1 );;
inOperator( MeshFlags, inStartIndex + 2 );;
return 3 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxConvexMeshGeometry>
{
PxConvexMeshGeometryGeneratedInfo Info;
const PxConvexMeshGeometryGeneratedInfo* getInfo() { return &Info; }
};
class PxSphereGeometry;
struct PxSphereGeometryGeneratedValues
: PxGeometryGeneratedValues {
PxReal Radius;
PX_PHYSX_CORE_API PxSphereGeometryGeneratedValues( const PxSphereGeometry* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSphereGeometry, Radius, PxSphereGeometryGeneratedValues)
struct PxSphereGeometryGeneratedInfo
: PxGeometryGeneratedInfo
{
static const char* getClassName() { return "PxSphereGeometry"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSphereGeometry_Radius, PxSphereGeometry, PxReal, PxReal > Radius;
PX_PHYSX_CORE_API PxSphereGeometryGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxSphereGeometry*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxGeometryGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxGeometryGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxGeometryGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 1; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxGeometryGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Radius, inStartIndex + 0 );;
return 1 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxSphereGeometry>
{
PxSphereGeometryGeneratedInfo Info;
const PxSphereGeometryGeneratedInfo* getInfo() { return &Info; }
};
class PxPlaneGeometry;
struct PxPlaneGeometryGeneratedValues
: PxGeometryGeneratedValues {
PX_PHYSX_CORE_API PxPlaneGeometryGeneratedValues( const PxPlaneGeometry* inSource );
};
struct PxPlaneGeometryGeneratedInfo
: PxGeometryGeneratedInfo
{
static const char* getClassName() { return "PxPlaneGeometry"; }
PX_PHYSX_CORE_API PxPlaneGeometryGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxPlaneGeometry*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxGeometryGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxGeometryGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxGeometryGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 0; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxGeometryGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return 0 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxPlaneGeometry>
{
PxPlaneGeometryGeneratedInfo Info;
const PxPlaneGeometryGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxMeshGeometryFlag__EnumConversion[] = {
{ "eTIGHT_BOUNDS", static_cast<PxU32>( physx::PxMeshGeometryFlag::eTIGHT_BOUNDS ) },
{ "eDOUBLE_SIDED", static_cast<PxU32>( physx::PxMeshGeometryFlag::eDOUBLE_SIDED ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxMeshGeometryFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxMeshGeometryFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxTriangleMeshGeometry;
struct PxTriangleMeshGeometryGeneratedValues
: PxGeometryGeneratedValues {
PxMeshScale Scale;
PxMeshGeometryFlags MeshFlags;
PxTriangleMesh * TriangleMesh;
PX_PHYSX_CORE_API PxTriangleMeshGeometryGeneratedValues( const PxTriangleMeshGeometry* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxTriangleMeshGeometry, Scale, PxTriangleMeshGeometryGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxTriangleMeshGeometry, MeshFlags, PxTriangleMeshGeometryGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxTriangleMeshGeometry, TriangleMesh, PxTriangleMeshGeometryGeneratedValues)
struct PxTriangleMeshGeometryGeneratedInfo
: PxGeometryGeneratedInfo
{
static const char* getClassName() { return "PxTriangleMeshGeometry"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxTriangleMeshGeometry_Scale, PxTriangleMeshGeometry, PxMeshScale, PxMeshScale > Scale;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxTriangleMeshGeometry_MeshFlags, PxTriangleMeshGeometry, PxMeshGeometryFlags, PxMeshGeometryFlags > MeshFlags;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxTriangleMeshGeometry_TriangleMesh, PxTriangleMeshGeometry, PxTriangleMesh *, PxTriangleMesh * > TriangleMesh;
PX_PHYSX_CORE_API PxTriangleMeshGeometryGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxTriangleMeshGeometry*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxGeometryGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxGeometryGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxGeometryGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 3; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxGeometryGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Scale, inStartIndex + 0 );;
inOperator( MeshFlags, inStartIndex + 1 );;
inOperator( TriangleMesh, inStartIndex + 2 );;
return 3 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxTriangleMeshGeometry>
{
PxTriangleMeshGeometryGeneratedInfo Info;
const PxTriangleMeshGeometryGeneratedInfo* getInfo() { return &Info; }
};
class PxHeightFieldGeometry;
struct PxHeightFieldGeometryGeneratedValues
: PxGeometryGeneratedValues {
PxHeightField * HeightField;
PxReal HeightScale;
PxReal RowScale;
PxReal ColumnScale;
PxMeshGeometryFlags HeightFieldFlags;
PX_PHYSX_CORE_API PxHeightFieldGeometryGeneratedValues( const PxHeightFieldGeometry* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxHeightFieldGeometry, HeightField, PxHeightFieldGeometryGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxHeightFieldGeometry, HeightScale, PxHeightFieldGeometryGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxHeightFieldGeometry, RowScale, PxHeightFieldGeometryGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxHeightFieldGeometry, ColumnScale, PxHeightFieldGeometryGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxHeightFieldGeometry, HeightFieldFlags, PxHeightFieldGeometryGeneratedValues)
struct PxHeightFieldGeometryGeneratedInfo
: PxGeometryGeneratedInfo
{
static const char* getClassName() { return "PxHeightFieldGeometry"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxHeightFieldGeometry_HeightField, PxHeightFieldGeometry, PxHeightField *, PxHeightField * > HeightField;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxHeightFieldGeometry_HeightScale, PxHeightFieldGeometry, PxReal, PxReal > HeightScale;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxHeightFieldGeometry_RowScale, PxHeightFieldGeometry, PxReal, PxReal > RowScale;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxHeightFieldGeometry_ColumnScale, PxHeightFieldGeometry, PxReal, PxReal > ColumnScale;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxHeightFieldGeometry_HeightFieldFlags, PxHeightFieldGeometry, PxMeshGeometryFlags, PxMeshGeometryFlags > HeightFieldFlags;
PX_PHYSX_CORE_API PxHeightFieldGeometryGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxHeightFieldGeometry*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxGeometryGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxGeometryGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxGeometryGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 5; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxGeometryGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( HeightField, inStartIndex + 0 );;
inOperator( HeightScale, inStartIndex + 1 );;
inOperator( RowScale, inStartIndex + 2 );;
inOperator( ColumnScale, inStartIndex + 3 );;
inOperator( HeightFieldFlags, inStartIndex + 4 );;
return 5 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxHeightFieldGeometry>
{
PxHeightFieldGeometryGeneratedInfo Info;
const PxHeightFieldGeometryGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxSceneQueryUpdateMode__EnumConversion[] = {
{ "eBUILD_ENABLED_COMMIT_ENABLED", static_cast<PxU32>( physx::PxSceneQueryUpdateMode::eBUILD_ENABLED_COMMIT_ENABLED ) },
{ "eBUILD_ENABLED_COMMIT_DISABLED", static_cast<PxU32>( physx::PxSceneQueryUpdateMode::eBUILD_ENABLED_COMMIT_DISABLED ) },
{ "eBUILD_DISABLED_COMMIT_DISABLED", static_cast<PxU32>( physx::PxSceneQueryUpdateMode::eBUILD_DISABLED_COMMIT_DISABLED ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxSceneQueryUpdateMode::Enum > { PxEnumTraits() : NameConversion( g_physx__PxSceneQueryUpdateMode__EnumConversion ) {} const PxU32ToName* NameConversion; };
static PxU32ToName g_physx__PxHitFlag__EnumConversion[] = {
{ "ePOSITION", static_cast<PxU32>( physx::PxHitFlag::ePOSITION ) },
{ "eNORMAL", static_cast<PxU32>( physx::PxHitFlag::eNORMAL ) },
{ "eUV", static_cast<PxU32>( physx::PxHitFlag::eUV ) },
{ "eASSUME_NO_INITIAL_OVERLAP", static_cast<PxU32>( physx::PxHitFlag::eASSUME_NO_INITIAL_OVERLAP ) },
{ "eANY_HIT", static_cast<PxU32>( physx::PxHitFlag::eANY_HIT ) },
{ "eMESH_MULTIPLE", static_cast<PxU32>( physx::PxHitFlag::eMESH_MULTIPLE ) },
{ "eMESH_ANY", static_cast<PxU32>( physx::PxHitFlag::eMESH_ANY ) },
{ "eMESH_BOTH_SIDES", static_cast<PxU32>( physx::PxHitFlag::eMESH_BOTH_SIDES ) },
{ "ePRECISE_SWEEP", static_cast<PxU32>( physx::PxHitFlag::ePRECISE_SWEEP ) },
{ "eMTD", static_cast<PxU32>( physx::PxHitFlag::eMTD ) },
{ "eFACE_INDEX", static_cast<PxU32>( physx::PxHitFlag::eFACE_INDEX ) },
{ "eDEFAULT", static_cast<PxU32>( physx::PxHitFlag::eDEFAULT ) },
{ "eMODIFIABLE_FLAGS", static_cast<PxU32>( physx::PxHitFlag::eMODIFIABLE_FLAGS ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxHitFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxHitFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
static PxU32ToName g_physx__PxGeometryQueryFlag__EnumConversion[] = {
{ "eSIMD_GUARD", static_cast<PxU32>( physx::PxGeometryQueryFlag::eSIMD_GUARD ) },
{ "eDEFAULT", static_cast<PxU32>( physx::PxGeometryQueryFlag::eDEFAULT ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxGeometryQueryFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxGeometryQueryFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxSceneQuerySystemBase;
struct PxSceneQuerySystemBaseGeneratedValues
{
PxU32 DynamicTreeRebuildRateHint;
PxSceneQueryUpdateMode::Enum UpdateMode;
PxU32 StaticTimestamp;
PX_PHYSX_CORE_API PxSceneQuerySystemBaseGeneratedValues( const PxSceneQuerySystemBase* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQuerySystemBase, DynamicTreeRebuildRateHint, PxSceneQuerySystemBaseGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQuerySystemBase, UpdateMode, PxSceneQuerySystemBaseGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQuerySystemBase, StaticTimestamp, PxSceneQuerySystemBaseGeneratedValues)
struct PxSceneQuerySystemBaseGeneratedInfo
{
static const char* getClassName() { return "PxSceneQuerySystemBase"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneQuerySystemBase_DynamicTreeRebuildRateHint, PxSceneQuerySystemBase, PxU32, PxU32 > DynamicTreeRebuildRateHint;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneQuerySystemBase_UpdateMode, PxSceneQuerySystemBase, PxSceneQueryUpdateMode::Enum, PxSceneQueryUpdateMode::Enum > UpdateMode;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneQuerySystemBase_StaticTimestamp, PxSceneQuerySystemBase, PxU32 > StaticTimestamp;
PX_PHYSX_CORE_API PxSceneQuerySystemBaseGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxSceneQuerySystemBase*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 3; }
static PxU32 totalPropertyCount() { return instancePropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( DynamicTreeRebuildRateHint, inStartIndex + 0 );;
inOperator( UpdateMode, inStartIndex + 1 );;
inOperator( StaticTimestamp, inStartIndex + 2 );;
return 3 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxSceneQuerySystemBase>
{
PxSceneQuerySystemBaseGeneratedInfo Info;
const PxSceneQuerySystemBaseGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxPruningStructureType__EnumConversion[] = {
{ "eNONE", static_cast<PxU32>( physx::PxPruningStructureType::eNONE ) },
{ "eDYNAMIC_AABB_TREE", static_cast<PxU32>( physx::PxPruningStructureType::eDYNAMIC_AABB_TREE ) },
{ "eSTATIC_AABB_TREE", static_cast<PxU32>( physx::PxPruningStructureType::eSTATIC_AABB_TREE ) },
{ "eLAST", static_cast<PxU32>( physx::PxPruningStructureType::eLAST ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxPruningStructureType::Enum > { PxEnumTraits() : NameConversion( g_physx__PxPruningStructureType__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxSceneSQSystem;
struct PxSceneSQSystemGeneratedValues
: PxSceneQuerySystemBaseGeneratedValues {
PxSceneQueryUpdateMode::Enum SceneQueryUpdateMode;
PxU32 SceneQueryStaticTimestamp;
PxPruningStructureType::Enum StaticStructure;
PxPruningStructureType::Enum DynamicStructure;
PX_PHYSX_CORE_API PxSceneSQSystemGeneratedValues( const PxSceneSQSystem* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneSQSystem, SceneQueryUpdateMode, PxSceneSQSystemGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneSQSystem, SceneQueryStaticTimestamp, PxSceneSQSystemGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneSQSystem, StaticStructure, PxSceneSQSystemGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneSQSystem, DynamicStructure, PxSceneSQSystemGeneratedValues)
struct PxSceneSQSystemGeneratedInfo
: PxSceneQuerySystemBaseGeneratedInfo
{
static const char* getClassName() { return "PxSceneSQSystem"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneSQSystem_SceneQueryUpdateMode, PxSceneSQSystem, PxSceneQueryUpdateMode::Enum, PxSceneQueryUpdateMode::Enum > SceneQueryUpdateMode;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneSQSystem_SceneQueryStaticTimestamp, PxSceneSQSystem, PxU32 > SceneQueryStaticTimestamp;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneSQSystem_StaticStructure, PxSceneSQSystem, PxPruningStructureType::Enum > StaticStructure;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneSQSystem_DynamicStructure, PxSceneSQSystem, PxPruningStructureType::Enum > DynamicStructure;
PX_PHYSX_CORE_API PxSceneSQSystemGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxSceneSQSystem*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxSceneQuerySystemBaseGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxSceneQuerySystemBaseGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxSceneQuerySystemBaseGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 4; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxSceneQuerySystemBaseGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( SceneQueryUpdateMode, inStartIndex + 0 );;
inOperator( SceneQueryStaticTimestamp, inStartIndex + 1 );;
inOperator( StaticStructure, inStartIndex + 2 );;
inOperator( DynamicStructure, inStartIndex + 3 );;
return 4 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxSceneSQSystem>
{
PxSceneSQSystemGeneratedInfo Info;
const PxSceneSQSystemGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxSceneFlag__EnumConversion[] = {
{ "eENABLE_ACTIVE_ACTORS", static_cast<PxU32>( physx::PxSceneFlag::eENABLE_ACTIVE_ACTORS ) },
{ "eENABLE_CCD", static_cast<PxU32>( physx::PxSceneFlag::eENABLE_CCD ) },
{ "eDISABLE_CCD_RESWEEP", static_cast<PxU32>( physx::PxSceneFlag::eDISABLE_CCD_RESWEEP ) },
{ "eENABLE_PCM", static_cast<PxU32>( physx::PxSceneFlag::eENABLE_PCM ) },
{ "eDISABLE_CONTACT_REPORT_BUFFER_RESIZE", static_cast<PxU32>( physx::PxSceneFlag::eDISABLE_CONTACT_REPORT_BUFFER_RESIZE ) },
{ "eDISABLE_CONTACT_CACHE", static_cast<PxU32>( physx::PxSceneFlag::eDISABLE_CONTACT_CACHE ) },
{ "eREQUIRE_RW_LOCK", static_cast<PxU32>( physx::PxSceneFlag::eREQUIRE_RW_LOCK ) },
{ "eENABLE_STABILIZATION", static_cast<PxU32>( physx::PxSceneFlag::eENABLE_STABILIZATION ) },
{ "eENABLE_AVERAGE_POINT", static_cast<PxU32>( physx::PxSceneFlag::eENABLE_AVERAGE_POINT ) },
{ "eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS", static_cast<PxU32>( physx::PxSceneFlag::eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS ) },
{ "eENABLE_GPU_DYNAMICS", static_cast<PxU32>( physx::PxSceneFlag::eENABLE_GPU_DYNAMICS ) },
{ "eENABLE_ENHANCED_DETERMINISM", static_cast<PxU32>( physx::PxSceneFlag::eENABLE_ENHANCED_DETERMINISM ) },
{ "eENABLE_FRICTION_EVERY_ITERATION", static_cast<PxU32>( physx::PxSceneFlag::eENABLE_FRICTION_EVERY_ITERATION ) },
{ "eENABLE_DIRECT_GPU_API", static_cast<PxU32>( physx::PxSceneFlag::eENABLE_DIRECT_GPU_API ) },
{ "eMUTABLE_FLAGS", static_cast<PxU32>( physx::PxSceneFlag::eMUTABLE_FLAGS ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxSceneFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxSceneFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
static PxU32ToName g_physx__PxActorTypeFlag__EnumConversion[] = {
{ "eRIGID_STATIC", static_cast<PxU32>( physx::PxActorTypeFlag::eRIGID_STATIC ) },
{ "eRIGID_DYNAMIC", static_cast<PxU32>( physx::PxActorTypeFlag::eRIGID_DYNAMIC ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxActorTypeFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxActorTypeFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
static PxU32ToName g_physx__PxParticleSolverType__EnumConversion[] = {
{ "ePBD", static_cast<PxU32>( physx::PxParticleSolverType::ePBD ) },
{ "eFLIP", static_cast<PxU32>( physx::PxParticleSolverType::eFLIP ) },
{ "eMPM", static_cast<PxU32>( physx::PxParticleSolverType::eMPM ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxParticleSolverType::Enum > { PxEnumTraits() : NameConversion( g_physx__PxParticleSolverType__EnumConversion ) {} const PxU32ToName* NameConversion; };
static PxU32ToName g_physx__PxPairFilteringMode__EnumConversion[] = {
{ "eKEEP", static_cast<PxU32>( physx::PxPairFilteringMode::eKEEP ) },
{ "eSUPPRESS", static_cast<PxU32>( physx::PxPairFilteringMode::eSUPPRESS ) },
{ "eKILL", static_cast<PxU32>( physx::PxPairFilteringMode::eKILL ) },
{ "eDEFAULT", static_cast<PxU32>( physx::PxPairFilteringMode::eDEFAULT ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxPairFilteringMode::Enum > { PxEnumTraits() : NameConversion( g_physx__PxPairFilteringMode__EnumConversion ) {} const PxU32ToName* NameConversion; };
static PxU32ToName g_physx__PxFrictionType__EnumConversion[] = {
{ "ePATCH", static_cast<PxU32>( physx::PxFrictionType::ePATCH ) },
{ "eONE_DIRECTIONAL", static_cast<PxU32>( physx::PxFrictionType::eONE_DIRECTIONAL ) },
{ "eTWO_DIRECTIONAL", static_cast<PxU32>( physx::PxFrictionType::eTWO_DIRECTIONAL ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxFrictionType::Enum > { PxEnumTraits() : NameConversion( g_physx__PxFrictionType__EnumConversion ) {} const PxU32ToName* NameConversion; };
static PxU32ToName g_physx__PxSolverType__EnumConversion[] = {
{ "ePGS", static_cast<PxU32>( physx::PxSolverType::ePGS ) },
{ "eTGS", static_cast<PxU32>( physx::PxSolverType::eTGS ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxSolverType::Enum > { PxEnumTraits() : NameConversion( g_physx__PxSolverType__EnumConversion ) {} const PxU32ToName* NameConversion; };
static PxU32ToName g_physx__PxVisualizationParameter__EnumConversion[] = {
{ "eSCALE", static_cast<PxU32>( physx::PxVisualizationParameter::eSCALE ) },
{ "eWORLD_AXES", static_cast<PxU32>( physx::PxVisualizationParameter::eWORLD_AXES ) },
{ "eBODY_AXES", static_cast<PxU32>( physx::PxVisualizationParameter::eBODY_AXES ) },
{ "eBODY_MASS_AXES", static_cast<PxU32>( physx::PxVisualizationParameter::eBODY_MASS_AXES ) },
{ "eBODY_LIN_VELOCITY", static_cast<PxU32>( physx::PxVisualizationParameter::eBODY_LIN_VELOCITY ) },
{ "eBODY_ANG_VELOCITY", static_cast<PxU32>( physx::PxVisualizationParameter::eBODY_ANG_VELOCITY ) },
{ "eCONTACT_POINT", static_cast<PxU32>( physx::PxVisualizationParameter::eCONTACT_POINT ) },
{ "eCONTACT_NORMAL", static_cast<PxU32>( physx::PxVisualizationParameter::eCONTACT_NORMAL ) },
{ "eCONTACT_ERROR", static_cast<PxU32>( physx::PxVisualizationParameter::eCONTACT_ERROR ) },
{ "eCONTACT_FORCE", static_cast<PxU32>( physx::PxVisualizationParameter::eCONTACT_FORCE ) },
{ "eACTOR_AXES", static_cast<PxU32>( physx::PxVisualizationParameter::eACTOR_AXES ) },
{ "eCOLLISION_AABBS", static_cast<PxU32>( physx::PxVisualizationParameter::eCOLLISION_AABBS ) },
{ "eCOLLISION_SHAPES", static_cast<PxU32>( physx::PxVisualizationParameter::eCOLLISION_SHAPES ) },
{ "eCOLLISION_AXES", static_cast<PxU32>( physx::PxVisualizationParameter::eCOLLISION_AXES ) },
{ "eCOLLISION_COMPOUNDS", static_cast<PxU32>( physx::PxVisualizationParameter::eCOLLISION_COMPOUNDS ) },
{ "eCOLLISION_FNORMALS", static_cast<PxU32>( physx::PxVisualizationParameter::eCOLLISION_FNORMALS ) },
{ "eCOLLISION_EDGES", static_cast<PxU32>( physx::PxVisualizationParameter::eCOLLISION_EDGES ) },
{ "eCOLLISION_STATIC", static_cast<PxU32>( physx::PxVisualizationParameter::eCOLLISION_STATIC ) },
{ "eCOLLISION_DYNAMIC", static_cast<PxU32>( physx::PxVisualizationParameter::eCOLLISION_DYNAMIC ) },
{ "eJOINT_LOCAL_FRAMES", static_cast<PxU32>( physx::PxVisualizationParameter::eJOINT_LOCAL_FRAMES ) },
{ "eJOINT_LIMITS", static_cast<PxU32>( physx::PxVisualizationParameter::eJOINT_LIMITS ) },
{ "eCULL_BOX", static_cast<PxU32>( physx::PxVisualizationParameter::eCULL_BOX ) },
{ "eMBP_REGIONS", static_cast<PxU32>( physx::PxVisualizationParameter::eMBP_REGIONS ) },
{ "eSIMULATION_MESH", static_cast<PxU32>( physx::PxVisualizationParameter::eSIMULATION_MESH ) },
{ "eSDF", static_cast<PxU32>( physx::PxVisualizationParameter::eSDF ) },
{ "eNUM_VALUES", static_cast<PxU32>( physx::PxVisualizationParameter::eNUM_VALUES ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxVisualizationParameter::Enum > { PxEnumTraits() : NameConversion( g_physx__PxVisualizationParameter__EnumConversion ) {} const PxU32ToName* NameConversion; };
static PxU32ToName g_physx__PxBroadPhaseType__EnumConversion[] = {
{ "eSAP", static_cast<PxU32>( physx::PxBroadPhaseType::eSAP ) },
{ "eMBP", static_cast<PxU32>( physx::PxBroadPhaseType::eMBP ) },
{ "eABP", static_cast<PxU32>( physx::PxBroadPhaseType::eABP ) },
{ "ePABP", static_cast<PxU32>( physx::PxBroadPhaseType::ePABP ) },
{ "eGPU", static_cast<PxU32>( physx::PxBroadPhaseType::eGPU ) },
{ "eLAST", static_cast<PxU32>( physx::PxBroadPhaseType::eLAST ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxBroadPhaseType::Enum > { PxEnumTraits() : NameConversion( g_physx__PxBroadPhaseType__EnumConversion ) {} const PxU32ToName* NameConversion; };
static PxU32ToName g_physx__PxArticulationGpuDataType__EnumConversion[] = {
{ "eJOINT_POSITION", static_cast<PxU32>( physx::PxArticulationGpuDataType::eJOINT_POSITION ) },
{ "eJOINT_VELOCITY", static_cast<PxU32>( physx::PxArticulationGpuDataType::eJOINT_VELOCITY ) },
{ "eJOINT_ACCELERATION", static_cast<PxU32>( physx::PxArticulationGpuDataType::eJOINT_ACCELERATION ) },
{ "eJOINT_FORCE", static_cast<PxU32>( physx::PxArticulationGpuDataType::eJOINT_FORCE ) },
{ "eJOINT_SOLVER_FORCE", static_cast<PxU32>( physx::PxArticulationGpuDataType::eJOINT_SOLVER_FORCE ) },
{ "eJOINT_TARGET_VELOCITY", static_cast<PxU32>( physx::PxArticulationGpuDataType::eJOINT_TARGET_VELOCITY ) },
{ "eJOINT_TARGET_POSITION", static_cast<PxU32>( physx::PxArticulationGpuDataType::eJOINT_TARGET_POSITION ) },
{ "eSENSOR_FORCE", static_cast<PxU32>( physx::PxArticulationGpuDataType::eSENSOR_FORCE ) },
{ "eROOT_TRANSFORM", static_cast<PxU32>( physx::PxArticulationGpuDataType::eROOT_TRANSFORM ) },
{ "eROOT_VELOCITY", static_cast<PxU32>( physx::PxArticulationGpuDataType::eROOT_VELOCITY ) },
{ "eLINK_TRANSFORM", static_cast<PxU32>( physx::PxArticulationGpuDataType::eLINK_TRANSFORM ) },
{ "eLINK_VELOCITY", static_cast<PxU32>( physx::PxArticulationGpuDataType::eLINK_VELOCITY ) },
{ "eLINK_ACCELERATION", static_cast<PxU32>( physx::PxArticulationGpuDataType::eLINK_ACCELERATION ) },
{ "eLINK_INCOMING_JOINT_FORCE", static_cast<PxU32>( physx::PxArticulationGpuDataType::eLINK_INCOMING_JOINT_FORCE ) },
{ "eLINK_FORCE", static_cast<PxU32>( physx::PxArticulationGpuDataType::eLINK_FORCE ) },
{ "eLINK_TORQUE", static_cast<PxU32>( physx::PxArticulationGpuDataType::eLINK_TORQUE ) },
{ "eFIXED_TENDON", static_cast<PxU32>( physx::PxArticulationGpuDataType::eFIXED_TENDON ) },
{ "eFIXED_TENDON_JOINT", static_cast<PxU32>( physx::PxArticulationGpuDataType::eFIXED_TENDON_JOINT ) },
{ "eSPATIAL_TENDON", static_cast<PxU32>( physx::PxArticulationGpuDataType::eSPATIAL_TENDON ) },
{ "eSPATIAL_TENDON_ATTACHMENT", static_cast<PxU32>( physx::PxArticulationGpuDataType::eSPATIAL_TENDON_ATTACHMENT ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxArticulationGpuDataType::Enum > { PxEnumTraits() : NameConversion( g_physx__PxArticulationGpuDataType__EnumConversion ) {} const PxU32ToName* NameConversion; };
static PxU32ToName g_physx__PxSoftBodyGpuDataFlag__EnumConversion[] = {
{ "eTET_INDICES", static_cast<PxU32>( physx::PxSoftBodyGpuDataFlag::eTET_INDICES ) },
{ "eTET_REST_POSES", static_cast<PxU32>( physx::PxSoftBodyGpuDataFlag::eTET_REST_POSES ) },
{ "eTET_ROTATIONS", static_cast<PxU32>( physx::PxSoftBodyGpuDataFlag::eTET_ROTATIONS ) },
{ "eTET_POSITION_INV_MASS", static_cast<PxU32>( physx::PxSoftBodyGpuDataFlag::eTET_POSITION_INV_MASS ) },
{ "eSIM_TET_INDICES", static_cast<PxU32>( physx::PxSoftBodyGpuDataFlag::eSIM_TET_INDICES ) },
{ "eSIM_TET_ROTATIONS", static_cast<PxU32>( physx::PxSoftBodyGpuDataFlag::eSIM_TET_ROTATIONS ) },
{ "eSIM_VELOCITY_INV_MASS", static_cast<PxU32>( physx::PxSoftBodyGpuDataFlag::eSIM_VELOCITY_INV_MASS ) },
{ "eSIM_POSITION_INV_MASS", static_cast<PxU32>( physx::PxSoftBodyGpuDataFlag::eSIM_POSITION_INV_MASS ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxSoftBodyGpuDataFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxSoftBodyGpuDataFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
static PxU32ToName g_physx__PxActorCacheFlag__EnumConversion[] = {
{ "eACTOR_DATA", static_cast<PxU32>( physx::PxActorCacheFlag::eACTOR_DATA ) },
{ "eFORCE", static_cast<PxU32>( physx::PxActorCacheFlag::eFORCE ) },
{ "eTORQUE", static_cast<PxU32>( physx::PxActorCacheFlag::eTORQUE ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxActorCacheFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxActorCacheFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxScene;
struct PxSceneGeneratedValues
: PxSceneSQSystemGeneratedValues {
PxSceneFlags Flags;
PxSceneLimits Limits;
PxU32 Timestamp;
const char * Name;
PxCpuDispatcher * CpuDispatcher;
PxCudaContextManager * CudaContextManager;
PxSimulationEventCallback * SimulationEventCallback;
PxContactModifyCallback * ContactModifyCallback;
PxCCDContactModifyCallback * CCDContactModifyCallback;
PxBroadPhaseCallback * BroadPhaseCallback;
PxU32 FilterShaderDataSize;
PxSimulationFilterShader FilterShader;
PxSimulationFilterCallback * FilterCallback;
PxPairFilteringMode::Enum KinematicKinematicFilteringMode;
PxPairFilteringMode::Enum StaticKinematicFilteringMode;
PxVec3 Gravity;
PxReal BounceThresholdVelocity;
PxU32 CCDMaxPasses;
PxReal CCDMaxSeparation;
PxReal CCDThreshold;
PxReal MaxBiasCoefficient;
PxReal FrictionOffsetThreshold;
PxReal FrictionCorrelationDistance;
PxFrictionType::Enum FrictionType;
PxSolverType::Enum SolverType;
PxBounds3 VisualizationCullingBox;
PxBroadPhaseType::Enum BroadPhaseType;
PxTaskManager * TaskManager;
PxU32 MaxNbContactDataBlocksUsed;
PxU32 ContactReportStreamBufferSize;
PxU32 SolverBatchSize;
PxU32 SolverArticulationBatchSize;
PxReal WakeCounterResetValue;
PxgDynamicsMemoryConfig GpuDynamicsConfig;
void * UserData;
PxSimulationStatistics SimulationStatistics;
PX_PHYSX_CORE_API PxSceneGeneratedValues( const PxScene* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, Flags, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, Limits, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, Timestamp, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, Name, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, CpuDispatcher, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, CudaContextManager, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, SimulationEventCallback, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, ContactModifyCallback, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, CCDContactModifyCallback, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, BroadPhaseCallback, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, FilterShaderDataSize, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, FilterShader, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, FilterCallback, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, KinematicKinematicFilteringMode, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, StaticKinematicFilteringMode, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, Gravity, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, BounceThresholdVelocity, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, CCDMaxPasses, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, CCDMaxSeparation, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, CCDThreshold, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, MaxBiasCoefficient, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, FrictionOffsetThreshold, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, FrictionCorrelationDistance, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, FrictionType, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, SolverType, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, VisualizationCullingBox, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, BroadPhaseType, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, TaskManager, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, MaxNbContactDataBlocksUsed, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, ContactReportStreamBufferSize, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, SolverBatchSize, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, SolverArticulationBatchSize, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, WakeCounterResetValue, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, GpuDynamicsConfig, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, UserData, PxSceneGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, SimulationStatistics, PxSceneGeneratedValues)
struct PxSceneGeneratedInfo
: PxSceneSQSystemGeneratedInfo
{
static const char* getClassName() { return "PxScene"; }
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_Flags, PxScene, PxSceneFlags > Flags;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_Limits, PxScene, const PxSceneLimits &, PxSceneLimits > Limits;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_Timestamp, PxScene, PxU32 > Timestamp;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_Name, PxScene, const char *, const char * > Name;
PxReadOnlyFilteredCollectionPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_Actors, PxScene, PxActor *, PxActorTypeFlags > Actors;
PxReadOnlyCollectionPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_SoftBodies, PxScene, PxSoftBody * > SoftBodies;
PxReadOnlyCollectionPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_Articulations, PxScene, PxArticulationReducedCoordinate * > Articulations;
PxReadOnlyCollectionPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_Constraints, PxScene, PxConstraint * > Constraints;
PxReadOnlyCollectionPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_Aggregates, PxScene, PxAggregate * > Aggregates;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_CpuDispatcher, PxScene, PxCpuDispatcher * > CpuDispatcher;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_CudaContextManager, PxScene, PxCudaContextManager * > CudaContextManager;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_SimulationEventCallback, PxScene, PxSimulationEventCallback *, PxSimulationEventCallback * > SimulationEventCallback;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_ContactModifyCallback, PxScene, PxContactModifyCallback *, PxContactModifyCallback * > ContactModifyCallback;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_CCDContactModifyCallback, PxScene, PxCCDContactModifyCallback *, PxCCDContactModifyCallback * > CCDContactModifyCallback;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_BroadPhaseCallback, PxScene, PxBroadPhaseCallback *, PxBroadPhaseCallback * > BroadPhaseCallback;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_FilterShaderDataSize, PxScene, PxU32 > FilterShaderDataSize;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_FilterShader, PxScene, PxSimulationFilterShader > FilterShader;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_FilterCallback, PxScene, PxSimulationFilterCallback * > FilterCallback;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_KinematicKinematicFilteringMode, PxScene, PxPairFilteringMode::Enum > KinematicKinematicFilteringMode;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_StaticKinematicFilteringMode, PxScene, PxPairFilteringMode::Enum > StaticKinematicFilteringMode;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_Gravity, PxScene, const PxVec3 &, PxVec3 > Gravity;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_BounceThresholdVelocity, PxScene, const PxReal, PxReal > BounceThresholdVelocity;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_CCDMaxPasses, PxScene, PxU32, PxU32 > CCDMaxPasses;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_CCDMaxSeparation, PxScene, const PxReal, PxReal > CCDMaxSeparation;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_CCDThreshold, PxScene, const PxReal, PxReal > CCDThreshold;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_MaxBiasCoefficient, PxScene, const PxReal, PxReal > MaxBiasCoefficient;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_FrictionOffsetThreshold, PxScene, const PxReal, PxReal > FrictionOffsetThreshold;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_FrictionCorrelationDistance, PxScene, const PxReal, PxReal > FrictionCorrelationDistance;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_FrictionType, PxScene, PxFrictionType::Enum > FrictionType;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_SolverType, PxScene, PxSolverType::Enum > SolverType;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_VisualizationCullingBox, PxScene, const PxBounds3 &, PxBounds3 > VisualizationCullingBox;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_BroadPhaseType, PxScene, PxBroadPhaseType::Enum > BroadPhaseType;
PxReadOnlyCollectionPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_BroadPhaseRegions, PxScene, PxBroadPhaseRegionInfo > BroadPhaseRegions;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_TaskManager, PxScene, PxTaskManager * > TaskManager;
PxWriteOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_NbContactDataBlocks, PxScene, PxU32 > NbContactDataBlocks;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_MaxNbContactDataBlocksUsed, PxScene, PxU32 > MaxNbContactDataBlocksUsed;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_ContactReportStreamBufferSize, PxScene, PxU32 > ContactReportStreamBufferSize;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_SolverBatchSize, PxScene, PxU32, PxU32 > SolverBatchSize;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_SolverArticulationBatchSize, PxScene, PxU32, PxU32 > SolverArticulationBatchSize;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_WakeCounterResetValue, PxScene, PxReal > WakeCounterResetValue;
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_GpuDynamicsConfig, PxScene, PxgDynamicsMemoryConfig > GpuDynamicsConfig;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxScene_UserData, PxScene, void *, void * > UserData;
SimulationStatisticsProperty SimulationStatistics;
PX_PHYSX_CORE_API PxSceneGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxScene*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxSceneSQSystemGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxSceneSQSystemGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxSceneSQSystemGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 43; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxSceneSQSystemGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Flags, inStartIndex + 0 );;
inOperator( Limits, inStartIndex + 1 );;
inOperator( Timestamp, inStartIndex + 2 );;
inOperator( Name, inStartIndex + 3 );;
inOperator( Actors, inStartIndex + 4 );;
inOperator( SoftBodies, inStartIndex + 5 );;
inOperator( Articulations, inStartIndex + 6 );;
inOperator( Constraints, inStartIndex + 7 );;
inOperator( Aggregates, inStartIndex + 8 );;
inOperator( CpuDispatcher, inStartIndex + 9 );;
inOperator( CudaContextManager, inStartIndex + 10 );;
inOperator( SimulationEventCallback, inStartIndex + 11 );;
inOperator( ContactModifyCallback, inStartIndex + 12 );;
inOperator( CCDContactModifyCallback, inStartIndex + 13 );;
inOperator( BroadPhaseCallback, inStartIndex + 14 );;
inOperator( FilterShaderDataSize, inStartIndex + 15 );;
inOperator( FilterShader, inStartIndex + 16 );;
inOperator( FilterCallback, inStartIndex + 17 );;
inOperator( KinematicKinematicFilteringMode, inStartIndex + 18 );;
inOperator( StaticKinematicFilteringMode, inStartIndex + 19 );;
inOperator( Gravity, inStartIndex + 20 );;
inOperator( BounceThresholdVelocity, inStartIndex + 21 );;
inOperator( CCDMaxPasses, inStartIndex + 22 );;
inOperator( CCDMaxSeparation, inStartIndex + 23 );;
inOperator( CCDThreshold, inStartIndex + 24 );;
inOperator( MaxBiasCoefficient, inStartIndex + 25 );;
inOperator( FrictionOffsetThreshold, inStartIndex + 26 );;
inOperator( FrictionCorrelationDistance, inStartIndex + 27 );;
inOperator( FrictionType, inStartIndex + 28 );;
inOperator( SolverType, inStartIndex + 29 );;
inOperator( VisualizationCullingBox, inStartIndex + 30 );;
inOperator( BroadPhaseType, inStartIndex + 31 );;
inOperator( BroadPhaseRegions, inStartIndex + 32 );;
inOperator( TaskManager, inStartIndex + 33 );;
inOperator( NbContactDataBlocks, inStartIndex + 34 );;
inOperator( MaxNbContactDataBlocksUsed, inStartIndex + 35 );;
inOperator( ContactReportStreamBufferSize, inStartIndex + 36 );;
inOperator( SolverBatchSize, inStartIndex + 37 );;
inOperator( SolverArticulationBatchSize, inStartIndex + 38 );;
inOperator( WakeCounterResetValue, inStartIndex + 39 );;
inOperator( GpuDynamicsConfig, inStartIndex + 40 );;
inOperator( UserData, inStartIndex + 41 );;
inOperator( SimulationStatistics, inStartIndex + 42 );;
return 43 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxScene>
{
PxSceneGeneratedInfo Info;
const PxSceneGeneratedInfo* getInfo() { return &Info; }
};
class PxTetrahedronMeshGeometry;
struct PxTetrahedronMeshGeometryGeneratedValues
: PxGeometryGeneratedValues {
PxTetrahedronMesh * TetrahedronMesh;
PX_PHYSX_CORE_API PxTetrahedronMeshGeometryGeneratedValues( const PxTetrahedronMeshGeometry* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxTetrahedronMeshGeometry, TetrahedronMesh, PxTetrahedronMeshGeometryGeneratedValues)
struct PxTetrahedronMeshGeometryGeneratedInfo
: PxGeometryGeneratedInfo
{
static const char* getClassName() { return "PxTetrahedronMeshGeometry"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxTetrahedronMeshGeometry_TetrahedronMesh, PxTetrahedronMeshGeometry, PxTetrahedronMesh *, PxTetrahedronMesh * > TetrahedronMesh;
PX_PHYSX_CORE_API PxTetrahedronMeshGeometryGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxTetrahedronMeshGeometry*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxGeometryGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxGeometryGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxGeometryGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 1; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxGeometryGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( TetrahedronMesh, inStartIndex + 0 );;
return 1 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxTetrahedronMeshGeometry>
{
PxTetrahedronMeshGeometryGeneratedInfo Info;
const PxTetrahedronMeshGeometryGeneratedInfo* getInfo() { return &Info; }
};
class PxCustomGeometry;
struct PxCustomGeometryGeneratedValues
: PxGeometryGeneratedValues {
PxU32 CustomType;
PX_PHYSX_CORE_API PxCustomGeometryGeneratedValues( const PxCustomGeometry* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxCustomGeometry, CustomType, PxCustomGeometryGeneratedValues)
struct PxCustomGeometryGeneratedInfo
: PxGeometryGeneratedInfo
{
static const char* getClassName() { return "PxCustomGeometry"; }
PxCustomGeometryCustomTypeProperty CustomType;
PX_PHYSX_CORE_API PxCustomGeometryGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxCustomGeometry*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxGeometryGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxGeometryGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxGeometryGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 1; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxGeometryGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( CustomType, inStartIndex + 0 );;
return 1 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxCustomGeometry>
{
PxCustomGeometryGeneratedInfo Info;
const PxCustomGeometryGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxHeightFieldFormat__EnumConversion[] = {
{ "eS16_TM", static_cast<PxU32>( physx::PxHeightFieldFormat::eS16_TM ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxHeightFieldFormat::Enum > { PxEnumTraits() : NameConversion( g_physx__PxHeightFieldFormat__EnumConversion ) {} const PxU32ToName* NameConversion; };
static PxU32ToName g_physx__PxHeightFieldFlag__EnumConversion[] = {
{ "eNO_BOUNDARY_EDGES", static_cast<PxU32>( physx::PxHeightFieldFlag::eNO_BOUNDARY_EDGES ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxHeightFieldFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxHeightFieldFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxHeightFieldDesc;
struct PxHeightFieldDescGeneratedValues
{
PxU32 NbRows;
PxU32 NbColumns;
PxHeightFieldFormat::Enum Format;
PxStridedData Samples;
PxReal ConvexEdgeThreshold;
PxHeightFieldFlags Flags;
PX_PHYSX_CORE_API PxHeightFieldDescGeneratedValues( const PxHeightFieldDesc* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxHeightFieldDesc, NbRows, PxHeightFieldDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxHeightFieldDesc, NbColumns, PxHeightFieldDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxHeightFieldDesc, Format, PxHeightFieldDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxHeightFieldDesc, Samples, PxHeightFieldDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxHeightFieldDesc, ConvexEdgeThreshold, PxHeightFieldDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxHeightFieldDesc, Flags, PxHeightFieldDescGeneratedValues)
struct PxHeightFieldDescGeneratedInfo
{
static const char* getClassName() { return "PxHeightFieldDesc"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxHeightFieldDesc_NbRows, PxHeightFieldDesc, PxU32, PxU32 > NbRows;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxHeightFieldDesc_NbColumns, PxHeightFieldDesc, PxU32, PxU32 > NbColumns;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxHeightFieldDesc_Format, PxHeightFieldDesc, PxHeightFieldFormat::Enum, PxHeightFieldFormat::Enum > Format;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxHeightFieldDesc_Samples, PxHeightFieldDesc, PxStridedData, PxStridedData > Samples;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxHeightFieldDesc_ConvexEdgeThreshold, PxHeightFieldDesc, PxReal, PxReal > ConvexEdgeThreshold;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxHeightFieldDesc_Flags, PxHeightFieldDesc, PxHeightFieldFlags, PxHeightFieldFlags > Flags;
PX_PHYSX_CORE_API PxHeightFieldDescGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxHeightFieldDesc*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 6; }
static PxU32 totalPropertyCount() { return instancePropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( NbRows, inStartIndex + 0 );;
inOperator( NbColumns, inStartIndex + 1 );;
inOperator( Format, inStartIndex + 2 );;
inOperator( Samples, inStartIndex + 3 );;
inOperator( ConvexEdgeThreshold, inStartIndex + 4 );;
inOperator( Flags, inStartIndex + 5 );;
return 6 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxHeightFieldDesc>
{
PxHeightFieldDescGeneratedInfo Info;
const PxHeightFieldDescGeneratedInfo* getInfo() { return &Info; }
};
struct PxArticulationLimit;
struct PxArticulationLimitGeneratedValues
{
PxReal Low;
PxReal High;
PX_PHYSX_CORE_API PxArticulationLimitGeneratedValues( const PxArticulationLimit* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationLimit, Low, PxArticulationLimitGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationLimit, High, PxArticulationLimitGeneratedValues)
struct PxArticulationLimitGeneratedInfo
{
static const char* getClassName() { return "PxArticulationLimit"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationLimit_Low, PxArticulationLimit, PxReal, PxReal > Low;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationLimit_High, PxArticulationLimit, PxReal, PxReal > High;
PX_PHYSX_CORE_API PxArticulationLimitGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxArticulationLimit*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 2; }
static PxU32 totalPropertyCount() { return instancePropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Low, inStartIndex + 0 );;
inOperator( High, inStartIndex + 1 );;
return 2 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxArticulationLimit>
{
PxArticulationLimitGeneratedInfo Info;
const PxArticulationLimitGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxArticulationDriveType__EnumConversion[] = {
{ "eFORCE", static_cast<PxU32>( physx::PxArticulationDriveType::eFORCE ) },
{ "eACCELERATION", static_cast<PxU32>( physx::PxArticulationDriveType::eACCELERATION ) },
{ "eTARGET", static_cast<PxU32>( physx::PxArticulationDriveType::eTARGET ) },
{ "eVELOCITY", static_cast<PxU32>( physx::PxArticulationDriveType::eVELOCITY ) },
{ "eNONE", static_cast<PxU32>( physx::PxArticulationDriveType::eNONE ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxArticulationDriveType::Enum > { PxEnumTraits() : NameConversion( g_physx__PxArticulationDriveType__EnumConversion ) {} const PxU32ToName* NameConversion; };
struct PxArticulationDrive;
struct PxArticulationDriveGeneratedValues
{
PxReal Stiffness;
PxReal Damping;
PxReal MaxForce;
PxArticulationDriveType::Enum DriveType;
PX_PHYSX_CORE_API PxArticulationDriveGeneratedValues( const PxArticulationDrive* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationDrive, Stiffness, PxArticulationDriveGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationDrive, Damping, PxArticulationDriveGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationDrive, MaxForce, PxArticulationDriveGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationDrive, DriveType, PxArticulationDriveGeneratedValues)
struct PxArticulationDriveGeneratedInfo
{
static const char* getClassName() { return "PxArticulationDrive"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationDrive_Stiffness, PxArticulationDrive, PxReal, PxReal > Stiffness;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationDrive_Damping, PxArticulationDrive, PxReal, PxReal > Damping;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationDrive_MaxForce, PxArticulationDrive, PxReal, PxReal > MaxForce;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxArticulationDrive_DriveType, PxArticulationDrive, PxArticulationDriveType::Enum, PxArticulationDriveType::Enum > DriveType;
PX_PHYSX_CORE_API PxArticulationDriveGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxArticulationDrive*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 4; }
static PxU32 totalPropertyCount() { return instancePropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( Stiffness, inStartIndex + 0 );;
inOperator( Damping, inStartIndex + 1 );;
inOperator( MaxForce, inStartIndex + 2 );;
inOperator( DriveType, inStartIndex + 3 );;
return 4 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxArticulationDrive>
{
PxArticulationDriveGeneratedInfo Info;
const PxArticulationDriveGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxDynamicTreeSecondaryPruner__EnumConversion[] = {
{ "eNONE", static_cast<PxU32>( physx::PxDynamicTreeSecondaryPruner::eNONE ) },
{ "eBUCKET", static_cast<PxU32>( physx::PxDynamicTreeSecondaryPruner::eBUCKET ) },
{ "eINCREMENTAL", static_cast<PxU32>( physx::PxDynamicTreeSecondaryPruner::eINCREMENTAL ) },
{ "eBVH", static_cast<PxU32>( physx::PxDynamicTreeSecondaryPruner::eBVH ) },
{ "eLAST", static_cast<PxU32>( physx::PxDynamicTreeSecondaryPruner::eLAST ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxDynamicTreeSecondaryPruner::Enum > { PxEnumTraits() : NameConversion( g_physx__PxDynamicTreeSecondaryPruner__EnumConversion ) {} const PxU32ToName* NameConversion; };
static PxU32ToName g_physx__PxBVHBuildStrategy__EnumConversion[] = {
{ "eFAST", static_cast<PxU32>( physx::PxBVHBuildStrategy::eFAST ) },
{ "eDEFAULT", static_cast<PxU32>( physx::PxBVHBuildStrategy::eDEFAULT ) },
{ "eSAH", static_cast<PxU32>( physx::PxBVHBuildStrategy::eSAH ) },
{ "eLAST", static_cast<PxU32>( physx::PxBVHBuildStrategy::eLAST ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxBVHBuildStrategy::Enum > { PxEnumTraits() : NameConversion( g_physx__PxBVHBuildStrategy__EnumConversion ) {} const PxU32ToName* NameConversion; };
class PxSceneQueryDesc;
struct PxSceneQueryDescGeneratedValues
{
_Bool IsValid;
PxPruningStructureType::Enum StaticStructure;
PxPruningStructureType::Enum DynamicStructure;
PxU32 DynamicTreeRebuildRateHint;
PxDynamicTreeSecondaryPruner::Enum DynamicTreeSecondaryPruner;
PxBVHBuildStrategy::Enum StaticBVHBuildStrategy;
PxBVHBuildStrategy::Enum DynamicBVHBuildStrategy;
PxU32 StaticNbObjectsPerNode;
PxU32 DynamicNbObjectsPerNode;
PxSceneQueryUpdateMode::Enum SceneQueryUpdateMode;
PX_PHYSX_CORE_API PxSceneQueryDescGeneratedValues( const PxSceneQueryDesc* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQueryDesc, IsValid, PxSceneQueryDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQueryDesc, StaticStructure, PxSceneQueryDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQueryDesc, DynamicStructure, PxSceneQueryDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQueryDesc, DynamicTreeRebuildRateHint, PxSceneQueryDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQueryDesc, DynamicTreeSecondaryPruner, PxSceneQueryDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQueryDesc, StaticBVHBuildStrategy, PxSceneQueryDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQueryDesc, DynamicBVHBuildStrategy, PxSceneQueryDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQueryDesc, StaticNbObjectsPerNode, PxSceneQueryDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQueryDesc, DynamicNbObjectsPerNode, PxSceneQueryDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQueryDesc, SceneQueryUpdateMode, PxSceneQueryDescGeneratedValues)
struct PxSceneQueryDescGeneratedInfo
{
static const char* getClassName() { return "PxSceneQueryDesc"; }
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneQueryDesc_IsValid, PxSceneQueryDesc, _Bool > IsValid;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneQueryDesc_StaticStructure, PxSceneQueryDesc, PxPruningStructureType::Enum, PxPruningStructureType::Enum > StaticStructure;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneQueryDesc_DynamicStructure, PxSceneQueryDesc, PxPruningStructureType::Enum, PxPruningStructureType::Enum > DynamicStructure;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneQueryDesc_DynamicTreeRebuildRateHint, PxSceneQueryDesc, PxU32, PxU32 > DynamicTreeRebuildRateHint;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneQueryDesc_DynamicTreeSecondaryPruner, PxSceneQueryDesc, PxDynamicTreeSecondaryPruner::Enum, PxDynamicTreeSecondaryPruner::Enum > DynamicTreeSecondaryPruner;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneQueryDesc_StaticBVHBuildStrategy, PxSceneQueryDesc, PxBVHBuildStrategy::Enum, PxBVHBuildStrategy::Enum > StaticBVHBuildStrategy;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneQueryDesc_DynamicBVHBuildStrategy, PxSceneQueryDesc, PxBVHBuildStrategy::Enum, PxBVHBuildStrategy::Enum > DynamicBVHBuildStrategy;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneQueryDesc_StaticNbObjectsPerNode, PxSceneQueryDesc, PxU32, PxU32 > StaticNbObjectsPerNode;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneQueryDesc_DynamicNbObjectsPerNode, PxSceneQueryDesc, PxU32, PxU32 > DynamicNbObjectsPerNode;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneQueryDesc_SceneQueryUpdateMode, PxSceneQueryDesc, PxSceneQueryUpdateMode::Enum, PxSceneQueryUpdateMode::Enum > SceneQueryUpdateMode;
PX_PHYSX_CORE_API PxSceneQueryDescGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxSceneQueryDesc*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 10; }
static PxU32 totalPropertyCount() { return instancePropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( IsValid, inStartIndex + 0 );;
inOperator( StaticStructure, inStartIndex + 1 );;
inOperator( DynamicStructure, inStartIndex + 2 );;
inOperator( DynamicTreeRebuildRateHint, inStartIndex + 3 );;
inOperator( DynamicTreeSecondaryPruner, inStartIndex + 4 );;
inOperator( StaticBVHBuildStrategy, inStartIndex + 5 );;
inOperator( DynamicBVHBuildStrategy, inStartIndex + 6 );;
inOperator( StaticNbObjectsPerNode, inStartIndex + 7 );;
inOperator( DynamicNbObjectsPerNode, inStartIndex + 8 );;
inOperator( SceneQueryUpdateMode, inStartIndex + 9 );;
return 10 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxSceneQueryDesc>
{
PxSceneQueryDescGeneratedInfo Info;
const PxSceneQueryDescGeneratedInfo* getInfo() { return &Info; }
};
class PxSceneDesc;
struct PxSceneDescGeneratedValues
: PxSceneQueryDescGeneratedValues {
PxVec3 Gravity;
PxSimulationEventCallback * SimulationEventCallback;
PxContactModifyCallback * ContactModifyCallback;
PxCCDContactModifyCallback * CcdContactModifyCallback;
const void * FilterShaderData;
PxU32 FilterShaderDataSize;
PxSimulationFilterShader FilterShader;
PxSimulationFilterCallback * FilterCallback;
PxPairFilteringMode::Enum KineKineFilteringMode;
PxPairFilteringMode::Enum StaticKineFilteringMode;
PxBroadPhaseType::Enum BroadPhaseType;
PxBroadPhaseCallback * BroadPhaseCallback;
PxSceneLimits Limits;
PxFrictionType::Enum FrictionType;
PxSolverType::Enum SolverType;
PxReal BounceThresholdVelocity;
PxReal FrictionOffsetThreshold;
PxReal FrictionCorrelationDistance;
PxSceneFlags Flags;
PxCpuDispatcher * CpuDispatcher;
PxCudaContextManager * CudaContextManager;
void * UserData;
PxU32 SolverBatchSize;
PxU32 SolverArticulationBatchSize;
PxU32 NbContactDataBlocks;
PxU32 MaxNbContactDataBlocks;
PxReal MaxBiasCoefficient;
PxU32 ContactReportStreamBufferSize;
PxU32 CcdMaxPasses;
PxReal CcdThreshold;
PxReal CcdMaxSeparation;
PxReal WakeCounterResetValue;
PxBounds3 SanityBounds;
PxgDynamicsMemoryConfig GpuDynamicsConfig;
PxU32 GpuMaxNumPartitions;
PxU32 GpuMaxNumStaticPartitions;
PxU32 GpuComputeVersion;
PxU32 ContactPairSlabSize;
PX_PHYSX_CORE_API PxSceneDescGeneratedValues( const PxSceneDesc* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, Gravity, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, SimulationEventCallback, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, ContactModifyCallback, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, CcdContactModifyCallback, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, FilterShaderData, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, FilterShaderDataSize, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, FilterShader, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, FilterCallback, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, KineKineFilteringMode, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, StaticKineFilteringMode, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, BroadPhaseType, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, BroadPhaseCallback, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, Limits, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, FrictionType, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, SolverType, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, BounceThresholdVelocity, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, FrictionOffsetThreshold, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, FrictionCorrelationDistance, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, Flags, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, CpuDispatcher, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, CudaContextManager, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, UserData, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, SolverBatchSize, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, SolverArticulationBatchSize, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, NbContactDataBlocks, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, MaxNbContactDataBlocks, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, MaxBiasCoefficient, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, ContactReportStreamBufferSize, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, CcdMaxPasses, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, CcdThreshold, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, CcdMaxSeparation, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, WakeCounterResetValue, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, SanityBounds, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, GpuDynamicsConfig, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, GpuMaxNumPartitions, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, GpuMaxNumStaticPartitions, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, GpuComputeVersion, PxSceneDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, ContactPairSlabSize, PxSceneDescGeneratedValues)
struct PxSceneDescGeneratedInfo
: PxSceneQueryDescGeneratedInfo
{
static const char* getClassName() { return "PxSceneDesc"; }
PxWriteOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_ToDefault, PxSceneDesc, const PxTolerancesScale & > ToDefault;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_Gravity, PxSceneDesc, PxVec3, PxVec3 > Gravity;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_SimulationEventCallback, PxSceneDesc, PxSimulationEventCallback *, PxSimulationEventCallback * > SimulationEventCallback;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_ContactModifyCallback, PxSceneDesc, PxContactModifyCallback *, PxContactModifyCallback * > ContactModifyCallback;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_CcdContactModifyCallback, PxSceneDesc, PxCCDContactModifyCallback *, PxCCDContactModifyCallback * > CcdContactModifyCallback;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_FilterShaderData, PxSceneDesc, const void *, const void * > FilterShaderData;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_FilterShaderDataSize, PxSceneDesc, PxU32, PxU32 > FilterShaderDataSize;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_FilterShader, PxSceneDesc, PxSimulationFilterShader, PxSimulationFilterShader > FilterShader;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_FilterCallback, PxSceneDesc, PxSimulationFilterCallback *, PxSimulationFilterCallback * > FilterCallback;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_KineKineFilteringMode, PxSceneDesc, PxPairFilteringMode::Enum, PxPairFilteringMode::Enum > KineKineFilteringMode;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_StaticKineFilteringMode, PxSceneDesc, PxPairFilteringMode::Enum, PxPairFilteringMode::Enum > StaticKineFilteringMode;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_BroadPhaseType, PxSceneDesc, PxBroadPhaseType::Enum, PxBroadPhaseType::Enum > BroadPhaseType;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_BroadPhaseCallback, PxSceneDesc, PxBroadPhaseCallback *, PxBroadPhaseCallback * > BroadPhaseCallback;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_Limits, PxSceneDesc, PxSceneLimits, PxSceneLimits > Limits;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_FrictionType, PxSceneDesc, PxFrictionType::Enum, PxFrictionType::Enum > FrictionType;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_SolverType, PxSceneDesc, PxSolverType::Enum, PxSolverType::Enum > SolverType;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_BounceThresholdVelocity, PxSceneDesc, PxReal, PxReal > BounceThresholdVelocity;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_FrictionOffsetThreshold, PxSceneDesc, PxReal, PxReal > FrictionOffsetThreshold;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_FrictionCorrelationDistance, PxSceneDesc, PxReal, PxReal > FrictionCorrelationDistance;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_Flags, PxSceneDesc, PxSceneFlags, PxSceneFlags > Flags;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_CpuDispatcher, PxSceneDesc, PxCpuDispatcher *, PxCpuDispatcher * > CpuDispatcher;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_CudaContextManager, PxSceneDesc, PxCudaContextManager *, PxCudaContextManager * > CudaContextManager;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_UserData, PxSceneDesc, void *, void * > UserData;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_SolverBatchSize, PxSceneDesc, PxU32, PxU32 > SolverBatchSize;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_SolverArticulationBatchSize, PxSceneDesc, PxU32, PxU32 > SolverArticulationBatchSize;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_NbContactDataBlocks, PxSceneDesc, PxU32, PxU32 > NbContactDataBlocks;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_MaxNbContactDataBlocks, PxSceneDesc, PxU32, PxU32 > MaxNbContactDataBlocks;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_MaxBiasCoefficient, PxSceneDesc, PxReal, PxReal > MaxBiasCoefficient;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_ContactReportStreamBufferSize, PxSceneDesc, PxU32, PxU32 > ContactReportStreamBufferSize;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_CcdMaxPasses, PxSceneDesc, PxU32, PxU32 > CcdMaxPasses;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_CcdThreshold, PxSceneDesc, PxReal, PxReal > CcdThreshold;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_CcdMaxSeparation, PxSceneDesc, PxReal, PxReal > CcdMaxSeparation;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_WakeCounterResetValue, PxSceneDesc, PxReal, PxReal > WakeCounterResetValue;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_SanityBounds, PxSceneDesc, PxBounds3, PxBounds3 > SanityBounds;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_GpuDynamicsConfig, PxSceneDesc, PxgDynamicsMemoryConfig, PxgDynamicsMemoryConfig > GpuDynamicsConfig;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_GpuMaxNumPartitions, PxSceneDesc, PxU32, PxU32 > GpuMaxNumPartitions;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_GpuMaxNumStaticPartitions, PxSceneDesc, PxU32, PxU32 > GpuMaxNumStaticPartitions;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_GpuComputeVersion, PxSceneDesc, PxU32, PxU32 > GpuComputeVersion;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneDesc_ContactPairSlabSize, PxSceneDesc, PxU32, PxU32 > ContactPairSlabSize;
PX_PHYSX_CORE_API PxSceneDescGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxSceneDesc*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
inOperator( *static_cast<PxSceneQueryDescGeneratedInfo*>( this ) );
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inStartIndex = PxSceneQueryDescGeneratedInfo::visitBaseProperties( inOperator, inStartIndex );
inStartIndex = PxSceneQueryDescGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex );
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 39; }
static PxU32 totalPropertyCount() { return instancePropertyCount()
+ PxSceneQueryDescGeneratedInfo::totalPropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( ToDefault, inStartIndex + 0 );;
inOperator( Gravity, inStartIndex + 1 );;
inOperator( SimulationEventCallback, inStartIndex + 2 );;
inOperator( ContactModifyCallback, inStartIndex + 3 );;
inOperator( CcdContactModifyCallback, inStartIndex + 4 );;
inOperator( FilterShaderData, inStartIndex + 5 );;
inOperator( FilterShaderDataSize, inStartIndex + 6 );;
inOperator( FilterShader, inStartIndex + 7 );;
inOperator( FilterCallback, inStartIndex + 8 );;
inOperator( KineKineFilteringMode, inStartIndex + 9 );;
inOperator( StaticKineFilteringMode, inStartIndex + 10 );;
inOperator( BroadPhaseType, inStartIndex + 11 );;
inOperator( BroadPhaseCallback, inStartIndex + 12 );;
inOperator( Limits, inStartIndex + 13 );;
inOperator( FrictionType, inStartIndex + 14 );;
inOperator( SolverType, inStartIndex + 15 );;
inOperator( BounceThresholdVelocity, inStartIndex + 16 );;
inOperator( FrictionOffsetThreshold, inStartIndex + 17 );;
inOperator( FrictionCorrelationDistance, inStartIndex + 18 );;
inOperator( Flags, inStartIndex + 19 );;
inOperator( CpuDispatcher, inStartIndex + 20 );;
inOperator( CudaContextManager, inStartIndex + 21 );;
inOperator( UserData, inStartIndex + 22 );;
inOperator( SolverBatchSize, inStartIndex + 23 );;
inOperator( SolverArticulationBatchSize, inStartIndex + 24 );;
inOperator( NbContactDataBlocks, inStartIndex + 25 );;
inOperator( MaxNbContactDataBlocks, inStartIndex + 26 );;
inOperator( MaxBiasCoefficient, inStartIndex + 27 );;
inOperator( ContactReportStreamBufferSize, inStartIndex + 28 );;
inOperator( CcdMaxPasses, inStartIndex + 29 );;
inOperator( CcdThreshold, inStartIndex + 30 );;
inOperator( CcdMaxSeparation, inStartIndex + 31 );;
inOperator( WakeCounterResetValue, inStartIndex + 32 );;
inOperator( SanityBounds, inStartIndex + 33 );;
inOperator( GpuDynamicsConfig, inStartIndex + 34 );;
inOperator( GpuMaxNumPartitions, inStartIndex + 35 );;
inOperator( GpuMaxNumStaticPartitions, inStartIndex + 36 );;
inOperator( GpuComputeVersion, inStartIndex + 37 );;
inOperator( ContactPairSlabSize, inStartIndex + 38 );;
return 39 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxSceneDesc>
{
PxSceneDescGeneratedInfo Info;
const PxSceneDescGeneratedInfo* getInfo() { return &Info; }
};
class PxBroadPhaseDesc;
struct PxBroadPhaseDescGeneratedValues
{
_Bool IsValid;
PxBroadPhaseType::Enum MType;
PxU64 MContextID;
PxCudaContextManager * MContextManager;
PxU32 MFoundLostPairsCapacity;
_Bool MDiscardStaticVsKinematic;
_Bool MDiscardKinematicVsKinematic;
PX_PHYSX_CORE_API PxBroadPhaseDescGeneratedValues( const PxBroadPhaseDesc* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxBroadPhaseDesc, IsValid, PxBroadPhaseDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxBroadPhaseDesc, MType, PxBroadPhaseDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxBroadPhaseDesc, MContextID, PxBroadPhaseDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxBroadPhaseDesc, MContextManager, PxBroadPhaseDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxBroadPhaseDesc, MFoundLostPairsCapacity, PxBroadPhaseDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxBroadPhaseDesc, MDiscardStaticVsKinematic, PxBroadPhaseDescGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxBroadPhaseDesc, MDiscardKinematicVsKinematic, PxBroadPhaseDescGeneratedValues)
struct PxBroadPhaseDescGeneratedInfo
{
static const char* getClassName() { return "PxBroadPhaseDesc"; }
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxBroadPhaseDesc_IsValid, PxBroadPhaseDesc, _Bool > IsValid;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxBroadPhaseDesc_MType, PxBroadPhaseDesc, PxBroadPhaseType::Enum, PxBroadPhaseType::Enum > MType;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxBroadPhaseDesc_MContextID, PxBroadPhaseDesc, PxU64, PxU64 > MContextID;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxBroadPhaseDesc_MContextManager, PxBroadPhaseDesc, PxCudaContextManager *, PxCudaContextManager * > MContextManager;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxBroadPhaseDesc_MFoundLostPairsCapacity, PxBroadPhaseDesc, PxU32, PxU32 > MFoundLostPairsCapacity;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxBroadPhaseDesc_MDiscardStaticVsKinematic, PxBroadPhaseDesc, _Bool, _Bool > MDiscardStaticVsKinematic;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxBroadPhaseDesc_MDiscardKinematicVsKinematic, PxBroadPhaseDesc, _Bool, _Bool > MDiscardKinematicVsKinematic;
PX_PHYSX_CORE_API PxBroadPhaseDescGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxBroadPhaseDesc*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 7; }
static PxU32 totalPropertyCount() { return instancePropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( IsValid, inStartIndex + 0 );;
inOperator( MType, inStartIndex + 1 );;
inOperator( MContextID, inStartIndex + 2 );;
inOperator( MContextManager, inStartIndex + 3 );;
inOperator( MFoundLostPairsCapacity, inStartIndex + 4 );;
inOperator( MDiscardStaticVsKinematic, inStartIndex + 5 );;
inOperator( MDiscardKinematicVsKinematic, inStartIndex + 6 );;
return 7 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxBroadPhaseDesc>
{
PxBroadPhaseDescGeneratedInfo Info;
const PxBroadPhaseDescGeneratedInfo* getInfo() { return &Info; }
};
class PxSceneLimits;
struct PxSceneLimitsGeneratedValues
{
PxU32 MaxNbActors;
PxU32 MaxNbBodies;
PxU32 MaxNbStaticShapes;
PxU32 MaxNbDynamicShapes;
PxU32 MaxNbAggregates;
PxU32 MaxNbConstraints;
PxU32 MaxNbRegions;
PxU32 MaxNbBroadPhaseOverlaps;
PX_PHYSX_CORE_API PxSceneLimitsGeneratedValues( const PxSceneLimits* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneLimits, MaxNbActors, PxSceneLimitsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneLimits, MaxNbBodies, PxSceneLimitsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneLimits, MaxNbStaticShapes, PxSceneLimitsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneLimits, MaxNbDynamicShapes, PxSceneLimitsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneLimits, MaxNbAggregates, PxSceneLimitsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneLimits, MaxNbConstraints, PxSceneLimitsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneLimits, MaxNbRegions, PxSceneLimitsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneLimits, MaxNbBroadPhaseOverlaps, PxSceneLimitsGeneratedValues)
struct PxSceneLimitsGeneratedInfo
{
static const char* getClassName() { return "PxSceneLimits"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneLimits_MaxNbActors, PxSceneLimits, PxU32, PxU32 > MaxNbActors;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneLimits_MaxNbBodies, PxSceneLimits, PxU32, PxU32 > MaxNbBodies;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneLimits_MaxNbStaticShapes, PxSceneLimits, PxU32, PxU32 > MaxNbStaticShapes;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneLimits_MaxNbDynamicShapes, PxSceneLimits, PxU32, PxU32 > MaxNbDynamicShapes;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneLimits_MaxNbAggregates, PxSceneLimits, PxU32, PxU32 > MaxNbAggregates;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneLimits_MaxNbConstraints, PxSceneLimits, PxU32, PxU32 > MaxNbConstraints;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneLimits_MaxNbRegions, PxSceneLimits, PxU32, PxU32 > MaxNbRegions;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSceneLimits_MaxNbBroadPhaseOverlaps, PxSceneLimits, PxU32, PxU32 > MaxNbBroadPhaseOverlaps;
PX_PHYSX_CORE_API PxSceneLimitsGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxSceneLimits*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 8; }
static PxU32 totalPropertyCount() { return instancePropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( MaxNbActors, inStartIndex + 0 );;
inOperator( MaxNbBodies, inStartIndex + 1 );;
inOperator( MaxNbStaticShapes, inStartIndex + 2 );;
inOperator( MaxNbDynamicShapes, inStartIndex + 3 );;
inOperator( MaxNbAggregates, inStartIndex + 4 );;
inOperator( MaxNbConstraints, inStartIndex + 5 );;
inOperator( MaxNbRegions, inStartIndex + 6 );;
inOperator( MaxNbBroadPhaseOverlaps, inStartIndex + 7 );;
return 8 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxSceneLimits>
{
PxSceneLimitsGeneratedInfo Info;
const PxSceneLimitsGeneratedInfo* getInfo() { return &Info; }
};
struct PxgDynamicsMemoryConfig;
struct PxgDynamicsMemoryConfigGeneratedValues
{
_Bool IsValid;
PxU32 TempBufferCapacity;
PxU32 MaxRigidContactCount;
PxU32 MaxRigidPatchCount;
PxU32 HeapCapacity;
PxU32 FoundLostPairsCapacity;
PxU32 FoundLostAggregatePairsCapacity;
PxU32 TotalAggregatePairsCapacity;
PxU32 MaxSoftBodyContacts;
PxU32 MaxFemClothContacts;
PxU32 MaxParticleContacts;
PxU32 CollisionStackSize;
PxU32 MaxHairContacts;
PX_PHYSX_CORE_API PxgDynamicsMemoryConfigGeneratedValues( const PxgDynamicsMemoryConfig* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, IsValid, PxgDynamicsMemoryConfigGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, TempBufferCapacity, PxgDynamicsMemoryConfigGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, MaxRigidContactCount, PxgDynamicsMemoryConfigGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, MaxRigidPatchCount, PxgDynamicsMemoryConfigGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, HeapCapacity, PxgDynamicsMemoryConfigGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, FoundLostPairsCapacity, PxgDynamicsMemoryConfigGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, FoundLostAggregatePairsCapacity, PxgDynamicsMemoryConfigGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, TotalAggregatePairsCapacity, PxgDynamicsMemoryConfigGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, MaxSoftBodyContacts, PxgDynamicsMemoryConfigGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, MaxFemClothContacts, PxgDynamicsMemoryConfigGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, MaxParticleContacts, PxgDynamicsMemoryConfigGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, CollisionStackSize, PxgDynamicsMemoryConfigGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, MaxHairContacts, PxgDynamicsMemoryConfigGeneratedValues)
struct PxgDynamicsMemoryConfigGeneratedInfo
{
static const char* getClassName() { return "PxgDynamicsMemoryConfig"; }
PxReadOnlyPropertyInfo<PX_PROPERTY_INFO_NAME::PxgDynamicsMemoryConfig_IsValid, PxgDynamicsMemoryConfig, _Bool > IsValid;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxgDynamicsMemoryConfig_TempBufferCapacity, PxgDynamicsMemoryConfig, PxU32, PxU32 > TempBufferCapacity;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxgDynamicsMemoryConfig_MaxRigidContactCount, PxgDynamicsMemoryConfig, PxU32, PxU32 > MaxRigidContactCount;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxgDynamicsMemoryConfig_MaxRigidPatchCount, PxgDynamicsMemoryConfig, PxU32, PxU32 > MaxRigidPatchCount;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxgDynamicsMemoryConfig_HeapCapacity, PxgDynamicsMemoryConfig, PxU32, PxU32 > HeapCapacity;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxgDynamicsMemoryConfig_FoundLostPairsCapacity, PxgDynamicsMemoryConfig, PxU32, PxU32 > FoundLostPairsCapacity;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxgDynamicsMemoryConfig_FoundLostAggregatePairsCapacity, PxgDynamicsMemoryConfig, PxU32, PxU32 > FoundLostAggregatePairsCapacity;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxgDynamicsMemoryConfig_TotalAggregatePairsCapacity, PxgDynamicsMemoryConfig, PxU32, PxU32 > TotalAggregatePairsCapacity;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxgDynamicsMemoryConfig_MaxSoftBodyContacts, PxgDynamicsMemoryConfig, PxU32, PxU32 > MaxSoftBodyContacts;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxgDynamicsMemoryConfig_MaxFemClothContacts, PxgDynamicsMemoryConfig, PxU32, PxU32 > MaxFemClothContacts;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxgDynamicsMemoryConfig_MaxParticleContacts, PxgDynamicsMemoryConfig, PxU32, PxU32 > MaxParticleContacts;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxgDynamicsMemoryConfig_CollisionStackSize, PxgDynamicsMemoryConfig, PxU32, PxU32 > CollisionStackSize;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxgDynamicsMemoryConfig_MaxHairContacts, PxgDynamicsMemoryConfig, PxU32, PxU32 > MaxHairContacts;
PX_PHYSX_CORE_API PxgDynamicsMemoryConfigGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxgDynamicsMemoryConfig*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 13; }
static PxU32 totalPropertyCount() { return instancePropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( IsValid, inStartIndex + 0 );;
inOperator( TempBufferCapacity, inStartIndex + 1 );;
inOperator( MaxRigidContactCount, inStartIndex + 2 );;
inOperator( MaxRigidPatchCount, inStartIndex + 3 );;
inOperator( HeapCapacity, inStartIndex + 4 );;
inOperator( FoundLostPairsCapacity, inStartIndex + 5 );;
inOperator( FoundLostAggregatePairsCapacity, inStartIndex + 6 );;
inOperator( TotalAggregatePairsCapacity, inStartIndex + 7 );;
inOperator( MaxSoftBodyContacts, inStartIndex + 8 );;
inOperator( MaxFemClothContacts, inStartIndex + 9 );;
inOperator( MaxParticleContacts, inStartIndex + 10 );;
inOperator( CollisionStackSize, inStartIndex + 11 );;
inOperator( MaxHairContacts, inStartIndex + 12 );;
return 13 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxgDynamicsMemoryConfig>
{
PxgDynamicsMemoryConfigGeneratedInfo Info;
const PxgDynamicsMemoryConfigGeneratedInfo* getInfo() { return &Info; }
};
static PxU32ToName g_physx__PxSimulationStatistics__RbPairStatsTypeConversion[] = {
{ "eDISCRETE_CONTACT_PAIRS", static_cast<PxU32>( physx::PxSimulationStatistics::eDISCRETE_CONTACT_PAIRS ) },
{ "eCCD_PAIRS", static_cast<PxU32>( physx::PxSimulationStatistics::eCCD_PAIRS ) },
{ "eMODIFIED_CONTACT_PAIRS", static_cast<PxU32>( physx::PxSimulationStatistics::eMODIFIED_CONTACT_PAIRS ) },
{ "eTRIGGER_PAIRS", static_cast<PxU32>( physx::PxSimulationStatistics::eTRIGGER_PAIRS ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits< physx::PxSimulationStatistics::RbPairStatsType > { PxEnumTraits() : NameConversion( g_physx__PxSimulationStatistics__RbPairStatsTypeConversion ) {} const PxU32ToName* NameConversion; };
class PxSimulationStatistics;
struct PxSimulationStatisticsGeneratedValues
{
PxU32 NbActiveConstraints;
PxU32 NbActiveDynamicBodies;
PxU32 NbActiveKinematicBodies;
PxU32 NbStaticBodies;
PxU32 NbDynamicBodies;
PxU32 NbKinematicBodies;
PxU32 NbAggregates;
PxU32 NbArticulations;
PxU32 NbAxisSolverConstraints;
PxU32 CompressedContactSize;
PxU32 RequiredContactConstraintMemory;
PxU32 PeakConstraintMemory;
PxU32 NbDiscreteContactPairsTotal;
PxU32 NbDiscreteContactPairsWithCacheHits;
PxU32 NbDiscreteContactPairsWithContacts;
PxU32 NbNewPairs;
PxU32 NbLostPairs;
PxU32 NbNewTouches;
PxU32 NbLostTouches;
PxU32 NbPartitions;
PxU64 GpuMemParticles;
PxU64 GpuMemSoftBodies;
PxU64 GpuMemFEMCloths;
PxU64 GpuMemHairSystems;
PxU64 GpuMemHeap;
PxU64 GpuMemHeapBroadPhase;
PxU64 GpuMemHeapNarrowPhase;
PxU64 GpuMemHeapSolver;
PxU64 GpuMemHeapArticulation;
PxU64 GpuMemHeapSimulation;
PxU64 GpuMemHeapSimulationArticulation;
PxU64 GpuMemHeapSimulationParticles;
PxU64 GpuMemHeapSimulationSoftBody;
PxU64 GpuMemHeapSimulationFEMCloth;
PxU64 GpuMemHeapSimulationHairSystem;
PxU64 GpuMemHeapParticles;
PxU64 GpuMemHeapSoftBodies;
PxU64 GpuMemHeapFEMCloths;
PxU64 GpuMemHeapHairSystems;
PxU64 GpuMemHeapOther;
PxU32 NbBroadPhaseAdds;
PxU32 NbBroadPhaseRemoves;
PxU32 NbDiscreteContactPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT];
PxU32 NbModifiedContactPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT];
PxU32 NbCCDPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT];
PxU32 NbTriggerPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT];
PxU32 NbShapes[PxGeometryType::eGEOMETRY_COUNT];
PX_PHYSX_CORE_API PxSimulationStatisticsGeneratedValues( const PxSimulationStatistics* inSource );
};
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbActiveConstraints, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbActiveDynamicBodies, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbActiveKinematicBodies, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbStaticBodies, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbDynamicBodies, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbKinematicBodies, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbAggregates, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbArticulations, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbAxisSolverConstraints, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, CompressedContactSize, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, RequiredContactConstraintMemory, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, PeakConstraintMemory, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbDiscreteContactPairsTotal, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbDiscreteContactPairsWithCacheHits, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbDiscreteContactPairsWithContacts, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbNewPairs, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbLostPairs, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbNewTouches, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbLostTouches, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbPartitions, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemParticles, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemSoftBodies, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemFEMCloths, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHairSystems, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeap, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapBroadPhase, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapNarrowPhase, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapSolver, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapArticulation, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapSimulation, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapSimulationArticulation, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapSimulationParticles, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapSimulationSoftBody, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapSimulationFEMCloth, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapSimulationHairSystem, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapParticles, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapSoftBodies, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapFEMCloths, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapHairSystems, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapOther, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbBroadPhaseAdds, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbBroadPhaseRemoves, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbDiscreteContactPairs, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbModifiedContactPairs, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbCCDPairs, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbTriggerPairs, PxSimulationStatisticsGeneratedValues)
DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbShapes, PxSimulationStatisticsGeneratedValues)
struct PxSimulationStatisticsGeneratedInfo
{
static const char* getClassName() { return "PxSimulationStatistics"; }
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_NbActiveConstraints, PxSimulationStatistics, PxU32, PxU32 > NbActiveConstraints;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_NbActiveDynamicBodies, PxSimulationStatistics, PxU32, PxU32 > NbActiveDynamicBodies;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_NbActiveKinematicBodies, PxSimulationStatistics, PxU32, PxU32 > NbActiveKinematicBodies;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_NbStaticBodies, PxSimulationStatistics, PxU32, PxU32 > NbStaticBodies;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_NbDynamicBodies, PxSimulationStatistics, PxU32, PxU32 > NbDynamicBodies;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_NbKinematicBodies, PxSimulationStatistics, PxU32, PxU32 > NbKinematicBodies;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_NbAggregates, PxSimulationStatistics, PxU32, PxU32 > NbAggregates;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_NbArticulations, PxSimulationStatistics, PxU32, PxU32 > NbArticulations;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_NbAxisSolverConstraints, PxSimulationStatistics, PxU32, PxU32 > NbAxisSolverConstraints;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_CompressedContactSize, PxSimulationStatistics, PxU32, PxU32 > CompressedContactSize;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_RequiredContactConstraintMemory, PxSimulationStatistics, PxU32, PxU32 > RequiredContactConstraintMemory;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_PeakConstraintMemory, PxSimulationStatistics, PxU32, PxU32 > PeakConstraintMemory;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_NbDiscreteContactPairsTotal, PxSimulationStatistics, PxU32, PxU32 > NbDiscreteContactPairsTotal;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_NbDiscreteContactPairsWithCacheHits, PxSimulationStatistics, PxU32, PxU32 > NbDiscreteContactPairsWithCacheHits;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_NbDiscreteContactPairsWithContacts, PxSimulationStatistics, PxU32, PxU32 > NbDiscreteContactPairsWithContacts;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_NbNewPairs, PxSimulationStatistics, PxU32, PxU32 > NbNewPairs;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_NbLostPairs, PxSimulationStatistics, PxU32, PxU32 > NbLostPairs;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_NbNewTouches, PxSimulationStatistics, PxU32, PxU32 > NbNewTouches;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_NbLostTouches, PxSimulationStatistics, PxU32, PxU32 > NbLostTouches;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_NbPartitions, PxSimulationStatistics, PxU32, PxU32 > NbPartitions;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_GpuMemParticles, PxSimulationStatistics, PxU64, PxU64 > GpuMemParticles;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_GpuMemSoftBodies, PxSimulationStatistics, PxU64, PxU64 > GpuMemSoftBodies;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_GpuMemFEMCloths, PxSimulationStatistics, PxU64, PxU64 > GpuMemFEMCloths;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_GpuMemHairSystems, PxSimulationStatistics, PxU64, PxU64 > GpuMemHairSystems;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_GpuMemHeap, PxSimulationStatistics, PxU64, PxU64 > GpuMemHeap;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_GpuMemHeapBroadPhase, PxSimulationStatistics, PxU64, PxU64 > GpuMemHeapBroadPhase;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_GpuMemHeapNarrowPhase, PxSimulationStatistics, PxU64, PxU64 > GpuMemHeapNarrowPhase;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_GpuMemHeapSolver, PxSimulationStatistics, PxU64, PxU64 > GpuMemHeapSolver;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_GpuMemHeapArticulation, PxSimulationStatistics, PxU64, PxU64 > GpuMemHeapArticulation;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_GpuMemHeapSimulation, PxSimulationStatistics, PxU64, PxU64 > GpuMemHeapSimulation;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_GpuMemHeapSimulationArticulation, PxSimulationStatistics, PxU64, PxU64 > GpuMemHeapSimulationArticulation;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_GpuMemHeapSimulationParticles, PxSimulationStatistics, PxU64, PxU64 > GpuMemHeapSimulationParticles;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_GpuMemHeapSimulationSoftBody, PxSimulationStatistics, PxU64, PxU64 > GpuMemHeapSimulationSoftBody;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_GpuMemHeapSimulationFEMCloth, PxSimulationStatistics, PxU64, PxU64 > GpuMemHeapSimulationFEMCloth;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_GpuMemHeapSimulationHairSystem, PxSimulationStatistics, PxU64, PxU64 > GpuMemHeapSimulationHairSystem;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_GpuMemHeapParticles, PxSimulationStatistics, PxU64, PxU64 > GpuMemHeapParticles;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_GpuMemHeapSoftBodies, PxSimulationStatistics, PxU64, PxU64 > GpuMemHeapSoftBodies;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_GpuMemHeapFEMCloths, PxSimulationStatistics, PxU64, PxU64 > GpuMemHeapFEMCloths;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_GpuMemHeapHairSystems, PxSimulationStatistics, PxU64, PxU64 > GpuMemHeapHairSystems;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_GpuMemHeapOther, PxSimulationStatistics, PxU64, PxU64 > GpuMemHeapOther;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_NbBroadPhaseAdds, PxSimulationStatistics, PxU32, PxU32 > NbBroadPhaseAdds;
PxPropertyInfo<PX_PROPERTY_INFO_NAME::PxSimulationStatistics_NbBroadPhaseRemoves, PxSimulationStatistics, PxU32, PxU32 > NbBroadPhaseRemoves;
NbDiscreteContactPairsProperty NbDiscreteContactPairs;
NbModifiedContactPairsProperty NbModifiedContactPairs;
NbCCDPairsProperty NbCCDPairs;
NbTriggerPairsProperty NbTriggerPairs;
NbShapesProperty NbShapes;
PX_PHYSX_CORE_API PxSimulationStatisticsGeneratedInfo();
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator inOperator ) const
{
return inOperator( reinterpret_cast<PxSimulationStatistics*>(NULL) );
}
template<typename TOperator>
void visitBases( TOperator inOperator )
{
PX_UNUSED(inOperator);
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
return inStartIndex;
}
static PxU32 instancePropertyCount() { return 47; }
static PxU32 totalPropertyCount() { return instancePropertyCount(); }
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const
{
PX_UNUSED(inOperator);
PX_UNUSED(inStartIndex);
inOperator( NbActiveConstraints, inStartIndex + 0 );;
inOperator( NbActiveDynamicBodies, inStartIndex + 1 );;
inOperator( NbActiveKinematicBodies, inStartIndex + 2 );;
inOperator( NbStaticBodies, inStartIndex + 3 );;
inOperator( NbDynamicBodies, inStartIndex + 4 );;
inOperator( NbKinematicBodies, inStartIndex + 5 );;
inOperator( NbAggregates, inStartIndex + 6 );;
inOperator( NbArticulations, inStartIndex + 7 );;
inOperator( NbAxisSolverConstraints, inStartIndex + 8 );;
inOperator( CompressedContactSize, inStartIndex + 9 );;
inOperator( RequiredContactConstraintMemory, inStartIndex + 10 );;
inOperator( PeakConstraintMemory, inStartIndex + 11 );;
inOperator( NbDiscreteContactPairsTotal, inStartIndex + 12 );;
inOperator( NbDiscreteContactPairsWithCacheHits, inStartIndex + 13 );;
inOperator( NbDiscreteContactPairsWithContacts, inStartIndex + 14 );;
inOperator( NbNewPairs, inStartIndex + 15 );;
inOperator( NbLostPairs, inStartIndex + 16 );;
inOperator( NbNewTouches, inStartIndex + 17 );;
inOperator( NbLostTouches, inStartIndex + 18 );;
inOperator( NbPartitions, inStartIndex + 19 );;
inOperator( GpuMemParticles, inStartIndex + 20 );;
inOperator( GpuMemSoftBodies, inStartIndex + 21 );;
inOperator( GpuMemFEMCloths, inStartIndex + 22 );;
inOperator( GpuMemHairSystems, inStartIndex + 23 );;
inOperator( GpuMemHeap, inStartIndex + 24 );;
inOperator( GpuMemHeapBroadPhase, inStartIndex + 25 );;
inOperator( GpuMemHeapNarrowPhase, inStartIndex + 26 );;
inOperator( GpuMemHeapSolver, inStartIndex + 27 );;
inOperator( GpuMemHeapArticulation, inStartIndex + 28 );;
inOperator( GpuMemHeapSimulation, inStartIndex + 29 );;
inOperator( GpuMemHeapSimulationArticulation, inStartIndex + 30 );;
inOperator( GpuMemHeapSimulationParticles, inStartIndex + 31 );;
inOperator( GpuMemHeapSimulationSoftBody, inStartIndex + 32 );;
inOperator( GpuMemHeapSimulationFEMCloth, inStartIndex + 33 );;
inOperator( GpuMemHeapSimulationHairSystem, inStartIndex + 34 );;
inOperator( GpuMemHeapParticles, inStartIndex + 35 );;
inOperator( GpuMemHeapSoftBodies, inStartIndex + 36 );;
inOperator( GpuMemHeapFEMCloths, inStartIndex + 37 );;
inOperator( GpuMemHeapHairSystems, inStartIndex + 38 );;
inOperator( GpuMemHeapOther, inStartIndex + 39 );;
inOperator( NbBroadPhaseAdds, inStartIndex + 40 );;
inOperator( NbBroadPhaseRemoves, inStartIndex + 41 );;
inOperator( NbDiscreteContactPairs, inStartIndex + 42 );;
inOperator( NbModifiedContactPairs, inStartIndex + 43 );;
inOperator( NbCCDPairs, inStartIndex + 44 );;
inOperator( NbTriggerPairs, inStartIndex + 45 );;
inOperator( NbShapes, inStartIndex + 46 );;
return 47 + inStartIndex;
}
};
template<> struct PxClassInfoTraits<PxSimulationStatistics>
{
PxSimulationStatisticsGeneratedInfo Info;
const PxSimulationStatisticsGeneratedInfo* getInfo() { return &Info; }
};
#undef THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON
#undef PX_PROPERTY_INFO_NAME
| 213,625 | C | 53.902596 | 218 | 0.791092 |
NVIDIA-Omniverse/PhysX/physx/source/physxmetadata/core/include/RepXMetaDataPropertyVisitor.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_REPX_META_DATA_PROPERTY_VISITOR_H
#define PX_REPX_META_DATA_PROPERTY_VISITOR_H
#include "PvdMetaDataPropertyVisitor.h"
namespace physx {
template<PxU32 TKey, typename TObjectType,typename TSetPropType, typename TPropertyType>
struct PxRepXPropertyAccessor : public Vd::ValueStructOffsetRecord
{
typedef PxPropertyInfo<TKey,TObjectType,TSetPropType,TPropertyType> TPropertyInfoType;
typedef TPropertyType prop_type;
const TPropertyInfoType mProperty;
PxRepXPropertyAccessor( const TPropertyInfoType& inProp )
: mProperty( inProp )
{
}
prop_type get( const TObjectType* inObj ) const { return mProperty.get( inObj ); }
void set( TObjectType* inObj, prop_type val ) const { return mProperty.set( inObj, val ); }
private:
PxRepXPropertyAccessor& operator=(const PxRepXPropertyAccessor&);
};
template<typename TSetPropType, typename TPropertyType>
struct PxRepXPropertyAccessor<PxPropertyInfoName::PxRigidDynamic_WakeCounter, PxRigidDynamic, TSetPropType, TPropertyType> : public Vd::ValueStructOffsetRecord
{
typedef PxPropertyInfo<PxPropertyInfoName::PxRigidDynamic_WakeCounter,PxRigidDynamic,TSetPropType,TPropertyType> TPropertyInfoType;
typedef TPropertyType prop_type;
const TPropertyInfoType mProperty;
PxRepXPropertyAccessor( const TPropertyInfoType& inProp )
: mProperty( inProp )
{
}
prop_type get( const PxRigidDynamic* inObj ) const { return mProperty.get( inObj ); }
void set( PxRigidDynamic* inObj, prop_type val ) const
{
PX_UNUSED(val);
PxRigidBodyFlags flags = inObj->getRigidBodyFlags();
if( !(flags & PxRigidBodyFlag::eKINEMATIC) )
return mProperty.set( inObj, val );
}
private:
PxRepXPropertyAccessor& operator=(const PxRepXPropertyAccessor&);
};
typedef PxReadOnlyPropertyInfo<PxPropertyInfoName::PxArticulationLink_InboundJoint, PxArticulationLink, PxArticulationJointReducedCoordinate *> TIncomingJointPropType;
//RepX cares about fewer property types than PVD does,
//but I want to reuse the accessor architecture as it
//greatly simplifies clients dealing with complex datatypes
template<typename TOperatorType>
struct RepXPropertyFilter
{
RepXPropertyFilter<TOperatorType> &operator=(const RepXPropertyFilter<TOperatorType> &);
Vd::PvdPropertyFilter<TOperatorType> mFilter;
RepXPropertyFilter( TOperatorType op ) : mFilter( op ) {}
RepXPropertyFilter( const RepXPropertyFilter<TOperatorType>& other ) : mFilter( other.mFilter ) {}
template<PxU32 TKey, typename TObjType, typename TPropertyType>
void operator()( const PxReadOnlyPropertyInfo<TKey,TObjType,TPropertyType>&, PxU32 ) {} //repx ignores read only and write only properties
template<PxU32 TKey, typename TObjType, typename TPropertyType>
void operator()( const PxWriteOnlyPropertyInfo<TKey,TObjType,TPropertyType>&, PxU32 ) {}
template<PxU32 TKey, typename TObjType, typename TCollectionType>
void operator()( const PxReadOnlyCollectionPropertyInfo<TKey, TObjType, TCollectionType>&, PxU32 ) {}
template<PxU32 TKey, typename TObjType, typename TCollectionType, typename TFilterType>
void operator()( const PxReadOnlyFilteredCollectionPropertyInfo<TKey, TObjType, TCollectionType, TFilterType >&, PxU32 ) {}
//forward these properties verbatim.
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType>
void operator()( const PxIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropertyType >& inProp, PxU32 idx )
{
mFilter( inProp, idx );
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType>
void operator()( const PxFixedSizeLookupTablePropertyInfo<TKey, TObjType, TIndexType,TPropertyType >& inProp, PxU32 idx )
{
mFilter( inProp, idx );
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType>
void operator()( const PxExtendedIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropertyType >& inProp, PxU32 idx)
{
mFilter( inProp, idx);
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TIndex2Type, typename TPropertyType>
void operator()( const PxDualIndexedPropertyInfo<TKey, TObjType, TIndexType, TIndex2Type, TPropertyType >& inProp, PxU32 idx )
{
mFilter( inProp, idx );
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TIndex2Type, typename TPropertyType>
void operator()( const PxExtendedDualIndexedPropertyInfo<TKey, TObjType, TIndexType, TIndex2Type, TPropertyType >& inProp, PxU32 idx )
{
mFilter( inProp, idx );
}
template<PxU32 TKey, typename TObjType, typename TPropertyType>
void operator()( const PxRangePropertyInfo<TKey, TObjType, TPropertyType>& inProp, PxU32 idx )
{
mFilter( inProp, idx );
}
template<PxU32 TKey, typename TObjType, typename TPropertyType>
void operator()( const PxBufferCollectionPropertyInfo<TKey, TObjType, TPropertyType>& inProp, PxU32 count )
{
mFilter( inProp, count );
}
template<PxU32 TKey, typename TObjType, typename TSetPropType, typename TPropertyType>
void operator()( const PxPropertyInfo<TKey,TObjType,TSetPropType,TPropertyType>& prop, PxU32 )
{
PxRepXPropertyAccessor< TKey, TObjType, TSetPropType, TPropertyType > theAccessor( prop );
mFilter.mOperator.pushName( prop.mName );
mFilter.template handleAccessor<TKey>( theAccessor );
mFilter.mOperator.popName();
}
void operator()(const PxRigidActorGlobalPosePropertyInfo& inProp, PxU32)
{
mFilter.mOperator.pushName(inProp.mName);
mFilter.mOperator.handleRigidActorGlobalPose(inProp);
mFilter.mOperator.popName();
}
void operator()( const PxRigidActorShapeCollection& inProp, PxU32 )
{
mFilter.mOperator.pushName( "Shapes" );
mFilter.mOperator.handleShapes( inProp );
mFilter.mOperator.popName();
}
void operator()( const PxArticulationLinkCollectionProp& inProp, PxU32 )
{
mFilter.mOperator.pushName( "Links" );
mFilter.mOperator.handleArticulationLinks( inProp );
mFilter.mOperator.popName();
}
void operator()( const PxShapeMaterialsProperty& inProp, PxU32 )
{
mFilter.mOperator.pushName( "Materials" );
mFilter.mOperator.handleShapeMaterials( inProp );
mFilter.mOperator.popName();
}
void operator()( const TIncomingJointPropType& inProp, PxU32 )
{
mFilter.mOperator.handleIncomingJoint( inProp );
}
void operator()( const PxShapeGeomProperty& inProp, PxU32 )
{
mFilter.mOperator.handleGeomProperty( inProp );
}
#define DEFINE_REPX_PROPERTY_NOP(datatype) \
template<PxU32 TKey, typename TObjType, typename TSetPropType> \
void operator()( const PxPropertyInfo<TKey,TObjType,TSetPropType,datatype>&, PxU32 ){}
DEFINE_REPX_PROPERTY_NOP( const void* )
DEFINE_REPX_PROPERTY_NOP( void* )
DEFINE_REPX_PROPERTY_NOP( PxSimulationFilterCallback * )
DEFINE_REPX_PROPERTY_NOP( physx::PxTaskManager * )
DEFINE_REPX_PROPERTY_NOP( PxSimulationFilterShader * )
DEFINE_REPX_PROPERTY_NOP( PxSimulationFilterShader)
DEFINE_REPX_PROPERTY_NOP( PxContactModifyCallback * )
DEFINE_REPX_PROPERTY_NOP( PxCCDContactModifyCallback * )
DEFINE_REPX_PROPERTY_NOP( PxSimulationEventCallback * )
DEFINE_REPX_PROPERTY_NOP( physx::PxCudaContextManager* )
DEFINE_REPX_PROPERTY_NOP( physx::PxCpuDispatcher * )
DEFINE_REPX_PROPERTY_NOP( PxRigidActor )
DEFINE_REPX_PROPERTY_NOP( const PxRigidActor )
DEFINE_REPX_PROPERTY_NOP( PxRigidActor& )
DEFINE_REPX_PROPERTY_NOP( const PxRigidActor& )
DEFINE_REPX_PROPERTY_NOP( PxScene* )
DEFINE_REPX_PROPERTY_NOP( PxAggregate * )
DEFINE_REPX_PROPERTY_NOP( PxArticulationReducedCoordinate& )
DEFINE_REPX_PROPERTY_NOP( const PxArticulationLink * )
DEFINE_REPX_PROPERTY_NOP( const PxRigidDynamic * )
DEFINE_REPX_PROPERTY_NOP( const PxRigidStatic * )
DEFINE_REPX_PROPERTY_NOP( PxStridedData ) //These are handled in a custom fasion.
};
}
#endif
| 9,616 | C | 42.713636 | 168 | 0.761543 |
NVIDIA-Omniverse/PhysX/physx/source/physxmetadata/core/include/PxMetaDataObjects.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_METADATAOBJECTS_H
#define PX_METADATAOBJECTS_H
#include "foundation/PxMemory.h"
#include "foundation/PxPhysicsVersion.h"
// include the base headers instead of the PxPhysicsAPI.h
//Geometry Library
#include "geometry/PxBoxGeometry.h"
#include "geometry/PxCapsuleGeometry.h"
#include "geometry/PxConvexMesh.h"
#include "geometry/PxConvexMeshGeometry.h"
#include "geometry/PxGeometry.h"
#include "geometry/PxGeometryHelpers.h"
#include "geometry/PxGeometryQuery.h"
#include "geometry/PxHeightField.h"
#include "geometry/PxHeightFieldDesc.h"
#include "geometry/PxHeightFieldFlag.h"
#include "geometry/PxHeightFieldGeometry.h"
#include "geometry/PxHeightFieldSample.h"
#include "geometry/PxMeshQuery.h"
#include "geometry/PxMeshScale.h"
#include "geometry/PxPlaneGeometry.h"
#include "geometry/PxSimpleTriangleMesh.h"
#include "geometry/PxSphereGeometry.h"
#include "geometry/PxTriangle.h"
#include "geometry/PxTriangleMesh.h"
#include "geometry/PxTriangleMeshGeometry.h"
#include "geometry/PxTetrahedron.h"
#include "geometry/PxTetrahedronMesh.h"
#include "geometry/PxTetrahedronMeshGeometry.h"
// PhysX Core SDK
#include "PxActor.h"
#include "PxAggregate.h"
#include "PxArticulationReducedCoordinate.h"
#include "PxArticulationJointReducedCoordinate.h"
#include "PxArticulationLink.h"
#include "PxClient.h"
#include "PxConstraint.h"
#include "PxConstraintDesc.h"
#include "PxContact.h"
#include "PxContactModifyCallback.h"
#include "PxDeletionListener.h"
#include "PxFiltering.h"
#include "PxForceMode.h"
#include "PxLockedData.h"
#include "PxMaterial.h"
#include "PxFEMSoftBodyMaterial.h"
#include "PxFEMClothMaterial.h"
#include "PxPBDMaterial.h"
#include "PxFLIPMaterial.h"
#include "PxMPMMaterial.h"
#include "PxPhysics.h"
#include "PxPhysXConfig.h"
#include "PxQueryFiltering.h"
#include "PxQueryReport.h"
#include "PxRigidActor.h"
#include "PxRigidBody.h"
#include "PxRigidDynamic.h"
#include "PxRigidStatic.h"
#include "PxScene.h"
#include "PxSceneDesc.h"
#include "PxSceneLock.h"
#include "PxShape.h"
#include "PxSimulationEventCallback.h"
#include "PxSimulationStatistics.h"
#include "PxVisualizationParameter.h"
#include "PxPruningStructure.h"
#if PX_LINUX && PX_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wreserved-identifier"
#endif
/** \addtogroup physics
@{
*/
namespace physx
{
class PxArticulationLink;
class PxArticulationJointReducedCoordinate;
struct PxPropertyInfoName
{
enum Enum
{
Unnamed = 0,
#include "PxAutoGeneratedMetaDataObjectNames.h"
LastPxPropertyInfoName
};
};
struct PxU32ToName
{
const char* mName;
PxU32 mValue;
};
struct PxPropertyInfoBase
{
const char* mName;
PxU32 mKey;
PxPropertyInfoBase( const char* n, PxU32 inKey )
: mName( n )
, mKey( inKey )
{
}
};
template<PxU32 TKey>
struct PxPropertyInfoParameterizedBase : public PxPropertyInfoBase
{
PxPropertyInfoParameterizedBase( const char* inName )
: PxPropertyInfoBase( inName, TKey ) {}
};
template<PxU32 TKey, typename TObjType, typename TPropertyType>
struct PxReadOnlyPropertyInfo : public PxPropertyInfoParameterizedBase<TKey>
{
typedef TPropertyType (*TGetterType)( const TObjType* );
TGetterType mGetter;
PxReadOnlyPropertyInfo( const char* inName, TGetterType inGetter )
: PxPropertyInfoParameterizedBase<TKey>( inName )
, mGetter( inGetter ) {}
TPropertyType get( const TObjType* inObj ) const { return mGetter( inObj ); }
};
template<PxU32 TKey, typename TObjType, typename TPropertyType>
struct PxWriteOnlyPropertyInfo : public PxPropertyInfoParameterizedBase<TKey>
{
typedef void(*TSetterType)( TObjType*, TPropertyType inArg );
TSetterType mSetter;
PxWriteOnlyPropertyInfo( const char* inName, TSetterType inSetter )
: PxPropertyInfoParameterizedBase<TKey>( inName )
, mSetter( inSetter ) {}
void set( TObjType* inObj, TPropertyType inArg ) const { mSetter( inObj, inArg ); }
};
//Define the property types on the auto-generated objects.
template<PxU32 TKey, typename TObjType, typename TSetPropType, typename TGetPropType>
struct PxPropertyInfo : public PxReadOnlyPropertyInfo<TKey, TObjType, TGetPropType>
{
typedef typename PxReadOnlyPropertyInfo<TKey, TObjType, TGetPropType>::TGetterType TGetterType;
typedef void(*TSetterType)( TObjType*, TSetPropType inArg );
TSetterType mSetter;
PxPropertyInfo( const char* inName, TSetterType inSetter, TGetterType inGetter )
: PxReadOnlyPropertyInfo<TKey, TObjType, TGetPropType>( inName, inGetter )
, mSetter( inSetter ) {}
void set( TObjType* inObj, TSetPropType inArg ) const { mSetter( inObj, inArg ); }
};
template<PxU32 TKey, typename TObjType, typename TPropertyType>
struct PxRangePropertyInfo : public PxPropertyInfoParameterizedBase<TKey>
{
typedef void (*TSetterType)( TObjType*,TPropertyType,TPropertyType);
typedef void (*TGetterType)( const TObjType*,TPropertyType&,TPropertyType&);
const char* mArg0Name;
const char* mArg1Name;
TSetterType mSetter;
TGetterType mGetter;
PxRangePropertyInfo( const char* name, const char* arg0Name, const char* arg1Name
, TSetterType setter, TGetterType getter )
: PxPropertyInfoParameterizedBase<TKey>( name )
, mArg0Name( arg0Name )
, mArg1Name( arg1Name )
, mSetter( setter )
, mGetter( getter )
{
}
void set( TObjType* inObj, TPropertyType arg0, TPropertyType arg1 ) const { mSetter( inObj, arg0, arg1 ); }
void get( const TObjType* inObj, TPropertyType& arg0, TPropertyType& arg1 ) const { mGetter( inObj, arg0, arg1 ); }
};
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType>
struct PxIndexedPropertyInfo : public PxPropertyInfoParameterizedBase<TKey>
{
typedef void (*TSetterType)( TObjType*, TIndexType, TPropertyType );
typedef TPropertyType (*TGetterType)( const TObjType* inObj, TIndexType );
TSetterType mSetter;
TGetterType mGetter;
PxIndexedPropertyInfo( const char* name, TSetterType setter, TGetterType getter )
: PxPropertyInfoParameterizedBase<TKey>( name )
, mSetter( setter )
, mGetter( getter )
{
}
void set( TObjType* inObj, TIndexType inIndex, TPropertyType arg ) const { mSetter( inObj, inIndex, arg ); }
TPropertyType get( const TObjType* inObj, TIndexType inIndex ) const { return mGetter( inObj, inIndex ); }
};
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType>
struct PxExtendedIndexedPropertyInfo : public PxPropertyInfoParameterizedBase<TKey>
{
typedef PxU32 (*TNbObjectsMember)( const TObjType* );
typedef void (*TSetterType)( TObjType*, TIndexType, TPropertyType );
typedef TPropertyType (*TGetterType)( const TObjType* inObj, TIndexType );
TSetterType mSetter;
TGetterType mGetter;
PxU32 mCount;
TNbObjectsMember mNbObjectsMember;
PxExtendedIndexedPropertyInfo( const char* name, TGetterType getter, TNbObjectsMember inNb, TSetterType setter)
: PxPropertyInfoParameterizedBase<TKey>( name )
, mSetter( setter )
, mGetter( getter )
, mNbObjectsMember( inNb )
{
}
PxU32 size( const TObjType* inObj ) const { return mNbObjectsMember( inObj ); }
void set( TObjType* inObj, TIndexType inIndex, TPropertyType arg ) const { mSetter( inObj, inIndex, arg ); }
TPropertyType get( const TObjType* inObj, TIndexType inIndex ) const { return mGetter( inObj, inIndex ); }
};
template<PxU32 TKey, typename TObjType, typename TIndex1Type, typename TIndex2Type, typename TPropertyType>
struct PxDualIndexedPropertyInfo : public PxPropertyInfoParameterizedBase<TKey>
{
typedef void (*TSetterType)( TObjType*, TIndex1Type, TIndex2Type, TPropertyType );
typedef TPropertyType (*TGetterType)( const TObjType* inObj, TIndex1Type, TIndex2Type );
TSetterType mSetter;
TGetterType mGetter;
PxDualIndexedPropertyInfo( const char* name, TSetterType setter, TGetterType getter )
: PxPropertyInfoParameterizedBase<TKey>( name )
, mSetter( setter )
, mGetter( getter )
{
}
void set( TObjType* inObj, TIndex1Type inIdx1, TIndex2Type inIdx2, TPropertyType arg ) const { mSetter( inObj, inIdx1, inIdx2, arg ); }
TPropertyType get( const TObjType* inObj, TIndex1Type inIdx1, TIndex2Type inIdx2 ) const { return mGetter( inObj, inIdx1, inIdx2 ); }
};
template<PxU32 TKey, typename TObjType, typename TIndex1Type, typename TIndex2Type, typename TPropertyType>
struct PxExtendedDualIndexedPropertyInfo : public PxPropertyInfoParameterizedBase<TKey>
{
typedef void (*TSetterType)( TObjType*, TIndex1Type, TIndex2Type, TPropertyType );
typedef TPropertyType (*TGetterType)( const TObjType* inObj, TIndex1Type, TIndex2Type );
TSetterType mSetter;
TGetterType mGetter;
PxU32 mId0Count;
PxU32 mId1Count;
PxExtendedDualIndexedPropertyInfo( const char* name, TSetterType setter, TGetterType getter, PxU32 id0Count, PxU32 id1Count )
: PxPropertyInfoParameterizedBase<TKey>( name )
, mSetter( setter )
, mGetter( getter )
, mId0Count( id0Count )
, mId1Count( id1Count )
{
}
void set( TObjType* inObj, TIndex1Type inIdx1, TIndex2Type inIdx2, TPropertyType arg ) const { mSetter( inObj, inIdx1, inIdx2, arg ); }
TPropertyType get( const TObjType* inObj, TIndex1Type inIdx1, TIndex2Type inIdx2 ) const { return mGetter( inObj, inIdx1, inIdx2 ); }
};
template<PxU32 TKey, typename TObjType, typename TCollectionType>
struct PxBufferCollectionPropertyInfo : public PxPropertyInfoParameterizedBase<TKey>
{
typedef PxU32 (*TNbObjectsMember)( const TObjType* );
typedef PxU32 (*TGetObjectsMember)( const TObjType*, TCollectionType*, PxU32 );
typedef void (*TSetObjectsMember)( TObjType*, TCollectionType*, PxU32 );
TGetObjectsMember mGetObjectsMember;
TNbObjectsMember mNbObjectsMember;
TSetObjectsMember mSetObjectsMember;
PxBufferCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb, TSetObjectsMember inSet )
: PxPropertyInfoParameterizedBase<TKey>( inName )
, mGetObjectsMember( inGetter )
, mNbObjectsMember( inNb )
, mSetObjectsMember( inSet )
{
}
PxU32 size( const TObjType* inObj ) const { return mNbObjectsMember( inObj ); }
PxU32 get( const TObjType* inObj, TCollectionType* inBuffer, PxU32 inNumItems ) const { return mGetObjectsMember( inObj, inBuffer, inNumItems ); }
void set( TObjType* inObj, TCollectionType* inBuffer, PxU32 inNumItems ) const { mSetObjectsMember( inObj, inBuffer, inNumItems); }
};
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropertyType>
struct PxFixedSizeLookupTablePropertyInfo : public PxPropertyInfoParameterizedBase<TKey>
{
typedef PxU32 (*TNbObjectsMember)( const TObjType* );
typedef PxReal (*TGetXMember)( const TObjType*, PxU32 );
typedef PxReal (*TGetYMember)( const TObjType*, PxU32 );
typedef void (*TAddPairMember)( TObjType*, PxReal, PxReal );
typedef void (*TClearMember)( TObjType* );
TGetXMember mGetXMember;
TGetYMember mGetYMember;
TNbObjectsMember mNbObjectsMember;
TAddPairMember mAddPairMember;
TClearMember mClearMember;
PxFixedSizeLookupTablePropertyInfo( const char* inName, TGetXMember inGetterX, TGetYMember inGetterY, TNbObjectsMember inNb, TAddPairMember inAddPair, TClearMember inClear )
: PxPropertyInfoParameterizedBase<TKey>( inName )
, mGetXMember( inGetterX )
, mGetYMember( inGetterY )
, mNbObjectsMember( inNb )
, mAddPairMember( inAddPair )
, mClearMember( inClear )
{
}
PxU32 size( const TObjType* inObj ) const { return mNbObjectsMember( inObj ); }
PxReal getX( const TObjType* inObj, const PxU32 index ) const { return mGetXMember( inObj, index ); }
PxReal getY( const TObjType* inObj, const PxU32 index ) const { return mGetYMember( inObj, index ); }
void addPair( TObjType* inObj, const PxReal x, const PxReal y ) { mAddPairMember( inObj, x, y ); }
void clear( TObjType* inObj ) { mClearMember( inObj ); }
};
template<PxU32 TKey, typename TObjType, typename TCollectionType>
struct PxReadOnlyCollectionPropertyInfo : public PxPropertyInfoParameterizedBase<TKey>
{
typedef PxU32 (*TNbObjectsMember)( const TObjType* );
typedef PxU32 (*TGetObjectsMember)( const TObjType*, TCollectionType*, PxU32 );
TGetObjectsMember mGetObjectsMember;
TNbObjectsMember mNbObjectsMember;
PxReadOnlyCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb )
: PxPropertyInfoParameterizedBase<TKey>( inName )
, mGetObjectsMember( inGetter )
, mNbObjectsMember( inNb )
{
}
PxU32 size( const TObjType* inObj ) const { return mNbObjectsMember( inObj ); }
PxU32 get( const TObjType* inObj, TCollectionType* inBuffer, PxU32 inBufSize ) const { return mGetObjectsMember( inObj, inBuffer, inBufSize); }
};
template<PxU32 TKey, typename TObjType, typename TCollectionType, typename TFilterType>
struct PxReadOnlyFilteredCollectionPropertyInfo : public PxPropertyInfoParameterizedBase<TKey>
{
typedef PxU32 (*TNbObjectsMember)( const TObjType*, TFilterType );
typedef PxU32 (*TGetObjectsMember)( const TObjType*, TFilterType, TCollectionType*, PxU32 );
TGetObjectsMember mGetObjectsMember;
TNbObjectsMember mNbObjectsMember;
PxReadOnlyFilteredCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb )
: PxPropertyInfoParameterizedBase<TKey>( inName )
, mGetObjectsMember( inGetter )
, mNbObjectsMember( inNb )
{
}
PxU32 size( const TObjType* inObj, TFilterType inFilter ) const { return mNbObjectsMember( inObj, inFilter ); }
PxU32 get( const TObjType* inObj, TFilterType inFilter, TCollectionType* inBuffer, PxU32 inBufSize ) const { return mGetObjectsMember( inObj, inFilter, inBuffer, inBufSize); }
};
template<PxU32 TKey, typename TObjType, typename TCollectionType, typename TCreateArg>
struct PxFactoryCollectionPropertyInfo : public PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >
{
typedef typename PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >::TGetObjectsMember TGetObjectsMember;
typedef typename PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >::TNbObjectsMember TNbObjectsMember;
typedef TCollectionType (*TCreateMember)( TObjType*, TCreateArg );
TCreateMember mCreateMember;
PxFactoryCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb, TCreateMember inMember )
: PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >( inName, inGetter, inNb )
, mCreateMember( inMember )
{
}
TCollectionType create( TObjType* inObj, TCreateArg inArg ) const { return mCreateMember( inObj, inArg ); }
};
template<PxU32 TKey, typename TObjType, typename TCollectionType>
struct PxCollectionPropertyInfo : public PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >
{
typedef typename PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >::TGetObjectsMember TGetObjectsMember;
typedef typename PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >::TNbObjectsMember TNbObjectsMember;
typedef void (*TAddMember)(TObjType*, TCollectionType&);
typedef void (*TRemoveMember)(TObjType*, TCollectionType&);
TAddMember mAddMember;
TRemoveMember mRemoveMember;
PxCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb, TAddMember inMember, TRemoveMember inRemoveMember )
: PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >( inName, inGetter, inNb )
, mAddMember( inMember )
, mRemoveMember( inRemoveMember )
{
}
void add( TObjType* inObj, TCollectionType& inArg ) const { mAddMember(inObj, inArg ); }
void remove( TObjType* inObj, TCollectionType& inArg ) const { mRemoveMember( inObj, inArg ); }
};
template<PxU32 TKey, typename TObjType, typename TCollectionType, typename TFilterType>
struct PxFilteredCollectionPropertyInfo : public PxReadOnlyFilteredCollectionPropertyInfo<TKey, TObjType, TCollectionType, TFilterType>
{
typedef typename PxReadOnlyFilteredCollectionPropertyInfo< TKey, TObjType, TCollectionType, TFilterType >::TGetObjectsMember TGetObjectsMember;
typedef typename PxReadOnlyFilteredCollectionPropertyInfo< TKey, TObjType, TCollectionType, TFilterType >::TNbObjectsMember TNbObjectsMember;
typedef void (*TAddMember)(TObjType*, TCollectionType&);
typedef void (*TRemoveMember)(TObjType*, TCollectionType&);
TAddMember mAddMember;
TRemoveMember mRemoveMember;
PxFilteredCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb, TAddMember inMember, TRemoveMember inRemoveMember )
: PxReadOnlyFilteredCollectionPropertyInfo<TKey, TObjType, TCollectionType, TFilterType>( inName, inGetter, inNb )
, mAddMember( inMember )
, mRemoveMember( inRemoveMember )
{
}
void add( TObjType* inObj, TCollectionType& inArg ) const { mAddMember(inObj, inArg ); }
void remove( TObjType* inObj, TCollectionType& inArg ) const { mRemoveMember( inObj, inArg ); }
};
//create a default info class for when we can't match
//the type correctly.
struct PxUnknownClassInfo
{
static const char* getClassName() { return "__unknown_class"; }
template<typename TReturnType, typename TOperator>
TReturnType visitType( TOperator )
{
return TReturnType();
}
template<typename TOperator>
void visitBases( TOperator )
{
}
template<typename TOperator>
PxU32 visitBaseProperties( TOperator, PxU32 inStartIndex = 0 ) const
{
return inStartIndex;
}
template<typename TOperator>
PxU32 visitInstanceProperties( TOperator, PxU32 inStartIndex = 0 ) const
{
return inStartIndex;
}
};
template<typename TDataType>
struct PxClassInfoTraits
{
PxUnknownClassInfo Info;
static bool getInfo() { return false;}
};
//move the bool typedef to the global namespace.
typedef bool _Bool;
template<PxU32 TPropertyName>
struct PxPropertyToValueStructMemberMap
{
bool Offset;
};
#define DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( type, prop, valueStruct ) \
template<> struct PxPropertyToValueStructMemberMap< PxPropertyInfoName::type##_##prop > \
{ \
PxU32 Offset; \
PxPropertyToValueStructMemberMap< PxPropertyInfoName::type##_##prop >() : Offset( PX_OFFSET_OF_RT( valueStruct, prop ) ) {} \
template<typename TOperator> void visitProp( TOperator inOperator, valueStruct& inStruct ) { inOperator( inStruct.prop ); } \
};
struct PxShapeGeomPropertyHelper
{
PX_PHYSX_CORE_API PxGeometryType::Enum getGeometryType(const PxShape* inShape) const;
PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxBoxGeometry& geometry) const;
PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxSphereGeometry& geometry) const;
PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxCapsuleGeometry& geometry) const;
PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxPlaneGeometry& geometry) const;
PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxConvexMeshGeometry& geometry) const;
PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxTetrahedronMeshGeometry& geometry) const;
PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxParticleSystemGeometry& geometry) const;
PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxTriangleMeshGeometry& geometry) const;
PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxHeightFieldGeometry& geometry) const;
};
struct PxShapeGeomProperty : public PxWriteOnlyPropertyInfo< PxPropertyInfoName::PxShape_Geom, PxShape, const PxGeometry & >
, public PxShapeGeomPropertyHelper
{
static void setPxShape_Geom( PxShape* inObj, const PxGeometry& inArg){ inObj->setGeometry( inArg ); }
static PxGeometryHolder getPxShape_Geom( const PxShape* inObj ) { return PxGeometryHolder(inObj->getGeometry()); }
typedef PxWriteOnlyPropertyInfo< PxPropertyInfoName::PxShape_Geom, PxShape, const PxGeometry & >::TSetterType TSetterType;
typedef PxGeometryHolder (*TGetterType)( const PxShape* inObj );
PxShapeGeomProperty( const char* inName="Geometry", TSetterType inSetter=setPxShape_Geom, TGetterType=getPxShape_Geom )
: PxWriteOnlyPropertyInfo< PxPropertyInfoName::PxShape_Geom, PxShape, const PxGeometry & >( inName, inSetter )
{
}
};
struct PxShapeMaterialsPropertyHelper
{
PX_PHYSX_CORE_API void setMaterials(PxShape* inShape, PxMaterial*const* materials, PxU16 materialCount) const;
};
struct PxShapeMaterialsProperty : public PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxShape_Materials, PxShape, PxMaterial*>
, public PxShapeMaterialsPropertyHelper
{
typedef PxReadOnlyCollectionPropertyInfo< PxPropertyInfoName::PxShape_Materials, PxShape, PxMaterial* >::TGetObjectsMember TGetObjectsMember;
typedef PxReadOnlyCollectionPropertyInfo< PxPropertyInfoName::PxShape_Materials, PxShape, PxMaterial* >::TNbObjectsMember TNbObjectsMember;
PxShapeMaterialsProperty( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb )
: PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxShape_Materials, PxShape, PxMaterial*>( inName, inGetter, inNb )
{
}
};
typedef PxPropertyInfo<PxPropertyInfoName::PxRigidActor_GlobalPose, PxRigidActor, const PxTransform &, PxTransform > PxRigidActorGlobalPosePropertyInfo;
struct PxRigidActorShapeCollectionHelper
{
PX_PHYSX_CORE_API PxShape* createShape(PxRigidActor* inActor, const PxGeometry& geometry, PxMaterial& material, PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) const;
PX_PHYSX_CORE_API PxShape* createShape(PxRigidActor* inActor, const PxGeometry& geometry, PxMaterial *const* materials, PxU16 materialCount, PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) const;
};
struct PxRigidActorShapeCollection : public PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxRigidActor_Shapes, PxRigidActor, PxShape*>
, public PxRigidActorShapeCollectionHelper
{
typedef PxReadOnlyCollectionPropertyInfo< PxPropertyInfoName::PxRigidActor_Shapes, PxRigidActor, PxShape* >::TGetObjectsMember TGetObjectsMember;
typedef PxReadOnlyCollectionPropertyInfo< PxPropertyInfoName::PxRigidActor_Shapes, PxRigidActor, PxShape* >::TNbObjectsMember TNbObjectsMember;
PxRigidActorShapeCollection( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb )
: PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxRigidActor_Shapes, PxRigidActor, PxShape*>( inName, inGetter, inNb )
{
}
};
struct PxArticulationReducedCoordinateLinkCollectionPropHelper
{
PX_PHYSX_CORE_API PxArticulationLink* createLink(PxArticulationReducedCoordinate* inArticulation, PxArticulationLink* parent, const PxTransform& pose) const;
};
struct PxArticulationLinkCollectionProp : public PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxArticulationReducedCoordinate_Links, PxArticulationReducedCoordinate, PxArticulationLink*>
, public PxArticulationReducedCoordinateLinkCollectionPropHelper
{
PxArticulationLinkCollectionProp( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb )
: PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxArticulationReducedCoordinate_Links, PxArticulationReducedCoordinate, PxArticulationLink*>( inName, inGetter, inNb )
{
}
};
template<typename TDataType>
struct PxEnumTraits { PxEnumTraits() : NameConversion( false ) {} bool NameConversion; };
struct NbShapesProperty : public PxIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbShapes, PxSimulationStatistics, PxGeometryType::Enum, PxU32>
{
PX_PHYSX_CORE_API NbShapesProperty();
};
struct NbDiscreteContactPairsProperty : public PxDualIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbDiscreteContactPairs
, PxSimulationStatistics
, PxGeometryType::Enum
, PxGeometryType::Enum
, PxU32>
{
PX_PHYSX_CORE_API NbDiscreteContactPairsProperty();
};
struct NbModifiedContactPairsProperty : public PxDualIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbModifiedContactPairs
, PxSimulationStatistics
, PxGeometryType::Enum
, PxGeometryType::Enum
, PxU32>
{
PX_PHYSX_CORE_API NbModifiedContactPairsProperty();
};
struct NbCCDPairsProperty : public PxDualIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbCCDPairs
, PxSimulationStatistics
, PxGeometryType::Enum
, PxGeometryType::Enum
, PxU32>
{
PX_PHYSX_CORE_API NbCCDPairsProperty();
};
struct NbTriggerPairsProperty : public PxDualIndexedPropertyInfo<PxPropertyInfoName::PxSimulationStatistics_NbTriggerPairs
, PxSimulationStatistics
, PxGeometryType::Enum
, PxGeometryType::Enum
, PxU32>
{
PX_PHYSX_CORE_API NbTriggerPairsProperty();
};
struct SimulationStatisticsProperty : public PxReadOnlyPropertyInfo<PxPropertyInfoName::PxScene_SimulationStatistics, PxScene, PxSimulationStatistics>
{
PX_PHYSX_CORE_API SimulationStatisticsProperty();
};
struct PxCustomGeometryCustomTypeProperty : public PxReadOnlyPropertyInfo<PxPropertyInfoName::PxCustomGeometry_CustomType, PxCustomGeometry, PxU32>
{
PX_PHYSX_CORE_API PxCustomGeometryCustomTypeProperty();
};
struct PxMetaDataPlane
{
PxVec3 normal;
PxReal distance;
PxMetaDataPlane( PxVec3 n = PxVec3( 0, 0, 0 ), PxReal d = 0 )
: normal( n )
, distance( d )
{
}
};
#include "PxAutoGeneratedMetaDataObjects.h"
#undef DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP
static PxU32ToName g_physx__PxQueryFlag__EnumConversion[] = {
{ "eSTATIC", static_cast<PxU32>( PxQueryFlag::eSTATIC ) },
{ "eDYNAMIC", static_cast<PxU32>( PxQueryFlag::eDYNAMIC ) },
{ "ePREFILTER", static_cast<PxU32>( PxQueryFlag::ePREFILTER ) },
{ "ePOSTFILTER", static_cast<PxU32>( PxQueryFlag::ePOSTFILTER ) },
{ NULL, 0 }
};
template<> struct PxEnumTraits<PxQueryFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxQueryFlag__EnumConversion ) {} const PxU32ToName* NameConversion; };
template<typename TObjType, typename TOperator>
inline PxU32 visitAllProperties( TOperator inOperator )
{
PxU32 thePropCount = PxClassInfoTraits<TObjType>().Info.visitBaseProperties( inOperator );
return PxClassInfoTraits<TObjType>().Info.visitInstanceProperties( inOperator, thePropCount );
}
template<typename TObjType, typename TOperator>
inline void visitInstanceProperties( TOperator inOperator )
{
PxClassInfoTraits<TObjType>().Info.visitInstanceProperties( inOperator, 0 );
}
}
#if PX_LINUX && PX_CLANG
#pragma clang diagnostic pop
#endif
/** @} */
#endif
| 28,256 | C | 40.311403 | 270 | 0.778843 |
NVIDIA-Omniverse/PhysX/physx/source/physxmetadata/core/include/PxMetaDataCompare.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_METADATACOMPARE_H
#define PX_METADATACOMPARE_H
#include "PxMetaDataObjects.h"
#include "foundation/PxInlineArray.h"
//Implement a basic equality comparison system based on the meta data system.
//if you implement a particular areequal specialized to exactly your type
//before including this file it will be called in preference to the completely
//generic one shown here.
//If you don't care about the failure prop name you are welcome to pass in 'null',
template<typename TBaseObjType>
bool areEqual( const TBaseObjType& lhs, const TBaseObjType& rhs, const char** outFailurePropName );
//We don't have the ability right now to handle these types.
inline bool areEqual( const PxAggregate&, const PxAggregate& ) { return true; }
inline bool areEqual( const PxSimulationFilterShader&, const PxSimulationFilterShader& ) { return true; }
inline bool areEqual( const PxSimulationFilterCallback&, const PxSimulationFilterCallback& ) { return true; }
inline bool areEqual( const PxConvexMesh&, const PxConvexMesh& ) { return true; }
inline bool areEqual( const PxTriangleMesh&, const PxTriangleMesh& ) { return true; }
inline bool areEqual( const PxTetrahedronMesh&, const PxTetrahedronMesh&) { return true; }
inline bool areEqual( const PxParticleSystemGeometry&, const PxParticleSystemGeometry&) { return true; }
inline bool areEqual( const PxBVH33TriangleMesh&, const PxBVH33TriangleMesh& ) { return true; }
inline bool areEqual( const PxBVH34TriangleMesh&, const PxBVH34TriangleMesh& ) { return true; }
inline bool areEqual( const PxHeightField&, const PxHeightField& ) { return true; }
inline bool areEqual( const void* inLhs, const void* inRhs ) { return inLhs == inRhs; }
inline bool areEqual( void* inLhs, void* inRhs ) { return inLhs == inRhs; }
//Operators are copied, so this object needs to point
//to the important data rather than reference or own it.
template<typename TBaseObjType>
struct EqualityOp
{
bool* mVal;
const TBaseObjType* mLhs;
const TBaseObjType* mRhs;
const char** mFailurePropName;
EqualityOp( bool& inVal, const TBaseObjType& inLhs, const TBaseObjType& inRhs, const char*& inFailurePropName )
: mVal( &inVal )
, mLhs( &inLhs )
, mRhs( &inRhs )
, mFailurePropName( &inFailurePropName )
{
}
bool hasFailed() { return *mVal == false; }
//Ensure failure propagates the result a ways.
void update( bool inResult, const char* inName )
{
*mVal = *mVal && inResult;
if ( hasFailed() )
*mFailurePropName = inName;
}
//ignore any properties pointering back to the scene.
template<PxU32 TKey, typename TObjType>
void operator()( const PxReadOnlyPropertyInfo<TKey, TObjType, PxScene*> & inProp, PxU32 ) {}
template<PxU32 TKey, typename TObjType>
void operator()( const PxReadOnlyPropertyInfo<TKey, TObjType, const PxScene*> & inProp, PxU32 ) {}
//ignore any properties pointering back to the impl.
template<PxU32 TKey, typename TObjType>
void operator()(const PxReadOnlyPropertyInfo<TKey, TObjType, void*> & inProp, PxU32) {}
template<PxU32 TKey, typename TObjType>
void operator()(const PxReadOnlyPropertyInfo<TKey, TObjType, const void*> & inProp, PxU32) {}
//ignore all of these properties because they just point back to the 'this' object and cause
//a stack overflow.
//Children is unnecessary and articulation points back to the source.
void operator()( const PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxArticulationLink_Children, PxArticulationLink, PxArticulationLink* >& inProp, PxU32 ) {}
void operator()( const PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxRigidActor_Constraints, PxRigidActor, PxConstraint* >& inProp, PxU32 ){}
void operator()( const PxReadOnlyCollectionPropertyInfo<PxPropertyInfoName::PxAggregate_Actors, PxAggregate, PxActor* >& inProp, PxU32 ) {}
template<PxU32 TKey, typename TObjType, typename TGetPropType>
void operator()( const PxBufferCollectionPropertyInfo<TKey, TObjType, TGetPropType> & inProp, PxU32 )
{
}
template<PxU32 TKey, typename TObjType, typename TGetPropType>
void operator()( const PxReadOnlyPropertyInfo<TKey, TObjType, TGetPropType> & inProp, PxU32 )
{
if ( hasFailed() )
return;
TGetPropType lhs( inProp.get( mLhs ) );
TGetPropType rhs( inProp.get( mRhs ) );
update( areEqual( lhs, rhs, NULL ), inProp.mName );
}
template<PxU32 TKey, typename TObjType, typename TPropType>
void operator()( const PxRangePropertyInfo<TKey, TObjType, TPropType> & inProp, PxU32 )
{
if ( hasFailed() )
return;
TPropType lhsl, lhsr, rhsl, rhsr;
inProp.get( mLhs, lhsl, lhsr );
inProp.get( mRhs, rhsl, rhsr );
update( areEqual( lhsl, rhsl, NULL ), inProp.mName );
update( areEqual( lhsr, rhsr, NULL ), inProp.mName );
}
//Indexed properties where we don't know the range of index types are ignored
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropType>
void compareIndex( const PxIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropType> &, bool ) {}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropType>
void compareIndex( const PxIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropType> &inProp, const PxU32ToName* inNames )
{
for ( const PxU32ToName* theName = inNames;
theName->mName != NULL && !hasFailed();
++theName )
{
TIndexType theIndex( static_cast<TIndexType>( theName->mValue ) );
update( areEqual( inProp.get( mLhs, theIndex ), inProp.get( mRhs, theIndex ), NULL ), inProp.mName );
}
}
template<PxU32 TKey, typename TObjType, typename TIndexType, typename TPropType>
void operator()( const PxIndexedPropertyInfo<TKey, TObjType, TIndexType, TPropType> & inProp, PxU32 )
{
if ( hasFailed() )
return;
compareIndex( inProp, PxEnumTraits<TIndexType>().NameConversion );
}
template<PxU32 TKey, typename TObjType, typename TCollectionType>
void operator()( const PxReadOnlyCollectionPropertyInfo<TKey, TObjType, TCollectionType> & inProp, PxU32 )
{
if ( hasFailed() )
return;
physx::PxInlineArray<TCollectionType, 20> lhsArray;
physx::PxInlineArray<TCollectionType, 20> rhsArray;
PxU32 size = inProp.size( mLhs );
if ( size != inProp.size( mRhs ) )
update( false, inProp.mName );
else
{
lhsArray.resize( size );
rhsArray.resize( size );
inProp.get( mLhs, lhsArray.begin(), size );
inProp.get( mRhs, rhsArray.begin(), size );
for ( PxU32 idx =0; idx < size && !hasFailed(); ++idx )
update( areEqual( lhsArray[idx], rhsArray[idx], NULL ), inProp.mName );
}
}
//Filtered collections where we can't know the range of filter values are ignored.
template<PxU32 TKey, typename TObjType, typename TFilterType, typename TCollectionType>
void compare( const PxReadOnlyFilteredCollectionPropertyInfo< TKey, TObjType, TFilterType, TCollectionType >&, bool ) {}
template<PxU32 TKey, typename TObjType, typename TFilterType, typename TCollectionType>
void compare( const PxReadOnlyFilteredCollectionPropertyInfo< TKey, TObjType, TFilterType, TCollectionType >& inProp, const PxU32ToName* inNames )
{
//Exaustively compare all items.
physx::PxInlineArray<TCollectionType*, 20> lhsArray;
physx::PxInlineArray<TCollectionType*, 20> rhsArray;
for ( const PxU32ToName* theName = inNames;
theName->mName != NULL && !hasFailed();
++theName )
{
TFilterType theFilter( static_cast<TFilterType>( theName->mValue ) );
PxU32 size = inProp.size( mLhs, theFilter );
if ( size != inProp.size( mRhs, theFilter ) )
update( false, inProp.mName );
else
{
lhsArray.resize( size );
rhsArray.resize( size );
inProp.get( mLhs, theFilter, lhsArray.begin(), size );
inProp.get( mRhs, theFilter, rhsArray.begin(), size );
for ( PxU32 idx =0; idx < size && !hasFailed(); ++idx )
update( areEqual( lhsArray[idx], rhsArray[idx], NULL ), inProp.mName );
}
}
}
template<PxU32 TKey, typename TObjType, typename TFilterType, typename TCollectionType>
void operator()( const PxReadOnlyFilteredCollectionPropertyInfo< TKey, TObjType, TFilterType, TCollectionType >& inProp, PxU32 )
{
if ( hasFailed() ) return;
compare( inProp, PxEnumTraits<TFilterType>().NameConversion );
}
template<typename TGeometryType, typename TPropertyType>
void compareGeometry( const TPropertyType& inProp )
{
TGeometryType lhs;
TGeometryType rhs;
bool lsuc = inProp.getGeometry( mLhs, lhs );
bool rsuc = inProp.getGeometry( mRhs, rhs );
if ( !( lsuc && rsuc ) )
update( false, inProp.mName );
else
update( areEqual( lhs, rhs, NULL ), inProp.mName );
}
void operator()( const PxShapeGeomProperty& inProp, PxU32 )
{
if ( hasFailed() )
return;
PxGeometryType::Enum lhsType( inProp.getGeometryType( mLhs ) );
PxGeometryType::Enum rhsType( inProp.getGeometryType( mRhs ) );
if ( lhsType != rhsType )
update( false, inProp.mName );
else
{
switch( lhsType )
{
case PxGeometryType::eSPHERE: compareGeometry<PxSphereGeometry>(inProp); break;
case PxGeometryType::ePLANE: compareGeometry<PxPlaneGeometry>(inProp); break;
case PxGeometryType::eCAPSULE: compareGeometry<PxCapsuleGeometry>(inProp); break;
case PxGeometryType::eBOX: compareGeometry<PxBoxGeometry>(inProp); break;
case PxGeometryType::eCONVEXMESH: compareGeometry<PxConvexMeshGeometry>(inProp); break;
case PxGeometryType::eTETRAHEDRONMESH: compareGeometry<PxTetrahedronMeshGeometry>(inProp); break;
case PxGeometryType::ePARTICLESYSTEM: compareGeometry<PxParticleSystemGeometry>(inProp); break;
case PxGeometryType::eTRIANGLEMESH: compareGeometry<PxTriangleMeshGeometry>(inProp); break;
case PxGeometryType::eHEIGHTFIELD: compareGeometry<PxHeightFieldGeometry>(inProp); break;
default: PX_ASSERT( false ); break;
}
}
}
};
inline bool areEqual( const char* lhs, const char* rhs, const char**, const PxUnknownClassInfo& )
{
if ( lhs && rhs ) return Pxstrcmp( lhs, rhs ) == 0;
if ( lhs || rhs ) return false;
return true;
}
inline bool areEqual( PxReal inLhs, PxReal inRhs )
{
return PxAbs( inLhs - inRhs ) < 1e-5f;
}
inline bool areEqual( PxVec3& lhs, PxVec3& rhs )
{
return areEqual( lhs.x, rhs.x )
&& areEqual( lhs.y, rhs.y )
&& areEqual( lhs.z, rhs.z );
}
inline bool areEqual( const PxVec3& lhs, const PxVec3& rhs )
{
return areEqual( lhs.x, rhs.x )
&& areEqual( lhs.y, rhs.y )
&& areEqual( lhs.z, rhs.z );
}
inline bool areEqual( const PxVec4& lhs, const PxVec4& rhs )
{
return areEqual( lhs.x, rhs.x )
&& areEqual( lhs.y, rhs.y )
&& areEqual( lhs.z, rhs.z )
&& areEqual( lhs.w, rhs.w );
}
inline bool areEqual( const PxQuat& lhs, const PxQuat& rhs )
{
return areEqual( lhs.x, rhs.x )
&& areEqual( lhs.y, rhs.y )
&& areEqual( lhs.z, rhs.z )
&& areEqual( lhs.w, rhs.w );
}
inline bool areEqual( const PxTransform& lhs, const PxTransform& rhs )
{
return areEqual(lhs.p, rhs.p) && areEqual(lhs.q, rhs.q);
}
inline bool areEqual( const PxBounds3& inLhs, const PxBounds3& inRhs )
{
return areEqual(inLhs.minimum,inRhs.minimum)
&& areEqual(inLhs.maximum,inRhs.maximum);
}
inline bool areEqual( const PxMetaDataPlane& lhs, const PxMetaDataPlane& rhs )
{
return areEqual( lhs.normal.x, rhs.normal.x )
&& areEqual( lhs.normal.y, rhs.normal.y )
&& areEqual( lhs.normal.z, rhs.normal.z )
&& areEqual( lhs.distance, rhs.distance );
}
template<typename TBaseObjType>
inline bool areEqual( const TBaseObjType& lhs, const TBaseObjType& rhs )
{
return lhs == rhs;
}
//If we don't know the class type, we must result in == operator
template<typename TBaseObjType>
inline bool areEqual( const TBaseObjType& lhs, const TBaseObjType& rhs, const char**, const PxUnknownClassInfo& )
{
return areEqual( lhs, rhs );
}
//If we don't know the class type, we must result in == operator
template<typename TBaseObjType, typename TTraitsType>
inline bool areEqual( const TBaseObjType& lhs, const TBaseObjType& rhs, const char** outFailurePropName, const TTraitsType& )
{
const char* theFailureName = NULL;
bool result = true;
static int i = 0;
++i;
visitAllProperties<TBaseObjType>( EqualityOp<TBaseObjType>( result, lhs, rhs, theFailureName ) );
if ( outFailurePropName != NULL && theFailureName )
*outFailurePropName = theFailureName;
return result;
}
template<typename TBaseObjType>
inline bool areEqualPointerCheck( const TBaseObjType& lhs, const TBaseObjType& rhs, const char** outFailurePropName, int )
{
return areEqual( lhs, rhs, outFailurePropName, PxClassInfoTraits<TBaseObjType>().Info );
}
inline bool areEqualPointerCheck( const void* lhs, const void* rhs, const char**, bool )
{
return lhs == rhs;
}
inline bool areEqualPointerCheck( const char* lhs, const char* rhs, const char** outFailurePropName, bool )
{
bool bRet = true;
if ( lhs && rhs ) bRet = Pxstrcmp( lhs, rhs ) == 0;
else if ( lhs || rhs ) bRet = false;
return bRet;
}
inline bool areEqualPointerCheck( void* lhs, void* rhs, const char**, bool )
{
return lhs == rhs;
}
template<typename TBaseObjType>
inline bool areEqualPointerCheck( const TBaseObjType& lhs, const TBaseObjType& rhs, const char** outFailurePropName, bool )
{
if ( lhs && rhs )
return areEqual( *lhs, *rhs, outFailurePropName );
if ( lhs || rhs )
return false;
return true;
}
template < typename Tp >
struct is_pointer { static const int val = 0; };
template < typename Tp >
struct is_pointer<Tp*> { static const bool val = true; };
template<typename TBaseObjType>
inline bool areEqual( const TBaseObjType& lhs, const TBaseObjType& rhs, const char** outFailurePropName )
{
return areEqualPointerCheck( lhs, rhs, outFailurePropName, is_pointer<TBaseObjType>::val );
}
#endif | 15,297 | C | 37.631313 | 167 | 0.732562 |
NVIDIA-Omniverse/PhysX/physx/source/physxmetadata/core/include/PvdMetaDataDefineProperties.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PVD_META_DATA_DEFINE_PROPERTIES_H
#define PVD_META_DATA_DEFINE_PROPERTIES_H
#if PX_SUPPORT_PVD
#include "common/PxCoreUtilityTypes.h"
#include "PvdMetaDataPropertyVisitor.h"
#include "PxPvdDataStreamHelpers.h"
#include "PxPvdDataStream.h"
namespace physx
{
namespace Vd
{
using namespace physx::pvdsdk;
template<typename TPropType>
struct PropertyDefinitionOp
{
void defineProperty( PvdPropertyDefinitionHelper& mHelper, NamespacedName mClassKey )
{
mHelper.createProperty( mClassKey, "", getPvdNamespacedNameForType<TPropType>(), PropertyType::Scalar );
}
};
template<>
struct PropertyDefinitionOp<const char*>
{
void defineProperty( PvdPropertyDefinitionHelper& mHelper, NamespacedName mClassKey )
{
mHelper.createProperty( mClassKey, "", getPvdNamespacedNameForType<StringHandle>(), PropertyType::Scalar );
}
};
#define DEFINE_PROPERTY_DEFINITION_OP_NOP( type ) \
template<> struct PropertyDefinitionOp<type> { void defineProperty( PvdPropertyDefinitionHelper&, NamespacedName ){} };
//NOP out these two types.
DEFINE_PROPERTY_DEFINITION_OP_NOP( PxStridedData )
DEFINE_PROPERTY_DEFINITION_OP_NOP( PxBoundedData )
#define DEFINE_PROPERTY_DEFINITION_OBJECT_REF( type ) \
template<> struct PropertyDefinitionOp<type> { \
void defineProperty( PvdPropertyDefinitionHelper& mHelper, NamespacedName mClassKey) \
{ \
mHelper.createProperty( mClassKey, "", getPvdNamespacedNameForType<ObjectRef>(), PropertyType::Scalar ); \
} \
};
DEFINE_PROPERTY_DEFINITION_OBJECT_REF( PxTetrahedronMesh* )
DEFINE_PROPERTY_DEFINITION_OBJECT_REF( PxTriangleMesh* )
DEFINE_PROPERTY_DEFINITION_OBJECT_REF( PxBVH33TriangleMesh* )
DEFINE_PROPERTY_DEFINITION_OBJECT_REF( PxBVH34TriangleMesh* )
DEFINE_PROPERTY_DEFINITION_OBJECT_REF( PxConvexMesh* )
DEFINE_PROPERTY_DEFINITION_OBJECT_REF( PxHeightField* )
struct PvdClassInfoDefine
{
PvdPropertyDefinitionHelper& mHelper;
NamespacedName mClassKey;
PvdClassInfoDefine( PvdPropertyDefinitionHelper& info, NamespacedName inClassName )
: mHelper( info )
, mClassKey( inClassName ) { }
PvdClassInfoDefine( const PvdClassInfoDefine& other )
: mHelper( other.mHelper )
, mClassKey( other.mClassKey )
{
}
void defineProperty( NamespacedName inDtype, const char* semantic = "", PropertyType::Enum inPType = PropertyType::Scalar )
{
mHelper.createProperty( mClassKey, semantic, inDtype, inPType );
}
void pushName( const char* inName )
{
mHelper.pushName( inName );
}
void pushBracketedName( const char* inName)
{
mHelper.pushBracketedName( inName );
}
void popName()
{
mHelper.popName();
}
inline void defineNameValueDefs( const PxU32ToName* theConversions )
{
while( theConversions->mName != NULL )
{
mHelper.addNamedValue( theConversions->mName, theConversions->mValue );
++theConversions;
}
}
template<typename TAccessorType>
void simpleProperty( PxU32, TAccessorType& /*inProp */)
{
typedef typename TAccessorType::prop_type TPropertyType;
PropertyDefinitionOp<TPropertyType>().defineProperty( mHelper, mClassKey );
}
template<typename TAccessorType, typename TInfoType>
void extendedIndexedProperty( PxU32* key, const TAccessorType& inProp, TInfoType& )
{
simpleProperty(*key, inProp);
}
template<typename TDataType>
static NamespacedName getNameForEnumType()
{
size_t s = sizeof( TDataType );
switch(s)
{
case 1: return getPvdNamespacedNameForType<PxU8>();
case 2: return getPvdNamespacedNameForType<PxU16>();
case 4: return getPvdNamespacedNameForType<PxU32>();
default: return getPvdNamespacedNameForType<PxU64>();
}
}
template<typename TAccessorType>
void enumProperty( PxU32 /*key*/, TAccessorType& /*inProp*/, const PxU32ToName* inConversions )
{
typedef typename TAccessorType::prop_type TPropType;
defineNameValueDefs( inConversions );
defineProperty( getNameForEnumType<TPropType>(), "Enumeration Value" );
}
template<typename TAccessorType>
void flagsProperty( PxU32 /*key*/, const TAccessorType& /*inAccessor*/, const PxU32ToName* inConversions )
{
typedef typename TAccessorType::prop_type TPropType;
defineNameValueDefs( inConversions );
defineProperty( getNameForEnumType<TPropType>(), "Bitflag" );
}
template<typename TAccessorType, typename TInfoType>
void complexProperty( PxU32* key, const TAccessorType& inAccessor, TInfoType& inInfo )
{
PxU32 theOffset = inAccessor.mOffset;
inInfo.visitBaseProperties( makePvdPropertyFilter( *this, key, &theOffset ) );
inInfo.visitInstanceProperties( makePvdPropertyFilter( *this, key, &theOffset ) );
}
template<typename TAccessorType, typename TInfoType>
void bufferCollectionProperty( PxU32* key, const TAccessorType& inAccessor, TInfoType& inInfo )
{
complexProperty(key, inAccessor, inInfo);
}
template<PxU32 TKey, typename TObjectType, typename TPropertyType, PxU32 TEnableFlag>
void handleBuffer( const PxBufferPropertyInfo<TKey, TObjectType, const PxArray< TPropertyType >&, TEnableFlag>& inProp )
{
mHelper.pushName( inProp.mName );
defineProperty( getPvdNamespacedNameForType<TPropertyType>(), "", PropertyType::Array );
mHelper.popName();
}
template<PxU32 TKey, typename TObjectType, typename TCollectionType>
void handleCollection( const PxReadOnlyCollectionPropertyInfo<TKey, TObjectType, TCollectionType>& inProp )
{
mHelper.pushName( inProp.mName );
defineProperty( getPvdNamespacedNameForType<TCollectionType>(), "", PropertyType::Array );
mHelper.popName();
}
template<PxU32 TKey, typename TObjectType, typename TEnumType>
void handleCollection( const PxReadOnlyCollectionPropertyInfo<TKey, TObjectType, TEnumType>& inProp, const PxU32ToName* inConversions )
{
mHelper.pushName( inProp.mName );
defineNameValueDefs( inConversions );
defineProperty( getNameForEnumType<TEnumType>(), "Enumeration Value", PropertyType::Array );
mHelper.popName();
}
private:
PvdClassInfoDefine& operator=(const PvdClassInfoDefine&);
};
template<typename TPropType>
struct SimplePropertyValueStructOp
{
void addPropertyMessageArg( PvdPropertyDefinitionHelper& mHelper, PxU32 inOffset )
{
mHelper.addPropertyMessageArg<TPropType>( inOffset );
}
};
#define DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_OP_NOP( type ) \
template<> struct SimplePropertyValueStructOp<type> { void addPropertyMessageArg( PvdPropertyDefinitionHelper&, PxU32 ){}};
DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_OP_NOP( PxStridedData )
DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_OP_NOP( PxBoundedData )
#define DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_VOIDPTR_OP( type ) \
template<> struct SimplePropertyValueStructOp<type> { \
void addPropertyMessageArg( PvdPropertyDefinitionHelper& mHelper, PxU32 inOffset ) \
{ \
mHelper.addPropertyMessageArg<VoidPtr>( inOffset ); \
} \
};
DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_VOIDPTR_OP( PxTetrahedronMesh* )
DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_VOIDPTR_OP( PxTriangleMesh* )
DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_VOIDPTR_OP( PxBVH33TriangleMesh* )
DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_VOIDPTR_OP( PxBVH34TriangleMesh* )
DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_VOIDPTR_OP( PxConvexMesh* )
DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_VOIDPTR_OP( PxHeightField* )
struct PvdClassInfoValueStructDefine
{
private:
PvdClassInfoValueStructDefine& operator=(const PvdClassInfoValueStructDefine&);
public:
PvdPropertyDefinitionHelper& mHelper;
PvdClassInfoValueStructDefine( PvdPropertyDefinitionHelper& info )
: mHelper( info )
{ }
PvdClassInfoValueStructDefine( const PvdClassInfoValueStructDefine& other )
: mHelper( other.mHelper )
{
}
void defineValueStructOffset( const ValueStructOffsetRecord& inProp, PxU32 inPropSize )
{
if( inProp.mHasValidOffset )
{
switch( inPropSize )
{
case 8: mHelper.addPropertyMessageArg<PxU64>( inProp.mOffset ); break;
case 4: mHelper.addPropertyMessageArg<PxU32>( inProp.mOffset ); break;
case 2: mHelper.addPropertyMessageArg<PxU16>( inProp.mOffset ); break;
default:
PX_ASSERT(1 == inPropSize);
mHelper.addPropertyMessageArg<PxU8>( inProp.mOffset ); break;
}
}
}
void pushName( const char* inName )
{
mHelper.pushName( inName );
}
void pushBracketedName( const char* inName)
{
mHelper.pushBracketedName( inName );
}
void popName()
{
mHelper.popName();
}
template<typename TAccessorType, typename TInfoType>
void bufferCollectionProperty( PxU32* /*key*/, const TAccessorType& /*inAccessor*/, TInfoType& /*inInfo*/ )
{
//complexProperty(key, inAccessor, inInfo);
}
template<typename TAccessorType>
void simpleProperty( PxU32 /*key*/, TAccessorType& inProp )
{
typedef typename TAccessorType::prop_type TPropertyType;
if ( inProp.mHasValidOffset )
{
SimplePropertyValueStructOp<TPropertyType>().addPropertyMessageArg( mHelper, inProp.mOffset );
}
}
template<typename TAccessorType>
void enumProperty( PxU32 /*key*/, TAccessorType& inAccessor, const PxU32ToName* /*inConversions */)
{
typedef typename TAccessorType::prop_type TPropType;
defineValueStructOffset( inAccessor, sizeof( TPropType ) );
}
template<typename TAccessorType>
void flagsProperty( PxU32 /*key*/, const TAccessorType& inAccessor, const PxU32ToName* /*inConversions */)
{
typedef typename TAccessorType::prop_type TPropType;
defineValueStructOffset( inAccessor, sizeof( TPropType ) );
}
template<typename TAccessorType, typename TInfoType>
void complexProperty( PxU32* key, const TAccessorType& inAccessor, TInfoType& inInfo )
{
PxU32 theOffset = inAccessor.mOffset;
inInfo.visitBaseProperties( makePvdPropertyFilter( *this, key, &theOffset ) );
inInfo.visitInstanceProperties( makePvdPropertyFilter( *this, key, &theOffset ) );
}
template<PxU32 TKey, typename TObjectType, typename TCollectionType>
void handleCollection( const PxReadOnlyCollectionPropertyInfo<TKey, TObjectType, TCollectionType>& /*prop*/ )
{
}
template<PxU32 TKey, typename TObjectType, typename TEnumType>
void handleCollection( const PxReadOnlyCollectionPropertyInfo<TKey, TObjectType, TEnumType>& /*prop*/, const PxU32ToName* /*inConversions */)
{
}
template<PxU32 TKey, typename TObjectType, typename TInfoType>
void handleCollection( const PxBufferCollectionPropertyInfo<TKey, TObjectType, TInfoType>& /*prop*/, const TInfoType& /*inInfo */)
{
}
};
}
}
#endif
#endif
| 12,100 | C | 33.280453 | 142 | 0.759256 |
NVIDIA-Omniverse/PhysX/physx/source/physxmetadata/core/include/PvdMetaDataExtensions.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_META_DATA_EXTENSIONS_H
#define PX_META_DATA_EXTENSIONS_H
#include "PxMetaDataObjects.h"
#if PX_SUPPORT_PVD
#include "PxPvdObjectModelBaseTypes.h"
namespace physx { namespace pvdsdk {
template<> PX_INLINE NamespacedName getPvdNamespacedNameForType<physx::PxMetaDataPlane>() { return getPvdNamespacedNameForType<PxVec4>(); }
template<> PX_INLINE NamespacedName getPvdNamespacedNameForType<physx::PxRigidActor*>() { return getPvdNamespacedNameForType<VoidPtr>(); }
}}
#endif
namespace physx
{
namespace Vd
{
//Additional properties that exist only in pvd land.
struct PxPvdOnlyProperties
{
enum Enum
{
FirstProp = PxPropertyInfoName::LastPxPropertyInfoName,
PxScene_Frame,
PxScene_Contacts,
PxScene_SimulateElapsedTime,
#define DEFINE_ENUM_RANGE( stem, count ) \
stem##Begin, \
stem##End = stem##Begin + count
//I can't easily add up the number of required property entries, but it is large due to the below
//geometry count squared properties. Thus I punt and allocate way more than I need right now.
DEFINE_ENUM_RANGE( PxScene_SimulationStatistics, 1000 ),
DEFINE_ENUM_RANGE( PxSceneDesc_Limits, PxPropertyInfoName::PxSceneLimits_PropertiesStop - PxPropertyInfoName::PxSceneLimits_PropertiesStart ),
DEFINE_ENUM_RANGE( PxSimulationStatistics_NumShapes, PxGeometryType::eGEOMETRY_COUNT ),
DEFINE_ENUM_RANGE( PxSimulationStatistics_NumDiscreteContactPairs, PxGeometryType::eGEOMETRY_COUNT * PxGeometryType::eGEOMETRY_COUNT ),
DEFINE_ENUM_RANGE( PxSimulationStatistics_NumModifiedContactPairs, PxGeometryType::eGEOMETRY_COUNT * PxGeometryType::eGEOMETRY_COUNT ),
DEFINE_ENUM_RANGE( PxSimulationStatistics_NumSweptIntegrationPairs, PxGeometryType::eGEOMETRY_COUNT * PxGeometryType::eGEOMETRY_COUNT ),
DEFINE_ENUM_RANGE( PxSimulationStatistics_NumTriggerPairs, PxGeometryType::eGEOMETRY_COUNT * PxGeometryType::eGEOMETRY_COUNT ),
DEFINE_ENUM_RANGE( PxRigidDynamic_SolverIterationCounts, 2 ),
DEFINE_ENUM_RANGE( PxArticulation_SolverIterationCounts, 2 ),
DEFINE_ENUM_RANGE( PxArticulationJoint_SwingLimit, 2 ),
DEFINE_ENUM_RANGE( PxArticulationJoint_TwistLimit, 2 ),
DEFINE_ENUM_RANGE( PxConvexMeshGeometry_Scale, PxPropertyInfoName::PxMeshScale_PropertiesStop - PxPropertyInfoName::PxMeshScale_PropertiesStart ),
DEFINE_ENUM_RANGE( PxTriangleMeshGeometry_Scale, PxPropertyInfoName::PxMeshScale_PropertiesStop - PxPropertyInfoName::PxMeshScale_PropertiesStart ),
LastPxPvdOnlyProperty
};
};
template<PxU32 TKey, typename TObjectType, typename TPropertyType, PxU32 TEnableFlag>
struct PxBufferPropertyInfo : PxReadOnlyPropertyInfo< TKey, TObjectType, TPropertyType >
{
typedef PxReadOnlyPropertyInfo< TKey, TObjectType, TPropertyType > TBaseType;
typedef typename TBaseType::TGetterType TGetterType;
PxBufferPropertyInfo( const char* inName, TGetterType inGetter )
: TBaseType( inName, inGetter )
{
}
bool isEnabled( PxU32 inFlags ) const { return (inFlags & TEnableFlag) > 0; }
};
#define DECLARE_BUFFER_PROPERTY( objectType, baseType, propType, propName, fieldName, flagName ) \
typedef PxBufferPropertyInfo< PxPvdOnlyProperties::baseType##_##propName, objectType, propType, flagName > T##objectType##propName##Base; \
inline propType get##propName( const objectType* inData ) { return inData->fieldName; } \
struct baseType##propName##Property : T##objectType##propName##Base \
{ \
baseType##propName##Property() : T##objectType##propName##Base( #propName, get##propName ){} \
};
template<PxU32 PropertyKey, typename TEnumType >
struct IndexerToNameMap
{
PxEnumTraits<TEnumType> Converter;
};
struct ValueStructOffsetRecord
{
mutable bool mHasValidOffset;
mutable PxU32 mOffset;
ValueStructOffsetRecord() : mHasValidOffset( false ), mOffset( 0 ) {}
void setupValueStructOffset( PxU32 inValue ) const
{
mHasValidOffset = true;
mOffset = inValue;
}
};
template<PxU32 TKey, typename TObjectType, typename TPropertyType>
struct PxPvdReadOnlyPropertyAccessor : public ValueStructOffsetRecord
{
typedef PxReadOnlyPropertyInfo<TKey,TObjectType,TPropertyType> TPropertyInfoType;
typedef TPropertyType prop_type;
const TPropertyInfoType mProperty;
PxPvdReadOnlyPropertyAccessor( const TPropertyInfoType& inProp )
: mProperty( inProp )
{
}
prop_type get( const TObjectType* inObj ) const { return mProperty.get( inObj ); }
private:
PxPvdReadOnlyPropertyAccessor& operator=(const PxPvdReadOnlyPropertyAccessor&);
};
template<PxU32 TKey, typename TObjectType, typename TPropertyType>
struct PxBufferCollectionPropertyAccessor : public ValueStructOffsetRecord
{
typedef PxBufferCollectionPropertyInfo< TKey, TObjectType, TPropertyType > TPropertyInfoType;
typedef TPropertyType prop_type;
const TPropertyInfoType& mProperty;
const char* mName;
PxBufferCollectionPropertyAccessor( const TPropertyInfoType& inProp, const char* inName )
: mProperty( inProp )
, mName( inName )
{
}
const char* name() const { return mName; }
PxU32 size( const TObjectType* inObj ) const { return mProperty.size( inObj ); }
PxU32 get( const TObjectType* inObj, prop_type* buffer, PxU32 inNumItems) const { return mProperty.get( inObj, buffer, inNumItems); }
void set( TObjectType* inObj, prop_type* inBuffer, PxU32 inNumItems ) const { mProperty.set( inObj, inBuffer, inNumItems ); }
};
template<PxU32 TKey, typename TObjectType, typename TIndexType, typename TPropertyType>
struct PxPvdIndexedPropertyAccessor : public ValueStructOffsetRecord
{
typedef PxIndexedPropertyInfo< TKey, TObjectType, TIndexType, TPropertyType > TPropertyInfoType;
typedef TPropertyType prop_type;
TIndexType mIndex;
const TPropertyInfoType& mProperty;
PxPvdIndexedPropertyAccessor( const TPropertyInfoType& inProp, PxU32 inIndex )
: mIndex( static_cast<TIndexType>( inIndex ) )
, mProperty( inProp )
{
}
prop_type get( const TObjectType* inObj ) const { return mProperty.get( inObj, mIndex ); }
void set( TObjectType* inObj, prop_type val ) const { mProperty.set( inObj, mIndex, val ); }
void operator = (PxPvdIndexedPropertyAccessor&) {}
};
template<PxU32 TKey, typename TObjectType, typename TIndexType, typename TPropertyType>
struct PxPvdExtendedIndexedPropertyAccessor : public ValueStructOffsetRecord
{
typedef PxExtendedIndexedPropertyInfo< TKey, TObjectType, TIndexType, TPropertyType > TPropertyInfoType;
typedef TPropertyType prop_type;
TIndexType mIndex;
const TPropertyInfoType& mProperty;
PxPvdExtendedIndexedPropertyAccessor( const TPropertyInfoType& inProp, PxU32 inIndex )
: mIndex( static_cast<TIndexType>( inIndex ) )
, mProperty( inProp )
{
}
PxU32 size( const TObjectType* inObj ) const { return mProperty.size( inObj ); }
prop_type get( const TObjectType* inObj, TIndexType index ) const { return mProperty.get( inObj, index ); }
void set( TObjectType* inObj, TIndexType index, prop_type val ) const { mProperty.set( inObj, index, val ); }
void operator = (PxPvdExtendedIndexedPropertyAccessor&) {}
};
template<PxU32 TKey, typename TObjectType, typename TIndexType, typename TPropertyType>
struct PxPvdFixedSizeLookupTablePropertyAccessor : public ValueStructOffsetRecord
{
typedef PxFixedSizeLookupTablePropertyInfo< TKey, TObjectType, TIndexType, TPropertyType > TPropertyInfoType;
typedef TPropertyType prop_type;
TIndexType mIndex;
const TPropertyInfoType& mProperty;
PxPvdFixedSizeLookupTablePropertyAccessor( const TPropertyInfoType& inProp, const PxU32 inIndex3 )
: mIndex( static_cast<TIndexType>( inIndex3 ) )
, mProperty( inProp )
{
}
PxU32 size( const TObjectType* inObj ) const { return mProperty.size( inObj ); }
prop_type getX( const TObjectType* inObj, const TIndexType index ) const { return mProperty.getX( inObj, index ); }
prop_type getY( const TObjectType* inObj, const TIndexType index ) const { return mProperty.getY( inObj, index ); }
void addPair( TObjectType* inObj, const PxReal x, const PxReal y ) { const_cast<TPropertyInfoType&>(mProperty).addPair( inObj, x, y ); }
void clear( TObjectType* inObj ) { const_cast<TPropertyInfoType&>(mProperty).clear( inObj ); }
void operator = (PxPvdFixedSizeLookupTablePropertyAccessor&) {}
};
template<PxU32 TKey, typename TObjectType, typename TIdx0Type, typename TIdx1Type, typename TPropertyType>
struct PxPvdDualIndexedPropertyAccessor : public ValueStructOffsetRecord
{
typedef PxDualIndexedPropertyInfo< TKey, TObjectType, TIdx0Type, TIdx1Type, TPropertyType > TPropertyInfoType;
typedef TPropertyType prop_type;
TIdx0Type mIdx0;
TIdx1Type mIdx1;
const TPropertyInfoType& mProperty;
PxPvdDualIndexedPropertyAccessor( const TPropertyInfoType& inProp, PxU32 idx0, PxU32 idx1 )
: mIdx0( static_cast<TIdx0Type>( idx0 ) )
, mIdx1( static_cast<TIdx1Type>( idx1 ) )
, mProperty( inProp )
{
}
prop_type get( const TObjectType* inObj ) const { return mProperty.get( inObj, mIdx0, mIdx1 ); }
void set( TObjectType* inObj, prop_type val ) const { mProperty.set( inObj, mIdx0, mIdx1, val ); }
private:
PxPvdDualIndexedPropertyAccessor& operator = (const PxPvdDualIndexedPropertyAccessor&);
};
template<PxU32 TKey, typename TObjectType, typename TIdx0Type, typename TIdx1Type, typename TPropertyType>
struct PxPvdExtendedDualIndexedPropertyAccessor : public ValueStructOffsetRecord
{
typedef PxExtendedDualIndexedPropertyInfo< TKey, TObjectType, TIdx0Type, TIdx1Type, TPropertyType > TPropertyInfoType;
typedef TPropertyType prop_type;
TIdx0Type mIdx0;
TIdx1Type mIdx1;
const TPropertyInfoType& mProperty;
PxPvdExtendedDualIndexedPropertyAccessor( const TPropertyInfoType& inProp, PxU32 idx0, PxU32 idx1 )
: mIdx0( static_cast<TIdx0Type>( idx0 ) )
, mIdx1( static_cast<TIdx1Type>( idx1 ) )
, mProperty( inProp )
{
}
prop_type get( const TObjectType* inObj ) const { return mProperty.get( inObj, mIdx0, mIdx1 ); }
void set( TObjectType* inObj, prop_type val ) const { mProperty.set( inObj, mIdx0, mIdx1, val ); }
private:
PxPvdExtendedDualIndexedPropertyAccessor& operator = (const PxPvdExtendedDualIndexedPropertyAccessor&);
};
template<PxU32 TKey, typename TObjType, typename TPropertyType>
struct PxPvdRangePropertyAccessor : public ValueStructOffsetRecord
{
typedef PxRangePropertyInfo<TKey, TObjType, TPropertyType> TPropertyInfoType;
typedef TPropertyType prop_type;
bool mFirstValue;
const TPropertyInfoType& mProperty;
PxPvdRangePropertyAccessor( const TPropertyInfoType& inProp, bool inFirstValue )
: mFirstValue( inFirstValue )
, mProperty( inProp )
{
}
prop_type get( const TObjType* inObj ) const {
prop_type first,second;
mProperty.get( inObj, first, second );
return mFirstValue ? first : second;
}
void set( TObjType* inObj, prop_type val ) const
{
prop_type first,second;
mProperty.get( inObj, first, second );
if ( mFirstValue ) mProperty.set( inObj, val, second );
else mProperty.set( inObj, first, val );
}
void operator = (PxPvdRangePropertyAccessor&) {}
};
template<typename TDataType>
struct IsFlagsType
{
bool FlagData;
};
template<typename TEnumType, typename TStorageType>
struct IsFlagsType<PxFlags<TEnumType, TStorageType> >
{
const PxU32ToName* FlagData;
IsFlagsType<PxFlags<TEnumType, TStorageType> > () : FlagData( PxEnumTraits<TEnumType>().NameConversion ) {}
};
template<typename TDataType>
struct PvdClassForType
{
bool Unknown;
};
}
}
#endif
| 13,059 | C | 40.069182 | 150 | 0.773643 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxPvdObjectModelMetaData.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#include "PxPvdObjectModelInternalTypes.h"
#include "PxPvdObjectModelMetaData.h"
#include "PxPvdInternalByteStreams.h"
#include "PxPvdMarshalling.h"
using namespace physx;
using namespace pvdsdk;
namespace
{
struct PropDescImpl : public PropertyDescription, public PxUserAllocated
{
PxArray<NamedValue> mValueNames;
PropDescImpl(const PropertyDescription& inBase, StringTable& table)
: PropertyDescription(inBase), mValueNames("NamedValue")
{
mName = table.registerStr(mName);
}
PropDescImpl() : mValueNames("NamedValue")
{
}
template <typename TSerializer>
void serialize(TSerializer& serializer)
{
serializer.streamify(mOwnerClassName);
serializer.streamify(mOwnerClassId);
serializer.streamify(mSemantic);
serializer.streamify(mDatatype);
serializer.streamify(mDatatypeName);
serializer.streamify(mPropertyType);
serializer.streamify(mPropertyId);
serializer.streamify(m32BitOffset);
serializer.streamify(m64BitOffset);
serializer.streamify(mValueNames);
serializer.streamify(mName);
}
};
struct ClassDescImpl : public ClassDescription, public PxUserAllocated
{
PxArray<PropDescImpl*> mPropImps;
PxArray<PtrOffset> m32OffsetArray;
PxArray<PtrOffset> m64OffsetArray;
ClassDescImpl(const ClassDescription& inBase)
: ClassDescription(inBase)
, mPropImps("PropDescImpl*")
, m32OffsetArray("ClassDescImpl::m32OffsetArray")
, m64OffsetArray("ClassDescImpl::m64OffsetArray")
{
PVD_FOREACH(idx, get32BitSizeInfo().mPtrOffsets.size())
m32OffsetArray.pushBack(get32BitSizeInfo().mPtrOffsets[idx]);
PVD_FOREACH(idx, get64BitSizeInfo().mPtrOffsets.size())
m64OffsetArray.pushBack(get64BitSizeInfo().mPtrOffsets[idx]);
}
ClassDescImpl()
: mPropImps("PropDescImpl*")
, m32OffsetArray("ClassDescImpl::m32OffsetArray")
, m64OffsetArray("ClassDescImpl::m64OffsetArray")
{
}
PropDescImpl* findProperty(String name)
{
PVD_FOREACH(idx, mPropImps.size())
{
if(safeStrEq(mPropImps[idx]->mName, name))
return mPropImps[idx];
}
return NULL;
}
void addProperty(PropDescImpl* prop)
{
mPropImps.pushBack(prop);
}
void addPtrOffset(PtrOffsetType::Enum type, uint32_t offset32, uint32_t offset64)
{
m32OffsetArray.pushBack(PtrOffset(type, offset32));
m64OffsetArray.pushBack(PtrOffset(type, offset64));
get32BitSizeInfo().mPtrOffsets = DataRef<PtrOffset>(m32OffsetArray.begin(), m32OffsetArray.end());
get64BitSizeInfo().mPtrOffsets = DataRef<PtrOffset>(m64OffsetArray.begin(), m64OffsetArray.end());
}
template <typename TSerializer>
void serialize(TSerializer& serializer)
{
serializer.streamify(mName);
serializer.streamify(mClassId);
serializer.streamify(mBaseClass);
serializer.streamify(mPackedUniformWidth);
serializer.streamify(mPackedClassType);
serializer.streamify(mLocked);
serializer.streamify(mRequiresDestruction);
serializer.streamify(get32BitSize());
serializer.streamify(get32BitSizeInfo().mDataByteSize);
serializer.streamify(get32BitSizeInfo().mAlignment);
serializer.streamify(get64BitSize());
serializer.streamify(get64BitSizeInfo().mDataByteSize);
serializer.streamify(get64BitSizeInfo().mAlignment);
serializer.streamifyLinks(mPropImps);
serializer.streamify(m32OffsetArray);
serializer.streamify(m64OffsetArray);
get32BitSizeInfo().mPtrOffsets = DataRef<PtrOffset>(m32OffsetArray.begin(), m32OffsetArray.end());
get64BitSizeInfo().mPtrOffsets = DataRef<PtrOffset>(m64OffsetArray.begin(), m64OffsetArray.end());
}
};
class StringTableImpl : public StringTable, public PxUserAllocated
{
PxHashMap<const char*, char*> mStrings;
uint32_t mNextStrHandle;
PxHashMap<uint32_t, char*> mHandleToStr;
PxHashMap<const char*, uint32_t> mStrToHandle;
public:
StringTableImpl()
: mStrings("StringTableImpl::mStrings")
, mNextStrHandle(1)
, mHandleToStr("StringTableImpl::mHandleToStr")
, mStrToHandle("StringTableImpl::mStrToHandle")
{
}
uint32_t nextHandleValue()
{
return mNextStrHandle++;
}
virtual ~StringTableImpl()
{
for(PxHashMap<const char*, char*>::Iterator iter = mStrings.getIterator(); !iter.done(); ++iter)
PX_FREE(iter->second);
mStrings.clear();
}
virtual uint32_t getNbStrs()
{
return mStrings.size();
}
virtual uint32_t getStrs(const char** outStrs, uint32_t bufLen, uint32_t startIdx = 0)
{
startIdx = PxMin(getNbStrs(), startIdx);
uint32_t numStrs(PxMin(getNbStrs() - startIdx, bufLen));
PxHashMap<const char*, char*>::Iterator iter(mStrings.getIterator());
for(uint32_t idx = 0; idx < startIdx; ++idx, ++iter)
;
for(uint32_t idx = 0; idx < numStrs && !iter.done(); ++idx, ++iter)
outStrs[idx] = iter->second;
return numStrs;
}
void addStringHandle(char* str, uint32_t hdl)
{
mHandleToStr.insert(hdl, str);
mStrToHandle.insert(str, hdl);
}
uint32_t addStringHandle(char* str)
{
uint32_t theNewHandle = nextHandleValue();
addStringHandle(str, theNewHandle);
return theNewHandle;
}
const char* doRegisterStr(const char* str, bool& outAdded)
{
PX_ASSERT(isMeaningful(str));
const PxHashMap<const char*, char*>::Entry* entry(mStrings.find(str));
if(entry == NULL)
{
outAdded = true;
char* retval(copyStr(str));
mStrings.insert(retval, retval);
return retval;
}
return entry->second;
}
virtual const char* registerStr(const char* str, bool& outAdded)
{
outAdded = false;
if(isMeaningful(str) == false)
return "";
const char* retval = doRegisterStr(str, outAdded);
if(outAdded)
addStringHandle(const_cast<char*>(retval));
return retval;
}
NamespacedName registerName(const NamespacedName& nm)
{
return NamespacedName(registerStr(nm.mNamespace), registerStr(nm.mName));
}
const char* registerStr(const char* str)
{
bool ignored;
return registerStr(str, ignored);
}
virtual StringHandle strToHandle(const char* str)
{
if(isMeaningful(str) == false)
return 0;
const PxHashMap<const char*, uint32_t>::Entry* entry(mStrToHandle.find(str));
if(entry)
return entry->second;
bool added = false;
const char* registeredStr = doRegisterStr(str, added);
uint32_t theNewHandle = addStringHandle(const_cast<char*>(registeredStr));
PX_ASSERT(mStrToHandle.find(str));
PX_ASSERT(added);
return theNewHandle;
}
virtual const char* handleToStr(uint32_t hdl)
{
if(hdl == 0)
return "";
const PxHashMap<uint32_t, char*>::Entry* entry(mHandleToStr.find(hdl));
if(entry)
return entry->second;
// unregistered handle...
return "";
}
void write(PvdOutputStream& stream)
{
uint32_t numStrs = static_cast<uint32_t>(mHandleToStr.size());
stream << numStrs;
stream << mNextStrHandle;
for(PxHashMap<uint32_t, char*>::Iterator iter = mHandleToStr.getIterator(); !iter.done(); ++iter)
{
stream << iter->first;
uint32_t len = static_cast<uint32_t>(strlen(iter->second) + 1);
stream << len;
stream.write(reinterpret_cast<uint8_t*>(iter->second), len);
}
}
template <typename TReader>
void read(TReader& stream)
{
mHandleToStr.clear();
mStrToHandle.clear();
uint32_t numStrs;
stream >> numStrs;
stream >> mNextStrHandle;
PxArray<uint8_t> readBuffer("StringTable::read::readBuffer");
uint32_t bufSize = 0;
for(uint32_t idx = 0; idx < numStrs; ++idx)
{
uint32_t handleValue;
uint32_t bufLen;
stream >> handleValue;
stream >> bufLen;
if(bufSize < bufLen)
readBuffer.resize(bufLen);
bufSize = PxMax(bufSize, bufLen);
stream.read(readBuffer.begin(), bufLen);
bool ignored;
const char* newStr = doRegisterStr(reinterpret_cast<const char*>(readBuffer.begin()), ignored);
addStringHandle(const_cast<char*>(newStr), handleValue);
}
}
virtual void release()
{
PVD_DELETE(this);
}
private:
StringTableImpl& operator=(const StringTableImpl&);
};
struct NamespacedNameHasher
{
uint32_t operator()(const NamespacedName& nm)
{
return PxHash<const char*>()(nm.mNamespace) ^ PxHash<const char*>()(nm.mName);
}
bool equal(const NamespacedName& lhs, const NamespacedName& rhs)
{
return safeStrEq(lhs.mNamespace, rhs.mNamespace) && safeStrEq(lhs.mName, rhs.mName);
}
};
struct ClassPropertyName
{
NamespacedName mName;
String mPropName;
ClassPropertyName(const NamespacedName& name = NamespacedName(), String propName = "")
: mName(name), mPropName(propName)
{
}
};
struct ClassPropertyNameHasher
{
uint32_t operator()(const ClassPropertyName& nm)
{
return NamespacedNameHasher()(nm.mName) ^ PxHash<const char*>()(nm.mPropName);
}
bool equal(const ClassPropertyName& lhs, const ClassPropertyName& rhs)
{
return NamespacedNameHasher().equal(lhs.mName, rhs.mName) && safeStrEq(lhs.mPropName, rhs.mPropName);
}
};
struct PropertyMessageEntryImpl : public PropertyMessageEntry
{
PropertyMessageEntryImpl(const PropertyMessageEntry& data) : PropertyMessageEntry(data)
{
}
PropertyMessageEntryImpl()
{
}
template <typename TSerializerType>
void serialize(TSerializerType& serializer)
{
serializer.streamify(mDatatypeName);
serializer.streamify(mDatatypeId);
serializer.streamify(mMessageOffset);
serializer.streamify(mByteSize);
serializer.streamify(mDestByteSize);
serializer.streamify(mProperty);
}
};
struct PropertyMessageDescriptionImpl : public PropertyMessageDescription, public PxUserAllocated
{
PxArray<PropertyMessageEntryImpl> mEntryImpls;
PxArray<PropertyMessageEntry> mEntries;
PxArray<uint32_t> mStringOffsetArray;
PropertyMessageDescriptionImpl(const PropertyMessageDescription& data)
: PropertyMessageDescription(data)
, mEntryImpls("PropertyMessageDescriptionImpl::mEntryImpls")
, mEntries("PropertyMessageDescriptionImpl::mEntries")
, mStringOffsetArray("PropertyMessageDescriptionImpl::mStringOffsets")
{
}
PropertyMessageDescriptionImpl()
: mEntryImpls("PropertyMessageDescriptionImpl::mEntryImpls")
, mEntries("PropertyMessageDescriptionImpl::mEntries")
, mStringOffsetArray("PropertyMessageDescriptionImpl::mStringOffsets")
{
}
~PropertyMessageDescriptionImpl()
{
}
void addEntry(const PropertyMessageEntryImpl& entry)
{
mEntryImpls.pushBack(entry);
mEntries.pushBack(entry);
mProperties = DataRef<PropertyMessageEntry>(mEntries.begin(), mEntries.end());
}
template <typename TSerializerType>
void serialize(TSerializerType& serializer)
{
serializer.streamify(mClassName);
serializer.streamify(mClassId); // No other class has this id, it is DB-unique
serializer.streamify(mMessageName);
serializer.streamify(mMessageId);
serializer.streamify(mMessageByteSize);
serializer.streamify(mEntryImpls);
serializer.streamify(mStringOffsetArray);
if(mEntries.size() != mEntryImpls.size())
{
mEntries.clear();
uint32_t numEntries = static_cast<uint32_t>(mEntryImpls.size());
for(uint32_t idx = 0; idx < numEntries; ++idx)
mEntries.pushBack(mEntryImpls[idx]);
}
mProperties = DataRef<PropertyMessageEntry>(mEntries.begin(), mEntries.end());
mStringOffsets = DataRef<uint32_t>(mStringOffsetArray.begin(), mStringOffsetArray.end());
}
private:
PropertyMessageDescriptionImpl& operator=(const PropertyMessageDescriptionImpl&);
};
struct PvdObjectModelMetaDataImpl : public PvdObjectModelMetaData, public PxUserAllocated
{
typedef PxHashMap<NamespacedName, ClassDescImpl*, NamespacedNameHasher> TNameToClassMap;
typedef PxHashMap<ClassPropertyName, PropDescImpl*, ClassPropertyNameHasher> TNameToPropMap;
typedef PxHashMap<NamespacedName, PropertyMessageDescriptionImpl*, NamespacedNameHasher> TNameToPropertyMessageMap;
TNameToClassMap mNameToClasses;
TNameToPropMap mNameToProperties;
PxArray<ClassDescImpl*> mClasses;
PxArray<PropDescImpl*> mProperties;
StringTableImpl* mStringTable;
TNameToPropertyMessageMap mPropertyMessageMap;
PxArray<PropertyMessageDescriptionImpl*> mPropertyMessages;
int32_t mNextClassId;
uint32_t mRefCount;
PvdObjectModelMetaDataImpl()
: mNameToClasses("NamespacedName->ClassDescImpl*")
, mNameToProperties("ClassPropertyName->PropDescImpl*")
, mClasses("ClassDescImpl*")
, mProperties("PropDescImpl*")
, mStringTable(PVD_NEW(StringTableImpl)())
, mPropertyMessageMap("PropertyMessageMap")
, mPropertyMessages("PvdObjectModelMetaDataImpl::mPropertyMessages")
, mNextClassId(1)
, mRefCount(0)
{
}
private:
PvdObjectModelMetaDataImpl& operator=(const PvdObjectModelMetaDataImpl&);
public:
int32_t nextClassId()
{
return mNextClassId++;
}
void initialize()
{
// Create the default classes.
{
ClassDescImpl& aryData = getOrCreateClassImpl(getPvdNamespacedNameForType<ArrayData>(),
DataTypeToPvdTypeMap<ArrayData>::BaseTypeEnum);
aryData.get32BitSize() = sizeof(ArrayData);
aryData.get32BitSizeInfo().mAlignment = sizeof(void*);
aryData.get64BitSize() = sizeof(ArrayData);
aryData.get64BitSizeInfo().mAlignment = sizeof(void*);
aryData.mLocked = true;
}
#define CREATE_BASIC_PVD_CLASS(type) \
{ \
ClassDescImpl& cls = getOrCreateClassImpl(getPvdNamespacedNameForType<type>(), getPvdTypeForType<type>()); \
cls.get32BitSize() = sizeof(type); \
cls.get32BitSizeInfo().mAlignment = sizeof(type); \
cls.get64BitSize() = sizeof(type); \
cls.get64BitSizeInfo().mAlignment = sizeof(type); \
cls.mLocked = true; \
cls.mPackedUniformWidth = sizeof(type); \
cls.mPackedClassType = getPvdTypeForType<type>(); \
}
CREATE_BASIC_PVD_CLASS(int8_t)
CREATE_BASIC_PVD_CLASS(uint8_t)
CREATE_BASIC_PVD_CLASS(bool)
CREATE_BASIC_PVD_CLASS(int16_t)
CREATE_BASIC_PVD_CLASS(uint16_t)
CREATE_BASIC_PVD_CLASS(int32_t)
CREATE_BASIC_PVD_CLASS(uint32_t)
// CREATE_BASIC_PVD_CLASS(uint32_t)
CREATE_BASIC_PVD_CLASS(int64_t)
CREATE_BASIC_PVD_CLASS(uint64_t)
CREATE_BASIC_PVD_CLASS(float)
CREATE_BASIC_PVD_CLASS(double)
#undef CREATE_BASIC_PVD_CLASS
#define CREATE_PTR_TYPE_PVD_CLASS(type, ptrType) \
{ \
ClassDescImpl& cls = getOrCreateClassImpl(getPvdNamespacedNameForType<type>(), getPvdTypeForType<type>()); \
cls.get32BitSize() = 4; \
cls.get32BitSizeInfo().mAlignment = 4; \
cls.get64BitSize() = 8; \
cls.get64BitSizeInfo().mAlignment = 8; \
cls.mLocked = true; \
cls.addPtrOffset(PtrOffsetType::ptrType, 0, 0); \
}
CREATE_PTR_TYPE_PVD_CLASS(String, StringOffset)
CREATE_PTR_TYPE_PVD_CLASS(VoidPtr, VoidPtrOffset)
CREATE_PTR_TYPE_PVD_CLASS(StringHandle, StringOffset)
CREATE_PTR_TYPE_PVD_CLASS(ObjectRef, VoidPtrOffset)
#undef CREATE_64BIT_ADJUST_PVD_CLASS
int32_t fltClassType = getPvdTypeForType<float>();
int32_t u32ClassType = getPvdTypeForType<uint32_t>();
int32_t v3ClassType = getPvdTypeForType<PxVec3>();
int32_t v4ClassType = getPvdTypeForType<PxVec4>();
int32_t qtClassType = getPvdTypeForType<PxQuat>();
{
ClassDescImpl& cls =
getOrCreateClassImpl(getPvdNamespacedNameForType<PvdColor>(), getPvdTypeForType<PvdColor>());
createProperty(cls.mClassId, "r", "", getPvdTypeForType<uint8_t>(), PropertyType::Scalar);
createProperty(cls.mClassId, "g", "", getPvdTypeForType<uint8_t>(), PropertyType::Scalar);
createProperty(cls.mClassId, "b", "", getPvdTypeForType<uint8_t>(), PropertyType::Scalar);
createProperty(cls.mClassId, "a", "", getPvdTypeForType<uint8_t>(), PropertyType::Scalar);
PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 1);
PX_ASSERT(cls.get32BitSize() == 4);
PX_ASSERT(cls.get64BitSizeInfo().mAlignment == 1);
PX_ASSERT(cls.get64BitSize() == 4);
PX_ASSERT(cls.mPackedUniformWidth == 1);
PX_ASSERT(cls.mPackedClassType == getPvdTypeForType<uint8_t>());
cls.mLocked = true;
}
{
ClassDescImpl& cls = getOrCreateClassImpl(getPvdNamespacedNameForType<PxVec2>(), getPvdTypeForType<PxVec2>());
createProperty(cls.mClassId, "x", "", fltClassType, PropertyType::Scalar);
createProperty(cls.mClassId, "y", "", fltClassType, PropertyType::Scalar);
PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4);
PX_ASSERT(cls.get32BitSize() == 8);
PX_ASSERT(cls.get64BitSizeInfo().mAlignment == 4);
PX_ASSERT(cls.get64BitSize() == 8);
PX_ASSERT(cls.mPackedUniformWidth == 4);
PX_ASSERT(cls.mPackedClassType == fltClassType);
cls.mLocked = true;
}
{
ClassDescImpl& cls = getOrCreateClassImpl(getPvdNamespacedNameForType<PxVec3>(), getPvdTypeForType<PxVec3>());
createProperty(cls.mClassId, "x", "", fltClassType, PropertyType::Scalar);
createProperty(cls.mClassId, "y", "", fltClassType, PropertyType::Scalar);
createProperty(cls.mClassId, "z", "", fltClassType, PropertyType::Scalar);
PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4);
PX_ASSERT(cls.get32BitSize() == 12);
PX_ASSERT(cls.get64BitSizeInfo().mAlignment == 4);
PX_ASSERT(cls.get64BitSize() == 12);
PX_ASSERT(cls.mPackedUniformWidth == 4);
PX_ASSERT(cls.mPackedClassType == fltClassType);
cls.mLocked = true;
}
{
ClassDescImpl& cls = getOrCreateClassImpl(getPvdNamespacedNameForType<PxVec4>(), getPvdTypeForType<PxVec4>());
createProperty(cls.mClassId, "x", "", fltClassType, PropertyType::Scalar);
createProperty(cls.mClassId, "y", "", fltClassType, PropertyType::Scalar);
createProperty(cls.mClassId, "z", "", fltClassType, PropertyType::Scalar);
createProperty(cls.mClassId, "w", "", fltClassType, PropertyType::Scalar);
PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4);
PX_ASSERT(cls.get32BitSize() == 16);
PX_ASSERT(cls.get64BitSizeInfo().mAlignment == 4);
PX_ASSERT(cls.get64BitSize() == 16);
PX_ASSERT(cls.mPackedUniformWidth == 4);
PX_ASSERT(cls.mPackedClassType == fltClassType);
cls.mLocked = true;
}
{
ClassDescImpl& cls = getOrCreateClassImpl(getPvdNamespacedNameForType<PxQuat>(), getPvdTypeForType<PxQuat>());
createProperty(cls.mClassId, "x", "", fltClassType, PropertyType::Scalar);
createProperty(cls.mClassId, "y", "", fltClassType, PropertyType::Scalar);
createProperty(cls.mClassId, "z", "", fltClassType, PropertyType::Scalar);
createProperty(cls.mClassId, "w", "", fltClassType, PropertyType::Scalar);
PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4);
PX_ASSERT(cls.get32BitSize() == 16);
PX_ASSERT(cls.get64BitSizeInfo().mAlignment == 4);
PX_ASSERT(cls.get64BitSize() == 16);
PX_ASSERT(cls.mPackedUniformWidth == 4);
PX_ASSERT(cls.mPackedClassType == fltClassType);
cls.mLocked = true;
}
{
ClassDescImpl& cls =
getOrCreateClassImpl(getPvdNamespacedNameForType<PxBounds3>(), getPvdTypeForType<PxBounds3>());
createProperty(cls.mClassId, "minimum", "", v3ClassType, PropertyType::Scalar);
createProperty(cls.mClassId, "maximum", "", v3ClassType, PropertyType::Scalar);
PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4);
PX_ASSERT(cls.get32BitSize() == 24);
PX_ASSERT(cls.mPackedUniformWidth == 4);
PX_ASSERT(cls.mPackedClassType == fltClassType);
cls.mLocked = true;
}
{
ClassDescImpl& cls =
getOrCreateClassImpl(getPvdNamespacedNameForType<PxTransform>(), getPvdTypeForType<PxTransform>());
createProperty(cls.mClassId, "q", "", qtClassType, PropertyType::Scalar);
createProperty(cls.mClassId, "p", "", v3ClassType, PropertyType::Scalar);
PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4);
PX_ASSERT(cls.get32BitSize() == 28);
PX_ASSERT(cls.mPackedUniformWidth == 4);
PX_ASSERT(cls.mPackedClassType == fltClassType);
cls.mLocked = true;
}
{
ClassDescImpl& cls =
getOrCreateClassImpl(getPvdNamespacedNameForType<PxMat33>(), getPvdTypeForType<PxMat33>());
createProperty(cls.mClassId, "column0", "", v3ClassType, PropertyType::Scalar);
createProperty(cls.mClassId, "column1", "", v3ClassType, PropertyType::Scalar);
createProperty(cls.mClassId, "column2", "", v3ClassType, PropertyType::Scalar);
PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4);
PX_ASSERT(cls.get32BitSize() == 36);
PX_ASSERT(cls.mPackedUniformWidth == 4);
PX_ASSERT(cls.mPackedClassType == fltClassType);
cls.mLocked = true;
}
{
ClassDescImpl& cls =
getOrCreateClassImpl(getPvdNamespacedNameForType<PxMat44>(), getPvdTypeForType<PxMat44>());
createProperty(cls.mClassId, "column0", "", v4ClassType, PropertyType::Scalar);
createProperty(cls.mClassId, "column1", "", v4ClassType, PropertyType::Scalar);
createProperty(cls.mClassId, "column2", "", v4ClassType, PropertyType::Scalar);
createProperty(cls.mClassId, "column3", "", v4ClassType, PropertyType::Scalar);
PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4);
PX_ASSERT(cls.get32BitSize() == 64);
PX_ASSERT(cls.mPackedUniformWidth == 4);
PX_ASSERT(cls.mPackedClassType == fltClassType);
cls.mLocked = true;
}
{
ClassDescImpl& cls =
getOrCreateClassImpl(getPvdNamespacedNameForType<U32Array4>(), getPvdTypeForType<U32Array4>());
createProperty(cls.mClassId, "d0", "", u32ClassType, PropertyType::Scalar);
createProperty(cls.mClassId, "d1", "", u32ClassType, PropertyType::Scalar);
createProperty(cls.mClassId, "d2", "", u32ClassType, PropertyType::Scalar);
createProperty(cls.mClassId, "d3", "", u32ClassType, PropertyType::Scalar);
cls.mLocked = true;
}
}
virtual ~PvdObjectModelMetaDataImpl()
{
mStringTable->release();
PVD_FOREACH(idx, mClasses.size())
{
if(mClasses[idx] != NULL)
PVD_DELETE(mClasses[idx]);
}
mClasses.clear();
PVD_FOREACH(idx, mProperties.size()) PVD_DELETE(mProperties[idx]);
mProperties.clear();
PVD_FOREACH(idx, mPropertyMessages.size()) PVD_DELETE(mPropertyMessages[idx]);
mPropertyMessages.clear();
}
ClassDescImpl& getOrCreateClassImpl(const NamespacedName& nm, int32_t idx)
{
ClassDescImpl* impl(getClassImpl(idx));
if(impl)
return *impl;
NamespacedName safeName(mStringTable->registerStr(nm.mNamespace), mStringTable->registerStr(nm.mName));
while(idx >= int32_t(mClasses.size()))
mClasses.pushBack(NULL);
mClasses[uint32_t(idx)] = PVD_NEW(ClassDescImpl)(ClassDescription(safeName, idx));
mNameToClasses.insert(nm, mClasses[uint32_t(idx)]);
mNextClassId = PxMax(mNextClassId, idx + 1);
return *mClasses[uint32_t(idx)];
}
ClassDescImpl& getOrCreateClassImpl(const NamespacedName& nm)
{
ClassDescImpl* retval = findClassImpl(nm);
if(retval)
return *retval;
return getOrCreateClassImpl(nm, nextClassId());
}
virtual ClassDescription getOrCreateClass(const NamespacedName& nm)
{
return getOrCreateClassImpl(nm);
}
// get or create parent, lock parent. deriveFrom getOrCreatechild.
virtual bool deriveClass(const NamespacedName& parent, const NamespacedName& child)
{
ClassDescImpl& p(getOrCreateClassImpl(parent));
ClassDescImpl& c(getOrCreateClassImpl(child));
if(c.mBaseClass >= 0)
{
PX_ASSERT(c.mBaseClass == p.mClassId);
return false;
}
p.mLocked = true;
c.mBaseClass = p.mClassId;
c.get32BitSizeInfo() = p.get32BitSizeInfo();
c.get64BitSizeInfo() = p.get64BitSizeInfo();
c.mPackedClassType = p.mPackedClassType;
c.mPackedUniformWidth = p.mPackedUniformWidth;
c.mRequiresDestruction = p.mRequiresDestruction;
c.m32OffsetArray = p.m32OffsetArray;
c.m64OffsetArray = p.m64OffsetArray;
// Add all the parent propertes to this class in the global name map.
for(ClassDescImpl* parent0 = &p; parent0 != NULL; parent0 = getClassImpl(parent0->mBaseClass))
{
PVD_FOREACH(idx, parent0->mPropImps.size())
mNameToProperties.insert(ClassPropertyName(c.mName, parent0->mPropImps[idx]->mName), parent0->mPropImps[idx]);
if(parent0->mBaseClass < 0)
break;
}
return true;
}
ClassDescImpl* findClassImpl(const NamespacedName& nm) const
{
const TNameToClassMap::Entry* entry(mNameToClasses.find(nm));
if(entry)
return entry->second;
return NULL;
}
virtual Option<ClassDescription> findClass(const NamespacedName& nm) const
{
ClassDescImpl* retval = findClassImpl(nm);
if(retval)
return *retval;
return Option<ClassDescription>();
}
ClassDescImpl* getClassImpl(int32_t classId) const
{
if(classId < 0)
return NULL;
uint32_t idx = uint32_t(classId);
if(idx < mClasses.size())
return mClasses[idx];
return NULL;
}
virtual Option<ClassDescription> getClass(int32_t classId) const
{
ClassDescImpl* impl(getClassImpl(classId));
if(impl)
return *impl;
return None();
}
virtual ClassDescription* getClassPtr(int32_t classId) const
{
return getClassImpl(classId);
}
virtual Option<ClassDescription> getParentClass(int32_t classId) const
{
ClassDescImpl* impl(getClassImpl(classId));
if(impl == NULL)
return None();
return getClass(impl->mBaseClass);
}
virtual void lockClass(int32_t classId)
{
ClassDescImpl* impl(getClassImpl(classId));
PX_ASSERT(impl);
if(impl)
impl->mLocked = true;
}
virtual uint32_t getNbClasses() const
{
uint32_t total = 0;
PVD_FOREACH(idx, mClasses.size()) if(mClasses[idx])++ total;
return total;
}
virtual uint32_t getClasses(ClassDescription* outClasses, uint32_t requestCount, uint32_t startIndex = 0) const
{
uint32_t classCount(getNbClasses());
startIndex = PxMin(classCount, startIndex);
uint32_t retAmount = PxMin(requestCount, classCount - startIndex);
uint32_t idx = 0;
while(startIndex)
{
if(mClasses[idx] != NULL)
--startIndex;
++idx;
}
uint32_t inserted = 0;
uint32_t classesSize = static_cast<uint32_t>(mClasses.size());
while(inserted < retAmount && idx < classesSize)
{
if(mClasses[idx] != NULL)
{
outClasses[inserted] = *mClasses[idx];
++inserted;
}
++idx;
}
return inserted;
}
uint32_t updateByteSizeAndGetPropertyAlignment(ClassDescriptionSizeInfo& dest, const ClassDescriptionSizeInfo& src)
{
uint32_t alignment = src.mAlignment;
dest.mAlignment = PxMax(dest.mAlignment, alignment);
uint32_t offset = align(dest.mDataByteSize, alignment);
dest.mDataByteSize = offset + src.mByteSize;
dest.mByteSize = align(dest.mDataByteSize, dest.mAlignment);
return offset;
}
void transferPtrOffsets(ClassDescriptionSizeInfo& destInfo, PxArray<PtrOffset>& destArray,
const PxArray<PtrOffset>& src, uint32_t offset)
{
PVD_FOREACH(idx, src.size())
destArray.pushBack(PtrOffset(src[idx].mOffsetType, src[idx].mOffset + offset));
destInfo.mPtrOffsets = DataRef<PtrOffset>(destArray.begin(), destArray.end());
}
virtual Option<PropertyDescription> createProperty(int32_t classId, String name, String semantic, int32_t datatype,
PropertyType::Enum propertyType)
{
ClassDescImpl* cls(getClassImpl(classId));
PX_ASSERT(cls);
if(!cls)
return None();
if(cls->mLocked)
{
PX_ASSERT(false);
return None();
}
PropDescImpl* impl(cls->findProperty(name));
// duplicate property definition
if(impl)
{
PX_ASSERT(false);
return None();
}
if(datatype == getPvdTypeForType<String>())
{
PX_ASSERT(false);
return None();
}
// The datatype for this property has not been declared.
ClassDescImpl* propDType(getClassImpl(datatype));
PX_ASSERT(propDType);
if(!propDType)
return None();
NamespacedName propClsName(propDType->mName);
int32_t propPackedWidth = propDType->mPackedUniformWidth;
int32_t propPackedType = propDType->mPackedClassType;
// The implications of properties being complex types aren't major
//*until* you start trying to undue a property event that set values
// of those complex types. Then things just get too complex.
if(propDType->mRequiresDestruction)
{
PX_ASSERT(false);
return None();
}
bool requiresDestruction = propDType->mRequiresDestruction || cls->mRequiresDestruction;
if(propertyType == PropertyType::Array)
{
int32_t tempId = DataTypeToPvdTypeMap<ArrayData>::BaseTypeEnum;
propDType = getClassImpl(tempId);
PX_ASSERT(propDType);
if(!propDType)
return None();
requiresDestruction = true;
}
uint32_t offset32 = updateByteSizeAndGetPropertyAlignment(cls->get32BitSizeInfo(), propDType->get32BitSizeInfo());
uint32_t offset64 = updateByteSizeAndGetPropertyAlignment(cls->get64BitSizeInfo(), propDType->get64BitSizeInfo());
transferPtrOffsets(cls->get32BitSizeInfo(), cls->m32OffsetArray, propDType->m32OffsetArray, offset32);
transferPtrOffsets(cls->get64BitSizeInfo(), cls->m64OffsetArray, propDType->m64OffsetArray, offset64);
propDType->mLocked = true; // Can't add members to the property type.
cls->mRequiresDestruction = requiresDestruction;
int32_t propId = int32_t(mProperties.size());
PropertyDescription newDesc(cls->mName, cls->mClassId, name, semantic, datatype, propClsName, propertyType,
propId, offset32, offset64);
mProperties.pushBack(PVD_NEW(PropDescImpl)(newDesc, *mStringTable));
mNameToProperties.insert(ClassPropertyName(cls->mName, mProperties.back()->mName), mProperties.back());
cls->addProperty(mProperties.back());
bool firstProp = cls->mPropImps.size() == 1;
if(firstProp)
{
cls->mPackedUniformWidth = propPackedWidth;
cls->mPackedClassType = propPackedType;
}
else
{
bool packed = (propPackedWidth > 0) && (cls->get32BitSizeInfo().mDataByteSize % propPackedWidth) == 0;
if(cls->mPackedClassType >= 0) // maybe uncheck packed class type
{
if(propPackedType < 0 || cls->mPackedClassType != propPackedType
// Object refs require conversion from stream to db id
||
datatype == getPvdTypeForType<ObjectRef>()
// Strings also require conversion from stream to db id.
||
datatype == getPvdTypeForType<StringHandle>() || packed == false)
cls->mPackedClassType = -1;
}
if(cls->mPackedUniformWidth >= 0) // maybe uncheck packed class width
{
if(propPackedWidth < 0 || cls->mPackedUniformWidth != propPackedWidth
// object refs, because they require special treatment during parsing,
// cannot be packed
||
datatype == getPvdTypeForType<ObjectRef>()
// Likewise, string handles are special because the data needs to be sent *after*
// the
||
datatype == getPvdTypeForType<StringHandle>() || packed == false)
cls->mPackedUniformWidth = -1; // invalid packed width.
}
}
return *mProperties.back();
}
PropDescImpl* findPropImpl(const NamespacedName& clsName, String prop) const
{
const TNameToPropMap::Entry* entry = mNameToProperties.find(ClassPropertyName(clsName, prop));
if(entry)
return entry->second;
return NULL;
}
virtual Option<PropertyDescription> findProperty(const NamespacedName& cls, String propName) const
{
PropDescImpl* prop(findPropImpl(cls, propName));
if(prop)
return *prop;
return None();
}
virtual Option<PropertyDescription> findProperty(int32_t clsId, String propName) const
{
ClassDescImpl* cls(getClassImpl(clsId));
PX_ASSERT(cls);
if(!cls)
return None();
PropDescImpl* prop(findPropImpl(cls->mName, propName));
if(prop)
return *prop;
return None();
}
PropDescImpl* getPropertyImpl(int32_t propId) const
{
PX_ASSERT(propId >= 0);
if(propId < 0)
return NULL;
uint32_t val = uint32_t(propId);
if(val >= mProperties.size())
{
PX_ASSERT(false);
return NULL;
}
return mProperties[val];
}
virtual Option<PropertyDescription> getProperty(int32_t propId) const
{
PropDescImpl* impl(getPropertyImpl(propId));
if(impl)
return *impl;
return None();
}
virtual void setNamedPropertyValues(DataRef<NamedValue> values, int32_t propId)
{
PropDescImpl* impl(getPropertyImpl(propId));
if(impl)
{
impl->mValueNames.resize(values.size());
PVD_FOREACH(idx, values.size()) impl->mValueNames[idx] = values[idx];
}
}
virtual DataRef<NamedValue> getNamedPropertyValues(int32_t propId) const
{
PropDescImpl* impl(getPropertyImpl(propId));
if(impl)
{
return toDataRef(impl->mValueNames);
}
return DataRef<NamedValue>();
}
virtual uint32_t getNbProperties(int32_t classId) const
{
uint32_t retval = 0;
for(ClassDescImpl* impl(getClassImpl(classId)); impl; impl = getClassImpl(impl->mBaseClass))
{
retval += impl->mPropImps.size();
if(impl->mBaseClass < 0)
break;
}
return retval;
}
// Properties need to be returned in base class order, so this requires a recursive function.
uint32_t getPropertiesImpl(int32_t classId, PropertyDescription*& outBuffer, uint32_t& numItems,
uint32_t& startIdx) const
{
ClassDescImpl* impl = getClassImpl(classId);
if(impl)
{
uint32_t retval = 0;
if(impl->mBaseClass >= 0)
retval = getPropertiesImpl(impl->mBaseClass, outBuffer, numItems, startIdx);
uint32_t localStart = PxMin(impl->mPropImps.size(), startIdx);
uint32_t localNumItems = PxMin(numItems, impl->mPropImps.size() - localStart);
PVD_FOREACH(idx, localNumItems)
{
outBuffer[idx] = *impl->mPropImps[localStart + idx];
}
startIdx -= localStart;
numItems -= localNumItems;
outBuffer += localNumItems;
return retval + localNumItems;
}
return 0;
}
virtual uint32_t getProperties(int32_t classId, PropertyDescription* outBuffer, uint32_t numItems,
uint32_t startIdx) const
{
return getPropertiesImpl(classId, outBuffer, numItems, startIdx);
}
virtual MarshalQueryResult checkMarshalling(int32_t srcClsId, int32_t dstClsId) const
{
Option<ClassDescription> propTypeOpt(getClass(dstClsId));
if(propTypeOpt.hasValue() == false)
{
PX_ASSERT(false);
return MarshalQueryResult();
}
const ClassDescription& propType(propTypeOpt);
Option<ClassDescription> incomingTypeOpt(getClass(srcClsId));
if(incomingTypeOpt.hasValue() == false)
{
PX_ASSERT(false);
return MarshalQueryResult();
}
const ClassDescription& incomingType(incomingTypeOpt);
// Can only marshal simple things at this point in time.
bool needsMarshalling = false;
bool canMarshal = false;
TSingleMarshaller single = NULL;
TBlockMarshaller block = NULL;
if(incomingType.mClassId != propType.mClassId)
{
// Check that marshalling is even possible.
if((incomingType.mPackedUniformWidth >= 0 && propType.mPackedUniformWidth >= 0) == false)
{
PX_ASSERT(false);
return MarshalQueryResult();
}
int32_t srcType = incomingType.mPackedClassType;
int32_t dstType = propType.mPackedClassType;
int32_t srcWidth = incomingType.mPackedUniformWidth;
int32_t dstWidth = propType.mPackedUniformWidth;
canMarshal = getMarshalOperators(single, block, srcType, dstType);
if(srcWidth == dstWidth)
needsMarshalling = canMarshal; // If the types are the same width, we assume we can convert between some
// of them seamlessly (uint16_t, int16_t)
else
{
needsMarshalling = true;
// If we can't marshall and we have to then we can't set the property value.
// This indicates that the src and dest are different properties and we don't
// know how to convert between them.
if(!canMarshal)
{
PX_ASSERT(false);
return MarshalQueryResult();
}
}
}
return MarshalQueryResult(srcClsId, dstClsId, canMarshal, needsMarshalling, block);
}
PropertyMessageDescriptionImpl* findPropertyMessageImpl(const NamespacedName& messageName) const
{
const TNameToPropertyMessageMap::Entry* entry = mPropertyMessageMap.find(messageName);
if(entry)
return entry->second;
return NULL;
}
PropertyMessageDescriptionImpl* getPropertyMessageImpl(int32_t msg) const
{
int32_t msgCount = int32_t(mPropertyMessages.size());
if(msg >= 0 && msg < msgCount)
return mPropertyMessages[uint32_t(msg)];
return NULL;
}
virtual Option<PropertyMessageDescription> createPropertyMessage(const NamespacedName& clsName,
const NamespacedName& messageName,
DataRef<PropertyMessageArg> entries,
uint32_t messageSize)
{
PropertyMessageDescriptionImpl* existing(findPropertyMessageImpl(messageName));
if(existing)
{
PX_ASSERT(false);
return None();
}
ClassDescImpl* cls = findClassImpl(clsName);
PX_ASSERT(cls);
if(!cls)
return None();
int32_t msgId = int32_t(mPropertyMessages.size());
PropertyMessageDescriptionImpl* newMessage = PVD_NEW(PropertyMessageDescriptionImpl)(
PropertyMessageDescription(mStringTable->registerName(clsName), cls->mClassId,
mStringTable->registerName(messageName), msgId, messageSize));
uint32_t calculatedSize = 0;
PVD_FOREACH(idx, entries.size())
{
PropertyMessageArg entry(entries[idx]);
ClassDescImpl* dtypeCls = findClassImpl(entry.mDatatypeName);
if(dtypeCls == NULL)
{
PX_ASSERT(false);
goto DestroyNewMessage;
}
ClassDescriptionSizeInfo dtypeInfo(dtypeCls->get32BitSizeInfo());
uint32_t incomingSize = dtypeInfo.mByteSize;
if(entry.mByteSize < incomingSize)
{
PX_ASSERT(false);
goto DestroyNewMessage;
}
calculatedSize = PxMax(calculatedSize, entry.mMessageOffset + entry.mByteSize);
if(calculatedSize > messageSize)
{
PX_ASSERT(false);
goto DestroyNewMessage;
}
Option<PropertyDescription> propName(findProperty(cls->mClassId, entry.mPropertyName));
if(propName.hasValue() == false)
{
PX_ASSERT(false);
goto DestroyNewMessage;
}
Option<ClassDescription> propCls(getClass(propName.getValue().mDatatype));
if(propCls.hasValue() == false)
{
PX_ASSERT(false);
goto DestroyNewMessage;
}
PropertyMessageEntryImpl newEntry(PropertyMessageEntry(
propName, dtypeCls->mName, dtypeCls->mClassId, entry.mMessageOffset, incomingSize, dtypeInfo.mByteSize));
newMessage->addEntry(newEntry);
if(newEntry.mDatatypeId == getPvdTypeForType<String>())
newMessage->mStringOffsetArray.pushBack(entry.mMessageOffset);
// property messages cannot be marshalled at this time.
if(newEntry.mDatatypeId != getPvdTypeForType<String>() && newEntry.mDatatypeId != getPvdTypeForType<VoidPtr>())
{
MarshalQueryResult marshalInfo = checkMarshalling(newEntry.mDatatypeId, newEntry.mProperty.mDatatype);
if(marshalInfo.needsMarshalling)
{
PX_ASSERT(false);
goto DestroyNewMessage;
}
}
}
if(newMessage)
{
newMessage->mStringOffsets =
DataRef<uint32_t>(newMessage->mStringOffsetArray.begin(), newMessage->mStringOffsetArray.end());
mPropertyMessages.pushBack(newMessage);
mPropertyMessageMap.insert(messageName, newMessage);
return *newMessage;
}
DestroyNewMessage:
if(newMessage)
PVD_DELETE(newMessage);
return None();
}
virtual Option<PropertyMessageDescription> findPropertyMessage(const NamespacedName& msgName) const
{
PropertyMessageDescriptionImpl* desc(findPropertyMessageImpl(msgName));
if(desc)
return *desc;
return None();
}
virtual Option<PropertyMessageDescription> getPropertyMessage(int32_t msgId) const
{
PropertyMessageDescriptionImpl* desc(getPropertyMessageImpl(msgId));
if(desc)
return *desc;
return None();
}
virtual uint32_t getNbPropertyMessages() const
{
return mPropertyMessages.size();
}
virtual uint32_t getPropertyMessages(PropertyMessageDescription* msgBuf, uint32_t bufLen, uint32_t startIdx = 0) const
{
startIdx = PxMin(startIdx, getNbPropertyMessages());
bufLen = PxMin(bufLen, getNbPropertyMessages() - startIdx);
PVD_FOREACH(idx, bufLen) msgBuf[idx] = *mPropertyMessages[idx + startIdx];
return bufLen;
}
struct MetaDataWriter
{
const PvdObjectModelMetaDataImpl& mMetaData;
PvdOutputStream& mStream;
MetaDataWriter(const PvdObjectModelMetaDataImpl& meta, PvdOutputStream& stream)
: mMetaData(meta), mStream(stream)
{
}
void streamify(NamespacedName& type)
{
mStream << mMetaData.mStringTable->strToHandle(type.mNamespace);
mStream << mMetaData.mStringTable->strToHandle(type.mName);
}
void streamify(String& type)
{
mStream << mMetaData.mStringTable->strToHandle(type);
}
void streamify(int32_t& type)
{
mStream << type;
}
void streamify(uint32_t& type)
{
mStream << type;
}
void streamify(uint8_t type)
{
mStream << type;
}
void streamify(bool type)
{
streamify( uint8_t(type));
}
void streamify(PropertyType::Enum type)
{
uint32_t val = static_cast<uint32_t>(type);
mStream << val;
}
void streamify(NamedValue& type)
{
streamify(type.mValue);
streamify(type.mName);
}
void streamifyLinks(PropDescImpl* prop)
{
streamify(prop->mPropertyId);
}
void streamify(PropertyDescription& prop)
{
streamify(prop.mPropertyId);
}
void streamify(PropertyMessageEntryImpl& prop)
{
prop.serialize(*this);
}
void streamify(PtrOffset& off)
{
uint32_t type = off.mOffsetType;
mStream << type;
mStream << off.mOffset;
}
template <typename TDataType>
void streamify(TDataType* type)
{
int32_t existMarker = type ? 1 : 0;
mStream << existMarker;
if(type)
type->serialize(*this);
}
template <typename TArrayType>
void streamify(const PxArray<TArrayType>& type)
{
mStream << static_cast<uint32_t>(type.size());
PVD_FOREACH(idx, type.size()) streamify(const_cast<TArrayType&>(type[idx]));
}
template <typename TArrayType>
void streamifyLinks(const PxArray<TArrayType>& type)
{
mStream << static_cast<uint32_t>(type.size());
PVD_FOREACH(idx, type.size()) streamifyLinks(const_cast<TArrayType&>(type[idx]));
}
private:
MetaDataWriter& operator=(const MetaDataWriter&);
};
template <typename TStreamType>
struct MetaDataReader
{
PvdObjectModelMetaDataImpl& mMetaData;
TStreamType& mStream;
MetaDataReader(PvdObjectModelMetaDataImpl& meta, TStreamType& stream) : mMetaData(meta), mStream(stream)
{
}
void streamify(NamespacedName& type)
{
streamify(type.mNamespace);
streamify(type.mName);
}
void streamify(String& type)
{
uint32_t handle;
mStream >> handle;
type = mMetaData.mStringTable->handleToStr(handle);
}
void streamify(int32_t& type)
{
mStream >> type;
}
void streamify(uint32_t& type)
{
mStream >> type;
}
void streamify(bool& type)
{
uint8_t data;
mStream >> data;
type = data ? true : false;
}
void streamify(PropertyType::Enum& type)
{
uint32_t val;
mStream >> val;
type = static_cast<PropertyType::Enum>(val);
}
void streamify(NamedValue& type)
{
streamify(type.mValue);
streamify(type.mName);
}
void streamify(PropertyMessageEntryImpl& type)
{
type.serialize(*this);
}
void streamify(PtrOffset& off)
{
uint32_t type;
mStream >> type;
mStream >> off.mOffset;
off.mOffsetType = static_cast<PtrOffsetType::Enum>(type);
}
void streamifyLinks(PropDescImpl*& prop)
{
int32_t propId;
streamify(propId);
prop = mMetaData.getPropertyImpl(propId);
}
void streamify(PropertyDescription& prop)
{
streamify(prop.mPropertyId);
prop = mMetaData.getProperty(prop.mPropertyId);
}
template <typename TDataType>
void streamify(TDataType*& type)
{
uint32_t existMarker;
mStream >> existMarker;
if(existMarker)
{
TDataType* newType = PVD_NEW(TDataType)();
newType->serialize(*this);
type = newType;
}
else
type = NULL;
}
template <typename TArrayType>
void streamify(PxArray<TArrayType>& type)
{
uint32_t typeSize;
mStream >> typeSize;
type.resize(typeSize);
PVD_FOREACH(idx, type.size()) streamify(type[idx]);
}
template <typename TArrayType>
void streamifyLinks(PxArray<TArrayType>& type)
{
uint32_t typeSize;
mStream >> typeSize;
type.resize(typeSize);
PVD_FOREACH(idx, type.size()) streamifyLinks(type[idx]);
}
private:
MetaDataReader& operator=(const MetaDataReader&);
};
virtual void write(PvdOutputStream& stream) const
{
stream << getCurrentPvdObjectModelVersion();
stream << mNextClassId;
mStringTable->write(stream);
MetaDataWriter writer(*this, stream);
writer.streamify(mProperties);
writer.streamify(mClasses);
writer.streamify(mPropertyMessages);
}
template <typename TReaderType>
void read(TReaderType& stream)
{
uint32_t version;
stream >> version;
stream >> mNextClassId;
mStringTable->read(stream);
MetaDataReader<TReaderType> reader(*this, stream);
reader.streamify(mProperties);
reader.streamify(mClasses);
reader.streamify(mPropertyMessages);
mNameToClasses.clear();
mNameToProperties.clear();
mPropertyMessageMap.clear();
PVD_FOREACH(i, mClasses.size())
{
ClassDescImpl* cls(mClasses[i]);
if(cls == NULL)
continue;
mNameToClasses.insert(cls->mName, mClasses[i]);
uint32_t propCount = getNbProperties(cls->mClassId);
PropertyDescription descs[16];
uint32_t offset = 0;
for(uint32_t idx = 0; idx < propCount; idx = offset)
{
uint32_t numProps = getProperties(cls->mClassId, descs, 16, offset);
offset += numProps;
for(uint32_t propIdx = 0; propIdx < numProps; ++propIdx)
{
PropDescImpl* prop = getPropertyImpl(descs[propIdx].mPropertyId);
if(prop)
mNameToProperties.insert(ClassPropertyName(cls->mName, prop->mName), prop);
}
}
}
PVD_FOREACH(idx, mPropertyMessages.size())
mPropertyMessageMap.insert(mPropertyMessages[idx]->mMessageName, mPropertyMessages[idx]);
}
virtual StringTable& getStringTable() const
{
return *mStringTable;
}
virtual void addRef()
{
++mRefCount;
}
virtual void release()
{
if(mRefCount)
--mRefCount;
if(!mRefCount)
PVD_DELETE(this);
}
};
}
uint32_t PvdObjectModelMetaData::getCurrentPvdObjectModelVersion()
{
return 1;
}
PvdObjectModelMetaData& PvdObjectModelMetaData::create()
{
PvdObjectModelMetaDataImpl& retval(*PVD_NEW(PvdObjectModelMetaDataImpl)());
retval.initialize();
return retval;
}
PvdObjectModelMetaData& PvdObjectModelMetaData::create(PvdInputStream& stream)
{
PvdObjectModelMetaDataImpl& retval(*PVD_NEW(PvdObjectModelMetaDataImpl)());
retval.read(stream);
return retval;
}
StringTable& StringTable::create()
{
return *PVD_NEW(StringTableImpl)();
}
| 48,987 | C++ | 31.61518 | 120 | 0.697001 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxProfileContextProviderImpl.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PX_PROFILE_CONTEXT_PROVIDER_IMPL_H
#define PX_PROFILE_CONTEXT_PROVIDER_IMPL_H
#include "PxProfileContextProvider.h"
#include "foundation/PxThread.h"
namespace physx { namespace profile {
struct PxDefaultContextProvider
{
PxProfileEventExecutionContext getExecutionContext()
{
PxThread::Id theId( PxThread::getId() );
return PxProfileEventExecutionContext( static_cast<uint32_t>( theId ), static_cast<uint8_t>( PxThreadPriority::eNORMAL ), 0 );
}
uint32_t getThreadId()
{
return static_cast<uint32_t>( PxThread::getId() );
}
};
} }
#endif
| 2,146 | C | 39.509433 | 129 | 0.756757 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxProfileEventNames.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PX_PROFILE_EVENT_NAMES_H
#define PX_PROFILE_EVENT_NAMES_H
#include "PxProfileEventId.h"
namespace physx { namespace profile {
/**
\brief Mapping from event id to name.
*/
struct PxProfileEventName
{
const char* name;
PxProfileEventId eventId;
/**
\brief Default constructor.
\param inName Profile event name.
\param inId Profile event id.
*/
PxProfileEventName( const char* inName, PxProfileEventId inId ) : name( inName ), eventId( inId ) {}
};
/**
\brief Aggregator of event id -> name mappings
*/
struct PxProfileNames
{
/**
\brief Default constructor that doesn't point to any names.
\param inEventCount Number of provided events.
\param inSubsystems Event names array.
*/
PxProfileNames( uint32_t inEventCount = 0, const PxProfileEventName* inSubsystems = NULL )
: eventCount( inEventCount )
, events( inSubsystems )
{
}
uint32_t eventCount;
const PxProfileEventName* events;
};
/**
\brief Provides a mapping from event ID -> name.
*/
class PxProfileNameProvider
{
public:
/**
\brief Returns profile event names.
\return Profile event names.
*/
virtual PxProfileNames getProfileNames() const = 0;
protected:
virtual ~PxProfileNameProvider(){}
PxProfileNameProvider& operator=(const PxProfileNameProvider&) { return *this; }
};
} }
#endif
| 2,914 | C | 31.388889 | 102 | 0.736788 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxProfileDataParsing.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PROFILE_DATA_PARSING_H
#define PX_PROFILE_DATA_PARSING_H
#include "foundation/Px.h"
namespace physx { namespace profile {
//Converts datatypes without using type punning.
struct BlockParserDataConverter
{
union
{
uint8_t mU8[8];
uint16_t mU16[4];
uint32_t mU32[2];
uint64_t mU64[1];
int8_t mI8[8];
int16_t mI16[4];
int32_t mI32[2];
int64_t mI64[1];
float mF32[2];
double mF64[1];
};
template<typename TDataType> inline TDataType convert() { PX_ASSERT( false ); return TDataType(); }
template<typename TDataType>
inline void convert( const TDataType& ) {}
};
template<> inline uint8_t BlockParserDataConverter::convert<uint8_t>() { return mU8[0]; }
template<> inline uint16_t BlockParserDataConverter::convert<uint16_t>() { return mU16[0]; }
template<> inline uint32_t BlockParserDataConverter::convert<uint32_t>() { return mU32[0]; }
template<> inline uint64_t BlockParserDataConverter::convert<uint64_t>() { return mU64[0]; }
template<> inline int8_t BlockParserDataConverter::convert<int8_t>() { return mI8[0]; }
template<> inline int16_t BlockParserDataConverter::convert<int16_t>() { return mI16[0]; }
template<> inline int32_t BlockParserDataConverter::convert<int32_t>() { return mI32[0]; }
template<> inline int64_t BlockParserDataConverter::convert<int64_t>() { return mI64[0]; }
template<> inline float BlockParserDataConverter::convert<float>() { return mF32[0]; }
template<> inline double BlockParserDataConverter::convert<double>() { return mF64[0]; }
template<> inline void BlockParserDataConverter::convert<uint8_t>( const uint8_t& inData ) { mU8[0] = inData; }
template<> inline void BlockParserDataConverter::convert<uint16_t>( const uint16_t& inData ) { mU16[0] = inData; }
template<> inline void BlockParserDataConverter::convert<uint32_t>( const uint32_t& inData ) { mU32[0] = inData; }
template<> inline void BlockParserDataConverter::convert<uint64_t>( const uint64_t& inData ) { mU64[0] = inData; }
template<> inline void BlockParserDataConverter::convert<int8_t>( const int8_t& inData ) { mI8[0] = inData; }
template<> inline void BlockParserDataConverter::convert<int16_t>( const int16_t& inData ) { mI16[0] = inData; }
template<> inline void BlockParserDataConverter::convert<int32_t>( const int32_t& inData ) { mI32[0] = inData; }
template<> inline void BlockParserDataConverter::convert<int64_t>( const int64_t& inData ) { mI64[0] = inData; }
template<> inline void BlockParserDataConverter::convert<float>( const float& inData ) { mF32[0] = inData; }
template<> inline void BlockParserDataConverter::convert<double>( const double& inData ) { mF64[0] = inData; }
//Handles various details around parsing blocks of uint8_t data.
struct BlockParseFunctions
{
template<uint8_t ByteCount>
static inline void swapBytes( uint8_t* inData )
{
for ( uint32_t idx = 0; idx < ByteCount/2; ++idx )
{
uint32_t endIdx = ByteCount-idx-1;
uint8_t theTemp = inData[idx];
inData[idx] = inData[endIdx];
inData[endIdx] = theTemp;
}
}
static inline bool checkLength( const uint8_t* inStart, const uint8_t* inStop, uint32_t inLength )
{
return static_cast<uint32_t>(inStop - inStart) >= inLength;
}
//warning work-around
template<typename T>
static inline T val(T v) {return v;}
template<bool DoSwapBytes, typename TDataType>
static inline bool parse( const uint8_t*& inStart, const uint8_t* inStop, TDataType& outData )
{
if ( checkLength( inStart, inStop, sizeof( TDataType ) ) )
{
BlockParserDataConverter theConverter;
for ( uint32_t idx =0; idx < sizeof( TDataType ); ++idx )
theConverter.mU8[idx] = inStart[idx];
if ( val(DoSwapBytes))
swapBytes<sizeof(TDataType)>( theConverter.mU8 );
outData = theConverter.convert<TDataType>();
inStart += sizeof( TDataType );
return true;
}
return false;
}
template<bool DoSwapBytes, typename TDataType>
static inline bool parseBlock( const uint8_t*& inStart, const uint8_t* inStop, TDataType* outData, uint32_t inNumItems )
{
uint32_t desired = sizeof(TDataType)*inNumItems;
if ( checkLength( inStart, inStop, desired ) )
{
if ( val(DoSwapBytes) )
{
for ( uint32_t item = 0; item < inNumItems; ++item )
{
BlockParserDataConverter theConverter;
for ( uint32_t idx =0; idx < sizeof( TDataType ); ++idx )
theConverter.mU8[idx] = inStart[idx];
swapBytes<sizeof(TDataType)>( theConverter.mU8 );
outData[item] = theConverter.convert<TDataType>();
inStart += sizeof(TDataType);
}
}
else
{
uint8_t* target = reinterpret_cast<uint8_t*>(outData);
memmove( target, inStart, desired );
inStart += desired;
}
return true;
}
return false;
}
//In-place byte swapping block
template<bool DoSwapBytes, typename TDataType>
static inline bool parseBlock( uint8_t*& inStart, const uint8_t* inStop, uint32_t inNumItems )
{
uint32_t desired = sizeof(TDataType)*inNumItems;
if ( checkLength( inStart, inStop, desired ) )
{
if ( val(DoSwapBytes) )
{
for ( uint32_t item = 0; item < inNumItems; ++item, inStart += sizeof( TDataType ) )
swapBytes<sizeof(TDataType)>( inStart ); //In-place swap.
}
else
inStart += sizeof( TDataType ) * inNumItems;
return true;
}
return false;
}
};
//Wraps the begin/end keeping track of them.
template<bool DoSwapBytes>
struct BlockParser
{
const uint8_t* mBegin;
const uint8_t* mEnd;
BlockParser( const uint8_t* inBegin=NULL, const uint8_t* inEnd=NULL )
: mBegin( inBegin )
, mEnd( inEnd )
{
}
inline bool hasMoreData() const { return mBegin != mEnd; }
inline bool checkLength( uint32_t inLength ) { return BlockParseFunctions::checkLength( mBegin, mEnd, inLength ); }
template<typename TDataType>
inline bool read( TDataType& outDatatype ) { return BlockParseFunctions::parse<DoSwapBytes>( mBegin, mEnd, outDatatype ); }
template<typename TDataType>
inline bool readBlock( TDataType* outDataPtr, uint32_t inNumItems ) { return BlockParseFunctions::parseBlock<DoSwapBytes>( mBegin, mEnd, outDataPtr, inNumItems ); }
template<typename TDataType>
inline bool readBlock( uint32_t inNumItems )
{
uint8_t* theTempPtr = const_cast<uint8_t*>(mBegin);
bool retval = BlockParseFunctions::parseBlock<DoSwapBytes, TDataType>( theTempPtr, mEnd, inNumItems );
mBegin = theTempPtr;
return retval;
}
uint32_t amountLeft() const { return static_cast<uint32_t>( mEnd - mBegin ); }
};
//Reads the data without checking for error conditions
template<typename TDataType, typename TBlockParserType>
inline TDataType blockParserRead( TBlockParserType& inType )
{
TDataType retval;
inType.read( retval );
return retval;
}
}}
#endif
| 8,528 | C | 38.123853 | 166 | 0.707903 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxProfileEventBuffer.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PROFILE_EVENT_BUFFER_H
#define PX_PROFILE_EVENT_BUFFER_H
#include "PxProfileEvents.h"
#include "PxProfileEventSerialization.h"
#include "PxProfileDataBuffer.h"
#include "PxProfileContextProvider.h"
#include "foundation/PxTime.h"
namespace physx { namespace profile {
/**
* An event buffer maintains an in-memory buffer of events. When this buffer is full
* it sends to buffer to all handlers registered and resets the buffer.
*
* It is parameterized in four ways. The first is a context provider that provides
* both thread id and context id.
*
* The second is the mutex (which may be null) and a scoped locking mechanism. Thus the buffer
* may be used in a multithreaded context but clients of the buffer don't pay for this if they
* don't intend to use it this way.
*
* Finally the buffer may use an event filtering mechanism. This mechanism needs one function,
* namely isEventEnabled( uint8_t subsystem, uint8_t eventId ).
*
* All of these systems can be parameterized at compile time leading to an event buffer
* that should be as fast as possible given the constraints.
*
* Buffers may be chained together as this buffer has a handleBufferFlush method that
* will grab the mutex and add the data to this event buffer.
*
* Overall, lets look at the PhysX SDK an how all the pieces fit together.
* The SDK should have a mutex-protected event buffer where actual devs or users of PhysX
* can register handlers. This buffer has slow but correct implementations of the
* context provider interface.
*
* The SDK object should also have a concrete event filter which was used in the
* construction of the event buffer and which it exposes through opaque interfaces.
*
* The SDK should protect its event buffer and its event filter from multithreaded
* access and thus this provides the safest and slowest way to log events and to
* enable/disable events.
*
* Each scene should also have a concrete event filter. This filter is updated from
* the SDK event filter (in a mutex protected way) every frame. Thus scenes can change
* their event filtering on a frame-by-frame basis. It means that tasks running
* under the scene don't need a mutex when accessing the filter.
*
* Furthermore the scene should have an event buffer that always sets the context id
* on each event to the scene. This allows PVD and other systems to correlate events
* to scenes. Scenes should provide access only to a relative event sending system
* that looks up thread id upon each event but uses the scene id.
*
* The SDK's event buffer should be setup as an EventBufferClient for each scene's
* event buffer. Thus the SDK should expose an EventBufferClient interface that
* any client can use.
*
* For extremely *extremely* performance sensitive areas we should create a specialized
* per-scene, per-thread event buffer that is set on the task for these occasions. This buffer
* uses a trivial event context setup with the scene's context id and the thread id. It should
* share the scene's concrete event filter and it should have absolutely no locking. It should
* empty into the scene's event buffer which in some cases should empty into the SDK's event buffer
* which when full will push events all the way out of the system. The task should *always* flush
* the event buffer (if it has one) when it is finished; nothing else will work reliably.
*
* If the per-scene,per-thread event buffer is correctly parameterized and fully defined adding
* a new event should be an inline operation requiring no mutex grabs in the common case. I don't
* believe you can get faster event production than this; the events are as small as possible (all
* relative events) and they are all produced inline resulting in one 4 byte header and one
* 8 byte timestamp per event. Reducing the memory pressure in this way reduces the communication
* overhead, the mutex grabs, basically everything that makes profiling expensive at the cost
* of a per-scene,per-thread event buffer (which could easily be reduced to a per-thread event
* buffer.
*/
template<typename TContextProvider,
typename TMutex,
typename TScopedLock,
typename TEventFilter>
class EventBuffer : public DataBuffer<TMutex, TScopedLock>
{
public:
typedef DataBuffer<TMutex, TScopedLock> TBaseType;
typedef TContextProvider TContextProviderType;
typedef TEventFilter TEventFilterType;
typedef typename TBaseType::TMutexType TMutexType;
typedef typename TBaseType::TScopedLockType TScopedLockType;
typedef typename TBaseType::TU8AllocatorType TU8AllocatorType;
typedef typename TBaseType::TMemoryBufferType TMemoryBufferType;
typedef typename TBaseType::TBufferClientArray TBufferClientArray;
private:
EventContextInformation mEventContextInformation;
uint64_t mLastTimestamp;
TContextProvider mContextProvider;
TEventFilterType mEventFilter;
public:
EventBuffer(PxAllocatorCallback* inFoundation
, uint32_t inBufferFullAmount
, const TContextProvider& inProvider
, TMutexType* inBufferMutex
, const TEventFilterType& inEventFilter )
: TBaseType( inFoundation, inBufferFullAmount, inBufferMutex, "struct physx::profile::ProfileEvent" )
, mLastTimestamp( 0 )
, mContextProvider( inProvider )
, mEventFilter( inEventFilter )
{
memset(&mEventContextInformation,0,sizeof(EventContextInformation));
}
TContextProvider& getContextProvider() { return mContextProvider; }
PX_FORCE_INLINE void startEvent(uint16_t inId, uint32_t threadId, uint64_t contextId, uint8_t cpuId, uint8_t threadPriority, uint64_t inTimestamp)
{
TScopedLockType lock(TBaseType::mBufferMutex);
if ( mEventFilter.isEventEnabled( inId ) )
{
StartEvent theEvent;
theEvent.init( threadId, contextId, cpuId, threadPriority, inTimestamp );
doAddProfileEvent( inId, theEvent );
}
}
PX_FORCE_INLINE void startEvent(uint16_t inId, uint64_t contextId)
{
PxProfileEventExecutionContext ctx( mContextProvider.getExecutionContext() );
startEvent( inId, ctx.mThreadId, contextId, ctx.mCpuId, static_cast<uint8_t>(ctx.mThreadPriority), PxTime::getCurrentCounterValue() );
}
PX_FORCE_INLINE void startEvent(uint16_t inId, uint64_t contextId, uint32_t threadId)
{
startEvent( inId, threadId, contextId, 0, 0, PxTime::getCurrentCounterValue() );
}
PX_FORCE_INLINE void stopEvent(uint16_t inId, uint32_t threadId, uint64_t contextId, uint8_t cpuId, uint8_t threadPriority, uint64_t inTimestamp)
{
TScopedLockType lock(TBaseType::mBufferMutex);
if ( mEventFilter.isEventEnabled( inId ) )
{
StopEvent theEvent;
theEvent.init( threadId, contextId, cpuId, threadPriority, inTimestamp );
doAddProfileEvent( inId, theEvent );
}
}
PX_FORCE_INLINE void stopEvent(uint16_t inId, uint64_t contextId)
{
PxProfileEventExecutionContext ctx( mContextProvider.getExecutionContext() );
stopEvent( inId, ctx.mThreadId, contextId, ctx.mCpuId, static_cast<uint8_t>(ctx.mThreadPriority), PxTime::getCurrentCounterValue() );
}
PX_FORCE_INLINE void stopEvent(uint16_t inId, uint64_t contextId, uint32_t threadId)
{
stopEvent( inId, threadId, contextId, 0, 0, PxTime::getCurrentCounterValue() );
}
inline void eventValue( uint16_t inId, uint64_t contextId, int64_t inValue )
{
eventValue( inId, mContextProvider.getThreadId(), contextId, inValue );
}
inline void eventValue( uint16_t inId, uint32_t threadId, uint64_t contextId, int64_t inValue )
{
TScopedLockType lock( TBaseType::mBufferMutex );
EventValue theEvent;
theEvent.init( inValue, contextId, threadId );
EventHeader theHeader( static_cast<uint8_t>( getEventType<EventValue>() ), inId );
//set the header relative timestamp;
EventValue& theType( theEvent );
theType.setupHeader( theHeader );
sendEvent( theHeader, theType );
}
void flushProfileEvents()
{
TBaseType::flushEvents();
}
void release()
{
PX_PROFILE_DELETE( TBaseType::mWrapper.mUserFoundation, this );
}
protected:
//Clears the cache meaning event compression
//starts over again.
//only called when the buffer mutex is held
void clearCachedData()
{
mEventContextInformation.setToDefault();
mLastTimestamp = 0;
}
template<typename TProfileEventType>
PX_FORCE_INLINE void doAddProfileEvent(uint16_t eventId, const TProfileEventType& inType)
{
TScopedLockType lock(TBaseType::mBufferMutex);
if (mEventContextInformation == inType.mContextInformation)
doAddEvent(static_cast<uint8_t>(inType.getRelativeEventType()), eventId, inType.getRelativeEvent());
else
{
mEventContextInformation = inType.mContextInformation;
doAddEvent( static_cast<uint8_t>( getEventType<TProfileEventType>() ), eventId, inType );
}
}
template<typename TDataType>
PX_FORCE_INLINE void doAddEvent(uint8_t inEventType, uint16_t eventId, const TDataType& inType)
{
EventHeader theHeader( inEventType, eventId );
//set the header relative timestamp;
TDataType& theType( const_cast<TDataType&>( inType ) );
uint64_t currentTs = inType.getTimestamp();
theType.setupHeader(theHeader, mLastTimestamp);
mLastTimestamp = currentTs;
sendEvent( theHeader, theType );
}
template<typename TDataType>
PX_FORCE_INLINE void sendEvent( EventHeader& inHeader, TDataType& inType )
{
uint32_t sizeToWrite = sizeof(inHeader) + inType.getEventSize(inHeader);
PX_UNUSED(sizeToWrite);
uint32_t writtenSize = inHeader.streamify( TBaseType::mSerializer );
writtenSize += inType.streamify(TBaseType::mSerializer, inHeader);
PX_ASSERT(writtenSize == sizeToWrite);
if ( TBaseType::mDataArray.size() >= TBaseType::mBufferFullAmount )
flushProfileEvents();
}
};
}}
#endif
| 11,552 | C | 42.269663 | 148 | 0.750779 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxProfileScopedEvent.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PX_PROFILE_SCOPED_EVENT_H
#define PX_PROFILE_SCOPED_EVENT_H
#include "PxProfileEventId.h"
#include "PxProfileCompileTimeEventFilter.h"
namespace physx { namespace profile {
/**
\brief Template version of startEvent, called directly on provided profile buffer.
\param inBuffer Profile event buffer.
\param inId Profile event id.
\param inContext Profile event context.
*/
template<bool TEnabled, typename TBufferType>
inline void startEvent( TBufferType* inBuffer, const PxProfileEventId& inId, uint64_t inContext )
{
if ( TEnabled && inBuffer ) inBuffer->startEvent( inId, inContext );
}
/**
\brief Template version of stopEvent, called directly on provided profile buffer.
\param inBuffer Profile event buffer.
\param inId Profile event id.
\param inContext Profile event context.
*/
template<bool TEnabled, typename TBufferType>
inline void stopEvent( TBufferType* inBuffer, const PxProfileEventId& inId, uint64_t inContext )
{
if ( TEnabled && inBuffer ) inBuffer->stopEvent( inId, inContext );
}
/**
\brief Template version of startEvent, called directly on provided profile buffer.
\param inEnabled If profile event is enabled.
\param inBuffer Profile event buffer.
\param inId Profile event id.
\param inContext Profile event context.
*/
template<typename TBufferType>
inline void startEvent( bool inEnabled, TBufferType* inBuffer, const PxProfileEventId& inId, uint64_t inContext )
{
if ( inEnabled && inBuffer ) inBuffer->startEvent( inId, inContext );
}
/**
\brief Template version of stopEvent, called directly on provided profile buffer.
\param inEnabled If profile event is enabled.
\param inBuffer Profile event buffer.
\param inId Profile event id.
\param inContext Profile event context.
*/
template<typename TBufferType>
inline void stopEvent( bool inEnabled, TBufferType* inBuffer, const PxProfileEventId& inId, uint64_t inContext )
{
if ( inEnabled && inBuffer ) inBuffer->stopEvent( inId, inContext );
}
/**
\brief Template version of eventValue, called directly on provided profile buffer.
\param inEnabled If profile event is enabled.
\param inBuffer Profile event buffer.
\param inId Profile event id.
\param inContext Profile event context.
\param inValue Event value.
*/
template<typename TBufferType>
inline void eventValue( bool inEnabled, TBufferType* inBuffer, const PxProfileEventId& inId, uint64_t inContext, int64_t inValue )
{
if ( inEnabled && inBuffer ) inBuffer->eventValue( inId, inContext, inValue );
}
}}
#endif
| 4,102 | C | 36.99074 | 131 | 0.762311 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxPvdImpl.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PVD_IMPL_H
#define PX_PVD_IMPL_H
#include "foundation/PxProfiler.h"
#include "foundation/PxAllocator.h"
#include "PsPvd.h"
#include "foundation/PxArray.h"
#include "foundation/PxMutex.h"
#include "PxPvdCommStreamTypes.h"
#include "PxPvdFoundation.h"
#include "PxPvdObjectModelMetaData.h"
#include "PxPvdObjectRegistrar.h"
namespace physx
{
namespace profile
{
class PxProfileZoneManager;
}
namespace pvdsdk
{
class PvdMemClient;
class PvdProfileZoneClient;
struct MetaDataProvider : public PvdOMMetaDataProvider, public PxUserAllocated
{
typedef PxMutex::ScopedLock TScopedLockType;
typedef PxHashMap<const void*, int32_t> TInstTypeMap;
PvdObjectModelMetaData& mMetaData;
PxMutex mMutex;
uint32_t mRefCount;
TInstTypeMap mTypeMap;
MetaDataProvider()
: mMetaData(PvdObjectModelMetaData::create()), mRefCount(0), mTypeMap("MetaDataProvider::mTypeMap")
{
mMetaData.addRef();
}
virtual ~MetaDataProvider()
{
mMetaData.release();
}
virtual void addRef()
{
TScopedLockType locker(mMutex);
++mRefCount;
}
virtual void release()
{
{
TScopedLockType locker(mMutex);
if(mRefCount)
--mRefCount;
}
if(!mRefCount)
PVD_DELETE(this);
}
virtual PvdObjectModelMetaData& lock()
{
mMutex.lock();
return mMetaData;
}
virtual void unlock()
{
mMutex.unlock();
}
virtual bool createInstance(const NamespacedName& clsName, const void* instance)
{
TScopedLockType locker(mMutex);
Option<ClassDescription> cls(mMetaData.findClass(clsName));
if(cls.hasValue() == false)
return false;
int32_t instType = cls->mClassId;
mTypeMap.insert(instance, instType);
return true;
}
virtual bool isInstanceValid(const void* instance)
{
TScopedLockType locker(mMutex);
ClassDescription classDesc;
bool retval = mTypeMap.find(instance) != NULL;
#if PX_DEBUG
if(retval)
classDesc = mMetaData.getClass(mTypeMap.find(instance)->second);
#endif
return retval;
}
virtual void destroyInstance(const void* instance)
{
{
TScopedLockType locker(mMutex);
mTypeMap.erase(instance);
}
}
virtual int32_t getInstanceClassType(const void* instance)
{
TScopedLockType locker(mMutex);
const TInstTypeMap::Entry* entry = mTypeMap.find(instance);
if(entry)
return entry->second;
return -1;
}
private:
MetaDataProvider& operator=(const MetaDataProvider&);
MetaDataProvider(const MetaDataProvider&);
};
//////////////////////////////////////////////////////////////////////////
/*!
PvdImpl is the realization of PxPvd.
It implements the interface methods and provides richer functionality for advanced users or internal clients (such as
PhysX or APEX), including handler notification for clients.
*/
//////////////////////////////////////////////////////////////////////////
class PvdImpl : public PsPvd, public PxUserAllocated
{
PX_NOCOPY(PvdImpl)
typedef PxMutex::ScopedLock TScopedLockType;
typedef void (PvdImpl::*TAllocationHandler)(size_t size, const char* typeName, const char* filename, int line,
void* allocatedMemory);
typedef void (PvdImpl::*TDeallocationHandler)(void* allocatedMemory);
public:
PvdImpl();
virtual ~PvdImpl();
void release();
bool connect(PxPvdTransport& transport, PxPvdInstrumentationFlags flags);
void disconnect();
bool isConnected(bool useCachedStatus = true);
void flush();
PxPvdTransport* getTransport();
PxPvdInstrumentationFlags getInstrumentationFlags();
void addClient(PvdClient* client);
void removeClient(PvdClient* client);
PvdOMMetaDataProvider& getMetaDataProvider();
bool registerObject(const void* inItem);
bool unRegisterObject(const void* inItem);
//AllocationListener
void onAllocation(size_t size, const char* typeName, const char* filename, int line, void* allocatedMemory);
void onDeallocation(void* addr);
uint64_t getNextStreamId();
static bool initialize();
static PvdImpl* getInstance();
// Profiling
virtual void* zoneStart(const char* eventName, bool detached, uint64_t contextId);
virtual void zoneEnd(void* profilerData, const char *eventName, bool detached, uint64_t contextId);
private:
void sendTransportInitialization();
PxPvdTransport* mPvdTransport;
physx::PxArray<PvdClient*> mPvdClients;
MetaDataProvider* mSharedMetaProvider; // shared between clients
ObjectRegistrar mObjectRegistrar;
PvdMemClient* mMemClient;
PxPvdInstrumentationFlags mFlags;
bool mIsConnected;
bool mGPUProfilingWasConnected;
bool mIsNVTXSupportEnabled;
uint32_t mNVTXContext;
uint64_t mNextStreamId;
physx::profile::PxProfileZoneManager*mProfileZoneManager;
PvdProfileZoneClient* mProfileClient;
physx::profile::PxProfileZone* mProfileZone;
static PvdImpl* sInstance;
static uint32_t sRefCount;
};
} // namespace pvdsdk
}
#endif
| 6,567 | C | 28.452915 | 117 | 0.730775 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxProfileEventSender.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PX_PROFILE_EVENT_SENDER_H
#define PX_PROFILE_EVENT_SENDER_H
#include "foundation/Px.h"
namespace physx { namespace profile {
/**
\brief Tagging interface to indicate an object that is capable of flushing a profile
event stream at a certain point.
*/
class PxProfileEventFlusher
{
protected:
virtual ~PxProfileEventFlusher(){}
public:
/**
\brief Flush profile events. Sends the profile event buffer to hooked clients.
*/
virtual void flushProfileEvents() = 0;
};
/**
\brief Sends the full events where the caller must provide the context and thread id.
*/
class PxProfileEventSender
{
protected:
virtual ~PxProfileEventSender(){}
public:
/**
\brief Use this as a thread id for events that start on one thread and end on another
*/
static const uint32_t CrossThreadId = 99999789;
/**
\brief Send a start profile event, optionally with a context. Events are sorted by thread
and context in the client side.
\param inId Profile event id.
\param contextId Context id.
*/
virtual void startEvent( uint16_t inId, uint64_t contextId) = 0;
/**
\brief Send a stop profile event, optionally with a context. Events are sorted by thread
and context in the client side.
\param inId Profile event id.
\param contextId Context id.
*/
virtual void stopEvent( uint16_t inId, uint64_t contextId) = 0;
/**
\brief Send a start profile event, optionally with a context. Events are sorted by thread
and context in the client side.
\param inId Profile event id.
\param contextId Context id.
\param threadId Thread id.
*/
virtual void startEvent( uint16_t inId, uint64_t contextId, uint32_t threadId) = 0;
/**
\brief Send a stop profile event, optionally with a context. Events are sorted by thread
and context in the client side.
\param inId Profile event id.
\param contextId Context id.
\param threadId Thread id.
*/
virtual void stopEvent( uint16_t inId, uint64_t contextId, uint32_t threadId ) = 0;
virtual void atEvent(uint16_t inId, uint64_t contextId, uint32_t threadId, uint64_t start, uint64_t stop) = 0;
/**
\brief Set an specific events value. This is different than the profiling value
for the event; it is a value recorded and kept around without a timestamp associated
with it. This value is displayed when the event itself is processed.
\param inId Profile event id.
\param contextId Context id.
\param inValue Value to set for the event.
*/
virtual void eventValue( uint16_t inId, uint64_t contextId, int64_t inValue ) = 0;
};
} }
#endif
| 4,134 | C | 35.919643 | 112 | 0.740687 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxProfileMemory.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PROFILE_MEMORY_H
#define PX_PROFILE_MEMORY_H
#include "PxProfileEventBufferClientManager.h"
#include "PxProfileEventSender.h"
#include "foundation/PxBroadcast.h"
namespace physx { namespace profile {
/**
\brief Record events so a late-connecting client knows about
all outstanding allocations
*/
class PxProfileMemoryEventRecorder : public PxAllocationListener
{
protected:
virtual ~PxProfileMemoryEventRecorder(){}
public:
/**
\brief Set the allocation listener
\param inListener Allocation listener.
*/
virtual void setListener(PxAllocationListener* inListener) = 0;
/**
\brief Release the instance.
*/
virtual void release() = 0;
};
/**
\brief Stores memory events into the memory buffer.
*/
class PxProfileMemoryEventBuffer
: public PxAllocationListener //add a new event to the buffer
, public PxProfileEventBufferClientManager //add clients to handle the serialized memory events
, public PxProfileEventFlusher //flush the buffer
{
protected:
virtual ~PxProfileMemoryEventBuffer(){}
public:
/**
\brief Release the instance.
*/
virtual void release() = 0;
/**
\brief Create a non-mutex-protected event buffer.
\param inAllocator Allocation callback.
\param inBufferSize Internal buffer size.
*/
static PxProfileMemoryEventBuffer& createMemoryEventBuffer(PxAllocatorCallback& inAllocator, uint32_t inBufferSize = 0x1000);
};
} } // namespace physx
#endif
| 3,151 | C | 33.637362 | 127 | 0.757537 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxProfileEventId.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PX_PROFILE_EVENT_ID_H
#define PX_PROFILE_EVENT_ID_H
#include "foundation/Px.h"
namespace physx { namespace profile {
/**
\brief A event id structure. Optionally includes information about
if the event was enabled at compile time.
*/
struct PxProfileEventId
{
uint16_t eventId;
mutable bool compileTimeEnabled;
/**
\brief Profile event id constructor.
\param inId Profile event id.
\param inCompileTimeEnabled Compile time enabled.
*/
PxProfileEventId( uint16_t inId = 0, bool inCompileTimeEnabled = true )
: eventId( inId )
, compileTimeEnabled( inCompileTimeEnabled )
{
}
operator uint16_t () const { return eventId; }
bool operator==( const PxProfileEventId& inOther ) const
{
return eventId == inOther.eventId;
}
};
} }
#endif
| 2,357 | C | 35.276923 | 74 | 0.747985 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxProfileMemoryEventBuffer.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PROFILE_MEMORY_EVENT_BUFFER_H
#define PX_PROFILE_MEMORY_EVENT_BUFFER_H
#include "PxProfileDataBuffer.h"
#include "PxProfileMemoryEvents.h"
#include "PxProfileMemory.h"
#include "PxProfileScopedMutexLock.h"
#include "PxProfileAllocatorWrapper.h"
#include "PxProfileEventMutex.h"
#include "foundation/PxHash.h"
#include "foundation/PxHashMap.h"
#include "foundation/PxUserAllocated.h"
namespace physx { namespace profile {
template<typename TMutex,
typename TScopedLock>
class MemoryEventBuffer : public DataBuffer<TMutex, TScopedLock>
{
public:
typedef DataBuffer<TMutex, TScopedLock> TBaseType;
typedef typename TBaseType::TMutexType TMutexType;
typedef typename TBaseType::TScopedLockType TScopedLockType;
typedef typename TBaseType::TU8AllocatorType TU8AllocatorType;
typedef typename TBaseType::TMemoryBufferType TMemoryBufferType;
typedef typename TBaseType::TBufferClientArray TBufferClientArray;
typedef PxHashMap<const char*, uint32_t, PxHash<const char*>, TU8AllocatorType> TCharPtrToHandleMap;
protected:
TCharPtrToHandleMap mStringTable;
public:
MemoryEventBuffer( PxAllocatorCallback& cback
, uint32_t inBufferFullAmount
, TMutexType* inBufferMutex )
: TBaseType( &cback, inBufferFullAmount, inBufferMutex, "struct physx::profile::MemoryEvent" )
, mStringTable( TU8AllocatorType( TBaseType::getWrapper(), "MemoryEventStringBuffer" ) )
{
}
uint32_t getHandle( const char* inData )
{
if ( inData == NULL ) inData = "";
const typename TCharPtrToHandleMap::Entry* result( mStringTable.find( inData ) );
if ( result )
return result->second;
uint32_t hdl = mStringTable.size() + 1;
mStringTable.insert( inData, hdl );
StringTableEvent theEvent;
theEvent.init( inData, hdl );
sendEvent( theEvent );
return hdl;
}
void onAllocation( size_t inSize, const char* inType, const char* inFile, uint32_t inLine, uint64_t addr )
{
if ( addr == 0 )
return;
uint32_t typeHdl( getHandle( inType ) );
uint32_t fileHdl( getHandle( inFile ) );
AllocationEvent theEvent;
theEvent.init( inSize, typeHdl, fileHdl, inLine, addr );
sendEvent( theEvent );
}
void onDeallocation( uint64_t addr )
{
if ( addr == 0 )
return;
DeallocationEvent theEvent;
theEvent.init( addr );
sendEvent( theEvent );
}
void flushProfileEvents()
{
TBaseType::flushEvents();
}
protected:
template<typename TDataType>
void sendEvent( TDataType inType )
{
MemoryEventHeader theHeader( getMemoryEventType<TDataType>() );
inType.setup( theHeader );
theHeader.streamify( TBaseType::mSerializer );
inType.streamify( TBaseType::mSerializer, theHeader );
if ( TBaseType::mDataArray.size() >= TBaseType::mBufferFullAmount )
flushProfileEvents();
}
};
class PxProfileMemoryEventBufferImpl : public PxUserAllocated
, public PxProfileMemoryEventBuffer
{
typedef MemoryEventBuffer<PxProfileEventMutex, NullLock> TMemoryBufferType;
TMemoryBufferType mBuffer;
public:
PxProfileMemoryEventBufferImpl( PxAllocatorCallback& alloc, uint32_t inBufferFullAmount )
: mBuffer( alloc, inBufferFullAmount, NULL )
{
}
virtual void onAllocation( size_t size, const char* typeName, const char* filename, int line, void* allocatedMemory )
{
mBuffer.onAllocation( size, typeName, filename, uint32_t(line), static_cast<uint64_t>(reinterpret_cast<size_t>(allocatedMemory)) );
}
virtual void onDeallocation( void* allocatedMemory )
{
mBuffer.onDeallocation(static_cast<uint64_t>(reinterpret_cast<size_t>(allocatedMemory)) );
}
virtual void addClient( PxProfileEventBufferClient& inClient ) { mBuffer.addClient( inClient ); }
virtual void removeClient( PxProfileEventBufferClient& inClient ) { mBuffer.removeClient( inClient ); }
virtual bool hasClients() const { return mBuffer.hasClients(); }
virtual void flushProfileEvents() { mBuffer.flushProfileEvents(); }
virtual void release(){ PX_PROFILE_DELETE( mBuffer.getWrapper().getAllocator(), this ); }
};
}}
#endif
| 5,746 | C | 35.605095 | 134 | 0.748869 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxPvdUserRenderer.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#include "PxPvdUserRenderImpl.h"
#include "PxPvdInternalByteStreams.h"
#include "PxPvdBits.h"
#include <stdarg.h>
using namespace physx;
using namespace physx::pvdsdk;
namespace
{
template <typename TStreamType>
struct RenderWriter : public RenderSerializer
{
TStreamType& mStream;
RenderWriter(TStreamType& stream) : mStream(stream)
{
}
template <typename TDataType>
void write(const TDataType* val, uint32_t count)
{
uint32_t numBytes = count * sizeof(TDataType);
mStream.write(reinterpret_cast<const uint8_t*>(val), numBytes);
}
template <typename TDataType>
void write(const TDataType& val)
{
write(&val, 1);
}
template <typename TDataType>
void writeRef(DataRef<TDataType>& val)
{
uint32_t amount = val.size();
write(amount);
if(amount)
write(val.begin(), amount);
}
virtual void streamify(uint64_t& val)
{
write(val);
}
virtual void streamify(uint32_t& val)
{
write(val);
}
virtual void streamify(float& val)
{
write(val);
}
virtual void streamify(uint8_t& val)
{
write(val);
}
virtual void streamify(DataRef<uint8_t>& val)
{
writeRef(val);
}
virtual void streamify(PxDebugText& val)
{
write(val.color);
write(val.position);
write(val.size);
uint32_t amount = static_cast<uint32_t>(strlen(val.string)) + 1;
write(amount);
if(amount)
write(val.string, amount);
}
virtual void streamify(DataRef<PxDebugPoint>& val)
{
writeRef(val);
}
virtual void streamify(DataRef<PxDebugLine>& val)
{
writeRef(val);
}
virtual void streamify(DataRef<PxDebugTriangle>& val)
{
writeRef(val);
}
virtual uint32_t hasData()
{
return false;
}
virtual bool isGood()
{
return true;
}
private:
RenderWriter& operator=(const RenderWriter&);
};
struct UserRenderer : public PvdUserRenderer
{
ForwardingMemoryBuffer mBuffer;
uint32_t mBufferCapacity;
RendererEventClient* mClient;
UserRenderer(uint32_t bufferFullAmount)
: mBuffer("UserRenderBuffer"), mBufferCapacity(bufferFullAmount), mClient(NULL)
{
}
virtual ~UserRenderer()
{
}
virtual void release()
{
PVD_DELETE(this);
}
template <typename TEventType>
void handleEvent(TEventType evt)
{
RenderWriter<ForwardingMemoryBuffer> _writer(mBuffer);
RenderSerializer& writer(_writer);
PvdUserRenderTypes::Enum evtType(getPvdRenderTypeFromType<TEventType>());
writer.streamify(evtType);
evt.serialize(writer);
if(mBuffer.size() >= mBufferCapacity)
flushRenderEvents();
}
virtual void setInstanceId(const void* iid)
{
handleEvent(SetInstanceIdRenderEvent(PVD_POINTER_TO_U64(iid)));
}
// Draw these points associated with this instance
virtual void drawPoints(const PxDebugPoint* points, uint32_t count)
{
handleEvent(PointsRenderEvent(points, count));
}
// Draw these lines associated with this instance
virtual void drawLines(const PxDebugLine* lines, uint32_t count)
{
handleEvent(LinesRenderEvent(lines, count));
}
// Draw these triangles associated with this instance
virtual void drawTriangles(const PxDebugTriangle* triangles, uint32_t count)
{
handleEvent(TrianglesRenderEvent(triangles, count));
}
virtual void drawText(const PxDebugText& text)
{
handleEvent(TextRenderEvent(text));
}
virtual void drawRenderbuffer(const PxDebugPoint* pointData, uint32_t pointCount, const PxDebugLine* lineData,
uint32_t lineCount, const PxDebugTriangle* triangleData, uint32_t triangleCount)
{
handleEvent(DebugRenderEvent(pointData, pointCount, lineData, lineCount, triangleData, triangleCount));
}
// Constraint visualization routines
virtual void visualizeJointFrames(const PxTransform& parent, const PxTransform& child) PX_OVERRIDE
{
handleEvent(JointFramesRenderEvent(parent, child));
}
virtual void visualizeLinearLimit(const PxTransform& t0, const PxTransform& t1, float value) PX_OVERRIDE
{
handleEvent(LinearLimitRenderEvent(t0, t1, value, true));
}
virtual void visualizeAngularLimit(const PxTransform& t0, float lower, float upper) PX_OVERRIDE
{
handleEvent(AngularLimitRenderEvent(t0, lower, upper, true));
}
virtual void visualizeLimitCone(const PxTransform& t, float tanQSwingY, float tanQSwingZ) PX_OVERRIDE
{
handleEvent(LimitConeRenderEvent(t, tanQSwingY, tanQSwingZ, true));
}
virtual void visualizeDoubleCone(const PxTransform& t, float angle) PX_OVERRIDE
{
handleEvent(DoubleConeRenderEvent(t, angle, true));
}
// Clear the immedate buffer.
virtual void flushRenderEvents()
{
if(mClient)
mClient->handleBufferFlush(mBuffer.begin(), mBuffer.size());
mBuffer.clear();
}
virtual void setClient(RendererEventClient* client)
{
mClient = client;
}
private:
UserRenderer& operator=(const UserRenderer&);
};
template <bool swapBytes>
struct RenderReader : public RenderSerializer
{
MemPvdInputStream mStream;
ForwardingMemoryBuffer& mBuffer;
RenderReader(ForwardingMemoryBuffer& buf) : mBuffer(buf)
{
}
void setData(DataRef<const uint8_t> data)
{
mStream.setup(const_cast<uint8_t*>(data.begin()), const_cast<uint8_t*>(data.end()));
}
virtual void streamify(uint32_t& val)
{
mStream >> val;
}
virtual void streamify(uint64_t& val)
{
mStream >> val;
}
virtual void streamify(float& val)
{
mStream >> val;
}
virtual void streamify(uint8_t& val)
{
mStream >> val;
}
template <typename TDataType>
void readRef(DataRef<TDataType>& val)
{
uint32_t count;
mStream >> count;
uint32_t numBytes = sizeof(TDataType) * count;
TDataType* dataPtr = reinterpret_cast<TDataType*>(mBuffer.growBuf(numBytes));
mStream.read(reinterpret_cast<uint8_t*>(dataPtr), numBytes);
val = DataRef<TDataType>(dataPtr, count);
}
virtual void streamify(DataRef<PxDebugPoint>& val)
{
readRef(val);
}
virtual void streamify(DataRef<PxDebugLine>& val)
{
readRef(val);
}
virtual void streamify(DataRef<PxDebugTriangle>& val)
{
readRef(val);
}
virtual void streamify(PxDebugText& val)
{
mStream >> val.color;
mStream >> val.position;
mStream >> val.size;
uint32_t len = 0;
mStream >> len;
uint8_t* dataPtr = mBuffer.growBuf(len);
mStream.read(dataPtr, len);
val.string = reinterpret_cast<const char*>(dataPtr);
}
virtual void streamify(DataRef<uint8_t>& val)
{
readRef(val);
}
virtual bool isGood()
{
return mStream.isGood();
}
virtual uint32_t hasData()
{
return uint32_t(mStream.size() > 0);
}
private:
RenderReader& operator=(const RenderReader&);
};
template <>
struct RenderReader<true> : public RenderSerializer
{
MemPvdInputStream mStream;
ForwardingMemoryBuffer& mBuffer;
RenderReader(ForwardingMemoryBuffer& buf) : mBuffer(buf)
{
}
void setData(DataRef<const uint8_t> data)
{
mStream.setup(const_cast<uint8_t*>(data.begin()), const_cast<uint8_t*>(data.end()));
}
template <typename TDataType>
void read(TDataType& val)
{
mStream >> val;
swapBytes(val);
}
virtual void streamify(uint64_t& val)
{
read(val);
}
virtual void streamify(uint32_t& val)
{
read(val);
}
virtual void streamify(float& val)
{
read(val);
}
virtual void streamify(uint8_t& val)
{
read(val);
}
template <typename TDataType>
void readRef(DataRef<TDataType>& val)
{
uint32_t count;
mStream >> count;
swapBytes(count);
uint32_t numBytes = sizeof(TDataType) * count;
TDataType* dataPtr = reinterpret_cast<TDataType*>(mBuffer.growBuf(numBytes));
PVD_FOREACH(idx, count)
RenderSerializerMap<TDataType>().serialize(*this, dataPtr[idx]);
val = DataRef<TDataType>(dataPtr, count);
}
virtual void streamify(DataRef<PxDebugPoint>& val)
{
readRef(val);
}
virtual void streamify(DataRef<PxDebugLine>& val)
{
readRef(val);
}
virtual void streamify(DataRef<PxDebugTriangle>& val)
{
readRef(val);
}
virtual void streamify(PxDebugText& val)
{
mStream >> val.color;
mStream >> val.position;
mStream >> val.size;
uint32_t len = 0;
mStream >> len;
uint8_t* dataPtr = mBuffer.growBuf(len);
mStream.read(dataPtr, len);
val.string = reinterpret_cast<const char*>(dataPtr);
}
virtual void streamify(DataRef<uint8_t>& val)
{
readRef(val);
}
virtual bool isGood()
{
return mStream.isGood();
}
virtual uint32_t hasData()
{
return uint32_t(mStream.size() > 0);
}
private:
RenderReader& operator=(const RenderReader&);
};
}
PvdUserRenderer* PvdUserRenderer::create(uint32_t bufferSize)
{
return PVD_NEW(UserRenderer)(bufferSize);
}
| 9,923 | C++ | 23.503704 | 111 | 0.727401 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxPvdDefaultSocketTransport.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "PxPvdDefaultSocketTransport.h"
namespace physx
{
namespace pvdsdk
{
PvdDefaultSocketTransport::PvdDefaultSocketTransport(const char* host, int port, unsigned int timeoutInMilliseconds)
: mHost(host), mPort(uint16_t(port)), mTimeout(timeoutInMilliseconds), mConnected(false), mWrittenData(0)
{
}
PvdDefaultSocketTransport::~PvdDefaultSocketTransport()
{
}
bool PvdDefaultSocketTransport::connect()
{
if(mConnected)
return true;
if(mSocket.connect(mHost, mPort, mTimeout))
{
mSocket.setBlocking(true);
mConnected = true;
}
return mConnected;
}
void PvdDefaultSocketTransport::disconnect()
{
mSocket.flush();
mSocket.disconnect();
mConnected = false;
}
bool PvdDefaultSocketTransport::isConnected()
{
return mSocket.isConnected();
}
bool PvdDefaultSocketTransport::write(const uint8_t* inBytes, uint32_t inLength)
{
if(mConnected)
{
if(inLength == 0)
return true;
uint32_t amountWritten = 0;
uint32_t totalWritten = 0;
do
{
// Sockets don't have to write as much as requested, so we need
// to wrap this call in a do/while loop.
// If they don't write any bytes then we consider them disconnected.
amountWritten = mSocket.write(inBytes, inLength);
inLength -= amountWritten;
inBytes += amountWritten;
totalWritten += amountWritten;
} while(inLength && amountWritten);
if(amountWritten == 0)
return false;
mWrittenData += totalWritten;
return true;
}
else
return false;
}
PxPvdTransport& PvdDefaultSocketTransport::lock()
{
mMutex.lock();
return *this;
}
void PvdDefaultSocketTransport::unlock()
{
mMutex.unlock();
}
void PvdDefaultSocketTransport::flush()
{
mSocket.flush();
}
uint64_t PvdDefaultSocketTransport::getWrittenDataSize()
{
return mWrittenData;
}
void PvdDefaultSocketTransport::release()
{
PX_DELETE_THIS;
}
} // namespace pvdsdk
PxPvdTransport* PxDefaultPvdSocketTransportCreate(const char* host, int port, unsigned int timeoutInMilliseconds)
{
return PX_NEW(pvdsdk::PvdDefaultSocketTransport)(host, port, timeoutInMilliseconds);
}
} // namespace physx
| 3,762 | C++ | 27.082089 | 116 | 0.754918 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxPvdDefaultFileTransport.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "PxPvdDefaultFileTransport.h"
namespace physx
{
namespace pvdsdk
{
PvdDefaultFileTransport::PvdDefaultFileTransport(const char* name) : mConnected(false), mWrittenData(0), mLocked(false)
{
mFileBuffer = PX_NEW(PsFileBuffer)(name, PxFileBuf::OPEN_WRITE_ONLY);
}
PvdDefaultFileTransport::~PvdDefaultFileTransport()
{
}
bool PvdDefaultFileTransport::connect()
{
PX_ASSERT(mFileBuffer);
mConnected = mFileBuffer->isOpen();
return mConnected;
}
void PvdDefaultFileTransport::disconnect()
{
mConnected = false;
}
bool PvdDefaultFileTransport::isConnected()
{
return mConnected;
}
bool PvdDefaultFileTransport::write(const uint8_t* inBytes, uint32_t inLength)
{
PX_ASSERT(mLocked);
PX_ASSERT(mFileBuffer);
if (mConnected)
{
uint32_t len = mFileBuffer->write(inBytes, inLength);
mWrittenData += len;
return len == inLength;
}
else
return false;
}
PxPvdTransport& PvdDefaultFileTransport::lock()
{
mMutex.lock();
PX_ASSERT(!mLocked);
mLocked = true;
return *this;
}
void PvdDefaultFileTransport::unlock()
{
PX_ASSERT(mLocked);
mLocked = false;
mMutex.unlock();
}
void PvdDefaultFileTransport::flush()
{
}
uint64_t PvdDefaultFileTransport::getWrittenDataSize()
{
return mWrittenData;
}
void PvdDefaultFileTransport::release()
{
if (mFileBuffer)
{
mFileBuffer->close();
delete mFileBuffer;
}
mFileBuffer = NULL;
PX_DELETE_THIS;
}
class NullFileTransport : public physx::PxPvdTransport, public physx::PxUserAllocated
{
PX_NOCOPY(NullFileTransport)
public:
NullFileTransport();
virtual ~NullFileTransport();
virtual bool connect();
virtual void disconnect();
virtual bool isConnected();
virtual bool write(const uint8_t* inBytes, uint32_t inLength);
virtual PxPvdTransport& lock();
virtual void unlock();
virtual void flush();
virtual uint64_t getWrittenDataSize();
virtual void release();
private:
bool mConnected;
uint64_t mWrittenData;
physx::PxMutex mMutex;
bool mLocked; // for debug, remove it when finished
};
NullFileTransport::NullFileTransport() : mConnected(false), mWrittenData(0), mLocked(false)
{
}
NullFileTransport::~NullFileTransport()
{
}
bool NullFileTransport::connect()
{
mConnected = true;
return true;
}
void NullFileTransport::disconnect()
{
mConnected = false;
}
bool NullFileTransport::isConnected()
{
return mConnected;
}
bool NullFileTransport::write(const uint8_t* /*inBytes*/, uint32_t inLength)
{
PX_ASSERT(mLocked);
if(mConnected)
{
uint32_t len = inLength;
mWrittenData += len;
return len == inLength;
}
else
return false;
}
PxPvdTransport& NullFileTransport::lock()
{
mMutex.lock();
PX_ASSERT(!mLocked);
mLocked = true;
return *this;
}
void NullFileTransport::unlock()
{
PX_ASSERT(mLocked);
mLocked = false;
mMutex.unlock();
}
void NullFileTransport::flush()
{
}
uint64_t NullFileTransport::getWrittenDataSize()
{
return mWrittenData;
}
void NullFileTransport::release()
{
PX_DELETE_THIS;
}
} // namespace pvdsdk
PxPvdTransport* PxDefaultPvdFileTransportCreate(const char* name)
{
if(name)
return PX_NEW(pvdsdk::PvdDefaultFileTransport)(name);
else
return PX_NEW(pvdsdk::NullFileTransport)();
}
} // namespace physx
| 4,866 | C++ | 21.325688 | 119 | 0.748048 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxProfileEvents.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PX_PROFILE_EVENTS_H
#define PX_PROFILE_EVENTS_H
#include "foundation/PxMath.h"
#include "foundation/PxAssert.h"
#include "PxProfileEventId.h"
#define PX_PROFILE_UNION_1(a) physx::profile::TUnion<a, physx::profile::Empty>
#define PX_PROFILE_UNION_2(a,b) physx::profile::TUnion<a, PX_PROFILE_UNION_1(b)>
#define PX_PROFILE_UNION_3(a,b,c) physx::profile::TUnion<a, PX_PROFILE_UNION_2(b,c)>
#define PX_PROFILE_UNION_4(a,b,c,d) physx::profile::TUnion<a, PX_PROFILE_UNION_3(b,c,d)>
#define PX_PROFILE_UNION_5(a,b,c,d,e) physx::profile::TUnion<a, PX_PROFILE_UNION_4(b,c,d,e)>
#define PX_PROFILE_UNION_6(a,b,c,d,e,f) physx::profile::TUnion<a, PX_PROFILE_UNION_5(b,c,d,e,f)>
#define PX_PROFILE_UNION_7(a,b,c,d,e,f,g) physx::profile::TUnion<a, PX_PROFILE_UNION_6(b,c,d,e,f,g)>
#define PX_PROFILE_UNION_8(a,b,c,d,e,f,g,h) physx::profile::TUnion<a, PX_PROFILE_UNION_7(b,c,d,e,f,g,h)>
#define PX_PROFILE_UNION_9(a,b,c,d,e,f,g,h,i) physx::profile::TUnion<a, PX_PROFILE_UNION_8(b,c,d,e,f,g,h,i)>
namespace physx { namespace profile {
struct Empty {};
template <typename T> struct Type2Type {};
template <typename U, typename V>
union TUnion
{
typedef U Head;
typedef V Tail;
Head head;
Tail tail;
template <typename TDataType>
void init(const TDataType& inData)
{
toType(Type2Type<TDataType>()).init(inData);
}
template <typename TDataType>
PX_FORCE_INLINE TDataType& toType(const Type2Type<TDataType>& outData) { return tail.toType(outData); }
PX_FORCE_INLINE Head& toType(const Type2Type<Head>&) { return head; }
template <typename TDataType>
PX_FORCE_INLINE const TDataType& toType(const Type2Type<TDataType>& outData) const { return tail.toType(outData); }
PX_FORCE_INLINE const Head& toType(const Type2Type<Head>&) const { return head; }
};
struct EventTypes
{
enum Enum
{
Unknown = 0,
StartEvent,
StopEvent,
RelativeStartEvent, //reuses context,id from the earlier event.
RelativeStopEvent, //reuses context,id from the earlier event.
EventValue,
CUDAProfileBuffer //obsolete, placeholder to skip data from PhysX SDKs < 3.4
};
};
struct EventStreamCompressionFlags
{
enum Enum
{
U8 = 0,
U16 = 1,
U32 = 2,
U64 = 3,
CompressionMask = 3
};
};
#if PX_APPLE_FAMILY
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-fallthrough"
#endif
//Find the smallest value that will represent the incoming value without loss.
//We can enlarge the current compression value, but we can't make is smaller.
//In this way, we can use this function to find the smallest compression setting
//that will work for a set of values.
inline EventStreamCompressionFlags::Enum findCompressionValue( uint64_t inValue, EventStreamCompressionFlags::Enum inCurrentCompressionValue = EventStreamCompressionFlags::U8 )
{
PX_ASSERT_WITH_MESSAGE( (inCurrentCompressionValue >= EventStreamCompressionFlags::U8) &&
(inCurrentCompressionValue <= EventStreamCompressionFlags::U64),
"Invalid inCurrentCompressionValue in profile::findCompressionValue");
//Fallthrough is intentional
switch( inCurrentCompressionValue )
{
case EventStreamCompressionFlags::U8:
if ( inValue <= UINT8_MAX )
return EventStreamCompressionFlags::U8;
case EventStreamCompressionFlags::U16:
if ( inValue <= UINT16_MAX )
return EventStreamCompressionFlags::U16;
case EventStreamCompressionFlags::U32:
if ( inValue <= UINT32_MAX )
return EventStreamCompressionFlags::U32;
case EventStreamCompressionFlags::U64:
break;
}
return EventStreamCompressionFlags::U64;
}
//Find the smallest value that will represent the incoming value without loss.
//We can enlarge the current compression value, but we can't make is smaller.
//In this way, we can use this function to find the smallest compression setting
//that will work for a set of values.
inline EventStreamCompressionFlags::Enum findCompressionValue( uint32_t inValue, EventStreamCompressionFlags::Enum inCurrentCompressionValue = EventStreamCompressionFlags::U8 )
{
PX_ASSERT_WITH_MESSAGE( (inCurrentCompressionValue >= EventStreamCompressionFlags::U8) &&
(inCurrentCompressionValue <= EventStreamCompressionFlags::U64),
"Invalid inCurrentCompressionValue in profile::findCompressionValue");
//Fallthrough is intentional
switch( inCurrentCompressionValue )
{
case EventStreamCompressionFlags::U8:
if ( inValue <= UINT8_MAX )
return EventStreamCompressionFlags::U8;
case EventStreamCompressionFlags::U16:
if ( inValue <= UINT16_MAX )
return EventStreamCompressionFlags::U16;
case EventStreamCompressionFlags::U32:
case EventStreamCompressionFlags::U64:
break;
}
return EventStreamCompressionFlags::U32;
}
#if PX_APPLE_FAMILY
#pragma clang diagnostic pop
#endif
//Event header is 32 bytes and precedes all events.
struct EventHeader
{
uint8_t mEventType; //Used to parse the correct event out of the stream
uint8_t mStreamOptions; //Timestamp compression, etc.
uint16_t mEventId; //16 bit per-event-system event id
EventHeader( uint8_t type = 0, uint16_t id = 0 )
: mEventType( type )
, mStreamOptions( uint8_t(-1) )
, mEventId( id )
{
}
EventHeader( EventTypes::Enum type, uint16_t id )
: mEventType( static_cast<uint8_t>( type ) )
, mStreamOptions( uint8_t(-1) )
, mEventId( id )
{
}
EventStreamCompressionFlags::Enum getTimestampCompressionFlags() const
{
return static_cast<EventStreamCompressionFlags::Enum> ( mStreamOptions & EventStreamCompressionFlags::CompressionMask );
}
uint64_t compressTimestamp( uint64_t inLastTimestamp, uint64_t inCurrentTimestamp )
{
mStreamOptions = EventStreamCompressionFlags::U64;
uint64_t retval = inCurrentTimestamp;
if ( inLastTimestamp )
{
retval = inCurrentTimestamp - inLastTimestamp;
EventStreamCompressionFlags::Enum compressionValue = findCompressionValue( retval );
mStreamOptions = static_cast<uint8_t>( compressionValue );
if ( compressionValue == EventStreamCompressionFlags::U64 )
retval = inCurrentTimestamp; //just send the timestamp as is.
}
return retval;
}
uint64_t uncompressTimestamp( uint64_t inLastTimestamp, uint64_t inCurrentTimestamp ) const
{
if ( getTimestampCompressionFlags() != EventStreamCompressionFlags::U64 )
return inLastTimestamp + inCurrentTimestamp;
return inCurrentTimestamp;
}
void setContextIdCompressionFlags( uint64_t inContextId )
{
uint8_t options = static_cast<uint8_t>( findCompressionValue( inContextId ) );
mStreamOptions = uint8_t(mStreamOptions | options << 2);
}
EventStreamCompressionFlags::Enum getContextIdCompressionFlags() const
{
return static_cast< EventStreamCompressionFlags::Enum >( ( mStreamOptions >> 2 ) & EventStreamCompressionFlags::CompressionMask );
}
bool operator==( const EventHeader& inOther ) const
{
return mEventType == inOther.mEventType
&& mStreamOptions == inOther.mStreamOptions
&& mEventId == inOther.mEventId;
}
template<typename TStreamType>
inline uint32_t streamify( TStreamType& inStream )
{
uint32_t writtenSize = inStream.streamify( "EventType", mEventType );
writtenSize += inStream.streamify("StreamOptions", mStreamOptions); //Timestamp compression, etc.
writtenSize += inStream.streamify("EventId", mEventId); //16 bit per-event-system event id
return writtenSize;
}
};
//Declaration of type level getEventType function that maps enumeration event types to datatypes
template<typename TDataType>
inline EventTypes::Enum getEventType() { PX_ASSERT( false ); return EventTypes::Unknown; }
//Relative profile event means this event is sharing the context and thread id
//with the event before it.
struct RelativeProfileEvent
{
uint64_t mTensOfNanoSeconds; //timestamp is in tensOfNanonseconds
void init( uint64_t inTs ) { mTensOfNanoSeconds = inTs; }
void init( const RelativeProfileEvent& inData ) { mTensOfNanoSeconds = inData.mTensOfNanoSeconds; }
bool operator==( const RelativeProfileEvent& other ) const
{
return mTensOfNanoSeconds == other.mTensOfNanoSeconds;
}
template<typename TStreamType>
uint32_t streamify( TStreamType& inStream, const EventHeader& inHeader )
{
return inStream.streamify( "TensOfNanoSeconds", mTensOfNanoSeconds, inHeader.getTimestampCompressionFlags() );
}
uint64_t getTimestamp() const { return mTensOfNanoSeconds; }
void setTimestamp( uint64_t inTs ) { mTensOfNanoSeconds = inTs; }
void setupHeader( EventHeader& inHeader, uint64_t inLastTimestamp )
{
mTensOfNanoSeconds = inHeader.compressTimestamp( inLastTimestamp, mTensOfNanoSeconds );
}
uint32_t getEventSize(const EventHeader& inHeader)
{
uint32_t size = 0;
switch (inHeader.getTimestampCompressionFlags())
{
case EventStreamCompressionFlags::U8:
size = 1;
break;
case EventStreamCompressionFlags::U16:
size = 2;
break;
case EventStreamCompressionFlags::U32:
size = 4;
break;
case EventStreamCompressionFlags::U64:
size = 8;
break;
}
return size;
}
};
//Start version of the relative event.
struct RelativeStartEvent : public RelativeProfileEvent
{
void init( uint64_t inTs = 0 ) { RelativeProfileEvent::init( inTs ); }
void init( const RelativeStartEvent& inData ) { RelativeProfileEvent::init( inData ); }
template<typename THandlerType>
void handle( THandlerType* inHdlr, uint16_t eventId, uint32_t thread, uint64_t context, uint8_t inCpuId, uint8_t threadPriority ) const
{
inHdlr->onStartEvent( PxProfileEventId( eventId ), thread, context, inCpuId, threadPriority, mTensOfNanoSeconds );
}
};
template<> inline EventTypes::Enum getEventType<RelativeStartEvent>() { return EventTypes::RelativeStartEvent; }
//Stop version of relative event.
struct RelativeStopEvent : public RelativeProfileEvent
{
void init( uint64_t inTs = 0 ) { RelativeProfileEvent::init( inTs ); }
void init( const RelativeStopEvent& inData ) { RelativeProfileEvent::init( inData ); }
template<typename THandlerType>
void handle( THandlerType* inHdlr, uint16_t eventId, uint32_t thread, uint64_t context, uint8_t inCpuId, uint8_t threadPriority ) const
{
inHdlr->onStopEvent( PxProfileEventId( eventId ), thread, context, inCpuId, threadPriority, mTensOfNanoSeconds );
}
};
template<> inline EventTypes::Enum getEventType<RelativeStopEvent>() { return EventTypes::RelativeStopEvent; }
struct EventContextInformation
{
uint64_t mContextId;
uint32_t mThreadId; //Thread this event was taken from
uint8_t mThreadPriority;
uint8_t mCpuId;
void init( uint32_t inThreadId = UINT32_MAX
, uint64_t inContextId = (uint64_t(-1))
, uint8_t inPriority = UINT8_MAX
, uint8_t inCpuId = UINT8_MAX )
{
mContextId = inContextId;
mThreadId = inThreadId;
mThreadPriority = inPriority;
mCpuId = inCpuId;
}
void init( const EventContextInformation& inData )
{
mContextId = inData.mContextId;
mThreadId = inData.mThreadId;
mThreadPriority = inData.mThreadPriority;
mCpuId = inData.mCpuId;
}
template<typename TStreamType>
uint32_t streamify( TStreamType& inStream, EventStreamCompressionFlags::Enum inContextIdFlags )
{
uint32_t writtenSize = inStream.streamify( "ThreadId", mThreadId );
writtenSize += inStream.streamify("ContextId", mContextId, inContextIdFlags);
writtenSize += inStream.streamify("ThreadPriority", mThreadPriority);
writtenSize += inStream.streamify("CpuId", mCpuId);
return writtenSize;
}
bool operator==( const EventContextInformation& other ) const
{
return mThreadId == other.mThreadId
&& mContextId == other.mContextId
&& mThreadPriority == other.mThreadPriority
&& mCpuId == other.mCpuId;
}
void setToDefault()
{
*this = EventContextInformation();
}
};
//Profile event contains all the data required to tell the profile what is going
//on.
struct ProfileEvent
{
EventContextInformation mContextInformation;
RelativeProfileEvent mTimeData; //timestamp in seconds.
void init( uint32_t inThreadId, uint64_t inContextId, uint8_t inCpuId, uint8_t inPriority, uint64_t inTs )
{
mContextInformation.init( inThreadId, inContextId, inPriority, inCpuId );
mTimeData.init( inTs );
}
void init( const ProfileEvent& inData )
{
mContextInformation.init( inData.mContextInformation );
mTimeData.init( inData.mTimeData );
}
bool operator==( const ProfileEvent& other ) const
{
return mContextInformation == other.mContextInformation
&& mTimeData == other.mTimeData;
}
template<typename TStreamType>
uint32_t streamify( TStreamType& inStream, const EventHeader& inHeader )
{
uint32_t writtenSize = mContextInformation.streamify(inStream, inHeader.getContextIdCompressionFlags());
writtenSize += mTimeData.streamify(inStream, inHeader);
return writtenSize;
}
uint32_t getEventSize(const EventHeader& inHeader)
{
uint32_t eventSize = 0;
// time is stored depending on the conpress flag mTimeData.streamify(inStream, inHeader);
switch (inHeader.getTimestampCompressionFlags())
{
case EventStreamCompressionFlags::U8:
eventSize++;
break;
case EventStreamCompressionFlags::U16:
eventSize += 2;
break;
case EventStreamCompressionFlags::U32:
eventSize += 4;
break;
case EventStreamCompressionFlags::U64:
eventSize += 8;
break;
}
// context information
// mContextInformation.streamify( inStream, inHeader.getContextIdCompressionFlags() );
eventSize += 6; // uint32_t mThreadId; uint8_t mThreadPriority; uint8_t mCpuId;
switch (inHeader.getContextIdCompressionFlags())
{
case EventStreamCompressionFlags::U8:
eventSize++;
break;
case EventStreamCompressionFlags::U16:
eventSize += 2;
break;
case EventStreamCompressionFlags::U32:
eventSize += 4;
break;
case EventStreamCompressionFlags::U64:
eventSize += 8;
break;
}
return eventSize;
}
uint64_t getTimestamp() const { return mTimeData.getTimestamp(); }
void setTimestamp( uint64_t inTs ) { mTimeData.setTimestamp( inTs ); }
void setupHeader( EventHeader& inHeader, uint64_t inLastTimestamp )
{
mTimeData.setupHeader( inHeader, inLastTimestamp );
inHeader.setContextIdCompressionFlags( mContextInformation.mContextId );
}
};
//profile start event starts the profile session.
struct StartEvent : public ProfileEvent
{
void init( uint32_t inThreadId = 0, uint64_t inContextId = 0, uint8_t inCpuId = 0, uint8_t inPriority = 0, uint64_t inTensOfNanoSeconds = 0 )
{
ProfileEvent::init( inThreadId, inContextId, inCpuId, inPriority, inTensOfNanoSeconds );
}
void init( const StartEvent& inData )
{
ProfileEvent::init( inData );
}
RelativeStartEvent getRelativeEvent() const { RelativeStartEvent theEvent; theEvent.init( mTimeData.mTensOfNanoSeconds ); return theEvent; }
EventTypes::Enum getRelativeEventType() const { return getEventType<RelativeStartEvent>(); }
};
template<> inline EventTypes::Enum getEventType<StartEvent>() { return EventTypes::StartEvent; }
//Profile stop event stops the profile session.
struct StopEvent : public ProfileEvent
{
void init( uint32_t inThreadId = 0, uint64_t inContextId = 0, uint8_t inCpuId = 0, uint8_t inPriority = 0, uint64_t inTensOfNanoSeconds = 0 )
{
ProfileEvent::init( inThreadId, inContextId, inCpuId, inPriority, inTensOfNanoSeconds );
}
void init( const StopEvent& inData )
{
ProfileEvent::init( inData );
}
RelativeStopEvent getRelativeEvent() const { RelativeStopEvent theEvent; theEvent.init( mTimeData.mTensOfNanoSeconds ); return theEvent; }
EventTypes::Enum getRelativeEventType() const { return getEventType<RelativeStopEvent>(); }
};
template<> inline EventTypes::Enum getEventType<StopEvent>() { return EventTypes::StopEvent; }
struct EventValue
{
uint64_t mValue;
uint64_t mContextId;
uint32_t mThreadId;
void init( int64_t inValue = 0, uint64_t inContextId = 0, uint32_t inThreadId = 0 )
{
mValue = static_cast<uint64_t>( inValue );
mContextId = inContextId;
mThreadId = inThreadId;
}
void init( const EventValue& inData )
{
mValue = inData.mValue;
mContextId = inData.mContextId;
mThreadId = inData.mThreadId;
}
int64_t getValue() const { return static_cast<int16_t>( mValue ); }
void setupHeader( EventHeader& inHeader )
{
mValue = inHeader.compressTimestamp( 0, mValue );
inHeader.setContextIdCompressionFlags( mContextId );
}
template<typename TStreamType>
uint32_t streamify( TStreamType& inStream, const EventHeader& inHeader )
{
uint32_t writtenSize = inStream.streamify("Value", mValue, inHeader.getTimestampCompressionFlags());
writtenSize += inStream.streamify("ContextId", mContextId, inHeader.getContextIdCompressionFlags());
writtenSize += inStream.streamify("ThreadId", mThreadId);
return writtenSize;
}
uint32_t getEventSize(const EventHeader& inHeader)
{
uint32_t eventSize = 0;
// value
switch (inHeader.getTimestampCompressionFlags())
{
case EventStreamCompressionFlags::U8:
eventSize++;
break;
case EventStreamCompressionFlags::U16:
eventSize += 2;
break;
case EventStreamCompressionFlags::U32:
eventSize += 4;
break;
case EventStreamCompressionFlags::U64:
eventSize += 8;
break;
}
// context information
switch (inHeader.getContextIdCompressionFlags())
{
case EventStreamCompressionFlags::U8:
eventSize++;
break;
case EventStreamCompressionFlags::U16:
eventSize += 2;
break;
case EventStreamCompressionFlags::U32:
eventSize += 4;
break;
case EventStreamCompressionFlags::U64:
eventSize += 8;
break;
}
eventSize += 4; // uint32_t mThreadId;
return eventSize;
}
bool operator==( const EventValue& other ) const
{
return mValue == other.mValue
&& mContextId == other.mContextId
&& mThreadId == other.mThreadId;
}
template<typename THandlerType>
void handle( THandlerType* inHdlr, uint16_t eventId ) const
{
inHdlr->onEventValue( PxProfileEventId( eventId ), mThreadId, mContextId, getValue() );
}
};
template<> inline EventTypes::Enum getEventType<EventValue>() { return EventTypes::EventValue; }
//obsolete, placeholder to skip data from PhysX SDKs < 3.4
struct CUDAProfileBuffer
{
uint64_t mTimestamp;
float mTimespan;
const uint8_t* mCudaData;
uint32_t mBufLen;
uint32_t mVersion;
template<typename TStreamType>
uint32_t streamify( TStreamType& inStream, const EventHeader& )
{
uint32_t writtenSize = inStream.streamify("Timestamp", mTimestamp);
writtenSize += inStream.streamify("Timespan", mTimespan);
writtenSize += inStream.streamify("CudaData", mCudaData, mBufLen);
writtenSize += inStream.streamify("BufLen", mBufLen);
writtenSize += inStream.streamify("Version", mVersion);
return writtenSize;
}
bool operator==( const CUDAProfileBuffer& other ) const
{
return mTimestamp == other.mTimestamp
&& mTimespan == other.mTimespan
&& mBufLen == other.mBufLen
&& memcmp( mCudaData, other.mCudaData, mBufLen ) == 0
&& mVersion == other.mVersion;
}
};
template<> inline EventTypes::Enum getEventType<CUDAProfileBuffer>() { return EventTypes::CUDAProfileBuffer; }
//Provides a generic equal operation for event data objects.
template <typename TEventData>
struct EventDataEqualOperator
{
TEventData mData;
EventDataEqualOperator( const TEventData& inD ) : mData( inD ) {}
template<typename TDataType> bool operator()( const TDataType& inRhs ) const { return mData.toType( Type2Type<TDataType>() ) == inRhs; }
bool operator()() const { return false; }
};
/**
* Generic event container that combines and even header with the generic event data type.
* Provides unsafe and typesafe access to the event data.
*/
class Event
{
public:
typedef PX_PROFILE_UNION_7(StartEvent, StopEvent, RelativeStartEvent, RelativeStopEvent, EventValue, CUDAProfileBuffer, uint8_t) EventData;
private:
EventHeader mHeader;
EventData mData;
public:
Event() {}
template <typename TDataType>
Event( EventHeader inHeader, const TDataType& inData )
: mHeader( inHeader )
{
mData.init<TDataType>(inData);
}
template<typename TDataType>
Event( uint16_t eventId, const TDataType& inData )
: mHeader( getEventType<TDataType>(), eventId )
{
mData.init<TDataType>(inData);
}
const EventHeader& getHeader() const { return mHeader; }
const EventData& getData() const { return mData; }
template<typename TDataType>
const TDataType& getValue() const { PX_ASSERT( mHeader.mEventType == getEventType<TDataType>() ); return mData.toType<TDataType>(); }
template<typename TDataType>
TDataType& getValue() { PX_ASSERT( mHeader.mEventType == getEventType<TDataType>() ); return mData.toType<TDataType>(); }
template<typename TRetVal, typename TOperator>
inline TRetVal visit( TOperator inOp ) const;
bool operator==( const Event& inOther ) const
{
if ( !(mHeader == inOther.mHeader ) ) return false;
if ( mHeader.mEventType )
return inOther.visit<bool>( EventDataEqualOperator<EventData>( mData ) );
return true;
}
};
//Combining the above union type with an event type means that an object can get the exact
//data out of the union. Using this function means that all callsites will be forced to
//deal with the newer datatypes and that the switch statement only exists in once place.
//Implements conversion from enum -> datatype
template<typename TRetVal, typename TOperator>
TRetVal visit( EventTypes::Enum inEventType, const Event::EventData& inData, TOperator inOperator )
{
switch( inEventType )
{
case EventTypes::StartEvent: return inOperator( inData.toType( Type2Type<StartEvent>() ) );
case EventTypes::StopEvent: return inOperator( inData.toType( Type2Type<StopEvent>() ) );
case EventTypes::RelativeStartEvent: return inOperator( inData.toType( Type2Type<RelativeStartEvent>() ) );
case EventTypes::RelativeStopEvent: return inOperator( inData.toType( Type2Type<RelativeStopEvent>() ) );
case EventTypes::EventValue: return inOperator( inData.toType( Type2Type<EventValue>() ) );
//obsolete, placeholder to skip data from PhysX SDKs < 3.4
case EventTypes::CUDAProfileBuffer: return inOperator( inData.toType( Type2Type<CUDAProfileBuffer>() ) );
case EventTypes::Unknown: break;
}
uint8_t type = static_cast<uint8_t>( inEventType );
return inOperator( type );
}
template<typename TRetVal, typename TOperator>
inline TRetVal Event::visit( TOperator inOp ) const
{
return physx::profile::visit<TRetVal>( static_cast<EventTypes::Enum>(mHeader.mEventType), mData, inOp );
}
} }
#endif
| 24,440 | C | 33.61898 | 177 | 0.729378 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxPvdObjectModelInternalTypes.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PX_PVD_OBJECT_MODEL_INTERNAL_TYPES_H
#define PX_PVD_OBJECT_MODEL_INTERNAL_TYPES_H
#include "foundation/PxMemory.h"
#include "PxPvdObjectModelBaseTypes.h"
#include "foundation/PxArray.h"
#include "PxPvdFoundation.h"
namespace physx
{
namespace pvdsdk
{
struct PvdInternalType
{
enum Enum
{
None = 0,
#define DECLARE_INTERNAL_PVD_TYPE(type) type,
#include "PxPvdObjectModelInternalTypeDefs.h"
Last
#undef DECLARE_INTERNAL_PVD_TYPE
};
};
PX_COMPILE_TIME_ASSERT(uint32_t(PvdInternalType::Last) <= uint32_t(PvdBaseType::InternalStop));
template <typename T>
struct DataTypeToPvdTypeMap
{
bool compile_error;
};
template <PvdInternalType::Enum>
struct PvdTypeToDataTypeMap
{
bool compile_error;
};
#define DECLARE_INTERNAL_PVD_TYPE(type) \
template <> \
struct DataTypeToPvdTypeMap<type> \
{ \
enum Enum \
{ \
BaseTypeEnum = PvdInternalType::type \
}; \
}; \
template <> \
struct PvdTypeToDataTypeMap<PvdInternalType::type> \
{ \
typedef type TDataType; \
}; \
template <> \
struct PvdDataTypeToNamespacedNameMap<type> \
{ \
NamespacedName Name; \
PvdDataTypeToNamespacedNameMap<type>() : Name("physx3_debugger_internal", #type) \
{ \
} \
};
#include "PxPvdObjectModelInternalTypeDefs.h"
#undef DECLARE_INTERNAL_PVD_TYPE
template <typename TDataType, typename TAlloc>
DataRef<TDataType> toDataRef(const PxArray<TDataType, TAlloc>& data)
{
return DataRef<TDataType>(data.begin(), data.end());
}
static inline bool safeStrEq(const DataRef<String>& lhs, const DataRef<String>& rhs)
{
uint32_t count = lhs.size();
if(count != rhs.size())
return false;
for(uint32_t idx = 0; idx < count; ++idx)
if(!safeStrEq(lhs[idx], rhs[idx]))
return false;
return true;
}
static inline char* copyStr(const char* str)
{
str = nonNull(str);
uint32_t len = static_cast<uint32_t>(strlen(str));
char* newData = reinterpret_cast<char*>(PX_ALLOC(len + 1, "string"));
PxMemCopy(newData, str, len);
newData[len] = 0;
return newData;
}
// Used for predictable bit fields.
template <typename TDataType, uint8_t TNumBits, uint8_t TOffset, typename TInputType>
struct BitMaskSetter
{
// Create a mask that masks out the orginal value shift into place
static TDataType createOffsetMask()
{
return createMask() << TOffset;
}
// Create a mask of TNumBits number of tis
static TDataType createMask()
{
return static_cast<TDataType>((1 << TNumBits) - 1);
}
void setValue(TDataType& inCurrent, TInputType inData)
{
PX_ASSERT(inData < (1 << TNumBits));
// Create a mask to remove the current value.
TDataType theMask = ~(createOffsetMask());
// Clear out current value.
inCurrent = inCurrent & theMask;
// Create the new value.
TDataType theAddition = reinterpret_cast<TDataType>(inData << TOffset);
// or it into the existing value.
inCurrent = inCurrent | theAddition;
}
TInputType getValue(TDataType inCurrent)
{
return static_cast<TInputType>((inCurrent >> TOffset) & createMask());
}
};
}
}
#endif
| 6,519 | C | 41.337662 | 120 | 0.511888 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxPvdMemClient.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "PxPvdImpl.h"
#include "PxPvdMemClient.h"
namespace physx
{
namespace pvdsdk
{
PvdMemClient::PvdMemClient(PvdImpl& pvd)
: mSDKPvd(pvd)
, mPvdDataStream(NULL)
, mIsConnected(false)
, mMemEventBuffer(profile::PxProfileMemoryEventBuffer::createMemoryEventBuffer(*gPvdAllocatorCallback))
{
}
PvdMemClient::~PvdMemClient()
{
mSDKPvd.removeClient(this);
if(mMemEventBuffer.hasClients())
mPvdDataStream->destroyInstance(&mMemEventBuffer);
mMemEventBuffer.release();
}
PvdDataStream* PvdMemClient::getDataStream()
{
return mPvdDataStream;
}
bool PvdMemClient::isConnected() const
{
return mIsConnected;
}
void PvdMemClient::onPvdConnected()
{
if(mIsConnected)
return;
mIsConnected = true;
mPvdDataStream = PvdDataStream::create(&mSDKPvd);
mPvdDataStream->createInstance(&mMemEventBuffer);
mMemEventBuffer.addClient(*this);
}
void PvdMemClient::onPvdDisconnected()
{
if(!mIsConnected)
return;
mIsConnected = false;
flush();
mMemEventBuffer.removeClient(*this);
mPvdDataStream->release();
mPvdDataStream = NULL;
}
void PvdMemClient::onAllocation(size_t inSize, const char* inType, const char* inFile, int inLine, void* inAddr)
{
mMutex.lock();
mMemEventBuffer.onAllocation(inSize, inType, inFile, inLine, inAddr);
mMutex.unlock();
}
void PvdMemClient::onDeallocation(void* inAddr)
{
mMutex.lock();
mMemEventBuffer.onDeallocation(inAddr);
mMutex.unlock();
}
void PvdMemClient::flush()
{
mMutex.lock();
mMemEventBuffer.flushProfileEvents();
mMutex.unlock();
}
void PvdMemClient::handleBufferFlush(const uint8_t* inData, uint32_t inLength)
{
if(mPvdDataStream)
mPvdDataStream->setPropertyValue(&mMemEventBuffer, "events", inData, inLength);
}
void PvdMemClient::handleClientRemoved()
{
}
} // pvd
} // physx
| 3,453 | C++ | 27.783333 | 112 | 0.764263 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxPvdMarshalling.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PX_PVD_MARSHALLING_H
#define PX_PVD_MARSHALLING_H
#include "foundation/PxMathIntrinsics.h"
#include "PxPvdObjectModelBaseTypes.h"
#include "PxPvdBits.h"
namespace physx
{
namespace pvdsdk
{
// Define marshalling
template <typename TSmallerType, typename TLargerType>
struct PvdMarshalling
{
bool canMarshal;
PvdMarshalling() : canMarshal(false)
{
}
};
template <typename smtype, typename lgtype>
static inline void marshalSingleT(const uint8_t* srcData, uint8_t* destData)
{
smtype incoming;
physx::intrinsics::memCopy(&incoming, srcData, sizeof(smtype));
lgtype outgoing = static_cast<lgtype>(incoming);
physx::intrinsics::memCopy(destData, &outgoing, sizeof(lgtype));
}
template <typename smtype, typename lgtype>
static inline void marshalBlockT(const uint8_t* srcData, uint8_t* destData, uint32_t numBytes)
{
for(const uint8_t* item = srcData, *end = srcData + numBytes; item < end;
item += sizeof(smtype), destData += sizeof(lgtype))
marshalSingleT<smtype, lgtype>(item, destData);
}
#define PVD_TYPE_MARSHALLER(smtype, lgtype) \
template <> \
struct PvdMarshalling<smtype, lgtype> \
{ \
uint32_t canMarshal; \
static void marshalSingle(const uint8_t* srcData, uint8_t* destData) \
{ \
marshalSingleT<smtype, lgtype>(srcData, destData); \
} \
static void marshalBlock(const uint8_t* srcData, uint8_t* destData, uint32_t numBytes) \
{ \
marshalBlockT<smtype, lgtype>(srcData, destData, numBytes); \
} \
};
// define marshalling tables.
PVD_TYPE_MARSHALLER(int8_t, int16_t)
PVD_TYPE_MARSHALLER(int8_t, uint16_t)
PVD_TYPE_MARSHALLER(int8_t, int32_t)
PVD_TYPE_MARSHALLER(int8_t, uint32_t)
PVD_TYPE_MARSHALLER(int8_t, int64_t)
PVD_TYPE_MARSHALLER(int8_t, uint64_t)
PVD_TYPE_MARSHALLER(int8_t, PvdF32)
PVD_TYPE_MARSHALLER(int8_t, PvdF64)
PVD_TYPE_MARSHALLER(uint8_t, int16_t)
PVD_TYPE_MARSHALLER(uint8_t, uint16_t)
PVD_TYPE_MARSHALLER(uint8_t, int32_t)
PVD_TYPE_MARSHALLER(uint8_t, uint32_t)
PVD_TYPE_MARSHALLER(uint8_t, int64_t)
PVD_TYPE_MARSHALLER(uint8_t, uint64_t)
PVD_TYPE_MARSHALLER(uint8_t, PvdF32)
PVD_TYPE_MARSHALLER(uint8_t, PvdF64)
PVD_TYPE_MARSHALLER(int16_t, int32_t)
PVD_TYPE_MARSHALLER(int16_t, uint32_t)
PVD_TYPE_MARSHALLER(int16_t, int64_t)
PVD_TYPE_MARSHALLER(int16_t, uint64_t)
PVD_TYPE_MARSHALLER(int16_t, PvdF32)
PVD_TYPE_MARSHALLER(int16_t, PvdF64)
PVD_TYPE_MARSHALLER(uint16_t, int32_t)
PVD_TYPE_MARSHALLER(uint16_t, uint32_t)
PVD_TYPE_MARSHALLER(uint16_t, int64_t)
PVD_TYPE_MARSHALLER(uint16_t, uint64_t)
PVD_TYPE_MARSHALLER(uint16_t, PvdF32)
PVD_TYPE_MARSHALLER(uint16_t, PvdF64)
PVD_TYPE_MARSHALLER(int32_t, int64_t)
PVD_TYPE_MARSHALLER(int32_t, uint64_t)
PVD_TYPE_MARSHALLER(int32_t, PvdF64)
PVD_TYPE_MARSHALLER(int32_t, PvdF32)
PVD_TYPE_MARSHALLER(uint32_t, int64_t)
PVD_TYPE_MARSHALLER(uint32_t, uint64_t)
PVD_TYPE_MARSHALLER(uint32_t, PvdF64)
PVD_TYPE_MARSHALLER(uint32_t, PvdF32)
PVD_TYPE_MARSHALLER(PvdF32, PvdF64)
PVD_TYPE_MARSHALLER(PvdF32, uint32_t)
PVD_TYPE_MARSHALLER(PvdF32, int32_t)
PVD_TYPE_MARSHALLER(uint64_t, PvdF64)
PVD_TYPE_MARSHALLER(int64_t, PvdF64)
PVD_TYPE_MARSHALLER(PvdF64, uint64_t)
PVD_TYPE_MARSHALLER(PvdF64, int64_t)
template <typename TMarshaller>
static inline bool getMarshalOperators(TSingleMarshaller&, TBlockMarshaller&, TMarshaller&, bool)
{
return false;
}
template <typename TMarshaller>
static inline bool getMarshalOperators(TSingleMarshaller& single, TBlockMarshaller& block, TMarshaller&, uint32_t)
{
single = TMarshaller::marshalSingle;
block = TMarshaller::marshalBlock;
return true;
}
template <typename smtype, typename lgtype>
static inline bool getMarshalOperators(TSingleMarshaller& single, TBlockMarshaller& block)
{
single = NULL;
block = NULL;
PvdMarshalling<smtype, lgtype> marshaller = PvdMarshalling<smtype, lgtype>();
return getMarshalOperators(single, block, marshaller, marshaller.canMarshal);
}
template <typename smtype>
static inline bool getMarshalOperators(TSingleMarshaller& single, TBlockMarshaller& block, int32_t lgtypeId)
{
switch(lgtypeId)
{
case PvdBaseType::PvdI8: // int8_t:
return getMarshalOperators<smtype, int8_t>(single, block);
case PvdBaseType::PvdU8: // uint8_t:
return getMarshalOperators<smtype, uint8_t>(single, block);
case PvdBaseType::PvdI16: // int16_t:
return getMarshalOperators<smtype, int16_t>(single, block);
case PvdBaseType::PvdU16: // uint16_t:
return getMarshalOperators<smtype, uint16_t>(single, block);
case PvdBaseType::PvdI32: // int32_t:
return getMarshalOperators<smtype, int32_t>(single, block);
case PvdBaseType::PvdU32: // uint32_t:
return getMarshalOperators<smtype, uint32_t>(single, block);
case PvdBaseType::PvdI64: // int64_t:
return getMarshalOperators<smtype, int64_t>(single, block);
case PvdBaseType::PvdU64: // uint64_t:
return getMarshalOperators<smtype, uint64_t>(single, block);
case PvdBaseType::PvdF32:
return getMarshalOperators<smtype, PvdF32>(single, block);
case PvdBaseType::PvdF64:
return getMarshalOperators<smtype, PvdF64>(single, block);
}
return false;
}
static inline bool getMarshalOperators(TSingleMarshaller& single, TBlockMarshaller& block, int32_t smtypeId,
int32_t lgtypeId)
{
switch(smtypeId)
{
case PvdBaseType::PvdI8: // int8_t:
return getMarshalOperators<int8_t>(single, block, lgtypeId);
case PvdBaseType::PvdU8: // uint8_t:
return getMarshalOperators<uint8_t>(single, block, lgtypeId);
case PvdBaseType::PvdI16: // int16_t:
return getMarshalOperators<int16_t>(single, block, lgtypeId);
case PvdBaseType::PvdU16: // uint16_t:
return getMarshalOperators<uint16_t>(single, block, lgtypeId);
case PvdBaseType::PvdI32: // int32_t:
return getMarshalOperators<int32_t>(single, block, lgtypeId);
case PvdBaseType::PvdU32: // uint32_t:
return getMarshalOperators<uint32_t>(single, block, lgtypeId);
case PvdBaseType::PvdI64: // int64_t:
return getMarshalOperators<int64_t>(single, block, lgtypeId);
case PvdBaseType::PvdU64: // uint64_t:
return getMarshalOperators<uint64_t>(single, block, lgtypeId);
case PvdBaseType::PvdF32:
return getMarshalOperators<PvdF32>(single, block, lgtypeId);
case PvdBaseType::PvdF64:
return getMarshalOperators<PvdF64>(single, block, lgtypeId);
}
return false;
}
}
}
#endif
| 8,876 | C | 39.167421 | 120 | 0.666629 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxProfileEventSerialization.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PROFILE_EVENT_SERIALIZATION_H
#define PX_PROFILE_EVENT_SERIALIZATION_H
#include "PxProfileDataParsing.h"
#include "PxProfileEvents.h"
namespace physx { namespace profile {
/**
* Array type must be a pxu8 container. Templated so that this object can write
* to different collections.
*/
template<typename TArrayType>
struct EventSerializer
{
TArrayType* mArray;
EventSerializer( TArrayType* inA ) : mArray( inA ) {}
template<typename TDataType>
uint32_t streamify( const char*, const TDataType& inType )
{
return mArray->write( inType );
}
uint32_t streamify( const char*, const char*& inType )
{
PX_ASSERT( inType != NULL );
uint32_t len( static_cast<uint32_t>( strlen( inType ) ) );
++len; //include the null terminator
uint32_t writtenSize = 0;
writtenSize = mArray->write(len);
writtenSize += mArray->write(inType, len);
return writtenSize;
}
uint32_t streamify( const char*, const uint8_t* inData, uint32_t len )
{
uint32_t writtenSize = mArray->write(len);
if ( len )
writtenSize += mArray->write(inData, len);
return writtenSize;
}
uint32_t streamify( const char* nm, const uint64_t& inType, EventStreamCompressionFlags::Enum inFlags )
{
uint32_t writtenSize = 0;
switch( inFlags )
{
case EventStreamCompressionFlags::U8:
writtenSize = streamify(nm, static_cast<uint8_t>(inType));
break;
case EventStreamCompressionFlags::U16:
writtenSize = streamify(nm, static_cast<uint16_t>(inType));
break;
case EventStreamCompressionFlags::U32:
writtenSize = streamify(nm, static_cast<uint32_t>(inType));
break;
case EventStreamCompressionFlags::U64:
writtenSize = streamify(nm, inType);
break;
}
return writtenSize;
}
uint32_t streamify( const char* nm, const uint32_t& inType, EventStreamCompressionFlags::Enum inFlags )
{
uint32_t writtenSize = 0;
switch( inFlags )
{
case EventStreamCompressionFlags::U8:
writtenSize = streamify(nm, static_cast<uint8_t>(inType));
break;
case EventStreamCompressionFlags::U16:
writtenSize = streamify(nm, static_cast<uint16_t>(inType));
break;
case EventStreamCompressionFlags::U32:
case EventStreamCompressionFlags::U64:
writtenSize = streamify(nm, inType);
break;
}
return writtenSize;
}
};
/**
* The event deserializes takes a buffer implements the streamify functions
* by setting the passed in data to the data in the buffer.
*/
template<bool TSwapBytes>
struct EventDeserializer
{
const uint8_t* mData;
uint32_t mLength;
bool mFail;
EventDeserializer( const uint8_t* inData, uint32_t inLength )
: mData( inData )
, mLength( inLength )
, mFail( false )
{
if ( mData == NULL )
mLength = 0;
}
bool val() { return TSwapBytes; }
uint32_t streamify( const char* , uint8_t& inType )
{
uint8_t* theData = reinterpret_cast<uint8_t*>( &inType ); //type punned pointer...
if ( mFail || sizeof( inType ) > mLength )
{
PX_ASSERT( false );
mFail = true;
}
else
{
for( uint32_t idx = 0; idx < sizeof( uint8_t ); ++idx, ++mData, --mLength )
theData[idx] = *mData;
}
return 0;
}
//default streamify reads things natively as bytes.
template<typename TDataType>
uint32_t streamify( const char* , TDataType& inType )
{
uint8_t* theData = reinterpret_cast<uint8_t*>( &inType ); //type punned pointer...
if ( mFail || sizeof( inType ) > mLength )
{
PX_ASSERT( false );
mFail = true;
}
else
{
for( uint32_t idx = 0; idx < sizeof( TDataType ); ++idx, ++mData, --mLength )
theData[idx] = *mData;
bool temp = val();
if ( temp )
BlockParseFunctions::swapBytes<sizeof(TDataType)>( theData );
}
return 0;
}
uint32_t streamify( const char*, const char*& inType )
{
uint32_t theLen;
streamify( "", theLen );
theLen = PxMin( theLen, mLength );
inType = reinterpret_cast<const char*>( mData );
mData += theLen;
mLength -= theLen;
return 0;
}
uint32_t streamify( const char*, const uint8_t*& inData, uint32_t& len )
{
uint32_t theLen;
streamify( "", theLen );
theLen = PxMin( theLen, mLength );
len = theLen;
inData = reinterpret_cast<const uint8_t*>( mData );
mData += theLen;
mLength -= theLen;
return 0;
}
uint32_t streamify( const char* nm, uint64_t& inType, EventStreamCompressionFlags::Enum inFlags )
{
switch( inFlags )
{
case EventStreamCompressionFlags::U8:
{
uint8_t val=0;
streamify( nm, val );
inType = val;
}
break;
case EventStreamCompressionFlags::U16:
{
uint16_t val;
streamify( nm, val );
inType = val;
}
break;
case EventStreamCompressionFlags::U32:
{
uint32_t val;
streamify( nm, val );
inType = val;
}
break;
case EventStreamCompressionFlags::U64:
streamify( nm, inType );
break;
}
return 0;
}
uint32_t streamify( const char* nm, uint32_t& inType, EventStreamCompressionFlags::Enum inFlags )
{
switch( inFlags )
{
case EventStreamCompressionFlags::U8:
{
uint8_t val=0;
streamify( nm, val );
inType = val;
}
break;
case EventStreamCompressionFlags::U16:
{
uint16_t val=0;
streamify( nm, val );
inType = val;
}
break;
case EventStreamCompressionFlags::U32:
case EventStreamCompressionFlags::U64:
streamify( nm, inType );
break;
}
return 0;
}
};
}}
#endif
| 7,248 | C | 27.206226 | 105 | 0.66984 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxPvdImpl.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "PxPvdImpl.h"
#include "PxPvdMemClient.h"
#include "PxPvdProfileZoneClient.h"
#include "PxPvdProfileZone.h"
#if PX_SUPPORT_GPU_PHYSX
#include "gpu/PxGpu.h"
#endif
#if PX_NVTX
#include "nvToolsExt.h"
#endif
namespace
{
const char* gSdkName = "PhysXSDK";
}
namespace physx
{
namespace pvdsdk
{
class CmEventNameProvider : public physx::profile::PxProfileNameProvider
{
public:
physx::profile::PxProfileNames getProfileNames() const
{
physx::profile::PxProfileNames ret;
ret.eventCount = 0;
return ret;
}
};
CmEventNameProvider gProfileNameProvider;
void initializeModelTypes(PvdDataStream& stream)
{
stream.createClass<profile::PxProfileZone>();
stream.createProperty<profile::PxProfileZone, uint8_t>(
"events", PvdCommStreamEmbeddedTypes::getProfileEventStreamSemantic(), PropertyType::Array);
stream.createClass<profile::PxProfileMemoryEventBuffer>();
stream.createProperty<profile::PxProfileMemoryEventBuffer, uint8_t>(
"events", PvdCommStreamEmbeddedTypes::getMemoryEventStreamSemantic(), PropertyType::Array);
stream.createClass<PvdUserRenderer>();
stream.createProperty<PvdUserRenderer, uint8_t>(
"events", PvdCommStreamEmbeddedTypes::getRendererEventStreamSemantic(), PropertyType::Array);
}
PvdImpl* PvdImpl::sInstance = NULL;
uint32_t PvdImpl::sRefCount = 0;
PvdImpl::PvdImpl()
: mPvdTransport(NULL)
, mSharedMetaProvider(NULL)
, mMemClient(NULL)
, mIsConnected(false)
, mGPUProfilingWasConnected(false)
, mIsNVTXSupportEnabled(true)
, mNVTXContext(0)
, mNextStreamId(1)
, mProfileClient(NULL)
, mProfileZone(NULL)
{
mProfileZoneManager = &physx::profile::PxProfileZoneManager::createProfileZoneManager(PxGetBroadcastAllocator());
mProfileClient = PVD_NEW(PvdProfileZoneClient)(*this);
}
PvdImpl::~PvdImpl()
{
if((mFlags & PxPvdInstrumentationFlag::ePROFILE) )
{
PxSetProfilerCallback(NULL);
#if PX_SUPPORT_GPU_PHYSX
if (mGPUProfilingWasConnected)
{
PxSetPhysXGpuProfilerCallback(NULL);
}
#endif
}
disconnect();
if ( mProfileZoneManager )
{
mProfileZoneManager->release();
mProfileZoneManager = NULL;
}
PVD_DELETE(mProfileClient);
mProfileClient = NULL;
}
bool PvdImpl::connect(PxPvdTransport& transport, PxPvdInstrumentationFlags flags)
{
if(mIsConnected)
{
PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "PxPvd::connect - recall connect! Should call disconnect before re-connect.");
return false;
}
mFlags = flags;
mPvdTransport = &transport;
mIsConnected = mPvdTransport->connect();
if(mIsConnected)
{
mSharedMetaProvider = PVD_NEW(MetaDataProvider);
sendTransportInitialization();
PvdDataStream* stream = PvdDataStream::create(this);
initializeModelTypes(*stream);
stream->release();
if(mFlags & PxPvdInstrumentationFlag::eMEMORY)
{
mMemClient = PVD_NEW(PvdMemClient)(*this);
mPvdClients.pushBack(mMemClient);
}
if((mFlags & PxPvdInstrumentationFlag::ePROFILE) && mProfileZoneManager)
{
mPvdClients.pushBack(mProfileClient);
mProfileZone = &physx::profile::PxProfileZone::createProfileZone(PxGetBroadcastAllocator(),gSdkName,gProfileNameProvider.getProfileNames());
}
for(uint32_t i = 0; i < mPvdClients.size(); i++)
mPvdClients[i]->onPvdConnected();
if (mProfileZone)
{
mProfileZoneManager->addProfileZoneHandler(*mProfileClient);
mProfileZoneManager->addProfileZone( *mProfileZone );
}
if ((mFlags & PxPvdInstrumentationFlag::ePROFILE))
{
PxSetProfilerCallback(this);
#if PX_SUPPORT_GPU_PHYSX
PxSetPhysXGpuProfilerCallback(this);
mGPUProfilingWasConnected = true;
#endif
}
}
return mIsConnected;
}
void PvdImpl::disconnect()
{
if(mProfileZone)
{
mProfileZoneManager->removeProfileZoneHandler(*mProfileClient);
mProfileZoneManager->removeProfileZone( *mProfileZone );
mProfileZone->release();
mProfileZone=NULL;
removeClient(mProfileClient);
}
if(mIsConnected)
{
for(uint32_t i = 0; i < mPvdClients.size(); i++)
mPvdClients[i]->onPvdDisconnected();
if(mMemClient)
{
removeClient(mMemClient);
PvdMemClient* tmp = mMemClient; //avoid tracking deallocation itsself
mMemClient = NULL;
PVD_DELETE(tmp);
}
mSharedMetaProvider->release();
mPvdTransport->disconnect();
mObjectRegistrar.clear();
mIsConnected = false;
}
}
void PvdImpl::flush()
{
for(uint32_t i = 0; i < mPvdClients.size(); i++)
mPvdClients[i]->flush();
if ( mProfileZone )
{
mProfileZone->flushEventIdNameMap();
mProfileZone->flushProfileEvents();
}
}
bool PvdImpl::isConnected(bool useCachedStatus)
{
if(mPvdTransport)
return useCachedStatus ? mIsConnected : mPvdTransport->isConnected();
else
return false;
}
PxPvdTransport* PvdImpl::getTransport()
{
return mPvdTransport;
}
PxPvdInstrumentationFlags PvdImpl::getInstrumentationFlags()
{
return mFlags;
}
void PvdImpl::sendTransportInitialization()
{
StreamInitialization init;
EventStreamifier<PxPvdTransport> stream(mPvdTransport->lock());
init.serialize(stream);
mPvdTransport->unlock();
}
void PvdImpl::addClient(PvdClient* client)
{
PX_ASSERT(client);
for(uint32_t i = 0; i < mPvdClients.size(); i++)
{
if(client == mPvdClients[i])
return;
}
mPvdClients.pushBack(client);
if(mIsConnected)
{
client->onPvdConnected();
}
}
void PvdImpl::removeClient(PvdClient* client)
{
for(uint32_t i = 0; i < mPvdClients.size(); i++)
{
if(client == mPvdClients[i])
{
client->onPvdDisconnected();
mPvdClients.remove(i);
}
}
}
void PvdImpl::onAllocation(size_t inSize, const char* inType, const char* inFile, int inLine, void* inAddr)
{
if(mMemClient)
mMemClient->onAllocation(inSize, inType, inFile, inLine, inAddr);
}
void PvdImpl::onDeallocation(void* inAddr)
{
if(mMemClient)
mMemClient->onDeallocation(inAddr);
}
PvdOMMetaDataProvider& PvdImpl::getMetaDataProvider()
{
return *mSharedMetaProvider;
}
bool PvdImpl::registerObject(const void* inItem)
{
return mObjectRegistrar.addItem(inItem);
}
bool PvdImpl::unRegisterObject(const void* inItem)
{
return mObjectRegistrar.decItem(inItem);
}
uint64_t PvdImpl::getNextStreamId()
{
uint64_t retval = ++mNextStreamId;
return retval;
}
bool PvdImpl::initialize()
{
if(0 == sRefCount)
{
sInstance = PVD_NEW(PvdImpl)();
}
++sRefCount;
return !!sInstance;
}
void PvdImpl::release()
{
if(sRefCount > 0)
{
if(--sRefCount)
return;
PVD_DELETE(sInstance);
sInstance = NULL;
}
}
PvdImpl* PvdImpl::getInstance()
{
return sInstance;
}
/**************************************************************************************************************************
Instrumented profiling events
***************************************************************************************************************************/
static const uint32_t CrossThreadId = 99999789;
void* PvdImpl::zoneStart(const char* eventName, bool detached, uint64_t contextId)
{
if(mProfileZone)
{
const uint16_t id = mProfileZone->getEventIdForName(eventName);
if(detached)
mProfileZone->startEvent(id, contextId, CrossThreadId);
else
mProfileZone->startEvent(id, contextId);
}
#if PX_NVTX
if(mIsNVTXSupportEnabled)
{
if(detached)
{
// TODO : Need to use the nvtxRangeStart API for cross thread events
nvtxEventAttributes_t eventAttrib;
memset(&eventAttrib, 0, sizeof(eventAttrib));
eventAttrib.version = NVTX_VERSION;
eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
eventAttrib.colorType = NVTX_COLOR_ARGB;
eventAttrib.color = 0xFF00FF00;
eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII;
eventAttrib.message.ascii = eventName;
nvtxMarkEx(&eventAttrib);
}
else
{
nvtxRangePush(eventName);
}
}
#endif
return NULL;
}
void PvdImpl::zoneEnd(void* /*profilerData*/, const char* eventName, bool detached, uint64_t contextId)
{
if(mProfileZone)
{
const uint16_t id = mProfileZone->getEventIdForName(eventName);
if(detached)
mProfileZone->stopEvent(id, contextId, CrossThreadId);
else
mProfileZone->stopEvent(id, contextId);
}
#if PX_NVTX
if(mIsNVTXSupportEnabled)
{
if(detached)
{
nvtxEventAttributes_t eventAttrib;
memset(&eventAttrib, 0, sizeof(eventAttrib));
eventAttrib.version = NVTX_VERSION;
eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
eventAttrib.colorType = NVTX_COLOR_ARGB;
eventAttrib.color = 0xFFFF0000;
eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII;
eventAttrib.message.ascii = eventName;
nvtxMarkEx(&eventAttrib);
}
else
{
nvtxRangePop();
}
}
#endif
}
} // pvd
} // physx
| 10,222 | C++ | 23.753027 | 144 | 0.7207 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxPvdDefaultFileTransport.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PVD_DEFAULT_FILE_TRANSPORT_H
#define PX_PVD_DEFAULT_FILE_TRANSPORT_H
#include "pvd/PxPvdTransport.h"
#include "foundation/PxUserAllocated.h"
#include "PsFileBuffer.h"
#include "foundation/PxMutex.h"
namespace physx
{
namespace pvdsdk
{
class PvdDefaultFileTransport : public physx::PxPvdTransport, public physx::PxUserAllocated
{
PX_NOCOPY(PvdDefaultFileTransport)
public:
PvdDefaultFileTransport(const char* name);
virtual ~PvdDefaultFileTransport();
virtual bool connect();
virtual void disconnect();
virtual bool isConnected();
virtual bool write(const uint8_t* inBytes, uint32_t inLength);
virtual PxPvdTransport& lock();
virtual void unlock();
virtual void flush();
virtual uint64_t getWrittenDataSize();
virtual void release();
private:
physx::PsFileBuffer* mFileBuffer;
bool mConnected;
uint64_t mWrittenData;
physx::PxMutex mMutex;
bool mLocked; // for debug, remove it when finished
};
} // pvdsdk
} // physx
#endif
| 2,667 | C | 33.205128 | 91 | 0.764154 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxPvdObjectModelMetaData.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PX_PVD_OBJECT_MODEL_METADATA_H
#define PX_PVD_OBJECT_MODEL_METADATA_H
#include "foundation/PxAssert.h"
#include "PxPvdObjectModelBaseTypes.h"
#include "PxPvdBits.h"
namespace physx
{
namespace pvdsdk
{
class PvdInputStream;
class PvdOutputStream;
struct PropertyDescription
{
NamespacedName mOwnerClassName;
int32_t mOwnerClassId;
String mName;
String mSemantic;
// The datatype this property corresponds to.
int32_t mDatatype;
// The name of the datatype
NamespacedName mDatatypeName;
// Scalar or array.
PropertyType::Enum mPropertyType;
// No other property under any class has this id, it is DB-unique.
int32_t mPropertyId;
// Offset in bytes into the object's data section where this property starts.
uint32_t m32BitOffset;
// Offset in bytes into the object's data section where this property starts.
uint32_t m64BitOffset;
PropertyDescription(const NamespacedName& clsName, int32_t classId, String name, String semantic, int32_t datatype,
const NamespacedName& datatypeName, PropertyType::Enum propType, int32_t propId,
uint32_t offset32, uint32_t offset64)
: mOwnerClassName(clsName)
, mOwnerClassId(classId)
, mName(name)
, mSemantic(semantic)
, mDatatype(datatype)
, mDatatypeName(datatypeName)
, mPropertyType(propType)
, mPropertyId(propId)
, m32BitOffset(offset32)
, m64BitOffset(offset64)
{
}
PropertyDescription()
: mOwnerClassId(-1)
, mName("")
, mSemantic("")
, mDatatype(-1)
, mPropertyType(PropertyType::Unknown)
, mPropertyId(-1)
, m32BitOffset(0)
, m64BitOffset(0)
{
}
virtual ~PropertyDescription()
{
}
};
struct PtrOffsetType
{
enum Enum
{
UnknownOffset,
VoidPtrOffset,
StringOffset
};
};
struct PtrOffset
{
PtrOffsetType::Enum mOffsetType;
uint32_t mOffset;
PtrOffset(PtrOffsetType::Enum type, uint32_t offset) : mOffsetType(type), mOffset(offset)
{
}
PtrOffset() : mOffsetType(PtrOffsetType::UnknownOffset), mOffset(0)
{
}
};
inline uint32_t align(uint32_t offset, uint32_t alignment)
{
uint32_t startOffset = offset;
uint32_t alignmentMask = ~(alignment - 1);
offset = (offset + alignment - 1) & alignmentMask;
PX_ASSERT(offset >= startOffset && (offset % alignment) == 0);
(void)startOffset;
return offset;
}
struct ClassDescriptionSizeInfo
{
// The size of the data section of this object, padded to alignment.
uint32_t mByteSize;
// The last data member goes to here.
uint32_t mDataByteSize;
// Alignment in bytes of the data section of this object.
uint32_t mAlignment;
// the offsets of string handles in the binary value of this class
DataRef<PtrOffset> mPtrOffsets;
ClassDescriptionSizeInfo() : mByteSize(0), mDataByteSize(0), mAlignment(0)
{
}
};
struct ClassDescription
{
NamespacedName mName;
// No other class has this id, it is DB-unique
int32_t mClassId;
// Only single derivation supported.
int32_t mBaseClass;
// If this class has properties that are of uniform type, then we note that.
// This means that when deserialization an array of these objects we can just use
// single function to endian convert the entire mess at once.
int32_t mPackedUniformWidth;
// If this class is composed uniformly of members of a given type
// Or all of its properties are composed uniformly of members of
// a give ntype, then this class's packed type is that type.
// PxTransform's packed type would be float.
int32_t mPackedClassType;
// 0: 32Bit 1: 64Bit
ClassDescriptionSizeInfo mSizeInfo[2];
// No further property additions allowed.
bool mLocked;
// True when this datatype has an array on it that needs to be
// separately deleted.
bool mRequiresDestruction;
ClassDescription(NamespacedName name, int32_t id)
: mName(name)
, mClassId(id)
, mBaseClass(-1)
, mPackedUniformWidth(-1)
, mPackedClassType(-1)
, mLocked(false)
, mRequiresDestruction(false)
{
}
ClassDescription()
: mClassId(-1), mBaseClass(-1), mPackedUniformWidth(-1), mPackedClassType(-1), mLocked(false), mRequiresDestruction(false)
{
}
virtual ~ClassDescription()
{
}
ClassDescriptionSizeInfo& get32BitSizeInfo()
{
return mSizeInfo[0];
}
ClassDescriptionSizeInfo& get64BitSizeInfo()
{
return mSizeInfo[1];
}
uint32_t& get32BitSize()
{
return get32BitSizeInfo().mByteSize;
}
uint32_t& get64BitSize()
{
return get64BitSizeInfo().mByteSize;
}
uint32_t get32BitSize() const
{
return mSizeInfo[0].mByteSize;
}
const ClassDescriptionSizeInfo& getNativeSizeInfo() const
{
return mSizeInfo[(sizeof(void*) >> 2) - 1];
}
uint32_t getNativeSize() const
{
return getNativeSizeInfo().mByteSize;
}
};
struct MarshalQueryResult
{
int32_t srcType;
int32_t dstType;
// If canMarshal != needsMarshalling we have a problem.
bool canMarshal;
bool needsMarshalling;
// Non null if marshalling is possible.
TBlockMarshaller marshaller;
MarshalQueryResult(int32_t _srcType = -1, int32_t _dstType = -1, bool _canMarshal = false, bool _needs = false,
TBlockMarshaller _m = NULL)
: srcType(_srcType), dstType(_dstType), canMarshal(_canMarshal), needsMarshalling(_needs), marshaller(_m)
{
}
};
struct PropertyMessageEntry
{
PropertyDescription mProperty;
NamespacedName mDatatypeName;
// datatype of the data in the message.
int32_t mDatatypeId;
// where in the message this property starts.
uint32_t mMessageOffset;
// size of this entry object
uint32_t mByteSize;
// If the chain of properties doesn't have any array properties this indicates the
uint32_t mDestByteSize;
PropertyMessageEntry(PropertyDescription propName, NamespacedName dtypeName, int32_t dtype, uint32_t messageOff,
uint32_t byteSize, uint32_t destByteSize)
: mProperty(propName)
, mDatatypeName(dtypeName)
, mDatatypeId(dtype)
, mMessageOffset(messageOff)
, mByteSize(byteSize)
, mDestByteSize(destByteSize)
{
}
PropertyMessageEntry() : mDatatypeId(-1), mMessageOffset(0), mByteSize(0), mDestByteSize(0)
{
}
};
// Create a struct that defines a subset of the properties on an object.
struct PropertyMessageDescription
{
NamespacedName mClassName;
// No other class has this id, it is DB-unique
int32_t mClassId;
NamespacedName mMessageName;
int32_t mMessageId;
DataRef<PropertyMessageEntry> mProperties;
uint32_t mMessageByteSize;
// Offsets into the property message where const char* items are.
DataRef<uint32_t> mStringOffsets;
PropertyMessageDescription(const NamespacedName& nm, int32_t clsId, const NamespacedName& msgName, int32_t msgId,
uint32_t msgSize)
: mClassName(nm), mClassId(clsId), mMessageName(msgName), mMessageId(msgId), mMessageByteSize(msgSize)
{
}
PropertyMessageDescription() : mClassId(-1), mMessageId(-1), mMessageByteSize(0)
{
}
virtual ~PropertyMessageDescription()
{
}
};
class StringTable
{
protected:
virtual ~StringTable()
{
}
public:
virtual uint32_t getNbStrs() = 0;
virtual uint32_t getStrs(const char** outStrs, uint32_t bufLen, uint32_t startIdx = 0) = 0;
virtual const char* registerStr(const char* str, bool& outAdded) = 0;
const char* registerStr(const char* str)
{
bool ignored;
return registerStr(str, ignored);
}
virtual StringHandle strToHandle(const char* str) = 0;
virtual const char* handleToStr(uint32_t hdl) = 0;
virtual void release() = 0;
static StringTable& create();
};
struct None
{
};
template <typename T>
class Option
{
T mValue;
bool mHasValue;
public:
Option(const T& val) : mValue(val), mHasValue(true)
{
}
Option(None nothing = None()) : mHasValue(false)
{
(void)nothing;
}
Option(const Option& other) : mValue(other.mValue), mHasValue(other.mHasValue)
{
}
Option& operator=(const Option& other)
{
mValue = other.mValue;
mHasValue = other.mHasValue;
return *this;
}
bool hasValue() const
{
return mHasValue;
}
const T& getValue() const
{
PX_ASSERT(hasValue());
return mValue;
}
T& getValue()
{
PX_ASSERT(hasValue());
return mValue;
}
operator const T&() const
{
return getValue();
}
operator T&()
{
return getValue();
}
T* operator->()
{
return &getValue();
}
const T* operator->() const
{
return &getValue();
}
};
/**
* Create new classes and add properties to some existing ones.
* The default classes are created already, the simple types
* along with the basic math types.
* (uint8_t, int8_t, etc )
* (PxVec3, PxQuat, PxTransform, PxMat33, PxMat34, PxMat44)
*/
class PvdObjectModelMetaData
{
protected:
virtual ~PvdObjectModelMetaData()
{
}
public:
virtual ClassDescription getOrCreateClass(const NamespacedName& nm) = 0;
// get or create parent, lock parent. deriveFrom getOrCreatechild.
virtual bool deriveClass(const NamespacedName& parent, const NamespacedName& child) = 0;
virtual Option<ClassDescription> findClass(const NamespacedName& nm) const = 0;
template <typename TDataType>
Option<ClassDescription> findClass()
{
return findClass(getPvdNamespacedNameForType<TDataType>());
}
virtual Option<ClassDescription> getClass(int32_t classId) const = 0;
virtual ClassDescription* getClassPtr(int32_t classId) const = 0;
virtual Option<ClassDescription> getParentClass(int32_t classId) const = 0;
bool isDerivedFrom(int32_t classId, int32_t parentClass) const
{
if(classId == parentClass)
return true;
ClassDescription* p = getClassPtr(getClassPtr(classId)->mBaseClass);
while(p != NULL)
{
if(p->mClassId == parentClass)
return true;
p = getClassPtr(p->mBaseClass);
}
return false;
}
virtual void lockClass(int32_t classId) = 0;
virtual uint32_t getNbClasses() const = 0;
virtual uint32_t getClasses(ClassDescription* outClasses, uint32_t requestCount, uint32_t startIndex = 0) const = 0;
// Create a nested property.
// This way you can have obj.p.x without explicity defining the class p.
virtual Option<PropertyDescription> createProperty(int32_t classId, String name, String semantic, int32_t datatype,
PropertyType::Enum propertyType = PropertyType::Scalar) = 0;
Option<PropertyDescription> createProperty(NamespacedName clsId, String name, String semantic, NamespacedName dtype,
PropertyType::Enum propertyType = PropertyType::Scalar)
{
return createProperty(findClass(clsId)->mClassId, name, semantic, findClass(dtype)->mClassId, propertyType);
}
Option<PropertyDescription> createProperty(NamespacedName clsId, String name, NamespacedName dtype,
PropertyType::Enum propertyType = PropertyType::Scalar)
{
return createProperty(findClass(clsId)->mClassId, name, "", findClass(dtype)->mClassId, propertyType);
}
Option<PropertyDescription> createProperty(int32_t clsId, String name, int32_t dtype,
PropertyType::Enum propertyType = PropertyType::Scalar)
{
return createProperty(clsId, name, "", dtype, propertyType);
}
template <typename TDataType>
Option<PropertyDescription> createProperty(int32_t clsId, String name, String semantic = "",
PropertyType::Enum propertyType = PropertyType::Scalar)
{
return createProperty(clsId, name, semantic, getPvdNamespacedNameForType<TDataType>(), propertyType);
}
virtual Option<PropertyDescription> findProperty(const NamespacedName& cls, String prop) const = 0;
virtual Option<PropertyDescription> findProperty(int32_t clsId, String prop) const = 0;
virtual Option<PropertyDescription> getProperty(int32_t propId) const = 0;
virtual void setNamedPropertyValues(DataRef<NamedValue> values, int32_t propId) = 0;
// for enumerations and flags.
virtual DataRef<NamedValue> getNamedPropertyValues(int32_t propId) const = 0;
virtual uint32_t getNbProperties(int32_t classId) const = 0;
virtual uint32_t getProperties(int32_t classId, PropertyDescription* outBuffer, uint32_t bufCount,
uint32_t startIdx = 0) const = 0;
// Does one cls id differ marshalling to another and if so return the functions to do it.
virtual MarshalQueryResult checkMarshalling(int32_t srcClsId, int32_t dstClsId) const = 0;
// messages and classes are stored in separate maps, so a property message can have the same name as a class.
virtual Option<PropertyMessageDescription> createPropertyMessage(const NamespacedName& cls,
const NamespacedName& msgName,
DataRef<PropertyMessageArg> entries,
uint32_t messageSize) = 0;
virtual Option<PropertyMessageDescription> findPropertyMessage(const NamespacedName& msgName) const = 0;
virtual Option<PropertyMessageDescription> getPropertyMessage(int32_t msgId) const = 0;
virtual uint32_t getNbPropertyMessages() const = 0;
virtual uint32_t getPropertyMessages(PropertyMessageDescription* msgBuf, uint32_t bufLen,
uint32_t startIdx = 0) const = 0;
virtual StringTable& getStringTable() const = 0;
virtual void write(PvdOutputStream& stream) const = 0;
void save(PvdOutputStream& stream) const
{
write(stream);
}
virtual void addRef() = 0;
virtual void release() = 0;
static uint32_t getCurrentPvdObjectModelVersion();
static PvdObjectModelMetaData& create();
static PvdObjectModelMetaData& create(PvdInputStream& stream);
};
}
}
#endif
| 15,021 | C | 30.165975 | 123 | 0.721656 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxPvdByteStreams.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PX_PVD_BYTE_STREAMS_H
#define PX_PVD_BYTE_STREAMS_H
#include "PxPvdObjectModelBaseTypes.h"
namespace physx
{
namespace pvdsdk
{
static inline uint32_t strLen(const char* inStr)
{
uint32_t len = 0;
if(inStr)
{
while(*inStr)
{
++len;
++inStr;
}
}
return len;
}
class PvdInputStream
{
protected:
virtual ~PvdInputStream()
{
}
public:
// Return false if you can't write the number of bytes requested
// But make an absolute best effort to read the data...
virtual bool read(uint8_t* buffer, uint32_t& len) = 0;
template <typename TDataType>
bool read(TDataType* buffer, uint32_t numItems)
{
uint32_t expected = numItems;
uint32_t amountToRead = numItems * sizeof(TDataType);
read(reinterpret_cast<uint8_t*>(buffer), amountToRead);
numItems = amountToRead / sizeof(TDataType);
PX_ASSERT(numItems == expected);
return expected == numItems;
}
template <typename TDataType>
PvdInputStream& operator>>(TDataType& data)
{
uint32_t dataSize = static_cast<uint32_t>(sizeof(TDataType));
bool success = read(reinterpret_cast<uint8_t*>(&data), dataSize);
// PX_ASSERT( success );
// PX_ASSERT( dataSize == sizeof( data ) );
(void)success;
return *this;
}
};
class PvdOutputStream
{
protected:
virtual ~PvdOutputStream()
{
}
public:
// Return false if you can't write the number of bytes requested
// But make an absolute best effort to write the data...
virtual bool write(const uint8_t* buffer, uint32_t len) = 0;
virtual bool directCopy(PvdInputStream& inStream, uint32_t len) = 0;
template <typename TDataType>
bool write(const TDataType* buffer, uint32_t numItems)
{
return write(reinterpret_cast<const uint8_t*>(buffer), numItems * sizeof(TDataType));
}
template <typename TDataType>
PvdOutputStream& operator<<(const TDataType& data)
{
bool success = write(reinterpret_cast<const uint8_t*>(&data), sizeof(data));
PX_ASSERT(success);
(void)success;
return *this;
}
PvdOutputStream& operator<<(const char* inString)
{
if(inString && *inString)
{
uint32_t len(strLen(inString));
write(inString, len);
}
return *this;
}
};
}
}
#endif
| 3,709 | C | 28.212598 | 87 | 0.72742 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxProfileZoneManagerImpl.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PROFILE_ZONE_MANAGER_IMPL_H
#define PX_PROFILE_ZONE_MANAGER_IMPL_H
#include "PxProfileZoneManager.h"
#include "PxProfileScopedMutexLock.h"
#include "PxPvdProfileZone.h"
#include "PxProfileAllocatorWrapper.h"
#include "foundation/PxArray.h"
#include "foundation/PxMutex.h"
namespace physx { namespace profile {
struct NullEventNameProvider : public PxProfileNameProvider
{
virtual PxProfileNames getProfileNames() const { return PxProfileNames( 0, 0 ); }
};
class ZoneManagerImpl : public PxProfileZoneManager
{
typedef ScopedLockImpl<PxMutex> TScopedLockType;
PxProfileAllocatorWrapper mWrapper;
PxProfileArray<PxProfileZone*> mZones;
PxProfileArray<PxProfileZoneHandler*> mHandlers;
PxMutex mMutex;
ZoneManagerImpl( const ZoneManagerImpl& inOther );
ZoneManagerImpl& operator=( const ZoneManagerImpl& inOther );
public:
ZoneManagerImpl(PxAllocatorCallback* inFoundation)
: mWrapper( inFoundation )
, mZones( mWrapper )
, mHandlers( mWrapper )
{}
virtual ~ZoneManagerImpl()
{
//This assert would mean that a profile zone is outliving us.
//This will cause a crash when the profile zone is released.
PX_ASSERT( mZones.size() == 0 );
while( mZones.size() )
removeProfileZone( *mZones.back() );
}
virtual void addProfileZone( PxProfileZone& inSDK )
{
TScopedLockType lock( &mMutex );
if ( inSDK.getProfileZoneManager() != NULL )
{
if ( inSDK.getProfileZoneManager() == this )
return;
else //there must be two managers in the system somehow.
{
PX_ASSERT( false );
inSDK.getProfileZoneManager()->removeProfileZone( inSDK );
}
}
mZones.pushBack( &inSDK );
inSDK.setProfileZoneManager( this );
for ( uint32_t idx =0; idx < mHandlers.size(); ++idx )
mHandlers[idx]->onZoneAdded( inSDK );
}
virtual void removeProfileZone( PxProfileZone& inSDK )
{
TScopedLockType lock( &mMutex );
if ( inSDK.getProfileZoneManager() == NULL )
return;
else if ( inSDK.getProfileZoneManager() != this )
{
PX_ASSERT( false );
inSDK.getProfileZoneManager()->removeProfileZone( inSDK );
return;
}
inSDK.setProfileZoneManager( NULL );
for ( uint32_t idx = 0; idx < mZones.size(); ++idx )
{
if ( mZones[idx] == &inSDK )
{
for ( uint32_t handler =0; handler < mHandlers.size(); ++handler )
mHandlers[handler]->onZoneRemoved( inSDK );
mZones.replaceWithLast( idx );
}
}
}
virtual void flushProfileEvents()
{
uint32_t sdkCount = mZones.size();
for ( uint32_t idx = 0; idx < sdkCount; ++idx )
mZones[idx]->flushProfileEvents();
}
virtual void addProfileZoneHandler( PxProfileZoneHandler& inHandler )
{
TScopedLockType lock( &mMutex );
mHandlers.pushBack( &inHandler );
for ( uint32_t idx = 0; idx < mZones.size(); ++idx )
inHandler.onZoneAdded( *mZones[idx] );
}
virtual void removeProfileZoneHandler( PxProfileZoneHandler& inHandler )
{
TScopedLockType lock( &mMutex );
for( uint32_t idx = 0; idx < mZones.size(); ++idx )
inHandler.onZoneRemoved( *mZones[idx] );
for( uint32_t idx = 0; idx < mHandlers.size(); ++idx )
{
if ( mHandlers[idx] == &inHandler )
mHandlers.replaceWithLast( idx );
}
}
virtual PxProfileZone& createProfileZone( const char* inSDKName, PxProfileNameProvider* inProvider, uint32_t inEventBufferByteSize )
{
NullEventNameProvider nullProvider;
if ( inProvider == NULL )
inProvider = &nullProvider;
return createProfileZone( inSDKName, inProvider->getProfileNames(), inEventBufferByteSize );
}
virtual PxProfileZone& createProfileZone( const char* inSDKName, PxProfileNames inNames, uint32_t inEventBufferByteSize )
{
PxProfileZone& retval( PxProfileZone::createProfileZone( &mWrapper.getAllocator(), inSDKName, inNames, inEventBufferByteSize ) );
addProfileZone( retval );
return retval;
}
virtual void release()
{
PX_PROFILE_DELETE( mWrapper.getAllocator(), this );
}
};
} }
#endif
| 5,729 | C | 32.121387 | 134 | 0.713039 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxPvdCommStreamTypes.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PX_PVD_COMM_STREAM_TYPES_H
#define PX_PVD_COMM_STREAM_TYPES_H
#include "foundation/PxErrorCallback.h"
#include "common/PxRenderBuffer.h"
#include "pvd/PxPvdTransport.h"
#include "PxPvdObjectModelBaseTypes.h"
#include "PxPvdCommStreamEvents.h"
#include "PxPvdDataStream.h"
#include "foundation/PxMutex.h"
namespace physx
{
namespace profile
{
class PxProfileZone;
class PxProfileMemoryEventBuffer;
}
namespace pvdsdk
{
struct PvdErrorMessage;
class PvdObjectModelMetaData;
DEFINE_PVD_TYPE_NAME_MAP(profile::PxProfileZone, "_debugger_", "PxProfileZone")
DEFINE_PVD_TYPE_NAME_MAP(profile::PxProfileMemoryEventBuffer, "_debugger_", "PxProfileMemoryEventBuffer")
DEFINE_PVD_TYPE_NAME_MAP(PvdErrorMessage, "_debugger_", "PvdErrorMessage")
// All event streams are on the 'events' property of objects of these types
static inline NamespacedName getMemoryEventTotalsClassName()
{
return NamespacedName("_debugger", "MemoryEventTotals");
}
class PvdOMMetaDataProvider
{
protected:
virtual ~PvdOMMetaDataProvider()
{
}
public:
virtual void addRef() = 0;
virtual void release() = 0;
virtual PvdObjectModelMetaData& lock() = 0;
virtual void unlock() = 0;
virtual bool createInstance(const NamespacedName& clsName, const void* instance) = 0;
virtual bool isInstanceValid(const void* instance) = 0;
virtual void destroyInstance(const void* instance) = 0;
virtual int32_t getInstanceClassType(const void* instance) = 0;
};
class PvdCommStreamEmbeddedTypes
{
public:
static const char* getProfileEventStreamSemantic()
{
return "profile event stream";
}
static const char* getMemoryEventStreamSemantic()
{
return "memory event stream";
}
static const char* getRendererEventStreamSemantic()
{
return "render event stream";
}
};
class PvdCommStreamEventBufferClient;
template <typename TStreamType>
struct EventStreamifier : public PvdEventSerializer
{
TStreamType& mBuffer;
EventStreamifier(TStreamType& buf) : mBuffer(buf)
{
}
template <typename TDataType>
void write(const TDataType& type)
{
mBuffer.write(reinterpret_cast<const uint8_t*>(&type), sizeof(TDataType));
}
template <typename TDataType>
void write(const TDataType* type, uint32_t count)
{
mBuffer.write(reinterpret_cast<const uint8_t*>(type), count * sizeof(TDataType));
}
void writeRef(DataRef<const uint8_t> data)
{
uint32_t amount = static_cast<uint32_t>(data.size());
write(amount);
write(data.begin(), amount);
}
void writeRef(DataRef<StringHandle> data)
{
uint32_t amount = static_cast<uint32_t>(data.size());
write(amount);
write(data.begin(), amount);
}
template <typename TDataType>
void writeRef(DataRef<TDataType> data)
{
uint32_t amount = static_cast<uint32_t>(data.size());
write(amount);
for(uint32_t idx = 0; idx < amount; ++idx)
{
TDataType& dtype(const_cast<TDataType&>(data[idx]));
dtype.serialize(*this);
}
}
virtual void streamify(uint16_t& val)
{
write(val);
}
virtual void streamify(uint8_t& val)
{
write(val);
}
virtual void streamify(uint32_t& val)
{
write(val);
}
virtual void streamify(float& val)
{
write(val);
}
virtual void streamify(uint64_t& val)
{
write(val);
}
virtual void streamify(PxDebugText& val)
{
write(val.color);
write(val.position);
write(val.size);
streamify(val.string);
}
virtual void streamify(String& val)
{
uint32_t len = 0;
String temp = nonNull(val);
if(*temp)
len = static_cast<uint32_t>(strlen(temp) + 1);
write(len);
write(val, len);
}
virtual void streamify(DataRef<const uint8_t>& val)
{
writeRef(val);
}
virtual void streamify(DataRef<NameHandleValue>& val)
{
writeRef(val);
}
virtual void streamify(DataRef<StreamPropMessageArg>& val)
{
writeRef(val);
}
virtual void streamify(DataRef<StringHandle>& val)
{
writeRef(val);
}
private:
EventStreamifier& operator=(const EventStreamifier&);
};
struct MeasureStream
{
uint32_t mSize;
MeasureStream() : mSize(0)
{
}
template <typename TDataType>
void write(const TDataType& val)
{
mSize += sizeof(val);
}
template <typename TDataType>
void write(const TDataType*, uint32_t count)
{
mSize += sizeof(TDataType) * count;
}
};
struct DataStreamState
{
enum Enum
{
Open,
SetPropertyValue,
PropertyMessageGroup
};
};
} // pvdsdk
} // physx
#endif
| 5,865 | C | 24.504348 | 105 | 0.73572 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxPvdDataStream.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#include "foundation/PxAssert.h"
#include "PxPvdCommStreamEventSink.h"
#include "PxPvdDataStreamHelpers.h"
#include "PxPvdObjectModelInternalTypes.h"
#include "PxPvdImpl.h"
using namespace physx;
using namespace physx::pvdsdk;
namespace
{
struct ScopedMetaData
{
PvdOMMetaDataProvider& mProvider;
PvdObjectModelMetaData& mMeta;
ScopedMetaData(PvdOMMetaDataProvider& provider) : mProvider(provider), mMeta(provider.lock())
{
}
~ScopedMetaData()
{
mProvider.unlock();
}
PvdObjectModelMetaData* operator->()
{
return &mMeta;
}
private:
ScopedMetaData& operator=(const ScopedMetaData&);
};
struct PropertyDefinitionHelper : public PvdPropertyDefinitionHelper
{
PvdDataStream* mStream;
PvdOMMetaDataProvider& mProvider;
PxArray<char> mNameBuffer;
PxArray<uint32_t> mNameStack;
PxArray<NamedValue> mNamedValues;
PxArray<PropertyMessageArg> mPropertyMessageArgs;
PropertyDefinitionHelper(PvdOMMetaDataProvider& provider)
: mStream(NULL)
, mProvider(provider)
, mNameBuffer("PropertyDefinitionHelper::mNameBuffer")
, mNameStack("PropertyDefinitionHelper::mNameStack")
, mNamedValues("PropertyDefinitionHelper::mNamedValues")
, mPropertyMessageArgs("PropertyDefinitionHelper::mPropertyMessageArgs")
{
}
void setStream(PvdDataStream* stream)
{
mStream = stream;
}
inline void appendStrToBuffer(const char* str)
{
if(str == NULL)
return;
size_t strLen = strlen(str);
size_t endBufOffset = mNameBuffer.size();
size_t resizeLen = endBufOffset;
// account for null
if(mNameBuffer.empty())
resizeLen += 1;
else
endBufOffset -= 1;
mNameBuffer.resize(static_cast<uint32_t>(resizeLen + strLen));
char* endPtr = mNameBuffer.begin() + endBufOffset;
PxMemCopy(endPtr, str, static_cast<uint32_t>(strLen));
}
virtual void pushName(const char* nm, const char* appender = ".")
{
size_t nameBufLen = mNameBuffer.size();
mNameStack.pushBack(static_cast<uint32_t>(nameBufLen));
if(mNameBuffer.empty() == false)
appendStrToBuffer(appender);
appendStrToBuffer(nm);
mNameBuffer.back() = 0;
}
virtual void pushBracketedName(const char* inName, const char* leftBracket = "[", const char* rightBracket = "]")
{
size_t nameBufLen = mNameBuffer.size();
mNameStack.pushBack(static_cast<uint32_t>(nameBufLen));
appendStrToBuffer(leftBracket);
appendStrToBuffer(inName);
appendStrToBuffer(rightBracket);
mNameBuffer.back() = 0;
}
virtual void popName()
{
if(mNameStack.empty())
return;
mNameBuffer.resize(static_cast<uint32_t>(mNameStack.back()));
mNameStack.popBack();
if(mNameBuffer.empty() == false)
mNameBuffer.back() = 0;
}
virtual const char* getTopName()
{
if(mNameBuffer.size())
return mNameBuffer.begin();
return "";
}
virtual void clearNameStack()
{
mNameBuffer.clear();
mNameStack.clear();
}
virtual void addNamedValue(const char* name, uint32_t value)
{
mNamedValues.pushBack(NamedValue(name, value));
}
virtual void clearNamedValues()
{
mNamedValues.clear();
}
virtual DataRef<NamedValue> getNamedValues()
{
return DataRef<NamedValue>(mNamedValues.begin(), mNamedValues.size());
}
virtual void createProperty(const NamespacedName& clsName, const char* inSemantic, const NamespacedName& dtypeName,
PropertyType::Enum propType)
{
mStream->createProperty(clsName, getTopName(), inSemantic, dtypeName, propType, getNamedValues());
clearNamedValues();
}
const char* registerStr(const char* str)
{
ScopedMetaData scopedProvider(mProvider);
return scopedProvider->getStringTable().registerStr(str);
}
virtual void addPropertyMessageArg(const NamespacedName& inDatatype, uint32_t inOffset, uint32_t inSize)
{
mPropertyMessageArgs.pushBack(PropertyMessageArg(registerStr(getTopName()), inDatatype, inOffset, inSize));
}
virtual void addPropertyMessage(const NamespacedName& clsName, const NamespacedName& msgName,
uint32_t inStructSizeInBytes)
{
if(mPropertyMessageArgs.empty())
{
PX_ASSERT(false);
return;
}
mStream->createPropertyMessage(
clsName, msgName, DataRef<PropertyMessageArg>(mPropertyMessageArgs.begin(), mPropertyMessageArgs.size()),
inStructSizeInBytes);
}
virtual void clearPropertyMessageArgs()
{
mPropertyMessageArgs.clear();
}
private:
PropertyDefinitionHelper& operator=(const PropertyDefinitionHelper&);
};
class PvdMemPool
{
// Link List
PxArray<uint8_t*> mMemBuffer;
uint32_t mLength;
uint32_t mBufIndex;
// 4k for one page
static const int BUFFER_LENGTH = 4096;
PX_NOCOPY(PvdMemPool)
public:
PvdMemPool(const char* bufDataName) : mMemBuffer(bufDataName), mLength(0), mBufIndex(0)
{
grow();
}
~PvdMemPool()
{
for(uint32_t i = 0; i < mMemBuffer.size(); i++)
{
PX_FREE(mMemBuffer[i]);
}
}
void grow()
{
if(mBufIndex + 1 < mMemBuffer.size())
{
mBufIndex++;
}
else
{
uint8_t* Buf = reinterpret_cast<uint8_t*>(PX_ALLOC(BUFFER_LENGTH, "PvdMemPool::mMemBuffer.buf"));
mMemBuffer.pushBack(Buf);
mBufIndex = mMemBuffer.size() - 1;
}
mLength = 0;
}
void* allocate(uint32_t length)
{
if(length > uint32_t(BUFFER_LENGTH))
return NULL;
if(length + mLength > uint32_t(BUFFER_LENGTH))
grow();
void* mem = reinterpret_cast<void*>(&mMemBuffer[mBufIndex][mLength]);
mLength += length;
return mem;
}
void clear()
{
mLength = 0;
mBufIndex = 0;
}
};
struct PvdOutStream : public PvdDataStream, public PxUserAllocated
{
PxHashMap<String, uint32_t> mStringHashMap;
PvdOMMetaDataProvider& mMetaDataProvider;
PxArray<uint8_t> mTempBuffer;
PropertyDefinitionHelper mPropertyDefinitionHelper;
DataStreamState::Enum mStreamState;
ClassDescription mSPVClass;
PropertyMessageDescription mMessageDesc;
// Set property value and SetPropertyMessage calls require
// us to write the data out to a separate buffer
// when strings are involved.
ForwardingMemoryBuffer mSPVBuffer;
uint32_t mEventCount;
uint32_t mPropertyMessageSize;
bool mConnected;
uint64_t mStreamId;
PxArray<PvdCommand*> mPvdCommandArray;
PvdMemPool mPvdCommandPool;
PxPvdTransport& mTransport;
PvdOutStream(PxPvdTransport& transport, PvdOMMetaDataProvider& provider, uint64_t streamId)
: mStringHashMap("PvdOutStream::mStringHashMap")
, mMetaDataProvider(provider)
, mTempBuffer("PvdOutStream::mTempBuffer")
, mPropertyDefinitionHelper(mMetaDataProvider)
, mStreamState(DataStreamState::Open)
, mSPVBuffer("PvdCommStreamBufferedEventSink::mSPVBuffer")
, mEventCount(0)
, mPropertyMessageSize(0)
, mConnected(true)
, mStreamId(streamId)
, mPvdCommandArray("PvdCommStreamBufferedEventSink::mPvdCommandArray")
, mPvdCommandPool("PvdCommStreamBufferedEventSink::mPvdCommandPool")
, mTransport(transport)
{
mPropertyDefinitionHelper.setStream(this);
}
virtual ~PvdOutStream()
{
}
virtual void release()
{
PVD_DELETE(this);
}
StringHandle toStream(String nm)
{
if(nm == NULL || *nm == 0)
return 0;
const PxHashMap<String, uint32_t>::Entry* entry(mStringHashMap.find(nm));
if(entry)
return entry->second;
ScopedMetaData meta(mMetaDataProvider);
StringHandle hdl = meta->getStringTable().strToHandle(nm);
nm = meta->getStringTable().handleToStr(hdl);
handlePvdEvent(StringHandleEvent(nm, hdl));
mStringHashMap.insert(nm, hdl);
return hdl;
}
StreamNamespacedName toStream(const NamespacedName& nm)
{
return StreamNamespacedName(toStream(nm.mNamespace), toStream(nm.mName));
}
bool isClassExist(const NamespacedName& nm)
{
ScopedMetaData meta(mMetaDataProvider);
return meta->findClass(nm).hasValue();
}
bool createMetaClass(const NamespacedName& nm)
{
ScopedMetaData meta(mMetaDataProvider);
meta->getOrCreateClass(nm);
return true;
}
bool deriveMetaClass(const NamespacedName& parent, const NamespacedName& child)
{
ScopedMetaData meta(mMetaDataProvider);
return meta->deriveClass(parent, child);
}
// You will notice that some functions are #pragma'd out throughout this file.
// This is because they are only called from asserts which means they aren't
// called in release. This causes warnings when building using snc which break
// the build.
#if PX_DEBUG
bool propertyExists(const NamespacedName& nm, String pname)
{
ScopedMetaData meta(mMetaDataProvider);
return meta->findProperty(nm, pname).hasValue();
}
#endif
PvdError boolToError(bool val)
{
if(val)
return PvdErrorType::Success;
return PvdErrorType::NetworkError;
}
// PvdMetaDataStream
virtual PvdError createClass(const NamespacedName& nm)
{
PX_ASSERT(mStreamState == DataStreamState::Open);
#if PX_DEBUG
PX_ASSERT(isClassExist(nm) == false);
#endif
createMetaClass(nm);
return boolToError(handlePvdEvent(CreateClass(toStream(nm))));
}
virtual PvdError deriveClass(const NamespacedName& parent, const NamespacedName& child)
{
PX_ASSERT(mStreamState == DataStreamState::Open);
#if PX_DEBUG
PX_ASSERT(isClassExist(parent));
PX_ASSERT(isClassExist(child));
#endif
deriveMetaClass(parent, child);
return boolToError(handlePvdEvent(DeriveClass(toStream(parent), toStream(child))));
}
template <typename TDataType>
TDataType* allocTemp(uint32_t numItems)
{
uint32_t desiredBytes = numItems * sizeof(TDataType);
if(desiredBytes > mTempBuffer.size())
mTempBuffer.resize(desiredBytes);
TDataType* retval = reinterpret_cast<TDataType*>(mTempBuffer.begin());
if(numItems)
{
PVD_FOREACH(idx, numItems) new (retval + idx) TDataType();
}
return retval;
}
#if PX_DEBUG
// Property datatypes need to be uniform.
// At this point, the data stream cannot handle properties that
// A struct with a float member and a char member would work.
// A struct with a float member and a long member would work (more efficiently).
bool isValidPropertyDatatype(const NamespacedName& dtypeName)
{
ScopedMetaData meta(mMetaDataProvider);
ClassDescription clsDesc(meta->findClass(dtypeName));
return clsDesc.mRequiresDestruction == false;
}
#endif
NamespacedName createMetaProperty(const NamespacedName& clsName, String name, String semantic,
const NamespacedName& dtypeName, PropertyType::Enum propertyType)
{
ScopedMetaData meta(mMetaDataProvider);
int32_t dtypeType = meta->findClass(dtypeName)->mClassId;
NamespacedName typeName = dtypeName;
if(dtypeType == getPvdTypeForType<String>())
{
dtypeType = getPvdTypeForType<StringHandle>();
typeName = getPvdNamespacedNameForType<StringHandle>();
}
Option<PropertyDescription> propOpt =
meta->createProperty(meta->findClass(clsName)->mClassId, name, semantic, dtypeType, propertyType);
PX_ASSERT(propOpt.hasValue());
PX_UNUSED(propOpt);
return typeName;
}
virtual PvdError createProperty(const NamespacedName& clsName, String name, String semantic,
const NamespacedName& incomingDtypeName, PropertyType::Enum propertyType,
DataRef<NamedValue> values)
{
PX_ASSERT(mStreamState == DataStreamState::Open);
#if PX_DEBUG
PX_ASSERT(isClassExist(clsName));
PX_ASSERT(propertyExists(clsName, name) == false);
#endif
NamespacedName dtypeName(incomingDtypeName);
if(safeStrEq(dtypeName.mName, "VoidPtr"))
dtypeName.mName = "ObjectRef";
#if PX_DEBUG
PX_ASSERT(isClassExist(dtypeName));
PX_ASSERT(isValidPropertyDatatype(dtypeName));
#endif
NamespacedName typeName = createMetaProperty(clsName, name, semantic, dtypeName, propertyType);
// Can't have arrays of strings or arrays of string handles due to the difficulty
// of quickly dealing with them on the network receiving side.
if(propertyType == PropertyType::Array && safeStrEq(typeName.mName, "StringHandle"))
{
PX_ASSERT(false);
return PvdErrorType::ArgumentError;
}
uint32_t numItems = values.size();
NameHandleValue* streamValues = allocTemp<NameHandleValue>(numItems);
PVD_FOREACH(idx, numItems)
streamValues[idx] = NameHandleValue(toStream(values[idx].mName), values[idx].mValue);
CreateProperty evt(toStream(clsName), toStream(name), toStream(semantic), toStream(typeName), propertyType,
DataRef<NameHandleValue>(streamValues, numItems));
return boolToError(handlePvdEvent(evt));
}
bool createMetaPropertyMessage(const NamespacedName& cls, const NamespacedName& msgName,
DataRef<PropertyMessageArg> entries, uint32_t messageSizeInBytes)
{
ScopedMetaData meta(mMetaDataProvider);
return meta->createPropertyMessage(cls, msgName, entries, messageSizeInBytes).hasValue();
}
#if PX_DEBUG
bool messageExists(const NamespacedName& msgName)
{
ScopedMetaData meta(mMetaDataProvider);
return meta->findPropertyMessage(msgName).hasValue();
}
#endif
virtual PvdError createPropertyMessage(const NamespacedName& cls, const NamespacedName& msgName,
DataRef<PropertyMessageArg> entries, uint32_t messageSizeInBytes)
{
PX_ASSERT(mStreamState == DataStreamState::Open);
#if PX_DEBUG
PX_ASSERT(isClassExist(cls));
PX_ASSERT(messageExists(msgName) == false);
#endif
createMetaPropertyMessage(cls, msgName, entries, messageSizeInBytes);
uint32_t numItems = entries.size();
StreamPropMessageArg* streamValues = allocTemp<StreamPropMessageArg>(numItems);
PVD_FOREACH(idx, numItems)
streamValues[idx] =
StreamPropMessageArg(toStream(entries[idx].mPropertyName), toStream(entries[idx].mDatatypeName),
entries[idx].mMessageOffset, entries[idx].mByteSize);
CreatePropertyMessage evt(toStream(cls), toStream(msgName),
DataRef<StreamPropMessageArg>(streamValues, numItems), messageSizeInBytes);
return boolToError(handlePvdEvent(evt));
}
uint64_t toStream(const void* instance)
{
return PVD_POINTER_TO_U64(instance);
}
virtual PvdError createInstance(const NamespacedName& cls, const void* instance)
{
PX_ASSERT(isInstanceValid(instance) == false);
PX_ASSERT(mStreamState == DataStreamState::Open);
bool success = mMetaDataProvider.createInstance(cls, instance);
PX_ASSERT(success);
(void)success;
return boolToError(handlePvdEvent(CreateInstance(toStream(cls), toStream(instance))));
}
virtual bool isInstanceValid(const void* instance)
{
return mMetaDataProvider.isInstanceValid(instance);
}
#if PX_DEBUG
// If the property will fit or is already completely in memory
bool checkPropertyType(const void* instance, String name, const NamespacedName& incomingType)
{
int32_t instType = mMetaDataProvider.getInstanceClassType(instance);
ScopedMetaData meta(mMetaDataProvider);
Option<PropertyDescription> prop = meta->findProperty(instType, name);
if(prop.hasValue() == false)
return false;
int32_t propType = prop->mDatatype;
int32_t incomingTypeId = meta->findClass(incomingType)->mClassId;
if(incomingTypeId != getPvdTypeForType<VoidPtr>())
{
MarshalQueryResult result = meta->checkMarshalling(incomingTypeId, propType);
bool possible = result.needsMarshalling == false || result.canMarshal;
return possible;
}
else
{
if(propType != getPvdTypeForType<ObjectRef>())
return false;
}
return true;
}
#endif
DataRef<const uint8_t> bufferPropertyValue(ClassDescriptionSizeInfo info, DataRef<const uint8_t> data)
{
uint32_t realSize = info.mByteSize;
uint32_t numItems = data.size() / realSize;
if(info.mPtrOffsets.size() != 0)
{
mSPVBuffer.clear();
PVD_FOREACH(item, numItems)
{
const uint8_t* itemPtr = data.begin() + item * realSize;
mSPVBuffer.write(itemPtr, realSize);
PVD_FOREACH(stringIdx, info.mPtrOffsets.size())
{
PtrOffset offset(info.mPtrOffsets[stringIdx]);
if(offset.mOffsetType == PtrOffsetType::VoidPtrOffset)
continue;
const char* strPtr;
physx::intrinsics::memCopy(&strPtr, itemPtr + offset.mOffset, sizeof(char*));
strPtr = nonNull(strPtr);
uint32_t len = safeStrLen(strPtr) + 1;
mSPVBuffer.write(strPtr, len);
}
}
data = DataRef<const uint8_t>(mSPVBuffer.begin(), mSPVBuffer.size());
}
return data;
}
virtual PvdError setPropertyValue(const void* instance, String name, DataRef<const uint8_t> data,
const NamespacedName& incomingTypeName)
{
PX_ASSERT(isInstanceValid(instance));
#if PX_DEBUG
PX_ASSERT(isClassExist(incomingTypeName));
#endif
PX_ASSERT(mStreamState == DataStreamState::Open);
ClassDescription clsDesc;
{
ScopedMetaData meta(mMetaDataProvider);
clsDesc = meta->findClass(incomingTypeName);
}
uint32_t realSize = clsDesc.getNativeSize();
uint32_t numItems = data.size() / realSize;
data = bufferPropertyValue(clsDesc.getNativeSizeInfo(), data);
SetPropertyValue evt(toStream(instance), toStream(name), data, toStream(incomingTypeName), numItems);
return boolToError(handlePvdEvent(evt));
}
// Else if the property is very large (contact reports) you can send it in chunks.
virtual PvdError beginSetPropertyValue(const void* instance, String name, const NamespacedName& incomingTypeName)
{
PX_ASSERT(isInstanceValid(instance));
#if PX_DEBUG
PX_ASSERT(isClassExist(incomingTypeName));
PX_ASSERT(checkPropertyType(instance, name, incomingTypeName));
#endif
PX_ASSERT(mStreamState == DataStreamState::Open);
mStreamState = DataStreamState::SetPropertyValue;
{
ScopedMetaData meta(mMetaDataProvider);
mSPVClass = meta->findClass(incomingTypeName);
}
BeginSetPropertyValue evt(toStream(instance), toStream(name), toStream(incomingTypeName));
return boolToError(handlePvdEvent(evt));
}
virtual PvdError appendPropertyValueData(DataRef<const uint8_t> data)
{
uint32_t realSize = mSPVClass.getNativeSize();
uint32_t numItems = data.size() / realSize;
data = bufferPropertyValue(mSPVClass.getNativeSizeInfo(), data);
PX_ASSERT(mStreamState == DataStreamState::SetPropertyValue);
return boolToError(handlePvdEvent(AppendPropertyValueData(data, numItems)));
}
virtual PvdError endSetPropertyValue()
{
PX_ASSERT(mStreamState == DataStreamState::SetPropertyValue);
mStreamState = DataStreamState::Open;
return boolToError(handlePvdEvent(EndSetPropertyValue()));
}
#if PX_DEBUG
bool checkPropertyMessage(const void* instance, const NamespacedName& msgName)
{
int32_t clsId = mMetaDataProvider.getInstanceClassType(instance);
ScopedMetaData meta(mMetaDataProvider);
PropertyMessageDescription desc(meta->findPropertyMessage(msgName));
bool retval = meta->isDerivedFrom(clsId, desc.mClassId);
return retval;
}
#endif
DataRef<const uint8_t> bufferPropertyMessage(const PropertyMessageDescription& desc, DataRef<const uint8_t> data)
{
if(desc.mStringOffsets.size())
{
mSPVBuffer.clear();
mSPVBuffer.write(data.begin(), data.size());
PVD_FOREACH(idx, desc.mStringOffsets.size())
{
const char* strPtr;
physx::intrinsics::memCopy(&strPtr, data.begin() + desc.mStringOffsets[idx], sizeof(char*));
strPtr = nonNull(strPtr);
uint32_t len = safeStrLen(strPtr) + 1;
mSPVBuffer.write(strPtr, len);
}
data = DataRef<const uint8_t>(mSPVBuffer.begin(), mSPVBuffer.end());
}
return data;
}
virtual PvdError setPropertyMessage(const void* instance, const NamespacedName& msgName, DataRef<const uint8_t> data)
{
ScopedMetaData meta(mMetaDataProvider);
PX_ASSERT(isInstanceValid(instance));
#if PX_DEBUG
PX_ASSERT(messageExists(msgName));
PX_ASSERT(checkPropertyMessage(instance, msgName));
#endif
PropertyMessageDescription desc(meta->findPropertyMessage(msgName));
if(data.size() < desc.mMessageByteSize)
{
PX_ASSERT(false);
return PvdErrorType::ArgumentError;
}
data = bufferPropertyMessage(desc, data);
PX_ASSERT(mStreamState == DataStreamState::Open);
return boolToError(handlePvdEvent(SetPropertyMessage(toStream(instance), toStream(msgName), data)));
}
#if PX_DEBUG
bool checkBeginPropertyMessageGroup(const NamespacedName& msgName)
{
ScopedMetaData meta(mMetaDataProvider);
PropertyMessageDescription desc(meta->findPropertyMessage(msgName));
return desc.mStringOffsets.size() == 0;
}
#endif
// If you need to send of lot of identical messages, this avoids a hashtable lookup per message.
virtual PvdError beginPropertyMessageGroup(const NamespacedName& msgName)
{
#if PX_DEBUG
PX_ASSERT(messageExists(msgName));
PX_ASSERT(checkBeginPropertyMessageGroup(msgName));
#endif
PX_ASSERT(mStreamState == DataStreamState::Open);
mStreamState = DataStreamState::PropertyMessageGroup;
ScopedMetaData meta(mMetaDataProvider);
mMessageDesc = meta->findPropertyMessage(msgName);
return boolToError(handlePvdEvent(BeginPropertyMessageGroup(toStream(msgName))));
}
virtual PvdError sendPropertyMessageFromGroup(const void* instance, DataRef<const uint8_t> data)
{
PX_ASSERT(mStreamState == DataStreamState::PropertyMessageGroup);
PX_ASSERT(isInstanceValid(instance));
#if PX_DEBUG
PX_ASSERT(checkPropertyMessage(instance, mMessageDesc.mMessageName));
#endif
if(mMessageDesc.mMessageByteSize != data.size())
{
PX_ASSERT(false);
return PvdErrorType::ArgumentError;
}
if(data.size() < mMessageDesc.mMessageByteSize)
return PvdErrorType::ArgumentError;
data = bufferPropertyMessage(mMessageDesc, data);
return boolToError(handlePvdEvent(SendPropertyMessageFromGroup(toStream(instance), data)));
}
virtual PvdError endPropertyMessageGroup()
{
PX_ASSERT(mStreamState == DataStreamState::PropertyMessageGroup);
mStreamState = DataStreamState::Open;
return boolToError(handlePvdEvent(EndPropertyMessageGroup()));
}
virtual PvdError pushBackObjectRef(const void* instance, String propName, const void* data)
{
PX_ASSERT(isInstanceValid(instance));
PX_ASSERT(isInstanceValid(data));
PX_ASSERT(mStreamState == DataStreamState::Open);
return boolToError(handlePvdEvent(PushBackObjectRef(toStream(instance), toStream(propName), toStream(data))));
}
virtual PvdError removeObjectRef(const void* instance, String propName, const void* data)
{
PX_ASSERT(isInstanceValid(instance));
PX_ASSERT(isInstanceValid(data));
PX_ASSERT(mStreamState == DataStreamState::Open);
return boolToError(handlePvdEvent(RemoveObjectRef(toStream(instance), toStream(propName), toStream(data))));
}
// Instance elimination.
virtual PvdError destroyInstance(const void* instance)
{
PX_ASSERT(isInstanceValid(instance));
PX_ASSERT(mStreamState == DataStreamState::Open);
mMetaDataProvider.destroyInstance(instance);
return boolToError(handlePvdEvent(DestroyInstance(toStream(instance))));
}
// Profiling hooks
virtual PvdError beginSection(const void* instance, String name)
{
PX_ASSERT(mStreamState == DataStreamState::Open);
return boolToError(handlePvdEvent(
BeginSection(toStream(instance), toStream(name), PxTime::getCurrentCounterValue())));
}
virtual PvdError endSection(const void* instance, String name)
{
PX_ASSERT(mStreamState == DataStreamState::Open);
return boolToError(handlePvdEvent(
EndSection(toStream(instance), toStream(name), PxTime::getCurrentCounterValue())));
}
virtual PvdError originShift(const void* scene, PxVec3 shift)
{
PX_ASSERT(mStreamState == DataStreamState::Open);
return boolToError(handlePvdEvent(OriginShift(toStream(scene), shift)));
}
virtual void addProfileZone(void* zone, const char* name)
{
handlePvdEvent(AddProfileZone(toStream(zone), name));
}
virtual void addProfileZoneEvent(void* zone, const char* name, uint16_t eventId, bool compileTimeEnabled)
{
handlePvdEvent(AddProfileZoneEvent(toStream(zone), name, eventId, compileTimeEnabled));
}
// add a variable sized event
void addEvent(const EventSerializeable& evt, PvdCommStreamEventTypes::Enum evtType)
{
MeasureStream measure;
PvdCommStreamEventSink::writeStreamEvent(evt, evtType, measure);
EventGroup evtGroup(measure.mSize, 1, mStreamId, PxTime::getCurrentCounterValue());
EventStreamifier<PxPvdTransport> streamifier(mTransport.lock());
evtGroup.serialize(streamifier);
PvdCommStreamEventSink::writeStreamEvent(evt, evtType, mTransport);
mTransport.unlock();
}
void setIsTopLevelUIElement(const void* instance, bool topLevel)
{
addEvent(SetIsTopLevel(static_cast<uint64_t>(reinterpret_cast<size_t>(instance)), topLevel),
getCommStreamEventType<SetIsTopLevel>());
}
void sendErrorMessage(uint32_t code, const char* message, const char* file, uint32_t line)
{
addEvent(ErrorMessage(code, message, file, line), getCommStreamEventType<ErrorMessage>());
}
void updateCamera(const char* name, const PxVec3& origin, const PxVec3& up, const PxVec3& target)
{
addEvent(SetCamera(name, origin, up, target), getCommStreamEventType<SetCamera>());
}
template <typename TEventType>
bool handlePvdEvent(const TEventType& evt)
{
addEvent(evt, getCommStreamEventType<TEventType>());
return mConnected;
}
virtual PvdPropertyDefinitionHelper& getPropertyDefinitionHelper()
{
mPropertyDefinitionHelper.clearBufferedData();
return mPropertyDefinitionHelper;
}
virtual bool isConnected()
{
return mConnected;
}
virtual void* allocateMemForCmd(uint32_t length)
{
return mPvdCommandPool.allocate(length);
}
virtual void pushPvdCommand(PvdCommand& cmd)
{
mPvdCommandArray.pushBack(&cmd);
}
virtual void flushPvdCommand()
{
uint32_t cmdQueueSize = mPvdCommandArray.size();
for(uint32_t i = 0; i < cmdQueueSize; i++)
{
if(mPvdCommandArray[i])
{
// if(mPvdCommandArray[i]->canRun(*this))
mPvdCommandArray[i]->run(*this);
mPvdCommandArray[i]->~PvdCommand();
}
}
mPvdCommandArray.clear();
mPvdCommandPool.clear();
}
PX_NOCOPY(PvdOutStream)
};
}
PvdDataStream* PvdDataStream::create(PxPvd* pvd)
{
if(pvd == NULL)
{
PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "PvdDataStream::create - pvd must be non-NULL!");
return NULL;
}
PvdImpl* pvdImpl = static_cast<PvdImpl*>(pvd);
return PVD_NEW(PvdOutStream)(*pvdImpl->getTransport(), pvdImpl->getMetaDataProvider(), pvdImpl->getNextStreamId());
}
| 27,599 | C++ | 30.98146 | 121 | 0.744302 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxProfileEventBufferClientManager.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PX_PROFILE_EVENT_BUFFER_CLIENT_MANAGER_H
#define PX_PROFILE_EVENT_BUFFER_CLIENT_MANAGER_H
#include "PxProfileEventBufferClient.h"
namespace physx { namespace profile {
/**
\brief Manager keep collections of PxProfileEventBufferClient clients.
@see PxProfileEventBufferClient
*/
class PxProfileEventBufferClientManager
{
protected:
virtual ~PxProfileEventBufferClientManager(){}
public:
/**
\brief Adds new client.
\param inClient Client to add.
*/
virtual void addClient( PxProfileEventBufferClient& inClient ) = 0;
/**
\brief Removes a client.
\param inClient Client to remove.
*/
virtual void removeClient( PxProfileEventBufferClient& inClient ) = 0;
/**
\brief Check if manager has clients.
\return True if manager has added clients.
*/
virtual bool hasClients() const = 0;
};
/**
\brief Manager keep collections of PxProfileZoneClient clients.
@see PxProfileZoneClient
*/
class PxProfileZoneClientManager
{
protected:
virtual ~PxProfileZoneClientManager(){}
public:
/**
\brief Adds new client.
\param inClient Client to add.
*/
virtual void addClient( PxProfileZoneClient& inClient ) = 0;
/**
\brief Removes a client.
\param inClient Client to remove.
*/
virtual void removeClient( PxProfileZoneClient& inClient ) = 0;
/**
\brief Check if manager has clients.
\return True if manager has added clients.
*/
virtual bool hasClients() const = 0;
};
} }
#endif
| 3,029 | C | 30.894737 | 74 | 0.745791 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxProfileDataBuffer.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PROFILE_DATA_BUFFER_H
#define PX_PROFILE_DATA_BUFFER_H
#include "PxProfileAllocatorWrapper.h"
#include "PxProfileMemoryBuffer.h"
#include "PxProfileEventBufferClient.h"
namespace physx { namespace profile {
template<typename TMutex
, typename TScopedLock>
class DataBuffer //base class for buffers that cache data and then dump the data to clients.
{
public:
typedef TMutex TMutexType;
typedef TScopedLock TScopedLockType;
typedef PxProfileWrapperNamedAllocator TU8AllocatorType;
typedef MemoryBuffer<TU8AllocatorType > TMemoryBufferType;
typedef PxProfileArray<PxProfileEventBufferClient*> TBufferClientArray;
protected:
PxProfileAllocatorWrapper mWrapper;
TMemoryBufferType mDataArray;
TBufferClientArray mBufferClients;
uint32_t mBufferFullAmount;
EventContextInformation mEventContextInformation;
TMutexType* mBufferMutex;
volatile bool mHasClients;
EventSerializer<TMemoryBufferType > mSerializer;
public:
DataBuffer( PxAllocatorCallback* inFoundation
, uint32_t inBufferFullAmount
, TMutexType* inBufferMutex
, const char* inAllocationName )
: mWrapper( inFoundation )
, mDataArray( TU8AllocatorType( mWrapper, inAllocationName ) )
, mBufferClients( mWrapper )
, mBufferFullAmount( inBufferFullAmount )
, mBufferMutex( inBufferMutex )
, mHasClients( false )
, mSerializer( &mDataArray )
{
//The data array is never resized really. We ensure
//it is bigger than it will ever need to be.
mDataArray.reserve( inBufferFullAmount + 68 );
}
virtual ~DataBuffer()
{
while(mBufferClients.size() )
{
removeClient( *mBufferClients[0] );
}
}
PxProfileAllocatorWrapper& getWrapper() { return mWrapper; }
TMutexType* getBufferMutex() { return mBufferMutex; }
void setBufferMutex(TMutexType* mutex) { mBufferMutex = mutex; }
void addClient( PxProfileEventBufferClient& inClient )
{
TScopedLockType lock( mBufferMutex );
mBufferClients.pushBack( &inClient );
mHasClients = true;
}
void removeClient( PxProfileEventBufferClient& inClient )
{
TScopedLockType lock( mBufferMutex );
for ( uint32_t idx =0; idx < mBufferClients.size(); ++idx )
{
if (mBufferClients[idx] == &inClient )
{
inClient.handleClientRemoved();
mBufferClients.replaceWithLast( idx );
break;
}
}
mHasClients = mBufferClients.size() != 0;
}
bool hasClients() const
{
return mHasClients;
}
virtual void flushEvents()
{
TScopedLockType lock(mBufferMutex);
const uint8_t* theData = mDataArray.begin();
uint32_t theDataSize = mDataArray.size();
sendDataToClients(theData, theDataSize);
mDataArray.clear();
clearCachedData();
}
//Used for chaining together event buffers.
virtual void handleBufferFlush( const uint8_t* inData, uint32_t inDataSize )
{
TScopedLockType lock( mBufferMutex );
if ( inData && inDataSize )
{
clearCachedData();
if ( mDataArray.size() + inDataSize >= mBufferFullAmount )
flushEvents();
if ( inDataSize >= mBufferFullAmount )
sendDataToClients( inData, inDataSize );
else
mDataArray.write( inData, inDataSize );
}
}
protected:
virtual void clearCachedData()
{
}
private:
void sendDataToClients( const uint8_t* inData, uint32_t inDataSize )
{
uint32_t clientCount = mBufferClients.size();
for( uint32_t idx =0; idx < clientCount; ++idx )
mBufferClients[idx]->handleBufferFlush( inData, inDataSize );
}
};
}}
#endif
| 5,270 | C | 30.753012 | 93 | 0.725806 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxPvdBits.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PX_PVD_BITS_H
#define PX_PVD_BITS_H
#include "PxPvdObjectModelBaseTypes.h"
namespace physx
{
namespace pvdsdk
{
// Marshallers cannot assume src is aligned, but they can assume dest is aligned.
typedef void (*TSingleMarshaller)(const uint8_t* src, uint8_t* dest);
typedef void (*TBlockMarshaller)(const uint8_t* src, uint8_t* dest, uint32_t numItems);
template <uint8_t ByteCount>
static inline void doSwapBytes(uint8_t* __restrict inData)
{
for(uint32_t idx = 0; idx < ByteCount / 2; ++idx)
{
uint32_t endIdx = ByteCount - idx - 1;
uint8_t theTemp = inData[idx];
inData[idx] = inData[endIdx];
inData[endIdx] = theTemp;
}
}
template <uint8_t ByteCount>
static inline void doSwapBytes(uint8_t* __restrict inData, uint32_t itemCount)
{
uint8_t* end = inData + itemCount * ByteCount;
for(; inData < end; inData += ByteCount)
doSwapBytes<ByteCount>(inData);
}
static inline void swapBytes(uint8_t* __restrict dataPtr, uint32_t numBytes, uint32_t itemWidth)
{
uint32_t numItems = numBytes / itemWidth;
switch(itemWidth)
{
case 1:
break;
case 2:
doSwapBytes<2>(dataPtr, numItems);
break;
case 4:
doSwapBytes<4>(dataPtr, numItems);
break;
case 8:
doSwapBytes<8>(dataPtr, numItems);
break;
case 16:
doSwapBytes<16>(dataPtr, numItems);
break;
default:
PX_ASSERT(false);
break;
}
}
static inline void swapBytes(uint8_t&)
{
}
static inline void swapBytes(int8_t&)
{
}
static inline void swapBytes(uint16_t& inData)
{
doSwapBytes<2>(reinterpret_cast<uint8_t*>(&inData));
}
static inline void swapBytes(int16_t& inData)
{
doSwapBytes<2>(reinterpret_cast<uint8_t*>(&inData));
}
static inline void swapBytes(uint32_t& inData)
{
doSwapBytes<4>(reinterpret_cast<uint8_t*>(&inData));
}
static inline void swapBytes(int32_t& inData)
{
doSwapBytes<4>(reinterpret_cast<uint8_t*>(&inData));
}
static inline void swapBytes(float& inData)
{
doSwapBytes<4>(reinterpret_cast<uint8_t*>(&inData));
}
static inline void swapBytes(uint64_t& inData)
{
doSwapBytes<8>(reinterpret_cast<uint8_t*>(&inData));
}
static inline void swapBytes(int64_t& inData)
{
doSwapBytes<8>(reinterpret_cast<uint8_t*>(&inData));
}
static inline void swapBytes(double& inData)
{
doSwapBytes<8>(reinterpret_cast<uint8_t*>(&inData));
}
static inline bool checkLength(const uint8_t* inStart, const uint8_t* inStop, uint32_t inLength)
{
return static_cast<uint32_t>(inStop - inStart) >= inLength;
}
}
}
#endif
| 3,989 | C | 29 | 96 | 0.73803 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxPvdCommStreamEvents.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PX_PVD_COMM_STREAM_EVENTS_H
#define PX_PVD_COMM_STREAM_EVENTS_H
#include "foundation/PxVec3.h"
#include "foundation/PxFlags.h"
#include "foundation/PxTime.h"
#include "PxPvdObjectModelBaseTypes.h"
namespace physx
{
namespace pvdsdk
{
struct CommStreamFlagTypes
{
enum Enum
{
Is64BitPtr = 1
};
};
typedef PxFlags<CommStreamFlagTypes::Enum, uint32_t> CommStreamFlags;
template <typename TDataType>
struct PvdCommVariableSizedEventCheck
{
bool variable_size_check;
};
// Pick out the events that are possibly very large.
// This helps us keep our buffers close to the size the user requested.
#define DECLARE_TYPE_VARIABLE_SIZED(type) \
template <> \
struct PvdCommVariableSizedEventCheck<type> \
{ \
uint32_t variable_size_check; \
};
struct NameHandleValue;
struct StreamPropMessageArg;
struct StringHandleEvent;
struct CreateClass;
struct DeriveClass;
struct CreateProperty;
struct CreatePropertyMessage;
struct CreateInstance;
struct SetPropertyValue;
struct BeginSetPropertyValue;
struct AppendPropertyValueData;
struct EndSetPropertyValue;
struct SetPropertyMessage;
struct BeginPropertyMessageGroup;
struct SendPropertyMessageFromGroup;
struct EndPropertyMessageGroup;
struct CreateDestroyInstanceProperty;
struct PushBackObjectRef;
struct RemoveObjectRef;
struct BeginSection;
struct EndSection;
struct SetPickable;
struct SetColor;
struct SetIsTopLevel;
struct SetCamera;
struct AddProfileZone;
struct AddProfileZoneEvent;
struct StreamEndEvent;
struct ErrorMessage;
struct OriginShift;
struct DestroyInstance;
#define DECLARE_COMM_STREAM_EVENTS \
\
DECLARE_PVD_COMM_STREAM_EVENT(StringHandleEvent) \
DECLARE_PVD_COMM_STREAM_EVENT(CreateClass) \
DECLARE_PVD_COMM_STREAM_EVENT(DeriveClass) \
DECLARE_PVD_COMM_STREAM_EVENT(CreateProperty) \
DECLARE_PVD_COMM_STREAM_EVENT(CreatePropertyMessage) \
DECLARE_PVD_COMM_STREAM_EVENT(CreateInstance) \
DECLARE_PVD_COMM_STREAM_EVENT(SetPropertyValue) \
DECLARE_PVD_COMM_STREAM_EVENT(BeginSetPropertyValue) \
DECLARE_PVD_COMM_STREAM_EVENT(AppendPropertyValueData) \
DECLARE_PVD_COMM_STREAM_EVENT(EndSetPropertyValue) \
DECLARE_PVD_COMM_STREAM_EVENT(SetPropertyMessage) \
DECLARE_PVD_COMM_STREAM_EVENT(BeginPropertyMessageGroup) \
DECLARE_PVD_COMM_STREAM_EVENT(SendPropertyMessageFromGroup) \
DECLARE_PVD_COMM_STREAM_EVENT(EndPropertyMessageGroup) \
DECLARE_PVD_COMM_STREAM_EVENT(DestroyInstance) \
DECLARE_PVD_COMM_STREAM_EVENT(PushBackObjectRef) \
DECLARE_PVD_COMM_STREAM_EVENT(RemoveObjectRef) \
DECLARE_PVD_COMM_STREAM_EVENT(BeginSection) \
DECLARE_PVD_COMM_STREAM_EVENT(EndSection) \
DECLARE_PVD_COMM_STREAM_EVENT(SetPickable) \
DECLARE_PVD_COMM_STREAM_EVENT(SetColor) \
DECLARE_PVD_COMM_STREAM_EVENT(SetIsTopLevel) \
DECLARE_PVD_COMM_STREAM_EVENT(SetCamera) \
DECLARE_PVD_COMM_STREAM_EVENT(AddProfileZone) \
DECLARE_PVD_COMM_STREAM_EVENT(AddProfileZoneEvent) \
DECLARE_PVD_COMM_STREAM_EVENT(StreamEndEvent) \
DECLARE_PVD_COMM_STREAM_EVENT(ErrorMessage) \
DECLARE_PVD_COMM_STREAM_EVENT_NO_COMMA(OriginShift)
struct PvdCommStreamEventTypes
{
enum Enum
{
Unknown = 0,
#define DECLARE_PVD_COMM_STREAM_EVENT(x) x,
#define DECLARE_PVD_COMM_STREAM_EVENT_NO_COMMA(x) x
DECLARE_COMM_STREAM_EVENTS
#undef DECLARE_PVD_COMM_STREAM_EVENT_NO_COMMA
#undef DECLARE_PVD_COMM_STREAM_EVENT
, Last
};
};
template <typename TDataType>
struct DatatypeToCommEventType
{
bool compile_error;
};
template <PvdCommStreamEventTypes::Enum TEnumType>
struct CommEventTypeToDatatype
{
bool compile_error;
};
#define DECLARE_PVD_COMM_STREAM_EVENT(x) \
template <> \
struct DatatypeToCommEventType<x> \
{ \
enum Enum \
{ \
EEventTypeMap = PvdCommStreamEventTypes::x \
}; \
}; \
template <> \
struct CommEventTypeToDatatype<PvdCommStreamEventTypes::x> \
{ \
typedef x TEventType; \
};
#define DECLARE_PVD_COMM_STREAM_EVENT_NO_COMMA(x) \
\
template<> struct DatatypeToCommEventType<x> \
{ \
enum Enum \
{ \
EEventTypeMap = PvdCommStreamEventTypes::x \
}; \
}; \
\
template<> struct CommEventTypeToDatatype<PvdCommStreamEventTypes::x> \
{ \
typedef x TEventType; \
};
DECLARE_COMM_STREAM_EVENTS
#undef DECLARE_PVD_COMM_STREAM_EVENT_NO_COMMA
#undef DECLARE_PVD_COMM_STREAM_EVENT
template <typename TDataType>
PvdCommStreamEventTypes::Enum getCommStreamEventType()
{
return static_cast<PvdCommStreamEventTypes::Enum>(DatatypeToCommEventType<TDataType>::EEventTypeMap);
}
struct StreamNamespacedName
{
StringHandle mNamespace; // StringHandle handles
StringHandle mName;
StreamNamespacedName(StringHandle ns = 0, StringHandle nm = 0) : mNamespace(ns), mName(nm)
{
}
};
class EventSerializeable;
class PvdEventSerializer
{
protected:
virtual ~PvdEventSerializer()
{
}
public:
virtual void streamify(uint8_t& val) = 0;
virtual void streamify(uint16_t& val) = 0;
virtual void streamify(uint32_t& val) = 0;
virtual void streamify(float& val) = 0;
virtual void streamify(uint64_t& val) = 0;
virtual void streamify(String& val) = 0;
virtual void streamify(DataRef<const uint8_t>& data) = 0;
virtual void streamify(DataRef<NameHandleValue>& data) = 0;
virtual void streamify(DataRef<StreamPropMessageArg>& data) = 0;
virtual void streamify(DataRef<StringHandle>& data) = 0;
void streamify(StringHandle& hdl)
{
streamify(hdl.mHandle);
}
void streamify(CommStreamFlags& flags)
{
uint32_t val(flags);
streamify(val);
flags = CommStreamFlags(val);
}
void streamify(PvdCommStreamEventTypes::Enum& val)
{
uint8_t detyped = static_cast<uint8_t>(val);
streamify(detyped);
val = static_cast<PvdCommStreamEventTypes::Enum>(detyped);
}
void streamify(PropertyType::Enum& val)
{
uint8_t detyped = static_cast<uint8_t>(val);
streamify(detyped);
val = static_cast<PropertyType::Enum>(detyped);
}
void streamify(bool& val)
{
uint8_t detyped = uint8_t(val ? 1 : 0);
streamify(detyped);
val = detyped ? true : false;
}
void streamify(StreamNamespacedName& name)
{
streamify(name.mNamespace);
streamify(name.mName);
}
void streamify(PvdColor& color)
{
streamify(color.r);
streamify(color.g);
streamify(color.b);
streamify(color.a);
}
void streamify(PxVec3& vec)
{
streamify(vec.x);
streamify(vec.y);
streamify(vec.z);
}
static uint32_t measure(const EventSerializeable& evt);
};
class EventSerializeable
{
protected:
virtual ~EventSerializeable()
{
}
public:
virtual void serialize(PvdEventSerializer& serializer) = 0;
};
/** Numbers generated from random.org
129919156 17973702 401496246 144984007 336950759
907025328 837150850 679717896 601529147 269478202
*/
struct StreamInitialization : public EventSerializeable
{
static uint32_t getStreamId()
{
return 837150850;
}
static uint32_t getStreamVersion()
{
return 1;
}
uint32_t mStreamId;
uint32_t mStreamVersion;
uint64_t mTimestampNumerator;
uint64_t mTimestampDenominator;
CommStreamFlags mStreamFlags;
StreamInitialization()
: mStreamId(getStreamId())
, mStreamVersion(getStreamVersion())
, mTimestampNumerator(physx::PxTime::getCounterFrequency().mNumerator * 10)
, mTimestampDenominator(physx::PxTime::getCounterFrequency().mDenominator)
, mStreamFlags(sizeof(void*) == 4 ? 0 : 1)
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mStreamId);
s.streamify(mStreamVersion);
s.streamify(mTimestampNumerator);
s.streamify(mTimestampDenominator);
s.streamify(mStreamFlags);
}
};
struct EventGroup : public EventSerializeable
{
uint32_t mDataSize; // in bytes, data directly follows this header
uint32_t mNumEvents;
uint64_t mStreamId;
uint64_t mTimestamp;
EventGroup(uint32_t dataSize = 0, uint32_t numEvents = 0, uint64_t streamId = 0, uint64_t ts = 0)
: mDataSize(dataSize), mNumEvents(numEvents), mStreamId(streamId), mTimestamp(ts)
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mDataSize);
s.streamify(mNumEvents);
s.streamify(mStreamId);
s.streamify(mTimestamp);
}
};
struct StringHandleEvent : public EventSerializeable
{
String mString;
uint32_t mHandle;
StringHandleEvent(String str, uint32_t hdl) : mString(str), mHandle(hdl)
{
}
StringHandleEvent()
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mString);
s.streamify(mHandle);
}
};
DECLARE_TYPE_VARIABLE_SIZED(StringHandleEvent)
typedef uint64_t Timestamp;
struct CreateClass : public EventSerializeable
{
StreamNamespacedName mName;
CreateClass(StreamNamespacedName nm) : mName(nm)
{
}
CreateClass()
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mName);
}
};
struct DeriveClass : public EventSerializeable
{
StreamNamespacedName mParent;
StreamNamespacedName mChild;
DeriveClass(StreamNamespacedName p, StreamNamespacedName c) : mParent(p), mChild(c)
{
}
DeriveClass()
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mParent);
s.streamify(mChild);
}
};
struct NameHandleValue : public EventSerializeable
{
StringHandle mName;
uint32_t mValue;
NameHandleValue(StringHandle name, uint32_t val) : mName(name), mValue(val)
{
}
NameHandleValue()
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mName);
s.streamify(mValue);
}
};
/*virtual PvdError createProperty( StreamNamespacedName clsName, StringHandle name, StringHandle semantic
, StreamNamespacedName dtypeName, PropertyType::Enum propertyType
, DataRef<NamedValue> values = DataRef<NamedValue>() ) = 0; */
struct CreateProperty : public EventSerializeable
{
StreamNamespacedName mClass;
StringHandle mName;
StringHandle mSemantic;
StreamNamespacedName mDatatypeName;
PropertyType::Enum mPropertyType;
DataRef<NameHandleValue> mValues;
CreateProperty(StreamNamespacedName cls, StringHandle name, StringHandle semantic, StreamNamespacedName dtypeName,
PropertyType::Enum ptype, DataRef<NameHandleValue> values)
: mClass(cls), mName(name), mSemantic(semantic), mDatatypeName(dtypeName), mPropertyType(ptype), mValues(values)
{
}
CreateProperty()
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mClass);
s.streamify(mName);
s.streamify(mSemantic);
s.streamify(mDatatypeName);
s.streamify(mPropertyType);
s.streamify(mValues);
}
};
struct StreamPropMessageArg : public EventSerializeable
{
StringHandle mPropertyName;
StreamNamespacedName mDatatypeName;
uint32_t mMessageOffset;
uint32_t mByteSize;
StreamPropMessageArg(StringHandle pname, StreamNamespacedName dtypeName, uint32_t offset, uint32_t byteSize)
: mPropertyName(pname), mDatatypeName(dtypeName), mMessageOffset(offset), mByteSize(byteSize)
{
}
StreamPropMessageArg()
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mPropertyName);
s.streamify(mDatatypeName);
s.streamify(mMessageOffset);
s.streamify(mByteSize);
}
};
/*
virtual PvdError createPropertyMessage( StreamNamespacedName cls, StreamNamespacedName msgName
, DataRef<PropertyMessageArg> entries, uint32_t messageSizeInBytes ) =
0;*/
struct CreatePropertyMessage : public EventSerializeable
{
StreamNamespacedName mClass;
StreamNamespacedName mMessageName;
DataRef<StreamPropMessageArg> mMessageEntries;
uint32_t mMessageByteSize;
CreatePropertyMessage(StreamNamespacedName cls, StreamNamespacedName msgName, DataRef<StreamPropMessageArg> propArg,
uint32_t messageByteSize)
: mClass(cls), mMessageName(msgName), mMessageEntries(propArg), mMessageByteSize(messageByteSize)
{
}
CreatePropertyMessage()
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mClass);
s.streamify(mMessageName);
s.streamify(mMessageEntries);
s.streamify(mMessageByteSize);
}
};
/**Changing immediate data on instances*/
// virtual PvdError createInstance( StreamNamespacedName cls, uint64_t instance ) = 0;
struct CreateInstance : public EventSerializeable
{
StreamNamespacedName mClass;
uint64_t mInstanceId;
CreateInstance(StreamNamespacedName cls, uint64_t streamId) : mClass(cls), mInstanceId(streamId)
{
}
CreateInstance()
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mClass);
s.streamify(mInstanceId);
}
};
// virtual PvdError setPropertyValue( uint64_t instance, StringHandle name, DataRef<const uint8_t> data,
// StreamNamespacedName incomingTypeName ) = 0;
struct SetPropertyValue : public EventSerializeable
{
uint64_t mInstanceId;
StringHandle mPropertyName;
DataRef<const uint8_t> mData;
StreamNamespacedName mIncomingTypeName;
uint32_t mNumItems;
SetPropertyValue(uint64_t instance, StringHandle name, DataRef<const uint8_t> data,
StreamNamespacedName incomingTypeName, uint32_t numItems)
: mInstanceId(instance), mPropertyName(name), mData(data), mIncomingTypeName(incomingTypeName), mNumItems(numItems)
{
}
SetPropertyValue()
{
}
void serializeBeginning(PvdEventSerializer& s)
{
s.streamify(mInstanceId);
s.streamify(mPropertyName);
s.streamify(mIncomingTypeName);
s.streamify(mNumItems);
}
void serialize(PvdEventSerializer& s)
{
serializeBeginning(s);
s.streamify(mData);
}
};
DECLARE_TYPE_VARIABLE_SIZED(SetPropertyValue)
struct BeginSetPropertyValue : public EventSerializeable
{
uint64_t mInstanceId;
StringHandle mPropertyName;
StreamNamespacedName mIncomingTypeName;
BeginSetPropertyValue(uint64_t instance, StringHandle name, StreamNamespacedName incomingTypeName)
: mInstanceId(instance), mPropertyName(name), mIncomingTypeName(incomingTypeName)
{
}
BeginSetPropertyValue()
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mInstanceId);
s.streamify(mPropertyName);
s.streamify(mIncomingTypeName);
}
};
// virtual PvdError appendPropertyValueData( DataRef<const uint8_t> data ) = 0;
struct AppendPropertyValueData : public EventSerializeable
{
DataRef<const uint8_t> mData;
uint32_t mNumItems;
AppendPropertyValueData(DataRef<const uint8_t> data, uint32_t numItems) : mData(data), mNumItems(numItems)
{
}
AppendPropertyValueData()
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mData);
s.streamify(mNumItems);
}
};
DECLARE_TYPE_VARIABLE_SIZED(AppendPropertyValueData)
// virtual PvdError endSetPropertyValue() = 0;
struct EndSetPropertyValue : public EventSerializeable
{
EndSetPropertyValue()
{
}
void serialize(PvdEventSerializer&)
{
}
};
// virtual PvdError setPropertyMessage( uint64_t instance, StreamNamespacedName msgName, DataRef<const uint8_t> data ) =
// 0;
struct SetPropertyMessage : public EventSerializeable
{
uint64_t mInstanceId;
StreamNamespacedName mMessageName;
DataRef<const uint8_t> mData;
SetPropertyMessage(uint64_t instance, StreamNamespacedName msgName, DataRef<const uint8_t> data)
: mInstanceId(instance), mMessageName(msgName), mData(data)
{
}
SetPropertyMessage()
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mInstanceId);
s.streamify(mMessageName);
s.streamify(mData);
}
};
DECLARE_TYPE_VARIABLE_SIZED(SetPropertyMessage)
// virtual PvdError beginPropertyMessageGroup( StreamNamespacedName msgName ) = 0;
struct BeginPropertyMessageGroup : public EventSerializeable
{
StreamNamespacedName mMsgName;
BeginPropertyMessageGroup(StreamNamespacedName msgName) : mMsgName(msgName)
{
}
BeginPropertyMessageGroup()
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mMsgName);
}
};
// virtual PvdError sendPropertyMessageFromGroup( uint64_t instance, DataRef<const uint8_t*> data ) = 0;
struct SendPropertyMessageFromGroup : public EventSerializeable
{
uint64_t mInstance;
DataRef<const uint8_t> mData;
SendPropertyMessageFromGroup(uint64_t instance, DataRef<const uint8_t> data) : mInstance(instance), mData(data)
{
}
SendPropertyMessageFromGroup()
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mInstance);
s.streamify(mData);
}
};
DECLARE_TYPE_VARIABLE_SIZED(SendPropertyMessageFromGroup)
// virtual PvdError endPropertyMessageGroup() = 0;
struct EndPropertyMessageGroup : public EventSerializeable
{
EndPropertyMessageGroup()
{
}
void serialize(PvdEventSerializer&)
{
}
};
struct PushBackObjectRef : public EventSerializeable
{
uint64_t mInstanceId;
StringHandle mProperty;
uint64_t mObjectRef;
PushBackObjectRef(uint64_t instId, StringHandle prop, uint64_t objRef)
: mInstanceId(instId), mProperty(prop), mObjectRef(objRef)
{
}
PushBackObjectRef()
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mInstanceId);
s.streamify(mProperty);
s.streamify(mObjectRef);
}
};
struct RemoveObjectRef : public EventSerializeable
{
uint64_t mInstanceId;
StringHandle mProperty;
uint64_t mObjectRef;
RemoveObjectRef(uint64_t instId, StringHandle prop, uint64_t objRef)
: mInstanceId(instId), mProperty(prop), mObjectRef(objRef)
{
}
RemoveObjectRef()
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mInstanceId);
s.streamify(mProperty);
s.streamify(mObjectRef);
}
};
// virtual PvdError destroyInstance( uint64_t key ) = 0;
struct DestroyInstance : public EventSerializeable
{
uint64_t mInstanceId;
DestroyInstance(uint64_t instance) : mInstanceId(instance)
{
}
DestroyInstance()
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mInstanceId);
}
};
// virtual PvdError beginSection( uint64_t sectionId, StringHandle name ) = 0;
struct BeginSection : public EventSerializeable
{
uint64_t mSectionId;
StringHandle mName;
Timestamp mTimestamp;
BeginSection(uint64_t sectionId, StringHandle name, uint64_t timestamp)
: mSectionId(sectionId), mName(name), mTimestamp(timestamp)
{
}
BeginSection()
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mSectionId);
s.streamify(mName);
s.streamify(mTimestamp);
}
};
// virtual PvdError endSection( uint64_t sectionId, StringHandle name ) = 0;
struct EndSection : public EventSerializeable
{
uint64_t mSectionId;
StringHandle mName;
Timestamp mTimestamp;
EndSection(uint64_t sectionId, StringHandle name, uint64_t timestamp)
: mSectionId(sectionId), mName(name), mTimestamp(timestamp)
{
}
EndSection()
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mSectionId);
s.streamify(mName);
s.streamify(mTimestamp);
}
};
// virtual void setPickable( void* instance, bool pickable ) = 0;
struct SetPickable : public EventSerializeable
{
uint64_t mInstanceId;
bool mPickable;
SetPickable(uint64_t instId, bool pick) : mInstanceId(instId), mPickable(pick)
{
}
SetPickable()
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mInstanceId);
s.streamify(mPickable);
}
};
// virtual void setColor( void* instance, const PvdColor& color ) = 0;
struct SetColor : public EventSerializeable
{
uint64_t mInstanceId;
PvdColor mColor;
SetColor(uint64_t instId, PvdColor color) : mInstanceId(instId), mColor(color)
{
}
SetColor()
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mInstanceId);
s.streamify(mColor);
}
};
// virtual void setColor( void* instance, const PvdColor& color ) = 0;
struct SetIsTopLevel : public EventSerializeable
{
uint64_t mInstanceId;
bool mIsTopLevel;
SetIsTopLevel(uint64_t instId, bool topLevel) : mInstanceId(instId), mIsTopLevel(topLevel)
{
}
SetIsTopLevel() : mIsTopLevel(false)
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mInstanceId);
s.streamify(mIsTopLevel);
}
};
struct SetCamera : public EventSerializeable
{
String mName;
PxVec3 mPosition;
PxVec3 mUp;
PxVec3 mTarget;
SetCamera(String name, const PxVec3& pos, const PxVec3& up, const PxVec3& target)
: mName(name), mPosition(pos), mUp(up), mTarget(target)
{
}
SetCamera() : mName(NULL)
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mName);
s.streamify(mPosition);
s.streamify(mUp);
s.streamify(mTarget);
}
};
struct ErrorMessage : public EventSerializeable
{
uint32_t mCode;
String mMessage;
String mFile;
uint32_t mLine;
ErrorMessage(uint32_t code, String message, String file, uint32_t line)
: mCode(code), mMessage(message), mFile(file), mLine(line)
{
}
ErrorMessage() : mMessage(NULL), mFile(NULL)
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mCode);
s.streamify(mMessage);
s.streamify(mFile);
s.streamify(mLine);
}
};
struct AddProfileZone : public EventSerializeable
{
uint64_t mInstanceId;
String mName;
AddProfileZone(uint64_t iid, String nm) : mInstanceId(iid), mName(nm)
{
}
AddProfileZone() : mName(NULL)
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mInstanceId);
s.streamify(mName);
}
};
struct AddProfileZoneEvent : public EventSerializeable
{
uint64_t mInstanceId;
String mName;
uint16_t mEventId;
bool mCompileTimeEnabled;
AddProfileZoneEvent(uint64_t iid, String nm, uint16_t eid, bool cte)
: mInstanceId(iid), mName(nm), mEventId(eid), mCompileTimeEnabled(cte)
{
}
AddProfileZoneEvent()
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mInstanceId);
s.streamify(mName);
s.streamify(mEventId);
s.streamify(mCompileTimeEnabled);
}
};
struct StreamEndEvent : public EventSerializeable
{
String mName;
StreamEndEvent() : mName("StreamEnd")
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mName);
}
};
struct OriginShift : public EventSerializeable
{
uint64_t mInstanceId;
PxVec3 mShift;
OriginShift(uint64_t iid, const PxVec3& shift) : mInstanceId(iid), mShift(shift)
{
}
OriginShift()
{
}
void serialize(PvdEventSerializer& s)
{
s.streamify(mInstanceId);
s.streamify(mShift);
}
};
} // pvdsdk
} // physx
#endif
| 25,795 | C | 25.109312 | 120 | 0.673231 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxPvdProfileZoneClient.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "PxPvdImpl.h"
#include "PxPvdProfileZoneClient.h"
#include "PxPvdProfileZone.h"
namespace physx
{
namespace pvdsdk
{
struct ProfileZoneClient : public profile::PxProfileZoneClient, public PxUserAllocated
{
profile::PxProfileZone& mZone;
PvdDataStream& mStream;
ProfileZoneClient(profile::PxProfileZone& zone, PvdDataStream& stream) : mZone(zone), mStream(stream)
{
}
~ProfileZoneClient()
{
mZone.removeClient(*this);
}
virtual void createInstance()
{
mStream.addProfileZone(&mZone, mZone.getName());
mStream.createInstance(&mZone);
mZone.addClient(*this);
profile::PxProfileNames names(mZone.getProfileNames());
PVD_FOREACH(idx, names.eventCount)
{
handleEventAdded(names.events[idx]);
}
}
virtual void handleEventAdded(const profile::PxProfileEventName& inName)
{
mStream.addProfileZoneEvent(&mZone, inName.name, inName.eventId.eventId, inName.eventId.compileTimeEnabled);
}
virtual void handleBufferFlush(const uint8_t* inData, uint32_t inLength)
{
mStream.setPropertyValue(&mZone, "events", inData, inLength);
}
virtual void handleClientRemoved()
{
mStream.destroyInstance(&mZone);
}
private:
ProfileZoneClient& operator=(const ProfileZoneClient&);
};
}
}
using namespace physx;
using namespace pvdsdk;
PvdProfileZoneClient::PvdProfileZoneClient(PvdImpl& pvd) : mSDKPvd(pvd), mPvdDataStream(NULL), mIsConnected(false)
{
}
PvdProfileZoneClient::~PvdProfileZoneClient()
{
mSDKPvd.removeClient(this);
// all zones should removed
PX_ASSERT(mProfileZoneClients.size() == 0);
}
PvdDataStream* PvdProfileZoneClient::getDataStream()
{
return mPvdDataStream;
}
bool PvdProfileZoneClient::isConnected() const
{
return mIsConnected;
}
void PvdProfileZoneClient::onPvdConnected()
{
if(mIsConnected)
return;
mIsConnected = true;
mPvdDataStream = PvdDataStream::create(&mSDKPvd);
}
void PvdProfileZoneClient::onPvdDisconnected()
{
if(!mIsConnected)
return;
mIsConnected = false;
flush();
mPvdDataStream->release();
mPvdDataStream = NULL;
}
void PvdProfileZoneClient::flush()
{
PVD_FOREACH(idx, mProfileZoneClients.size())
mProfileZoneClients[idx]->mZone.flushProfileEvents();
}
void PvdProfileZoneClient::onZoneAdded(profile::PxProfileZone& zone)
{
PX_ASSERT(mIsConnected);
ProfileZoneClient* client = PVD_NEW(ProfileZoneClient)(zone, *mPvdDataStream);
mMutex.lock();
client->createInstance();
mProfileZoneClients.pushBack(client);
mMutex.unlock();
}
void PvdProfileZoneClient::onZoneRemoved(profile::PxProfileZone& zone)
{
for(uint32_t i = 0; i < mProfileZoneClients.size(); i++)
{
if(&zone == &mProfileZoneClients[i]->mZone)
{
mMutex.lock();
ProfileZoneClient* client = mProfileZoneClients[i];
mProfileZoneClients.replaceWithLast(i);
PVD_DELETE(client);
mMutex.unlock();
return;
}
}
}
| 4,503 | C++ | 26.975155 | 114 | 0.758383 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxProfileEventBufferClient.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PX_PROFILE_EVENT_BUFFER_CLIENT_H
#define PX_PROFILE_EVENT_BUFFER_CLIENT_H
#include "PxProfileEventNames.h"
namespace physx { namespace profile {
/**
\brief Client handles the data when an event buffer flushes. This data
can be parsed (PxProfileEventHandler.h) as a binary set of events.
*/
class PxProfileEventBufferClient
{
protected:
virtual ~PxProfileEventBufferClient(){}
public:
/**
\brief Callback when the event buffer is full. This data is serialized profile events
and can be read back using: PxProfileEventHandler::parseEventBuffer.
\param inData Provided buffer data.
\param inLength Data length.
@see PxProfileEventHandler::parseEventBuffer.
*/
virtual void handleBufferFlush( const uint8_t* inData, uint32_t inLength ) = 0;
/**
\brief Happens if something removes all the clients from the manager.
*/
virtual void handleClientRemoved() = 0;
};
/**
\brief Client handles new profile event add.
*/
class PxProfileZoneClient : public PxProfileEventBufferClient
{
protected:
virtual ~PxProfileZoneClient(){}
public:
/**
\brief Callback when new profile event is added.
\param inName Added profile event name.
*/
virtual void handleEventAdded( const PxProfileEventName& inName ) = 0;
};
} }
#endif
| 2,848 | C | 34.172839 | 87 | 0.754565 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxPvdUserRenderImpl.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PX_PVD_USER_RENDER_IMPL_H
#define PX_PVD_USER_RENDER_IMPL_H
#include "PxPvdUserRenderer.h"
namespace physx
{
namespace pvdsdk
{
struct PvdUserRenderTypes
{
enum Enum
{
Unknown = 0,
#define DECLARE_PVD_IMMEDIATE_RENDER_TYPE(type) type,
#define DECLARE_PVD_IMMEDIATE_RENDER_TYPE_NO_COMMA(type) type
#include "PxPvdUserRenderTypes.h"
#undef DECLARE_PVD_IMMEDIATE_RENDER_TYPE_NO_COMMA
#undef DECLARE_PVD_IMMEDIATE_RENDER_TYPE
};
};
class RenderSerializer
{
protected:
virtual ~RenderSerializer()
{
}
public:
virtual void streamify(uint64_t& val) = 0;
virtual void streamify(float& val) = 0;
virtual void streamify(uint32_t& val) = 0;
virtual void streamify(uint8_t& val) = 0;
virtual void streamify(DataRef<uint8_t>& val) = 0;
virtual void streamify(DataRef<PxDebugPoint>& val) = 0;
virtual void streamify(DataRef<PxDebugLine>& val) = 0;
virtual void streamify(DataRef<PxDebugTriangle>& val) = 0;
virtual void streamify(PxDebugText& val) = 0;
virtual bool isGood() = 0;
virtual uint32_t hasData() = 0;
void streamify(PvdUserRenderTypes::Enum& val)
{
uint8_t data = static_cast<uint8_t>(val);
streamify(data);
val = static_cast<PvdUserRenderTypes::Enum>(data);
}
void streamify(PxVec3& val)
{
streamify(val[0]);
streamify(val[1]);
streamify(val[2]);
}
void streamify(PvdColor& val)
{
streamify(val.r);
streamify(val.g);
streamify(val.b);
streamify(val.a);
}
void streamify(PxTransform& val)
{
streamify(val.q.x);
streamify(val.q.y);
streamify(val.q.z);
streamify(val.q.w);
streamify(val.p.x);
streamify(val.p.y);
streamify(val.p.z);
}
void streamify(bool& val)
{
uint8_t tempVal = uint8_t(val ? 1 : 0);
streamify(tempVal);
val = tempVal ? true : false;
}
};
template <typename TBulkRenderType>
struct BulkRenderEvent
{
DataRef<TBulkRenderType> mData;
BulkRenderEvent(const TBulkRenderType* data, uint32_t count) : mData(data, count)
{
}
BulkRenderEvent()
{
}
void serialize(RenderSerializer& serializer)
{
serializer.streamify(mData);
}
};
struct SetInstanceIdRenderEvent
{
uint64_t mInstanceId;
SetInstanceIdRenderEvent(uint64_t iid) : mInstanceId(iid)
{
}
SetInstanceIdRenderEvent()
{
}
void serialize(RenderSerializer& serializer)
{
serializer.streamify(mInstanceId);
}
};
struct PointsRenderEvent : BulkRenderEvent<PxDebugPoint>
{
PointsRenderEvent(const PxDebugPoint* data, uint32_t count) : BulkRenderEvent<PxDebugPoint>(data, count)
{
}
PointsRenderEvent()
{
}
};
struct LinesRenderEvent : BulkRenderEvent<PxDebugLine>
{
LinesRenderEvent(const PxDebugLine* data, uint32_t count) : BulkRenderEvent<PxDebugLine>(data, count)
{
}
LinesRenderEvent()
{
}
};
struct TrianglesRenderEvent : BulkRenderEvent<PxDebugTriangle>
{
TrianglesRenderEvent(const PxDebugTriangle* data, uint32_t count) : BulkRenderEvent<PxDebugTriangle>(data, count)
{
}
TrianglesRenderEvent()
{
}
};
struct DebugRenderEvent
{
DataRef<PxDebugPoint> mPointData;
DataRef<PxDebugLine> mLineData;
DataRef<PxDebugTriangle> mTriangleData;
DebugRenderEvent(const PxDebugPoint* pointData, uint32_t pointCount, const PxDebugLine* lineData,
uint32_t lineCount, const PxDebugTriangle* triangleData, uint32_t triangleCount)
: mPointData(pointData, pointCount), mLineData(lineData, lineCount), mTriangleData(triangleData, triangleCount)
{
}
DebugRenderEvent()
{
}
void serialize(RenderSerializer& serializer)
{
serializer.streamify(mPointData);
serializer.streamify(mLineData);
serializer.streamify(mTriangleData);
}
};
struct TextRenderEvent
{
PxDebugText mText;
TextRenderEvent(const PxDebugText& text)
{
mText.color = text.color;
mText.position = text.position;
mText.size = text.size;
mText.string = text.string;
}
TextRenderEvent()
{
}
void serialize(RenderSerializer& serializer)
{
serializer.streamify(mText);
}
};
struct JointFramesRenderEvent
{
PxTransform parent;
PxTransform child;
JointFramesRenderEvent(const PxTransform& p, const PxTransform& c) : parent(p), child(c)
{
}
JointFramesRenderEvent()
{
}
void serialize(RenderSerializer& serializer)
{
serializer.streamify(parent);
serializer.streamify(child);
}
};
struct LinearLimitRenderEvent
{
PxTransform t0;
PxTransform t1;
float value;
bool active;
LinearLimitRenderEvent(const PxTransform& _t0, const PxTransform& _t1, float _value, bool _active)
: t0(_t0), t1(_t1), value(_value), active(_active)
{
}
LinearLimitRenderEvent()
{
}
void serialize(RenderSerializer& serializer)
{
serializer.streamify(t0);
serializer.streamify(t1);
serializer.streamify(value);
serializer.streamify(active);
}
};
struct AngularLimitRenderEvent
{
PxTransform t0;
float lower;
float upper;
bool active;
AngularLimitRenderEvent(const PxTransform& _t0, float _lower, float _upper, bool _active)
: t0(_t0), lower(_lower), upper(_upper), active(_active)
{
}
AngularLimitRenderEvent()
{
}
void serialize(RenderSerializer& serializer)
{
serializer.streamify(t0);
serializer.streamify(lower);
serializer.streamify(upper);
serializer.streamify(active);
}
};
struct LimitConeRenderEvent
{
PxTransform t;
float ySwing;
float zSwing;
bool active;
LimitConeRenderEvent(const PxTransform& _t, float _ySwing, float _zSwing, bool _active)
: t(_t), ySwing(_ySwing), zSwing(_zSwing), active(_active)
{
}
LimitConeRenderEvent()
{
}
void serialize(RenderSerializer& serializer)
{
serializer.streamify(t);
serializer.streamify(ySwing);
serializer.streamify(zSwing);
serializer.streamify(active);
}
};
struct DoubleConeRenderEvent
{
PxTransform t;
float angle;
bool active;
DoubleConeRenderEvent(const PxTransform& _t, float _angle, bool _active) : t(_t), angle(_angle), active(_active)
{
}
DoubleConeRenderEvent()
{
}
void serialize(RenderSerializer& serializer)
{
serializer.streamify(t);
serializer.streamify(angle);
serializer.streamify(active);
}
};
template <typename TDataType>
struct RenderSerializerMap
{
void serialize(RenderSerializer& s, TDataType& d)
{
d.serialize(s);
}
};
template <>
struct RenderSerializerMap<uint8_t>
{
void serialize(RenderSerializer& s, uint8_t& d)
{
s.streamify(d);
}
};
template <>
struct RenderSerializerMap<PxDebugPoint>
{
void serialize(RenderSerializer& s, PxDebugPoint& d)
{
s.streamify(d.pos);
s.streamify(d.color);
}
};
template <>
struct RenderSerializerMap<PxDebugLine>
{
void serialize(RenderSerializer& s, PxDebugLine& d)
{
s.streamify(d.pos0);
s.streamify(d.color0);
s.streamify(d.pos1);
s.streamify(d.color1);
}
};
template <>
struct RenderSerializerMap<PxDebugTriangle>
{
void serialize(RenderSerializer& s, PxDebugTriangle& d)
{
s.streamify(d.pos0);
s.streamify(d.color0);
s.streamify(d.pos1);
s.streamify(d.color1);
s.streamify(d.pos2);
s.streamify(d.color2);
}
};
template <typename TDataType>
struct PvdTypeToRenderType
{
bool compile_error;
};
#define DECLARE_PVD_IMMEDIATE_RENDER_TYPE(type) \
template <> \
struct PvdTypeToRenderType<type##RenderEvent> \
{ \
enum Enum \
{ \
EnumVal = PvdUserRenderTypes::type \
}; \
};
#include "PxPvdUserRenderTypes.h"
#undef DECLARE_PVD_IMMEDIATE_RENDER_TYPE
template <typename TDataType>
PvdUserRenderTypes::Enum getPvdRenderTypeFromType()
{
return static_cast<PvdUserRenderTypes::Enum>(PvdTypeToRenderType<TDataType>::EnumVal);
}
}
}
#endif
| 9,152 | C | 22.712435 | 114 | 0.721045 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxProfileZoneImpl.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PROFILE_ZONE_IMPL_H
#define PX_PROFILE_ZONE_IMPL_H
#include "PxPvdProfileZone.h"
#include "PxProfileZoneManager.h"
#include "PxProfileContextProviderImpl.h"
#include "PxProfileScopedMutexLock.h"
#include "PxProfileEventBufferAtomic.h"
#include "foundation/PxMutex.h"
namespace physx { namespace profile {
/**
\brief Simple event filter that enables all events.
*/
struct PxProfileNullEventFilter
{
void setEventEnabled( const PxProfileEventId&, bool) { PX_ASSERT(false); }
bool isEventEnabled( const PxProfileEventId&) const { return true; }
};
typedef PxMutexT<PxProfileWrapperReflectionAllocator<uint8_t> > TZoneMutexType;
typedef ScopedLockImpl<TZoneMutexType> TZoneLockType;
typedef EventBuffer< PxDefaultContextProvider, TZoneMutexType, TZoneLockType, PxProfileNullEventFilter > TZoneEventBufferType;
//typedef EventBufferAtomic< PxDefaultContextProvider, TZoneMutexType, TZoneLockType, PxProfileNullEventFilter > TZoneEventBufferType;
template<typename TNameProvider>
class ZoneImpl : TZoneEventBufferType //private inheritance intended
, public PxProfileZone
, public PxProfileEventBufferClient
{
typedef PxMutexT<PxProfileWrapperReflectionAllocator<uint8_t> > TMutexType;
typedef PxProfileHashMap<const char*, uint32_t> TNameToEvtIndexMap;
//ensure we don't reuse event ids.
typedef PxProfileHashMap<uint16_t, const char*> TEvtIdToNameMap;
typedef TMutexType::ScopedLock TLockType;
const char* mName;
mutable TMutexType mMutex;
PxProfileArray<PxProfileEventName> mEventNames;
// to avoid locking, read-only and read-write map exist
TNameToEvtIndexMap mNameToEvtIndexMapR;
TNameToEvtIndexMap mNameToEvtIndexMapRW;
//ensure we don't reuse event ids.
TEvtIdToNameMap mEvtIdToNameMap;
PxProfileZoneManager* mProfileZoneManager;
PxProfileArray<PxProfileZoneClient*> mZoneClients;
volatile bool mEventsActive;
PX_NOCOPY(ZoneImpl<TNameProvider>)
public:
ZoneImpl( PxAllocatorCallback* inAllocator, const char* inName, uint32_t bufferSize = 0x10000 /*64k*/, const TNameProvider& inProvider = TNameProvider() )
: TZoneEventBufferType( inAllocator, bufferSize, PxDefaultContextProvider(), NULL, PxProfileNullEventFilter() )
, mName( inName )
, mMutex( PxProfileWrapperReflectionAllocator<uint8_t>( mWrapper ) )
, mEventNames( mWrapper )
, mNameToEvtIndexMapR( mWrapper )
, mNameToEvtIndexMapRW( mWrapper )
, mEvtIdToNameMap( mWrapper )
, mProfileZoneManager( NULL )
, mZoneClients( mWrapper )
, mEventsActive( false )
{
TZoneEventBufferType::setBufferMutex( &mMutex );
//Initialize the event name structure with existing names from the name provider.
PxProfileNames theNames( inProvider.getProfileNames() );
for ( uint32_t idx = 0; idx < theNames.eventCount; ++idx )
{
const PxProfileEventName& theName (theNames.events[idx]);
doAddName( theName.name, theName.eventId.eventId, theName.eventId.compileTimeEnabled );
}
TZoneEventBufferType::addClient( *this );
}
virtual ~ZoneImpl() {
if ( mProfileZoneManager != NULL )
mProfileZoneManager->removeProfileZone( *this );
mProfileZoneManager = NULL;
TZoneEventBufferType::removeClient( *this );
}
void doAddName( const char* inName, uint16_t inEventId, bool inCompileTimeEnabled )
{
TLockType theLocker( mMutex );
mEvtIdToNameMap.insert( inEventId, inName );
uint32_t idx = static_cast<uint32_t>( mEventNames.size() );
mNameToEvtIndexMapRW.insert( inName, idx );
mEventNames.pushBack( PxProfileEventName( inName, PxProfileEventId( inEventId, inCompileTimeEnabled ) ) );
}
virtual void flushEventIdNameMap()
{
// copy the RW map into R map
if (mNameToEvtIndexMapRW.size())
{
for (TNameToEvtIndexMap::Iterator iter = mNameToEvtIndexMapRW.getIterator(); !iter.done(); ++iter)
{
mNameToEvtIndexMapR.insert(iter->first, iter->second);
}
mNameToEvtIndexMapRW.clear();
}
}
virtual uint16_t getEventIdForName( const char* inName )
{
return getEventIdsForNames( &inName, 1 );
}
virtual uint16_t getEventIdsForNames( const char** inNames, uint32_t inLen )
{
if ( inLen == 0 )
return 0;
// search the read-only map first
const TNameToEvtIndexMap::Entry* theEntry( mNameToEvtIndexMapR.find( inNames[0] ) );
if ( theEntry )
return mEventNames[theEntry->second].eventId;
TLockType theLocker(mMutex);
const TNameToEvtIndexMap::Entry* theReEntry(mNameToEvtIndexMapRW.find(inNames[0]));
if (theReEntry)
return mEventNames[theReEntry->second].eventId;
//Else git R dun.
uint16_t nameSize = static_cast<uint16_t>( mEventNames.size() );
//We don't allow 0 as an event id.
uint16_t eventId = nameSize;
//Find a contiguous set of unique event ids
bool foundAnEventId = false;
do
{
foundAnEventId = false;
++eventId;
for ( uint16_t idx = 0; idx < inLen && foundAnEventId == false; ++idx )
foundAnEventId = mEvtIdToNameMap.find( uint16_t(eventId + idx) ) != NULL;
}
while( foundAnEventId );
uint32_t clientCount = mZoneClients.size();
for ( uint16_t nameIdx = 0; nameIdx < inLen; ++nameIdx )
{
uint16_t newId = uint16_t(eventId + nameIdx);
doAddName( inNames[nameIdx], newId, true );
for( uint32_t clientIdx =0; clientIdx < clientCount; ++clientIdx )
mZoneClients[clientIdx]->handleEventAdded( PxProfileEventName( inNames[nameIdx], PxProfileEventId( newId ) ) );
}
return eventId;
}
virtual void setProfileZoneManager(PxProfileZoneManager* inMgr)
{
mProfileZoneManager = inMgr;
}
virtual PxProfileZoneManager* getProfileZoneManager()
{
return mProfileZoneManager;
}
const char* getName() { return mName; }
PxProfileEventBufferClient* getEventBufferClient() { return this; }
//SDK implementation
void addClient( PxProfileZoneClient& inClient )
{
TLockType lock( mMutex );
mZoneClients.pushBack( &inClient );
mEventsActive = true;
}
void removeClient( PxProfileZoneClient& inClient )
{
TLockType lock( mMutex );
for ( uint32_t idx =0; idx < mZoneClients.size(); ++idx )
{
if (mZoneClients[idx] == &inClient )
{
inClient.handleClientRemoved();
mZoneClients.replaceWithLast( idx );
break;
}
}
mEventsActive = mZoneClients.size() != 0;
}
virtual bool hasClients() const
{
return mEventsActive;
}
virtual PxProfileNames getProfileNames() const
{
TLockType theLocker( mMutex );
const PxProfileEventName* theNames = mEventNames.begin();
uint32_t theEventCount = uint32_t(mEventNames.size());
return PxProfileNames( theEventCount, theNames );
}
virtual void release()
{
PX_PROFILE_DELETE( mWrapper.getAllocator(), this );
}
//Implementation chaining the buffer flush to our clients
virtual void handleBufferFlush( const uint8_t* inData, uint32_t inLength )
{
TLockType theLocker( mMutex );
uint32_t clientCount = mZoneClients.size();
for( uint32_t idx =0; idx < clientCount; ++idx )
mZoneClients[idx]->handleBufferFlush( inData, inLength );
}
//Happens if something removes all the clients from the manager.
virtual void handleClientRemoved() {}
//Send a profile event, optionally with a context. Events are sorted by thread
//and context in the client side.
virtual void startEvent( uint16_t inId, uint64_t contextId)
{
if( mEventsActive )
{
TZoneEventBufferType::startEvent( inId, contextId );
}
}
virtual void stopEvent( uint16_t inId, uint64_t contextId)
{
if( mEventsActive )
{
TZoneEventBufferType::stopEvent( inId, contextId );
}
}
virtual void startEvent( uint16_t inId, uint64_t contextId, uint32_t threadId)
{
if( mEventsActive )
{
TZoneEventBufferType::startEvent( inId, contextId, threadId );
}
}
virtual void stopEvent( uint16_t inId, uint64_t contextId, uint32_t threadId )
{
if( mEventsActive )
{
TZoneEventBufferType::stopEvent( inId, contextId, threadId );
}
}
virtual void atEvent(uint16_t inId, uint64_t contextId, uint32_t threadId, uint64_t start, uint64_t stop)
{
if (mEventsActive)
{
TZoneEventBufferType::startEvent(inId, threadId, contextId, 0, 0, start);
TZoneEventBufferType::stopEvent(inId, threadId, contextId, 0, 0, stop);
}
}
/**
* Set an specific events value. This is different than the profiling value
* for the event; it is a value recorded and kept around without a timestamp associated
* with it. This value is displayed when the event itself is processed.
*/
virtual void eventValue( uint16_t inId, uint64_t contextId, int64_t inValue )
{
if( mEventsActive )
{
TZoneEventBufferType::eventValue( inId, contextId, inValue );
}
}
virtual void flushProfileEvents()
{
TZoneEventBufferType::flushProfileEvents();
}
};
}}
#endif
| 10,615 | C | 32.701587 | 156 | 0.723033 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxProfileZoneManager.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PX_PROFILE_ZONE_MANAGER_H
#define PX_PROFILE_ZONE_MANAGER_H
#include "PxProfileEventSender.h"
#include "PxProfileEventNames.h"
namespace physx {
class PxAllocatorCallback;
namespace profile {
class PxProfileZone;
class PxProfileNameProvider;
/**
\brief Profile zone handler for zone add/remove notification.
*/
class PxProfileZoneHandler
{
protected:
virtual ~PxProfileZoneHandler(){}
public:
/**
\brief On zone added notification
\note Not a threadsafe call; handlers are expected to be able to handle
this from any thread.
\param inSDK Added zone.
*/
virtual void onZoneAdded( PxProfileZone& inSDK ) = 0;
/**
\brief On zone removed notification
\note Not a threadsafe call; handlers are expected to be able to handle
this from any thread.
\param inSDK removed zone.
*/
virtual void onZoneRemoved( PxProfileZone& inSDK ) = 0;
};
/**
\brief The profiling system was setup in the expectation that there would be several
systems that each had its own island of profile information. PhysX, client code,
and APEX would be the first examples of these. Each one of these islands is represented
by a profile zone.
The Manager is a singleton-like object where all these different systems can be registered
so that clients of the profiling system can have one point to capture *all* profiling events.
Flushing the manager implies that you want to loop through all the profile zones and flush
each one.
@see PxProfileEventFlusher
*/
class PxProfileZoneManager
: public PxProfileEventFlusher //Tell all SDK's to flush their queue of profile events.
{
protected:
virtual ~PxProfileZoneManager(){}
public:
/**
\brief Add new profile zone for the manager.
\note Threadsafe call, can be done from any thread. Handlers that are already connected
will get a new callback on the current thread.
\param inSDK Profile zone to add.
*/
virtual void addProfileZone( PxProfileZone& inSDK ) = 0;
/**
\brief Removes profile zone from the manager.
\note Threadsafe call, can be done from any thread. Handlers that are already connected
will get a new callback on the current thread.
\param inSDK Profile zone to remove.
*/
virtual void removeProfileZone( PxProfileZone& inSDK ) = 0;
/**
\brief Add profile zone handler callback for the profile zone notifications.
\note Threadsafe call. The new handler will immediately be notified about all
known SDKs.
\param inHandler Profile zone handler to add.
*/
virtual void addProfileZoneHandler( PxProfileZoneHandler& inHandler ) = 0;
/**
\brief Removes profile zone handler callback for the profile zone notifications.
\note Threadsafe call. The new handler will immediately be notified about all
known SDKs.
\param inHandler Profile zone handler to remove.
*/
virtual void removeProfileZoneHandler( PxProfileZoneHandler& inHandler ) = 0;
/**
\brief Create a new profile zone. This means you don't need access to a PxFoundation to
create your profile zone object, and your object is automatically registered with
the profile zone manager.
You still need to release your object when you are finished with it.
\param inSDKName Name of the SDK object.
\param inNames Option set of event id to name mappings.
\param inEventBufferByteSize rough maximum size of the event buffer. May exceed this size
by sizeof one event. When full an immediate call to all listeners is made.
*/
virtual PxProfileZone& createProfileZone( const char* inSDKName, PxProfileNames inNames = PxProfileNames(), uint32_t inEventBufferByteSize = 0x4000 /*16k*/ ) = 0;
/**
\brief Releases the profile manager instance.
*/
virtual void release() = 0;
/**
\brief Create the profile zone manager.
\param inAllocatorCallback Allocator callback.
*/
static PxProfileZoneManager& createProfileZoneManager(PxAllocatorCallback* inAllocatorCallback );
};
} }
#endif
| 5,530 | C | 34.455128 | 164 | 0.752622 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxProfileMemoryBuffer.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PROFILE_MEMORY_BUFFER_H
#define PX_PROFILE_MEMORY_BUFFER_H
#include "foundation/PxAllocator.h"
#include "foundation/PxMemory.h"
namespace physx { namespace profile {
template<typename TAllocator = typename PxAllocatorTraits<uint8_t>::Type >
class MemoryBuffer : public TAllocator
{
uint8_t* mBegin;
uint8_t* mEnd;
uint8_t* mCapacityEnd;
public:
MemoryBuffer( const TAllocator& inAlloc = TAllocator() ) : TAllocator( inAlloc ), mBegin( 0 ), mEnd( 0 ), mCapacityEnd( 0 ) {}
~MemoryBuffer()
{
if ( mBegin ) TAllocator::deallocate( mBegin );
}
uint32_t size() const { return static_cast<uint32_t>( mEnd - mBegin ); }
uint32_t capacity() const { return static_cast<uint32_t>( mCapacityEnd - mBegin ); }
uint8_t* begin() { return mBegin; }
uint8_t* end() { return mEnd; }
void setEnd(uint8_t* nEnd) { mEnd = nEnd; }
const uint8_t* begin() const { return mBegin; }
const uint8_t* end() const { return mEnd; }
void clear() { mEnd = mBegin; }
uint32_t write( uint8_t inValue )
{
growBuf( 1 );
*mEnd = inValue;
++mEnd;
return 1;
}
template<typename TDataType>
uint32_t write( const TDataType& inValue )
{
uint32_t writtenSize = sizeof(TDataType);
growBuf(writtenSize);
const uint8_t* __restrict readPtr = reinterpret_cast< const uint8_t* >( &inValue );
uint8_t* __restrict writePtr = mEnd;
for ( uint32_t idx = 0; idx < sizeof(TDataType); ++idx ) writePtr[idx] = readPtr[idx];
mEnd += writtenSize;
return writtenSize;
}
template<typename TDataType>
uint32_t write( const TDataType* inValue, uint32_t inLength )
{
if ( inValue && inLength )
{
uint32_t writeSize = inLength * sizeof( TDataType );
growBuf( writeSize );
PxMemCopy( mBegin + size(), inValue, writeSize );
mEnd += writeSize;
return writeSize;
}
return 0;
}
// used by atomic write. Store the data and write the end afterwards
// we dont check the buffer size, it should not resize on the fly
template<typename TDataType>
uint32_t write(const TDataType* inValue, uint32_t inLength, int32_t index)
{
if (inValue && inLength)
{
uint32_t writeSize = inLength * sizeof(TDataType);
PX_ASSERT(mBegin + index + writeSize < mCapacityEnd);
PxMemCopy(mBegin + index, inValue, writeSize);
return writeSize;
}
return 0;
}
void growBuf( uint32_t inAmount )
{
uint32_t newSize = size() + inAmount;
reserve( newSize );
}
void resize( uint32_t inAmount )
{
reserve( inAmount );
mEnd = mBegin + inAmount;
}
void reserve( uint32_t newSize )
{
uint32_t currentSize = size();
if ( newSize >= capacity() )
{
const uint32_t allocSize = mBegin ? newSize * 2 : newSize;
uint8_t* newData = static_cast<uint8_t*>(TAllocator::allocate(allocSize, PX_FL));
memset(newData, 0xf,allocSize);
if ( mBegin )
{
PxMemCopy( newData, mBegin, currentSize );
TAllocator::deallocate( mBegin );
}
mBegin = newData;
mEnd = mBegin + currentSize;
mCapacityEnd = mBegin + allocSize;
}
}
};
class TempMemoryBuffer
{
uint8_t* mBegin;
uint8_t* mEnd;
uint8_t* mCapacityEnd;
public:
TempMemoryBuffer(uint8_t* data, int32_t size) : mBegin(data), mEnd(data), mCapacityEnd(data + size) {}
~TempMemoryBuffer()
{
}
uint32_t size() const { return static_cast<uint32_t>(mEnd - mBegin); }
uint32_t capacity() const { return static_cast<uint32_t>(mCapacityEnd - mBegin); }
const uint8_t* begin() { return mBegin; }
uint8_t* end() { return mEnd; }
const uint8_t* begin() const { return mBegin; }
const uint8_t* end() const { return mEnd; }
uint32_t write(uint8_t inValue)
{
*mEnd = inValue;
++mEnd;
return 1;
}
template<typename TDataType>
uint32_t write(const TDataType& inValue)
{
uint32_t writtenSize = sizeof(TDataType);
const uint8_t* __restrict readPtr = reinterpret_cast<const uint8_t*>(&inValue);
uint8_t* __restrict writePtr = mEnd;
for (uint32_t idx = 0; idx < sizeof(TDataType); ++idx) writePtr[idx] = readPtr[idx];
mEnd += writtenSize;
return writtenSize;
}
template<typename TDataType>
uint32_t write(const TDataType* inValue, uint32_t inLength)
{
if (inValue && inLength)
{
uint32_t writeSize = inLength * sizeof(TDataType);
PxMemCopy(mBegin + size(), inValue, writeSize);
mEnd += writeSize;
return writeSize;
}
return 0;
}
};
}}
#endif
| 6,145 | C | 31.17801 | 128 | 0.683645 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxPvdObjectRegistrar.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "PxPvdObjectRegistrar.h"
namespace physx
{
namespace pvdsdk
{
bool ObjectRegistrar::addItem(const void* inItem)
{
physx::PxMutex::ScopedLock lock(mRefCountMapLock);
if(mRefCountMap.find(inItem))
{
uint32_t& counter = mRefCountMap[inItem];
counter++;
return false;
}
else
{
mRefCountMap.insert(inItem, 1);
return true;
}
}
bool ObjectRegistrar::decItem(const void* inItem)
{
physx::PxMutex::ScopedLock lock(mRefCountMapLock);
const physx::PxHashMap<const void*, uint32_t>::Entry* entry = mRefCountMap.find(inItem);
if(entry)
{
uint32_t& retval(const_cast<uint32_t&>(entry->second));
if(retval)
--retval;
uint32_t theValue = retval;
if(theValue == 0)
{
mRefCountMap.erase(inItem);
return true;
}
}
return false;
}
void ObjectRegistrar::clear()
{
physx::PxMutex::ScopedLock lock(mRefCountMapLock);
mRefCountMap.clear();
}
} // pvdsdk
} // physx
| 2,599 | C++ | 31.5 | 89 | 0.744517 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxPvdProfileZone.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PX_PVD_PROFILE_ZONE_H
#define PX_PVD_PROFILE_ZONE_H
#include "foundation/PxPreprocessor.h"
#include "PxProfileEventBufferClientManager.h"
#include "PxProfileEventNames.h"
#include "PxProfileEventSender.h"
namespace physx {
class PxAllocatorCallback;
namespace profile {
class PxProfileZoneManager;
/**
\brief The profiling system was setup in the expectation that there would be several
systems that each had its own island of profile information. PhysX, client code,
and APEX would be the first examples of these. Each one of these islands is represented
by a profile zone.
A profile zone combines a name, a place where all the events coming from its interface
can flushed, and a mapping from event number to full event name.
It also provides a top level filtering service where profile events
can be filtered by event id.
The profile zone implements a system where if there is no one
listening to events it doesn't provide a mechanism to send them. In this way
the event system is short circuited when there aren't any clients.
All functions on this interface should be considered threadsafe.
@see PxProfileZoneClientManager, PxProfileNameProvider, PxProfileEventSender, PxProfileEventFlusher
*/
class PxProfileZone : public PxProfileZoneClientManager
, public PxProfileNameProvider
, public PxProfileEventSender
, public PxProfileEventFlusher
{
protected:
virtual ~PxProfileZone(){}
public:
/**
\brief Get profile zone name.
\return Zone name.
*/
virtual const char* getName() = 0;
/**
\brief Release the profile zone.
*/
virtual void release() = 0;
/**
\brief Set profile zone manager for the zone.
\param inMgr Profile zone manager.
*/
virtual void setProfileZoneManager(PxProfileZoneManager* inMgr) = 0;
/**
\brief Get profile zone manager for the zone.
\return Profile zone manager.
*/
virtual PxProfileZoneManager* getProfileZoneManager() = 0;
/**
\brief Get or create a new event id for a given name.
If you pass in a previously defined event name (including one returned)
from the name provider) you will just get the same event id back.
\param inName Profile event name.
*/
virtual uint16_t getEventIdForName( const char* inName ) = 0;
/**
\brief Specifies that it is a safe point to flush read-write name map into
read-only map. Make sure getEventIdForName is not called from a different thread.
*/
virtual void flushEventIdNameMap() = 0;
/**
\brief Reserve a contiguous set of profile event ids for a set of names.
This function does not do any meaningful error checking other than to ensure
that if it does generate new ids they are contiguous. If the first name is already
registered, that is the ID that will be returned regardless of what other
names are registered. Thus either use this function alone (without the above
function) or don't use it.
If you register "one","two","three" and the function returns an id of 4, then
"one" is mapped to 4, "two" is mapped to 5, and "three" is mapped to 6.
\param inNames set of names to register.
\param inLen Length of the name list.
\return The first id associated with the first name. The rest of the names
will be associated with monotonically incrementing uint16_t values from the first
id.
*/
virtual uint16_t getEventIdsForNames( const char** inNames, uint32_t inLen ) = 0;
/**
\brief Create a new profile zone.
\param inAllocator memory allocation is controlled through the foundation if one is passed in.
\param inSDKName Name of the profile zone; useful for clients to understand where events came from.
\param inNames Mapping from event id -> event name.
\param inEventBufferByteSize Size of the canonical event buffer. This does not need to be a large number
as profile events are fairly small individually.
\return a profile zone implementation.
*/
static PxProfileZone& createProfileZone(PxAllocatorCallback* inAllocator, const char* inSDKName, PxProfileNames inNames = PxProfileNames(), uint32_t inEventBufferByteSize = 0x10000 /*64k*/);
};
} }
#endif
| 5,725 | C | 39.041958 | 192 | 0.751092 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxProfileMemoryEvents.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PROFILE_MEMORY_EVENTS_H
#define PX_PROFILE_MEMORY_EVENTS_H
#include "PxProfileEvents.h"
//Memory events define their own event stream
namespace physx { namespace profile {
struct MemoryEventTypes
{
enum Enum
{
Unknown = 0,
StringTableEvent, //introduce a new mapping of const char* -> integer
AllocationEvent,
DeallocationEvent,
FullAllocationEvent
};
};
template<unsigned numBits, typename TDataType>
inline unsigned char convertToNBits( TDataType inType )
{
uint8_t conversion = static_cast<uint8_t>( inType );
PX_ASSERT( conversion < (1 << numBits) );
return conversion;
}
template<typename TDataType>
inline unsigned char convertToTwoBits( TDataType inType )
{
return convertToNBits<2>( inType );
}
template<typename TDataType>
inline unsigned char convertToFourBits( TDataType inType )
{
return convertToNBits<4>( inType );
}
inline EventStreamCompressionFlags::Enum fromNumber( uint8_t inNum ) { return static_cast<EventStreamCompressionFlags::Enum>( inNum ); }
template<unsigned lhs, unsigned rhs>
inline void compileCheckSize()
{
PX_COMPILE_TIME_ASSERT( lhs <= rhs );
}
//Used for predictable bit fields.
template<typename TDataType
, uint8_t TNumBits
, uint8_t TOffset
, typename TInputType>
struct BitMaskSetter
{
//Create a mask that masks out the orginal value shift into place
static TDataType createOffsetMask() { return TDataType(createMask() << TOffset); }
//Create a mask of TNumBits number of tis
static TDataType createMask() { return static_cast<TDataType>((1 << TNumBits) - 1); }
void setValue( TDataType& inCurrent, TInputType inData )
{
PX_ASSERT( inData < ( 1 << TNumBits ) );
//Create a mask to remove the current value.
TDataType theMask = TDataType(~(createOffsetMask()));
//Clear out current value.
inCurrent = TDataType(inCurrent & theMask);
//Create the new value.
TDataType theAddition = static_cast<TDataType>( inData << TOffset );
//or it into the existing value.
inCurrent = TDataType(inCurrent | theAddition);
}
TInputType getValue( TDataType inCurrent )
{
return static_cast<TInputType>( ( inCurrent >> TOffset ) & createMask() );
}
};
struct MemoryEventHeader
{
uint16_t mValue;
typedef BitMaskSetter<uint16_t, 4, 0, uint8_t> TTypeBitmask;
typedef BitMaskSetter<uint16_t, 2, 4, uint8_t> TAddrCompressBitmask;
typedef BitMaskSetter<uint16_t, 2, 6, uint8_t> TTypeCompressBitmask;
typedef BitMaskSetter<uint16_t, 2, 8, uint8_t> TFnameCompressBitmask;
typedef BitMaskSetter<uint16_t, 2, 10, uint8_t> TSizeCompressBitmask;
typedef BitMaskSetter<uint16_t, 2, 12, uint8_t> TLineCompressBitmask;
//That leaves size as the only thing not compressed usually.
MemoryEventHeader( MemoryEventTypes::Enum inType = MemoryEventTypes::Unknown )
: mValue( 0 )
{
uint8_t defaultCompression( convertToTwoBits( EventStreamCompressionFlags::U64 ) );
TTypeBitmask().setValue( mValue, convertToFourBits( inType ) );
TAddrCompressBitmask().setValue( mValue, defaultCompression );
TTypeCompressBitmask().setValue( mValue, defaultCompression );
TFnameCompressBitmask().setValue( mValue, defaultCompression );
TSizeCompressBitmask().setValue( mValue, defaultCompression );
TLineCompressBitmask().setValue( mValue, defaultCompression );
}
MemoryEventTypes::Enum getType() const { return static_cast<MemoryEventTypes::Enum>( TTypeBitmask().getValue( mValue ) ); }
#define DEFINE_MEMORY_HEADER_COMPRESSION_ACCESSOR( name ) \
void set##name( EventStreamCompressionFlags::Enum inEnum ) { T##name##Bitmask().setValue( mValue, convertToTwoBits( inEnum ) ); } \
EventStreamCompressionFlags::Enum get##name() const { return fromNumber( T##name##Bitmask().getValue( mValue ) ); }
DEFINE_MEMORY_HEADER_COMPRESSION_ACCESSOR( AddrCompress )
DEFINE_MEMORY_HEADER_COMPRESSION_ACCESSOR( TypeCompress )
DEFINE_MEMORY_HEADER_COMPRESSION_ACCESSOR( FnameCompress )
DEFINE_MEMORY_HEADER_COMPRESSION_ACCESSOR( SizeCompress )
DEFINE_MEMORY_HEADER_COMPRESSION_ACCESSOR( LineCompress )
#undef DEFINE_MEMORY_HEADER_COMPRESSION_ACCESSOR
bool operator==( const MemoryEventHeader& inOther ) const
{
return mValue == inOther.mValue;
}
template<typename TStreamType>
void streamify( TStreamType& inStream )
{
inStream.streamify( "Header", mValue );
}
};
//Declaration of type level getMemoryEventType function that maps enumeration event types to datatypes
template<typename TDataType>
inline MemoryEventTypes::Enum getMemoryEventType() { PX_ASSERT( false ); return MemoryEventTypes::Unknown; }
inline bool safeStrEq( const char* lhs, const char* rhs )
{
if ( lhs == rhs )
return true;
//If they aren't equal, and one of them is null,
//then they can't be equal.
//This is assuming that the null char* is not equal to
//the empty "" char*.
if ( !lhs || !rhs )
return false;
return ::strcmp( lhs, rhs ) == 0;
}
struct StringTableEvent
{
const char* mString;
uint32_t mHandle;
void init( const char* inStr = "", uint32_t inHdl = 0 )
{
mString = inStr;
mHandle = inHdl;
}
void init( const StringTableEvent& inData )
{
mString = inData.mString;
mHandle = inData.mHandle;
}
bool operator==( const StringTableEvent& inOther ) const
{
return mHandle == inOther.mHandle
&& safeStrEq( mString, inOther.mString );
}
void setup( MemoryEventHeader& ) const {}
template<typename TStreamType>
void streamify( TStreamType& inStream, const MemoryEventHeader& )
{
inStream.streamify( "String", mString );
inStream.streamify( "Handle", mHandle );
}
};
template<> inline MemoryEventTypes::Enum getMemoryEventType<StringTableEvent>() { return MemoryEventTypes::StringTableEvent; }
struct MemoryEventData
{
uint64_t mAddress;
void init( uint64_t addr )
{
mAddress = addr;
}
void init( const MemoryEventData& inData)
{
mAddress = inData.mAddress;
}
bool operator==( const MemoryEventData& inOther ) const
{
return mAddress == inOther.mAddress;
}
void setup( MemoryEventHeader& inHeader ) const
{
inHeader.setAddrCompress( findCompressionValue( mAddress ) );
}
template<typename TStreamType>
void streamify( TStreamType& inStream, const MemoryEventHeader& inHeader )
{
inStream.streamify( "Address", mAddress, inHeader.getAddrCompress() );
}
};
struct AllocationEvent : public MemoryEventData
{
uint32_t mSize;
uint32_t mType;
uint32_t mFile;
uint32_t mLine;
void init( size_t size = 0, uint32_t type = 0, uint32_t file = 0, uint32_t line = 0, uint64_t addr = 0 )
{
MemoryEventData::init( addr );
mSize = static_cast<uint32_t>( size );
mType = type;
mFile = file;
mLine = line;
}
void init( const AllocationEvent& inData )
{
MemoryEventData::init( inData );
mSize = inData.mSize;
mType = inData.mType;
mFile = inData.mFile;
mLine = inData.mLine;
}
bool operator==( const AllocationEvent& inOther ) const
{
return MemoryEventData::operator==( inOther )
&& mSize == inOther.mSize
&& mType == inOther.mType
&& mFile == inOther.mFile
&& mLine == inOther.mLine;
}
void setup( MemoryEventHeader& inHeader ) const
{
inHeader.setTypeCompress( findCompressionValue( mType ) );
inHeader.setFnameCompress( findCompressionValue( mFile ) );
inHeader.setSizeCompress( findCompressionValue( mSize ) );
inHeader.setLineCompress( findCompressionValue( mLine ) );
MemoryEventData::setup( inHeader );
}
template<typename TStreamType>
void streamify( TStreamType& inStream, const MemoryEventHeader& inHeader )
{
inStream.streamify( "Size", mSize, inHeader.getSizeCompress() );
inStream.streamify( "Type", mType, inHeader.getTypeCompress() );
inStream.streamify( "File", mFile, inHeader.getFnameCompress() );
inStream.streamify( "Line", mLine, inHeader.getLineCompress() );
MemoryEventData::streamify( inStream, inHeader );
}
};
template<> inline MemoryEventTypes::Enum getMemoryEventType<AllocationEvent>() { return MemoryEventTypes::AllocationEvent; }
struct FullAllocationEvent : public MemoryEventData
{
size_t mSize;
const char* mType;
const char* mFile;
uint32_t mLine;
void init( size_t size, const char* type, const char* file, uint32_t line, uint64_t addr )
{
MemoryEventData::init( addr );
mSize = size;
mType = type;
mFile = file;
mLine = line;
}
void init( const FullAllocationEvent& inData )
{
MemoryEventData::init( inData );
mSize = inData.mSize;
mType = inData.mType;
mFile = inData.mFile;
mLine = inData.mLine;
}
bool operator==( const FullAllocationEvent& inOther ) const
{
return MemoryEventData::operator==( inOther )
&& mSize == inOther.mSize
&& safeStrEq( mType, inOther.mType )
&& safeStrEq( mFile, inOther.mFile )
&& mLine == inOther.mLine;
}
void setup( MemoryEventHeader& ) const {}
};
template<> inline MemoryEventTypes::Enum getMemoryEventType<FullAllocationEvent>() { return MemoryEventTypes::FullAllocationEvent; }
struct DeallocationEvent : public MemoryEventData
{
void init( uint64_t addr = 0 ) { MemoryEventData::init( addr ); }
void init( const DeallocationEvent& inData ) { MemoryEventData::init( inData ); }
};
template<> inline MemoryEventTypes::Enum getMemoryEventType<DeallocationEvent>() { return MemoryEventTypes::DeallocationEvent; }
class MemoryEvent
{
public:
typedef PX_PROFILE_UNION_5(StringTableEvent, AllocationEvent, DeallocationEvent, FullAllocationEvent, uint8_t) EventData;
private:
MemoryEventHeader mHeader;
EventData mData;
public:
MemoryEvent() {}
MemoryEvent( MemoryEventHeader inHeader, const EventData& inData = EventData() )
: mHeader( inHeader )
, mData( inData )
{
}
template<typename TDataType>
MemoryEvent( const TDataType& inType )
: mHeader( getMemoryEventType<TDataType>() )
, mData( inType )
{
//set the appropriate compression bits.
inType.setup( mHeader );
}
const MemoryEventHeader& getHeader() const { return mHeader; }
const EventData& getData() const { return mData; }
template<typename TDataType>
const TDataType& getValue() const { PX_ASSERT( mHeader.getType() == getMemoryEventType<TDataType>() ); return mData.toType<TDataType>(); }
template<typename TDataType>
TDataType& getValue() { PX_ASSERT( mHeader.getType() == getMemoryEventType<TDataType>() ); return mData.toType<TDataType>(); }
template<typename TRetVal, typename TOperator>
inline TRetVal visit( TOperator inOp ) const;
bool operator==( const MemoryEvent& inOther ) const
{
if ( !(mHeader == inOther.mHeader ) ) return false;
if ( mHeader.getType() )
return inOther.visit<bool>( EventDataEqualOperator<EventData>( mData ) );
return true;
}
};
template<typename TRetVal, typename TOperator>
inline TRetVal visit( MemoryEventTypes::Enum inEventType, const MemoryEvent::EventData& inData, TOperator inOperator )
{
switch( inEventType )
{
case MemoryEventTypes::StringTableEvent: return inOperator( inData.toType( Type2Type<StringTableEvent>() ) );
case MemoryEventTypes::AllocationEvent: return inOperator( inData.toType( Type2Type<AllocationEvent>() ) );
case MemoryEventTypes::DeallocationEvent: return inOperator( inData.toType( Type2Type<DeallocationEvent>() ) );
case MemoryEventTypes::FullAllocationEvent: return inOperator( inData.toType( Type2Type<FullAllocationEvent>() ) );
case MemoryEventTypes::Unknown: return inOperator( static_cast<uint8_t>( inEventType ) );
}
return TRetVal();
}
template<typename TRetVal, typename TOperator>
inline TRetVal MemoryEvent::visit( TOperator inOp ) const
{
return physx::profile::visit<TRetVal>( mHeader.getType(), mData, inOp );
}
}}
#endif
| 13,543 | C | 31.953771 | 140 | 0.72148 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/src/PxPvdFoundation.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PX_PVD_FOUNDATION_H
#define PX_PVD_FOUNDATION_H
#include "foundation/PxVec3.h"
#include "foundation/PxTransform.h"
#include "foundation/PxBounds3.h"
#include "foundation/PxHashSet.h"
#include "foundation/PxHashMap.h"
#include "foundation/PxArray.h"
#include "foundation/PxString.h"
#include "foundation/PxPool.h"
#include "PxPvdObjectModelBaseTypes.h"
namespace physx
{
namespace pvdsdk
{
extern PxAllocatorCallback* gPvdAllocatorCallback;
class ForwardingAllocator : public PxAllocatorCallback
{
void* allocate(size_t size, const char* typeName, const char* filename, int line)
{
return PxGetBroadcastAllocator()->allocate(size, typeName, filename, line);
}
void deallocate(void* ptr)
{
PxGetBroadcastAllocator()->deallocate(ptr);
}
};
class RawMemoryBuffer
{
uint8_t* mBegin;
uint8_t* mEnd;
uint8_t* mCapacityEnd;
const char* mBufDataName;
public:
RawMemoryBuffer(const char* name) : mBegin(0), mEnd(0), mCapacityEnd(0),mBufDataName(name)
{
PX_UNUSED(mBufDataName);
}
~RawMemoryBuffer()
{
PX_FREE(mBegin);
}
uint32_t size() const
{
return static_cast<uint32_t>(mEnd - mBegin);
}
uint32_t capacity() const
{
return static_cast<uint32_t>(mCapacityEnd - mBegin);
}
uint8_t* begin()
{
return mBegin;
}
uint8_t* end()
{
return mEnd;
}
const uint8_t* begin() const
{
return mBegin;
}
const uint8_t* end() const
{
return mEnd;
}
void clear()
{
mEnd = mBegin;
}
const char* cStr()
{
if(mEnd && (*mEnd != 0))
write(0);
return reinterpret_cast<const char*>(mBegin);
}
uint32_t write(uint8_t inValue)
{
*growBuf(1) = inValue;
return 1;
}
template <typename TDataType>
uint32_t write(const TDataType& inValue)
{
const uint8_t* __restrict readPtr = reinterpret_cast<const uint8_t*>(&inValue);
uint8_t* __restrict writePtr = growBuf(sizeof(TDataType));
for(uint32_t idx = 0; idx < sizeof(TDataType); ++idx)
writePtr[idx] = readPtr[idx];
return sizeof(TDataType);
}
template <typename TDataType>
uint32_t write(const TDataType* inValue, uint32_t inLength)
{
uint32_t writeSize = inLength * sizeof(TDataType);
if(inValue && inLength)
{
physx::intrinsics::memCopy(growBuf(writeSize), inValue, writeSize);
}
if(inLength && !inValue)
{
PX_ASSERT(false);
// You can't not write something, because that will cause
// the receiving end to crash.
for(uint32_t idx = 0; idx < writeSize; ++idx)
write(0);
}
return writeSize;
}
uint8_t* growBuf(uint32_t inAmount)
{
uint32_t offset = size();
uint32_t newSize = offset + inAmount;
reserve(newSize);
mEnd += inAmount;
return mBegin + offset;
}
void writeZeros(uint32_t inAmount)
{
uint32_t offset = size();
growBuf(inAmount);
physx::intrinsics::memZero(begin() + offset, inAmount);
}
void reserve(uint32_t newSize)
{
uint32_t currentSize = size();
if(newSize && newSize >= capacity())
{
uint32_t newDataSize = newSize > 4096 ? newSize + (newSize >> 2) : newSize*2;
uint8_t* newData = static_cast<uint8_t*>(PX_ALLOC(newDataSize, mBufDataName));
if(mBegin)
{
physx::intrinsics::memCopy(newData, mBegin, currentSize);
PX_FREE(mBegin);
}
mBegin = newData;
mEnd = mBegin + currentSize;
mCapacityEnd = mBegin + newDataSize;
}
}
};
struct ForwardingMemoryBuffer : public RawMemoryBuffer
{
ForwardingMemoryBuffer(const char* bufDataName) : RawMemoryBuffer(bufDataName)
{
}
ForwardingMemoryBuffer& operator<<(const char* inString)
{
if(inString && *inString)
{
uint32_t len = static_cast<uint32_t>(strlen(inString));
write(inString, len);
}
return *this;
}
template <typename TDataType>
inline ForwardingMemoryBuffer& toStream(const char* inFormat, const TDataType inData)
{
char buffer[128] = { 0 };
Pxsnprintf(buffer, 128, inFormat, inData);
*this << buffer;
return *this;
}
inline ForwardingMemoryBuffer& operator<<(bool inData)
{
*this << (inData ? "true" : "false");
return *this;
}
inline ForwardingMemoryBuffer& operator<<(int32_t inData)
{
return toStream("%d", inData);
}
inline ForwardingMemoryBuffer& operator<<(uint16_t inData)
{
return toStream("%u", uint32_t(inData));
}
inline ForwardingMemoryBuffer& operator<<(uint8_t inData)
{
return toStream("%u", uint32_t(inData));
}
inline ForwardingMemoryBuffer& operator<<(char inData)
{
return toStream("%c", inData);
}
inline ForwardingMemoryBuffer& operator<<(uint32_t inData)
{
return toStream("%u", inData);
}
inline ForwardingMemoryBuffer& operator<<(uint64_t inData)
{
return toStream("%I64u", inData);
}
inline ForwardingMemoryBuffer& operator<<(int64_t inData)
{
return toStream("%I64d", inData);
}
inline ForwardingMemoryBuffer& operator<<(const void* inData)
{
return *this << static_cast<uint64_t>(reinterpret_cast<size_t>(inData));
}
inline ForwardingMemoryBuffer& operator<<(float inData)
{
return toStream("%g", double(inData));
}
inline ForwardingMemoryBuffer& operator<<(double inData)
{
return toStream("%g", inData);
}
inline ForwardingMemoryBuffer& operator<<(const PxVec3& inData)
{
*this << inData[0];
*this << " ";
*this << inData[1];
*this << " ";
*this << inData[2];
return *this;
}
inline ForwardingMemoryBuffer& operator<<(const PxQuat& inData)
{
*this << inData.x;
*this << " ";
*this << inData.y;
*this << " ";
*this << inData.z;
*this << " ";
*this << inData.w;
return *this;
}
inline ForwardingMemoryBuffer& operator<<(const PxTransform& inData)
{
*this << inData.q;
*this << " ";
*this << inData.p;
return *this;
}
inline ForwardingMemoryBuffer& operator<<(const PxBounds3& inData)
{
*this << inData.minimum;
*this << " ";
*this << inData.maximum;
return *this;
}
};
template <typename TDataType>
inline void* PvdAllocate(const char* typeName, const char* file, int line)
{
PX_ASSERT(gPvdAllocatorCallback);
return gPvdAllocatorCallback->allocate(sizeof(TDataType), typeName, file, line);
}
template <typename TDataType>
inline void PvdDeleteAndDeallocate(TDataType* inDType)
{
PX_ASSERT(gPvdAllocatorCallback);
if(inDType)
{
inDType->~TDataType();
gPvdAllocatorCallback->deallocate(inDType);
}
}
}
}
#define PVD_NEW(dtype) new (PvdAllocate<dtype>(#dtype, PX_FL)) dtype
#define PVD_DELETE(obj) PvdDeleteAndDeallocate(obj);
//#define PVD_NEW(dtype) PX_NEW(dtype)
//#define PVD_DELETE(obj) PX_DELETE(obj)
#define PVD_FOREACH(varname, stop) for(uint32_t varname = 0; varname < stop; ++varname)
#define PVD_POINTER_TO_U64(ptr) static_cast<uint64_t>(reinterpret_cast<size_t>(ptr))
#endif
| 8,132 | C | 24.737342 | 91 | 0.703763 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/include/PxPvdUserRenderer.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PX_PVD_USER_RENDERER_H
#define PX_PVD_USER_RENDERER_H
/** \addtogroup pvd
@{
*/
#include "foundation/PxVec3.h"
#include "foundation/PxTransform.h"
#include "common/PxRenderBuffer.h"
#include "pvd/PxPvd.h"
#include "PxPvdDataStream.h"
#include "foundation/PxUserAllocated.h"
#if !PX_DOXYGEN
namespace physx
{
#endif
class PxPvd;
#if !PX_DOXYGEN
namespace pvdsdk
{
#endif
class RendererEventClient;
class PvdUserRenderer : public PxUserAllocated
{
protected:
virtual ~PvdUserRenderer()
{
}
public:
virtual void release() = 0;
virtual void setClient(RendererEventClient* client) = 0;
// Instance to associate the further rendering with.
virtual void setInstanceId(const void* instanceId) = 0;
// Draw these points associated with this instance
virtual void drawPoints(const PxDebugPoint* points, uint32_t count) = 0;
// Draw these lines associated with this instance
virtual void drawLines(const PxDebugLine* lines, uint32_t count) = 0;
// Draw these triangles associated with this instance
virtual void drawTriangles(const PxDebugTriangle* triangles, uint32_t count) = 0;
// Draw this text associated with this instance
virtual void drawText(const PxDebugText& text) = 0;
// Draw SDK debug render
virtual void drawRenderbuffer(const PxDebugPoint* pointData, uint32_t pointCount, const PxDebugLine* lineData,
uint32_t lineCount, const PxDebugTriangle* triangleData, uint32_t triangleCount) = 0;
// Constraint visualization routines
virtual void visualizeJointFrames(const PxTransform& parent, const PxTransform& child) = 0;
virtual void visualizeLinearLimit(const PxTransform& t0, const PxTransform& t1, float value) = 0;
virtual void visualizeAngularLimit(const PxTransform& t0, float lower, float upper) = 0;
virtual void visualizeLimitCone(const PxTransform& t, float tanQSwingY, float tanQSwingZ) = 0;
virtual void visualizeDoubleCone(const PxTransform& t, float angle) = 0;
// Clear the immedate buffer.
virtual void flushRenderEvents() = 0;
static PvdUserRenderer* create(uint32_t bufferSize = 0x2000);
};
class RendererEventClient
{
public:
virtual ~RendererEventClient(){}
virtual void handleBufferFlush(const uint8_t* inData, uint32_t inLength) = 0;
};
#if !PX_DOXYGEN
}
}
#endif
/** @} */
#endif
| 3,856 | C | 34.385321 | 116 | 0.759855 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/include/PxPvdClient.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PVD_CLIENT_H
#define PX_PVD_CLIENT_H
/** \addtogroup pvd
@{
*/
#include "foundation/PxFlags.h"
#include "foundation/PxVec3.h"
#if !PX_DOXYGEN
namespace physx
{
namespace pvdsdk
{
#endif
class PvdDataStream;
class PvdUserRenderer;
/**
\brief PvdClient is the per-client connection to PVD.
It provides callback when PVD is connected/disconnted.
It provides access to the internal object so that advanced users can create extension client.
*/
class PvdClient
{
public:
virtual PvdDataStream* getDataStream() = 0;
virtual bool isConnected() const = 0;
virtual void onPvdConnected() = 0;
virtual void onPvdDisconnected() = 0;
virtual void flush() = 0;
protected:
virtual ~PvdClient()
{
}
};
#if !PX_DOXYGEN
} // namespace pvdsdk
} // namespace physx
#endif
/** @} */
#endif
| 2,497 | C | 31.441558 | 93 | 0.752103 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/include/PxPvdDataStream.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PX_PVD_DATA_STREAM_H
#define PX_PVD_DATA_STREAM_H
/** \addtogroup pvd
@{
*/
#include "pvd/PxPvd.h"
#include "PxPvdErrorCodes.h"
#include "PxPvdObjectModelBaseTypes.h"
#if !PX_DOXYGEN
namespace physx
{
namespace pvdsdk
{
#endif
class PvdPropertyDefinitionHelper;
class PvdMetaDataStream
{
protected:
virtual ~PvdMetaDataStream()
{
}
public:
virtual PvdError createClass(const NamespacedName& nm) = 0;
template <typename TDataType>
PvdError createClass()
{
return createClass(getPvdNamespacedNameForType<TDataType>());
}
virtual PvdError deriveClass(const NamespacedName& parent, const NamespacedName& child) = 0;
template <typename TParentType, typename TChildType>
PvdError deriveClass()
{
return deriveClass(getPvdNamespacedNameForType<TParentType>(), getPvdNamespacedNameForType<TChildType>());
}
virtual bool isClassExist(const NamespacedName& nm) = 0;
template <typename TDataType>
bool isClassExist()
{
return isClassExist(getPvdNamespacedNameForType<TDataType>());
}
virtual PvdError createProperty(const NamespacedName& clsName, const char* name, const char* semantic,
const NamespacedName& dtypeName, PropertyType::Enum propertyType,
DataRef<NamedValue> values = DataRef<NamedValue>()) = 0;
template <typename TClsType, typename TDataType>
PvdError createProperty(String name, String semantic = "", PropertyType::Enum propertyType = PropertyType::Scalar,
DataRef<NamedValue> values = DataRef<NamedValue>())
{
return createProperty(getPvdNamespacedNameForType<TClsType>(), name, semantic,
getPvdNamespacedNameForType<TDataType>(), propertyType, values);
}
virtual PvdError createPropertyMessage(const NamespacedName& cls, const NamespacedName& msgName,
DataRef<PropertyMessageArg> entries, uint32_t messageSizeInBytes) = 0;
template <typename TClsType, typename TMsgType>
PvdError createPropertyMessage(DataRef<PropertyMessageArg> entries)
{
return createPropertyMessage(getPvdNamespacedNameForType<TClsType>(), getPvdNamespacedNameForType<TMsgType>(),
entries, sizeof(TMsgType));
}
};
class PvdInstanceDataStream
{
protected:
virtual ~PvdInstanceDataStream()
{
}
public:
virtual PvdError createInstance(const NamespacedName& cls, const void* instance) = 0;
template <typename TDataType>
PvdError createInstance(const TDataType* inst)
{
return createInstance(getPvdNamespacedNameForType<TDataType>(), inst);
}
virtual bool isInstanceValid(const void* instance) = 0;
// If the property will fit or is already completely in memory
virtual PvdError setPropertyValue(const void* instance, String name, DataRef<const uint8_t> data,
const NamespacedName& incomingTypeName) = 0;
template <typename TDataType>
PvdError setPropertyValue(const void* instance, String name, const TDataType& value)
{
const uint8_t* dataStart = reinterpret_cast<const uint8_t*>(&value);
return setPropertyValue(instance, name, DataRef<const uint8_t>(dataStart, dataStart + sizeof(TDataType)),
getPvdNamespacedNameForType<TDataType>());
}
template <typename TDataType>
PvdError setPropertyValue(const void* instance, String name, const TDataType* value, uint32_t numItems)
{
const uint8_t* dataStart = reinterpret_cast<const uint8_t*>(value);
return setPropertyValue(instance, name,
DataRef<const uint8_t>(dataStart, dataStart + sizeof(TDataType) * numItems),
getPvdNamespacedNameForType<TDataType>());
}
// Else if the property is very large (contact reports) you can send it in chunks.
virtual PvdError beginSetPropertyValue(const void* instance, String name, const NamespacedName& incomingTypeName) = 0;
template <typename TDataType>
PvdError beginSetPropertyValue(const void* instance, String name)
{
return beginSetPropertyValue(instance, name, getPvdNamespacedNameForType<TDataType>());
}
virtual PvdError appendPropertyValueData(DataRef<const uint8_t> data) = 0;
template <typename TDataType>
PvdError appendPropertyValueData(const TDataType* value, uint32_t numItems)
{
const uint8_t* dataStart = reinterpret_cast<const uint8_t*>(value);
return appendPropertyValueData(DataRef<const uint8_t>(dataStart, dataStart + numItems * sizeof(TDataType)));
}
virtual PvdError endSetPropertyValue() = 0;
// Set a set of properties to various values on an object.
virtual PvdError setPropertyMessage(const void* instance, const NamespacedName& msgName,
DataRef<const uint8_t> data) = 0;
template <typename TDataType>
PvdError setPropertyMessage(const void* instance, const TDataType& value)
{
const uint8_t* dataStart = reinterpret_cast<const uint8_t*>(&value);
return setPropertyMessage(instance, getPvdNamespacedNameForType<TDataType>(),
DataRef<const uint8_t>(dataStart, sizeof(TDataType)));
}
// If you need to send of lot of identical messages, this avoids a hashtable lookup per message.
virtual PvdError beginPropertyMessageGroup(const NamespacedName& msgName) = 0;
template <typename TDataType>
PvdError beginPropertyMessageGroup()
{
return beginPropertyMessageGroup(getPvdNamespacedNameForType<TDataType>());
}
virtual PvdError sendPropertyMessageFromGroup(const void* instance, DataRef<const uint8_t> data) = 0;
template <typename TDataType>
PvdError sendPropertyMessageFromGroup(const void* instance, const TDataType& value)
{
const uint8_t* dataStart = reinterpret_cast<const uint8_t*>(&value);
return sendPropertyMessageFromGroup(instance, DataRef<const uint8_t>(dataStart, sizeof(TDataType)));
}
virtual PvdError endPropertyMessageGroup() = 0;
// These functions ensure the target array doesn't contain duplicates
virtual PvdError pushBackObjectRef(const void* instId, String propName, const void* objRef) = 0;
virtual PvdError removeObjectRef(const void* instId, String propName, const void* objRef) = 0;
// Instance elimination.
virtual PvdError destroyInstance(const void* key) = 0;
// Profiling hooks
virtual PvdError beginSection(const void* instance, String name) = 0;
virtual PvdError endSection(const void* instance, String name) = 0;
// Origin Shift
virtual PvdError originShift(const void* scene, PxVec3 shift) = 0;
public:
/*For some cases, pvd command cannot be run immediately. For example, when create joints, while the actors may still
*pending for insert, the joints update commands can be run deffered.
*/
class PvdCommand
{
public:
// Assigned is needed for copying
PvdCommand(const PvdCommand&)
{
}
PvdCommand& operator=(const PvdCommand&)
{
return *this;
}
public:
PvdCommand()
{
}
virtual ~PvdCommand()
{
}
// Not pure virtual so can have default PvdCommand obj
virtual bool canRun(PvdInstanceDataStream&)
{
return false;
}
virtual void run(PvdInstanceDataStream&)
{
}
};
// PVD SDK provide this helper function to allocate cmd's memory and release them at after flush the command queue
virtual void* allocateMemForCmd(uint32_t length) = 0;
// PVD will call the destructor of PvdCommand object at the end fo flushPvdCommand
virtual void pushPvdCommand(PvdCommand& cmd) = 0;
virtual void flushPvdCommand() = 0;
};
class PvdDataStream : public PvdInstanceDataStream, public PvdMetaDataStream
{
protected:
virtual ~PvdDataStream()
{
}
public:
virtual void release() = 0;
virtual bool isConnected() = 0;
virtual void addProfileZone(void* zone, const char* name) = 0;
virtual void addProfileZoneEvent(void* zone, const char* name, uint16_t eventId, bool compileTimeEnabled) = 0;
virtual PvdPropertyDefinitionHelper& getPropertyDefinitionHelper() = 0;
virtual void setIsTopLevelUIElement(const void* instance, bool topLevel) = 0;
virtual void sendErrorMessage(uint32_t code, const char* message, const char* file, uint32_t line) = 0;
virtual void updateCamera(const char* name, const PxVec3& origin, const PxVec3& up, const PxVec3& target) = 0;
/**
\brief Create a new PvdDataStream.
\param pvd A pointer to a valid PxPvd instance. This must be non-null.
*/
static PvdDataStream* create(PxPvd* pvd);
};
#if !PX_DOXYGEN
} // pvdsdk
} // physx
#endif
/** @} */
#endif
| 9,961 | C | 35.357664 | 119 | 0.740086 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/include/PxPvdDataStreamHelpers.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PX_PVD_DATA_STREAM_HELPERS_H
#define PX_PVD_DATA_STREAM_HELPERS_H
/** \addtogroup pvd
@{
*/
#include "PxPvdObjectModelBaseTypes.h"
#if !PX_DOXYGEN
namespace physx
{
namespace pvdsdk
{
#endif
class PvdPropertyDefinitionHelper
{
protected:
virtual ~PvdPropertyDefinitionHelper()
{
}
public:
/**
Push a name c such that it appends such as a.b.c.
*/
virtual void pushName(const char* inName, const char* inAppendStr = ".") = 0;
/**
Push a name c such that it appends like a.b[c]
*/
virtual void pushBracketedName(const char* inName, const char* leftBracket = "[", const char* rightBracket = "]") = 0;
/**
* Pop the current name
*/
virtual void popName() = 0;
virtual void clearNameStack() = 0;
/**
* Get the current name at the top of the name stack.
* Would return "a.b.c" or "a.b[c]" in the above examples.
*/
virtual const char* getTopName() = 0;
virtual void addNamedValue(const char* name, uint32_t value) = 0;
virtual void clearNamedValues() = 0;
virtual DataRef<NamedValue> getNamedValues() = 0;
/**
* Define a property using the top of the name stack and the passed-in semantic
*/
virtual void createProperty(const NamespacedName& clsName, const char* inSemantic, const NamespacedName& dtypeName,
PropertyType::Enum propType = PropertyType::Scalar) = 0;
template <typename TClsType, typename TDataType>
void createProperty(const char* inSemantic = "", PropertyType::Enum propType = PropertyType::Scalar)
{
createProperty(getPvdNamespacedNameForType<TClsType>(), inSemantic, getPvdNamespacedNameForType<TDataType>(),
propType);
}
// The datatype used for instances needs to be pointer unless you actually have pvdsdk::InstanceId members on your
// value structs.
virtual void addPropertyMessageArg(const NamespacedName& inDatatype, uint32_t inOffset, uint32_t inSize) = 0;
template <typename TDataType>
void addPropertyMessageArg(uint32_t offset)
{
addPropertyMessageArg(getPvdNamespacedNameForType<TDataType>(), offset, static_cast<uint32_t>(sizeof(TDataType)));
}
virtual void addPropertyMessage(const NamespacedName& clsName, const NamespacedName& msgName,
uint32_t inStructSizeInBytes) = 0;
template <typename TClsType, typename TMsgType>
void addPropertyMessage()
{
addPropertyMessage(getPvdNamespacedNameForType<TClsType>(), getPvdNamespacedNameForType<TMsgType>(),
static_cast<uint32_t>(sizeof(TMsgType)));
}
virtual void clearPropertyMessageArgs() = 0;
void clearBufferedData()
{
clearNameStack();
clearPropertyMessageArgs();
clearNamedValues();
}
};
#if !PX_DOXYGEN
} // pvdsdk
} // physx
#endif
/** @} */
#endif
| 4,289 | C | 34.163934 | 119 | 0.73094 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/include/PxPvdObjectModelBaseTypes.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PX_PVD_OBJECT_MODEL_BASE_TYPES_H
#define PX_PVD_OBJECT_MODEL_BASE_TYPES_H
/** \addtogroup pvd
@{
*/
#include "foundation/PxAssert.h"
#if !PX_DOXYGEN
namespace physx
{
namespace pvdsdk
{
#endif
using namespace physx;
inline const char* nonNull(const char* str)
{
return str ? str : "";
}
// strcmp will crash if passed a null string, however,
// so we need to make sure that doesn't happen. We do that
// by equating NULL and the empty string, "".
inline bool safeStrEq(const char* lhs, const char* rhs)
{
return ::strcmp(nonNull(lhs), nonNull(rhs)) == 0;
}
// Does this string have useful information in it.
inline bool isMeaningful(const char* str)
{
return *(nonNull(str)) > 0;
}
inline uint32_t safeStrLen(const char* str)
{
str = nonNull(str);
return static_cast<uint32_t>(strlen(str));
}
struct ObjectRef
{
int32_t mInstanceId;
ObjectRef(int32_t iid = -1) : mInstanceId(iid)
{
}
operator int32_t() const
{
return mInstanceId;
}
bool hasValue() const
{
return mInstanceId > 0;
}
};
struct U32Array4
{
uint32_t mD0;
uint32_t mD1;
uint32_t mD2;
uint32_t mD3;
U32Array4(uint32_t d0, uint32_t d1, uint32_t d2, uint32_t d3) : mD0(d0), mD1(d1), mD2(d2), mD3(d3)
{
}
U32Array4() : mD0(0), mD1(0), mD2(0), mD3(0)
{
}
};
typedef bool PvdBool;
typedef const char* String;
typedef void* VoidPtr;
typedef double PvdF64;
typedef float PvdF32;
typedef int64_t PvdI64;
typedef uint64_t PvdU64;
typedef int32_t PvdI32;
typedef uint32_t PvdU32;
typedef int16_t PvdI16;
typedef uint16_t PvdU16;
typedef int8_t PvdI8;
typedef uint8_t PvdU8;
struct PvdColor
{
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t a;
PvdColor(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a = 255) : r(_r), g(_g), b(_b), a(_a)
{
}
PvdColor() : r(0), g(0), b(0), a(255)
{
}
PvdColor(uint32_t abgr)
{
uint8_t* valPtr = reinterpret_cast<uint8_t*>(&abgr);
r = valPtr[0];
g = valPtr[1];
b = valPtr[2];
a = valPtr[3];
}
};
struct StringHandle
{
uint32_t mHandle;
StringHandle(uint32_t val = 0) : mHandle(val)
{
}
operator uint32_t() const
{
return mHandle;
}
};
#define DECLARE_TYPES \
DECLARE_BASE_PVD_TYPE(PvdI8) \
DECLARE_BASE_PVD_TYPE(PvdU8) \
DECLARE_BASE_PVD_TYPE(PvdI16) \
DECLARE_BASE_PVD_TYPE(PvdU16) \
DECLARE_BASE_PVD_TYPE(PvdI32) \
DECLARE_BASE_PVD_TYPE(PvdU32) \
DECLARE_BASE_PVD_TYPE(PvdI64) \
DECLARE_BASE_PVD_TYPE(PvdU64) \
DECLARE_BASE_PVD_TYPE(PvdF32) \
DECLARE_BASE_PVD_TYPE(PvdF64) \
DECLARE_BASE_PVD_TYPE(PvdBool) \
DECLARE_BASE_PVD_TYPE(PvdColor) \
DECLARE_BASE_PVD_TYPE(String) \
DECLARE_BASE_PVD_TYPE(StringHandle) \
DECLARE_BASE_PVD_TYPE(ObjectRef) \
DECLARE_BASE_PVD_TYPE(VoidPtr) \
DECLARE_BASE_PVD_TYPE(PxVec2) \
DECLARE_BASE_PVD_TYPE(PxVec3) \
DECLARE_BASE_PVD_TYPE(PxVec4) \
DECLARE_BASE_PVD_TYPE(PxBounds3) \
DECLARE_BASE_PVD_TYPE(PxQuat) \
DECLARE_BASE_PVD_TYPE(PxTransform) \
DECLARE_BASE_PVD_TYPE(PxMat33) \
DECLARE_BASE_PVD_TYPE(PxMat44) \
DECLARE_BASE_PVD_TYPE(U32Array4)
struct PvdBaseType
{
enum Enum
{
None = 0,
InternalStart = 1,
InternalStop = 64,
#define DECLARE_BASE_PVD_TYPE(type) type,
DECLARE_TYPES
Last
#undef DECLARE_BASE_PVD_TYPE
};
};
struct NamespacedName
{
String mNamespace;
String mName;
NamespacedName(String ns, String nm) : mNamespace(ns), mName(nm)
{
}
NamespacedName(String nm = "") : mNamespace(""), mName(nm)
{
}
bool operator==(const NamespacedName& other) const
{
return safeStrEq(mNamespace, other.mNamespace) && safeStrEq(mName, other.mName);
}
};
struct NamedValue
{
String mName;
uint32_t mValue;
NamedValue(String nm = "", uint32_t val = 0) : mName(nm), mValue(val)
{
}
};
template <typename T>
struct BaseDataTypeToTypeMap
{
bool compile_error;
};
template <PvdBaseType::Enum>
struct BaseTypeToDataTypeMap
{
bool compile_error;
};
// Users can extend this mapping with new datatypes.
template <typename T>
struct PvdDataTypeToNamespacedNameMap
{
bool Name;
};
// This mapping tells you the what class id to use for the base datatypes
//
#define DECLARE_BASE_PVD_TYPE(type) \
template <> \
struct BaseDataTypeToTypeMap<type> \
{ \
enum Enum \
{ \
BaseTypeEnum = PvdBaseType::type \
}; \
}; \
template <> \
struct BaseDataTypeToTypeMap<const type&> \
{ \
enum Enum \
{ \
BaseTypeEnum = PvdBaseType::type \
}; \
}; \
template <> \
struct BaseTypeToDataTypeMap<PvdBaseType::type> \
{ \
typedef type TDataType; \
}; \
template <> \
struct PvdDataTypeToNamespacedNameMap<type> \
{ \
NamespacedName Name; \
PvdDataTypeToNamespacedNameMap<type>() : Name("physx3", #type) \
{ \
} \
}; \
template <> \
struct PvdDataTypeToNamespacedNameMap<const type&> \
{ \
NamespacedName Name; \
PvdDataTypeToNamespacedNameMap<const type&>() : Name("physx3", #type) \
{ \
} \
};
DECLARE_TYPES
#undef DECLARE_BASE_PVD_TYPE
template <typename TDataType>
inline int32_t getPvdTypeForType()
{
return static_cast<PvdBaseType::Enum>(BaseDataTypeToTypeMap<TDataType>::BaseTypeEnum);
}
template <typename TDataType>
inline NamespacedName getPvdNamespacedNameForType()
{
return PvdDataTypeToNamespacedNameMap<TDataType>().Name;
}
#define DEFINE_PVD_TYPE_NAME_MAP(type, ns, name) \
template <> \
struct PvdDataTypeToNamespacedNameMap<type> \
{ \
NamespacedName Name; \
PvdDataTypeToNamespacedNameMap<type>() : Name(ns, name) \
{ \
} \
};
#define DEFINE_PVD_TYPE_ALIAS(newType, oldType) \
template <> \
struct PvdDataTypeToNamespacedNameMap<newType> \
{ \
NamespacedName Name; \
PvdDataTypeToNamespacedNameMap<newType>() : Name(PvdDataTypeToNamespacedNameMap<oldType>().Name) \
{ \
} \
};
DEFINE_PVD_TYPE_ALIAS(const void*, void*)
struct ArrayData
{
uint8_t* mBegin;
uint8_t* mEnd;
uint8_t* mCapacity; //>= stop
ArrayData(uint8_t* beg = NULL, uint8_t* end = NULL, uint8_t* cap = NULL) : mBegin(beg), mEnd(end), mCapacity(cap)
{
}
uint8_t* begin()
{
return mBegin;
}
uint8_t* end()
{
return mEnd;
}
uint32_t byteCapacity()
{
return static_cast<uint32_t>(mCapacity - mBegin);
}
uint32_t byteSize() const
{
return static_cast<uint32_t>(mEnd - mBegin);
} // in bytes
uint32_t numberOfItems(uint32_t objectByteSize)
{
if(objectByteSize)
return byteSize() / objectByteSize;
return 0;
}
void forgetData()
{
mBegin = mEnd = mCapacity = 0;
}
};
template <typename T>
class DataRef
{
const T* mBegin;
const T* mEnd;
public:
DataRef(const T* b, uint32_t count) : mBegin(b), mEnd(b + count)
{
}
DataRef(const T* b = NULL, const T* e = NULL) : mBegin(b), mEnd(e)
{
}
DataRef(const DataRef& o) : mBegin(o.mBegin), mEnd(o.mEnd)
{
}
DataRef& operator=(const DataRef& o)
{
mBegin = o.mBegin;
mEnd = o.mEnd;
return *this;
}
uint32_t size() const
{
return static_cast<uint32_t>(mEnd - mBegin);
}
const T* begin() const
{
return mBegin;
}
const T* end() const
{
return mEnd;
}
const T& operator[](uint32_t idx) const
{
PX_ASSERT(idx < size());
return mBegin[idx];
}
const T& back() const
{
PX_ASSERT(mEnd > mBegin);
return *(mEnd - 1);
}
};
struct PropertyType
{
enum Enum
{
Unknown = 0,
Scalar,
Array
};
};
// argument to the create property message function
struct PropertyMessageArg
{
String mPropertyName;
NamespacedName mDatatypeName;
// where in the message this property starts.
uint32_t mMessageOffset;
// size of this entry object
uint32_t mByteSize;
PropertyMessageArg(String propName, NamespacedName dtype, uint32_t msgOffset, uint32_t byteSize)
: mPropertyName(propName), mDatatypeName(dtype), mMessageOffset(msgOffset), mByteSize(byteSize)
{
}
PropertyMessageArg() : mPropertyName(""), mMessageOffset(0), mByteSize(0)
{
}
};
class PvdUserRenderer;
DEFINE_PVD_TYPE_NAME_MAP(PvdUserRenderer, "_debugger_", "PvdUserRenderer")
#if !PX_DOXYGEN
}
}
#endif
/** @} */
#endif
| 14,371 | C | 32.501165 | 120 | 0.455431 |
NVIDIA-Omniverse/PhysX/physx/source/pvd/include/PxProfileAllocatorWrapper.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PROFILE_ALLOCATOR_WRAPPER_H
#define PX_PROFILE_ALLOCATOR_WRAPPER_H
#include "foundation/PxPreprocessor.h"
#include "foundation/PxAllocatorCallback.h"
#include "foundation/PxErrorCallback.h"
#include "foundation/PxAssert.h"
#include "foundation/PxHashMap.h"
#include "foundation/PxArray.h"
namespace physx { namespace profile {
/**
\brief Helper struct to encapsulate the user allocator callback
Useful for array and hash templates
*/
struct PxProfileAllocatorWrapper
{
PxAllocatorCallback* mUserAllocator;
PxProfileAllocatorWrapper( PxAllocatorCallback& inUserAllocator )
: mUserAllocator( &inUserAllocator )
{
}
PxProfileAllocatorWrapper( PxAllocatorCallback* inUserAllocator )
: mUserAllocator( inUserAllocator )
{
}
PxAllocatorCallback& getAllocator() const
{
PX_ASSERT( NULL != mUserAllocator );
return *mUserAllocator;
}
};
/**
\brief Helper class to encapsulate the reflection allocator
*/
template <typename T>
class PxProfileWrapperReflectionAllocator
{
static const char* getName()
{
#if PX_LINUX || PX_OSX || PX_EMSCRIPTEN || PX_SWITCH
return __PRETTY_FUNCTION__;
#else
return typeid(T).name();
#endif
}
PxProfileAllocatorWrapper* mWrapper;
public:
PxProfileWrapperReflectionAllocator(PxProfileAllocatorWrapper& inWrapper) : mWrapper( &inWrapper ) {}
PxProfileWrapperReflectionAllocator( const PxProfileWrapperReflectionAllocator& inOther )
: mWrapper( inOther.mWrapper )
{
}
PxProfileWrapperReflectionAllocator& operator=( const PxProfileWrapperReflectionAllocator& inOther )
{
mWrapper = inOther.mWrapper;
return *this;
}
PxAllocatorCallback& getAllocator() { return mWrapper->getAllocator(); }
void* allocate(size_t size, const char* filename, int line)
{
#if PX_CHECKED // checked and debug builds
if(!size)
return 0;
return getAllocator().allocate(size, getName(), filename, line);
#else
return getAllocator().allocate(size, "<no allocation names in this config>", filename, line);
#endif
}
void deallocate(void* ptr)
{
if(ptr)
getAllocator().deallocate(ptr);
}
};
/**
\brief Helper class to encapsulate the named allocator
*/
struct PxProfileWrapperNamedAllocator
{
PxProfileAllocatorWrapper* mWrapper;
const char* mAllocationName;
PxProfileWrapperNamedAllocator(PxProfileAllocatorWrapper& inWrapper, const char* inAllocationName)
: mWrapper( &inWrapper )
, mAllocationName( inAllocationName )
{}
PxProfileWrapperNamedAllocator( const PxProfileWrapperNamedAllocator& inOther )
: mWrapper( inOther.mWrapper )
, mAllocationName( inOther.mAllocationName )
{
}
PxProfileWrapperNamedAllocator& operator=( const PxProfileWrapperNamedAllocator& inOther )
{
mWrapper = inOther.mWrapper;
mAllocationName = inOther.mAllocationName;
return *this;
}
PxAllocatorCallback& getAllocator() { return mWrapper->getAllocator(); }
void* allocate(size_t size, const char* filename, int line)
{
if(!size)
return 0;
return getAllocator().allocate(size, mAllocationName, filename, line);
}
void deallocate(void* ptr)
{
if(ptr)
getAllocator().deallocate(ptr);
}
};
/**
\brief Helper struct to encapsulate the array
*/
template<class T>
struct PxProfileArray : public PxArray<T, PxProfileWrapperReflectionAllocator<T> >
{
typedef PxProfileWrapperReflectionAllocator<T> TAllocatorType;
PxProfileArray( PxProfileAllocatorWrapper& inWrapper )
: PxArray<T, TAllocatorType >( TAllocatorType( inWrapper ) )
{
}
PxProfileArray( const PxProfileArray< T >& inOther )
: PxArray<T, TAllocatorType >( inOther, inOther )
{
}
};
/**
\brief Helper struct to encapsulate the array
*/
template<typename TKeyType, typename TValueType, typename THashType=PxHash<TKeyType> >
struct PxProfileHashMap : public PxHashMap<TKeyType, TValueType, THashType, PxProfileWrapperReflectionAllocator< TValueType > >
{
typedef PxHashMap<TKeyType, TValueType, THashType, PxProfileWrapperReflectionAllocator< TValueType > > THashMapType;
typedef PxProfileWrapperReflectionAllocator<TValueType> TAllocatorType;
PxProfileHashMap( PxProfileAllocatorWrapper& inWrapper )
: THashMapType( TAllocatorType( inWrapper ) )
{
}
};
/**
\brief Helper function to encapsulate the profile allocation
*/
template<typename TDataType>
inline TDataType* PxProfileAllocate( PxAllocatorCallback* inAllocator, const char* file, int inLine )
{
PxProfileAllocatorWrapper wrapper( inAllocator );
typedef PxProfileWrapperReflectionAllocator< TDataType > TAllocator;
TAllocator theAllocator( wrapper );
return reinterpret_cast<TDataType*>( theAllocator.allocate( sizeof( TDataType ), file, inLine ) );
}
/**
\brief Helper function to encapsulate the profile allocation
*/
template<typename TDataType>
inline TDataType* PxProfileAllocate( PxAllocatorCallback& inAllocator, const char* file, int inLine )
{
return PxProfileAllocate<TDataType>( &inAllocator, file, inLine );
}
/**
\brief Helper function to encapsulate the profile deallocation
*/
template<typename TDataType>
inline void PxProfileDeleteAndDeallocate( PxProfileAllocatorWrapper& inAllocator, TDataType* inDType )
{
PX_ASSERT(inDType);
PxAllocatorCallback& allocator( inAllocator.getAllocator() );
inDType->~TDataType();
allocator.deallocate( inDType );
}
/**
\brief Helper function to encapsulate the profile deallocation
*/
template<typename TDataType>
inline void PxProfileDeleteAndDeallocate( PxAllocatorCallback& inAllocator, TDataType* inDType )
{
PxProfileAllocatorWrapper wrapper( &inAllocator );
PxProfileDeleteAndDeallocate( wrapper, inDType );
}
} }
#define PX_PROFILE_NEW( allocator, dtype ) new (physx::profile::PxProfileAllocate<dtype>( allocator, PX_FL)) dtype
#define PX_PROFILE_DELETE( allocator, obj ) physx::profile::PxProfileDeleteAndDeallocate( allocator, obj );
#endif
| 7,606 | C | 32.073913 | 128 | 0.756902 |
NVIDIA-Omniverse/PhysX/physx/source/physxcooking/src/Cooking.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "Cooking.h"
#include "GuCooking.h"
#include "GuBVH.h"
///////////////////////////////////////////////////////////////////////////////
using namespace physx;
using namespace Gu;
#include "cooking/PxCookingInternal.h"
#include "GuTriangleMeshBV4.h"
physx::PxTriangleMesh* PxCreateTriangleMeshInternal(const physx::PxTriangleMeshInternalData& data)
{
TriangleMesh* np;
PX_NEW_SERIALIZED(np, BV4TriangleMesh)(data);
return np;
}
physx::PxBVH* PxCreateBVHInternal(const physx::PxBVHInternalData& data)
{
BVH* np;
PX_NEW_SERIALIZED(np, BVH)(data);
return np;
}
///////////////////////////////////////////////////////////////////////////////
PxInsertionCallback* PxGetStandaloneInsertionCallback()
{
return immediateCooking::getInsertionCallback();
}
bool PxCookBVH(const PxBVHDesc& desc, PxOutputStream& stream)
{
return immediateCooking::cookBVH(desc, stream);
}
PxBVH* PxCreateBVH(const PxBVHDesc& desc, PxInsertionCallback& insertionCallback)
{
return immediateCooking::createBVH(desc, insertionCallback);
}
bool PxCookHeightField(const PxHeightFieldDesc& desc, PxOutputStream& stream)
{
return immediateCooking::cookHeightField(desc, stream);
}
PxHeightField* PxCreateHeightField(const PxHeightFieldDesc& desc, PxInsertionCallback& insertionCallback)
{
return immediateCooking::createHeightField(desc, insertionCallback);
}
bool PxCookConvexMesh(const PxCookingParams& params, const PxConvexMeshDesc& desc, PxOutputStream& stream, PxConvexMeshCookingResult::Enum* condition)
{
return immediateCooking::cookConvexMesh(params, desc, stream, condition);
}
PxConvexMesh* PxCreateConvexMesh(const PxCookingParams& params, const PxConvexMeshDesc& desc, PxInsertionCallback& insertionCallback, PxConvexMeshCookingResult::Enum* condition)
{
return immediateCooking::createConvexMesh(params, desc, insertionCallback, condition);
}
bool PxValidateConvexMesh(const PxCookingParams& params, const PxConvexMeshDesc& desc)
{
return immediateCooking::validateConvexMesh(params, desc);
}
bool PxComputeHullPolygons(const PxCookingParams& params, const PxSimpleTriangleMesh& mesh, PxAllocatorCallback& inCallback, PxU32& nbVerts, PxVec3*& vertices, PxU32& nbIndices, PxU32*& indices, PxU32& nbPolygons, PxHullPolygon*& hullPolygons)
{
return immediateCooking::computeHullPolygons(params, mesh, inCallback, nbVerts, vertices, nbIndices, indices, nbPolygons, hullPolygons);
}
bool PxValidateTriangleMesh(const PxCookingParams& params, const PxTriangleMeshDesc& desc)
{
return immediateCooking::validateTriangleMesh(params, desc);
}
PxTriangleMesh* PxCreateTriangleMesh(const PxCookingParams& params, const PxTriangleMeshDesc& desc, PxInsertionCallback& insertionCallback, PxTriangleMeshCookingResult::Enum* condition)
{
return immediateCooking::createTriangleMesh(params, desc, insertionCallback, condition);
}
bool PxCookTriangleMesh(const PxCookingParams& params, const PxTriangleMeshDesc& desc, PxOutputStream& stream, PxTriangleMeshCookingResult::Enum* condition)
{
return immediateCooking::cookTriangleMesh(params, desc, stream, condition);
}
bool PxCookTetrahedronMesh(const PxCookingParams& params, const PxTetrahedronMeshDesc& meshDesc, PxOutputStream& stream)
{
return immediateCooking::cookTetrahedronMesh(params, meshDesc, stream);
}
PxTetrahedronMesh* PxCreateTetrahedronMesh(const PxCookingParams& params, const PxTetrahedronMeshDesc& meshDesc, PxInsertionCallback& insertionCallback)
{
return immediateCooking::createTetrahedronMesh(params, meshDesc, insertionCallback);
}
bool PxCookSoftBodyMesh(const PxCookingParams& params, const PxTetrahedronMeshDesc& simulationMeshDesc, const PxTetrahedronMeshDesc& collisionMeshDesc, const PxSoftBodySimulationDataDesc& softbodyDataDesc, PxOutputStream& stream)
{
return immediateCooking::cookSoftBodyMesh(params, simulationMeshDesc, collisionMeshDesc, softbodyDataDesc, stream);
}
PxSoftBodyMesh* PxCreateSoftBodyMesh(const PxCookingParams& params, const PxTetrahedronMeshDesc& simulationMeshDesc, const PxTetrahedronMeshDesc& collisionMeshDesc, const PxSoftBodySimulationDataDesc& softbodyDataDesc, PxInsertionCallback& insertionCallback)
{
return immediateCooking::createSoftBodyMesh(params, simulationMeshDesc, collisionMeshDesc, softbodyDataDesc, insertionCallback);
}
PxCollisionMeshMappingData* PxComputeModelsMapping(const PxCookingParams& params, PxTetrahedronMeshData& simulationMesh, const PxTetrahedronMeshData& collisionMesh, const PxSoftBodyCollisionData& collisionData, const PxBoundedData* vertexToTet)
{
return immediateCooking::computeModelsMapping(params, simulationMesh, collisionMesh, collisionData, vertexToTet);
}
PxCollisionTetrahedronMeshData* PxComputeCollisionData(const PxCookingParams& params, const PxTetrahedronMeshDesc& collisionMeshDesc)
{
return immediateCooking::computeCollisionData(params, collisionMeshDesc);
}
PxSimulationTetrahedronMeshData* PxComputeSimulationData(const PxCookingParams& params, const PxTetrahedronMeshDesc& simulationMeshDesc)
{
return immediateCooking::computeSimulationData(params, simulationMeshDesc);
}
PxSoftBodyMesh* PxAssembleSoftBodyMesh(PxTetrahedronMeshData& simulationMesh, PxSoftBodySimulationData& simulationData, PxTetrahedronMeshData& collisionMesh, PxSoftBodyCollisionData& collisionData, PxCollisionMeshMappingData& mappingData, PxInsertionCallback& insertionCallback)
{
return immediateCooking::assembleSoftBodyMesh(simulationMesh, simulationData, collisionMesh, collisionData, mappingData, insertionCallback);
}
PxSoftBodyMesh* PxAssembleSoftBodyMesh_Sim(PxSimulationTetrahedronMeshData& simulationMesh, PxCollisionTetrahedronMeshData& collisionMesh, PxCollisionMeshMappingData& mappingData, PxInsertionCallback& insertionCallback)
{
return immediateCooking::assembleSoftBodyMesh_Sim(simulationMesh, collisionMesh, mappingData, insertionCallback);
}
| 7,525 | C++ | 45.745341 | 278 | 0.807575 |
NVIDIA-Omniverse/PhysX/physx/source/task/src/TaskManager.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
#include "task/PxTask.h"
#include "foundation/PxErrors.h"
#include "foundation/PxHashMap.h"
#include "foundation/PxAllocator.h"
#include "foundation/PxAtomic.h"
#include "foundation/PxMutex.h"
#include "foundation/PxArray.h"
#include "foundation/PxThread.h"
#define LOCK() PxMutex::ScopedLock _lock_(mMutex)
namespace physx
{
const int EOL = -1;
typedef PxHashMap<const char *, PxTaskID> PxTaskNameToIDMap;
struct PxTaskDepTableRow
{
PxTaskID mTaskID;
int mNextDep;
};
typedef PxArray<PxTaskDepTableRow> PxTaskDepTable;
class PxTaskTableRow
{
public:
PxTaskTableRow() : mRefCount( 1 ), mStartDep(EOL), mLastDep(EOL) {}
void addDependency( PxTaskDepTable& depTable, PxTaskID taskID )
{
int newDep = int(depTable.size());
PxTaskDepTableRow row;
row.mTaskID = taskID;
row.mNextDep = EOL;
depTable.pushBack( row );
if( mLastDep == EOL )
{
mStartDep = mLastDep = newDep;
}
else
{
depTable[ uint32_t(mLastDep) ].mNextDep = newDep;
mLastDep = newDep;
}
}
PxTask * mTask;
volatile int mRefCount;
PxTaskType::Enum mType;
int mStartDep;
int mLastDep;
};
typedef PxArray<PxTaskTableRow> PxTaskTable;
/* Implementation of PxTaskManager abstract API */
class PxTaskMgr : public PxTaskManager, public PxUserAllocated
{
PX_NOCOPY(PxTaskMgr)
public:
PxTaskMgr(PxErrorCallback& , PxCpuDispatcher*);
~PxTaskMgr();
void setCpuDispatcher( PxCpuDispatcher& ref )
{
mCpuDispatcher = &ref;
}
PxCpuDispatcher* getCpuDispatcher() const
{
return mCpuDispatcher;
}
void resetDependencies();
void startSimulation();
void stopSimulation();
void taskCompleted( PxTask& task );
PxTaskID getNamedTask( const char *name );
PxTaskID submitNamedTask( PxTask *task, const char *name, PxTaskType::Enum type = PxTaskType::eCPU );
PxTaskID submitUnnamedTask( PxTask& task, PxTaskType::Enum type = PxTaskType::eCPU );
PxTask* getTaskFromID( PxTaskID );
void dispatchTask( PxTaskID taskID );
void resolveRow( PxTaskID taskID );
void release();
void finishBefore( PxTask& task, PxTaskID taskID );
void startAfter( PxTask& task, PxTaskID taskID );
void addReference( PxTaskID taskID );
void decrReference( PxTaskID taskID );
int32_t getReference( PxTaskID taskID ) const;
void decrReference( PxLightCpuTask& lighttask );
void addReference( PxLightCpuTask& lighttask );
PxErrorCallback& mErrorCallback;
PxCpuDispatcher *mCpuDispatcher;
PxTaskNameToIDMap mName2IDmap;
volatile int mPendingTasks;
PxMutex mMutex;
PxTaskDepTable mDepTable;
PxTaskTable mTaskTable;
PxArray<PxTaskID> mStartDispatch;
};
PxTaskManager* PxTaskManager::createTaskManager(PxErrorCallback& errorCallback, PxCpuDispatcher* cpuDispatcher)
{
return PX_NEW(PxTaskMgr)(errorCallback, cpuDispatcher);
}
PxTaskMgr::PxTaskMgr(PxErrorCallback& errorCallback, PxCpuDispatcher* cpuDispatcher)
: mErrorCallback (errorCallback)
, mCpuDispatcher( cpuDispatcher )
, mPendingTasks( 0 )
, mDepTable("PxTaskDepTable")
, mTaskTable("PxTaskTable")
, mStartDispatch("StartDispatch")
{
}
PxTaskMgr::~PxTaskMgr()
{
}
void PxTaskMgr::release()
{
PX_DELETE_THIS;
}
void PxTaskMgr::decrReference(PxLightCpuTask& lighttask)
{
/* This does not need a lock! */
if (!PxAtomicDecrement(&lighttask.mRefCount))
{
PX_ASSERT(mCpuDispatcher);
if (mCpuDispatcher)
{
mCpuDispatcher->submitTask(lighttask);
}
else
{
lighttask.release();
}
}
}
void PxTaskMgr::addReference(PxLightCpuTask& lighttask)
{
/* This does not need a lock! */
PxAtomicIncrement(&lighttask.mRefCount);
}
/*
* Called by the owner (Scene) at the start of every frame, before
* asking for tasks to be submitted.
*/
void PxTaskMgr::resetDependencies()
{
PX_ASSERT( !mPendingTasks ); // only valid if you don't resubmit named tasks, this is true for the SDK
PX_ASSERT( mCpuDispatcher );
mTaskTable.clear();
mDepTable.clear();
mName2IDmap.clear();
mPendingTasks = 0;
}
/*
* Called by the owner (Scene) to start simulating the task graph.
* Dispatch all tasks with refCount == 1
*/
void PxTaskMgr::startSimulation()
{
PX_ASSERT( mCpuDispatcher );
/* Handle empty task graph */
if( mPendingTasks == 0 )
return;
for( PxTaskID i = 0 ; i < mTaskTable.size() ; i++ )
{
if( mTaskTable[ i ].mType == PxTaskType::eCOMPLETED )
{
continue;
}
if( !PxAtomicDecrement( &mTaskTable[ i ].mRefCount ) )
{
mStartDispatch.pushBack(i);
}
}
for( uint32_t i=0; i<mStartDispatch.size(); ++i)
{
dispatchTask( mStartDispatch[i] );
}
//mStartDispatch.resize(0);
mStartDispatch.forceSize_Unsafe(0);
}
void PxTaskMgr::stopSimulation()
{
}
PxTaskID PxTaskMgr::getNamedTask( const char *name )
{
const PxTaskNameToIDMap::Entry *ret;
{
LOCK();
ret = mName2IDmap.find( name );
}
if( ret )
{
return ret->second;
}
else
{
// create named entry in task table, without a task
return submitNamedTask( NULL, name, PxTaskType::eNOT_PRESENT );
}
}
PxTask* PxTaskMgr::getTaskFromID( PxTaskID id )
{
LOCK(); // todo: reader lock necessary?
return mTaskTable[ id ].mTask;
}
/* If called at runtime, must be thread-safe */
PxTaskID PxTaskMgr::submitNamedTask( PxTask *task, const char *name, PxTaskType::Enum type )
{
if( task )
{
task->mTm = this;
task->submitted();
}
LOCK();
const PxTaskNameToIDMap::Entry *ret = mName2IDmap.find( name );
if( ret )
{
PxTaskID prereg = ret->second;
if( task )
{
/* name was registered for us by a dependent task */
PX_ASSERT( !mTaskTable[ prereg ].mTask );
PX_ASSERT( mTaskTable[ prereg ].mType == PxTaskType::eNOT_PRESENT );
mTaskTable[ prereg ].mTask = task;
mTaskTable[ prereg ].mType = type;
task->mTaskID = prereg;
}
return prereg;
}
else
{
PxAtomicIncrement(&mPendingTasks);
PxTaskID id = static_cast<PxTaskID>(mTaskTable.size());
mName2IDmap[ name ] = id;
if( task )
{
task->mTaskID = id;
}
PxTaskTableRow r;
r.mTask = task;
r.mType = type;
mTaskTable.pushBack(r);
return id;
}
}
/*
* Add an unnamed task to the task table
*/
PxTaskID PxTaskMgr::submitUnnamedTask( PxTask& task, PxTaskType::Enum type )
{
PxAtomicIncrement(&mPendingTasks);
task.mTm = this;
task.submitted();
LOCK();
task.mTaskID = static_cast<PxTaskID>(mTaskTable.size());
PxTaskTableRow r;
r.mTask = &task;
r.mType = type;
mTaskTable.pushBack(r);
return task.mTaskID;
}
/* Called by worker threads (or cooperating application threads) when a
* PxTask has completed. Propogate depdenencies, decrementing all
* referenced tasks' refCounts. If any of those reach zero, activate
* those tasks.
*/
void PxTaskMgr::taskCompleted( PxTask& task )
{
LOCK();
resolveRow(task.mTaskID);
}
/* ================== Private Functions ======================= */
/*
* Add a dependency to force 'task' to complete before the
* referenced 'taskID' is allowed to be dispatched.
*/
void PxTaskMgr::finishBefore( PxTask& task, PxTaskID taskID )
{
LOCK();
PX_ASSERT( mTaskTable[ taskID ].mType != PxTaskType::eCOMPLETED );
mTaskTable[ task.mTaskID ].addDependency( mDepTable, taskID );
PxAtomicIncrement( &mTaskTable[ taskID ].mRefCount );
}
/*
* Add a dependency to force 'task' to wait for the referenced 'taskID'
* to complete before it is allowed to be dispatched.
*/
void PxTaskMgr::startAfter( PxTask& task, PxTaskID taskID )
{
LOCK();
PX_ASSERT( mTaskTable[ taskID ].mType != PxTaskType::eCOMPLETED );
mTaskTable[ taskID ].addDependency( mDepTable, task.mTaskID );
PxAtomicIncrement( &mTaskTable[ task.mTaskID ].mRefCount );
}
void PxTaskMgr::addReference( PxTaskID taskID )
{
LOCK();
PxAtomicIncrement( &mTaskTable[ taskID ].mRefCount );
}
/*
* Remove one reference count from a task. Must be done here to make it thread safe.
*/
void PxTaskMgr::decrReference( PxTaskID taskID )
{
LOCK();
if( !PxAtomicDecrement( &mTaskTable[ taskID ].mRefCount ) )
{
dispatchTask(taskID);
}
}
int32_t PxTaskMgr::getReference(PxTaskID taskID) const
{
return mTaskTable[ taskID ].mRefCount;
}
/*
* A task has completed, decrement all dependencies and submit tasks
* that are ready to run. Signal simulation end if ther are no more
* pending tasks.
*/
void PxTaskMgr::resolveRow( PxTaskID taskID )
{
int depRow = mTaskTable[ taskID ].mStartDep;
while( depRow != EOL )
{
PxTaskDepTableRow& row = mDepTable[ uint32_t(depRow) ];
PxTaskTableRow& dtt = mTaskTable[ row.mTaskID ];
if( !PxAtomicDecrement( &dtt.mRefCount ) )
{
dispatchTask( row.mTaskID );
}
depRow = row.mNextDep;
}
PxAtomicDecrement( &mPendingTasks );
}
/*
* Submit a ready task to its appropriate dispatcher.
*/
void PxTaskMgr::dispatchTask( PxTaskID taskID )
{
LOCK(); // todo: reader lock necessary?
PxTaskTableRow& tt = mTaskTable[ taskID ];
// prevent re-submission
if( tt.mType == PxTaskType::eCOMPLETED )
{
mErrorCallback.reportError(PxErrorCode::eDEBUG_WARNING, "PxTask dispatched twice", PX_FL);
return;
}
switch ( tt.mType )
{
case PxTaskType::eCPU:
mCpuDispatcher->submitTask( *tt.mTask );
break;
case PxTaskType::eNOT_PRESENT:
/* No task registered with this taskID, resolve its dependencies */
PX_ASSERT(!tt.mTask);
//PxGetFoundation().error(PX_INFO, "unregistered task resolved");
resolveRow( taskID );
break;
case PxTaskType::eCOMPLETED:
default:
mErrorCallback.reportError(PxErrorCode::eDEBUG_WARNING, "Unknown task type", PX_FL);
resolveRow( taskID );
break;
}
tt.mType = PxTaskType::eCOMPLETED;
}
}// end physx namespace
| 11,436 | C++ | 24.701124 | 111 | 0.689314 |
NVIDIA-Omniverse/PhysX/physx/source/geomutils/src/GuAABBTreeUpdateMap.h | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef GU_AABB_TREE_UPDATE_MAP_H
#define GU_AABB_TREE_UPDATE_MAP_H
#include "common/PxPhysXCommonConfig.h"
#include "GuPrunerTypedef.h"
#include "foundation/PxArray.h"
namespace physx
{
namespace Gu
{
class AABBTree;
// Maps pruning pool indices to AABB-tree indices (i.e. locates the object's box in the aabb-tree nodes pool)
//
// The map spans pool indices from 0..N-1, where N is the number of pool entries when the map was created from a tree.
//
// It maps:
// to node indices in the range 0..M-1, where M is the number of nodes in the tree the map was created from,
// or to INVALID_NODE_ID if the pool entry was removed or pool index is outside input domain.
//
// The map is the inverse of the tree mapping: (node[map[poolID]].primitive == poolID) is true at all times.
class AABBTreeUpdateMap
{
public:
AABBTreeUpdateMap() {}
~AABBTreeUpdateMap() {}
void release()
{
mMapping.reset();
}
// indices offset used when indices are shifted from objects (used for merged trees)
PX_PHYSX_COMMON_API void initMap(PxU32 numPoolObjects, const AABBTree& tree);
PX_PHYSX_COMMON_API void invalidate(PoolIndex poolIndex, PoolIndex replacementPoolIndex, AABBTree& tree);
PX_FORCE_INLINE TreeNodeIndex operator[](PxU32 poolIndex) const
{
return poolIndex < mMapping.size() ? mMapping[poolIndex] : INVALID_NODE_ID;
}
private:
// maps from prunerIndex (index in the PruningPool) to treeNode index
// this will only map to leaf tree nodes
PxArray<TreeNodeIndex> mMapping;
};
}
}
#endif
| 3,359 | C | 39.975609 | 119 | 0.719857 |
NVIDIA-Omniverse/PhysX/physx/source/geomutils/src/GuAABBTreeUpdateMap.cpp | // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include "GuAABBTreeUpdateMap.h"
#include "GuAABBTree.h"
#include "GuAABBTreeNode.h"
using namespace physx;
using namespace Gu;
static const PxU32 SHRINK_THRESHOLD = 1024;
void AABBTreeUpdateMap::initMap(PxU32 nbObjects, const AABBTree& tree)
{
if(!nbObjects)
{
release();
return;
}
// Memory management
{
const PxU32 mapSize = nbObjects;
const PxU32 targetCapacity = mapSize + (mapSize>>2);
PxU32 currentCapacity = mMapping.capacity();
if( ( targetCapacity < (currentCapacity>>1) ) && ( (currentCapacity-targetCapacity) > SHRINK_THRESHOLD ) )
{
// trigger reallocation of a smaller array, there is enough memory to save
currentCapacity = 0;
}
if(mapSize > currentCapacity)
{
// the mapping values are invalid and reset below in any case
// so there is no need to copy the values at all
mMapping.reset();
mMapping.reserve(targetCapacity); // since size is 0, reserve will also just allocate
}
mMapping.forceSize_Unsafe(mapSize);
for(PxU32 i=0;i<mapSize;i++)
mMapping[i] = INVALID_NODE_ID;
}
const PxU32 nbNodes = tree.getNbNodes();
const BVHNode* nodes = tree.getNodes();
const PxU32* indices = tree.getIndices();
for(TreeNodeIndex i=0;i<nbNodes;i++)
{
if(nodes[i].isLeaf())
{
const PxU32 nbPrims = nodes[i].getNbRuntimePrimitives();
// PT: with multiple primitives per node, several mapping entries will point to the same node.
PX_ASSERT(nbPrims<16);
for(PxU32 j=0;j<nbPrims;j++)
{
const PxU32 index = nodes[i].getPrimitives(indices)[j];
PX_ASSERT(index<nbObjects);
mMapping[index] = i;
}
}
}
}
void AABBTreeUpdateMap::invalidate(PoolIndex prunerIndex0, PoolIndex prunerIndex1, AABBTree& tree)
{
// prunerIndex0 and prunerIndex1 are both indices into the pool, not handles
// prunerIndex0 is the index in the pruning pool for the node that was just removed
// prunerIndex1 is the index in the pruning pool for the node
const TreeNodeIndex nodeIndex0 = prunerIndex0<mMapping.size() ? mMapping[prunerIndex0] : INVALID_NODE_ID;
const TreeNodeIndex nodeIndex1 = prunerIndex1<mMapping.size() ? mMapping[prunerIndex1] : INVALID_NODE_ID;
//printf("map invalidate pi0:%x ni0:%x\t",prunerIndex0,nodeIndex0);
//printf(" replace with pi1:%x ni1:%x\n",prunerIndex1,nodeIndex1);
// if nodeIndex0 exists:
// invalidate node 0
// invalidate map prunerIndex0
// if nodeIndex1 exists:
// point node 1 to prunerIndex0
// map prunerIndex0 to node 1
// invalidate map prunerIndex1
// eventually:
// - node 0 is invalid
// - prunerIndex0 is mapped to node 1 or
// is not mapped if prunerIndex1 is not mapped
// is not mapped if prunerIndex0==prunerIndex1
// - node 1 points to prunerIndex0 or
// is invalid if prunerIndex1 is not mapped
// is invalid if prunerIndex0==prunerIndex1
// - prunerIndex1 is not mapped
BVHNode* nodes = tree.getNodes();
if(nodeIndex0!=INVALID_NODE_ID)
{
PX_ASSERT(nodeIndex0 < tree.getNbNodes());
PX_ASSERT(nodes[nodeIndex0].isLeaf());
BVHNode* node0 = nodes + nodeIndex0;
const PxU32 nbPrims = node0->getNbRuntimePrimitives();
PX_ASSERT(nbPrims < 16);
// retrieve the primitives pointer
PxU32* primitives = node0->getPrimitives(tree.getIndices());
PX_ASSERT(primitives);
// PT: look for desired pool index in the leaf
bool foundIt = false;
for(PxU32 i=0;i<nbPrims;i++)
{
PX_ASSERT(mMapping[primitives[i]] == nodeIndex0); // PT: all primitives should point to the same leaf node
if(prunerIndex0 == primitives[i])
{
foundIt = true;
const PxU32 last = nbPrims-1;
node0->setNbRunTimePrimitives(last);
primitives[i] = INVALID_POOL_ID; // Mark primitive index as invalid in the node
mMapping[prunerIndex0] = INVALID_NODE_ID; // invalidate the node index for pool 0
// PT: swap within the leaf node. No need to update the mapping since they should all point
// to the same tree node anyway.
if(last!=i)
PxSwap(primitives[i], primitives[last]);
break;
}
}
PX_ASSERT(foundIt);
PX_UNUSED(foundIt);
}
if (nodeIndex1!=INVALID_NODE_ID)
{
// PT: with multiple primitives per leaf, tree nodes may very well be the same for different pool indices.
// However the pool indices may be the same when a swap has been skipped in the pruning pool, in which
// case there is nothing to do.
if(prunerIndex0!=prunerIndex1)
{
PX_ASSERT(nodeIndex1 < tree.getNbNodes());
PX_ASSERT(nodes[nodeIndex1].isLeaf());
BVHNode* node1 = nodes + nodeIndex1;
const PxU32 nbPrims = node1->getNbRuntimePrimitives();
PX_ASSERT(nbPrims < 16);
// retrieve the primitives pointer
PxU32* primitives = node1->getPrimitives(tree.getIndices());
PX_ASSERT(primitives);
// PT: look for desired pool index in the leaf
bool foundIt = false;
for(PxU32 i=0;i<nbPrims;i++)
{
PX_ASSERT(mMapping[primitives[i]] == nodeIndex1); // PT: all primitives should point to the same leaf node
if(prunerIndex1 == primitives[i])
{
foundIt = true;
primitives[i] = prunerIndex0; // point node 1 to the pool object moved to ID 0
mMapping[prunerIndex0] = nodeIndex1; // pool 0 is pointed at by node 1 now
mMapping[prunerIndex1] = INVALID_NODE_ID; // pool 1 is no longer stored in the tree
break;
}
}
PX_ASSERT(foundIt);
PX_UNUSED(foundIt);
}
}
}
| 7,030 | C++ | 34.510101 | 110 | 0.714936 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.