| 86 | } |
| 87 | |
| 88 | void ActionCamera::updateTransform() |
| 89 | { |
| 90 | Mat4 lookupMatrix; |
| 91 | Mat4::createLookAt(_eye.x, _eye.y, _eye.z, _center.x, _center.y, _center.z, _up.x, _up.y, _up.z, &lookupMatrix); |
| 92 | |
| 93 | Vec2 anchorPoint = _target->getAnchorPointInPoints(); |
| 94 | |
| 95 | bool needsTranslation = !anchorPoint.isZero(); |
| 96 | |
| 97 | Mat4 mv = Mat4::IDENTITY; |
| 98 | |
| 99 | if (needsTranslation) |
| 100 | { |
| 101 | Mat4 t; |
| 102 | Mat4::createTranslation(anchorPoint.x, anchorPoint.y, 0, &t); |
| 103 | mv = mv * t; |
| 104 | } |
| 105 | |
| 106 | mv = mv * lookupMatrix; |
| 107 | |
| 108 | if (needsTranslation) |
| 109 | { |
| 110 | Mat4 t; |
| 111 | Mat4::createTranslation(-anchorPoint.x, -anchorPoint.y, 0, &t); |
| 112 | mv = mv * t; |
| 113 | } |
| 114 | |
| 115 | // FIXME: Using the AdditionalTransform is a complete hack. |
| 116 | // This should be done by multiplying the lookup-Matrix with the Node's MV matrix |
| 117 | // And then setting the result as the new MV matrix |
| 118 | // But that operation needs to be done after all the 'updates'. |
| 119 | // So the Director should emit an 'director_after_update' event. |
| 120 | // And this object should listen to it |
| 121 | _target->setAdditionalTransform(&mv); |
| 122 | } |
| 123 | |
| 124 | // |
| 125 | // OrbitCamera |
nothing calls this directly
no test coverage detected