provide interface to workaround hpr problem

This commit is contained in:
David Rose 2001-06-02 01:36:43 +00:00
parent 6105c9ab33
commit 03b2acbfd2
3 changed files with 45 additions and 15 deletions

View File

@ -904,20 +904,6 @@ set_hpr(const NodePath &other, float h, float p, float r) {
set_hpr(other, LPoint3f(h, p, r));
}
////////////////////////////////////////////////////////////////////
// Function: NodePath::get_hpr
// Access: Public
// Description: Returns the relative orientation of the bottom node
// as seen from the other node.
////////////////////////////////////////////////////////////////////
INLINE LVecBase3f NodePath::
get_hpr(const NodePath &other) const {
LMatrix4f mat = get_mat(other);
LVector3f scale, hpr, pos;
decompose_matrix(mat, scale, hpr, pos);
return hpr;
}
INLINE float NodePath::
get_h(const NodePath &other) const {
return get_hpr(other)[0];

View File

@ -1327,6 +1327,20 @@ get_hpr() const {
return hpr;
}
////////////////////////////////////////////////////////////////////
// Function: NodePath::get_hpr
// Access: Public
// Description: Retrieves the rotation component of the transform.
////////////////////////////////////////////////////////////////////
LVecBase3f NodePath::
get_hpr(float roll) const {
nassertr(has_arcs(), LVecBase3f(0.0, 0.0, 0.0));
LMatrix4f mat = get_mat();
LVecBase3f scale, hpr, pos;
decompose_matrix(mat, scale, hpr, pos, roll);
return hpr;
}
////////////////////////////////////////////////////////////////////
// Function: NodePath::set_scale
// Access: Public
@ -1752,6 +1766,34 @@ set_r(const NodePath &other, float r) {
set_mat(other, mat);
}
////////////////////////////////////////////////////////////////////
// Function: NodePath::get_hpr
// Access: Public
// Description: Returns the relative orientation of the bottom node
// as seen from the other node.
////////////////////////////////////////////////////////////////////
LVecBase3f NodePath::
get_hpr(const NodePath &other) const {
LMatrix4f mat = get_mat(other);
LVector3f scale, hpr, pos;
decompose_matrix(mat, scale, hpr, pos);
return hpr;
}
////////////////////////////////////////////////////////////////////
// Function: NodePath::get_hpr
// Access: Public
// Description: Returns the relative orientation of the bottom node
// as seen from the other node.
////////////////////////////////////////////////////////////////////
LVecBase3f NodePath::
get_hpr(const NodePath &other, float roll) const {
LMatrix4f mat = get_mat(other);
LVector3f scale, hpr, pos;
decompose_matrix(mat, scale, hpr, pos, roll);
return hpr;
}
////////////////////////////////////////////////////////////////////
// Function: NodePath::set_scale
// Access: Public

View File

@ -285,6 +285,7 @@ PUBLISHED:
void set_p(float p);
void set_r(float r);
LVecBase3f get_hpr() const;
LVecBase3f get_hpr(float roll) const;
INLINE float get_h() const;
INLINE float get_p() const;
INLINE float get_r() const;
@ -368,7 +369,8 @@ PUBLISHED:
void set_h(const NodePath &other, float h);
void set_p(const NodePath &other, float p);
void set_r(const NodePath &other, float r);
INLINE LVecBase3f get_hpr(const NodePath &other) const;
LVecBase3f get_hpr(const NodePath &other) const;
LVecBase3f get_hpr(const NodePath &other, float roll) const;
INLINE float get_h(const NodePath &other) const;
INLINE float get_p(const NodePath &other) const;
INLINE float get_r(const NodePath &other) const;