mirror of
https://github.com/SMGCommunity/Petari.git
synced 2025-02-22 23:22:13 +00:00
Fix minor formatting issues
This commit is contained in:
parent
6d3246801f
commit
0eeb7a6d64
@ -105,7 +105,6 @@ namespace JGeometry {
|
||||
}
|
||||
|
||||
T mMtx[3][4];
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
@ -119,12 +118,10 @@ namespace JGeometry {
|
||||
void mult(const TVec3f &rSrc, TVec3f &rDest) const;
|
||||
|
||||
void multTranspose(const TVec3f &a1, const TVec3f &a2) const;
|
||||
typedef T::type type;
|
||||
};
|
||||
template<class T>
|
||||
struct TRotation3 : public T {
|
||||
public:
|
||||
typedef T::type type;
|
||||
void identity33();
|
||||
|
||||
void getXDir(TVec3f &rDest) const NO_INLINE {
|
||||
@ -160,15 +157,15 @@ namespace JGeometry {
|
||||
void setScale(const TVec3f &rSrc);
|
||||
void setRotate(const TVec3f &, f32);
|
||||
void INLINE_FUNC_DECL(setRotate, const TVec3f &mLocalDirection, f32 fr1e) {
|
||||
TVec3f stack_8;
|
||||
stack_8.set(mLocalDirection);
|
||||
PSVECMag(stack_8.toCVec());
|
||||
PSVECNormalize(stack_8.toCVec(), stack_8.toVec());
|
||||
TVec3f v;
|
||||
v.set(mLocalDirection);
|
||||
PSVECMag(v.toCVec());
|
||||
PSVECNormalize(v.toCVec(), v.toVec());
|
||||
f32 fr1ey = sin(fr1e), fr1ex = cos(fr1e);
|
||||
f32 x, y, z;
|
||||
x = stack_8.x;
|
||||
y = stack_8.y;
|
||||
z = stack_8.z;
|
||||
x = v.x;
|
||||
y = v.y;
|
||||
z = v.z;
|
||||
f32 xx = x * x;
|
||||
f32 yx = y * y;
|
||||
f32 zz = z * z;
|
||||
@ -185,15 +182,15 @@ namespace JGeometry {
|
||||
|
||||
void setRotateInline2(const TVec3f &mLocalDirection, f32 fr1e) {
|
||||
// The only difference from the first setRotate is that we use setInline instead of set
|
||||
TVec3f stack_8;
|
||||
stack_8.setInline(mLocalDirection);
|
||||
PSVECMag(stack_8.toCVec());
|
||||
PSVECNormalize(stack_8.toCVec(), stack_8.toVec());
|
||||
TVec3f v;
|
||||
v.setInline(mLocalDirection);
|
||||
PSVECMag(v.toCVec());
|
||||
PSVECNormalize(v.toCVec(), v.toVec());
|
||||
f32 fr1ey = sin(fr1e), fr1ex = cos(fr1e);
|
||||
f32 x, y, z;
|
||||
x = stack_8.x;
|
||||
y = stack_8.y;
|
||||
z = stack_8.z;
|
||||
x = v.x;
|
||||
y = v.y;
|
||||
z = v.z;
|
||||
f32 xx = x * x;
|
||||
f32 yx = y * y;
|
||||
f32 zz = z * z;
|
||||
@ -237,21 +234,6 @@ namespace JGeometry {
|
||||
}
|
||||
};
|
||||
|
||||
inline f32 dot(f32 x, f32 y, f32 z, f32 x2, f32 y2, f32 z2) {
|
||||
return x2 * x + y2 * y + z2 * z;
|
||||
}
|
||||
|
||||
inline f32 yy(f32 y) {
|
||||
return y * y;
|
||||
}
|
||||
inline f32 g(f32 x) {
|
||||
return cos(x);
|
||||
}
|
||||
|
||||
inline f32 helper(const Vec &rSrc, const Vec &mtx) {
|
||||
return rSrc.y * mtx.y + rSrc.x * mtx.x + rSrc.z * mtx.z;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
struct TPosition3 : public TRotation3<T> {
|
||||
public:
|
||||
|
@ -49,10 +49,10 @@ namespace JGeometry {
|
||||
void zero();
|
||||
|
||||
/* Operators */
|
||||
TVec2<T> &operator=(const TVec2<T> &rSrc);
|
||||
TVec2<T> &operator+(const TVec2<T> &rOther) const;
|
||||
TVec2<T> &operator-(const TVec2<T> &rOther) const;
|
||||
TVec2<T> &operator*(f32 scale) const;
|
||||
TVec2<T>& operator=(const TVec2<T> &rSrc);
|
||||
TVec2<T>& operator+(const TVec2<T> &rOther) const;
|
||||
TVec2<T>& operator-(const TVec2<T> &rOther) const;
|
||||
TVec2<T>& operator*(f32 scale) const;
|
||||
|
||||
T x, y;
|
||||
};
|
||||
@ -62,9 +62,9 @@ namespace JGeometry {
|
||||
public:
|
||||
/* Constructors */
|
||||
|
||||
// This constructor must be associated with data so that the array constructor
|
||||
// This constructor must be associated with data so that construct_new_array
|
||||
// will use this (effectively empty) constructor. Otherwise, the compiler does not pass
|
||||
// this constructor to the implicit array constructor.
|
||||
// any constructor to construct_new_array. See WireGravity::setPointListSize for more details.
|
||||
inline TVec3() {0.0f;}
|
||||
|
||||
template <typename U>
|
||||
@ -109,8 +109,7 @@ namespace JGeometry {
|
||||
lfs z, 8(src)
|
||||
psq_st xy, 0(dst), 0, 0
|
||||
stfs z, 8(dst)
|
||||
}
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
/* General operations */
|
||||
@ -149,8 +148,7 @@ namespace JGeometry {
|
||||
ps_add f0, f1, f0
|
||||
psq_st f2, 0(this_vec), 0, 0
|
||||
psq_st f0, 8(this_vec), 0, 0
|
||||
}
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
void addXY(const register TVec3<T> &rSrc) NO_INLINE
|
||||
@ -190,8 +188,7 @@ namespace JGeometry {
|
||||
ps_madd f1, f0, f0, f2
|
||||
ps_sum0 f1, f1, f2, f2
|
||||
blr
|
||||
}
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -214,11 +211,12 @@ namespace JGeometry {
|
||||
T angle(const TVec3<T> &rOther) const;
|
||||
|
||||
|
||||
inline void rejection(const TVec3<T> &rVec, const TVec3<T> &rNormal) {
|
||||
inline void rejection(const TVec3<T> &rVec, const TVec3<T> &rNormal)
|
||||
{
|
||||
JMAVECScaleAdd(rNormal.toCVec(), rVec.toCVec(), toVec(), -rNormal.dot(rVec));
|
||||
}
|
||||
|
||||
TVec3<T> &subtract(const TVec3<T> &, const TVec3<T> &);
|
||||
TVec3<T>& subtract(const TVec3<T> &, const TVec3<T> &);
|
||||
void subtract(const TVec3<T> &);
|
||||
|
||||
T dot(const register TVec3<T> &rOther) const NO_INLINE
|
||||
@ -233,8 +231,7 @@ namespace JGeometry {
|
||||
ps_madd f1, f0, f1, f2
|
||||
ps_sum0 f1, f1, f2, f2
|
||||
blr
|
||||
}
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
void zero();
|
||||
@ -250,8 +247,7 @@ namespace JGeometry {
|
||||
fneg f0, f0
|
||||
psq_st f1, 0(this_vec), 0, 0
|
||||
stfs f0, 8(this_vec)
|
||||
}
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
void negate(const TVec3<T> &rSrc);
|
||||
@ -289,7 +285,7 @@ namespace JGeometry {
|
||||
return ret;
|
||||
}
|
||||
|
||||
TVec3<T> &operator=(const TVec3<T> &);
|
||||
TVec3<T>& operator=(const TVec3<T> &);
|
||||
TVec3<T> operator*=(T);
|
||||
TVec3<T> operator*(T scalar) const NO_INLINE
|
||||
{
|
||||
@ -305,7 +301,7 @@ namespace JGeometry {
|
||||
return vec;
|
||||
}
|
||||
|
||||
TVec3<T> &operator-=(const TVec3<T> &rhs) NO_INLINE
|
||||
TVec3<T>& operator-=(const TVec3<T> &rhs) NO_INLINE
|
||||
{
|
||||
JMathInlineVEC::PSVECSubtract(toCVec(), rhs.toCVec(), toVec());
|
||||
return *this;
|
||||
@ -318,7 +314,7 @@ namespace JGeometry {
|
||||
return vec;
|
||||
}
|
||||
|
||||
TVec3<T> &operator+=(const TVec3<T> &rhs) NO_INLINE
|
||||
TVec3<T>& operator+=(const TVec3<T> &rhs) NO_INLINE
|
||||
{
|
||||
JMathInlineVEC::PSVECAdd(toCVec(), rhs.toCVec(), toVec());
|
||||
return *this;
|
||||
@ -335,7 +331,7 @@ namespace JGeometry {
|
||||
psq_st xy, 0(r3), 0, 0
|
||||
stfs z, 8(r3)
|
||||
blr
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
TVec3<T> operator%(T scalar) const
|
||||
@ -393,8 +389,7 @@ namespace JGeometry {
|
||||
lfs z, 8(src)
|
||||
psq_st xy, 0(dst), 0, 0
|
||||
stfs z, 8(dst)
|
||||
}
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
inline void setInlinePS_2(register const TVec3<T> &src)
|
||||
@ -408,8 +403,7 @@ namespace JGeometry {
|
||||
lfs z, 8(src)
|
||||
psq_st xy, 0(dst), 0, 0
|
||||
stfs z, 8(dst)
|
||||
}
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
inline void setInlineXYPS(register const TVec3<T> &src)
|
||||
@ -421,8 +415,8 @@ namespace JGeometry {
|
||||
psq_l xy, 0(src), 0, 0
|
||||
lfs _z, 8(src)
|
||||
psq_st xy, 0(dst), 0, 0
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
scalar = 500.0f;
|
||||
|
||||
f32 __z = _z;
|
||||
@ -448,8 +442,7 @@ namespace JGeometry {
|
||||
lfs z, 8(src)
|
||||
psq_st xy, 0(dst), 0, 0
|
||||
stfs z, 8(dst)
|
||||
}
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
inline void scaleInline(T scale)
|
||||
@ -473,8 +466,7 @@ namespace JGeometry {
|
||||
ps_add bZ, aZ, bZ
|
||||
psq_st bXY, 0(dst), 0, 0
|
||||
psq_st bZ, 8(dst), 1, 0
|
||||
}
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
inline void addInline2(register const TVec3<T> &rOther)
|
||||
@ -491,8 +483,7 @@ namespace JGeometry {
|
||||
psq_l _0, 8(rOther), 1, 0
|
||||
ps_add _0, _1, _0
|
||||
psq_st _0, 8(dst), 1, 0
|
||||
}
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
inline void addInline3(register const TVec3<T> &rOther)
|
||||
@ -510,8 +501,7 @@ namespace JGeometry {
|
||||
ps_add totalZ, dstZ, srcZ
|
||||
psq_st dstXY, 0(dst), 0, 0
|
||||
psq_st totalZ, 8(dst), 1, 0
|
||||
}
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
inline void addInline_4(register const TVec3<T> &rOther)
|
||||
@ -528,8 +518,7 @@ namespace JGeometry {
|
||||
ps_add aZ, aZ, bZ
|
||||
psq_st aXY, 0(dst), 0, 0
|
||||
psq_st aZ, 8(dst), 1, 0
|
||||
}
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
inline void addInline_5(register const TVec3<T> &rOther)
|
||||
@ -546,36 +535,7 @@ namespace JGeometry {
|
||||
ps_add aXY, bZ, aZ
|
||||
psq_st bXY, 0(dst), 0, 0
|
||||
psq_st aXY, 8(dst), 1, 0
|
||||
}
|
||||
;
|
||||
}
|
||||
|
||||
inline void addInline_7(register const TVec3<T> &rOther)
|
||||
{
|
||||
register TVec3<T> *dst = this;
|
||||
register f32 sumZ, bZ, aZ, bXY, aXY;
|
||||
|
||||
__asm {
|
||||
psq_l bXY, 0(rOther), 0, 0
|
||||
psq_l aXY, 0(dst), 0, 0
|
||||
psq_l aZ, 8(dst), 1, 0
|
||||
ps_add aXY, aXY, bXY
|
||||
psq_l bZ, 8(rOther), 1, 0
|
||||
ps_add sumZ, aZ, bZ
|
||||
psq_st aXY, 0(dst), 0, 0
|
||||
psq_st sumZ, 8(dst), 1, 0
|
||||
}
|
||||
;
|
||||
}
|
||||
|
||||
inline TVec3<T> _madd(const TVec3<T> &v) const {
|
||||
TVec3<T> ret(*this);
|
||||
ret.addInline_7(v);
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline TVec3<T> madd(f32 scale, const TVec3<T> &v) const {
|
||||
return _madd(v * scale);
|
||||
};
|
||||
}
|
||||
|
||||
inline void addInline6(register const TVec3<T> &rOther)
|
||||
@ -598,6 +558,33 @@ namespace JGeometry {
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void addInline_7(register const TVec3<T> &rOther)
|
||||
{
|
||||
register TVec3<T> *dst = this;
|
||||
register f32 sumZ, bZ, aZ, bXY, aXY;
|
||||
|
||||
__asm {
|
||||
psq_l bXY, 0(rOther), 0, 0
|
||||
psq_l aXY, 0(dst), 0, 0
|
||||
psq_l aZ, 8(dst), 1, 0
|
||||
ps_add aXY, aXY, bXY
|
||||
psq_l bZ, 8(rOther), 1, 0
|
||||
ps_add sumZ, aZ, bZ
|
||||
psq_st aXY, 0(dst), 0, 0
|
||||
psq_st sumZ, 8(dst), 1, 0
|
||||
};
|
||||
}
|
||||
|
||||
inline TVec3<T> _madd(const TVec3<T> &v) const {
|
||||
TVec3<T> ret(*this);
|
||||
ret.addInline_7(v);
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline TVec3<T> madd(f32 scale, const TVec3<T> &v) const {
|
||||
return _madd(v * scale);
|
||||
}
|
||||
|
||||
inline void subInline(const TVec3<T> &rA, const TVec3<T> &rB)
|
||||
{
|
||||
register TVec3<T> *dst = this;
|
||||
@ -615,8 +602,7 @@ namespace JGeometry {
|
||||
ps_sub aZ, aZ, bZ
|
||||
psq_st bXY, 0(dst), 0, 0
|
||||
psq_st aZ, 8(dst), 1, 0
|
||||
}
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
inline void subInline2(const TVec3<T> &rA, const TVec3<T> &rB)
|
||||
@ -635,8 +621,7 @@ namespace JGeometry {
|
||||
psq_l bZ, 8(b), 1, 0
|
||||
ps_sub aZ, aZ, bZ
|
||||
psq_st aZ, 8(dst), 1, 0
|
||||
}
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
inline void subInline3(const TVec3<T> &rA, const TVec3<T> &rB)
|
||||
@ -655,8 +640,7 @@ namespace JGeometry {
|
||||
psq_l aZ, 8(a), 1, 0
|
||||
ps_sub aZ, aZ, bZ
|
||||
psq_st aZ, 8(dst), 1, 0
|
||||
}
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
inline void subInline(const TVec3<T> &rA)
|
||||
@ -674,8 +658,7 @@ namespace JGeometry {
|
||||
psq_l bZ, 8(this_vec), 1, 0
|
||||
ps_sub aZ, bZ, aZ
|
||||
psq_st aZ, 8(this_vec), 1, 0
|
||||
}
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
inline void subInline4(register const TVec3<T> &rVec)
|
||||
@ -709,7 +692,7 @@ namespace JGeometry {
|
||||
lfs z, 8(src)
|
||||
fneg z, z
|
||||
stfs z, 8(dest)
|
||||
}
|
||||
};
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -728,7 +711,7 @@ namespace JGeometry {
|
||||
lfs z, 8(src)
|
||||
fneg z, z
|
||||
stfs z, 8(dest)
|
||||
}
|
||||
};
|
||||
|
||||
TVec3f trueRet = TVec3f(ret);
|
||||
trueRet.scale(scalar);
|
||||
@ -748,7 +731,7 @@ namespace JGeometry {
|
||||
fneg z, z
|
||||
psq_st xy, 0(dst), 0, 0
|
||||
stfs z, 8(dst)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
inline void negateInline_2(register const TVec3<T> &rSrc)
|
||||
@ -764,7 +747,7 @@ namespace JGeometry {
|
||||
lfs z, 8(rSrc)
|
||||
fneg z, z
|
||||
stfs z, 8(dst)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
inline TVec3<T> negateInline_2() const
|
||||
@ -794,7 +777,7 @@ namespace JGeometry {
|
||||
stfs x, 0(rDest)
|
||||
stfs y, 4(rDest)
|
||||
stfs z_single, 8(rDest)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
inline void negateSelf()
|
||||
@ -811,7 +794,7 @@ namespace JGeometry {
|
||||
lfs z, 8(src)
|
||||
fneg z, z
|
||||
stfs z, 8(dst)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
inline void setNegatedInline(register const TVec3<T> &rSrc)
|
||||
@ -827,7 +810,7 @@ namespace JGeometry {
|
||||
lfs z, 8(rSrc)
|
||||
fneg z, z
|
||||
stfs z, 8(rDst)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
inline void multAndSet(TVec3<T> *pDest, T scalar)
|
||||
@ -853,7 +836,7 @@ namespace JGeometry {
|
||||
lfs z_2, 8(rVec1)
|
||||
fmuls z_2, z_1, z_2
|
||||
stfs z_2, 8(rDst)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
inline f32 squareDistancePS(const register TVec3<T> &rVec1) const
|
||||
|
@ -49,7 +49,7 @@ namespace JMath {
|
||||
|
||||
return table[(u16)v & LEN - 1].b1;
|
||||
}
|
||||
inline f32 get(f32 v) { return table[(u16)(LEN / TWO_PI * v) & LEN - 1].b1; }
|
||||
inline f32 get(f32 v) { return table[(u16)v & LEN - 1].b1; }
|
||||
};
|
||||
|
||||
template <s32 Len, typename T>
|
||||
|
@ -2,10 +2,6 @@
|
||||
#include "JSystem/JMath/JMath.hpp"
|
||||
#include "Game/Util.hpp"
|
||||
|
||||
inline f32 getElement(const TRot3f &rot) {
|
||||
return rot.mMtx[1][0];
|
||||
}
|
||||
|
||||
template<>
|
||||
void TRot3f::mult33(const TVec3f &rSrc, TVec3f &rDst) const {
|
||||
f32 a32, a22, a12, a31, a21, a11, a13, a33, a23;
|
||||
|
@ -9,9 +9,9 @@ template<>
|
||||
void TVec3f::cubic(const TVec3f &rv1, const TVec3f &rv2, const TVec3f &rv3, const TVec3f &rv4, f32 a) {
|
||||
set(
|
||||
rv3 * (a * a * a - a * a)
|
||||
+ rv2 * (a + a * a * a - 2 * a * a)
|
||||
+ rv1 * (1 + 2 * a * a * a - 3 * a * a)
|
||||
+ rv4 * (3 * a * a - 2 * a * a * a)
|
||||
+ rv2 * (a + a * a * a - 2.0f * a * a)
|
||||
+ rv1 * (1.0f + 2.0f * a * a * a - 3.0f * a * a)
|
||||
+ rv4 * (3.0f * a * a - 2.0f * a * a * a)
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
@ -46,8 +46,7 @@ bool TVec3f::isZero() const
|
||||
ps_mul f1, f1, f1
|
||||
ps_madd sum, sum, sum, f1
|
||||
ps_sum0 sum, sum, f1, f1
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
return sum <= 0.0000038146973f;
|
||||
}
|
||||
@ -75,9 +74,9 @@ CubeGravity::CubeGravity() : PlanetGravity()
|
||||
mPosition.identity();
|
||||
}
|
||||
|
||||
void CubeGravity::setCube(const TPos3f &cube)
|
||||
void CubeGravity::setCube(const TPos3f &rCube)
|
||||
{
|
||||
mCube = cube;
|
||||
mCube = rCube;
|
||||
|
||||
updateIdentityMtx();
|
||||
}
|
||||
|
@ -106,10 +106,6 @@ bool DiskGravity::calcOwnGravityVector(TVec3f *pDest, f32 *pDistance, const TVec
|
||||
return true;
|
||||
}
|
||||
|
||||
f32 degToRad(f32 deg) {
|
||||
return deg;
|
||||
}
|
||||
|
||||
void DiskGravity::updateLocalParam() {
|
||||
TRot3f rot;
|
||||
|
||||
@ -134,8 +130,9 @@ void DiskGravity::updateLocalParam() {
|
||||
rot.identity();
|
||||
rot.CALL_INLINE_FUNC(setRotate, mLocalNormal, 0.5f * mValidDegree * (PI / 180));
|
||||
rArtifact = false;
|
||||
if(!artifact)
|
||||
if(!artifact) {
|
||||
rot.mult(mOppositeSideVecOrtho, mOppositeSideVecOrtho);
|
||||
}
|
||||
}
|
||||
|
||||
void DiskGravity::updateMtx(const TPos3f &rMtx) {
|
||||
|
@ -46,7 +46,7 @@ bool PlanetGravityManager::calcTotalGravityVector(TVec3f *pGravity, GravityInfo
|
||||
|
||||
if ((*pGravities)->calcGravity(&gravityVec, rPosition)) {
|
||||
bool storeInfo = false;
|
||||
f32 scalar = PSVECMag(reinterpret_cast<const Vec*>(&gravityVec));
|
||||
f32 scalar = PSVECMag(gravityVec.toCVec());
|
||||
|
||||
// If same priority, add gravity vector to total result
|
||||
if (priority == largestPriority) {
|
||||
|
@ -7,80 +7,22 @@ inline f32 yy(f32 y) {
|
||||
|
||||
template<>
|
||||
void TRot3f::setRotate(const TVec3f &mLocalDirection, f32 fr1e) {
|
||||
//union {TVec3f stack_81; const Vec stack_8;};
|
||||
//stack_81.setInline(mLocalDirection);
|
||||
//const TVec3f &stack_8 = *(const TVec3f*)&bs;
|
||||
TVec3f stack_8;
|
||||
stack_8.set(mLocalDirection);
|
||||
PSVECMag(stack_8.toCVec());
|
||||
PSVECNormalize(stack_8.toCVec(), stack_8.toVec());
|
||||
//const TVec3f stack_8 = stack_8;
|
||||
|
||||
//f32 fr1ex, fr1ey;
|
||||
|
||||
// 8 reg -- 3 for stack_8, 3 for calculation, 1 for fr1ex, 1 for 1.0f - fr1ex
|
||||
f32 fr1ey = sin(fr1e), fr1ex = cos(fr1e);
|
||||
|
||||
//f32 fr1ex, fr1ey;
|
||||
|
||||
// 8 reg -- 3 for stack_8, 3 for calculation, 1 for fr1ex, 1 for 1.0f - fr1ex
|
||||
//f32 fr1ey = sin(fr1e), fr1ex = cos(fr1e);
|
||||
f32 x, y, z;
|
||||
//f32 &rx = x, &ry = y, &rz = z;
|
||||
y = stack_8.y;
|
||||
x = stack_8.x;
|
||||
z = stack_8.z;
|
||||
//f32 yy = y * y;
|
||||
//f32 (1.0f - fr1ex) = 1.0f - fr1ex;
|
||||
|
||||
//f32 (1.0f - fr1ex) = 1.0f - fr1ex;
|
||||
mMtx[0][0] = fr1ex + (1.0f - fr1ex) * yy(x);
|
||||
mMtx[0][1] = (1.0f - fr1ex) * x * y - fr1ey * z;
|
||||
mMtx[0][2] = (1.0f - fr1ex) * x * z + fr1ey * y;
|
||||
mMtx[1][0] = (1.0f - fr1ex) * x * y + fr1ey * z;
|
||||
mMtx[1][1] = fr1ex + (1.0f - fr1ex) * yy(y);
|
||||
mMtx[1][2] = (1.0f - fr1ex) * y * z - fr1ey * x;
|
||||
mMtx[2][0] = (1.0f - fr1ex) * x * z - fr1ey * y;
|
||||
mMtx[2][1] = (1.0f - fr1ex) * y * z + fr1ey * x;
|
||||
mMtx[2][2] = fr1ex + (1.0f - fr1ex) * yy(z);
|
||||
}
|
||||
|
||||
/*
|
||||
template<>
|
||||
void TRot3f::setRotate(const TVec3f &mLocalDirection, f32 fr1e) {
|
||||
f32 (1.0f - fr1ex);
|
||||
TVec3f stack_8;
|
||||
stack_8.set(mLocalDirection);
|
||||
PSVECMag(stack_8.toCVec());
|
||||
PSVECNormalize(stack_8.toCVec(), stack_8.toVec());
|
||||
|
||||
//f32 fr1ex, fr1ey;
|
||||
|
||||
// 8 reg -- 3 for stack_8, 3 for calculation, 1 for fr1ex, 1 for 1.0f - fr1ex
|
||||
f32 fr1ey = sin(fr1e), fr1ex = cos(fr1e);
|
||||
(1.0f - fr1ex) = 1.0f - fr1ex;
|
||||
f32 a00, a01, a02, a10, a11, a12, a20, a21, a22;
|
||||
|
||||
//f32 (1.0f - fr1ex) = 1.0f - fr1ex;
|
||||
a00 = fr1ex + (1.0f - fr1ex) * (stack_8.x * stack_8.x);
|
||||
a01 = (1.0f - fr1ex) * stack_8.x * stack_8.y - fr1ey * stack_8.z;
|
||||
a02 = (1.0f - fr1ex) * stack_8.x * stack_8.z + fr1ey * stack_8.y;
|
||||
a10 = (1.0f - fr1ex) * stack_8.x * stack_8.y + fr1ey * stack_8.z;
|
||||
a11 = fr1ex + (1.0f - fr1ex) * (stack_8.y * stack_8.y);
|
||||
a12 = (1.0f - fr1ex) * stack_8.y * stack_8.z - fr1ey * stack_8.x;
|
||||
a20 = (1.0f - fr1ex) * stack_8.x * stack_8.z - fr1ey * stack_8.y;
|
||||
a21 = (1.0f - fr1ex) * stack_8.y * stack_8.z + fr1ey * stack_8.x;
|
||||
a22 = fr1ex + (1.0f - fr1ex) * (stack_8.z * stack_8.z);
|
||||
|
||||
mMtx[0][0] = a00;
|
||||
mMtx[0][1] = a01;
|
||||
mMtx[0][2] = a02;
|
||||
mMtx[1][0] = a10;
|
||||
mMtx[1][1] = a11;
|
||||
mMtx[1][2] = a12;
|
||||
mMtx[2][0] = a20;
|
||||
mMtx[2][1] = a21;
|
||||
mMtx[2][2] = a22;
|
||||
}
|
||||
|
||||
*/
|
||||
TVec3f v;
|
||||
v.set(mLocalDirection);
|
||||
PSVECMag(v.toCVec());
|
||||
PSVECNormalize(v.toCVec(), v.toVec());
|
||||
f32 fr1ey = sin(fr1e), fr1ex = cos(fr1e);
|
||||
f32 x, y, z;
|
||||
y = v.y;
|
||||
x = v.x;
|
||||
z = v.z;
|
||||
mMtx[0][0] = fr1ex + (1.0f - fr1ex) * yy(x);
|
||||
mMtx[0][1] = (1.0f - fr1ex) * x * y - fr1ey * z;
|
||||
mMtx[0][2] = (1.0f - fr1ex) * x * z + fr1ey * y;
|
||||
mMtx[1][0] = (1.0f - fr1ex) * x * y + fr1ey * z;
|
||||
mMtx[1][1] = fr1ex + (1.0f - fr1ex) * yy(y);
|
||||
mMtx[1][2] = (1.0f - fr1ex) * y * z - fr1ey * x;
|
||||
mMtx[2][0] = (1.0f - fr1ex) * x * z - fr1ey * y;
|
||||
mMtx[2][1] = (1.0f - fr1ex) * y * z + fr1ey * x;
|
||||
mMtx[2][2] = fr1ex + (1.0f - fr1ex) * yy(z);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user