Go to the documentation of this file.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 APEX_SDK_H
00031 #define APEX_SDK_H
00032
00038 #include "ApexDefs.h"
00039 #include "ApexUsingNamespace.h"
00040 #include "ApexDesc.h"
00041 #include "ApexInterface.h"
00042
00043 #include "nvparameterized/NvSerializer.h"
00044 #include "nvparameterized/NvParameterized.h"
00045 #include "nvparameterized/NvParameterizedTraits.h"
00046 #include "Shape.h"
00047
00048
00049 namespace RENDER_DEBUG
00050 {
00051 class RenderDebugInterface;
00052 };
00053
00054 namespace physx
00055 {
00056 class PxFoundation;
00057 class PxCpuDispatcher;
00058
00059 namespace profile
00060 {
00061 class PxProfileZoneManager;
00062 }
00063 class PxPvd;
00064 }
00065
00067 namespace nvidia
00068 {
00070 namespace apex
00071 {
00072
00073 class UserRenderResourceManager;
00074 class Scene;
00075 class SceneDesc;
00076 class AssetPreviewScene;
00077 class RenderMeshAsset;
00078 class RenderMeshAssetAuthoring;
00079 class Module;
00080 class PhysXObjectDesc;
00081 class ResourceProvider;
00082 class ResourceCallback;
00083 class RenderDebugInterface;
00084 class Asset;
00085 class AssetAuthoring;
00086 class ApexSDKCachedData;
00087 class RenderMeshActor;
00088
00089 PX_PUSH_PACK_DEFAULT
00090
00094 class GroupsMask64
00095 {
00096 public:
00100 PX_INLINE GroupsMask64()
00101 {
00102 bits0 = bits1 = 0;
00103 }
00104
00108 PX_INLINE GroupsMask64(uint32_t b0, uint32_t b1) : bits0(b0), bits1(b1) {}
00109
00113 PX_INLINE void setToDefault()
00114 {
00115 *this = GroupsMask64();
00116 }
00117
00119 uint32_t bits0;
00121 uint32_t bits1;
00122 };
00123
00127 struct GroupsFilterOp
00128 {
00132 enum Enum
00133 {
00134 AND,
00135 OR,
00136 XOR,
00137 NAND,
00138 NOR,
00139 NXOR,
00140 SWAP_AND
00141 };
00142 };
00143
00147 typedef unsigned int AuthObjTypeID;
00148
00152 class ApexSDKDesc : public ApexDesc
00153 {
00154 public:
00158 PxFoundation* foundation;
00159
00167 uint32_t physXSDKVersion;
00168
00169 #if PX_PHYSICS_VERSION_MAJOR == 3
00170
00173 PxPhysics* physXSDK;
00174
00178 PxCooking* cooking;
00179 #endif
00180
00184 PxPvd* pvd;
00185
00189 UserRenderResourceManager* renderResourceManager;
00190
00198 ResourceCallback* resourceCallback;
00199
00206 const char* dllLoadPath;
00207
00214 const char* wireframeMaterial;
00215
00222 const char* solidShadedMaterial;
00223
00233 bool renderMeshActorLoadMaterialsLazily;
00234
00244 const char* dllNamePostfix;
00245
00253 const char* appGuid;
00254
00255
00261 bool resourceProviderIsCaseSensitive;
00262
00267 uint32_t physXObjDescTableAllocationIncrement;
00268
00273 bool enableConcurrencyCheck;
00274
00278 PX_INLINE ApexSDKDesc() : ApexDesc()
00279 {
00280 init();
00281 }
00282
00286 PX_INLINE void setToDefault()
00287 {
00288 ApexDesc::setToDefault();
00289 init();
00290 }
00291
00296 PX_INLINE bool isValid() const
00297 {
00298 bool retVal = ApexDesc::isValid();
00299
00300 if (foundation == NULL)
00301 {
00302 return false;
00303 }
00304 #if PX_PHYSICS_VERSION_MAJOR == 3
00305 if (physXSDK == NULL)
00306 {
00307 return false;
00308 }
00309 if (cooking == NULL)
00310 {
00311 return false;
00312 }
00313 if (physXSDKVersion != PX_PHYSICS_VERSION)
00314 {
00315 return false;
00316 }
00317 #endif
00318 return retVal;
00319 }
00320
00321 private:
00322 PX_INLINE void init()
00323 {
00324 renderResourceManager = NULL;
00325 foundation = NULL;
00326 #if PX_PHYSICS_VERSION_MAJOR == 3
00327 physXSDKVersion = PX_PHYSICS_VERSION;
00328 physXSDK = NULL;
00329 cooking = NULL;
00330 #endif
00331 pvd = NULL;
00332 resourceCallback = NULL;
00333 dllLoadPath = NULL;
00334 solidShadedMaterial = "ApexSolidShaded";
00335 wireframeMaterial = "ApexWireframe";
00336 renderMeshActorLoadMaterialsLazily = true;
00337 dllNamePostfix = NULL;
00338 appGuid = NULL;
00339 resourceProviderIsCaseSensitive = false;
00340 physXObjDescTableAllocationIncrement = 128;
00341 enableConcurrencyCheck = false;
00342 }
00343 };
00344
00345
00349 enum ApexCreateError
00350 {
00354 APEX_CE_NO_ERROR = 0,
00355
00361 APEX_CE_NOT_FOUND = 1,
00362
00366 APEX_CE_WRONG_VERSION = 2,
00367
00371 APEX_CE_DESCRIPTOR_INVALID = 3,
00372
00376 APEX_CE_CREATE_NO_ALLOWED = 4,
00377
00378 };
00379
00380
00384 class ApexSDK : public ApexInterface
00385 {
00386 public:
00390 virtual Scene* createScene(const SceneDesc&) = 0;
00391
00395 virtual void releaseScene(Scene*) = 0;
00396
00400 virtual AssetPreviewScene* createAssetPreviewScene() = 0;
00401
00405 virtual void releaseAssetPreviewScene(AssetPreviewScene* nxScene) = 0;
00406
00410 virtual Module* createModule(const char* name, ApexCreateError* err = NULL) = 0;
00411
00412 #if PX_PHYSICS_VERSION_MAJOR == 0
00413
00419 virtual physx::PxCpuDispatcher* createCpuDispatcher(uint32_t numThreads = 0) = 0;
00423 virtual void releaseCpuDispatcher(physx::PxCpuDispatcher& cd) = 0;
00424 #endif
00425
00426 #if PX_PHYSICS_VERSION_MAJOR == 3
00427
00431 virtual const PhysXObjectDesc* getPhysXObjectInfo(const PxActor* actor) const = 0;
00432
00437 virtual const PhysXObjectDesc* getPhysXObjectInfo(const PxShape* shape) const = 0;
00438
00443 virtual const PhysXObjectDesc* getPhysXObjectInfo(const PxJoint* joint) const = 0;
00444
00449 virtual const PhysXObjectDesc* getPhysXObjectInfo(const PxCloth* cloth) const = 0;
00450
00454 virtual PxCooking* getCookingInterface() = 0;
00455 #endif
00456
00461 PX_DEPRECATED virtual PxErrorCallback* getOutputStream() = 0;
00462
00466 virtual PxErrorCallback* getErrorCallback() const = 0;
00467
00471 virtual PxAllocatorCallback* getAllocator() const = 0;
00472
00476 virtual ResourceProvider* getNamedResourceProvider() = 0;
00477
00483 virtual PxFileBuf* createStream(const char* filename, PxFileBuf::OpenMode mode) = 0;
00484
00488 virtual PxFileBuf* createMemoryReadStream(const void* mem, uint32_t len) = 0;
00489
00493 virtual PxFileBuf* createMemoryWriteStream(uint32_t alignment = 0) = 0;
00494
00498 virtual const void* getMemoryWriteBuffer(PxFileBuf& stream, uint32_t& len) = 0;
00499
00503 virtual void releaseMemoryReadStream(PxFileBuf& stream) = 0;
00504
00508 virtual void releaseMemoryWriteStream(PxFileBuf& stream) = 0;
00509
00510 #if PX_PHYSICS_VERSION_MAJOR == 3
00511
00514 virtual PxPhysics* getPhysXSDK() = 0;
00515 #endif
00516
00520 virtual uint32_t getNbModules() = 0;
00521
00525 virtual Module** getModules() = 0;
00526
00530 virtual void releaseModule(Module* module) = 0;
00531
00535 virtual RenderDebugInterface* createApexRenderDebug(RENDER_DEBUG::RenderDebugInterface* iface, bool useRemoteDebugVisualization = false) = 0;
00536
00540 virtual void releaseApexRenderDebug(RenderDebugInterface& debug) = 0;
00541
00545 virtual SphereShape* createApexSphereShape() = 0;
00546
00550 virtual CapsuleShape* createApexCapsuleShape() = 0;
00551
00555 virtual BoxShape* createApexBoxShape() = 0;
00556
00560 virtual HalfSpaceShape* createApexHalfSpaceShape() = 0;
00561
00565 virtual void releaseApexShape(Shape& shape) = 0;
00566
00570 virtual uint32_t forceLoadAssets() = 0;
00571
00578 virtual bool getAuthorableObjectNames(const char** authTypeNames, uint32_t& outCount, uint32_t inCount) = 0;
00579
00583 virtual ::NvParameterized::Traits* getParameterizedTraits() = 0;
00584
00588 virtual Asset* createAsset(AssetAuthoring&, const char* name) = 0;
00589
00594 virtual Asset* createAsset(::NvParameterized::Interface*, const char* name) = 0;
00595
00599 virtual void releaseAsset(Asset&) = 0;
00600
00604 virtual AssetAuthoring* createAssetAuthoring(const char* authorTypeName) = 0;
00605
00609 virtual AssetAuthoring* createAssetAuthoring(const char* authorTypeName, const char* name) = 0;
00610
00614 virtual AssetAuthoring* createAssetAuthoring(::NvParameterized::Interface*, const char* name) = 0;
00615
00619 virtual void releaseAssetAuthoring(AssetAuthoring&) = 0;
00620
00624 virtual ApexSDKCachedData& getCachedData() const = 0;
00625
00629 virtual ::NvParameterized::Serializer* createSerializer(::NvParameterized::Serializer::SerializeType type) = 0;
00630
00634 virtual ::NvParameterized::Serializer* createSerializer(::NvParameterized::Serializer::SerializeType type, ::NvParameterized::Traits* traits) = 0;
00635
00640 virtual ::NvParameterized::Serializer::SerializeType getSerializeType(const void* data, uint32_t dlen) = 0;
00641
00645 virtual ::NvParameterized::Serializer::SerializeType getSerializeType(PxFileBuf& stream) = 0;
00646
00650 virtual NvParameterized::Serializer::ErrorType getSerializePlatform(PxFileBuf& stream, NvParameterized::SerializePlatform& platform) = 0;
00651
00656 virtual NvParameterized::Serializer::ErrorType getSerializePlatform(const void* data, uint32_t dlen, NvParameterized::SerializePlatform& platform) = 0;
00657
00661 virtual void getCurrentPlatform(NvParameterized::SerializePlatform& platform) const = 0;
00662
00672 virtual bool getPlatformFromString(const char* name, NvParameterized::SerializePlatform& platform) const = 0;
00673
00677 virtual const char* getPlatformName(const NvParameterized::SerializePlatform& platform) const = 0;
00678
00683 virtual ::NvParameterized::Interface* getDebugColorParams() const = 0;
00684
00688 virtual const char* getWireframeMaterial() = 0;
00689
00693 virtual const char* getSolidShadedMaterial() = 0;
00694
00698 virtual void setEnableApexStats(bool enableApexStats) = 0;
00699
00703 virtual void setEnableConcurrencyCheck(bool enableConcurrencyChecks) = 0;
00704
00708 virtual bool isConcurrencyCheckEnabled() = 0;
00709
00710 protected:
00711 virtual ~ApexSDK() {}
00712
00713 };
00714
00725 PX_POP_PACK
00726
00727 #ifdef CALL_CONV
00728 #undef CALL_CONV
00729 #endif
00730
00731 #if PX_WINDOWS_FAMILY
00732
00733 #define APEX_API extern "C" __declspec(dllexport)
00734 #define CALL_CONV __cdecl
00735 #else
00736 #define APEX_API extern "C"
00737 #define CALL_CONV
00738 #endif
00739
00743 APEX_API ApexSDK* CALL_CONV CreateApexSDK( const ApexSDKDesc& desc,
00744 ApexCreateError* errorCode = NULL,
00745 uint32_t APEXsdkVersion = APEX_SDK_VERSION,
00746 PxAllocatorCallback* alloc = 0);
00747
00751 APEX_API ApexSDK* CALL_CONV GetApexSDK();
00752
00753 }
00754 }
00755
00756 #endif // APEX_SDK_H