sidestep linux gcc linker? bug
Showing the changes to libraries/render-utils/src/AnimDebugDraw.cpp (1 of 1 file). Show all
Unified · Split
| @@ -19,13 +19,14 @@ · 18 unmodified lines | ||
| 19 | 19 | |
| 20 | 20 | #include "AnimDebugDraw.h" |
| 21 | 21 | |
| 22 | −struct Vertex { | |
| 23 | − glm::vec3 pos; | |
| 24 | − uint32_t rgba; | |
| 25 | −}; | |
| 26 | − | |
| 27 | 22 | class AnimDebugDrawData { |
| 28 | 23 | public: |
| 24 | + | |
| 25 | + struct Vertex { | |
| 26 | + glm::vec3 pos; | |
| 27 | + uint32_t rgba; | |
| 28 | + }; | |
| 29 | + | |
| 29 | 30 | typedef render::Payload<AnimDebugDrawData> Payload; |
| 30 | 31 | typedef Payload::DataPointer Pointer; |
| 31 | 32 | |
| @@ -119,18 +120,18 @@ AnimDebugDraw::AnimDebugDraw() : · 87 unmodified lines | ||
| 119 | 120 | } |
| 120 | 121 | |
| 121 | 122 | // HACK: add red, green and blue axis at (1,1,1) |
| 122 | − _animDebugDrawData->_vertexBuffer->resize(sizeof(Vertex) * 6); | |
| 123 | + _animDebugDrawData->_vertexBuffer->resize(sizeof(AnimDebugDrawData::Vertex) * 6); | |
| 123 | 124 | |
| 124 | − static std::vector<Vertex> vertices({ | |
| 125 | − Vertex { glm::vec3(1.0, 1.0f, 1.0f), toRGBA(255, 0, 0, 255) }, | |
| 126 | − Vertex { glm::vec3(2.0, 1.0f, 1.0f), toRGBA(255, 0, 0, 255) }, | |
| 127 | − Vertex { glm::vec3(1.0, 1.0f, 1.0f), toRGBA(0, 255, 0, 255) }, | |
| 128 | − Vertex { glm::vec3(1.0, 2.0f, 1.0f), toRGBA(0, 255, 0, 255) }, | |
| 129 | − Vertex { glm::vec3(1.0, 1.0f, 1.0f), toRGBA(0, 0, 255, 255) }, | |
| 130 | − Vertex { glm::vec3(1.0, 1.0f, 2.0f), toRGBA(0, 0, 255, 255) }, | |
| 125 | + static std::vector<AnimDebugDrawData::Vertex> vertices({ | |
| 126 | + AnimDebugDrawData::Vertex { glm::vec3(1.0, 1.0f, 1.0f), toRGBA(255, 0, 0, 255) }, | |
| 127 | + AnimDebugDrawData::Vertex { glm::vec3(2.0, 1.0f, 1.0f), toRGBA(255, 0, 0, 255) }, | |
| 128 | + AnimDebugDrawData::Vertex { glm::vec3(1.0, 1.0f, 1.0f), toRGBA(0, 255, 0, 255) }, | |
| 129 | + AnimDebugDrawData::Vertex { glm::vec3(1.0, 2.0f, 1.0f), toRGBA(0, 255, 0, 255) }, | |
| 130 | + AnimDebugDrawData::Vertex { glm::vec3(1.0, 1.0f, 1.0f), toRGBA(0, 0, 255, 255) }, | |
| 131 | + AnimDebugDrawData::Vertex { glm::vec3(1.0, 1.0f, 2.0f), toRGBA(0, 0, 255, 255) }, | |
| 131 | 132 | }); |
| 132 | 133 | static std::vector<uint16_t> indices({ 0, 1, 2, 3, 4, 5 }); |
| 133 | − _animDebugDrawData->_vertexBuffer->setSubData<Vertex>(0, vertices); | |
| 134 | + _animDebugDrawData->_vertexBuffer->setSubData<AnimDebugDrawData::Vertex>(0, vertices); | |
| 134 | 135 | _animDebugDrawData->_indexBuffer->setSubData<uint16_t>(0, indices); |
| 135 | 136 | } |
| 136 | 137 | |
| @@ -161,7 +162,7 @@ static const uint32_t blue = toRGBA(0, 0, 255, 255); · 24 unmodified lines | ||
| 161 | 162 | |
| 162 | 163 | const int NUM_CIRCLE_SLICES = 24; |
| 163 | 164 | |
| 164 | −static void addBone(const AnimPose& rootPose, const AnimPose& pose, float radius, Vertex*& v) { | |
| 165 | +static void addBone(const AnimPose& rootPose, const AnimPose& pose, float radius, AnimDebugDrawData::Vertex*& v) { | |
| 165 | 166 | |
| 166 | 167 | const float XYZ_AXIS_LENGTH = radius * 4.0f; |
| 167 | 168 | |
| @@ -236,7 +237,7 @@ static void addBone(const AnimPose& rootPose, const AnimPose& pose, float radius · 68 unmodified lines | ||
| 236 | 237 | } |
| 237 | 238 | |
| 238 | 239 | static void addLink(const AnimPose& rootPose, const AnimPose& pose, const AnimPose& parentPose, |
| 239 | − float radius, const glm::vec4& colorVec, Vertex*& v) { | |
| 240 | + float radius, const glm::vec4& colorVec, AnimDebugDrawData::Vertex*& v) { | |
| 240 | 241 | |
| 241 | 242 | uint32_t color = toRGBA(colorVec); |
| 242 | 243 | |
| @@ -298,7 +299,7 @@ static void addLink(const AnimPose& rootPose, const AnimPose& pose, const AnimPo · 55 unmodified lines | ||
| 298 | 299 | } |
| 299 | 300 | } |
| 300 | 301 | |
| 301 | −static void addLine(const glm::vec3& start, const glm::vec3& end, const glm::vec4& color, Vertex*& v) { | |
| 302 | +static void addLine(const glm::vec3& start, const glm::vec3& end, const glm::vec4& color, AnimDebugDrawData::Vertex*& v) { | |
| 302 | 303 | uint32_t colorInt = toRGBA(color); |
| 303 | 304 | v->pos = start; |
| 304 | 305 | v->rgba = colorInt; |
| @@ -347,10 +348,10 @@ void AnimDebugDraw::update() { · 42 unmodified lines | ||
| 347 | 348 | numVerts += (int)DebugDraw::getInstance().getRays().size() * VERTICES_PER_RAY; |
| 348 | 349 | |
| 349 | 350 | // allocate verts! |
| 350 | − std::vector<Vertex> vertices; | |
| 351 | + std::vector<AnimDebugDrawData::Vertex> vertices; | |
| 351 | 352 | vertices.resize(numVerts); |
| 352 | 353 | //Vertex* verts = (Vertex*)data._vertexBuffer->editData(); |
| 353 | − Vertex* v = nullptr; | |
| 354 | + AnimDebugDrawData::Vertex* v = nullptr; | |
| 354 | 355 | if (numVerts) { |
| 355 | 356 | v = &vertices[0]; |
| 356 | 357 | } |
| @@ -403,8 +404,8 @@ void AnimDebugDraw::update() { · 46 unmodified lines | ||
| 403 | 404 | } |
| 404 | 405 | DebugDraw::getInstance().clearRays(); |
| 405 | 406 | |
| 406 | − data._vertexBuffer->resize(sizeof(Vertex) * numVerts); | |
| 407 | − data._vertexBuffer->setSubData<Vertex>(0, vertices); | |
| 407 | + data._vertexBuffer->resize(sizeof(AnimDebugDrawData::Vertex) * numVerts); | |
| 408 | + data._vertexBuffer->setSubData<AnimDebugDrawData::Vertex>(0, vertices); | |
| 408 | 409 | |
| 409 | 410 | assert((!numVerts && !v) || (numVerts == (v - &vertices[0]))); |
| 410 | 411 | |