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
168168 const uint32_t color = toRGBA(vecColor);
169169
170170 AnimPose finalPose = rootPose * pose;
171− glm::vec3 base = rootPose * pose.trans;
171+ glm::vec3 base = rootPose * pose.trans();
172172
173173 glm::vec3 xRing[NUM_CIRCLE_SLICES + 1]; // one extra for last index.
174174 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
245245 AnimPose pose0 = rootPose * parentPose;
246246 AnimPose pose1 = rootPose * pose;
247247
248− glm::vec3 boneAxisWorld = glm::normalize(pose1.trans - pose0.trans);
248+ glm::vec3 boneAxisWorld = glm::normalize(pose1.trans() - pose0.trans());
249249 glm::vec3 boneAxis0 = glm::normalize(pose0.inverse().xformVector(boneAxisWorld));
250250 glm::vec3 boneAxis1 = glm::normalize(pose1.inverse().xformVector(boneAxisWorld));
251251
@@ -255,7 +255,7 @@ static void addLink(const AnimPose& rootPose, const AnimPose& pose, const AnimPo · 3 unmodified lines
255255 const int NUM_BASE_CORNERS = 4;
256256
257257 // 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)) {
259259
260260 // there is room, so lets draw a nice bone
261261
@@ -290,10 +290,10 @@ static void addLink(const AnimPose& rootPose, const AnimPose& pose, const AnimPo · 28 unmodified lines
290290 // just draw a line between the two bone centers.
291291 // We add the same line multiple times, so the vertex count is correct.
292292 for (int i = 0; i < NUM_BASE_CORNERS * 2; i++) {
293− v->pos = pose0.trans;
293+ v->pos = pose0.trans();
294294 v->rgba = color;
295295 v++;
296− v->pos = pose1.trans;
296+ v->pos = pose1.trans();
297297 v->rgba = color;
298298 v++;
299299 }
@@ -365,7 +365,7 @@ void AnimDebugDraw::update() { · 65 unmodified lines
365365 glm::vec4 color = std::get<3>(iter.second);
366366
367367 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);
369369
370370 // draw bone
371371 addBone(rootPose, absPoses[i], radius, color, v);