Skip to content

Commit

Permalink
GRAPHICS: Add ModelNode::getWorldPosition()
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Dec 25, 2012
1 parent 24094de commit 6656155
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/graphics/aurora/modelnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ void ModelNode::getAbsolutePosition(float &x, float &y, float &z) const {
z = _absolutePosition.getZ() * _model->_modelScale[2];
}

void ModelNode::getWorldPosition(float &x, float &y, float &z) const {
Common::TransformationMatrix pos = _model->_absolutePosition;

pos.transform(_absolutePosition);

x = pos.getX();
y = pos.getY();
z = pos.getZ();
}

void ModelNode::setPosition(float x, float y, float z) {
GfxMan.lockFrame();

Expand Down
2 changes: 2 additions & 0 deletions src/graphics/aurora/modelnode.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ class ModelNode {

/** Get the position of the node after translate/rotate. */
void getAbsolutePosition(float &x, float &y, float &z) const;
/** Get the position of the node in the world, instead of relative to the parent model. */
void getWorldPosition(float &x, float &y, float &z) const;

/** Set the position of the node. */
void setPosition(float x, float y, float z);
Expand Down

0 comments on commit 6656155

Please sign in to comment.