aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Source/Common/src/CmRenderOutput.h
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 /PhysX_3.4/Source/Common/src/CmRenderOutput.h
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 'PhysX_3.4/Source/Common/src/CmRenderOutput.h')
-rw-r--r--PhysX_3.4/Source/Common/src/CmRenderOutput.h191
1 files changed, 191 insertions, 0 deletions
diff --git a/PhysX_3.4/Source/Common/src/CmRenderOutput.h b/PhysX_3.4/Source/Common/src/CmRenderOutput.h
new file mode 100644
index 00000000..a121cb27
--- /dev/null
+++ b/PhysX_3.4/Source/Common/src/CmRenderOutput.h
@@ -0,0 +1,191 @@
+// 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 PX_FOUNDATION_PSRENDEROUTPUT_H
+#define PX_FOUNDATION_PSRENDEROUTPUT_H
+
+#include "foundation/PxMat44.h"
+#include "CmRenderBuffer.h"
+
+namespace physx
+{
+namespace Cm
+{
+ struct DebugText;
+
+#if PX_VC
+ #pragma warning(push)
+ #pragma warning( disable : 4251 ) // class needs to have dll-interface to be used by clients of class
+#endif
+ /**
+ Output stream to fill RenderBuffer
+ */
+ class PX_PHYSX_COMMON_API RenderOutput
+ {
+ public:
+
+ enum Primitive {
+ POINTS,
+ LINES,
+ LINESTRIP,
+ TRIANGLES,
+ TRIANGLESTRIP,
+ TEXT
+ };
+
+ RenderOutput(RenderBuffer& buffer)
+ : mPrim(POINTS), mColor(0), mVertex0(0.0f), mVertex1(0.0f)
+ , mVertexCount(0), mTransform(PxMat44(PxIdentity)), mBuffer(buffer)
+ {}
+
+ RenderOutput& operator<<(Primitive prim);
+ RenderOutput& operator<<(PxU32 color); // 0xbbggrr
+ RenderOutput& operator<<(const PxMat44& transform);
+ RenderOutput& operator<<(const PxTransform&);
+
+ RenderOutput& operator<<(PxVec3 vertex);
+ RenderOutput& operator<<(const DebugText& text);
+
+ PX_FORCE_INLINE PxDebugLine* reserveSegments(PxU32 nbSegments)
+ {
+ const PxU32 currentSize = mBuffer.mLines.size();
+ mBuffer.mLines.resizeUninitialized(currentSize + nbSegments);
+ return mBuffer.mLines.begin() + currentSize;
+ }
+
+ // PT: using the operators is just too slow.
+ PX_FORCE_INLINE void outputSegment(const PxVec3& v0, const PxVec3& v1)
+ {
+ // PT: TODO: replace pushBack with something faster like the versions below
+ mBuffer.mLines.pushBack(PxDebugLine(v0, v1, mColor));
+
+ // PT: TODO: use the "pushBackUnsafe" version or replace with ICE containers
+/* PxDebugLine& l = mBuffer.mLines.insert();
+ l.pos0 = v0;
+ l.pos1 = v1;
+ l.color0 = l.color1 = mColor;
+
+ PxDebugLine& l = mBuffer.mLines.pushBackUnsafe();
+ l.pos0 = v0;
+ l.pos1 = v1;
+ l.color0 = l.color1 = mColor;*/
+ }
+
+ RenderOutput& outputCapsule(PxF32 radius, PxF32 halfHeight, const PxMat44& absPose);
+
+ private:
+
+ RenderOutput& operator=(const RenderOutput&);
+
+ Primitive mPrim;
+ PxU32 mColor;
+ PxVec3 mVertex0, mVertex1;
+ PxU32 mVertexCount;
+ PxMat44 mTransform;
+ RenderBuffer& mBuffer;
+ };
+
+ /** debug render helper types */
+ struct PX_PHYSX_COMMON_API DebugText
+ {
+ DebugText(const PxVec3& position, PxReal size, const char* string, ...);
+ static const int sBufferSize = 1008; // sizeof(DebugText)==1kB
+ char buffer[sBufferSize];
+ PxVec3 position;
+ PxReal size;
+ };
+
+ struct DebugBox
+ {
+ explicit DebugBox(const PxVec3& extents, bool wireframe_ = true)
+ : minimum(-extents), maximum(extents), wireframe(wireframe_) {}
+
+ explicit DebugBox(const PxVec3& pos, const PxVec3& extents, bool wireframe_ = true)
+ : minimum(pos-extents), maximum(pos+extents), wireframe(wireframe_) {}
+
+ explicit DebugBox(const PxBounds3& bounds, bool wireframe_ = true)
+ : minimum(bounds.minimum), maximum(bounds.maximum), wireframe(wireframe_) {}
+
+ PxVec3 minimum, maximum;
+ bool wireframe;
+ };
+ PX_PHYSX_COMMON_API RenderOutput& operator<<(RenderOutput& out, const DebugBox& box);
+
+ struct DebugArrow
+ {
+ DebugArrow(const PxVec3& pos, const PxVec3& vec)
+ : base(pos), tip(pos+vec), headLength(vec.magnitude()*0.15f) {}
+
+ DebugArrow(const PxVec3& pos, const PxVec3& vec, PxReal headLength_)
+ : base(pos), tip(pos+vec), headLength(headLength_) {}
+
+ PxVec3 base, tip;
+ PxReal headLength;
+ };
+ PX_PHYSX_COMMON_API RenderOutput& operator<<(RenderOutput& out, const DebugArrow& arrow);
+
+ struct DebugBasis
+ {
+ DebugBasis(const PxVec3& ext, PxU32 cX = PxDebugColor::eARGB_RED,
+ PxU32 cY = PxDebugColor::eARGB_GREEN, PxU32 cZ = PxDebugColor::eARGB_BLUE)
+ : extends(ext), colorX(cX), colorY(cY), colorZ(cZ) {}
+ PxVec3 extends;
+ PxU32 colorX, colorY, colorZ;
+ };
+ PX_PHYSX_COMMON_API RenderOutput& operator<<(RenderOutput& out, const DebugBasis& basis);
+
+#if PX_VC
+ #pragma warning(pop)
+#endif
+
+ struct DebugCircle
+ {
+ DebugCircle(PxU32 s, PxReal r)
+ : nSegments(s), radius(r) {}
+ PxU32 nSegments;
+ PxReal radius;
+ };
+ PX_PHYSX_COMMON_API RenderOutput& operator<<(RenderOutput& out, const DebugCircle& circle);
+
+ struct DebugArc
+ {
+ DebugArc(PxU32 s, PxReal r, PxReal minAng, PxReal maxAng)
+ : nSegments(s), radius(r), minAngle(minAng), maxAngle(maxAng) {}
+ PxU32 nSegments;
+ PxReal radius;
+ PxReal minAngle, maxAngle;
+ };
+ PX_PHYSX_COMMON_API RenderOutput& operator<<(RenderOutput& out, const DebugArc& arc);
+
+} // namespace Cm
+
+}
+
+#endif