APEX Framework: nvidia::apex::Scene Class Reference

NVIDIA APEX

nvidia::apex::Scene Class Reference

An APEX wrapper for an PxScene. More...

#include <Scene.h>

Inheritance diagram for nvidia::apex::Scene:
nvidia::apex::Renderable nvidia::apex::Context nvidia::apex::ApexInterface nvidia::apex::RenderDataProvider nvidia::apex::RWLockable

List of all members.

Public Member Functions

virtual void setPhysXScene (PxScene *s)=0
 Associate an PxScene with this Scene.
virtual PxScene * getPhysXScene () const =0
 Retrieve the PxScene associated with this Scene.
virtual const SceneStatsgetStats (void) const =0
 Retrieve scene statistics.
virtual void simulate (float elapsedTime, bool finalStep=true, PxBaseTask *completionTask=NULL, void *scratchMemBlock=0, uint32_t scratchMemBlockSize=0)=0
 Start simulation of the APEX (and PhysX) scene.
virtual bool fetchResults (bool block, uint32_t *errorState)=0
 Checks, and optionally blocks, for simulation completion. Updates scene state.
virtual const PxRenderBuffer * getRenderBuffer () const =0
 Returns an DebugRenderable object that contains the data for debug rendering of this scene.
virtual const PxRenderBuffer * getRenderBufferScreenSpace () const =0
 Returns an DebugRenderable object that contains the data for debug rendering of this scene, in screenspace.
virtual bool checkResults (bool block) const =0
 Checks, and optionally blocks, for simulation completion.
virtual uint32_t 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 uint32_t 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 uint32_t getNumViewMatrices () const =0
 Returns the number of view matrices allocated.
virtual uint32_t getNumProjMatrices () const =0
 Returns the number of projection matrices allocated.
virtual void setViewMatrix (const PxMat44 &viewTransform, const uint32_t viewID=0)=0
 Sets the view matrix for the given viewID. Should be called whenever the view matrix needs to be updated.
virtual PxMat44 getViewMatrix (const uint32_t viewID=0) const =0
 Returns the view matrix set by the user for the given viewID.
virtual void setProjMatrix (const PxMat44 &projTransform, const uint32_t projID=0)=0
 Sets the projection matrix for the given projID. Should be called whenever the projection matrix needs to be updated.
virtual PxMat44 getProjMatrix (const uint32_t projID=0) const =0
 Returns the projection matrix set by the user for the given projID.
virtual void setUseViewProjMatrix (const uint32_t viewID=0, const uint32_t 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 PxVec3 &eyePosition, const PxVec3 &eyeDirection, const PxVec3 &worldUpDirection=PxVec3(0, 1, 0), const uint32_t 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 (float nearPlaneDistance, float farPlaneDistance, float fieldOfViewDegree, uint32_t viewportWidth, uint32_t viewportHeight, const uint32_t 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 PxVec3 getEyePosition (const uint32_t viewID=0) const =0
 Returns the world space eye position.
virtual PxVec3 getEyeDirection (const uint32_t viewID=0) const =0
 Returns the world space eye direction.
virtual 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
::NvParameterized::Interface
getDebugRenderParams () const =0
 Gets debug rendering parameters from NvParameterized.
virtual
::NvParameterized::Interface
getModuleDebugRenderParams (const char *name) const =0
 Gets module debug rendering parameters from NvParameterized.
virtual PxVec3 getGravity () const =0
 Gets gravity value from PhysX or Apex scene for non PhysX configuration.
virtual void setGravity (const PxVec3 &gravity)=0
 Sets gravity for PhysX or Apex scene for non PhysX configuration.
virtual void lockRead (const char *fileName, uint32_t lineo)=0
 Acquire the PhysX scene lock for read access.
virtual void lockWrite (const char *fileName, uint32_t lineno)=0
 Acquire the PhysX scene lock for write access.
virtual void unlockRead ()=0
 Release the PhysX scene read lock.
virtual void unlockWrite ()=0
 Release the PhysX scene write lock.
virtual void addActorPair (PxActor *actor0, PxActor *actor1)=0
 Allows the application to specify a pair of PhysX actors for the purposes of collision filtering.
virtual void removeActorPair (PxActor *actor0, PxActor *actor1)=0
 Removes a previously specified pair of actors from the actor-pair filter table.
virtual bool findActorPair (PxActor *actor0, PxActor *actor1) const =0
 This method is used to determine if two actor pairs match.
virtual MirrorScenecreateMirrorScene (nvidia::apex::Scene &mirrorScene, MirrorScene::MirrorFilter &mirrorFilter, float mirrorStaticDistance, float mirrorDynamicDistance, float mirrorRefreshDistance)=0
 Returns an MirrorScene helper class which keeps a primary APEX scene mirrored into a secondary scene.
virtual void addBoundingBox (const PxBounds3 &bounds, UserBoundingBoxFlags::Enum flags)=0
 Adds user-defined bounding box into the scene. Each module can use these bounding boxes in a module-specific way. See documentation on each module. Some modules might use it as a valid volume of simulation, deleting actors or parts of actors upon leaving a BB.
virtual const PxBounds3 getBoundingBox (const uint32_t index) const =0
 Returns user-defined bounding box added previously. In case there is no bounding box for the given index, zero sized PxBounds3 is returned.
virtual UserBoundingBoxFlags::Enum getBoundingBoxFlags (const uint32_t index) const =0
 Returns user-defined bounding box flags. In case there is no bounding box (and its flags) for the given index, UserBoundingBoxFlags::NONE is returned.
virtual uint32_t getBoundingBoxCount () const =0
 Returns user-defined bounding box count.
virtual void removeBoundingBox (const uint32_t index)=0
 Removes user-defined bounding box at index. In case index is invalid (there is no bounding box for this index) nothing is happenning.
virtual void removeAllBoundingBoxes ()=0
 Removed all of the user-specified bounding boxes.
virtual void * getCudaTestManager () const =0
 Returns CUDA test manager. For distribution builds return NULL.
virtual void * getCudaProfileManager () const =0
 Returns CUDA profile manager. For distribution builds return NULL.
virtual void setCudaKernelCheckEnabled (bool enabled)=0
 Enables/disables CUDA error check after each kernel launch.
virtual bool getCudaKernelCheckEnabled () const =0
 Returns whether CUDA error check enabled.

Detailed Description

An APEX wrapper for an PxScene.


Member Function Documentation

virtual void nvidia::apex::Scene::addActorPair ( PxActor *  actor0,
PxActor *  actor1 
) [pure virtual]

Allows the application to specify a pair of PhysX actors for the purposes of collision filtering.

The set of methods addActorPair/removeActorPair and findActorPair can be used to implement collision filtering. This is a feature typically required to implement ragdoll systems to prevent nearby bodies from generating contacts which create jitter in the simulation; causing artifacts and preventing a ragdoll from coming to rest.

These methods are not required but are helper methods available if needed by the application.

Parameters:
actor0The first actor in the actor pair to consider
actor1The second actor in the actor pair to consider for filtering
virtual void nvidia::apex::Scene::addBoundingBox ( const PxBounds3 &  bounds,
UserBoundingBoxFlags::Enum  flags 
) [pure virtual]

Adds user-defined bounding box into the scene. Each module can use these bounding boxes in a module-specific way. See documentation on each module. Some modules might use it as a valid volume of simulation, deleting actors or parts of actors upon leaving a BB.

Parameters:
bounds[in] - The bounding box in world coordinates.
flags[in] - The flag for supplied bounding box.
virtual uint32_t nvidia::apex::Scene::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

See also:
ProjMatrixType
setProjParams()
virtual uint32_t nvidia::apex::Scene::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.

See also:
ViewMatrixType
setViewParams()
virtual bool nvidia::apex::Scene::checkResults ( bool  block) const [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 MirrorScene* nvidia::apex::Scene::createMirrorScene ( nvidia::apex::Scene mirrorScene,
MirrorScene::MirrorFilter mirrorFilter,
float  mirrorStaticDistance,
float  mirrorDynamicDistance,
float  mirrorRefreshDistance 
) [pure virtual]

Returns an MirrorScene helper class which keeps a primary APEX scene mirrored into a secondary scene.

Parameters:
mirrorScene[in] - The APEX scene that this scene will be mirrored into.
mirrorFilter[in] - The application provided callback interface to filter which actors/shapes get mirrored.
mirrorStaticDistance[in] - The distance to mirror static objects from the primary scene into the mirrored scene.
mirrorDynamicDistance[in] - The distance to mirror dynamic objects from the primary scene into the mirrored scene.
mirrorRefreshDistance[in] - The distance the camera should have moved before revising the trigger shapes controlling which actors get mirrored.
virtual bool nvidia::apex::Scene::fetchResults ( bool  block,
uint32_t *  errorState 
) [pure virtual]

Checks, and optionally blocks, for simulation completion. Updates scene state.

Checks if Scene has completed simulating (optionally blocking for completion). Updates new state of Actors and the PxScene. Returns true if simulation is complete.

Parameters:
block[in] - block until simulation is complete
errorState[out] - error value is written to this address, if not NULL
virtual bool nvidia::apex::Scene::findActorPair ( PxActor *  actor0,
PxActor *  actor1 
) const [pure virtual]

This method is used to determine if two actor pairs match.

If actor0 and actor1 were previously added to the actor-pair filter table, then this method will return true. Order is not important, actor0+actor1 will return the same result as actor1+actor0

Parameters:
actor0The first actor to consider
actor1The second actor to consider
Returns:
Returns true if the two actors match false if they have not been previously defined.
virtual const PxBounds3 nvidia::apex::Scene::getBoundingBox ( const uint32_t  index) const [pure virtual]

Returns user-defined bounding box added previously. In case there is no bounding box for the given index, zero sized PxBounds3 is returned.

Parameters:
index[in] - Index of the bounding box. User could acquire total number of bounding boxes using getBoundingBoxCount.
virtual UserBoundingBoxFlags::Enum nvidia::apex::Scene::getBoundingBoxFlags ( const uint32_t  index) const [pure virtual]

Returns user-defined bounding box flags. In case there is no bounding box (and its flags) for the given index, UserBoundingBoxFlags::NONE is returned.

Parameters:
index[in] - Index of the bounding box. User could acquire total number of bounding boxes using getBoundingBoxCount.
virtual PxVec3 nvidia::apex::Scene::getEyeDirection ( const uint32_t  viewID = 0) const [pure virtual]

Returns the world space eye direction.

See also:
ViewMatrixType
setViewMatrix()
virtual PxVec3 nvidia::apex::Scene::getEyePosition ( const uint32_t  viewID = 0) const [pure virtual]

Returns the world space eye position.

See also:
ViewMatrixType
setViewMatrix()
virtual PxMat44 nvidia::apex::Scene::getProjMatrix ( const uint32_t  projID = 0) const [pure virtual]

Returns the projection matrix set by the user for the given projID.

See also:
setProjMatrix()
virtual PxMat44 nvidia::apex::Scene::getViewMatrix ( const uint32_t  viewID = 0) const [pure virtual]

Returns the view matrix set by the user for the given viewID.

See also:
setViewMatrix()
virtual void nvidia::apex::Scene::lockRead ( const char *  fileName,
uint32_t  lineo 
) [pure virtual]

Acquire the PhysX scene lock for read access.

The PhysX 3.2.2 SDK (and higher) provides a multiple-reader single writer mutex lock to coordinate access to the PhysX SDK API from multiple concurrent threads. This method will in turn invoke the lockRead call on the PhysX Scene. The source code fileName and line number a provided for debugging purposes.

virtual void nvidia::apex::Scene::lockWrite ( const char *  fileName,
uint32_t  lineno 
) [pure virtual]

Acquire the PhysX scene lock for write access.

The PhysX 3.2.2 SDK (and higher) provides a multiple-reader single writer mutex lock to coordinate access to the PhysX SDK API from multiple concurrent threads. This method will in turn invoke the lockWrite call on the PhysX Scene. The source code fileName and line number a provided for debugging purposes.

virtual void nvidia::apex::Scene::removeActorPair ( PxActor *  actor0,
PxActor *  actor1 
) [pure virtual]

Removes a previously specified pair of actors from the actor-pair filter table.

Parameters:
actor0The first actor in the actor pair to remove
actor1The second actor in the actor pair to remove
virtual void nvidia::apex::Scene::removeBoundingBox ( const uint32_t  index) [pure virtual]

Removes user-defined bounding box at index. In case index is invalid (there is no bounding box for this index) nothing is happenning.

Parameters:
index[in] - Index of the bounding box. User could acquire total number of bounding boxes using getBoundingBoxCount.
virtual void nvidia::apex::Scene::setCudaKernelCheckEnabled ( bool  enabled) [pure virtual]

Enables/disables CUDA error check after each kernel launch.

Use ONLY for DEBUG purposes, when enabled could dramatically slowdown performance!

virtual void nvidia::apex::Scene::setPhysXScene ( PxScene *  s) [pure virtual]

Associate an PxScene with this Scene.

All Actors in the Scene will be added to the PxScene. The PxScene pointer can be NULL, which will cause all APEX actors to be removed from the previously specified PxScene. This must be done before the PxScene can be released.

virtual void nvidia::apex::Scene::setProjMatrix ( const PxMat44 &  projTransform,
const uint32_t  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().

See also:
setProjParams()
virtual void nvidia::apex::Scene::setProjParams ( float  nearPlaneDistance,
float  farPlaneDistance,
float  fieldOfViewDegree,
uint32_t  viewportWidth,
uint32_t  viewportHeight,
const uint32_t  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.

See also:
ProjMatrixType
virtual void nvidia::apex::Scene::setViewMatrix ( const PxMat44 &  viewTransform,
const uint32_t  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 nvidia::apex::Scene::setViewParams ( const PxVec3 &  eyePosition,
const PxVec3 &  eyeDirection,
const PxVec3 &  worldUpDirection = PxVec3(0, 1, 0),
const uint32_t  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.

See also:
ViewMatrixType
virtual void nvidia::apex::Scene::simulate ( float  elapsedTime,
bool  finalStep = true,
PxBaseTask *  completionTask = NULL,
void *  scratchMemBlock = 0,
uint32_t  scratchMemBlockSize = 0 
) [pure virtual]

Start simulation of the APEX (and PhysX) scene.

Start simulation of the Actors and the PxScene associated with this Scene. No Actors 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.

Parameters:
[in]elapsedTimeAmount of time to advance simulation by. Range: (0,inf)
[in]finalStepshould 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]completionTaskif 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]scratchMemBlocka 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]scratchMemBlockSizethe size of the scratch memory block. Must be a multiple of 16K.

The documentation for this class was generated from the following file:

Generated on Fri Dec 15 2017 13:58:41

Copyright © 2012-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved.