diff options
| author | git perforce import user <a@b> | 2016-10-25 12:29:14 -0600 |
|---|---|---|
| committer | Sheikh Dawood Abdul Ajees <Sheikh Dawood Abdul Ajees> | 2016-10-25 18:56:37 -0500 |
| commit | 3dfe2108cfab31ba3ee5527e217d0d8e99a51162 (patch) | |
| tree | fa6485c169e50d7415a651bf838f5bcd0fd3bfbd /APEX_1.4/common/include/ApexSDKIntl.h | |
| download | physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.tar.xz physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.zip | |
Initial commit:
PhysX 3.4.0 Update @ 21294896
APEX 1.4.0 Update @ 21275617
[CL 21300167]
Diffstat (limited to 'APEX_1.4/common/include/ApexSDKIntl.h')
| -rw-r--r-- | APEX_1.4/common/include/ApexSDKIntl.h | 265 |
1 files changed, 265 insertions, 0 deletions
diff --git a/APEX_1.4/common/include/ApexSDKIntl.h b/APEX_1.4/common/include/ApexSDKIntl.h new file mode 100644 index 00000000..6bcc91bb --- /dev/null +++ b/APEX_1.4/common/include/ApexSDKIntl.h @@ -0,0 +1,265 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + + +#ifndef APEX_SDK_INTL_H +#define APEX_SDK_INTL_H + +/* Framework-internal interface class */ + +#include "ApexSDK.h" +#include "ResourceProviderIntl.h" +#include "PhysXObjectDescIntl.h" + +#include "PsString.h" +#include "PxErrors.h" + +#if APEX_CUDA_SUPPORT +namespace nvidia +{ + class PhysXGpuIndicator; +} +#endif + +#include <stdarg.h> +#include <stdio.h> +#include <string.h> + +namespace NvParameterized +{ +class Traits; +}; + +namespace physx +{ +namespace pvdsdk +{ + class ApexPvdClient; +} +namespace profile +{ + class PxProfileZone; +} +} + +namespace nvidia +{ +namespace apex +{ + +class ModuleIntl; +class Actor; +class ApexActor; +class AuthorableObjectIntl; +class UserOpaqueMesh; + +/** +Internal interface to the ApexSDK, available to Modules and Scenes +*/ +class ApexSDKIntl : public ApexSDK +{ +public: + /** + Register an authorable object type with the SDK. These IDs should be accessable + from the Module* public interface so users can compare them against game objects + in callbacks. + */ + virtual AuthObjTypeID registerAuthObjType(const char*, ResID nsid) = 0; + virtual AuthObjTypeID registerAuthObjType(const char*, AuthorableObjectIntl* authObjPtr) = 0; + virtual AuthObjTypeID registerNvParamAuthType(const char*, AuthorableObjectIntl* authObjPtr) = 0; + virtual void unregisterAuthObjType(const char*) = 0; + virtual void unregisterNvParamAuthType(const char*) = 0; + /** + Query the ResID of an authorable object namespace. This is useful if you have + an authorable object class name, but not a module pointer. + */ + virtual AuthorableObjectIntl* getAuthorableObject(const char*) = 0; + virtual AuthorableObjectIntl* getParamAuthObject(const char*) = 0; + + virtual AssetAuthoring* createAssetAuthoring(const char* aoTypeName) = 0; + virtual AssetAuthoring* createAssetAuthoring(const char* aoTypeName, const char* name) = 0; + virtual Asset* createAsset(AssetAuthoring&, const char*) = 0; + virtual Asset* createAsset(NvParameterized::Interface*, const char*) = 0; + virtual Asset* createAsset(const char* opaqueMeshName, UserOpaqueMesh* om) = 0; + virtual void releaseAsset(Asset&) = 0; + virtual void releaseAssetAuthoring(AssetAuthoring&) = 0; + /** + Request an ApexActor pointer for an Actor + */ + virtual ApexActor* getApexActor(Actor*) const = 0; + + /** + When APEX creates a PhysX object and injects it into a PhysX scene, it must + register that object with the ApexSDK so that the end user can differentiate between + their own PhysX objects and those created by APEX. The object descriptor will also + provide a method for working their way back to the containing APEX data structure. + */ +#if PX_PHYSICS_VERSION_MAJOR == 3 + virtual PhysXObjectDescIntl* createObjectDesc(const Actor*, const PxActor*) = 0; + virtual PhysXObjectDescIntl* createObjectDesc(const Actor*, const PxShape*) = 0; + virtual PhysXObjectDescIntl* createObjectDesc(const Actor*, const PxJoint*) = 0; + virtual PhysXObjectDescIntl* createObjectDesc(const Actor*, const PxCloth*) = 0; +#endif // PX_PHYSICS_VERSION_MAJOR == 3 + + /** + Retrieve an object desc created by createObjectDesc. + */ + virtual PhysXObjectDescIntl* getGenericPhysXObjectInfo(const void*) const = 0; + + /** + When APEX deletes a PhysX object or otherwise removes it from the PhysX scene, it must + call this function to remove it from the ApexSDK object description cache. + */ + virtual void releaseObjectDesc(void*) = 0; + + /* Utility functions intended to be used internally */ + virtual void reportError(PxErrorCode::Enum code, const char* file, int line, const char* functionName, const char* message, ...) = 0; + + virtual uint32_t getCookingVersion() const = 0; + + virtual void* getTempMemory(uint32_t size) = 0; + + virtual void releaseTempMemory(void* data) = 0; + + /** + * ApexScenes and Modules can query the ModuleIntl interfaces from the ApexSDK + */ + virtual ModuleIntl** getInternalModules() = 0; + + /** + * Returns the internal named resource provider. The internal interface allows + * resource creation and deletion + */ + virtual ResourceProviderIntl* getInternalResourceProvider() = 0; + + /** + * Allow 3rd party modules distributed as static libraries to link + * into the ApexSDK such that the normal ApexSDK::createModule() + * will still work correctly. The 3rd party lib must export a C + * function that instantiates their module and calls this function. + * The user must call that instantiation function before calling + * createModule() for it. + */ + virtual void registerExternalModule(Module* nx, ModuleIntl* ni) = 0; + + /** + * Allow modules to fetch these ApexSDK global name spaces + */ + virtual ResID getMaterialNameSpace() const = 0; + virtual ResID getOpaqueMeshNameSpace() const = 0; + virtual ResID getCustomVBNameSpace() const = 0; + virtual ResID getApexMeshNameSpace() = 0; + virtual ResID getCollisionGroupNameSpace() const = 0; + virtual ResID getCollisionGroup128NameSpace() const = 0; + virtual ResID getCollisionGroup64NameSpace() const = 0; + virtual ResID getCollisionGroupMaskNameSpace() const = 0; + virtual ResID getPhysicalMaterialNameSpace() const = 0; + virtual ResID getAuthorableTypesNameSpace() const = 0; + + /** + * Retrieve the user provided render resource manager + */ + virtual UserRenderResourceManager* getUserRenderResourceManager() const = 0; + + virtual NvParameterized::Traits* getParameterizedTraits() = 0; + + virtual ModuleIntl* getInternalModuleByName(const char* name) = 0; + + /** + * Update debug renderer color tables in each apex scene with NvParameterized color table. + */ + virtual void updateDebugColorParams(const char* color, uint32_t val) = 0; + + virtual bool getRMALoadMaterialsLazily() = 0; + + virtual pvdsdk::ApexPvdClient* getApexPvdClient() = 0; + virtual profile::PxProfileZoneManager * getProfileZoneManager() = 0; + virtual profile::PxProfileZone * getProfileZone() = 0; + + // applications can append strings to the APEX DLL filenames + virtual const char* getCustomDllNamePostfix() const = 0; +#if PX_WINDOWS_FAMILY + /** + * Return the user-provided appGuid, or the default appGuid if the user didn't provide one. + */ + virtual const char* getAppGuid() = 0; +#endif + +#if APEX_CUDA_SUPPORT + virtual PhysXGpuIndicator* registerPhysXIndicatorGpuClient() = 0; + virtual void unregisterPhysXIndicatorGpuClient(PhysXGpuIndicator* gpuIndicator) = 0; +#endif + + virtual ModuleIntl *getInternalModule(Module *module) = 0; + virtual Module *getModule(ModuleIntl *module) = 0; + + virtual void enterURR() = 0; + virtual void leaveURR() = 0; + virtual void checkURR() = 0; + + PX_FORCE_INLINE PxU64 getContextId() const { return PxU64(reinterpret_cast<size_t>(this)); } + +protected: + virtual ~ApexSDKIntl() {} + +}; + +/** +Returns global SDK pointer. Not sure if we can do this. +*/ +APEX_API ApexSDKIntl* CALL_CONV GetInternalApexSDK(); + +} +} // end namespace nvidia::apex + +#define APEX_SPRINTF_S(dest_buf, n, str_fmt, ...) \ + shdfnd::snprintf((char *) dest_buf, n, str_fmt, ##__VA_ARGS__); + +// gcc uses names ...s +#define APEX_INVALID_PARAMETER(_A, ...) \ + nvidia::GetInternalApexSDK()->reportError(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, __FUNCTION__, _A, ##__VA_ARGS__) +#define APEX_INVALID_OPERATION(_A, ...) \ + nvidia::GetInternalApexSDK()->reportError(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, __FUNCTION__, _A, ##__VA_ARGS__) +#define APEX_INTERNAL_ERROR(_A, ...) \ + nvidia::GetInternalApexSDK()->reportError(PxErrorCode::eINTERNAL_ERROR , __FILE__, __LINE__, __FUNCTION__, _A, ##__VA_ARGS__) +#define APEX_DEBUG_INFO(_A, ...) \ + nvidia::GetInternalApexSDK()->reportError(PxErrorCode::eDEBUG_INFO , __FILE__, __LINE__, __FUNCTION__, _A, ##__VA_ARGS__) +#define APEX_DEBUG_WARNING(_A, ...) \ + nvidia::GetInternalApexSDK()->reportError(PxErrorCode::eDEBUG_WARNING , __FILE__, __LINE__, __FUNCTION__, _A, ##__VA_ARGS__) +#define APEX_DEPRECATED() \ + nvidia::GetInternalApexSDK()->reportError(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, __FUNCTION__, "This method is deprecated") +#define APEX_DEPRECATED_ONCE() \ + { static bool firstTime = true; if (firstTime) { firstTime = false; APEX_DEPRECATED(); } } + + +#if PX_DEBUG || PX_CHECKED + +namespace nvidia +{ + namespace apex + { + class UpdateRenderResourcesScope + { + public: + PX_INLINE UpdateRenderResourcesScope() { GetInternalApexSDK()->enterURR(); } + PX_INLINE ~UpdateRenderResourcesScope() { GetInternalApexSDK()->leaveURR(); } + }; + } +} + +# define URR_SCOPE UpdateRenderResourcesScope updateRenderResourcesScope +# define URR_CHECK GetInternalApexSDK()->checkURR() +#else +# define URR_SCOPE +# define URR_CHECK +#endif + + +#endif // APEX_SDK_INTL_H |