From 3dfe2108cfab31ba3ee5527e217d0d8e99a51162 Mon Sep 17 00:00:00 2001 From: git perforce import user Date: Tue, 25 Oct 2016 12:29:14 -0600 Subject: Initial commit: PhysX 3.4.0 Update @ 21294896 APEX 1.4.0 Update @ 21275617 [CL 21300167] --- .../general/RenderDebug/include/RenderDebugData.h | 2289 ++++++++++++++++++++ 1 file changed, 2289 insertions(+) create mode 100644 APEX_1.4/shared/general/RenderDebug/include/RenderDebugData.h (limited to 'APEX_1.4/shared/general/RenderDebug/include/RenderDebugData.h') diff --git a/APEX_1.4/shared/general/RenderDebug/include/RenderDebugData.h b/APEX_1.4/shared/general/RenderDebug/include/RenderDebugData.h new file mode 100644 index 00000000..aca786ea --- /dev/null +++ b/APEX_1.4/shared/general/RenderDebug/include/RenderDebugData.h @@ -0,0 +1,2289 @@ +/* + * Copyright 2009-2011 NVIDIA Corporation. All rights reserved. + * + * NOTICE TO USER: + * + * This source code is subject to NVIDIA ownership rights under U.S. and + * international Copyright laws. Users and possessors of this source code + * are hereby granted a nonexclusive, royalty-free license to use this code + * in individual and commercial software. + * + * NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE + * CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR + * IMPLIED WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. + * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE + * OR PERFORMANCE OF THIS SOURCE CODE. + * + * U.S. Government End Users. This source code is a "commercial item" as + * that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting of + * "commercial computer software" and "commercial computer software + * documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) + * and is provided to the U.S. Government only as a commercial end item. + * Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through + * 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the + * source code with only those rights set forth herein. + * + * Any use of this source code in individual and commercial software must + * include, in the user documentation and internal comments to the code, + * the above Disclaimer and U.S. Government End Users Notice. + */ + +#ifndef RENDER_DEBUG_DATA_H +#define RENDER_DEBUG_DATA_H + +/*! +\file +\brief debug rendering classes and structures +*/ +#include "PxVec2.h" +#include "PxVec3.h" +#include "PxVec4.h" +#include "PxQuat.h" +#include "PxMat33.h" +#include "PxMat44.h" +#include "PsIntrinsics.h" +#include "RenderDebugImpl.h" +#include "RenderDebug.h" +#include + +#define MAX_SEND_BUFFER 16384 // send up to 16384 at a time. + +namespace RENDER_DEBUG +{ + +PX_PUSH_PACK_DEFAULT + +struct DebugPrimitive; +struct DebugGraphDesc; + +//******************************************************************** +//******************************************************************** + + +// This enumeration defines the list of graphics primitives that can be generated by the debug renderer. +struct DebugCommand +{ + enum Enum + { + SET_CURRENT_RENDER_STATE, // set the current render state bit flags + SET_CURRENT_TEXT_SCALE, // set the floating point scale for 3d text printing. + SET_CURRENT_COLOR, // set the current pen color + SET_CURRENT_ARROW_COLOR, // set the current arrow (secondary) color + SET_CURRENT_TEXTURE1, // set the current texture id + SET_CURRENT_TEXTURE2, // set the current texture id + SET_CURRENT_TILE1, + SET_CURRENT_TILE2, + SET_CURRENT_TRANSFORM, // set the current matrix transform for graphics primitives + SET_CURRENT_RENDER_SCALE, // set the current overall render scale. + SET_CURRENT_ARROW_SIZE, // set the current size of arrow heads + SET_CURRENT_USER_ID, // sets the current user id. + DEBUG_LINE, // render a single line segment + DRAW_GRID, // render a 3d studio max style grid. + DEBUG_TEXT, // display 3d text + DEBUG_MESSAGE, // A debug message or a command + DEBUG_BOUND, // display a bounding box + DEBUG_FRUSTUM, // debug display a view frustum + DEBUG_POINT, // highlight a point + DEBUG_POINT_SCALE, // Debug a point with different scale on x/y/z + DEBUG_QUAD, // Debug a scaled and oriented screen facing quad + DEBUG_RECT2D, // display a 2d rectangle + DEBUG_GRADIENT_LINE, // draw a line segment with a unique color for each point. + DEBUG_RAY, // draw a ray (line with arrow on the end) + DEBUG_CYLINDER, // draw a cylinder assuming the default orientation of the PhysX SDK + DEBUG_POINT_CYLINDER, // draw a cylinder between two points + DEBUG_THICK_RAY, // draw a thick ray, full 3d arrow head. + DEBUG_PLANE, // debug visualization of a plane equation (drawn as concentric circles) + DEBUG_TRI, // debug visualize a triangle solid/wireframe determined by the current render state. + DEBUG_TRI_NORMALS, // debug visualize a triangle using the provided vertex normals + DEBUG_GRADIENT_TRI, // debug visualize a solid shaded triangle with unique vertex colors + DEBUG_GRADIENT_TRI_NORMALS, // debug visualize a solid shaded triangle with unique vertex normals and vertex colors + DEBUG_SPHERE, // debug visualize a coarse sphere + DEBUG_SQUASHED_SPHERE, // debug visualize a sphere that has been squashed + DEBUG_CAPSULE, // debug visualize a capsule (assumed PhysX SDK orientation) i.e. Y up is 'height' + DEBUG_AXES, // debug visualize a set of axes using thick-rays. + DEBUG_ARC, // debug visualize an arc. + DEBUG_THICK_ARC, // debug visualize a thick arc + DEBUG_DETAILED_SPHERE, // debug visualize a highly detailed sphere + DEBUG_BLOCK_INFO, // used internally only. + DEBUG_GRAPH, // display a graph + DEBUG_CAPSULE_TAPERED, // debug visualize a capsule with y-up as height + DEBUG_CIRCLE, // debug visualize an oriented circle + DEBUG_CREATE_TRIANGLE_MESH, // Create a triangle mesh to render + DEBUG_RENDER_TRIANGLE_MESH_INSTANCES, // render a sequence of triangle mesh instances + DEBUG_RELEASE_TRIANGLE_MESH, + DEBUG_CONE, + DEBUG_REFRESH_TRIANGLE_MESH_VERTICES, + DEBUG_TEXT2D, + DEBUG_CREATE_CUSTOM_TEXTURE, + DEBUG_RENDER_POINTS, + DEBUG_RENDER_LINES, + DEBUG_RENDER_TRIANGLES, + DEBUG_REGISTER_INPUT_EVENT, + DEBUG_RESET_INPUT_EVENTS, + DEBUG_UNREGISTER_INPUT_EVENT, + DEBUG_SKIP_FRAME, + DEBUG_CONVEX_HULL, + DEBUG_LAST + }; + static PX_INLINE uint32_t getPrimtiveSize(const DebugPrimitive &p); // returns the size of the data associated with a particular primitive type. +}; + +PX_INLINE void swap4Bytes(void* _data) +{ + char *data = static_cast(_data); + char one_byte; + one_byte = data[0]; data[0] = data[3]; data[3] = one_byte; + one_byte = data[1]; data[1] = data[2]; data[2] = one_byte; +} + +PX_INLINE void endianSwap(float &v) +{ + swap4Bytes(&v); +} + +PX_INLINE void endianSwap(uint32_t &v) +{ + swap4Bytes(&v); +} + +PX_INLINE void endianSwap(int32_t &v) +{ + swap4Bytes(&v); +} + +PX_INLINE void endianSwap(physx::PxVec2 &v) +{ + swap4Bytes(&v.x); + swap4Bytes(&v.y); +} + +PX_INLINE void endianSwap(physx::PxVec3 &v) +{ + swap4Bytes(&v.x); + swap4Bytes(&v.y); + swap4Bytes(&v.z); +} + +PX_INLINE void endianSwap(physx::PxVec4 &v) +{ + swap4Bytes(&v.x); + swap4Bytes(&v.y); + swap4Bytes(&v.z); + swap4Bytes(&v.w); +} + +PX_INLINE void endianSwap(physx::PxQuat &v) +{ + swap4Bytes(&v.x); + swap4Bytes(&v.y); + swap4Bytes(&v.z); + swap4Bytes(&v.w); +} + +PX_INLINE void endianSwap(physx::PxTransform &v) +{ + endianSwap(v.p); + endianSwap(v.q); +} + +PX_INLINE void endianSwap(physx::PxMat33 &v) +{ + uint32_t count = sizeof(v)/4; + uint32_t *s = reinterpret_cast(&v); + for (uint32_t i=0; i(&v); + for (uint32_t i=0; iendianFixup(); + switch ( prim->mCommand ) + { + case DebugCommand::SET_CURRENT_TRANSFORM: + { + DebugSetCurrentTransform *d = static_cast< DebugSetCurrentTransform *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_SKIP_FRAME: + case DebugCommand::DEBUG_RESET_INPUT_EVENTS: + case DebugCommand::SET_CURRENT_COLOR: + case DebugCommand::SET_CURRENT_RENDER_STATE: + case DebugCommand::SET_CURRENT_ARROW_COLOR: + case DebugCommand::SET_CURRENT_TEXTURE1: + case DebugCommand::SET_CURRENT_TEXTURE2: + case DebugCommand::SET_CURRENT_USER_ID: + { + DebugPrimitiveU32 *d = static_cast< DebugPrimitiveU32 *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_BOUND: + { + DebugBound *d = static_cast< DebugBound *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::SET_CURRENT_TEXT_SCALE: + case DebugCommand::SET_CURRENT_RENDER_SCALE: + case DebugCommand::SET_CURRENT_ARROW_SIZE: + case DebugCommand::SET_CURRENT_TILE1: + case DebugCommand::SET_CURRENT_TILE2: + { + DebugPrimitiveF32 *d = static_cast< DebugPrimitiveF32 *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_LINE: + { + DebugLine *d = static_cast< DebugLine *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DRAW_GRID: + { + DrawGrid *d = static_cast< DrawGrid *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_TEXT: + { + DebugText *d = static_cast< DebugText *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_TEXT2D: + { + DebugText2D *d = static_cast< DebugText2D *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_QUAD: + { + DebugQuad *d = static_cast< DebugQuad *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_POINT: + { + DebugPoint *d = static_cast< DebugPoint *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_RECT2D: + { + DebugRect2d *d = static_cast< DebugRect2d *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_GRADIENT_LINE: + { + DebugGradientLine *d = static_cast< DebugGradientLine *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_RAY: + { + DebugRay *d = static_cast< DebugRay *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_CYLINDER: + { + DebugCylinder *d = static_cast< DebugCylinder *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_CIRCLE: + { + DebugCircle *d = static_cast< DebugCircle *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_POINT_CYLINDER: + { + DebugPointCylinder *d = static_cast< DebugPointCylinder *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_THICK_RAY: + { + DebugThickRay *d = static_cast< DebugThickRay *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_PLANE: + { + DebugPlane *d = static_cast< DebugPlane *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_TRI: + { + DebugTri *d = static_cast< DebugTri *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_TRI_NORMALS: + { + DebugTriNormals *d = static_cast< DebugTriNormals *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_GRADIENT_TRI: + { + DebugGradientTri *d = static_cast< DebugGradientTri *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_GRADIENT_TRI_NORMALS: + { + DebugGradientTriNormals *d = static_cast< DebugGradientTriNormals *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_SPHERE: + { + DebugSphere *d = static_cast< DebugSphere *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_SQUASHED_SPHERE: + { + DebugSquashedSphere *d = static_cast< DebugSquashedSphere *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_CAPSULE: + { + DebugCapsule *d = static_cast< DebugCapsule *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_AXES: + { + DebugAxes *d = static_cast< DebugAxes *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_ARC: + { + DebugArc *d = static_cast< DebugArc *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_THICK_ARC: + { + DebugThickArc *d = static_cast< DebugThickArc *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_DETAILED_SPHERE: + { + DebugDetailedSphere *d = static_cast< DebugDetailedSphere *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_BLOCK_INFO: + { + PX_ALWAYS_ASSERT(); + } + break; + case DebugCommand::DEBUG_GRAPH: + { + DebugGraphStream *d = static_cast< DebugGraphStream *>(prim); + d->adjustEndian(); + PX_ALWAYS_ASSERT(); + } + break; + case DebugCommand::DEBUG_CAPSULE_TAPERED: + { + DebugTaperedCapsule *d = static_cast< DebugTaperedCapsule *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_POINT_SCALE: + { + DebugPointScale *d = static_cast< DebugPointScale *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_MESSAGE: + { + DebugMessage *d = static_cast< DebugMessage *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_CREATE_CUSTOM_TEXTURE: + { + DebugCreateCustomTexture *d = static_cast< DebugCreateCustomTexture *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_FRUSTUM: + { + DebugFrustum *d = static_cast< DebugFrustum *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_CONE: + { + DebugCone *d = static_cast< DebugCone *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_REGISTER_INPUT_EVENT: + { + DebugRegisterInputEvent *d = static_cast< DebugRegisterInputEvent *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_UNREGISTER_INPUT_EVENT: + { + DebugUnregisterInputEvent *d = static_cast< DebugUnregisterInputEvent *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_CREATE_TRIANGLE_MESH: + { + DebugCreateTriangleMesh *d = static_cast< DebugCreateTriangleMesh *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_RENDER_TRIANGLE_MESH_INSTANCES: + { + DebugRenderTriangleMeshInstances *d = static_cast< DebugRenderTriangleMeshInstances *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_RENDER_POINTS: + { + DebugRenderPoints *d = static_cast< DebugRenderPoints *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_CONVEX_HULL: + { + DebugConvexHull *d = static_cast< DebugConvexHull *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_RENDER_LINES: + { + DebugRenderLines *d = static_cast< DebugRenderLines *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_RENDER_TRIANGLES: + { + DebugRenderTriangles *d = static_cast< DebugRenderTriangles *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_RELEASE_TRIANGLE_MESH: + { + DebugReleaseTriangleMesh *d = static_cast< DebugReleaseTriangleMesh *>(prim); + d->adjustEndian(); + } + break; + case DebugCommand::DEBUG_REFRESH_TRIANGLE_MESH_VERTICES: + { + DebugRefreshTriangleMeshVertices *d = static_cast< DebugRefreshTriangleMeshVertices *>(prim); + d->adjustEndian(); + } + break; + } +} + +//******************************************************************** +//******************************************************************** + +// data structure used to track draw groups. Used internally only. +struct BlockInfo +{ +public: + + BlockInfo(void) + { + mHashValue = 0; + mVisibleState = true; + mChanged = false; + } + + uint32_t getHashValue(void) const + { + return mHashValue; + } + + physx::PxMat44 mPose; // transform for block of data + uint32_t mHashValue; + bool mVisibleState; + bool mChanged; // a semaphore indicating that the state has changed for this block +}; + + + +// The current render state data block. +class RenderState +{ +public: + + RenderState() + { + mStates = 0; + mColor = 0xcfcfcfcf; // needs to be symmetric to be platform independent. + mDisplayTime = 0.0001f; + mArrowColor = 0x5f5f5f5f; // needs to be symmetric to be platform independent. + mOutlineColor = 0xFFFFFFFF; + mArrowSize = 0.1f; + mRenderScale = 1.0f; + mTextScale = 1.0f; + mUserId = 0; + mPose = NULL; + mBlockInfo = NULL; + mChangeCount = 0; + mCurrentPose = physx::PxMat44(physx::PxIdentity); + mTexture1 = 0; + mTexture2 = 0; + mTileRate1 = 1.0f; + mTileRate2 = 1.0f; + } + + RenderState(uint32_t s,uint32_t c,float d,uint32_t a,float as,float rs,float ts) + { + mStates = s; + mOutlineColor = 0xFFFFFFFF; + mColor = c; + mDisplayTime = d; + mArrowColor = a; + mArrowSize = as; + mRenderScale = rs; + mTextScale = ts; + mUserId = 0; + mPose = NULL; + mCurrentPose = physx::PxMat44(physx::PxIdentity); + mBlockInfo = NULL; + mChangeCount = 0; + mTexture1 = 0; + mTexture2 = 0; + mTileRate1 = 1.0f; + mTileRate2 = 1.0f; + } + + PX_INLINE bool isScreen(void) const { return (mStates & RENDER_DEBUG::DebugRenderState::ScreenSpace); } + PX_INLINE bool isUseZ(void) const { return !(mStates & RENDER_DEBUG::DebugRenderState::NoZbuffer); } + PX_INLINE bool isSolid(void) const { return (mStates & (RENDER_DEBUG::DebugRenderState::SolidShaded | RENDER_DEBUG::DebugRenderState::SolidWireShaded)) ? true : false; } + PX_INLINE bool isClockwise(void) const { return !(mStates & RENDER_DEBUG::DebugRenderState::CounterClockwise); } + PX_INLINE bool isWireframeOverlay(void) const { return (mStates & RENDER_DEBUG::DebugRenderState::SolidWireShaded) ? true : false; } + PX_INLINE bool isWireframe(void) const + { + bool ret = true; + if ( isSolid() && !isWireframeOverlay() ) + { + ret = false; + } + return ret; + } + + PX_INLINE float getDisplayTime(void) const + { + return (mStates & RENDER_DEBUG::DebugRenderState::InfiniteLifeSpan) ? PX_MAX_F32 : mDisplayTime; + } + + PX_INLINE bool isCentered(void) const { return (mStates & RENDER_DEBUG::DebugRenderState::CenterText) ? true : false; } + PX_INLINE bool isCameraFacing(void) const { return (mStates & RENDER_DEBUG::DebugRenderState::CameraFacing) ? true : false; } + PX_INLINE bool isCounterClockwise(void) const { return (mStates & RENDER_DEBUG::DebugRenderState::CounterClockwise) ? true : false; } + PX_INLINE int32_t getUserId(void) const { return mUserId; } + + PX_INLINE void incrementChangeCount(void) { mChangeCount++; } + PX_INLINE uint32_t getChangeCount(void) const { return mChangeCount; } + + PX_INLINE uint32_t setRenderState(RENDER_DEBUG::DebugRenderState::Enum state) + { + mStates|=state; + return mStates; + } + + PX_INLINE uint32_t clearRenderState(RENDER_DEBUG::DebugRenderState::Enum state) + { + mStates&=~state; + return mStates; + } + + PX_INLINE bool hasRenderState(RENDER_DEBUG::DebugRenderState::Enum state) const + { + return (state&mStates) ? true : false; + } + + PX_INLINE void setCurrentColor(uint32_t c1,uint32_t c2) + { + mColor = c1; + mArrowColor = c2; + } + + + uint32_t mStates; + uint32_t mColor; + uint32_t mTexture1; + float mTileRate1; + uint32_t mTexture2; + float mTileRate2; + float mDisplayTime; + uint32_t mArrowColor; + uint32_t mOutlineColor; + float mArrowSize; + float mRenderScale; + float mTextScale; + uint32_t mChangeCount; + int32_t mUserId; + BlockInfo *mBlockInfo; + physx::PxMat44 *mPose; + physx::PxMat44 mCurrentPose; +}; + +struct DebugBlockInfo : public DebugPrimitive +{ + DebugBlockInfo(void) { } + DebugBlockInfo(BlockInfo *info) : + DebugPrimitive(DebugCommand::DEBUG_BLOCK_INFO), + mInfo(info) + { + if ( info ) + { + new ( &mCurrentTransform ) DebugSetCurrentTransform(info->mPose); + } + } + BlockInfo *mInfo; + DebugSetCurrentTransform mCurrentTransform; // contains the transform for this block; updated each time it changes. +}; + +/** +\brief The maximum number of graphs that can be displayed at one time. (0-5) +*/ +#define MAX_GRAPHS 6 +/** +\brief The width of the graphs (x axis) when created automatically +*/ +#define GRAPH_WIDTH_DEFAULT 0.8f +/** +\brief The height of the graphs (y axis) when created automatically +*/ +#define GRAPH_HEIGHT_DEFAULT 0.4f + +/** +\brief definition of the debugGraph descriptor used to create graphs +*/ +struct DebugGraphDesc +{ + DebugGraphDesc(void) + { + mPoints = NULL; + mGraphXLabel = NULL; + mGraphYLabel = NULL; + } + + + /** + \brief The number of float data points to graph + */ + uint32_t mNumPoints; + /** + \brief Pointer to the float data points to graph + */ + const float* mPoints; + /** + \brief optional cutoff line drawn horizontally on the graph. It should be between 0 and mGraphMax. + 0.0f indicates not to draw the cutoff line. + */ + float mCutOffLevel; + /** + \brief The maximum value that the graph should be be able to display. + Noramlly this is slightly larger than the greatest value in the mPoints array to make room for + future samples that are higher then the current set. + */ + float mGraphMax; + /** + \brief The bottom left x coordinate of the graph. + This is set automatically by the constructor that takes graphNum as an argument. + NOTE: display coordinates range from -1.0f - + 1.0f + */ + float mGraphXPos; + /** + \brief bottom left y coordinate of the graph. + This is set automatically by the constructor that takes graphNum as an argument. + NOTE: display coordinates range from -1.0f - + 1.0f + */ + float mGraphYPos; + /** + \brief The width of the graph. + This is set automatically by the constructor that takes graphNum as an argument. + NOTE: display coordinates range from -1.0f - + 1.0f + */ + float mGraphWidth; + /** + \brief The height of the graph. + This is set automatically by the constructor that takes graphNum as an argument. + NOTE: display coordinates range from -1.0f - + 1.0f + */ + float mGraphHeight; + /** + \brief The color of the data. + This is set automatically by the constructor that takes graphNum as an argument. + NOTE: display coordinates range from -1.0f - + 1.0f + This is set automatically by the constructor that takes graphNum as an argument. + */ + uint32_t mGraphColor; + /** + \brief The alternate color of the data if mColorSwitchIndex is set to a value that is a valid + index to the mPoints array. The points after mColorSwitchIndex are drawn in this color. + This is set automatically by the constructor that takes graphNum as an argument. + */ + uint32_t mArrowColor; + /** + \brief A pointer to the label for the X axis. + */ + const char* mGraphXLabel; + /** + \brief A pointer to the label for the Y axis. + */ + const char* mGraphYLabel; + /** + \brief The (optional!) index in the data set at which to switch the color to the color specified by + mArrorColor. By default this is set to -1 indicating that no color switch should be performed. + */ + uint32_t mColorSwitchIndex; + +}; + + + + + +PX_INLINE uint32_t DebugCommand::getPrimtiveSize(const DebugPrimitive &p) +{ + uint32_t ret=0; + + RENDER_DEBUG::DebugCommand::Enum c = static_cast(p.mCommand); + switch ( c ) + { + case SET_CURRENT_TRANSFORM: + ret = sizeof(DebugSetCurrentTransform); + break; + case DEBUG_SKIP_FRAME: + case DEBUG_RESET_INPUT_EVENTS: + case SET_CURRENT_COLOR: + case SET_CURRENT_RENDER_STATE: + case SET_CURRENT_ARROW_COLOR: + case SET_CURRENT_USER_ID: + case SET_CURRENT_TEXTURE1: + case SET_CURRENT_TEXTURE2: + ret = sizeof(DebugPrimitiveU32); + break; + case DEBUG_BOUND: + ret = sizeof(DebugBound); + break; + case SET_CURRENT_TEXT_SCALE: + case SET_CURRENT_RENDER_SCALE: + case SET_CURRENT_ARROW_SIZE: + case SET_CURRENT_TILE1: + case SET_CURRENT_TILE2: + ret = sizeof(DebugPrimitiveF32); + break; + case DEBUG_LINE: + ret = sizeof(DebugLine); + break; + case DRAW_GRID: + ret = sizeof(DrawGrid); + break; + case DEBUG_TEXT: + ret = sizeof(DebugText); + break; + case DEBUG_TEXT2D: + ret = sizeof(DebugText2D); + break; + case DEBUG_QUAD: + ret = sizeof(DebugQuad); + break; + case DEBUG_POINT: + ret = sizeof(DebugPoint); + break; + case DEBUG_RECT2D: + ret = sizeof(DebugRect2d); + break; + case DEBUG_GRADIENT_LINE: + ret = sizeof(DebugGradientLine); + break; + case DEBUG_RAY: + ret = sizeof(DebugRay); + break; + case DEBUG_CYLINDER: + ret = sizeof(DebugCylinder); + break; + case DEBUG_CIRCLE: + ret = sizeof(DebugCircle); + break; + case DEBUG_POINT_CYLINDER: + ret = sizeof(DebugPointCylinder); + break; + case DEBUG_THICK_RAY: + ret = sizeof(DebugThickRay); + break; + case DEBUG_PLANE: + ret = sizeof(DebugPlane); + break; + case DEBUG_TRI: + ret = sizeof(DebugTri); + break; + case DEBUG_TRI_NORMALS: + ret = sizeof(DebugTriNormals); + break; + case DEBUG_GRADIENT_TRI: + ret = sizeof(DebugGradientTri); + break; + case DEBUG_GRADIENT_TRI_NORMALS: + ret = sizeof(DebugGradientTriNormals); + break; + case DEBUG_SPHERE: + ret = sizeof(DebugSphere); + break; + case DEBUG_SQUASHED_SPHERE: + ret = sizeof(DebugSquashedSphere); + break; + case DEBUG_CAPSULE: + ret = sizeof(DebugCapsule); + break; + case DEBUG_AXES: + ret = sizeof(DebugAxes); + break; + case DEBUG_ARC: + ret = sizeof(DebugArc); + break; + case DEBUG_THICK_ARC: + ret = sizeof(DebugThickArc); + break; + case DEBUG_DETAILED_SPHERE: + ret = sizeof(DebugDetailedSphere); + break; + case DEBUG_BLOCK_INFO: + ret = sizeof(DebugBlockInfo); + break; + case DEBUG_GRAPH: + { + const DebugGraphStream *d = static_cast< const DebugGraphStream *>(&p); + ret = d->getSize(); + } + break; + case DEBUG_CAPSULE_TAPERED: + ret = sizeof(DebugTaperedCapsule); + break; + case DEBUG_POINT_SCALE: + ret = sizeof(DebugPointScale); + break; + case DEBUG_MESSAGE: + ret = sizeof(DebugMessage); + break; + case DEBUG_CREATE_CUSTOM_TEXTURE: + ret = sizeof(DebugCreateCustomTexture); + break; + case DEBUG_FRUSTUM: + ret = sizeof(DebugFrustum); + break; + case DEBUG_CONE: + ret = sizeof(DebugCone); + break; + case DEBUG_REGISTER_INPUT_EVENT: + ret = sizeof(DebugRegisterInputEvent); + break; + case DEBUG_UNREGISTER_INPUT_EVENT: + ret = sizeof(DebugUnregisterInputEvent); + break; + case DEBUG_CREATE_TRIANGLE_MESH: + { + const DebugCreateTriangleMesh *d = static_cast< const DebugCreateTriangleMesh *>(&p); + ret = d->getSize(); + } + break; + case DEBUG_RENDER_TRIANGLE_MESH_INSTANCES: + { + const DebugRenderTriangleMeshInstances *d = static_cast< const DebugRenderTriangleMeshInstances *>(&p); + ret = d->getSize(); + } + break; + case DEBUG_RENDER_POINTS: + { + const DebugRenderPoints *d = static_cast< const DebugRenderPoints *>(&p); + ret = d->getSize(); + } + break; + case DEBUG_CONVEX_HULL: + { + const DebugConvexHull *d = static_cast< const DebugConvexHull *>(&p); + ret = d->getSize(); + } + break; + case DEBUG_RENDER_LINES: + { + const DebugRenderLines *d = static_cast< const DebugRenderLines *>(&p); + ret = d->getSize(); + } + break; + case DEBUG_RENDER_TRIANGLES: + { + const DebugRenderTriangles *d = static_cast< const DebugRenderTriangles *>(&p); + ret = d->getSize(); + } + break; + case DEBUG_RELEASE_TRIANGLE_MESH: + ret = sizeof(DebugReleaseTriangleMesh); + break; + case DEBUG_REFRESH_TRIANGLE_MESH_VERTICES: + { + const DebugRefreshTriangleMeshVertices *d = static_cast< const DebugRefreshTriangleMeshVertices *>(&p); + ret = d->getSize(); + } + break; + case DEBUG_LAST: + break; + default: + PX_ALWAYS_ASSERT(); + ret = 0; + break; + } + return ret; +} + +PX_POP_PACK + +} // end of namespace + +#endif // RENDER_DEBUG_DATA_H -- cgit v1.2.3