00001 #pragma once 00002 00003 #define NOMINMAX 00004 #include "NxPhysics.h" 00005 #include "constants.h" 00006 #include "types.h" 00007 #include "GObject.h" 00008 #include "GSingletonManager.h" 00009 #include "GBoundingSphere.h" 00010 #include "GBoundingBox.h" 00011 #include "GModel.h" 00012 #include "GVec4f.h" 00013 #include "NxControllerManager.h" 00014 #include "NxUserRaycastReport.h" 00015 #include "NxActor.h" 00016 #include "Bullet.h" 00017 #include "Grenade.h" 00018 #include "GParticle.h" 00019 #include "GParticleEmitter.h" 00020 00021 00022 class myRaycastReport : public NxUserRaycastReport 00023 { 00024 virtual bool onHit(const NxRaycastHit &hits); 00025 }; 00026 00027 class GPhysicsManager : public GSingletonManager<GPhysicsManager> 00028 { 00029 friend class myRaycastReport; 00030 protected: 00031 NxPhysicsSDK* mPhysicsSDK; 00032 NxScene* mScene; 00033 NxActor* mActor; 00034 NxControllerManager* ControllerManager; 00035 NxCookingInterface *Cooking; 00036 float LastRayCastDistance; 00037 myRaycastReport *MyReport; 00038 public: 00039 GPhysicsManager(); 00040 int AddForce(GModel*, GVec4f); 00041 int Simulate(float dt); 00042 int InitPhysics(void); 00043 NxActor* RegisterPhysicalObject(GObject *Object, GVec4f Position, GVec4f Dimensions, BoundingType bt); 00044 int RegisterPhysicalModel(GModel *Model); 00045 int DeleteActor(NxActor *Actor); 00046 int DeleteController(NxController *Controller); 00048 int ApplyForce(GSkeleton *Skeleton, GVec4f Force); 00050 GVec4f GetLinearVelocity(GModel *Model); 00051 int RegisterController(GModel *Model); 00052 int RegisterBullet(Bullet *bullet); 00053 int RegisterGrenade(Grenade *grenade); 00054 int RegisterParticle(GParticle *particle); 00055 int CastRay(GVec4f Origin, GVec4f Direction); 00056 float GetLastRayCastDistance(void); 00057 };