History

Encapsulate AnimPose members for easier optimizations

Brad Davis committed 9 years ago

Commit e5e9ab41 parent b56a15b14 files · +179 −149Browse files

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

Unified · Split

libraries/render-utils/src/AnimDebugDraw.cpp+6−6
@@ -168,7 +168,7 @@ static void addBone(const AnimPose& rootPose, const AnimPose& pose, float radius · 167 unmodified lines
168 const uint32_t color = toRGBA(vecColor);168 const uint32_t color = toRGBA(vecColor);
169 169
170 AnimPose finalPose = rootPose * pose;170 AnimPose finalPose = rootPose * pose;
171 glm::vec3 base = rootPose * pose.trans;171 glm::vec3 base = rootPose * pose.trans();
172 172
173 glm::vec3 xRing[NUM_CIRCLE_SLICES + 1]; // one extra for last index.173 glm::vec3 xRing[NUM_CIRCLE_SLICES + 1]; // one extra for last index.
174 glm::vec3 yRing[NUM_CIRCLE_SLICES + 1];174 glm::vec3 yRing[NUM_CIRCLE_SLICES + 1];
@@ -245,7 +245,7 @@ static void addLink(const AnimPose& rootPose, const AnimPose& pose, const AnimPo · 70 unmodified lines
245 AnimPose pose0 = rootPose * parentPose;245 AnimPose pose0 = rootPose * parentPose;
246 AnimPose pose1 = rootPose * pose;246 AnimPose pose1 = rootPose * pose;
247 247
248 glm::vec3 boneAxisWorld = glm::normalize(pose1.trans - pose0.trans);248 glm::vec3 boneAxisWorld = glm::normalize(pose1.trans() - pose0.trans());
249 glm::vec3 boneAxis0 = glm::normalize(pose0.inverse().xformVector(boneAxisWorld));249 glm::vec3 boneAxis0 = glm::normalize(pose0.inverse().xformVector(boneAxisWorld));
250 glm::vec3 boneAxis1 = glm::normalize(pose1.inverse().xformVector(boneAxisWorld));250 glm::vec3 boneAxis1 = glm::normalize(pose1.inverse().xformVector(boneAxisWorld));
251 251
@@ -255,7 +255,7 @@ static void addLink(const AnimPose& rootPose, const AnimPose& pose, const AnimPo · 3 unmodified lines
255 const int NUM_BASE_CORNERS = 4;255 const int NUM_BASE_CORNERS = 4;
256 256
257 // make sure there's room between the two bones to draw a nice bone link.257 // make sure there's room between the two bones to draw a nice bone link.
258 if (glm::dot(boneTip - pose0.trans, boneAxisWorld) > glm::dot(boneBase - pose0.trans, boneAxisWorld)) {258 if (glm::dot(boneTip - pose0.trans(), boneAxisWorld) > glm::dot(boneBase - pose0.trans(), boneAxisWorld)) {
259 259
260 // there is room, so lets draw a nice bone260 // there is room, so lets draw a nice bone
261 261
@@ -290,10 +290,10 @@ static void addLink(const AnimPose& rootPose, const AnimPose& pose, const AnimPo · 28 unmodified lines
290 // just draw a line between the two bone centers.290 // just draw a line between the two bone centers.
291 // We add the same line multiple times, so the vertex count is correct.291 // We add the same line multiple times, so the vertex count is correct.
292 for (int i = 0; i < NUM_BASE_CORNERS * 2; i++) {292 for (int i = 0; i < NUM_BASE_CORNERS * 2; i++) {
293 v->pos = pose0.trans;293 v->pos = pose0.trans();
294 v->rgba = color;294 v->rgba = color;
295 v++;295 v++;
296 v->pos = pose1.trans;296 v->pos = pose1.trans();
297 v->rgba = color;297 v->rgba = color;
298 v++;298 v++;
299 }299 }
@@ -365,7 +365,7 @@ void AnimDebugDraw::update() { · 65 unmodified lines
365 glm::vec4 color = std::get<3>(iter.second);365 glm::vec4 color = std::get<3>(iter.second);
366 366
367 for (int i = 0; i < skeleton->getNumJoints(); i++) {367 for (int i = 0; i < skeleton->getNumJoints(); i++) {
368 const float radius = BONE_RADIUS / (absPoses[i].scale.x * rootPose.scale.x);368 const float radius = BONE_RADIUS / (absPoses[i].scale().x * rootPose.scale().x);
369 369
370 // draw bone370 // draw bone
371 addBone(rootPose, absPoses[i], radius, color, v);371 addBone(rootPose, absPoses[i], radius, color, v);