diff --git a/libraries/render-utils/src/AnimDebugDraw.cpp b/libraries/render-utils/src/AnimDebugDraw.cpp index e4e27a1b3d..6e86b900da 100644 --- a/libraries/render-utils/src/AnimDebugDraw.cpp +++ b/libraries/render-utils/src/AnimDebugDraw.cpp @@ -17,13 +17,14 @@ #include "AnimDebugDraw.h" -struct Vertex { - glm::vec3 pos; - uint32_t rgba; -}; - class AnimDebugDrawData { public: + + struct Vertex { + glm::vec3 pos; + uint32_t rgba; + }; + typedef render::Payload Payload; typedef Payload::DataPointer Pointer; @@ -117,18 +118,18 @@ AnimDebugDraw::AnimDebugDraw() : } // HACK: add red, green and blue axis at (1,1,1) - _animDebugDrawData->_vertexBuffer->resize(sizeof(Vertex) * 6); + _animDebugDrawData->_vertexBuffer->resize(sizeof(AnimDebugDrawData::Vertex) * 6); - static std::vector vertices({ - Vertex { glm::vec3(1.0, 1.0f, 1.0f), toRGBA(255, 0, 0, 255) }, - Vertex { glm::vec3(2.0, 1.0f, 1.0f), toRGBA(255, 0, 0, 255) }, - Vertex { glm::vec3(1.0, 1.0f, 1.0f), toRGBA(0, 255, 0, 255) }, - Vertex { glm::vec3(1.0, 2.0f, 1.0f), toRGBA(0, 255, 0, 255) }, - Vertex { glm::vec3(1.0, 1.0f, 1.0f), toRGBA(0, 0, 255, 255) }, - Vertex { glm::vec3(1.0, 1.0f, 2.0f), toRGBA(0, 0, 255, 255) }, + static std::vector vertices({ + AnimDebugDrawData::Vertex { glm::vec3(1.0, 1.0f, 1.0f), toRGBA(255, 0, 0, 255) }, + AnimDebugDrawData::Vertex { glm::vec3(2.0, 1.0f, 1.0f), toRGBA(255, 0, 0, 255) }, + AnimDebugDrawData::Vertex { glm::vec3(1.0, 1.0f, 1.0f), toRGBA(0, 255, 0, 255) }, + AnimDebugDrawData::Vertex { glm::vec3(1.0, 2.0f, 1.0f), toRGBA(0, 255, 0, 255) }, + AnimDebugDrawData::Vertex { glm::vec3(1.0, 1.0f, 1.0f), toRGBA(0, 0, 255, 255) }, + AnimDebugDrawData::Vertex { glm::vec3(1.0, 1.0f, 2.0f), toRGBA(0, 0, 255, 255) }, }); static std::vector indices({ 0, 1, 2, 3, 4, 5 }); - _animDebugDrawData->_vertexBuffer->setSubData(0, vertices); + _animDebugDrawData->_vertexBuffer->setSubData(0, vertices); _animDebugDrawData->_indexBuffer->setSubData(0, indices); } @@ -159,7 +160,7 @@ static const uint32_t blue = toRGBA(0, 0, 255, 255); const int NUM_CIRCLE_SLICES = 24; -static void addBone(const AnimPose& rootPose, const AnimPose& pose, float radius, Vertex*& v) { +static void addBone(const AnimPose& rootPose, const AnimPose& pose, float radius, AnimDebugDrawData::Vertex*& v) { const float XYZ_AXIS_LENGTH = radius * 4.0f; @@ -234,7 +235,7 @@ static void addBone(const AnimPose& rootPose, const AnimPose& pose, float radius } static void addLink(const AnimPose& rootPose, const AnimPose& pose, const AnimPose& parentPose, - float radius, const glm::vec4& colorVec, Vertex*& v) { + float radius, const glm::vec4& colorVec, AnimDebugDrawData::Vertex*& v) { uint32_t color = toRGBA(colorVec); @@ -296,7 +297,7 @@ static void addLink(const AnimPose& rootPose, const AnimPose& pose, const AnimPo } } -static void addLine(const glm::vec3& start, const glm::vec3& end, const glm::vec4& color, Vertex*& v) { +static void addLine(const glm::vec3& start, const glm::vec3& end, const glm::vec4& color, AnimDebugDrawData::Vertex*& v) { uint32_t colorInt = toRGBA(color); v->pos = start; v->rgba = colorInt; @@ -345,10 +346,10 @@ void AnimDebugDraw::update() { numVerts += (int)DebugDraw::getInstance().getRays().size() * VERTICES_PER_RAY; // allocate verts! - std::vector vertices; + std::vector vertices; vertices.resize(numVerts); //Vertex* verts = (Vertex*)data._vertexBuffer->editData(); - Vertex* v = nullptr; + AnimDebugDrawData::Vertex* v = nullptr; if (numVerts) { v = &vertices[0]; } @@ -401,8 +402,8 @@ void AnimDebugDraw::update() { } DebugDraw::getInstance().clearRays(); - data._vertexBuffer->resize(sizeof(Vertex) * numVerts); - data._vertexBuffer->setSubData(0, vertices); + data._vertexBuffer->resize(sizeof(AnimDebugDrawData::Vertex) * numVerts); + data._vertexBuffer->setSubData(0, vertices); assert((!numVerts && !v) || (numVerts == (v - &vertices[0])));