An APEX wrapper for an NxScene. More...
#include <NxApexScene.h>
Inheritance diagram for physx::apex::NxApexScene:Public Member Functions | |
| virtual void | setPhysXScene (PxScene *s)=0 |
| Associate an NxScene with this NxApexScene. | |
| virtual PxScene * | getPhysXScene ()=0 |
| Retrieve the NxScene associated with this NxApexScene. | |
| virtual const NxApexSceneStats * | getStats (void) const =0 |
| Retrieve scene statistics. | |
| virtual void | prepareRenderResourceContexts ()=0 |
| Particle rendering synchronization method. | |
| virtual void | simulate (physx::PxF32 elapsedTime, bool finalStep=true, physx::PxBaseTask *completionTask=NULL, void *scratchMemBlock=0, PxU32 scratchMemBlockSize=0)=0 |
| Start simulation of the APEX (and PhysX) scene. | |
| virtual bool | fetchResults (bool block, physx::PxU32 *errorState)=0 |
| Checks, and optionally blocks, for simulation completion. Updates scene state. | |
| virtual bool | checkResults (bool block)=0 |
| Checks, and optionally blocks, for simulation completion. | |
| virtual void | setLODResourceBudget (physx::PxF32 totalResource)=0 |
| Set the resource budget for this scene. | |
| virtual physx::PxF32 | getLODResourceConsumed () const =0 |
| Returns the ammount of LOD resource consumed. | |
| virtual physx::PxU32 | allocViewMatrix (ViewMatrixType::Enum)=0 |
| Allocate a view matrix. Returns a viewID that identifies this view matrix for future calls to setViewMatrix(). The matrix is de-allocated automatically when the scene is released. | |
| virtual physx::PxU32 | allocProjMatrix (ProjMatrixType::Enum)=0 |
| Allocate a projection matrix. Returns a projID that identifies this projection matrix for future calls to setProjMatrix(). The matrix is de-allocated automatically when the scene is released. | |
| virtual physx::PxU32 | getNumViewMatrices () const =0 |
| Returns the number of view matrices allocated. | |
| virtual physx::PxU32 | getNumProjMatrices () const =0 |
| Returns the number of projection matrices allocated. | |
| virtual void | setViewMatrix (const physx::PxMat44 &viewTransform, const physx::PxU32 viewID=0)=0 |
| Sets the view matrix for the given viewID. Should be called whenever the view matrix needs to be updated. | |
| virtual physx::PxMat44 | getViewMatrix (const physx::PxU32 viewID=0) const =0 |
| Returns the view matrix set by the user for the given viewID. | |
| virtual void | setProjMatrix (const physx::PxMat44 &projTransform, const physx::PxU32 projID=0)=0 |
| Sets the projection matrix for the given projID. Should be called whenever the projection matrix needs to be updated. | |
| virtual physx::PxMat44 | getProjMatrix (const physx::PxU32 projID=0) const =0 |
| Returns the projection matrix set by the user for the given projID. | |
| virtual void | setUseViewProjMatrix (const physx::PxU32 viewID=0, const physx::PxU32 projID=0)=0 |
| Sets the use of the view matrix and projection matrix as identified by their IDs. Should be called whenever either matrices needs to be updated. | |
| virtual void | setViewParams (const physx::PxVec3 &eyePosition, const physx::PxVec3 &eyeDirection, const physx::PxVec3 &worldUpDirection=PxVec3(0, 1, 0), const physx::PxU32 viewID=0)=0 |
| Sets the necessary information for the view matrix as identified by its viewID. Should be called whenever any of the listed parameters needs to be updated. | |
| virtual void | setProjParams (physx::PxF32 nearPlaneDistance, physx::PxF32 farPlaneDistance, physx::PxF32 fieldOfViewDegree, physx::PxU32 viewportWidth, physx::PxU32 viewportHeight, const physx::PxU32 projID=0)=0 |
| Sets the necessary information for the projection matrix as identified by its projID. Should be called whenever any of the listed parameters needs to be updated. | |
| virtual physx::PxVec3 | getEyePosition (const physx::PxU32 viewID=0) const =0 |
| Returns the world space eye position. | |
| virtual physx::PxVec3 | getEyeDirection (const physx::PxU32 viewID=0) const =0 |
| Returns the world space eye direction. | |
| virtual physx::PxTaskManager * | getTaskManager () const =0 |
| Returns the APEX scene's task manager. | |
| virtual void | setUseDebugRenderable (bool state)=0 |
| Toggle the use of a debug renderable. | |
|
virtual ::NxParameterized::Interface * | getDebugRenderParams ()=0 |
| Gets debug rendering parameters from NxParameterized. | |
|
virtual ::NxParameterized::Interface * | getModuleDebugRenderParams (const char *name)=0 |
| Gets module debug rendering parameters from NxParameterized. | |
| virtual void | acquirePhysXLock (void)=0 |
| Acquire the PhysX scene lock. | |
| virtual void | releasePhysXLock (void)=0 |
| Release the PhysX scene lock. | |
An APEX wrapper for an NxScene.
| virtual void physx::apex::NxApexScene::acquirePhysXLock | ( | void | ) | [pure virtual] |
Acquire the PhysX scene lock.
While a simulation is running, PhysX 3 scenes support read and write access to objects in the scene. Concurrent access from the application and APEX scene (after simulate has returned and before fetchResults is called) might corrupt the state of the objects or lead to data races or inconsistent views in the simulation code. When accessing the PhysX scene the APEX scene will aquire the PhysX lock, and so should the application.
For more information on this PhysX 3 feature, please see the PhysX documentation regarding data access. Note, this method will be deprecated under PhysX 3.3 which will provide a multiple-reader-single-writer mutex instead to co-ordinate access to the PhysX API from multiple threads and multiple libraries.
| virtual physx::PxU32 physx::apex::NxApexScene::allocProjMatrix | ( | ProjMatrixType::Enum | ) | [pure virtual] |
Allocate a projection matrix. Returns a projID that identifies this projection matrix for future calls to setProjMatrix(). The matrix is de-allocated automatically when the scene is released.
Each call of this function allocates space for one projection matrix. Since many features in APEX require a projection matrix it is _required_ that the application call this method. Max calls restricted to 1 for now. If ProjMatrixType is USER_CUSTOMIZED, setProjParams() as well using this projID
| virtual physx::PxU32 physx::apex::NxApexScene::allocViewMatrix | ( | ViewMatrixType::Enum | ) | [pure virtual] |
Allocate a view matrix. Returns a viewID that identifies this view matrix for future calls to setViewMatrix(). The matrix is de-allocated automatically when the scene is released.
Each call of this function allocates space for one view matrix. Since many features in APEX require a projection matrix it is _required_ that the application call this method. Max calls restricted to 1 for now. If ViewMatrixType is USER_CUSTOMIZED, setViewParams() as well using this viewID. If connected to PVD, PVD camera is set up.
| virtual bool physx::apex::NxApexScene::checkResults | ( | bool | block | ) | [pure virtual] |
Checks, and optionally blocks, for simulation completion.
Performs same function as fetchResults(), but does not update scene state. fetchResults() must still be called before the next simulation step can begin.
| virtual bool physx::apex::NxApexScene::fetchResults | ( | bool | block, |
| physx::PxU32 * | errorState | ||
| ) | [pure virtual] |
Checks, and optionally blocks, for simulation completion. Updates scene state.
Checks if NxApexScene has completed simulating (optionally blocking for completion). Updates new state of NxApexActors and the NxScene. Returns true if simulation is complete.
| block | [in] - block until simulation is complete |
| errorState | [out] - error value is written to this address, if not NULL |
| virtual physx::PxVec3 physx::apex::NxApexScene::getEyeDirection | ( | const physx::PxU32 | viewID = 0 | ) | const [pure virtual] |
Returns the world space eye direction.
| virtual physx::PxVec3 physx::apex::NxApexScene::getEyePosition | ( | const physx::PxU32 | viewID = 0 | ) | const [pure virtual] |
Returns the world space eye position.
| virtual physx::PxF32 physx::apex::NxApexScene::getLODResourceConsumed | ( | ) | const [pure virtual] |
Returns the ammount of LOD resource consumed.
Retrieves the amount of LOD resource consumed in the last simulation frame. The system attempts to keep this below the value set in setLODResourceBudget().
| virtual physx::PxMat44 physx::apex::NxApexScene::getProjMatrix | ( | const physx::PxU32 | projID = 0 | ) | const [pure virtual] |
Returns the projection matrix set by the user for the given projID.
| virtual physx::PxMat44 physx::apex::NxApexScene::getViewMatrix | ( | const physx::PxU32 | viewID = 0 | ) | const [pure virtual] |
Returns the view matrix set by the user for the given viewID.
| virtual void physx::apex::NxApexScene::prepareRenderResourceContexts | ( | ) | [pure virtual] |
Particle rendering synchronization method.
This method switches the staging particle data over to the render buffers to support a single render buffer for non-interop and a double render buffer for D3D-CUDA interop.
| virtual void physx::apex::NxApexScene::setLODResourceBudget | ( | physx::PxF32 | totalResource | ) | [pure virtual] |
Set the resource budget for this scene.
Sets a total resource budget that the LOD system will distribute among modules, and eventually among the objects of those modules.
The resource is specified in an abstract 'resource unit' rather than any real world quantity.
| virtual void physx::apex::NxApexScene::setPhysXScene | ( | PxScene * | s | ) | [pure virtual] |
Associate an NxScene with this NxApexScene.
All NxApexActors in the NxApexSene will be added to the NxScene. The NxScene pointer can be NULL, which will cause all APEX actors to be removed from the previously specified NxScene. This must be done before the NxScene can be released.
| virtual void physx::apex::NxApexScene::setProjMatrix | ( | const physx::PxMat44 & | projTransform, |
| const physx::PxU32 | projID = 0 |
||
| ) | [pure virtual] |
Sets the projection matrix for the given projID. Should be called whenever the projection matrix needs to be updated.
Make a call to setProjParams().
| virtual void physx::apex::NxApexScene::setProjParams | ( | physx::PxF32 | nearPlaneDistance, |
| physx::PxF32 | farPlaneDistance, | ||
| physx::PxF32 | fieldOfViewDegree, | ||
| physx::PxU32 | viewportWidth, | ||
| physx::PxU32 | viewportHeight, | ||
| const physx::PxU32 | projID = 0 |
||
| ) | [pure virtual] |
Sets the necessary information for the projection matrix as identified by its projID. Should be called whenever any of the listed parameters needs to be updated.
| virtual void physx::apex::NxApexScene::setViewMatrix | ( | const physx::PxMat44 & | viewTransform, |
| const physx::PxU32 | viewID = 0 |
||
| ) | [pure virtual] |
Sets the view matrix for the given viewID. Should be called whenever the view matrix needs to be updated.
If the given viewID's matrix type is identifiable as indicated in ViewMatrixType, eye position and eye direction are set as well, using values from this matrix. Otherwise, make a call to setViewParams(). If connected to PVD, PVD camera is updated.
| virtual void physx::apex::NxApexScene::setViewParams | ( | const physx::PxVec3 & | eyePosition, |
| const physx::PxVec3 & | eyeDirection, | ||
| const physx::PxVec3 & | worldUpDirection = PxVec3(0, 1, 0), |
||
| const physx::PxU32 | viewID = 0 |
||
| ) | [pure virtual] |
Sets the necessary information for the view matrix as identified by its viewID. Should be called whenever any of the listed parameters needs to be updated.
| virtual void physx::apex::NxApexScene::simulate | ( | physx::PxF32 | elapsedTime, |
| bool | finalStep = true, |
||
| physx::PxBaseTask * | completionTask = NULL, |
||
| void * | scratchMemBlock = 0, |
||
| PxU32 | scratchMemBlockSize = 0 |
||
| ) | [pure virtual] |
Start simulation of the APEX (and PhysX) scene.
Start simulation of the NxApexActors and the NxScene associated with this NxApexScene. No NxApexActors should be added, deleted, or modified until fetchResults() is called.
Calls to simulate() should pair with calls to fetchResults(): Each fetchResults() invocation corresponds to exactly one simulate() invocation; calling simulate() twice without an intervening fetchResults() or fetchResults() twice without an intervening simulate() causes an error condition.
| [in] | elapsedTime | Amount of time to advance simulation by. Range: (0,inf) |
| [in] | finalStep | should be left as true, unless your application is manually sub stepping APEX (and PhysX) and you do not intend to try to render the output of intermediate steps. |
| [in] | completionTask | if non-NULL, this task will have its refcount incremented in simulate(), then decremented when the scene is ready to have fetchResults called. So the task will not run until the application also calls removeReference() after calling simulate. |
| [in] | scratchMemBlock | a memory region for physx to use for temporary data during simulation. This block may be reused by the application after fetchResults returns. Must be aligned on a 16-byte boundary |
| [in] | scratchMemBlockSize | the size of the scratch memory block. Must be a multiple of 16K. |