aboutsummaryrefslogtreecommitdiff
path: root/PxShared/src/pvd/include
diff options
context:
space:
mode:
authorgit perforce import user <a@b>2016-10-25 12:29:14 -0600
committerSheikh Dawood Abdul Ajees <Sheikh Dawood Abdul Ajees>2016-10-25 18:56:37 -0500
commit3dfe2108cfab31ba3ee5527e217d0d8e99a51162 (patch)
treefa6485c169e50d7415a651bf838f5bcd0fd3bfbd /PxShared/src/pvd/include
downloadphysx-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 'PxShared/src/pvd/include')
-rw-r--r--PxShared/src/pvd/include/PsPvd.h85
-rw-r--r--PxShared/src/pvd/include/PxProfileAllocatorWrapper.h231
-rw-r--r--PxShared/src/pvd/include/PxPvdClient.h77
-rw-r--r--PxShared/src/pvd/include/PxPvdDataStream.h272
-rw-r--r--PxShared/src/pvd/include/PxPvdDataStreamHelpers.h120
-rw-r--r--PxShared/src/pvd/include/PxPvdErrorCodes.h62
-rw-r--r--PxShared/src/pvd/include/PxPvdObjectModelBaseTypes.h428
-rw-r--r--PxShared/src/pvd/include/PxPvdRenderBuffer.h140
-rw-r--r--PxShared/src/pvd/include/PxPvdUserRenderer.h107
9 files changed, 1522 insertions, 0 deletions
diff --git a/PxShared/src/pvd/include/PsPvd.h b/PxShared/src/pvd/include/PsPvd.h
new file mode 100644
index 00000000..33f98bbe
--- /dev/null
+++ b/PxShared/src/pvd/include/PsPvd.h
@@ -0,0 +1,85 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and 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.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved.
+// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
+// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
+
+#ifndef PXPVDSDK_PSPVD_H
+#define PXPVDSDK_PSPVD_H
+
+/** \addtogroup pvd
+@{
+*/
+#include "pvd/PxPvd.h"
+#include "PsBroadcast.h"
+
+#if !PX_DOXYGEN
+namespace physx
+{
+#endif
+
+class PxPvdTransport;
+
+#if !PX_DOXYGEN
+namespace pvdsdk
+{
+#endif
+
+class PvdDataStream;
+class PvdClient;
+class PvdOMMetaDataProvider;
+
+// PsPvd is used for advanced user, it support custom pvd client API
+class PsPvd : public physx::PxPvd, public shdfnd::AllocationListener
+{
+ public:
+ virtual void addClient(PvdClient* client) = 0;
+ virtual void removeClient(PvdClient* client) = 0;
+
+ virtual bool registerObject(const void* inItem) = 0;
+ virtual bool unRegisterObject(const void* inItem) = 0;
+
+ //AllocationListener
+ void onAllocation(size_t size, const char* typeName, const char* filename, int line, void* allocatedMemory) = 0;
+ void onDeallocation(void* addr) = 0;
+
+ virtual PvdOMMetaDataProvider& getMetaDataProvider() = 0;
+
+ virtual uint64_t getNextStreamId() = 0;
+ // Call to flush events to PVD
+ virtual void flush() = 0;
+
+};
+
+PX_PVDSDK_API void PX_CALL_CONV SetPvdAllocatorCallback(PxAllocatorCallback* inAllocatorCallback);
+
+#if !PX_DOXYGEN
+} // namespace pvdsdk
+} // namespace physx
+#endif
+
+/** @} */
+#endif // PXPVDSDK_PSPVD_H
diff --git a/PxShared/src/pvd/include/PxProfileAllocatorWrapper.h b/PxShared/src/pvd/include/PxProfileAllocatorWrapper.h
new file mode 100644
index 00000000..3e4237eb
--- /dev/null
+++ b/PxShared/src/pvd/include/PxProfileAllocatorWrapper.h
@@ -0,0 +1,231 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and 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.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved.
+// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
+// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
+
+
+#ifndef PXPVDSDK_PXPROFILEALLOCATORWRAPPER_H
+#define PXPVDSDK_PXPROFILEALLOCATORWRAPPER_H
+
+#include "foundation/PxPreprocessor.h"
+#include "foundation/PxAllocatorCallback.h"
+#include "foundation/PxErrorCallback.h"
+#include "foundation/PxAssert.h"
+
+#include "PsArray.h"
+#include "PsHashMap.h"
+
+namespace physx { namespace profile {
+
+ /**
+ \brief Helper struct to encapsulate the user allocator callback
+ Useful for array and hash templates
+ */
+ struct PxProfileAllocatorWrapper
+ {
+ PxAllocatorCallback* mUserAllocator;
+
+ PxProfileAllocatorWrapper( PxAllocatorCallback& inUserAllocator )
+ : mUserAllocator( &inUserAllocator )
+ {
+ }
+
+ PxProfileAllocatorWrapper( PxAllocatorCallback* inUserAllocator )
+ : mUserAllocator( inUserAllocator )
+ {
+ }
+
+ PxAllocatorCallback& getAllocator() const
+ {
+ PX_ASSERT( NULL != mUserAllocator );
+ return *mUserAllocator;
+ }
+ };
+
+ /**
+ \brief Helper class to encapsulate the reflection allocator
+ */
+ template <typename T>
+ class PxProfileWrapperReflectionAllocator
+ {
+ static const char* getName()
+ {
+#if PX_LINUX || PX_ANDROID || PX_PS4 || PX_IOS || PX_OSX || PX_EMSCRIPTEN
+ return __PRETTY_FUNCTION__;
+#else
+ return typeid(T).name();
+#endif
+ }
+ PxProfileAllocatorWrapper* mWrapper;
+
+ public:
+ PxProfileWrapperReflectionAllocator(PxProfileAllocatorWrapper& inWrapper) : mWrapper( &inWrapper ) {}
+ PxProfileWrapperReflectionAllocator( const PxProfileWrapperReflectionAllocator& inOther )
+ : mWrapper( inOther.mWrapper )
+ {
+ }
+ PxProfileWrapperReflectionAllocator& operator=( const PxProfileWrapperReflectionAllocator& inOther )
+ {
+ mWrapper = inOther.mWrapper;
+ return *this;
+ }
+ PxAllocatorCallback& getAllocator() { return mWrapper->getAllocator(); }
+ void* allocate(size_t size, const char* filename, int line)
+ {
+#if PX_CHECKED // checked and debug builds
+ if(!size)
+ return 0;
+ return getAllocator().allocate(size, getName(), filename, line);
+#else
+ return getAllocator().allocate(size, "<no allocation names in this config>", filename, line);
+#endif
+ }
+ void deallocate(void* ptr)
+ {
+ if(ptr)
+ getAllocator().deallocate(ptr);
+ }
+ };
+
+ /**
+ \brief Helper class to encapsulate the named allocator
+ */
+ struct PxProfileWrapperNamedAllocator
+ {
+ PxProfileAllocatorWrapper* mWrapper;
+ const char* mAllocationName;
+ PxProfileWrapperNamedAllocator(PxProfileAllocatorWrapper& inWrapper, const char* inAllocationName)
+ : mWrapper( &inWrapper )
+ , mAllocationName( inAllocationName )
+ {}
+ PxProfileWrapperNamedAllocator( const PxProfileWrapperNamedAllocator& inOther )
+ : mWrapper( inOther.mWrapper )
+ , mAllocationName( inOther.mAllocationName )
+ {
+ }
+ PxProfileWrapperNamedAllocator& operator=( const PxProfileWrapperNamedAllocator& inOther )
+ {
+ mWrapper = inOther.mWrapper;
+ mAllocationName = inOther.mAllocationName;
+ return *this;
+ }
+ PxAllocatorCallback& getAllocator() { return mWrapper->getAllocator(); }
+ void* allocate(size_t size, const char* filename, int line)
+ {
+ if(!size)
+ return 0;
+ return getAllocator().allocate(size, mAllocationName, filename, line);
+ }
+ void deallocate(void* ptr)
+ {
+ if(ptr)
+ getAllocator().deallocate(ptr);
+ }
+ };
+
+ /**
+ \brief Helper struct to encapsulate the array
+ */
+ template<class T>
+ struct PxProfileArray : public shdfnd::Array<T, PxProfileWrapperReflectionAllocator<T> >
+ {
+ typedef PxProfileWrapperReflectionAllocator<T> TAllocatorType;
+
+ PxProfileArray( PxProfileAllocatorWrapper& inWrapper )
+ : shdfnd::Array<T, TAllocatorType >( TAllocatorType( inWrapper ) )
+ {
+ }
+
+ PxProfileArray( const PxProfileArray< T >& inOther )
+ : shdfnd::Array<T, TAllocatorType >( inOther, inOther )
+ {
+ }
+ };
+
+ /**
+ \brief Helper struct to encapsulate the array
+ */
+ template<typename TKeyType, typename TValueType, typename THashType=shdfnd::Hash<TKeyType> >
+ struct PxProfileHashMap : public shdfnd::HashMap<TKeyType, TValueType, THashType, PxProfileWrapperReflectionAllocator< TValueType > >
+ {
+ typedef shdfnd::HashMap<TKeyType, TValueType, THashType, PxProfileWrapperReflectionAllocator< TValueType > > THashMapType;
+ typedef PxProfileWrapperReflectionAllocator<TValueType> TAllocatorType;
+ PxProfileHashMap( PxProfileAllocatorWrapper& inWrapper )
+ : THashMapType( TAllocatorType( inWrapper ) )
+ {
+ }
+ };
+
+ /**
+ \brief Helper function to encapsulate the profile allocation
+ */
+ template<typename TDataType>
+ inline TDataType* PxProfileAllocate( PxAllocatorCallback* inAllocator, const char* file, int inLine )
+ {
+ PxProfileAllocatorWrapper wrapper( inAllocator );
+ typedef PxProfileWrapperReflectionAllocator< TDataType > TAllocator;
+ TAllocator theAllocator( wrapper );
+ return reinterpret_cast<TDataType*>( theAllocator.allocate( sizeof( TDataType ), file, inLine ) );
+ }
+
+ /**
+ \brief Helper function to encapsulate the profile allocation
+ */
+ template<typename TDataType>
+ inline TDataType* PxProfileAllocate( PxAllocatorCallback& inAllocator, const char* file, int inLine )
+ {
+ return PxProfileAllocate<TDataType>( &inAllocator, file, inLine );
+ }
+
+ /**
+ \brief Helper function to encapsulate the profile deallocation
+ */
+ template<typename TDataType>
+ inline void PxProfileDeleteAndDeallocate( PxProfileAllocatorWrapper& inAllocator, TDataType* inDType )
+ {
+ PX_ASSERT(inDType);
+ PxAllocatorCallback& allocator( inAllocator.getAllocator() );
+ inDType->~TDataType();
+ allocator.deallocate( inDType );
+ }
+
+ /**
+ \brief Helper function to encapsulate the profile deallocation
+ */
+ template<typename TDataType>
+ inline void PxProfileDeleteAndDeallocate( PxAllocatorCallback& inAllocator, TDataType* inDType )
+ {
+ PxProfileAllocatorWrapper wrapper( &inAllocator );
+ PxProfileDeleteAndDeallocate( wrapper, inDType );
+ }
+
+} }
+
+#define PX_PROFILE_NEW( allocator, dtype ) new (physx::profile::PxProfileAllocate<dtype>( allocator, __FILE__, __LINE__ )) dtype
+#define PX_PROFILE_DELETE( allocator, obj ) physx::profile::PxProfileDeleteAndDeallocate( allocator, obj );
+
+#endif // PXPVDSDK_PXPROFILEALLOCATORWRAPPER_H
diff --git a/PxShared/src/pvd/include/PxPvdClient.h b/PxShared/src/pvd/include/PxPvdClient.h
new file mode 100644
index 00000000..8917d495
--- /dev/null
+++ b/PxShared/src/pvd/include/PxPvdClient.h
@@ -0,0 +1,77 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and 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.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved.
+// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
+// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
+
+#ifndef PXPVDSDK_PXPVDCLIENT_H
+#define PXPVDSDK_PXPVDCLIENT_H
+
+/** \addtogroup pvd
+@{
+*/
+#include "foundation/PxFlags.h"
+#include "foundation/PxVec3.h"
+
+#if !PX_DOXYGEN
+namespace physx
+{
+namespace pvdsdk
+{
+#endif
+
+class PvdDataStream;
+class PvdUserRenderer;
+
+/**
+\brief PvdClient is the per-client connection to PVD.
+It provides callback when PVD is connected/disconnted.
+It provides access to the internal object so that advanced users can create extension client.
+*/
+class PvdClient
+{
+ public:
+ virtual PvdDataStream* getDataStream() = 0;
+ virtual PvdUserRenderer* getUserRender() = 0;
+
+ virtual bool isConnected() const = 0;
+ virtual void onPvdConnected() = 0;
+ virtual void onPvdDisconnected() = 0;
+ virtual void flush() = 0;
+
+ protected:
+ virtual ~PvdClient()
+ {
+ }
+};
+
+#if !PX_DOXYGEN
+} // namespace pvdsdk
+} // namespace physx
+#endif
+
+/** @} */
+#endif // PXPVDSDK_PXPVDCLIENT_H
diff --git a/PxShared/src/pvd/include/PxPvdDataStream.h b/PxShared/src/pvd/include/PxPvdDataStream.h
new file mode 100644
index 00000000..870e5973
--- /dev/null
+++ b/PxShared/src/pvd/include/PxPvdDataStream.h
@@ -0,0 +1,272 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and 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.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved.
+#ifndef PXPVDSDK_PXPVDDATASTREAM_H
+#define PXPVDSDK_PXPVDDATASTREAM_H
+
+/** \addtogroup pvd
+@{
+*/
+#include "pvd/PxPvd.h"
+#include "PxPvdErrorCodes.h"
+#include "PxPvdObjectModelBaseTypes.h"
+
+#if !PX_DOXYGEN
+namespace physx
+{
+namespace pvdsdk
+{
+#endif
+
+class PvdPropertyDefinitionHelper;
+
+class PvdMetaDataStream
+{
+ protected:
+ virtual ~PvdMetaDataStream()
+ {
+ }
+
+ public:
+ virtual PvdError createClass(const NamespacedName& nm) = 0;
+ template <typename TDataType>
+ PvdError createClass()
+ {
+ return createClass(getPvdNamespacedNameForType<TDataType>());
+ }
+
+ virtual PvdError deriveClass(const NamespacedName& parent, const NamespacedName& child) = 0;
+ template <typename TParentType, typename TChildType>
+ PvdError deriveClass()
+ {
+ return deriveClass(getPvdNamespacedNameForType<TParentType>(), getPvdNamespacedNameForType<TChildType>());
+ }
+
+ virtual bool isClassExist(const NamespacedName& nm) = 0;
+ template <typename TDataType>
+ bool isClassExist()
+ {
+ return isClassExist(getPvdNamespacedNameForType<TDataType>());
+ }
+
+ virtual PvdError createProperty(const NamespacedName& clsName, const char* name, const char* semantic,
+ const NamespacedName& dtypeName, PropertyType::Enum propertyType,
+ DataRef<NamedValue> values = DataRef<NamedValue>()) = 0;
+ template <typename TClsType, typename TDataType>
+ PvdError createProperty(String name, String semantic = "", PropertyType::Enum propertyType = PropertyType::Scalar,
+ DataRef<NamedValue> values = DataRef<NamedValue>())
+ {
+ return createProperty(getPvdNamespacedNameForType<TClsType>(), name, semantic,
+ getPvdNamespacedNameForType<TDataType>(), propertyType, values);
+ }
+
+ virtual PvdError createPropertyMessage(const NamespacedName& cls, const NamespacedName& msgName,
+ DataRef<PropertyMessageArg> entries, uint32_t messageSizeInBytes) = 0;
+
+ template <typename TClsType, typename TMsgType>
+ PvdError createPropertyMessage(DataRef<PropertyMessageArg> entries)
+ {
+ return createPropertyMessage(getPvdNamespacedNameForType<TClsType>(), getPvdNamespacedNameForType<TMsgType>(),
+ entries, sizeof(TMsgType));
+ }
+};
+
+class PvdInstanceDataStream
+{
+ protected:
+ virtual ~PvdInstanceDataStream()
+ {
+ }
+
+ public:
+ virtual PvdError createInstance(const NamespacedName& cls, const void* instance) = 0;
+
+ template <typename TDataType>
+ PvdError createInstance(const TDataType* inst)
+ {
+ return createInstance(getPvdNamespacedNameForType<TDataType>(), inst);
+ }
+ virtual bool isInstanceValid(const void* instance) = 0;
+
+ // If the property will fit or is already completely in memory
+ virtual PvdError setPropertyValue(const void* instance, String name, DataRef<const uint8_t> data,
+ const NamespacedName& incomingTypeName) = 0;
+ template <typename TDataType>
+ PvdError setPropertyValue(const void* instance, String name, const TDataType& value)
+ {
+ const uint8_t* dataStart = reinterpret_cast<const uint8_t*>(&value);
+ return setPropertyValue(instance, name, DataRef<const uint8_t>(dataStart, dataStart + sizeof(TDataType)),
+ getPvdNamespacedNameForType<TDataType>());
+ }
+
+ template <typename TDataType>
+ PvdError setPropertyValue(const void* instance, String name, const TDataType* value, uint32_t numItems)
+ {
+ const uint8_t* dataStart = reinterpret_cast<const uint8_t*>(value);
+ return setPropertyValue(instance, name,
+ DataRef<const uint8_t>(dataStart, dataStart + sizeof(TDataType) * numItems),
+ getPvdNamespacedNameForType<TDataType>());
+ }
+
+ // Else if the property is very large (contact reports) you can send it in chunks.
+ virtual PvdError beginSetPropertyValue(const void* instance, String name, const NamespacedName& incomingTypeName) = 0;
+
+ template <typename TDataType>
+ PvdError beginSetPropertyValue(const void* instance, String name)
+ {
+ return beginSetPropertyValue(instance, name, getPvdNamespacedNameForType<TDataType>());
+ }
+ virtual PvdError appendPropertyValueData(DataRef<const uint8_t> data) = 0;
+
+ template <typename TDataType>
+ PvdError appendPropertyValueData(const TDataType* value, uint32_t numItems)
+ {
+ const uint8_t* dataStart = reinterpret_cast<const uint8_t*>(value);
+ return appendPropertyValueData(DataRef<const uint8_t>(dataStart, dataStart + numItems * sizeof(TDataType)));
+ }
+
+ virtual PvdError endSetPropertyValue() = 0;
+
+ // Set a set of properties to various values on an object.
+
+ virtual PvdError setPropertyMessage(const void* instance, const NamespacedName& msgName,
+ DataRef<const uint8_t> data) = 0;
+
+ template <typename TDataType>
+ PvdError setPropertyMessage(const void* instance, const TDataType& value)
+ {
+ const uint8_t* dataStart = reinterpret_cast<const uint8_t*>(&value);
+ return setPropertyMessage(instance, getPvdNamespacedNameForType<TDataType>(),
+ DataRef<const uint8_t>(dataStart, sizeof(TDataType)));
+ }
+ // If you need to send of lot of identical messages, this avoids a hashtable lookup per message.
+ virtual PvdError beginPropertyMessageGroup(const NamespacedName& msgName) = 0;
+
+ template <typename TDataType>
+ PvdError beginPropertyMessageGroup()
+ {
+ return beginPropertyMessageGroup(getPvdNamespacedNameForType<TDataType>());
+ }
+ virtual PvdError sendPropertyMessageFromGroup(const void* instance, DataRef<const uint8_t> data) = 0;
+
+ template <typename TDataType>
+ PvdError sendPropertyMessageFromGroup(const void* instance, const TDataType& value)
+ {
+ const uint8_t* dataStart = reinterpret_cast<const uint8_t*>(&value);
+ return sendPropertyMessageFromGroup(instance, DataRef<const uint8_t>(dataStart, sizeof(TDataType)));
+ }
+
+ virtual PvdError endPropertyMessageGroup() = 0;
+
+ // These functions ensure the target array doesn't contain duplicates
+ virtual PvdError pushBackObjectRef(const void* instId, String propName, const void* objRef) = 0;
+ virtual PvdError removeObjectRef(const void* instId, String propName, const void* objRef) = 0;
+
+ // Instance elimination.
+ virtual PvdError destroyInstance(const void* key) = 0;
+
+ // Profiling hooks
+ virtual PvdError beginSection(const void* instance, String name) = 0;
+ virtual PvdError endSection(const void* instance, String name) = 0;
+
+ // Origin Shift
+ virtual PvdError originShift(const void* scene, PxVec3 shift) = 0;
+
+ public:
+ /*For some cases, pvd command cannot be run immediately. For example, when create joints, while the actors may still
+ *pending for insert, the joints update commands can be run deffered.
+ */
+ class PvdCommand
+ {
+ public:
+ // Assigned is needed for copying
+ PvdCommand(const PvdCommand&)
+ {
+ }
+ PvdCommand& operator=(const PvdCommand&)
+ {
+ return *this;
+ }
+
+ public:
+ PvdCommand()
+ {
+ }
+ virtual ~PvdCommand()
+ {
+ }
+
+ // Not pure virtual so can have default PvdCommand obj
+ virtual bool canRun(PvdInstanceDataStream&)
+ {
+ return false;
+ }
+ virtual void run(PvdInstanceDataStream&)
+ {
+ }
+ };
+
+ // PVD SDK provide this helper function to allocate cmd's memory and release them at after flush the command queue
+ virtual void* allocateMemForCmd(uint32_t length) = 0;
+
+ // PVD will call the destructor of PvdCommand object at the end fo flushPvdCommand
+ virtual void pushPvdCommand(PvdCommand& cmd) = 0;
+ virtual void flushPvdCommand() = 0;
+};
+
+class PvdDataStream : public PvdInstanceDataStream, public PvdMetaDataStream
+{
+ protected:
+ virtual ~PvdDataStream()
+ {
+ }
+
+ public:
+ virtual void release() = 0;
+ virtual bool isConnected() = 0;
+
+ virtual void addProfileZone(void* zone, const char* name) = 0;
+ virtual void addProfileZoneEvent(void* zone, const char* name, uint16_t eventId, bool compileTimeEnabled) = 0;
+
+ virtual PvdPropertyDefinitionHelper& getPropertyDefinitionHelper() = 0;
+
+ virtual void setIsTopLevelUIElement(const void* instance, bool topLevel) = 0;
+ virtual void sendErrorMessage(uint32_t code, const char* message, const char* file, uint32_t line) = 0;
+ virtual void updateCamera(const char* name, const PxVec3& origin, const PxVec3& up, const PxVec3& target) = 0;
+
+/**
+ \brief Create a new PvdDataStream.
+ \param pvd A pointer to a valid PxPvd instance. This must be non-null.
+*/
+ PX_PVDSDK_API static PvdDataStream* create(PxPvd* pvd);
+};
+#if !PX_DOXYGEN
+} // pvdsdk
+} // physx
+#endif
+
+/** @} */
+#endif // PXPVDSDK_PXPVDDATASTREAM_H
diff --git a/PxShared/src/pvd/include/PxPvdDataStreamHelpers.h b/PxShared/src/pvd/include/PxPvdDataStreamHelpers.h
new file mode 100644
index 00000000..7517a2a0
--- /dev/null
+++ b/PxShared/src/pvd/include/PxPvdDataStreamHelpers.h
@@ -0,0 +1,120 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and 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.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved.
+#ifndef PXPVDSDK_PXPVDDATASTREAMHELPERS_H
+#define PXPVDSDK_PXPVDDATASTREAMHELPERS_H
+
+/** \addtogroup pvd
+@{
+*/
+#include "PxPvdObjectModelBaseTypes.h"
+
+#if !PX_DOXYGEN
+namespace physx
+{
+namespace pvdsdk
+{
+#endif
+
+class PvdPropertyDefinitionHelper
+{
+ protected:
+ virtual ~PvdPropertyDefinitionHelper()
+ {
+ }
+
+ public:
+ /**
+ Push a name c such that it appends such as a.b.c.
+ */
+ virtual void pushName(const char* inName, const char* inAppendStr = ".") = 0;
+ /**
+ Push a name c such that it appends like a.b[c]
+ */
+ virtual void pushBracketedName(const char* inName, const char* leftBracket = "[", const char* rightBracket = "]") = 0;
+ /**
+ * Pop the current name
+ */
+ virtual void popName() = 0;
+
+ virtual void clearNameStack() = 0;
+ /**
+ * Get the current name at the top of the name stack.
+ * Would return "a.b.c" or "a.b[c]" in the above examples.
+ */
+ virtual const char* getTopName() = 0;
+
+ virtual void addNamedValue(const char* name, uint32_t value) = 0;
+ virtual void clearNamedValues() = 0;
+ virtual DataRef<NamedValue> getNamedValues() = 0;
+
+ /**
+ * Define a property using the top of the name stack and the passed-in semantic
+ */
+ virtual void createProperty(const NamespacedName& clsName, const char* inSemantic, const NamespacedName& dtypeName,
+ PropertyType::Enum propType = PropertyType::Scalar) = 0;
+
+ template <typename TClsType, typename TDataType>
+ void createProperty(const char* inSemantic = "", PropertyType::Enum propType = PropertyType::Scalar)
+ {
+ createProperty(getPvdNamespacedNameForType<TClsType>(), inSemantic, getPvdNamespacedNameForType<TDataType>(),
+ propType);
+ }
+
+ // The datatype used for instances needs to be pointer unless you actually have pvdsdk::InstanceId members on your
+ // value structs.
+ virtual void addPropertyMessageArg(const NamespacedName& inDatatype, uint32_t inOffset, uint32_t inSize) = 0;
+
+ template <typename TDataType>
+ void addPropertyMessageArg(uint32_t offset)
+ {
+ addPropertyMessageArg(getPvdNamespacedNameForType<TDataType>(), offset, static_cast<uint32_t>(sizeof(TDataType)));
+ }
+ virtual void addPropertyMessage(const NamespacedName& clsName, const NamespacedName& msgName,
+ uint32_t inStructSizeInBytes) = 0;
+ template <typename TClsType, typename TMsgType>
+ void addPropertyMessage()
+ {
+ addPropertyMessage(getPvdNamespacedNameForType<TClsType>(), getPvdNamespacedNameForType<TMsgType>(),
+ static_cast<uint32_t>(sizeof(TMsgType)));
+ }
+ virtual void clearPropertyMessageArgs() = 0;
+
+ void clearBufferedData()
+ {
+ clearNameStack();
+ clearPropertyMessageArgs();
+ clearNamedValues();
+ }
+};
+
+#if !PX_DOXYGEN
+} // pvdsdk
+} // physx
+#endif
+
+/** @} */
+#endif // PXPVDSDK_PXPVDDATASTREAMHELPERS_H
diff --git a/PxShared/src/pvd/include/PxPvdErrorCodes.h b/PxShared/src/pvd/include/PxPvdErrorCodes.h
new file mode 100644
index 00000000..bf5536fb
--- /dev/null
+++ b/PxShared/src/pvd/include/PxPvdErrorCodes.h
@@ -0,0 +1,62 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and 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.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved.
+#ifndef PXPVDSDK_PXPVDERRORCODES_H
+#define PXPVDSDK_PXPVDERRORCODES_H
+
+/** \addtogroup pvd
+@{
+*/
+
+#include "foundation/Px.h"
+
+#if !PX_DOXYGEN
+namespace physx
+{
+namespace pvdsdk
+{
+#endif
+
+struct PvdErrorType
+{
+ enum Enum
+ {
+ Success = 0,
+ NetworkError,
+ ArgumentError,
+ Disconnect,
+ InternalProblem
+ };
+};
+
+typedef PvdErrorType::Enum PvdError;
+
+#if !PX_DOXYGEN
+}
+}
+#endif
+/** @} */
+#endif // PXPVDSDK_PXPVDERRORCODES_H
diff --git a/PxShared/src/pvd/include/PxPvdObjectModelBaseTypes.h b/PxShared/src/pvd/include/PxPvdObjectModelBaseTypes.h
new file mode 100644
index 00000000..8fa0d376
--- /dev/null
+++ b/PxShared/src/pvd/include/PxPvdObjectModelBaseTypes.h
@@ -0,0 +1,428 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and 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.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved.
+
+#ifndef PXPVDSDK_PXPVDOBJECTMODELBASETYPES_H
+#define PXPVDSDK_PXPVDOBJECTMODELBASETYPES_H
+
+/** \addtogroup pvd
+@{
+*/
+#include "foundation/PxAssert.h"
+
+#if !PX_DOXYGEN
+namespace physx
+{
+namespace pvdsdk
+{
+#endif
+
+using namespace physx;
+
+inline const char* nonNull(const char* str)
+{
+ return str ? str : "";
+}
+// strcmp will crash if passed a null string, however,
+// so we need to make sure that doesn't happen. We do that
+// by equating NULL and the empty string, "".
+inline bool safeStrEq(const char* lhs, const char* rhs)
+{
+ return ::strcmp(nonNull(lhs), nonNull(rhs)) == 0;
+}
+
+// Does this string have useful information in it.
+inline bool isMeaningful(const char* str)
+{
+ return *(nonNull(str)) > 0;
+}
+
+inline uint32_t safeStrLen(const char* str)
+{
+ str = nonNull(str);
+ return static_cast<uint32_t>(strlen(str));
+}
+
+struct ObjectRef
+{
+ int32_t mInstanceId;
+
+ ObjectRef(int32_t iid = -1) : mInstanceId(iid)
+ {
+ }
+ operator int32_t() const
+ {
+ return mInstanceId;
+ }
+ bool hasValue() const
+ {
+ return mInstanceId > 0;
+ }
+};
+
+struct U32Array4
+{
+ uint32_t mD0;
+ uint32_t mD1;
+ uint32_t mD2;
+ uint32_t mD3;
+ U32Array4(uint32_t d0, uint32_t d1, uint32_t d2, uint32_t d3) : mD0(d0), mD1(d1), mD2(d2), mD3(d3)
+ {
+ }
+ U32Array4() : mD0(0), mD1(0), mD2(0), mD3(0)
+ {
+ }
+};
+
+typedef bool PvdBool;
+typedef const char* String;
+typedef void* VoidPtr;
+typedef double PvdF64;
+typedef float PvdF32;
+typedef int64_t PvdI64;
+typedef uint64_t PvdU64;
+typedef int32_t PvdI32;
+typedef uint32_t PvdU32;
+typedef int16_t PvdI16;
+typedef uint16_t PvdU16;
+typedef int8_t PvdI8;
+typedef uint8_t PvdU8;
+
+struct PvdColor
+{
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+ uint8_t a;
+ PvdColor(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a = 255) : r(_r), g(_g), b(_b), a(_a)
+ {
+ }
+ PvdColor() : r(0), g(0), b(0), a(255)
+ {
+ }
+ PvdColor(uint32_t abgr)
+ {
+ uint8_t* valPtr = reinterpret_cast<uint8_t*>(&abgr);
+ r = valPtr[0];
+ g = valPtr[1];
+ b = valPtr[2];
+ a = valPtr[3];
+ }
+};
+
+struct StringHandle
+{
+ uint32_t mHandle;
+ StringHandle(uint32_t val = 0) : mHandle(val)
+ {
+ }
+ operator uint32_t() const
+ {
+ return mHandle;
+ }
+};
+
+#define DECLARE_TYPES \
+DECLARE_BASE_PVD_TYPE(PvdI8) \
+DECLARE_BASE_PVD_TYPE(PvdU8) \
+DECLARE_BASE_PVD_TYPE(PvdI16) \
+DECLARE_BASE_PVD_TYPE(PvdU16) \
+DECLARE_BASE_PVD_TYPE(PvdI32) \
+DECLARE_BASE_PVD_TYPE(PvdU32) \
+DECLARE_BASE_PVD_TYPE(PvdI64) \
+DECLARE_BASE_PVD_TYPE(PvdU64) \
+DECLARE_BASE_PVD_TYPE(PvdF32) \
+DECLARE_BASE_PVD_TYPE(PvdF64) \
+DECLARE_BASE_PVD_TYPE(PvdBool) \
+DECLARE_BASE_PVD_TYPE(PvdColor) \
+DECLARE_BASE_PVD_TYPE(String) \
+DECLARE_BASE_PVD_TYPE(StringHandle) \
+DECLARE_BASE_PVD_TYPE(ObjectRef) \
+DECLARE_BASE_PVD_TYPE(VoidPtr) \
+DECLARE_BASE_PVD_TYPE(PxVec2) \
+DECLARE_BASE_PVD_TYPE(PxVec3) \
+DECLARE_BASE_PVD_TYPE(PxVec4) \
+DECLARE_BASE_PVD_TYPE(PxBounds3) \
+DECLARE_BASE_PVD_TYPE(PxQuat) \
+DECLARE_BASE_PVD_TYPE(PxTransform) \
+DECLARE_BASE_PVD_TYPE(PxMat33) \
+DECLARE_BASE_PVD_TYPE(PxMat44) \
+DECLARE_BASE_PVD_TYPE(U32Array4)
+
+struct PvdBaseType
+{
+ enum Enum
+ {
+ None = 0,
+ InternalStart = 1,
+ InternalStop = 64,
+#define DECLARE_BASE_PVD_TYPE(type) type,
+ DECLARE_TYPES
+ Last
+#undef DECLARE_BASE_PVD_TYPE
+ };
+};
+struct NamespacedName
+{
+ String mNamespace;
+ String mName;
+ NamespacedName(String ns, String nm) : mNamespace(ns), mName(nm)
+ {
+ }
+ NamespacedName(String nm = "") : mNamespace(""), mName(nm)
+ {
+ }
+ bool operator==(const NamespacedName& other) const
+ {
+ return safeStrEq(mNamespace, other.mNamespace) && safeStrEq(mName, other.mName);
+ }
+};
+
+struct NamedValue
+{
+ String mName;
+ uint32_t mValue;
+ NamedValue(String nm = "", uint32_t val = 0) : mName(nm), mValue(val)
+ {
+ }
+};
+
+template <typename T>
+struct BaseDataTypeToTypeMap
+{
+ bool compile_error;
+};
+template <PvdBaseType::Enum>
+struct BaseTypeToDataTypeMap
+{
+ bool compile_error;
+};
+
+// Users can extend this mapping with new datatypes.
+template <typename T>
+struct PvdDataTypeToNamespacedNameMap
+{
+ bool Name;
+};
+// This mapping tells you the what class id to use for the base datatypes
+//
+#define DECLARE_BASE_PVD_TYPE(type) \
+ template <> \
+ struct BaseDataTypeToTypeMap<type> \
+ { \
+ enum Enum \
+ { \
+ BaseTypeEnum = PvdBaseType::type \
+ }; \
+ }; \
+ template <> \
+ struct BaseDataTypeToTypeMap<const type&> \
+ { \
+ enum Enum \
+ { \
+ BaseTypeEnum = PvdBaseType::type \
+ }; \
+ }; \
+ template <> \
+ struct BaseTypeToDataTypeMap<PvdBaseType::type> \
+ { \
+ typedef type TDataType; \
+ }; \
+ template <> \
+ struct PvdDataTypeToNamespacedNameMap<type> \
+ { \
+ NamespacedName Name; \
+ PvdDataTypeToNamespacedNameMap<type>() : Name("physx3", #type) \
+ { \
+ } \
+ }; \
+ template <> \
+ struct PvdDataTypeToNamespacedNameMap<const type&> \
+ { \
+ NamespacedName Name; \
+ PvdDataTypeToNamespacedNameMap<const type&>() : Name("physx3", #type) \
+ { \
+ } \
+ };
+
+DECLARE_TYPES
+#undef DECLARE_BASE_PVD_TYPE
+
+template <typename TDataType>
+inline int32_t getPvdTypeForType()
+{
+ return static_cast<PvdBaseType::Enum>(BaseDataTypeToTypeMap<TDataType>::BaseTypeEnum);
+}
+template <typename TDataType>
+inline NamespacedName getPvdNamespacedNameForType()
+{
+ return PvdDataTypeToNamespacedNameMap<TDataType>().Name;
+}
+
+#define DEFINE_PVD_TYPE_NAME_MAP(type, ns, name) \
+ template <> \
+ struct PvdDataTypeToNamespacedNameMap<type> \
+ { \
+ NamespacedName Name; \
+ PvdDataTypeToNamespacedNameMap<type>() : Name(ns, name) \
+ { \
+ } \
+ };
+
+#define DEFINE_PVD_TYPE_ALIAS(newType, oldType) \
+ template <> \
+ struct PvdDataTypeToNamespacedNameMap<newType> \
+ { \
+ NamespacedName Name; \
+ PvdDataTypeToNamespacedNameMap<newType>() : Name(PvdDataTypeToNamespacedNameMap<oldType>().Name) \
+ { \
+ } \
+ };
+
+DEFINE_PVD_TYPE_ALIAS(const void*, void*)
+
+struct ArrayData
+{
+ uint8_t* mBegin;
+ uint8_t* mEnd;
+ uint8_t* mCapacity; //>= stop
+ ArrayData(uint8_t* beg = NULL, uint8_t* end = NULL, uint8_t* cap = NULL) : mBegin(beg), mEnd(end), mCapacity(cap)
+ {
+ }
+ uint8_t* begin()
+ {
+ return mBegin;
+ }
+ uint8_t* end()
+ {
+ return mEnd;
+ }
+ uint32_t byteCapacity()
+ {
+ return static_cast<uint32_t>(mCapacity - mBegin);
+ }
+ uint32_t byteSize() const
+ {
+ return static_cast<uint32_t>(mEnd - mBegin);
+ } // in bytes
+ uint32_t numberOfItems(uint32_t objectByteSize)
+ {
+ if(objectByteSize)
+ return byteSize() / objectByteSize;
+ return 0;
+ }
+
+ void forgetData()
+ {
+ mBegin = mEnd = mCapacity = 0;
+ }
+};
+
+template <typename T>
+class DataRef
+{
+ const T* mBegin;
+ const T* mEnd;
+
+ public:
+ DataRef(const T* b, uint32_t count) : mBegin(b), mEnd(b + count)
+ {
+ }
+ DataRef(const T* b = NULL, const T* e = NULL) : mBegin(b), mEnd(e)
+ {
+ }
+ DataRef(const DataRef& o) : mBegin(o.mBegin), mEnd(o.mEnd)
+ {
+ }
+ DataRef& operator=(const DataRef& o)
+ {
+ mBegin = o.mBegin;
+ mEnd = o.mEnd;
+ return *this;
+ }
+ uint32_t size() const
+ {
+ return static_cast<uint32_t>(mEnd - mBegin);
+ }
+ const T* begin() const
+ {
+ return mBegin;
+ }
+ const T* end() const
+ {
+ return mEnd;
+ }
+ const T& operator[](uint32_t idx) const
+ {
+ PX_ASSERT(idx < size());
+ return mBegin[idx];
+ }
+ const T& back() const
+ {
+ PX_ASSERT(mEnd > mBegin);
+ return *(mEnd - 1);
+ }
+};
+
+struct PropertyType
+{
+ enum Enum
+ {
+ Unknown = 0,
+ Scalar,
+ Array
+ };
+};
+
+// argument to the create property message function
+struct PropertyMessageArg
+{
+ String mPropertyName;
+ NamespacedName mDatatypeName;
+ // where in the message this property starts.
+ uint32_t mMessageOffset;
+ // size of this entry object
+ uint32_t mByteSize;
+
+ PropertyMessageArg(String propName, NamespacedName dtype, uint32_t msgOffset, uint32_t byteSize)
+ : mPropertyName(propName), mDatatypeName(dtype), mMessageOffset(msgOffset), mByteSize(byteSize)
+ {
+ }
+ PropertyMessageArg() : mPropertyName(""), mMessageOffset(0), mByteSize(0)
+ {
+ }
+};
+
+class PvdUserRenderer;
+DEFINE_PVD_TYPE_NAME_MAP(PvdUserRenderer, "_debugger_", "PvdUserRenderer")
+
+#if !PX_DOXYGEN
+}
+}
+#endif
+
+/** @} */
+#endif // PXPVDSDK_PXPVDOBJECTMODELBASETYPES_H
diff --git a/PxShared/src/pvd/include/PxPvdRenderBuffer.h b/PxShared/src/pvd/include/PxPvdRenderBuffer.h
new file mode 100644
index 00000000..47b020b4
--- /dev/null
+++ b/PxShared/src/pvd/include/PxPvdRenderBuffer.h
@@ -0,0 +1,140 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and 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.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved.
+// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
+// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
+
+#ifndef PXPVDSDK_PXPVDRENDERBUFFER_H
+#define PXPVDSDK_PXPVDRENDERBUFFER_H
+
+/** \addtogroup pvd
+@{
+*/
+
+#include "foundation/PxVec3.h"
+
+#if !PX_DOXYGEN
+namespace physx
+{
+namespace pvdsdk
+{
+#endif
+
+/**
+\brief Default color values used for debug rendering.
+*/
+struct PvdDebugColor
+{
+ enum Enum
+ {
+ eARGB_BLACK = 0xff000000,
+ eARGB_RED = 0xffff0000,
+ eARGB_GREEN = 0xff00ff00,
+ eARGB_BLUE = 0xff0000ff,
+ eARGB_YELLOW = 0xffffff00,
+ eARGB_MAGENTA = 0xffff00ff,
+ eARGB_CYAN = 0xff00ffff,
+ eARGB_WHITE = 0xffffffff,
+ eARGB_GREY = 0xff808080,
+ eARGB_DARKRED = 0x88880000,
+ eARGB_DARKGREEN = 0x88008800,
+ eARGB_DARKBLUE = 0x88000088
+ };
+};
+
+/**
+\brief Used to store a single point and colour for debug rendering.
+*/
+struct PvdDebugPoint
+{
+ PvdDebugPoint(const PxVec3& p, const uint32_t& c) : pos(p), color(c)
+ {
+ }
+
+ PxVec3 pos;
+ uint32_t color;
+};
+
+/**
+\brief Used to store a single line and colour for debug rendering.
+*/
+struct PvdDebugLine
+{
+ PvdDebugLine(const PxVec3& p0, const PxVec3& p1, const uint32_t& c) : pos0(p0), color0(c), pos1(p1), color1(c)
+ {
+ }
+
+ PxVec3 pos0;
+ uint32_t color0;
+ PxVec3 pos1;
+ uint32_t color1;
+};
+
+/**
+\brief Used to store a single triangle and colour for debug rendering.
+*/
+struct PvdDebugTriangle
+{
+ PvdDebugTriangle(const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, const uint32_t& c)
+ : pos0(p0), color0(c), pos1(p1), color1(c), pos2(p2), color2(c)
+ {
+ }
+
+ PxVec3 pos0;
+ uint32_t color0;
+ PxVec3 pos1;
+ uint32_t color1;
+ PxVec3 pos2;
+ uint32_t color2;
+};
+
+/**
+\brief Used to store a text for debug rendering. Doesn't own 'string' array.
+*/
+struct PvdDebugText
+{
+ PvdDebugText() : string(0)
+ {
+ }
+
+ PvdDebugText(const PxVec3& p, const float& s, const uint32_t& c, const char* str)
+ : position(p), size(s), color(c), string(str)
+ {
+ }
+
+ PxVec3 position;
+ float size;
+ uint32_t color;
+ const char* string;
+};
+
+#if !PX_DOXYGEN
+}
+} // namespace physx
+#endif
+
+/** @} */
+#endif // PXPVDSDK_PXPVDRENDERBUFFER_H
diff --git a/PxShared/src/pvd/include/PxPvdUserRenderer.h b/PxShared/src/pvd/include/PxPvdUserRenderer.h
new file mode 100644
index 00000000..e2a3c608
--- /dev/null
+++ b/PxShared/src/pvd/include/PxPvdUserRenderer.h
@@ -0,0 +1,107 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and 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.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved.
+#ifndef PXPVDSDK_PXPVDUSERRENDERER_H
+#define PXPVDSDK_PXPVDUSERRENDERER_H
+
+/** \addtogroup pvd
+@{
+*/
+#include "foundation/PxVec3.h"
+#include "foundation/PxTransform.h"
+#include "pvd/PxPvd.h"
+
+#include "PxPvdDataStream.h"
+#include "PxPvdRenderBuffer.h"
+#include "PsUserAllocated.h"
+
+#if !PX_DOXYGEN
+namespace physx
+{
+#endif
+
+class PxPvd;
+
+#if !PX_DOXYGEN
+namespace pvdsdk
+{
+#endif
+
+class RendererEventClient;
+
+class PvdUserRenderer : public shdfnd::UserAllocated
+{
+ protected:
+ virtual ~PvdUserRenderer()
+ {
+ }
+
+ public:
+ virtual void release() = 0;
+ virtual void setClient(RendererEventClient* client) = 0;
+
+ // Instance to associate the further rendering with.
+ virtual void setInstanceId(const void* instanceId) = 0;
+ // Draw these points associated with this instance
+ virtual void drawPoints(const PvdDebugPoint* points, uint32_t count) = 0;
+ // Draw these lines associated with this instance
+ virtual void drawLines(const PvdDebugLine* lines, uint32_t count) = 0;
+ // Draw these triangles associated with this instance
+ virtual void drawTriangles(const PvdDebugTriangle* triangles, uint32_t count) = 0;
+ // Draw this text associated with this instance
+ virtual void drawText(const PvdDebugText& text) = 0;
+
+ // Draw SDK debug render
+ virtual void drawRenderbuffer(const PvdDebugPoint* pointData, uint32_t pointCount, const PvdDebugLine* lineData,
+ uint32_t lineCount, const PvdDebugTriangle* triangleData, uint32_t triangleCount) = 0;
+
+ // Constraint visualization routines
+ virtual void visualizeJointFrames(const PxTransform& parent, const PxTransform& child) = 0;
+ virtual void visualizeLinearLimit(const PxTransform& t0, const PxTransform& t1, float value, bool active) = 0;
+ virtual void visualizeAngularLimit(const PxTransform& t0, float lower, float upper, bool active) = 0;
+ virtual void visualizeLimitCone(const PxTransform& t, float ySwing, float zSwing, bool active) = 0;
+ virtual void visualizeDoubleCone(const PxTransform& t, float angle, bool active) = 0;
+
+ // Clear the immedate buffer.
+ virtual void flushRenderEvents() = 0;
+
+ PX_PVDSDK_API static PvdUserRenderer* create(uint32_t bufferSize = 0x2000);
+};
+
+class RendererEventClient
+{
+ public:
+ virtual ~RendererEventClient(){}
+
+ virtual void handleBufferFlush(const uint8_t* inData, uint32_t inLength) = 0;
+};
+
+#if !PX_DOXYGEN
+}
+}
+#endif
+/** @} */
+#endif // PXPVDSDK_PXPVDUSERRENDERER_H