mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-17 01:42:14 -04:00
like that
This commit is contained in:
parent
1facd208fd
commit
08315e791d
@ -41,12 +41,11 @@ private:
|
|||||||
|
|
||||||
template <class value>
|
template <class value>
|
||||||
class SimpleLerpFunctor : public LerpFunctor {
|
class SimpleLerpFunctor : public LerpFunctor {
|
||||||
private:
|
protected:
|
||||||
value _start;
|
value _start;
|
||||||
value _end;
|
value _end;
|
||||||
value _diff_cache;
|
value _diff_cache;
|
||||||
|
|
||||||
protected:
|
|
||||||
value interpolate(float);
|
value interpolate(float);
|
||||||
SimpleLerpFunctor(value start, value end) : LerpFunctor(), _start(start),
|
SimpleLerpFunctor(value start, value end) : LerpFunctor(), _start(start),
|
||||||
_end(end), _diff_cache(end-start)
|
_end(end), _diff_cache(end-start)
|
||||||
|
@ -37,6 +37,26 @@ void PosLerpFunctor::operator()(float t) {
|
|||||||
HprLerpFunctor::HprLerpFunctor(const HprLerpFunctor& c)
|
HprLerpFunctor::HprLerpFunctor(const HprLerpFunctor& c)
|
||||||
: LVecBase3fLerpFunctor(c), _node_path(c._node_path) {}
|
: LVecBase3fLerpFunctor(c), _node_path(c._node_path) {}
|
||||||
|
|
||||||
|
void HprLerpFunctor::take_shortest(void) {
|
||||||
|
// so long as these are actually degrees
|
||||||
|
for (int i=0; i!=3; ++i)
|
||||||
|
if (this->_diff_cache[i] < -180.)
|
||||||
|
_start[i] -= 360.;
|
||||||
|
else if (this->_diff_cache[i] > 180.)
|
||||||
|
_start[i] += 360.;
|
||||||
|
this->_diff_cache = this->_end - this->_start;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HprLerpFunctor::take_longest(void) {
|
||||||
|
// so long as these are actually degrees
|
||||||
|
for (int i=0; i!=3; ++i)
|
||||||
|
if ((this->_diff_cache[i] < 0.) && (this->_diff_cache[i] > -180.))
|
||||||
|
_start[i] -= 360.;
|
||||||
|
else if ((this->_diff_cache[i] >= 0.) && (this->_diff_cache[i] < 180))
|
||||||
|
_start[i] += 360.;
|
||||||
|
this->_diff_cache = this->_end - this->_start;
|
||||||
|
}
|
||||||
|
|
||||||
HprLerpFunctor::~HprLerpFunctor(void)
|
HprLerpFunctor::~HprLerpFunctor(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -95,6 +115,26 @@ void ColorLerpFunctor::operator()(float t) {
|
|||||||
PosHprLerpFunctor::PosHprLerpFunctor(const PosHprLerpFunctor& c)
|
PosHprLerpFunctor::PosHprLerpFunctor(const PosHprLerpFunctor& c)
|
||||||
: LerpFunctor(c), _node_path(c._node_path) {}
|
: LerpFunctor(c), _node_path(c._node_path) {}
|
||||||
|
|
||||||
|
void PosHprLerpFunctor::take_shortest(void) {
|
||||||
|
// so long as these are actually degrees
|
||||||
|
for (int i=0; i!=3; ++i)
|
||||||
|
if (this->_hdiff_cache[i] < -180.)
|
||||||
|
_hstart[i] -= 360.;
|
||||||
|
else if (this->_hdiff_cache[i] > 180.)
|
||||||
|
_hstart[i] += 360.;
|
||||||
|
this->_hdiff_cache = this->_hend - this->_hstart;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PosHprLerpFunctor::take_longest(void) {
|
||||||
|
// so long as these are actually degrees
|
||||||
|
for (int i=0; i!=3; ++i)
|
||||||
|
if ((this->_hdiff_cache[i] < 0.) && (this->_hdiff_cache[i] > -180.))
|
||||||
|
_hstart[i] -= 360.;
|
||||||
|
else if ((this->_hdiff_cache[i] >= 0.) && (this->_hdiff_cache[i] < 180))
|
||||||
|
_hstart[i] += 360.;
|
||||||
|
this->_hdiff_cache = this->_hend - this->_hstart;
|
||||||
|
}
|
||||||
|
|
||||||
PosHprLerpFunctor::~PosHprLerpFunctor(void)
|
PosHprLerpFunctor::~PosHprLerpFunctor(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -123,6 +163,26 @@ void PosHprLerpFunctor::operator()(float t) {
|
|||||||
PosHprScaleLerpFunctor::PosHprScaleLerpFunctor(const PosHprScaleLerpFunctor& c)
|
PosHprScaleLerpFunctor::PosHprScaleLerpFunctor(const PosHprScaleLerpFunctor& c)
|
||||||
: LerpFunctor(c), _node_path(c._node_path) {}
|
: LerpFunctor(c), _node_path(c._node_path) {}
|
||||||
|
|
||||||
|
void PosHprScaleLerpFunctor::take_shortest(void) {
|
||||||
|
// so long as these are actually degrees
|
||||||
|
for (int i=0; i!=3; ++i)
|
||||||
|
if (this->_hdiff_cache[i] < -180.)
|
||||||
|
_hstart[i] -= 360.;
|
||||||
|
else if (this->_hdiff_cache[i] > 180.)
|
||||||
|
_hstart[i] += 360.;
|
||||||
|
this->_hdiff_cache = this->_hend - this->_hstart;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PosHprScaleLerpFunctor::take_longest(void) {
|
||||||
|
// so long as these are actually degrees
|
||||||
|
for (int i=0; i!=3; ++i)
|
||||||
|
if ((this->_hdiff_cache[i] < 0.) && (this->_hdiff_cache[i] > -180.))
|
||||||
|
_hstart[i] -= 360.;
|
||||||
|
else if ((this->_hdiff_cache[i] >= 0.) && (this->_hdiff_cache[i] < 180))
|
||||||
|
_hstart[i] += 360.;
|
||||||
|
this->_hdiff_cache = this->_hend - this->_hstart;
|
||||||
|
}
|
||||||
|
|
||||||
PosHprScaleLerpFunctor::~PosHprScaleLerpFunctor(void)
|
PosHprScaleLerpFunctor::~PosHprScaleLerpFunctor(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -87,6 +87,8 @@ PUBLISHED:
|
|||||||
float ez, NodePath wrt)
|
float ez, NodePath wrt)
|
||||||
: LVecBase3fLerpFunctor(LVecBase3f(sx, sy, sz), LVecBase3f(ex, ey, ez)),
|
: LVecBase3fLerpFunctor(LVecBase3f(sx, sy, sz), LVecBase3f(ex, ey, ez)),
|
||||||
_node_path(np), _is_wrt(true), _wrt_path(wrt) {}
|
_node_path(np), _is_wrt(true), _wrt_path(wrt) {}
|
||||||
|
void take_shortest(void);
|
||||||
|
void take_longest(void);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HprLerpFunctor(const HprLerpFunctor&);
|
HprLerpFunctor(const HprLerpFunctor&);
|
||||||
@ -260,6 +262,8 @@ PUBLISHED:
|
|||||||
_pend(pex, pey, pez), _pdiff_cache(_pend-_pstart),
|
_pend(pex, pey, pez), _pdiff_cache(_pend-_pstart),
|
||||||
_hstart(hsx, hsy, hsz), _hend(hex, hey, hez),
|
_hstart(hsx, hsy, hsz), _hend(hex, hey, hez),
|
||||||
_hdiff_cache(_hend - _hstart), _is_wrt(true), _wrt_path(wrt) {}
|
_hdiff_cache(_hend - _hstart), _is_wrt(true), _wrt_path(wrt) {}
|
||||||
|
void take_shortest(void);
|
||||||
|
void take_longest(void);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PosHprLerpFunctor(const PosHprLerpFunctor&);
|
PosHprLerpFunctor(const PosHprLerpFunctor&);
|
||||||
@ -343,6 +347,8 @@ PUBLISHED:
|
|||||||
_hdiff_cache(_hend-_hstart), _sstart(ssx, ssy, ssz),
|
_hdiff_cache(_hend-_hstart), _sstart(ssx, ssy, ssz),
|
||||||
_send(sex, sey, sez), _sdiff_cache(_send-_sstart), _is_wrt(true),
|
_send(sex, sey, sez), _sdiff_cache(_send-_sstart), _is_wrt(true),
|
||||||
_wrt_path(wrt) {}
|
_wrt_path(wrt) {}
|
||||||
|
void take_shortest(void);
|
||||||
|
void take_longest(void);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PosHprScaleLerpFunctor(const PosHprScaleLerpFunctor&);
|
PosHprScaleLerpFunctor(const PosHprScaleLerpFunctor&);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user