| 79 | } |
| 80 | |
| 81 | MatrixF AssimpAppNode::getTransform(F32 time) |
| 82 | { |
| 83 | // Check if we can use the last computed transform |
| 84 | if (time == mLastTransformTime) |
| 85 | return mLastTransform; |
| 86 | |
| 87 | if (appParent) { |
| 88 | // Get parent node's transform |
| 89 | mLastTransform = appParent->getTransform(time); |
| 90 | } |
| 91 | else { |
| 92 | // no parent (ie. root level) => scale by global shape <unit> |
| 93 | mLastTransform.identity(); |
| 94 | mLastTransform.scale(ColladaUtils::getOptions().unit * ColladaUtils::getOptions().formatScaleFactor); |
| 95 | if (!isBounds()) |
| 96 | convertMat(mLastTransform); |
| 97 | } |
| 98 | |
| 99 | // If this node is animated in the active sequence, fetch the animated transform |
| 100 | MatrixF mat(true); |
| 101 | if (sActiveSequence) |
| 102 | getAnimatedTransform(mat, time, sActiveSequence); |
| 103 | else |
| 104 | mat = mNodeTransform; |
| 105 | |
| 106 | // Remove node scaling? |
| 107 | Point3F nodeScale = mat.getScale(); |
| 108 | if (nodeScale != Point3F::One && appParent && ColladaUtils::getOptions().ignoreNodeScale) |
| 109 | { |
| 110 | nodeScale.x = nodeScale.x ? (1.0f / nodeScale.x) : 0; |
| 111 | nodeScale.y = nodeScale.y ? (1.0f / nodeScale.y) : 0; |
| 112 | nodeScale.z = nodeScale.z ? (1.0f / nodeScale.z) : 0; |
| 113 | mat.scale(nodeScale); |
| 114 | } |
| 115 | |
| 116 | mLastTransform.mul(mat); |
| 117 | |
| 118 | mLastTransformTime = time; |
| 119 | return mLastTransform; |
| 120 | } |
| 121 | |
| 122 | void AssimpAppNode::getAnimatedTransform(MatrixF& mat, F32 t, aiAnimation* animSeq) |
| 123 | { |
no test coverage detected