mirror of https://github.com/axmolengine/axmol.git
remove kmMat4 in ActionCamera.cpp
This commit is contained in:
parent
e5802a56da
commit
554ede75f0
|
@ -91,28 +91,28 @@ void ActionCamera::setUp(const kmVec3& up)
|
||||||
|
|
||||||
void ActionCamera::updateTransform()
|
void ActionCamera::updateTransform()
|
||||||
{
|
{
|
||||||
kmMat4 lookupMatrix;
|
Matrix lookupMatrix;
|
||||||
kmMat4LookAt(&lookupMatrix, &_eye, &_center, &_up);
|
Matrix::createLookAt(_eye.x, _eye.y, _eye.z, _center.x, _center.y, _center.z, _up.x, _up.y, _up.z, &lookupMatrix);
|
||||||
|
|
||||||
Point anchorPoint = _target->getAnchorPointInPoints();
|
Point anchorPoint = _target->getAnchorPointInPoints();
|
||||||
|
|
||||||
bool needsTranslation = !anchorPoint.equals(Point::ZERO);
|
bool needsTranslation = !anchorPoint.equals(Point::ZERO);
|
||||||
|
|
||||||
kmMat4 mv;
|
Matrix mv = Matrix::identity();
|
||||||
kmMat4Identity(&mv);
|
|
||||||
|
|
||||||
if(needsTranslation) {
|
if(needsTranslation) {
|
||||||
kmMat4 t;
|
Matrix t;
|
||||||
kmMat4Translation(&t, anchorPoint.x, anchorPoint.y, 0);
|
Matrix::createTranslation(anchorPoint.x, anchorPoint.y, 0, &t);
|
||||||
kmMat4Multiply(&mv, &mv, &t);
|
mv = mv * t;
|
||||||
}
|
}
|
||||||
|
|
||||||
kmMat4Multiply(&mv, &mv, &lookupMatrix);
|
mv = mv * lookupMatrix;
|
||||||
|
|
||||||
if(needsTranslation) {
|
if(needsTranslation) {
|
||||||
kmMat4 t;
|
|
||||||
kmMat4Translation(&t, -anchorPoint.x, -anchorPoint.y, 0);
|
Matrix t;
|
||||||
kmMat4Multiply(&mv, &mv, &t);
|
Matrix::createTranslation(-anchorPoint.x, -anchorPoint.y, 0, &t);
|
||||||
|
mv = mv * t;
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX FIXME TODO
|
// XXX FIXME TODO
|
||||||
|
@ -122,8 +122,7 @@ void ActionCamera::updateTransform()
|
||||||
// But that operation needs to be done after all the 'updates'.
|
// But that operation needs to be done after all the 'updates'.
|
||||||
// So the Director should emit an 'director_after_update' event.
|
// So the Director should emit an 'director_after_update' event.
|
||||||
// And this object should listen to it
|
// And this object should listen to it
|
||||||
Matrix mv2 = mv;
|
_target->setAdditionalTransform(&mv);
|
||||||
_target->setAdditionalTransform(&mv2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue