mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
remove look_at_preserve_scale
This commit is contained in:
parent
3142a673e7
commit
f38fcb0429
@ -705,34 +705,6 @@ heads_up(float x, float y, float z) {
|
|||||||
heads_up(LPoint3f(x, y, z));
|
heads_up(LPoint3f(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: qpNodePath::look_at_preserve_scale
|
|
||||||
// Access: Published
|
|
||||||
// Description: Functions like look_at(), but preforms additional
|
|
||||||
// work to preserve any scales that may already be
|
|
||||||
// present on the node. Normally, look_at() blows away
|
|
||||||
// the scale because scale and rotation are represented
|
|
||||||
// in the same part of the matrix.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
INLINE void qpNodePath::
|
|
||||||
look_at_preserve_scale(float x, float y, float z) {
|
|
||||||
look_at_preserve_scale(LPoint3f(x, y, z));
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: qpNodePath::heads_up_preserve_scale
|
|
||||||
// Access: Published
|
|
||||||
// Description: Functions like heads_up(), but preforms additional
|
|
||||||
// work to preserve any scales that may already be
|
|
||||||
// present on the node. Normally, heads_up() blows away
|
|
||||||
// the scale because scale and rotation are represented
|
|
||||||
// in the same part of the matrix.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
INLINE void qpNodePath::
|
|
||||||
heads_up_preserve_scale(float x, float y, float z) {
|
|
||||||
heads_up_preserve_scale(LPoint3f(x, y, z));
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: qpNodePath::set_pos
|
// Function: qpNodePath::set_pos
|
||||||
// Access: Published
|
// Access: Published
|
||||||
@ -863,11 +835,9 @@ set_pos_hpr_scale(const qpNodePath &other,
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: qpNodePath::look_at
|
// Function: qpNodePath::look_at
|
||||||
// Access: Published
|
// Access: Published
|
||||||
// Description: Sets the transform on this qpNodePath so that it
|
// Description: Sets the hpr on this NodePath so that it rotates to
|
||||||
// rotates to face the indicated point in space, which
|
// face the indicated point in space, which is relative
|
||||||
// is relative to the other qpNodePath. This
|
// to the other NodePath.
|
||||||
// will overwrite any previously existing scale on the
|
|
||||||
// node, although it will preserve any translation.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE void qpNodePath::
|
INLINE void qpNodePath::
|
||||||
look_at(const qpNodePath &other, float x, float y, float z) {
|
look_at(const qpNodePath &other, float x, float y, float z) {
|
||||||
@ -886,34 +856,6 @@ heads_up(const qpNodePath &other, float x, float y, float z) {
|
|||||||
heads_up(other, LPoint3f(x, y, z));
|
heads_up(other, LPoint3f(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: qpNodePath::look_at_preserve_scale
|
|
||||||
// Access: Published
|
|
||||||
// Description: Functions like look_at(), but preforms additional
|
|
||||||
// work to preserve any scales that may already be
|
|
||||||
// present on the node. Normally, look_at() blows away
|
|
||||||
// the scale because scale and rotation are represented
|
|
||||||
// in the same part of the matrix.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
INLINE void qpNodePath::
|
|
||||||
look_at_preserve_scale(const qpNodePath &other, float x, float y, float z) {
|
|
||||||
look_at_preserve_scale(other, LPoint3f(x, y, z));
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: qpNodePath::heads_up_preserve_scale
|
|
||||||
// Access: Published
|
|
||||||
// Description: Functions like heads_up(), but preforms additional
|
|
||||||
// work to preserve any scales that may already be
|
|
||||||
// present on the node. Normally, heads_up() blows away
|
|
||||||
// the scale because scale and rotation are represented
|
|
||||||
// in the same part of the matrix.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
INLINE void qpNodePath::
|
|
||||||
heads_up_preserve_scale(const qpNodePath &other, float x, float y, float z) {
|
|
||||||
heads_up_preserve_scale(other, LPoint3f(x, y, z));
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: qpNodePath::get_distance
|
// Function: qpNodePath::get_distance
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -710,11 +710,8 @@ get_color_scale() const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: qpNodePath::look_at
|
// Function: qpNodePath::look_at
|
||||||
// Access: Published
|
// Access: Published
|
||||||
// Description: Sets the transform on this qpNodePath so that it
|
// Description: Sets the hpr on this qpNodePath so that it
|
||||||
// rotates to face the indicated point in space. This
|
// rotates to face the indicated point in space.
|
||||||
// will overwrite any previously existing scale on the
|
|
||||||
// node, although it will preserve any translation. See
|
|
||||||
// also look_at_preserve_scale().
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void qpNodePath::
|
void qpNodePath::
|
||||||
look_at(const LPoint3f &point, const LVector3f &up) {
|
look_at(const LPoint3f &point, const LVector3f &up) {
|
||||||
@ -722,10 +719,12 @@ look_at(const LPoint3f &point, const LVector3f &up) {
|
|||||||
|
|
||||||
LPoint3f pos = get_pos();
|
LPoint3f pos = get_pos();
|
||||||
|
|
||||||
LMatrix4f mat;
|
LMatrix3f mat;
|
||||||
::look_at(mat, point - pos, up);
|
::look_at(mat, point - pos, up);
|
||||||
mat.set_row(3, pos);
|
LVecBase3f scale, hpr;
|
||||||
set_mat(mat);
|
decompose_matrix(mat, scale, hpr);
|
||||||
|
|
||||||
|
set_hpr(hpr);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -741,107 +740,12 @@ heads_up(const LPoint3f &point, const LVector3f &up) {
|
|||||||
|
|
||||||
LPoint3f pos = get_pos();
|
LPoint3f pos = get_pos();
|
||||||
|
|
||||||
LMatrix4f mat;
|
LMatrix3f mat;
|
||||||
::heads_up(mat, point - pos, up);
|
::heads_up(mat, point - pos, up);
|
||||||
mat.set_row(3, pos);
|
LVecBase3f scale, hpr;
|
||||||
set_mat(mat);
|
decompose_matrix(mat, scale, hpr);
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
set_hpr(hpr);
|
||||||
// Function: qpNodePath::look_at_preserve_scale
|
|
||||||
// Access: Published
|
|
||||||
// Description: Functions like look_at(), but preforms additional
|
|
||||||
// work to preserve any scales that may already be
|
|
||||||
// present on the node. Normally, look_at() blows away
|
|
||||||
// the scale because scale and rotation are represented
|
|
||||||
// in the same part of the matrix.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
void qpNodePath::
|
|
||||||
look_at_preserve_scale(const LPoint3f &point, const LVector3f &up) {
|
|
||||||
nassertv(!is_empty());
|
|
||||||
|
|
||||||
LMatrix4f mat = get_mat();
|
|
||||||
|
|
||||||
// Extract the axes from the matrix.
|
|
||||||
LVector3f x, y, z;
|
|
||||||
|
|
||||||
mat.get_row3(x,0);
|
|
||||||
mat.get_row3(y,1);
|
|
||||||
mat.get_row3(z,2);
|
|
||||||
|
|
||||||
// The lengths of the axes defines the scale.
|
|
||||||
|
|
||||||
float scale_0 = length(x);
|
|
||||||
float scale_1 = length(y);
|
|
||||||
float scale_2 = length(z);
|
|
||||||
|
|
||||||
LPoint3f pos;
|
|
||||||
mat.get_row3(pos,3);
|
|
||||||
::look_at(mat, point - pos, up);
|
|
||||||
|
|
||||||
// Now reapply the scale and position.
|
|
||||||
|
|
||||||
mat.get_row3(x,0);
|
|
||||||
mat.get_row3(y,1);
|
|
||||||
mat.get_row3(z,2);
|
|
||||||
|
|
||||||
x *= scale_0;
|
|
||||||
y *= scale_1;
|
|
||||||
z *= scale_2;
|
|
||||||
|
|
||||||
mat.set_row(0, x);
|
|
||||||
mat.set_row(1, y);
|
|
||||||
mat.set_row(2, z);
|
|
||||||
mat.set_row(3, pos);
|
|
||||||
set_mat(mat);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: qpNodePath::heads_up_preserve_scale
|
|
||||||
// Access: Published
|
|
||||||
// Description: Functions like heads_up(), but preforms additional
|
|
||||||
// work to preserve any scales that may already be
|
|
||||||
// present on the node. Normally, heads_up() blows away
|
|
||||||
// the scale because scale and rotation are represented
|
|
||||||
// in the same part of the matrix.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
void qpNodePath::
|
|
||||||
heads_up_preserve_scale(const LPoint3f &point, const LVector3f &up) {
|
|
||||||
nassertv(!is_empty());
|
|
||||||
|
|
||||||
LMatrix4f mat = get_mat();
|
|
||||||
|
|
||||||
// Extract the axes from the matrix.
|
|
||||||
LVector3f x, y, z;
|
|
||||||
mat.get_row3(x,0);
|
|
||||||
mat.get_row3(y,1);
|
|
||||||
mat.get_row3(z,2);
|
|
||||||
|
|
||||||
float scale_0 = length(x);
|
|
||||||
float scale_1 = length(y);
|
|
||||||
float scale_2 = length(z);
|
|
||||||
|
|
||||||
// The lengths of the axes defines the scale.
|
|
||||||
LPoint3f pos;
|
|
||||||
mat.get_row3(pos,3);
|
|
||||||
|
|
||||||
::heads_up(mat, point - pos, up);
|
|
||||||
|
|
||||||
// Now reapply the scale and position.
|
|
||||||
|
|
||||||
mat.get_row3(x,0);
|
|
||||||
mat.get_row3(y,1);
|
|
||||||
mat.get_row3(z,2);
|
|
||||||
|
|
||||||
x *= scale_0;
|
|
||||||
y *= scale_1;
|
|
||||||
z *= scale_2;
|
|
||||||
|
|
||||||
mat.set_row(0, x);
|
|
||||||
mat.set_row(1, y);
|
|
||||||
mat.set_row(2, z);
|
|
||||||
mat.set_row(3, pos);
|
|
||||||
set_mat(mat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -1131,15 +1035,17 @@ void qpNodePath::
|
|||||||
look_at(const qpNodePath &other, const LPoint3f &point, const LVector3f &up) {
|
look_at(const qpNodePath &other, const LPoint3f &point, const LVector3f &up) {
|
||||||
nassertv(!is_empty());
|
nassertv(!is_empty());
|
||||||
|
|
||||||
LPoint3f pos = get_pos();
|
|
||||||
|
|
||||||
qpNodePath parent = get_parent();
|
qpNodePath parent = get_parent();
|
||||||
LPoint3f rel_point = point * other.get_mat(parent);
|
LPoint3f rel_point = point * other.get_mat(parent);
|
||||||
|
|
||||||
LMatrix4f mat;
|
LPoint3f pos = get_pos();
|
||||||
|
|
||||||
|
LMatrix3f mat;
|
||||||
::look_at(mat, rel_point - pos, up);
|
::look_at(mat, rel_point - pos, up);
|
||||||
mat.set_row(3, pos);
|
LVecBase3f scale, hpr;
|
||||||
set_mat(mat);
|
decompose_matrix(mat, scale, hpr);
|
||||||
|
|
||||||
|
set_hpr(hpr);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -1153,118 +1059,17 @@ void qpNodePath::
|
|||||||
heads_up(const qpNodePath &other, const LPoint3f &point, const LVector3f &up) {
|
heads_up(const qpNodePath &other, const LPoint3f &point, const LVector3f &up) {
|
||||||
nassertv(!is_empty());
|
nassertv(!is_empty());
|
||||||
|
|
||||||
|
qpNodePath parent = get_parent();
|
||||||
|
LPoint3f rel_point = point * other.get_mat(parent);
|
||||||
|
|
||||||
LPoint3f pos = get_pos();
|
LPoint3f pos = get_pos();
|
||||||
|
|
||||||
qpNodePath parent = get_parent();
|
LMatrix3f mat;
|
||||||
LPoint3f rel_point = point * other.get_mat(parent);
|
|
||||||
|
|
||||||
LMatrix4f mat;
|
|
||||||
::heads_up(mat, rel_point - pos, up);
|
::heads_up(mat, rel_point - pos, up);
|
||||||
mat.set_row(3, pos);
|
LVecBase3f scale, hpr;
|
||||||
set_mat(mat);
|
decompose_matrix(mat, scale, hpr);
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
set_hpr(hpr);
|
||||||
// Function: qpNodePath::look_at_preserve_scale
|
|
||||||
// Access: Published
|
|
||||||
// Description: Functions like look_at(), but preforms additional
|
|
||||||
// work to preserve any scales that may already be
|
|
||||||
// present on the node. Normally, look_at() blows away
|
|
||||||
// the scale because scale and rotation are represented
|
|
||||||
// in the same part of the matrix.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
void qpNodePath::
|
|
||||||
look_at_preserve_scale(const qpNodePath &other, const LPoint3f &point,
|
|
||||||
const LVector3f &up) {
|
|
||||||
nassertv(!is_empty());
|
|
||||||
|
|
||||||
LMatrix4f mat = get_mat();
|
|
||||||
|
|
||||||
// Extract the axes from the matrix.
|
|
||||||
LVector3f x, y, z;
|
|
||||||
mat.get_row3(x,0);
|
|
||||||
mat.get_row3(y,1);
|
|
||||||
mat.get_row3(z,2);
|
|
||||||
|
|
||||||
// The lengths of the axes defines the scale.
|
|
||||||
float scale_0 = length(x);
|
|
||||||
float scale_1 = length(y);
|
|
||||||
float scale_2 = length(z);
|
|
||||||
|
|
||||||
LPoint3f pos;
|
|
||||||
mat.get_row3(pos,3);
|
|
||||||
|
|
||||||
qpNodePath parent = get_parent();
|
|
||||||
LPoint3f rel_point = point * other.get_mat(parent);
|
|
||||||
|
|
||||||
::look_at(mat, rel_point - pos, up);
|
|
||||||
|
|
||||||
// Now reapply the scale and position.
|
|
||||||
|
|
||||||
mat.get_row3(x,0);
|
|
||||||
mat.get_row3(y,1);
|
|
||||||
mat.get_row3(z,2);
|
|
||||||
|
|
||||||
x *= scale_0;
|
|
||||||
y *= scale_1;
|
|
||||||
z *= scale_2;
|
|
||||||
|
|
||||||
mat.set_row(0, x);
|
|
||||||
mat.set_row(1, y);
|
|
||||||
mat.set_row(2, z);
|
|
||||||
mat.set_row(3, pos);
|
|
||||||
set_mat(mat);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: qpNodePath::heads_up_preserve_scale
|
|
||||||
// Access: Published
|
|
||||||
// Description: Functions like heads_up(), but preforms additional
|
|
||||||
// work to preserve any scales that may already be
|
|
||||||
// present on the node. Normally, heads_up() blows away
|
|
||||||
// the scale because scale and rotation are represented
|
|
||||||
// in the same part of the matrix.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
void qpNodePath::
|
|
||||||
heads_up_preserve_scale(const qpNodePath &other, const LPoint3f &point,
|
|
||||||
const LVector3f &up) {
|
|
||||||
nassertv(!is_empty());
|
|
||||||
|
|
||||||
LMatrix4f mat = get_mat();
|
|
||||||
|
|
||||||
// Extract the axes from the matrix.
|
|
||||||
LVector3f x, y, z;
|
|
||||||
mat.get_row3(x,0);
|
|
||||||
mat.get_row3(y,1);
|
|
||||||
mat.get_row3(z,2);
|
|
||||||
|
|
||||||
// The lengths of the axes defines the scale.
|
|
||||||
float scale_0 = length(x);
|
|
||||||
float scale_1 = length(y);
|
|
||||||
float scale_2 = length(z);
|
|
||||||
|
|
||||||
LPoint3f pos;
|
|
||||||
mat.get_row3(pos,3);
|
|
||||||
|
|
||||||
qpNodePath parent = get_parent();
|
|
||||||
LPoint3f rel_point = point * other.get_mat(parent);
|
|
||||||
|
|
||||||
::heads_up(mat, rel_point - pos, up);
|
|
||||||
|
|
||||||
// Now reapply the scale and position.
|
|
||||||
mat.get_row3(x,0);
|
|
||||||
mat.get_row3(y,1);
|
|
||||||
mat.get_row3(z,2);
|
|
||||||
|
|
||||||
x *= scale_0;
|
|
||||||
y *= scale_1;
|
|
||||||
z *= scale_2;
|
|
||||||
|
|
||||||
mat.set_row(0, x);
|
|
||||||
mat.set_row(1, y);
|
|
||||||
mat.set_row(2, z);
|
|
||||||
mat.set_row(3, pos);
|
|
||||||
set_mat(mat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -293,11 +293,6 @@ PUBLISHED:
|
|||||||
INLINE void heads_up(float x, float y, float z);
|
INLINE void heads_up(float x, float y, float z);
|
||||||
void heads_up(const LPoint3f &point, const LVector3f &up = LVector3f::up());
|
void heads_up(const LPoint3f &point, const LVector3f &up = LVector3f::up());
|
||||||
|
|
||||||
INLINE void look_at_preserve_scale(float x, float y, float z);
|
|
||||||
void look_at_preserve_scale(const LPoint3f &point, const LVector3f &up = LVector3f::up());
|
|
||||||
INLINE void heads_up_preserve_scale(float x, float y, float z);
|
|
||||||
void heads_up_preserve_scale(const LPoint3f &point, const LVector3f &up = LVector3f::up());
|
|
||||||
|
|
||||||
// Methods that get and set the matrix transforms relative to some
|
// Methods that get and set the matrix transforms relative to some
|
||||||
// other node in the scene graph. These perform an implicit wrt().
|
// other node in the scene graph. These perform an implicit wrt().
|
||||||
|
|
||||||
@ -369,17 +364,6 @@ PUBLISHED:
|
|||||||
const LPoint3f &point = LPoint3f(0.0, 0.0, 0.0),
|
const LPoint3f &point = LPoint3f(0.0, 0.0, 0.0),
|
||||||
const LVector3f &up = LVector3f::up());
|
const LVector3f &up = LVector3f::up());
|
||||||
|
|
||||||
INLINE void look_at_preserve_scale(const qpNodePath &other,
|
|
||||||
float x, float y, float z);
|
|
||||||
void look_at_preserve_scale(const qpNodePath &other,
|
|
||||||
const LPoint3f &point = LPoint3f(0.0, 0.0, 0.0),
|
|
||||||
const LVector3f &up = LVector3f::up());
|
|
||||||
INLINE void heads_up_preserve_scale(const qpNodePath &other,
|
|
||||||
float x, float y, float z);
|
|
||||||
void heads_up_preserve_scale(const qpNodePath &other,
|
|
||||||
const LPoint3f &point = LPoint3f(0.0, 0.0, 0.0),
|
|
||||||
const LVector3f &up = LVector3f::up());
|
|
||||||
|
|
||||||
INLINE float get_distance(const qpNodePath &other) const;
|
INLINE float get_distance(const qpNodePath &other) const;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user