Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef APEX_SDK_H
00013 #define APEX_SDK_H
00014
00020 #include "ApexDefs.h"
00021 #include "ApexUsingNamespace.h"
00022 #include "ApexDesc.h"
00023 #include "ApexInterface.h"
00024
00025 #include "nvparameterized/NvSerializer.h"
00026 #include "nvparameterized/NvParameterized.h"
00027 #include "nvparameterized/NvParameterizedTraits.h"
00028 #include "Shape.h"
00029
00030
00031 namespace RENDER_DEBUG
00032 {
00033 class RenderDebugInterface;
00034 };
00035
00036 namespace physx
00037 {
00038 class PxFoundation;
00039 class PxCpuDispatcher;
00040
00041 namespace profile
00042 {
00043 class PxProfileZoneManager;
00044 }
00045 class PxPvd;
00046 }
00047
00049 namespace nvidia
00050 {
00052 namespace apex
00053 {
00054
00055 class UserRenderResourceManager;
00056 class Scene;
00057 class SceneDesc;
00058 class AssetPreviewScene;
00059 class RenderMeshAsset;
00060 class RenderMeshAssetAuthoring;
00061 class Module;
00062 class PhysXObjectDesc;
00063 class ResourceProvider;
00064 class ResourceCallback;
00065 class RenderDebugInterface;
00066 class Asset;
00067 class AssetAuthoring;
00068 class ApexSDKCachedData;
00069 class RenderMeshActor;
00070
00071 PX_PUSH_PACK_DEFAULT
00072
00076 class GroupsMask64
00077 {
00078 public:
00082 PX_INLINE GroupsMask64()
00083 {
00084 bits0 = bits1 = 0;
00085 }
00086
00090 PX_INLINE GroupsMask64(uint32_t b0, uint32_t b1) : bits0(b0), bits1(b1) {}
00091
00095 PX_INLINE void setToDefault()
00096 {
00097 *this = GroupsMask64();
00098 }
00099
00101 uint32_t bits0;
00103 uint32_t bits1;
00104 };
00105
00109 struct GroupsFilterOp
00110 {
00114 enum Enum
00115 {
00116 AND,
00117 OR,
00118 XOR,
00119 NAND,
00120 NOR,
00121 NXOR,
00122 SWAP_AND
00123 };
00124 };
00125
00129 typedef unsigned int AuthObjTypeID;
00130
00134 class ApexSDKDesc : public ApexDesc
00135 {
00136 public:
00140 PxFoundation* foundation;
00141
00149 uint32_t physXSDKVersion;
00150
00151 #if PX_PHYSICS_VERSION_MAJOR == 3
00152
00155 PxPhysics* physXSDK;
00156
00160 PxCooking* cooking;
00161 #endif
00162
00166 PxPvd* pvd;
00167
00171 UserRenderResourceManager* renderResourceManager;
00172
00180 ResourceCallback* resourceCallback;
00181
00188 const char* dllLoadPath;
00189
00196 const char* wireframeMaterial;
00197
00204 const char* solidShadedMaterial;
00205
00215 bool renderMeshActorLoadMaterialsLazily;
00216
00226 const char* dllNamePostfix;
00227
00235 const char* appGuid;
00236
00237
00243 bool resourceProviderIsCaseSensitive;
00244
00249 uint32_t physXObjDescTableAllocationIncrement;
00250
00255 bool enableConcurrencyCheck;
00256
00260 PX_INLINE ApexSDKDesc() : ApexDesc()
00261 {
00262 init();
00263 }
00264
00268 PX_INLINE void setToDefault()
00269 {
00270 ApexDesc::setToDefault();
00271 init();
00272 }
00273
00278 PX_INLINE bool isValid() const
00279 {
00280 bool retVal = ApexDesc::isValid();
00281
00282 if (foundation == NULL)
00283 {
00284 return false;
00285 }
00286 #if PX_PHYSICS_VERSION_MAJOR == 3
00287 if (physXSDK == NULL)
00288 {
00289 return false;
00290 }
00291 if (cooking == NULL)
00292 {
00293 return false;
00294 }
00295 if (physXSDKVersion != PX_PHYSICS_VERSION)
00296 {
00297 return false;
00298 }
00299 #endif
00300 return retVal;
00301 }
00302
00303 private:
00304 PX_INLINE void init()
00305 {
00306 renderResourceManager = NULL;
00307 foundation = NULL;
00308 #if PX_PHYSICS_VERSION_MAJOR == 3
00309 physXSDKVersion = PX_PHYSICS_VERSION;
00310 physXSDK = NULL;
00311 cooking = NULL;
00312 #endif
00313 pvd = NULL;
00314 resourceCallback = NULL;
00315 dllLoadPath = NULL;
00316 solidShadedMaterial = "ApexSolidShaded";
00317 wireframeMaterial = "ApexWireframe";
00318 renderMeshActorLoadMaterialsLazily = true;
00319 dllNamePostfix = NULL;
00320 appGuid = NULL;
00321 resourceProviderIsCaseSensitive = false;
00322 physXObjDescTableAllocationIncrement = 128;
00323 enableConcurrencyCheck = false;
00324 }
00325 };
00326
00327
00331 enum ApexCreateError
00332 {
00336 APEX_CE_NO_ERROR = 0,
00337
00343 APEX_CE_NOT_FOUND = 1,
00344
00348 APEX_CE_WRONG_VERSION = 2,
00349
00353 APEX_CE_DESCRIPTOR_INVALID = 3,
00354
00358 APEX_CE_CREATE_NO_ALLOWED = 4,
00359
00360 };
00361
00362
00366 class ApexSDK : public ApexInterface
00367 {
00368 public:
00372 virtual Scene* createScene(const SceneDesc&) = 0;
00373
00377 virtual void releaseScene(Scene*) = 0;
00378
00382 virtual AssetPreviewScene* createAssetPreviewScene() = 0;
00383
00387 virtual void releaseAssetPreviewScene(AssetPreviewScene* nxScene) = 0;
00388
00392 virtual Module* createModule(const char* name, ApexCreateError* err = NULL) = 0;
00393
00394 #if PX_PHYSICS_VERSION_MAJOR == 0
00395
00401 virtual physx::PxCpuDispatcher* createCpuDispatcher(uint32_t numThreads = 0) = 0;
00405 virtual void releaseCpuDispatcher(physx::PxCpuDispatcher& cd) = 0;
00406 #endif
00407
00408 #if PX_PHYSICS_VERSION_MAJOR == 3
00409
00413 virtual const PhysXObjectDesc* getPhysXObjectInfo(const PxActor* actor) const = 0;
00414
00419 virtual const PhysXObjectDesc* getPhysXObjectInfo(const PxShape* shape) const = 0;
00420
00425 virtual const PhysXObjectDesc* getPhysXObjectInfo(const PxJoint* joint) const = 0;
00426
00431 virtual const PhysXObjectDesc* getPhysXObjectInfo(const PxCloth* cloth) const = 0;
00432
00436 virtual PxCooking* getCookingInterface() = 0;
00437 #endif
00438
00443 PX_DEPRECATED virtual PxErrorCallback* getOutputStream() = 0;
00444
00448 virtual PxErrorCallback* getErrorCallback() const = 0;
00449
00453 virtual PxAllocatorCallback* getAllocator() const = 0;
00454
00458 virtual ResourceProvider* getNamedResourceProvider() = 0;
00459
00465 virtual PxFileBuf* createStream(const char* filename, PxFileBuf::OpenMode mode) = 0;
00466
00470 virtual PxFileBuf* createMemoryReadStream(const void* mem, uint32_t len) = 0;
00471
00475 virtual PxFileBuf* createMemoryWriteStream(uint32_t alignment = 0) = 0;
00476
00480 virtual const void* getMemoryWriteBuffer(PxFileBuf& stream, uint32_t& len) = 0;
00481
00485 virtual void releaseMemoryReadStream(PxFileBuf& stream) = 0;
00486
00490 virtual void releaseMemoryWriteStream(PxFileBuf& stream) = 0;
00491
00492 #if PX_PHYSICS_VERSION_MAJOR == 3
00493
00496 virtual PxPhysics* getPhysXSDK() = 0;
00497 #endif
00498
00502 virtual uint32_t getNbModules() = 0;
00503
00507 virtual Module** getModules() = 0;
00508
00512 virtual void releaseModule(Module* module) = 0;
00513
00517 virtual RenderDebugInterface* createApexRenderDebug(RENDER_DEBUG::RenderDebugInterface* iface, bool useRemoteDebugVisualization = false) = 0;
00518
00522 virtual void releaseApexRenderDebug(RenderDebugInterface& debug) = 0;
00523
00527 virtual SphereShape* createApexSphereShape() = 0;
00528
00532 virtual CapsuleShape* createApexCapsuleShape() = 0;
00533
00537 virtual BoxShape* createApexBoxShape() = 0;
00538
00542 virtual HalfSpaceShape* createApexHalfSpaceShape() = 0;
00543
00547 virtual void releaseApexShape(Shape& shape) = 0;
00548
00552 virtual uint32_t forceLoadAssets() = 0;
00553
00560 virtual bool getAuthorableObjectNames(const char** authTypeNames, uint32_t& outCount, uint32_t inCount) = 0;
00561
00565 virtual ::NvParameterized::Traits* getParameterizedTraits() = 0;
00566
00570 virtual Asset* createAsset(AssetAuthoring&, const char* name) = 0;
00571
00576 virtual Asset* createAsset(::NvParameterized::Interface*, const char* name) = 0;
00577
00581 virtual void releaseAsset(Asset&) = 0;
00582
00586 virtual AssetAuthoring* createAssetAuthoring(const char* authorTypeName) = 0;
00587
00591 virtual AssetAuthoring* createAssetAuthoring(const char* authorTypeName, const char* name) = 0;
00592
00596 virtual AssetAuthoring* createAssetAuthoring(::NvParameterized::Interface*, const char* name) = 0;
00597
00601 virtual void releaseAssetAuthoring(AssetAuthoring&) = 0;
00602
00606 virtual ApexSDKCachedData& getCachedData() const = 0;
00607
00611 virtual ::NvParameterized::Serializer* createSerializer(::NvParameterized::Serializer::SerializeType type) = 0;
00612
00616 virtual ::NvParameterized::Serializer* createSerializer(::NvParameterized::Serializer::SerializeType type, ::NvParameterized::Traits* traits) = 0;
00617
00622 virtual ::NvParameterized::Serializer::SerializeType getSerializeType(const void* data, uint32_t dlen) = 0;
00623
00627 virtual ::NvParameterized::Serializer::SerializeType getSerializeType(PxFileBuf& stream) = 0;
00628
00632 virtual NvParameterized::Serializer::ErrorType getSerializePlatform(PxFileBuf& stream, NvParameterized::SerializePlatform& platform) = 0;
00633
00638 virtual NvParameterized::Serializer::ErrorType getSerializePlatform(const void* data, uint32_t dlen, NvParameterized::SerializePlatform& platform) = 0;
00639
00643 virtual void getCurrentPlatform(NvParameterized::SerializePlatform& platform) const = 0;
00644
00654 virtual bool getPlatformFromString(const char* name, NvParameterized::SerializePlatform& platform) const = 0;
00655
00659 virtual const char* getPlatformName(const NvParameterized::SerializePlatform& platform) const = 0;
00660
00665 virtual ::NvParameterized::Interface* getDebugColorParams() const = 0;
00666
00670 virtual const char* getWireframeMaterial() = 0;
00671
00675 virtual const char* getSolidShadedMaterial() = 0;
00676
00680 virtual void setEnableApexStats(bool enableApexStats) = 0;
00681
00685 virtual void setEnableConcurrencyCheck(bool enableConcurrencyChecks) = 0;
00686
00690 virtual bool isConcurrencyCheckEnabled() = 0;
00691
00692 protected:
00693 virtual ~ApexSDK() {}
00694
00695 };
00696
00707 PX_POP_PACK
00708
00709 #ifdef CALL_CONV
00710 #undef CALL_CONV
00711 #endif
00712
00713 #if PX_WINDOWS_FAMILY
00714
00715 #define APEX_API extern "C" __declspec(dllexport)
00716 #define CALL_CONV __cdecl
00717 #else
00718 #define APEX_API extern "C"
00719 #define CALL_CONV
00720 #endif
00721
00725 APEX_API ApexSDK* CALL_CONV CreateApexSDK( const ApexSDKDesc& desc,
00726 ApexCreateError* errorCode = NULL,
00727 uint32_t APEXsdkVersion = APEX_SDK_VERSION,
00728 PxAllocatorCallback* alloc = 0);
00729
00733 APEX_API ApexSDK* CALL_CONV GetApexSDK();
00734
00735 }
00736 }
00737
00738 #endif // APEX_SDK_H