px3World.h
Engine/source/T3D/physics/physx3/px3World.h
Classes:
class
Public Enumerations
enum
Px3CollisionGroup { PX3_DEFAULT = BIT(0) PX3_PLAYER = BIT(1) PX3_DEBRIS = BIT(2) PX3_TRIGGER = BIT(3) }
Detailed Description
Public Enumerations
Px3CollisionGroup
Enumerator
- PX3_DEFAULT = BIT(0)
- PX3_PLAYER = BIT(1)
- PX3_DEBRIS = BIT(2)
- PX3_TRIGGER = BIT(3)
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _PX3WORLD_H_ 25#define _PX3WORLD_H_ 26 27#ifndef _T3D_PHYSICS_PHYSICSWORLD_H_ 28#include "T3D/physics/physicsWorld.h" 29#endif 30#ifndef _MMATH_H_ 31#include "math/mMath.h" 32#endif 33#ifndef _PHYSX3_H_ 34#include "T3D/physics/physx3/px3.h" 35#endif 36#ifndef _TVECTOR_H_ 37#include "core/util/tVector.h" 38#endif 39 40class Px3ConsoleStream; 41class Px3ContactReporter; 42class FixedStepper; 43 44enum Px3CollisionGroup 45{ 46 PX3_DEFAULT = BIT(0), 47 PX3_PLAYER = BIT(1), 48 PX3_DEBRIS = BIT(2), 49 PX3_TRIGGER = BIT(3), 50}; 51 52class Px3World : public PhysicsWorld 53{ 54protected: 55 56 physx::PxScene* mScene; 57 bool mIsEnabled; 58 bool mIsSimulating; 59 bool mIsServer; 60 bool mIsSceneLocked; 61 U32 mTickCount; 62 ProcessList *mProcessList; 63 F32 mEditorTimeScale; 64 bool mErrorReport; 65 physx::PxRenderBuffer *mRenderBuffer; 66 physx::PxControllerManager* mControllerManager; 67 static Px3ConsoleStream *smErrorCallback; 68 static physx::PxDefaultAllocator smMemoryAlloc; 69 static physx::PxFoundation* smFoundation; 70 static physx::PxCooking *smCooking; 71 static physx::PxProfileZoneManager* smProfileZoneManager; 72 static physx::PxDefaultCpuDispatcher* smCpuDispatcher; 73 static physx::PxVisualDebuggerConnection* smPvdConnection; 74 F32 mAccumulator; 75 bool _simulate(const F32 dt); 76 77public: 78 79 Px3World(); 80 virtual ~Px3World(); 81 82 virtual bool initWorld( bool isServer, ProcessList *processList ); 83 virtual void destroyWorld(); 84 virtual void onDebugDraw( const SceneRenderState *state ); 85 virtual void reset() {} 86 virtual bool castRay( const Point3F &startPnt, const Point3F &endPnt, RayInfo *ri, const Point3F &impulse ); 87 virtual PhysicsBody* castRay( const Point3F &start, const Point3F &end, U32 bodyTypes = BT_All ); 88 virtual void explosion( const Point3F &pos, F32 radius, F32 forceMagnitude ); 89 virtual bool isEnabled() const { return mIsEnabled; } 90 physx::PxScene* getScene(){ return mScene;} 91 void setEnabled( bool enabled ); 92 U32 getTick() { return mTickCount; } 93 void tickPhysics( U32 elapsedMs ); 94 void getPhysicsResults(); 95 void setEditorTimeScale( F32 timeScale ) { mEditorTimeScale = timeScale; } 96 const F32 getEditorTimeScale() const { return mEditorTimeScale; } 97 void releaseWriteLock(); 98 bool isServer(){return mIsServer;} 99 physx::PxController* createController( physx::PxControllerDesc &desc ); 100 void lockScene(); 101 void unlockScene(); 102 //static 103 static bool restartSDK( bool destroyOnly = false, Px3World *clientWorld = NULL, Px3World *serverWorld = NULL ); 104 static void releaseWriteLocks(); 105 static physx::PxCooking *getCooking(); 106 static void lockScenes(); 107 static void unlockScenes(); 108}; 109 110#endif // _PX3WORLD_H_ 111
