Showing the changes to libraries/render-utils/src/AnimDebugDraw.cpp (1 of 1 file). Show all
Unified · Split
| @@ -56,13 +56,16 @@ public: · 55 unmodified lines | |||
| 56 | gpu::Stream::FormatPointer _vertexFormat; | 56 | gpu::Stream::FormatPointer _vertexFormat; |
| 57 | gpu::BufferPointer _vertexBuffer; | 57 | gpu::BufferPointer _vertexBuffer; |
| 58 | gpu::BufferPointer _indexBuffer; | 58 | gpu::BufferPointer _indexBuffer; |
| 59 | |||
| 60 | render::Item::Bound _bound { glm::vec3(-16384.0f), 32768.0f }; | ||
| 61 | bool _isVisible { true }; | ||
| 59 | }; | 62 | }; |
| 60 | 63 | ||
| 61 | typedef render::Payload<AnimDebugDrawData> AnimDebugDrawPayload; | 64 | typedef render::Payload<AnimDebugDrawData> AnimDebugDrawPayload; |
| 62 | 65 | ||
| 63 | namespace render { | 66 | namespace render { |
| 64 | template <> const ItemKey payloadGetKey(const AnimDebugDrawData::Pointer& data) { return ItemKey::Builder::opaqueShape(); } | 67 | template <> const ItemKey payloadGetKey(const AnimDebugDrawData::Pointer& data) { return (data->_isVisible ? ItemKey::Builder::opaqueShape() : ItemKey::Builder::opaqueShape().withInvisible()); } |
| 65 | template <> const Item::Bound payloadGetBound(const AnimDebugDrawData::Pointer& data) { return Item::Bound(); } | 68 | template <> const Item::Bound payloadGetBound(const AnimDebugDrawData::Pointer& data) { return data->_bound; } |
| 66 | template <> void payloadRender(const AnimDebugDrawData::Pointer& data, RenderArgs* args) { | 69 | template <> void payloadRender(const AnimDebugDrawData::Pointer& data, RenderArgs* args) { |
| 67 | data->render(args); | 70 | data->render(args); |
| 68 | } | 71 | } |
| @@ -389,6 +392,13 @@ void AnimDebugDraw::update() { · 320 unmodified lines | |||
| 389 | 392 | ||
| 390 | assert(numVerts == (v - verts)); | 393 | assert(numVerts == (v - verts)); |
| 391 | 394 | ||
| 395 | render::Item::Bound theBound; | ||
| 396 | for (int i = 0; i < numVerts; i++) { | ||
| 397 | theBound += verts[i].pos; | ||
| 398 | } | ||
| 399 | |||
| 400 | data._isVisible = (numVerts > 0); | ||
| 401 | data._bound = theBound; | ||
| 392 | data._indexBuffer->resize(sizeof(uint16_t) * numVerts); | 402 | data._indexBuffer->resize(sizeof(uint16_t) * numVerts); |
| 393 | uint16_t* indices = (uint16_t*)data._indexBuffer->editData(); | 403 | uint16_t* indices = (uint16_t*)data._indexBuffer->editData(); |
| 394 | for (int i = 0; i < numVerts; i++) { | 404 | for (int i = 0; i < numVerts; i++) { |