PxPhysics Class Reference
[Physics]
Abstract singleton factory class used for instancing objects in the Physics SDK.
More...
#include <PxPhysics.h>
Public Member Functions | |
virtual | ~PxPhysics () |
virtual bool | registerClass (PxType type, PxClassCreationCallback callback)=0 |
virtual PxUserReferences * | createUserReferences ()=0 |
Creates a user references object. | |
virtual PX_DEPRECATED void | releaseUserReferences (PxUserReferences &ref)=0 |
virtual PxCollection * | createCollection ()=0 |
Creates a collection object. | |
virtual PX_DEPRECATED void | releaseCollection (PxCollection &)=0 |
virtual void | addCollection (const PxCollection &collection, PxScene &scene)=0 |
Adds collected objects to a scene. | |
virtual void | release ()=0 |
Destroys the instance it is called on. | |
virtual PxScene * | createScene (const PxSceneDesc &sceneDesc)=0 |
Creates a scene. | |
virtual PxU32 | getNbScenes () const =0 |
Gets number of created scenes. | |
virtual PxU32 | getScenes (PxScene **userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const =0 |
Writes the array of scene pointers to a user buffer. | |
virtual PxRigidStatic * | createRigidStatic (const PxTransform &pose)=0 |
Creates a static rigid actor with the specified pose and all other fields initialized to their default values. | |
virtual PxRigidDynamic * | createRigidDynamic (const PxTransform &pose)=0 |
Creates a dynamic rigid actor with the specified pose and all other fields initialized to their default values. | |
virtual PxConstraint * | createConstraint (PxRigidActor *actor0, PxRigidActor *actor1, PxConstraintConnector &connector, const PxConstraintShaderTable &shaders, PxU32 dataSize)=0 |
Creates a constraint shader. | |
virtual PxArticulation * | createArticulation ()=0 |
Creates an articulation with all fields initialized to their default values. | |
virtual PxAggregate * | createAggregate (PxU32 maxSize, bool enableSelfCollision)=0 |
Creates an aggregate with the specified maximum size and selfCollision property. | |
virtual PxParticleSystem * | createParticleSystem (PxU32 maxParticles, bool perParticleRestOffset=false)=0 |
Creates a particle system. | |
virtual PxParticleFluid * | createParticleFluid (PxU32 maxParticles, bool perParticleRestOffset=false)=0 |
Creates a particle fluid. | |
virtual PxCloth * | createCloth (const PxTransform &globalPose, PxClothFabric &fabric, const PxClothParticle *particles, const PxClothCollisionData &collData, PxClothFlags flags)=0 |
virtual PxMaterial * | createMaterial (PxReal staticFriction, PxReal dynamicFriction, PxReal restitution)=0 |
Creates a new material with default properties. | |
virtual PxU32 | getNbMaterials () const =0 |
Return the number of materials that currently exist. | |
virtual PxU32 | getMaterials (PxMaterial **userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const =0 |
Writes the array of material pointers to a user buffer. | |
virtual PxTriangleMesh * | createTriangleMesh (PxInputStream &stream)=0 |
Creates a triangle mesh object. | |
virtual PxU32 | getNbTriangleMeshes () const =0 |
Return the number of triangle meshes that currently exist. | |
virtual PxU32 | getTriangleMeshes (PxTriangleMesh **userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const =0 |
Writes the array of triangle mesh pointers to a user buffer. | |
virtual PxHeightField * | createHeightField (const PxHeightFieldDesc &heightFieldDesc)=0 |
Creates a PxHeightField object. | |
virtual PxU32 | getNbHeightFields () const =0 |
Return the number of heightfields that currently exist. | |
virtual PxU32 | getHeightFields (PxHeightField **userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const =0 |
Writes the array of heightfield pointers to a user buffer. | |
virtual PxConvexMesh * | createConvexMesh (PxInputStream &stream)=0 |
Creates a convex mesh object. | |
virtual PxU32 | getNbConvexMeshes () const =0 |
Return the number of convex meshes that currently exist. | |
virtual PxU32 | getConvexMeshes (PxConvexMesh **userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const =0 |
Writes the array of convex mesh pointers to a user buffer. | |
virtual PxClothFabric * | createClothFabric (PxInputStream &stream)=0 |
Creates a cloth fabric object. | |
virtual PxClothFabric * | createClothFabric (PxU32 nbParticles, PxU32 nbPhases, const PxU32 *phases, const PxClothFabricPhaseType::Enum *phaseTypes, PxU32 nbRestvalues, const PxReal *restvalues, PxU32 nbSets, const PxU32 *sets, const PxU32 *fibers, const PxU32 *indices)=0 |
Creates a cloth fabric object from particle connectivity and restlength information. | |
virtual PxU32 | getNbClothFabrics () const =0 |
Return the number of cloth fabrics that currently exist. | |
virtual PxU32 | getClothFabrics (PxClothFabric **userBuffer, PxU32 bufferSize) const =0 |
Writes the array of cloth fabrics to a user buffer. | |
virtual const PxTolerancesScale & | getTolerancesScale () const =0 |
Returns the simulation tolerance parameters. | |
virtual PxFoundation & | getFoundation ()=0 |
Retrieves the Foundation instance. | |
virtual PxVisualDebugger * | getVisualDebugger ()=0 |
Retrieves the PhysX Visual Debugger. | |
virtual physx::debugger::comm::PvdConnectionManager * | getPvdConnectionManager ()=0 |
virtual physx::PxProfileZoneManager * | getProfileZoneManager ()=0 |
Detailed Description
Abstract singleton factory class used for instancing objects in the Physics SDK.In addition you can use PxPhysics to set global parameters which will effect all scenes, create triangle meshes.
You can get an instance of this class by calling PxCreatePhysics().
Constructor & Destructor Documentation
virtual PxPhysics::~PxPhysics | ( | ) | [inline, virtual] |
Member Function Documentation
virtual void PxPhysics::addCollection | ( | const PxCollection & | collection, | |
PxScene & | scene | |||
) | [pure virtual] |
Adds collected objects to a scene.
This function adds all objects contained in the input collection to the input scene. This is typically used after deserializing the collection, to populate the scene with deserialized objects.
- Parameters:
-
[in] collection Objects to add to the scene. See PxCollection [in] scene Scene to which collected objects will be added. See PxScene
- See also:
- PxCollection PxScene
virtual PxAggregate* PxPhysics::createAggregate | ( | PxU32 | maxSize, | |
bool | enableSelfCollision | |||
) | [pure virtual] |
Creates an aggregate with the specified maximum size and selfCollision property.
- Parameters:
-
[in] maxSize the maximum number of actors that may be placed in the aggregate. This value must not exceed 128, otherwise NULL will be returned. [in] enableSelfCollision whether the aggregate supports self-collision
- Returns:
- The new aggregate.
- See also:
- PxAggregate
virtual PxArticulation* PxPhysics::createArticulation | ( | ) | [pure virtual] |
Creates an articulation with all fields initialized to their default values.
- Returns:
- the new articulation
- See also:
- PxRigidDynamic
virtual PxCloth* PxPhysics::createCloth | ( | const PxTransform & | globalPose, | |
PxClothFabric & | fabric, | |||
const PxClothParticle * | particles, | |||
const PxClothCollisionData & | collData, | |||
PxClothFlags | flags | |||
) | [pure virtual] |
Creates a cloth.
- Parameters:
-
globalPose The world space transform of the cloth. fabric The fabric the cloth should use. particles Particle definition buffer. The size of the buffer has to match the number of points of the cloth mesh which elements must match with the provided collData Collision information. flags Cloth flags.
- Returns:
- The new cloth.
virtual PxClothFabric* PxPhysics::createClothFabric | ( | PxU32 | nbParticles, | |
PxU32 | nbPhases, | |||
const PxU32 * | phases, | |||
const PxClothFabricPhaseType::Enum * | phaseTypes, | |||
PxU32 | nbRestvalues, | |||
const PxReal * | restvalues, | |||
PxU32 | nbSets, | |||
const PxU32 * | sets, | |||
const PxU32 * | fibers, | |||
const PxU32 * | indices | |||
) | [pure virtual] |
Creates a cloth fabric object from particle connectivity and restlength information.
This can then be instanced into PxCloth objects.
- Note:
- We recommended using PxCooking.cookClothFabric() to create cloth fabrics from meshes and then using createClothFabric(const PxInputStream& stream). This method should only be used if you need to provide fully customized particle fiber/connectivity information for your fabric or if you did custom cloth fabric serialization and want to deserialize.
- Parameters:
-
[in] nbParticles the number of particles needed when creating a PxCloth instance from the fabric. [in] nbPhases the number of solver phases. [in] phases array defining which set to use for each phase. See PxClothFabric.getPhases(). [in] phaseTypes array defining the type of each phase. See PxClothFabricPhaseType. [in] nbRestvalues the number of rest values [in] restvalues array of rest values for each constraint. See PxClothFabric.getRestvalues(). [in] nbSets number of sets in the fabric. [in] sets array with an index per set which points one entry beyond the last fiber of the set. See PxClothFabric.getSets(). [in] fibers array with an index per fiber which points one entry beyond the last particle index of the fiber. See PxClothFabric.getFibers(). [in] indices array of particle indices which specifies the line strips of connected particles of a fiber. See PxClothFabric.getParticleIndices().
- Returns:
- The new cloth fabric.
- See also:
- PxClothFabric PxClothFabric.release() PxCloth
virtual PxClothFabric* PxPhysics::createClothFabric | ( | PxInputStream & | stream | ) | [pure virtual] |
Creates a cloth fabric object.
This can then be instanced into PxCloth objects.
- Parameters:
-
[in] stream The stream to load the cloth fabric from.
- Returns:
- The new cloth fabric.
virtual PxCollection* PxPhysics::createCollection | ( | ) | [pure virtual] |
Creates a collection object.
Objects can only be serialized or deserialized through a collection. For serialization, users must add objects to the collection and serialize the collection as a whole. For deserialization, the system gives back a collection of deserialized objects to users.
- Returns:
- The new collection object.
- See also:
- PxCollection::release()
virtual PxConstraint* PxPhysics::createConstraint | ( | PxRigidActor * | actor0, | |
PxRigidActor * | actor1, | |||
PxConstraintConnector & | connector, | |||
const PxConstraintShaderTable & | shaders, | |||
PxU32 | dataSize | |||
) | [pure virtual] |
Creates a constraint shader.
- Note:
- A constraint shader will get added automatically to the scene the two linked actors belong to. Either, but not both, of actor0 and actor1 may be NULL to denote attachment to the world.
- Parameters:
-
[in] actor0 the first actor [in] actor1 the second actor [in] connector the connector object, which the SDK uses to communicate with the infrastructure for the constraint [in] shaders the shader functions for the constraint [in] dataSize the size of the data block for the shader
- Returns:
- The new shader.
virtual PxConvexMesh* PxPhysics::createConvexMesh | ( | PxInputStream & | stream | ) | [pure virtual] |
Creates a convex mesh object.
This can then be instanced into PxShape objects.
- Parameters:
-
[in] stream The stream to load the convex mesh from.
- Returns:
- The new convex mesh.
virtual PxHeightField* PxPhysics::createHeightField | ( | const PxHeightFieldDesc & | heightFieldDesc | ) | [pure virtual] |
Creates a PxHeightField object.
This can then be instanced into PxShape objects.
- Parameters:
-
[in] heightFieldDesc The descriptor to load the object from.
- Returns:
- The new height field object.
virtual PxMaterial* PxPhysics::createMaterial | ( | PxReal | staticFriction, | |
PxReal | dynamicFriction, | |||
PxReal | restitution | |||
) | [pure virtual] |
Creates a new material with default properties.
- Returns:
- The new material.
- Parameters:
-
staticFriction the coefficient of static friction dynamicFriction the coefficient of dynamic friction restitution the coefficient of restitution
- See also:
- PxMaterial
virtual PxParticleFluid* PxPhysics::createParticleFluid | ( | PxU32 | maxParticles, | |
bool | perParticleRestOffset = false | |||
) | [pure virtual] |
Creates a particle fluid.
- Parameters:
-
maxParticles the maximum number of particles that may be placed in the particle fluid perParticleRestOffset whether the ParticleFluid supports perParticleRestOffset
- Returns:
- The new particle fluid.
virtual PxParticleSystem* PxPhysics::createParticleSystem | ( | PxU32 | maxParticles, | |
bool | perParticleRestOffset = false | |||
) | [pure virtual] |
Creates a particle system.
- Parameters:
-
maxParticles the maximum number of particles that may be placed in the particle system perParticleRestOffset whether the ParticleSystem supports perParticleRestOffset
- Returns:
- The new particle system.
virtual PxRigidDynamic* PxPhysics::createRigidDynamic | ( | const PxTransform & | pose | ) | [pure virtual] |
Creates a dynamic rigid actor with the specified pose and all other fields initialized to their default values.
- Parameters:
-
[in] pose the initial pose of the actor. Must be a valid transform
- See also:
- PxRigidDynamic
virtual PxRigidStatic* PxPhysics::createRigidStatic | ( | const PxTransform & | pose | ) | [pure virtual] |
Creates a static rigid actor with the specified pose and all other fields initialized to their default values.
- Parameters:
-
[in] pose the initial pose of the actor. Must be a valid transform
- See also:
- PxRigidStatic
virtual PxScene* PxPhysics::createScene | ( | const PxSceneDesc & | sceneDesc | ) | [pure virtual] |
Creates a scene.
The scene can then create its contained entities.
- Parameters:
-
[in] sceneDesc Scene descriptor. See PxSceneDesc
- Returns:
- The new scene object.
- See also:
- PxScene PxScene.release() PxSceneDesc
virtual PxTriangleMesh* PxPhysics::createTriangleMesh | ( | PxInputStream & | stream | ) | [pure virtual] |
Creates a triangle mesh object.
This can then be instanced into PxShape objects.
- Parameters:
-
[in] stream The triangle mesh stream.
- Returns:
- The new triangle mesh.
virtual PxUserReferences* PxPhysics::createUserReferences | ( | ) | [pure virtual] |
Creates a user references object.
User references are needed when a collection contains external references, either to another collection (when serializing subsets) or to user objects.
virtual PxU32 PxPhysics::getClothFabrics | ( | PxClothFabric ** | userBuffer, | |
PxU32 | bufferSize | |||
) | const [pure virtual] |
Writes the array of cloth fabrics to a user buffer.
Returns the number of pointers written.
The ordering of the cloth fabrics in the array is not specified.
- Parameters:
-
[out] userBuffer The buffer to receive cloth fabric pointers. [in] bufferSize The number of cloth fabric pointers which can be stored in the buffer.
- Returns:
- The number of cloth fabric pointers written to userBuffer, this should be less or equal to bufferSize.
- See also:
- getNbClothFabrics() PxClothFabric
virtual PxU32 PxPhysics::getConvexMeshes | ( | PxConvexMesh ** | userBuffer, | |
PxU32 | bufferSize, | |||
PxU32 | startIndex = 0 | |||
) | const [pure virtual] |
Writes the array of convex mesh pointers to a user buffer.
Returns the number of pointers written.
The ordering of the convex meshes in the array is not specified.
- Parameters:
-
[out] userBuffer The buffer to receive convex mesh pointers. [in] bufferSize The number of convex mesh pointers which can be stored in the buffer. [in] startIndex Index of first convex mesh pointer to be retrieved
- Returns:
- The number of convex mesh pointers written to userBuffer, this should be less or equal to bufferSize.
- See also:
- getNbConvexMeshes() PxConvexMesh
virtual PxFoundation& PxPhysics::getFoundation | ( | ) | [pure virtual] |
Retrieves the Foundation instance.
- Returns:
- A reference to the Foundation object.
virtual PxU32 PxPhysics::getHeightFields | ( | PxHeightField ** | userBuffer, | |
PxU32 | bufferSize, | |||
PxU32 | startIndex = 0 | |||
) | const [pure virtual] |
Writes the array of heightfield pointers to a user buffer.
Returns the number of pointers written.
The ordering of the heightfields in the array is not specified.
- Parameters:
-
[out] userBuffer The buffer to receive heightfield pointers. [in] bufferSize The number of heightfield pointers which can be stored in the buffer. [in] startIndex Index of first heightfield pointer to be retrieved
- Returns:
- The number of heightfield pointers written to userBuffer, this should be less or equal to bufferSize.
- See also:
- getNbHeightFields() PxHeightField
virtual PxU32 PxPhysics::getMaterials | ( | PxMaterial ** | userBuffer, | |
PxU32 | bufferSize, | |||
PxU32 | startIndex = 0 | |||
) | const [pure virtual] |
Writes the array of material pointers to a user buffer.
Returns the number of pointers written.
The ordering of the materials in the array is not specified.
- Parameters:
-
[out] userBuffer The buffer to receive material pointers. [in] bufferSize The number of material pointers which can be stored in the buffer. [in] startIndex Index of first material pointer to be retrieved
- Returns:
- The number of material pointers written to userBuffer, this should be less or equal to bufferSize.
- See also:
- getNbMaterials() PxMaterial
virtual PxU32 PxPhysics::getNbClothFabrics | ( | ) | const [pure virtual] |
Return the number of cloth fabrics that currently exist.
- Returns:
- Number of cloth fabrics.
- See also:
- getClothFabrics()
virtual PxU32 PxPhysics::getNbConvexMeshes | ( | ) | const [pure virtual] |
Return the number of convex meshes that currently exist.
- Returns:
- Number of convex meshes.
- See also:
- getConvexMeshes()
virtual PxU32 PxPhysics::getNbHeightFields | ( | ) | const [pure virtual] |
Return the number of heightfields that currently exist.
- Returns:
- Number of heightfields.
- See also:
- getHeightFields()
virtual PxU32 PxPhysics::getNbMaterials | ( | ) | const [pure virtual] |
Return the number of materials that currently exist.
- Returns:
- Number of materials.
- See also:
- getMaterials()
virtual PxU32 PxPhysics::getNbScenes | ( | ) | const [pure virtual] |
Gets number of created scenes.
- Returns:
- The number of scenes created.
- See also:
- getScene()
virtual PxU32 PxPhysics::getNbTriangleMeshes | ( | ) | const [pure virtual] |
Return the number of triangle meshes that currently exist.
- Returns:
- Number of triangle meshes.
- See also:
- getTriangleMeshes()
virtual physx::PxProfileZoneManager* PxPhysics::getProfileZoneManager | ( | ) | [pure virtual] |
virtual physx::debugger::comm::PvdConnectionManager* PxPhysics::getPvdConnectionManager | ( | ) | [pure virtual] |
The factory manager allows notifications when a new connection to pvd is made. It also allows the users to specify a scheme to handle the read-side of a network connection. By default, the SDK specifies that a thread gets launched which blocks reading on the network socket.
- Returns:
- A valid manager *if* the SDK was compiled with PVD support. Null otherwise.
virtual PxU32 PxPhysics::getScenes | ( | PxScene ** | userBuffer, | |
PxU32 | bufferSize, | |||
PxU32 | startIndex = 0 | |||
) | const [pure virtual] |
Writes the array of scene pointers to a user buffer.
Returns the number of pointers written.
The ordering of the scene pointers in the array is not specified.
- Parameters:
-
[out] userBuffer The buffer to receive scene pointers. [in] bufferSize The number of scene pointers which can be stored in the buffer. [in] startIndex Index of first scene pointer to be retrieved
- Returns:
- The number of scene pointers written to userBuffer, this should be less or equal to bufferSize.
- See also:
- getNbScenes() PxScene
virtual const PxTolerancesScale& PxPhysics::getTolerancesScale | ( | ) | const [pure virtual] |
Returns the simulation tolerance parameters.
- Returns:
- The current simulation tolerance parameters.
virtual PxU32 PxPhysics::getTriangleMeshes | ( | PxTriangleMesh ** | userBuffer, | |
PxU32 | bufferSize, | |||
PxU32 | startIndex = 0 | |||
) | const [pure virtual] |
Writes the array of triangle mesh pointers to a user buffer.
Returns the number of pointers written.
The ordering of the triangle meshes in the array is not specified.
- Parameters:
-
[out] userBuffer The buffer to receive triangle mesh pointers. [in] bufferSize The number of triangle mesh pointers which can be stored in the buffer. [in] startIndex Index of first mesh pointer to be retrieved
- Returns:
- The number of triangle mesh pointers written to userBuffer, this should be less or equal to bufferSize.
- See also:
- getNbTriangleMeshes() PxTriangleMesh
virtual PxVisualDebugger* PxPhysics::getVisualDebugger | ( | ) | [pure virtual] |
Retrieves the PhysX Visual Debugger.
- Returns:
- A pointer to the PxVisualDebugger. Can be NULL if PVD is not supported on this platform.
virtual bool PxPhysics::registerClass | ( | PxType | type, | |
PxClassCreationCallback | callback | |||
) | [pure virtual] |
virtual void PxPhysics::release | ( | ) | [pure virtual] |
Destroys the instance it is called on.
Use this release method to destroy an instance of this class. Be sure to not keep a reference to this object after calling release. Avoid release calls while a scene is simulating (in between simulate() and fetchResults() calls).
Note that this must be called once for each prior call to PxCreatePhysics, as there is a reference counter. Also note that you mustn't destroy the allocator or the error callback (if available) until after the reference count reaches 0 and the SDK is actually removed.
Releasing an SDK will also release any scenes, triangle meshes, convex meshes, and heightfields created through it, provided the user hasn't already done so.
- See also:
- PxCreatePhysics()
virtual PX_DEPRECATED void PxPhysics::releaseCollection | ( | PxCollection & | ) | [pure virtual] |
virtual PX_DEPRECATED void PxPhysics::releaseUserReferences | ( | PxUserReferences & | ref | ) | [pure virtual] |
The documentation for this class was generated from the following file:
Copyright © 2008-2012 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com