diff options
| author | sschirm <[email protected]> | 2016-12-23 14:20:36 +0100 |
|---|---|---|
| committer | sschirm <[email protected]> | 2016-12-23 14:56:17 +0100 |
| commit | ef6937e69e8ee3f409cf9d460d5ad300a65d5924 (patch) | |
| tree | 710426e8daa605551ce3f34b581897011101c30f /PhysX_3.4/Source/Common/src/CmRenderOutput.h | |
| parent | Initial commit: (diff) | |
| download | physx-3.4-ef6937e69e8ee3f409cf9d460d5ad300a65d5924.tar.xz physx-3.4-ef6937e69e8ee3f409cf9d460d5ad300a65d5924.zip | |
PhysX 3.4 / APEX 1.4 release candidate @21506124
Diffstat (limited to 'PhysX_3.4/Source/Common/src/CmRenderOutput.h')
| -rw-r--r-- | PhysX_3.4/Source/Common/src/CmRenderOutput.h | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/PhysX_3.4/Source/Common/src/CmRenderOutput.h b/PhysX_3.4/Source/Common/src/CmRenderOutput.h index a121cb27..3f588e85 100644 --- a/PhysX_3.4/Source/Common/src/CmRenderOutput.h +++ b/PhysX_3.4/Source/Common/src/CmRenderOutput.h @@ -33,6 +33,7 @@ #include "foundation/PxMat44.h" #include "CmRenderBuffer.h" +#include "CmUtils.h" namespace physx { @@ -44,6 +45,7 @@ namespace Cm #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 */ @@ -62,7 +64,7 @@ namespace Cm RenderOutput(RenderBuffer& buffer) : mPrim(POINTS), mColor(0), mVertex0(0.0f), mVertex1(0.0f) - , mVertexCount(0), mTransform(PxMat44(PxIdentity)), mBuffer(buffer) + , mVertexCount(0), mTransform(PxIdentity), mBuffer(buffer) {} RenderOutput& operator<<(Primitive prim); @@ -75,27 +77,16 @@ namespace Cm PX_FORCE_INLINE PxDebugLine* reserveSegments(PxU32 nbSegments) { - const PxU32 currentSize = mBuffer.mLines.size(); - mBuffer.mLines.resizeUninitialized(currentSize + nbSegments); - return mBuffer.mLines.begin() + currentSize; + return reserveContainerMemory(mBuffer.mLines, nbSegments); } // 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;*/ + PxDebugLine* segment = reserveSegments(1); + segment->pos0 = v0; + segment->pos1 = v1; + segment->color0 = segment->color1 = mColor; } RenderOutput& outputCapsule(PxF32 radius, PxF32 halfHeight, const PxMat44& absPose); |