MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / PhysXSample

Class PhysXSample

physx/samples/samplebase/PhysXSample.h:64–339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62};
63
64class PhysXSample : public RAWImportCallback
65 , public SampleAllocateable
66 , public PxDeletionListener
67{
68 typedef std::map<PhysXShape, RenderBaseActor*> PhysXShapeToRenderActorMap;
69
70public:
71 PhysXSample(PhysXSampleApplication& app, PxU32 maxSubSteps=8);
72 virtual ~PhysXSample();
73
74public:
75 void render();
76 void displayFPS();
77
78 SampleFramework::SampleAsset* getAsset(const char* relativePath, SampleFramework::SampleAsset::Type type, bool abortOnError = true);
79 void importRAWFile(const char* relativePath, PxReal scale, bool recook=false);
80 void removeActor(PxRigidActor* actor);
81 void removeRenderObject(RenderBaseActor *renderAcotr);
82 void createRenderObjectsFromActor(PxRigidActor* actor, RenderMaterial* material=NULL);
83 RenderBaseActor* createRenderBoxFromShape(PxRigidActor* actor, PxShape* shape, RenderMaterial* material=NULL, const PxReal* uvs=NULL);
84 RenderBaseActor* createRenderObjectFromShape(PxRigidActor* actor, PxShape* shape, RenderMaterial* material=NULL);
85 RenderMeshActor* createRenderMeshFromRawMesh(const RAWMesh& data, PxShape* shape = NULL);
86 RenderTexture* createRenderTextureFromRawTexture(const RAWTexture& data);
87 RenderMaterial* createRenderMaterialFromTextureFile(const char* filename);
88 PxRigidActor* createGrid(RenderMaterial* material=NULL);
89 PxRigidDynamic* createBox(const PxVec3& pos, const PxVec3& dims, const PxVec3* linVel=NULL, RenderMaterial* material=NULL, PxReal density=1.0f);
90 PxRigidDynamic* createSphere(const PxVec3& pos, PxReal radius, const PxVec3* linVel=NULL, RenderMaterial* material=NULL, PxReal density=1.0f);
91 PxRigidDynamic* createCapsule(const PxVec3& pos, PxReal radius, PxReal halfHeight, const PxVec3* linVel=NULL, RenderMaterial* material=NULL, PxReal density=1.0f);
92 PxRigidDynamic* createConvex(const PxVec3& pos, const PxVec3* linVel=NULL, RenderMaterial* material=NULL, PxReal density=1.0f);
93 PxRigidDynamic* createCompound(const PxVec3& pos, const std::vector<PxTransform>& localPoses, const std::vector<const PxGeometry*>& geometries, const PxVec3* linVel=NULL, RenderMaterial* material=NULL, PxReal density=1.0f);
94 PxRigidDynamic* createTestCompound(const PxVec3& pos, PxU32 nbBoxes, float boxSize, float amplitude, const PxVec3* linVel, RenderMaterial* material, PxReal density, bool makeSureVolumeEmpty = false);
95 void createRenderObjectsFromScene();
96
97 void setSubStepper(const PxReal stepSize, const PxU32 maxSteps) { getStepper()->setSubStepper(stepSize, maxSteps); }
98 void togglePause();
99 void toggleFlyCamera();
100 void initRenderObjects();
101
102 // project from world coords to screen coords (can be used for text rendering)
103 void project(const PxVec3& v, int& x, int& y, float& depth);
104
105public:
106 virtual void onInit();
107 virtual void onInit(bool restart) { onInit(); }
108 virtual void onShutdown();
109
110 // called after simulate() has completed
111 virtual void onSubstep(float dtime) {}
112
113 // called after simulate() has completed, but before fetchResult() is called
114 virtual void onSubstepPreFetchResult() {}
115
116 // called before simulate() is called
117 virtual void onSubstepSetup(float dtime, PxBaseTask* cont) {}
118 // called after simulate() has started
119 virtual void onSubstepStart(float dtime) {}
120
121 virtual void onTickPreRender(float dtime);

Callers

nothing calls this directly

Calls 2

getRendererMethod · 0.80
getCameraMethod · 0.45

Tested by

no test coverage detected