History

Fixing the rendering of the avatar skeleton

samcake committed 10 years ago

Commit 29bacd21 parent 6eda7aa1 file · +12 −2Browse files

Showing the changes to libraries/render-utils/src/AnimDebugDraw.cpp (1 of 1 file). Show all

Unified · Split

libraries/render-utils/src/AnimDebugDraw.cpp+12−2
@@ -56,13 +56,16 @@ public: · 55 unmodified lines
5656 gpu::Stream::FormatPointer _vertexFormat;
5757 gpu::BufferPointer _vertexBuffer;
5858 gpu::BufferPointer _indexBuffer;
59+
60+ render::Item::Bound _bound { glm::vec3(-16384.0f), 32768.0f };
61+ bool _isVisible { true };
5962 };
6063
6164 typedef render::Payload<AnimDebugDrawData> AnimDebugDrawPayload;
6265
6366 namespace render {
64− template <> const ItemKey payloadGetKey(const AnimDebugDrawData::Pointer& data) { return ItemKey::Builder::opaqueShape(); }
65− template <> const Item::Bound payloadGetBound(const AnimDebugDrawData::Pointer& data) { return Item::Bound(); }
67+ template <> const ItemKey payloadGetKey(const AnimDebugDrawData::Pointer& data) { return (data->_isVisible ? ItemKey::Builder::opaqueShape() : ItemKey::Builder::opaqueShape().withInvisible()); }
68+ template <> const Item::Bound payloadGetBound(const AnimDebugDrawData::Pointer& data) { return data->_bound; }
6669 template <> void payloadRender(const AnimDebugDrawData::Pointer& data, RenderArgs* args) {
6770 data->render(args);
6871 }
@@ -389,6 +392,13 @@ void AnimDebugDraw::update() { · 320 unmodified lines
389392
390393 assert(numVerts == (v - verts));
391394
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;
392402 data._indexBuffer->resize(sizeof(uint16_t) * numVerts);
393403 uint16_t* indices = (uint16_t*)data._indexBuffer->editData();
394404 for (int i = 0; i < numVerts; i++) {