| 1 | /* |
| 2 | * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. |
| 3 | * |
| 4 | * NVIDIA CORPORATION and its licensors retain all intellectual property |
| 5 | * and proprietary rights in and to this software, related documentation |
| 6 | * and any modifications thereto. Any use, reproduction, disclosure or |
| 7 | * distribution of this software and related documentation without an express |
| 8 | * license agreement from NVIDIA CORPORATION is strictly prohibited. |
| 9 | */ |
| 10 | // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. |
| 11 | // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. |
| 12 | |
| 13 | |
| 14 | #ifndef PX_FOUNDATION_PXRENDERBUFFER_H |
| 15 | #define PX_FOUNDATION_PXRENDERBUFFER_H |
| 16 | |
| 17 | /** \addtogroup common |
| 18 | @{ |
| 19 | */ |
| 20 | |
| 21 | #include "common/PxPhysXCommonConfig.h" |
| 22 | #include "foundation/PxVec3.h" |
| 23 | #include "foundation/PxMat33.h" |
| 24 | #include "foundation/PxBounds3.h" |
| 25 | |
| 26 | #ifndef PX_DOXYGEN |
| 27 | namespace physx |
| 28 | { |
| 29 | #endif |
| 30 | |
| 31 | /** |
| 32 | \brief Default color values used for debug rendering. |
| 33 | */ |
| 34 | struct PxDebugColor |
| 35 | { |
| 36 | enum Enum |
| 37 | { |
| 38 | eARGB_BLACK = 0xff000000, |
| 39 | eARGB_RED = 0xffff0000, |
| 40 | eARGB_GREEN = 0xff00ff00, |
| 41 | eARGB_BLUE = 0xff0000ff, |
| 42 | eARGB_YELLOW = 0xffffff00, |
| 43 | eARGB_MAGENTA = 0xffff00ff, |
| 44 | eARGB_CYAN = 0xff00ffff, |
| 45 | eARGB_WHITE = 0xffffffff, |
| 46 | eARGB_GREY = 0xff808080, |
| 47 | eARGB_DARKRED = 0x88880000, |
| 48 | eARGB_DARKGREEN = 0x88008800, |
| 49 | eARGB_DARKBLUE = 0x88000088 |
| 50 | }; |
| 51 | }; |
| 52 | |
| 53 | /** |
| 54 | \brief Used to store a single point and colour for debug rendering. |
| 55 | */ |
| 56 | struct PxDebugPoint |
| 57 | { |
| 58 | PxDebugPoint(const PxVec3& p, const PxU32& c) |
| 59 | : pos(p), color(c) {} |
| 60 | |
| 61 | PxVec3 pos; |
| 62 | PxU32 color; |
| 63 | }; |
| 64 | |
| 65 | /** |
| 66 | \brief Used to store a single line and colour for debug rendering. |
| 67 | */ |
| 68 | struct PxDebugLine |
| 69 | { |
| 70 | PxDebugLine(const PxVec3& p0, const PxVec3& p1, const PxU32& c) |
| 71 | : pos0(p0), color0(c), pos1(p1), color1(c) {} |
| 72 | |
| 73 | PxVec3 pos0; |
| 74 | PxU32 color0; |
| 75 | PxVec3 pos1; |
| 76 | PxU32 color1; |
| 77 | }; |
| 78 | |
| 79 | /** |
| 80 | \brief Used to store a single triangle and colour for debug rendering. |
| 81 | */ |
| 82 | struct PxDebugTriangle |
| 83 | { |
| 84 | PxDebugTriangle(const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, const PxU32& c) |
| 85 | : pos0(p0), color0(c), pos1(p1), color1(c), pos2(p2), color2(c) {} |
| 86 | |
| 87 | PxVec3 pos0; |
| 88 | PxU32 color0; |
| 89 | PxVec3 pos1; |
| 90 | PxU32 color1; |
| 91 | PxVec3 pos2; |
| 92 | PxU32 color2; |
| 93 | }; |
| 94 | |
| 95 | /** |
| 96 | \brief Used to store a text for debug rendering. Doesn't own 'string' array. |
| 97 | */ |
| 98 | struct PxDebugText |
| 99 | { |
| 100 | PxDebugText() : string(0) {} |
| 101 | |
| 102 | PxDebugText(const PxVec3& p, const PxReal& s, const PxU32& c, const char* str) |
| 103 | : position(p), size(s), color(c), string(str) {} |
| 104 | |
| 105 | PxVec3 position; |
| 106 | PxReal size; |
| 107 | PxU32 color; |
| 108 | const char* string; |
| 109 | }; |
| 110 | |
| 111 | /** |
| 112 | \brief Interface for points, lines, triangles, and text buffer. |
| 113 | */ |
| 114 | class PxRenderBuffer |
| 115 | { |
| 116 | public: |
| 117 | virtual ~PxRenderBuffer() {} |
| 118 | |
| 119 | virtual PxU32 getNbPoints() const = 0; |
| 120 | virtual const PxDebugPoint* getPoints() const = 0; |
| 121 | |
| 122 | virtual PxU32 getNbLines() const = 0; |
| 123 | virtual const PxDebugLine* getLines() const = 0; |
| 124 | |
| 125 | virtual PxU32 getNbTriangles() const = 0; |
| 126 | virtual const PxDebugTriangle* getTriangles() const = 0; |
| 127 | |
| 128 | virtual PxU32 getNbTexts() const = 0; |
| 129 | virtual const PxDebugText* getTexts() const = 0; |
| 130 | |
| 131 | virtual void append(const PxRenderBuffer& other) = 0; |
| 132 | virtual void clear() = 0; |
| 133 | }; |
| 134 | |
| 135 | #ifndef PX_DOXYGEN |
| 136 | } // namespace physx |
| 137 | #endif |
| 138 | |
| 139 | /** @} */ |
| 140 | #endif |
| 141 | |