Added support in osg::computeWorldToLocal and compteLocalToWorld functions for automatically
stripping any absolute or root CameraNode's from the NodePaths. Added osg::Node::getWorldMatrices() convinience method.
This commit is contained in:
@@ -36,6 +36,8 @@ typedef std::vector< Node* > NodePath;
|
||||
/** A vector of NodePath, typically used to describe all the paths from a node to the potential root nodes it has.*/
|
||||
typedef std::vector< NodePath > NodePathList;
|
||||
|
||||
/** A vector of NodePath, typically used to describe all the paths from a node to the potential root nodes it has.*/
|
||||
typedef std::vector< Matrix > MatrixList;
|
||||
|
||||
/** META_Node macro define the standard clone, isSameKindAs, className
|
||||
* and accept methods. Use when subclassing from Node to make it
|
||||
@@ -89,6 +91,7 @@ class OSG_EXPORT Node : public Object
|
||||
/** Convert 'this' into a Transform pointer if Node is a Transform, otherwise return 0.
|
||||
* Equivalent to dynamic_cast<Transform*>(this).*/
|
||||
virtual Transform* asTransform() { return 0; }
|
||||
|
||||
/** convert 'const this' into a const Transform pointer if Node is a Transform, otherwise return 0.
|
||||
* Equivalent to dynamic_cast<const Transform*>(this).*/
|
||||
virtual const Transform* asTransform() const { return 0; }
|
||||
@@ -129,6 +132,10 @@ class OSG_EXPORT Node : public Object
|
||||
* The optional Node* haltTraversalAtNode allows the user to prevent traversal beyond a specifed node. */
|
||||
NodePathList getParentalNodePaths(osg::Node* haltTraversalAtNode=0) const;
|
||||
|
||||
/** Get the list of matrices that transform this node from local coordinates to world coordinates.
|
||||
* The optional Node* haltTraversalAtNode allows the user to prevent traversal beyond a specifed node. */
|
||||
MatrixList getWorldMatrices(osg::Node* haltTraversalAtNode=0) const;
|
||||
|
||||
|
||||
/** Set update node callback, called during update traversal. */
|
||||
void setUpdateCallback(NodeCallback* nc);
|
||||
|
||||
@@ -28,24 +28,24 @@ namespace osg {
|
||||
/** Compute the matrix which transforms objects in local coords to world coords,
|
||||
* by accumulating the Transform local to world matrices along the specified node path.
|
||||
*/
|
||||
extern OSG_EXPORT Matrix computeLocalToWorld(const NodePath& nodePath);
|
||||
extern OSG_EXPORT Matrix computeLocalToWorld(const NodePath& nodePath, bool ignoreCameraNodes = true);
|
||||
|
||||
/** Compute the matrix which transforms objects in world coords to local coords,
|
||||
* by accumulating the Transform world to local matrices along the specified node path.
|
||||
*/
|
||||
extern OSG_EXPORT Matrix computeWorldToLocal(const NodePath& nodePath);
|
||||
extern OSG_EXPORT Matrix computeWorldToLocal(const NodePath& nodePath, bool ignoreCameraNodes = true);
|
||||
|
||||
/** Compute the matrix which transforms objects in local coords to eye coords,
|
||||
* by accumulating the Transform local to world matrices along the specified node path
|
||||
* and multipling by the supplied initial camera modelview.
|
||||
*/
|
||||
extern OSG_EXPORT Matrix computeLocalToEye(const Matrix& modelview, const NodePath& nodePath);
|
||||
extern OSG_EXPORT Matrix computeLocalToEye(const Matrix& modelview, const NodePath& nodePath, bool ignoreCameraNodes = true);
|
||||
|
||||
/** Compute the matrix which transforms objects in eye coords to local coords,
|
||||
* by accumulating the Transform world to local matrices along the specified node path
|
||||
* and multipling by the inverse of the supplied initialial camera modelview.
|
||||
*/
|
||||
extern OSG_EXPORT Matrix computeEyeToLocal(const Matrix& modelview, const NodePath& nodePath);
|
||||
extern OSG_EXPORT Matrix computeEyeToLocal(const Matrix& modelview, const NodePath& nodePath, bool ignoreCameraNodes = true);
|
||||
|
||||
|
||||
/** A Transform is a group node for which all children are transformed by
|
||||
|
||||
Reference in New Issue
Block a user