00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef ACTOR_H
00031 #define ACTOR_H
00032
00038 #include "ApexInterface.h"
00039
00040 #if PX_PHYSICS_VERSION_MAJOR == 3
00041 #include "PxActor.h"
00042 #include "PxShape.h"
00043 #include "PxFiltering.h"
00044 namespace nvidia { namespace apex
00045 {
00046
00048 #define APEX_DEFAULT_WAKE_UP_COUNTER 0.4f
00049
00051 #define APEX_ACTOR_TEMPLATE_PARAM(_type, _name, _valid, _default) \
00052 bool is##_name##Valid(_type x) const { PX_UNUSED(x); return _valid; } \
00053 _type getDefault##_name() const { return _default; } \
00054 virtual _type get##_name() const = 0; \
00055 virtual bool set##_name(_type) = 0
00056
00062 class PhysX3DescTemplate
00063 {
00064 public:
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00077 APEX_ACTOR_TEMPLATE_PARAM(physx::PxDominanceGroup, DominanceGroup, (1), 0);
00079 APEX_ACTOR_TEMPLATE_PARAM(uint8_t, ActorFlags, (1), physx::PxActorFlag::eSEND_SLEEP_NOTIFIES);
00081 APEX_ACTOR_TEMPLATE_PARAM(physx::PxClientID, OwnerClient, (1), 0);
00083 APEX_ACTOR_TEMPLATE_PARAM(uint32_t, ClientBehaviorBits, (1), 0);
00085 APEX_ACTOR_TEMPLATE_PARAM(uint16_t, ContactReportFlags, (1), 0);
00087 APEX_ACTOR_TEMPLATE_PARAM(void*, UserData, (1), NULL);
00089 APEX_ACTOR_TEMPLATE_PARAM(const char*, Name, (1), NULL);
00090
00091
00093 APEX_ACTOR_TEMPLATE_PARAM(float, Density, (x >= 0.0f), 1.0f);
00095 APEX_ACTOR_TEMPLATE_PARAM(uint8_t, BodyFlags, (1), 0);
00097 APEX_ACTOR_TEMPLATE_PARAM(float, WakeUpCounter, (x >= 0.0f), APEX_DEFAULT_WAKE_UP_COUNTER);
00099 APEX_ACTOR_TEMPLATE_PARAM(float, LinearDamping, (x >= 0.0f), 0.0f);
00101 APEX_ACTOR_TEMPLATE_PARAM(float, AngularDamping, (x >= 0.0f), 0.05f);
00103 APEX_ACTOR_TEMPLATE_PARAM(float, MaxAngularVelocity, (1), 7.0f);
00105 APEX_ACTOR_TEMPLATE_PARAM(float, SleepLinearVelocity, (1), 0.0f);
00107 APEX_ACTOR_TEMPLATE_PARAM(uint32_t, SolverIterationCount, (x >= 1 && x <= 255), 4);
00109 APEX_ACTOR_TEMPLATE_PARAM(uint32_t, VelocityIterationCount, (x >= 1 && x <= 255), 1);
00111 APEX_ACTOR_TEMPLATE_PARAM(float, ContactReportThreshold, (1), PX_MAX_F32);
00113 APEX_ACTOR_TEMPLATE_PARAM(float, SleepThreshold, (1), 0.005f);
00114
00115
00117 APEX_ACTOR_TEMPLATE_PARAM(uint8_t, ShapeFlags, (1), physx::PxShapeFlag::eSIMULATION_SHAPE | physx::PxShapeFlag::eSCENE_QUERY_SHAPE | physx::PxShapeFlag::eVISUALIZATION);
00119 APEX_ACTOR_TEMPLATE_PARAM(void*, ShapeUserData, (1), NULL);
00121 APEX_ACTOR_TEMPLATE_PARAM(const char*, ShapeName, (1), NULL);
00123 APEX_ACTOR_TEMPLATE_PARAM(physx::PxFilterData, SimulationFilterData, (1), physx::PxFilterData(0, 0, 0, 0));
00125 APEX_ACTOR_TEMPLATE_PARAM(physx::PxFilterData, QueryFilterData, (1), physx::PxFilterData(0, 0, 0, 0));
00127 APEX_ACTOR_TEMPLATE_PARAM(float, ContactOffset, (1), -1.0f);
00129 APEX_ACTOR_TEMPLATE_PARAM(float, RestOffset, (1), PX_MAX_F32);
00130
00132 virtual physx::PxMaterial** getMaterials(uint32_t& materialCount) const = 0;
00134 virtual bool setMaterials(physx::PxMaterial** materialArray, uint32_t materialCount) = 0;
00135
00136
00138 virtual void release() = 0;
00139
00140 protected:
00141 virtual ~PhysX3DescTemplate() {}
00142 };
00143
00144 #undef APEX_ACTOR_TEMPLATE_PARAM
00145
00146 }}
00147 #endif
00148
00149 namespace nvidia
00150 {
00151 namespace apex
00152 {
00153
00154 PX_PUSH_PACK_DEFAULT
00155
00156 class Asset;
00157
00161 class Actor : public ApexInterface
00162 {
00163 public:
00167 virtual Asset* getOwner() const = 0;
00168
00179 virtual void getLodRange(float& min, float& max, bool& intOnly) const = 0;
00180
00184 virtual float getActiveLod() const = 0;
00185
00194 virtual void forceLod(float lod) = 0;
00195
00199 virtual void cacheModuleData() const {}
00200
00204 virtual void setEnableDebugVisualization(bool state) = 0;
00205
00206
00207 protected:
00208 virtual ~Actor() {}
00209 };
00210
00211 #if PX_PHYSICS_VERSION_MAJOR == 3
00212
00215 class ActorSource
00216 {
00217 public:
00234 virtual void setPhysX3Template(const PhysX3DescTemplate*) = 0;
00235
00239 virtual bool getPhysX3Template(PhysX3DescTemplate& dest) const = 0;
00240
00244 virtual PhysX3DescTemplate* createPhysX3DescTemplate() const = 0;
00245 };
00246
00247 #endif
00248
00249 PX_POP_PACK
00250
00251 }
00252 }
00253
00254 #endif // ACTOR_H