gcc porting - successful compilation
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
EE_LIBS := $(EE_LIBS) -ldraw -lgraph -lmath3d -lpacket -ldma -lpacket2 -lpad -laudsrv -lc -lstdc++ -lpng -lz
|
||||
EE_LIBS := $(EE_LIBS) -ldraw -lcdvd -lgraph -lmath3d -lpacket -ldma -lpacket2 -lpad -laudsrv -lc -lstdc++ -lpng -lz
|
||||
EE_INCS := -I$(TYRA_DIR)/include -I$(PS2SDK)/ports/include $(EE_INCS)
|
||||
EE_LDFLAGS := -L$(PS2SDK)/ports/lib -L$(TYRA_DIR) $(EE_LDFLAGS)
|
||||
EE_CFLAGS := -DHAVE_LIBPNG -DHAVE_ZLIB $(EE_CFLAGS)
|
||||
EE_CXXFLAGS := -DHAVE_LIBPNG -DHAVE_ZLIB $(EE_CXXFLAGS)
|
||||
EE_CFLAGS := -DHAVE_LIBPNG -D_XCDVD -DHAVE_ZLIB $(EE_CFLAGS)
|
||||
EE_CXXFLAGS := -DHAVE_LIBPNG -D_XCDVD -DHAVE_ZLIB $(EE_CXXFLAGS)
|
||||
EE_DVP = dvp-as
|
||||
EE_VCL = vcl
|
||||
EE_VCLPP = vclpp
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <tamtypes.h>
|
||||
#include <math3d.h>
|
||||
#include "../models/math/vector3.hpp"
|
||||
#include <fastmath.h>
|
||||
|
||||
class Vector3; // Forward definition
|
||||
|
||||
@@ -24,16 +25,15 @@ class Math
|
||||
{
|
||||
|
||||
public:
|
||||
const static float HALF_ANG2RAD = 3.14159265358979323846F / 360.0F;
|
||||
const static float ANG2RAD = 3.14159265358979323846F / 180.0F;
|
||||
const static float PI = 3.1415926535897932384626433832795F;
|
||||
const static float HALF_PI = 1.5707963267948966192313216916398F;
|
||||
constexpr static float HALF_ANG2RAD = 3.14159265358979323846F / 360.0F;
|
||||
constexpr static float ANG2RAD = 3.14159265358979323846F / 180.0F;
|
||||
constexpr static float PI = 3.1415926535897932384626433832795F;
|
||||
constexpr static float HALF_PI = 1.5707963267948966192313216916398F;
|
||||
static float cos(float x);
|
||||
static float asin(float x);
|
||||
static float mod(float x, float y);
|
||||
static inline float sin(float x) { return cos(x - HALF_PI); };
|
||||
static inline float tan(float x) { return sin(x) / cos(x); }
|
||||
static float sqrt(float x);
|
||||
static float invSqrt(float x);
|
||||
static inline u32 max(u32 a, u32 b) { return (a > b) ? a : b; }
|
||||
static inline s32 max(s32 a, s32 b) { return (a > b) ? a : b; }
|
||||
|
||||
@@ -58,16 +58,16 @@ Vector3 Matrix::operator*(const Vector3 &v) const
|
||||
float a[4] = {v.x, v.y, v.z, 1.0F};
|
||||
float res[4];
|
||||
asm volatile(
|
||||
"lqc2 vf4, 0x00(%1) \n\t"
|
||||
"lqc2 vf5, 0x10(%1) \n\t"
|
||||
"lqc2 vf6, 0x20(%1) \n\t"
|
||||
"lqc2 vf7, 0x30(%1) \n\t"
|
||||
"lqc2 vf8, 0x00(%2) \n\t"
|
||||
"vmulax.xyzw ACC, vf4, vf8 \n\t"
|
||||
"vmadday.xyzw ACC, vf5, vf8 \n\t"
|
||||
"vmaddaz.xyzw ACC, vf6, vf8 \n\t"
|
||||
"vmaddw.xyzw vf9, vf7, vf8 \n\t"
|
||||
"sqc2 vf9, 0x00(%0) \n\t"
|
||||
"lqc2 $vf4, 0x00(%1) \n\t"
|
||||
"lqc2 $vf5, 0x10(%1) \n\t"
|
||||
"lqc2 $vf6, 0x20(%1) \n\t"
|
||||
"lqc2 $vf7, 0x30(%1) \n\t"
|
||||
"lqc2 $vf8, 0x00(%2) \n\t"
|
||||
"vmulax.xyzw $ACC, $vf4, $vf8 \n\t"
|
||||
"vmadday.xyzw $ACC, $vf5, $vf8 \n\t"
|
||||
"vmaddaz.xyzw $ACC, $vf6, $vf8 \n\t"
|
||||
"vmaddw.xyzw $vf9, $vf7, $vf8 \n\t"
|
||||
"sqc2 $vf9, 0x00(%0) \n\t"
|
||||
:
|
||||
: "r"(res), "r"(this->data), "r"(a));
|
||||
return Vector3(res[0], res[1], res[2]);
|
||||
@@ -80,15 +80,15 @@ Vector3 Matrix::operator*(const Vector3 &v) const
|
||||
void Matrix::identity()
|
||||
{
|
||||
asm volatile(
|
||||
"vsub.xyzw vf4, vf0, vf0 \n\t"
|
||||
"vadd.w vf4, vf4, vf0 \n\t"
|
||||
"vmr32.xyzw vf5, vf4 \n\t"
|
||||
"vmr32.xyzw vf6, vf5 \n\t"
|
||||
"vmr32.xyzw vf7, vf6 \n\t"
|
||||
"sqc2 vf4, 0x30(%0) \n\t"
|
||||
"sqc2 vf5, 0x20(%0) \n\t"
|
||||
"sqc2 vf6, 0x10(%0) \n\t"
|
||||
"sqc2 vf7, 0x0(%0) \n\t"
|
||||
"vsub.xyzw $vf4, $vf0, $vf0 \n\t"
|
||||
"vadd.w $vf4, $vf4, $vf0 \n\t"
|
||||
"vmr32.xyzw $vf5, $vf4 \n\t"
|
||||
"vmr32.xyzw $vf6, $vf5 \n\t"
|
||||
"vmr32.xyzw $vf7, $vf6 \n\t"
|
||||
"sqc2 $vf4, 0x30(%0) \n\t"
|
||||
"sqc2 $vf5, 0x20(%0) \n\t"
|
||||
"sqc2 $vf6, 0x10(%0) \n\t"
|
||||
"sqc2 $vf7, 0x0(%0) \n\t"
|
||||
:
|
||||
: "r"(this->data));
|
||||
}
|
||||
@@ -131,17 +131,17 @@ void Matrix::lookAt(const Vector3 &t_position, const Vector3 &t_target)
|
||||
VECTOR eye = {t_position.x, t_position.y, t_position.z, 1.0F};
|
||||
VECTOR obj = {t_target.x, t_target.y, t_target.z, 1.0F};
|
||||
asm volatile(
|
||||
"lqc2 vf4, 0x00(%2) # eye \n\t"
|
||||
"lqc2 vf5, 0x00(%3) # obj \n\t"
|
||||
"vsub.xyz vf7, vf4, vf5 # view_vec = vf7 \n\t"
|
||||
"vmove.xyzw vf6, vf0 \n\t"
|
||||
"vaddw.y vf6, vf0, vf0 # vf6 = { 0.0f, 1.0f, 0.0f, 1.0f } \n\t"
|
||||
"vopmula.xyz ACC, vf6, vf7 \n\t"
|
||||
"vopmsub.xyz vf9, vf7, vf6 # vec = vf9 \n\t"
|
||||
"vopmula.xyz ACC, vf7, vf9 \n\t"
|
||||
"vopmsub.xyz vf8, vf9, vf7 # up_vec = vf8 \n\t"
|
||||
"sqc2 vf7, 0x00(%0) # view_vec \n\t"
|
||||
"sqc2 vf6, 0x00(%1) # up_vec \n\t"
|
||||
"lqc2 $vf4, 0x00(%2) # eye \n\t"
|
||||
"lqc2 $vf5, 0x00(%3) # obj \n\t"
|
||||
"vsub.xyz $vf7, $vf4, $vf5 # view_vec = $vf7 \n\t"
|
||||
"vmove.xyzw $vf6, $vf0 \n\t"
|
||||
"vaddw.y $vf6, $vf0, $vf0 # $vf6 = { 0.0f, 1.0f, 0.0f, 1.0f } \n\t"
|
||||
"vopmula.xyz $ACC, $vf6, $vf7 \n\t"
|
||||
"vopmsub.xyz $vf9, $vf7, $vf6 # vec = $vf9 \n\t"
|
||||
"vopmula.xyz $ACC, $vf7, $vf9 \n\t"
|
||||
"vopmsub.xyz $vf8, $vf9, $vf7 # up_vec = $vf8 \n\t"
|
||||
"sqc2 $vf7, 0x00(%0) # view_vec \n\t"
|
||||
"sqc2 $vf6, 0x00(%1) # up_vec \n\t"
|
||||
:
|
||||
: "r"(view_vec), "r"(up_vec), "r"(eye), "r"(obj));
|
||||
Matrix temp;
|
||||
@@ -270,45 +270,45 @@ void Matrix::setScale(const Vector3 &t_val)
|
||||
|
||||
void Matrix::setCamera(const float t_pos[4], const float t_vz[4], const float t_vy[4])
|
||||
{
|
||||
// Matrix vf4, vf5, vf6, vf7
|
||||
// t_pos vf8
|
||||
// t_vz vf9
|
||||
// t_vy vf10
|
||||
// vtmp vf11
|
||||
// Matrix $vf4, $vf5, $vf6, $vf7
|
||||
// t_pos $vf8
|
||||
// t_vz $vf9
|
||||
// t_vy $vf10
|
||||
// vtmp $vf11
|
||||
asm volatile(
|
||||
"lqc2 vf9, 0x00(%2) \n\t"
|
||||
"lqc2 vf10, 0x00(%3) \n\t"
|
||||
"lqc2 $vf9, 0x00(%2) \n\t"
|
||||
"lqc2 $vf10, 0x00(%3) \n\t"
|
||||
// mtmp.unit()
|
||||
"vsub.w vf5, vf0, vf0 # mtmp[1][PW] = 0.0F \n\t"
|
||||
"vsub.w $vf5, $vf0, $vf0 # mtmp[1][PW] = 0.0F \n\t"
|
||||
// vtmp.outerProduct(vy, vz);
|
||||
"vopmula.xyz ACC, vf10, vf9 \n\t"
|
||||
"vopmsub.xyz vf11, vf9, vf10 \n\t"
|
||||
"vopmula.xyz $ACC, $vf10, $vf9 \n\t"
|
||||
"vopmsub.xyz $vf11, $vf9, $vf10 \n\t"
|
||||
// mtmp[0] = vtmp.normalize();
|
||||
"vmul.xyz vf12, vf11, vf11 \n\t"
|
||||
"vaddy.x vf12, vf12, vf12 \n\t"
|
||||
"vaddz.x vf12, vf12, vf12 \n\t"
|
||||
"vrsqrt Q, vf0w, vf12x \n\t"
|
||||
"vsub.xyzw vf4, vf0, vf0 \n\t"
|
||||
"vmul.xyz $vf12, $vf11, $vf11 \n\t"
|
||||
"vaddy.x $vf12, $vf12, $vf12 \n\t"
|
||||
"vaddz.x $vf12, $vf12, $vf12 \n\t"
|
||||
"vrsqrt $Q, $vf0w, $vf12x \n\t"
|
||||
"vsub.xyzw $vf4, $vf0, $vf0 \n\t"
|
||||
"vwaitq \n\t"
|
||||
"vmulq.xyz vf4, vf11, Q \n\t"
|
||||
"vmulq.xyz $vf4, $vf11, $Q \n\t"
|
||||
// mtmp[2] = vz.normalize();
|
||||
"vmul.xyz vf12, vf9, vf9 \n\t"
|
||||
"vaddy.x vf12, vf12, vf12 \n\t"
|
||||
"vaddz.x vf12, vf12, vf12 \n\t"
|
||||
"vrsqrt Q, vf0w, vf12x \n\t"
|
||||
"vsub.xyzw vf6, vf0, vf0 \n\t"
|
||||
"vmul.xyz $vf12, $vf9, $vf9 \n\t"
|
||||
"vaddy.x $vf12, $vf12, $vf12 \n\t"
|
||||
"vaddz.x $vf12, $vf12, $vf12 \n\t"
|
||||
"vrsqrt $Q, $vf0w, $vf12x \n\t"
|
||||
"vsub.xyzw $vf6, $vf0, $vf0 \n\t"
|
||||
"vwaitq \n\t"
|
||||
"vmulq.xyz vf6, vf9, Q \n\t"
|
||||
"vmulq.xyz $vf6, $vf9, $Q \n\t"
|
||||
// mtmp[1].outerProduct(mtmp[2], mtmp[0]);
|
||||
"vopmula.xyz ACC, vf6, vf4 \n\t"
|
||||
"vopmsub.xyz vf5, vf4, vf6 \n\t"
|
||||
"vopmula.xyz $ACC, $vf6, $vf4 \n\t"
|
||||
"vopmsub.xyz $vf5, $vf4, $vf6 \n\t"
|
||||
// mtmp.transpose(pos);
|
||||
"lqc2 vf7, 0x00(%1) \n\t"
|
||||
"lqc2 $vf7, 0x00(%1) \n\t"
|
||||
// m = mtmp.inverse();
|
||||
"qmfc2.ni $11, vf0 \n\t"
|
||||
"qmfc2.ni $8, vf4 \n\t"
|
||||
"qmfc2.ni $9, vf5 \n\t"
|
||||
"qmfc2.ni $10, vf6 \n\t"
|
||||
"qmfc2.ni $11, $vf0 \n\t"
|
||||
"qmfc2.ni $8, $vf4 \n\t"
|
||||
"qmfc2.ni $9, $vf5 \n\t"
|
||||
"qmfc2.ni $10, $vf6 \n\t"
|
||||
|
||||
"pextlw $12, $9, $8 \n\t"
|
||||
"pextuw $13, $9, $8 \n\t"
|
||||
@@ -318,18 +318,18 @@ void Matrix::setCamera(const float t_pos[4], const float t_vz[4], const float t_
|
||||
"pcpyud $9, $12, $14 \n\t"
|
||||
"pcpyld $10, $15, $13 \n\t"
|
||||
|
||||
"qmtc2.ni $8, vf16 \n\t"
|
||||
"qmtc2.ni $9, vf17 \n\t"
|
||||
"qmtc2.ni $10, vf18 \n\t"
|
||||
"vmulax.xyz ACC, vf16, vf7 \n\t"
|
||||
"vmadday.xyz ACC, vf17, vf7 \n\t"
|
||||
"vmaddz.xyz vf5, vf18, vf7 \n\t"
|
||||
"vsub.xyzw vf5, vf0, vf5 \n\t"
|
||||
"qmtc2.ni $8, $vf16 \n\t"
|
||||
"qmtc2.ni $9, $vf17 \n\t"
|
||||
"qmtc2.ni $10, $vf18 \n\t"
|
||||
"vmulax.xyz $ACC, $vf16, $vf7 \n\t"
|
||||
"vmadday.xyz $ACC, $vf17, $vf7 \n\t"
|
||||
"vmaddz.xyz $vf5, $vf18, $vf7 \n\t"
|
||||
"vsub.xyzw $vf5, $vf0, $vf5 \n\t"
|
||||
|
||||
"sq $8, 0x00(%0) \n\t"
|
||||
"sq $9, 0x10(%0) \n\t"
|
||||
"sq $10, 0x20(%0) \n\t"
|
||||
"sqc2 vf5, 0x30(%0) \n\t"
|
||||
"sqc2 $vf5, 0x30(%0) \n\t"
|
||||
:
|
||||
: "r"(this->data), "r"(t_pos), "r"(t_vz), "r"(t_vy));
|
||||
}
|
||||
@@ -337,34 +337,34 @@ void Matrix::setCamera(const float t_pos[4], const float t_vz[4], const float t_
|
||||
void Matrix::cross(float res[16], const float a[16], const float b[16]) const
|
||||
{
|
||||
asm volatile(
|
||||
"lqc2 vf1, 0x00(%1) \n\t"
|
||||
"lqc2 vf2, 0x10(%1) \n\t"
|
||||
"lqc2 vf3, 0x20(%1) \n\t"
|
||||
"lqc2 vf4, 0x30(%1) \n\t"
|
||||
"lqc2 vf5, 0x00(%2) \n\t"
|
||||
"lqc2 vf6, 0x10(%2) \n\t"
|
||||
"lqc2 vf7, 0x20(%2) \n\t"
|
||||
"lqc2 vf8, 0x30(%2) \n\t"
|
||||
"vmulax.xyzw ACC, vf5, vf1 \n\t"
|
||||
"vmadday.xyzw ACC, vf6, vf1 \n\t"
|
||||
"vmaddaz.xyzw ACC, vf7, vf1 \n\t"
|
||||
"vmaddw.xyzw vf1, vf8, vf1 \n\t"
|
||||
"vmulax.xyzw ACC, vf5, vf2 \n\t"
|
||||
"vmadday.xyzw ACC, vf6, vf2 \n\t"
|
||||
"vmaddaz.xyzw ACC, vf7, vf2 \n\t"
|
||||
"vmaddw.xyzw vf2, vf8, vf2 \n\t"
|
||||
"vmulax.xyzw ACC, vf5, vf3 \n\t"
|
||||
"vmadday.xyzw ACC, vf6, vf3 \n\t"
|
||||
"vmaddaz.xyzw ACC, vf7, vf3 \n\t"
|
||||
"vmaddw.xyzw vf3, vf8, vf3 \n\t"
|
||||
"vmulax.xyzw ACC, vf5, vf4 \n\t"
|
||||
"vmadday.xyzw ACC, vf6, vf4 \n\t"
|
||||
"vmaddaz.xyzw ACC, vf7, vf4 \n\t"
|
||||
"vmaddw.xyzw vf4, vf8, vf4 \n\t"
|
||||
"sqc2 vf1, 0x00(%0) \n\t"
|
||||
"sqc2 vf2, 0x10(%0) \n\t"
|
||||
"sqc2 vf3, 0x20(%0) \n\t"
|
||||
"sqc2 vf4, 0x30(%0) \n\t"
|
||||
"lqc2 $vf1, 0x00(%1) \n\t"
|
||||
"lqc2 $vf2, 0x10(%1) \n\t"
|
||||
"lqc2 $vf3, 0x20(%1) \n\t"
|
||||
"lqc2 $vf4, 0x30(%1) \n\t"
|
||||
"lqc2 $vf5, 0x00(%2) \n\t"
|
||||
"lqc2 $vf6, 0x10(%2) \n\t"
|
||||
"lqc2 $vf7, 0x20(%2) \n\t"
|
||||
"lqc2 $vf8, 0x30(%2) \n\t"
|
||||
"vmulax.xyzw $ACC, $vf5, $vf1 \n\t"
|
||||
"vmadday.xyzw $ACC, $vf6, $vf1 \n\t"
|
||||
"vmaddaz.xyzw $ACC, $vf7, $vf1 \n\t"
|
||||
"vmaddw.xyzw $vf1, $vf8, $vf1 \n\t"
|
||||
"vmulax.xyzw $ACC, $vf5, $vf2 \n\t"
|
||||
"vmadday.xyzw $ACC, $vf6, $vf2 \n\t"
|
||||
"vmaddaz.xyzw $ACC, $vf7, $vf2 \n\t"
|
||||
"vmaddw.xyzw $vf2, $vf8, $vf2 \n\t"
|
||||
"vmulax.xyzw $ACC, $vf5, $vf3 \n\t"
|
||||
"vmadday.xyzw $ACC, $vf6, $vf3 \n\t"
|
||||
"vmaddaz.xyzw $ACC, $vf7, $vf3 \n\t"
|
||||
"vmaddw.xyzw $vf3, $vf8, $vf3 \n\t"
|
||||
"vmulax.xyzw $ACC, $vf5, $vf4 \n\t"
|
||||
"vmadday.xyzw $ACC, $vf6, $vf4 \n\t"
|
||||
"vmaddaz.xyzw $ACC, $vf7, $vf4 \n\t"
|
||||
"vmaddw.xyzw $vf4, $vf8, $vf4 \n\t"
|
||||
"sqc2 $vf1, 0x00(%0) \n\t"
|
||||
"sqc2 $vf2, 0x10(%0) \n\t"
|
||||
"sqc2 $vf3, 0x20(%0) \n\t"
|
||||
"sqc2 $vf4, 0x30(%0) \n\t"
|
||||
:
|
||||
: "r"(res), "r"(b), "r"(a)
|
||||
: "memory");
|
||||
|
||||
@@ -30,10 +30,10 @@ Vector3 Vector3::operator+(const Vector3 &v) const
|
||||
{
|
||||
Vector3 result;
|
||||
asm volatile( // VU0 Macro program
|
||||
"lqc2 vf4, 0x0(%1) \n\t"
|
||||
"lqc2 vf5, 0x0(%2) \n\t"
|
||||
"vadd.xyz vf6, vf4, vf5 \n\t"
|
||||
"sqc2 vf6, 0x0(%0) \n\t"
|
||||
"lqc2 $vf4, 0x0(%1) \n\t"
|
||||
"lqc2 $vf5, 0x0(%2) \n\t"
|
||||
"vadd.xyz $vf6, $vf4, $vf5 \n\t"
|
||||
"sqc2 $vf6, 0x0(%0) \n\t"
|
||||
:
|
||||
: "r"(result.xyz), "r"(this->xyz), "r"(v.xyz));
|
||||
return result;
|
||||
@@ -43,10 +43,10 @@ Vector3 Vector3::operator-(const Vector3 &v) const
|
||||
{
|
||||
Vector3 result;
|
||||
asm volatile( // VU0 Macro program
|
||||
"lqc2 vf4, 0x0(%1) \n\t"
|
||||
"lqc2 vf5, 0x0(%2) \n\t"
|
||||
"vsub.xyz vf6, vf4, vf5 \n\t"
|
||||
"sqc2 vf6, 0x0(%0) \n\t"
|
||||
"lqc2 $vf4, 0x0(%1) \n\t"
|
||||
"lqc2 $vf5, 0x0(%2) \n\t"
|
||||
"vsub.xyz $vf6, $vf4, $vf5 \n\t"
|
||||
"sqc2 $vf6, 0x0(%0) \n\t"
|
||||
:
|
||||
: "r"(result.xyz), "r"(this->xyz), "r"(v.xyz));
|
||||
return result;
|
||||
@@ -56,12 +56,12 @@ Vector3 Vector3::operator*(const Vector3 &v) const
|
||||
{
|
||||
Vector3 res;
|
||||
asm volatile( // VU0 Macro program
|
||||
"lqc2 vf4, 0x0(%1) \n\t" // vf4 = this
|
||||
"lqc2 vf5, 0x0(%2) \n\t" // vf5 = v
|
||||
"vopmula.xyz ACC, vf4, vf5 \n\t"
|
||||
"vopmsub.xyz vf8, vf5, vf4 \n\t"
|
||||
"vsub.w vf8, vf00, vf00 \n\t"
|
||||
"sqc2 vf8, 0x0(%0) \n\t" // vf8 = res
|
||||
"lqc2 $vf4, 0x0(%1) \n\t" // $vf4 = this
|
||||
"lqc2 $vf5, 0x0(%2) \n\t" // $vf5 = v
|
||||
"vopmula.xyz $ACC, $vf4, $vf5 \n\t"
|
||||
"vopmsub.xyz $vf8, $vf5, $vf4 \n\t"
|
||||
"vsub.w $vf8, $vf0, $vf0 \n\t"
|
||||
"sqc2 $vf8, 0x0(%0) \n\t" // $vf8 = res
|
||||
:
|
||||
: "r"(res.xyz), "r"(this->xyz), "r"(v.xyz));
|
||||
// result.x = y * v.z - z * v.y;
|
||||
@@ -74,11 +74,11 @@ Vector3 Vector3::operator*(const float &t) const
|
||||
{
|
||||
Vector3 result;
|
||||
asm volatile(
|
||||
"lqc2 vf4, 0x0(%1) \n\t"
|
||||
"lqc2 $vf4, 0x0(%1) \n\t"
|
||||
"mfc1 $8, %2 \n\t"
|
||||
"qmtc2 $8, vf5 \n\t"
|
||||
"vmulx.xyz vf6, vf4, vf5 \n\t"
|
||||
"sqc2 vf6, 0x0(%0) \n\t"
|
||||
"qmtc2 $8, $vf5 \n\t"
|
||||
"vmulx.xyz $vf6, $vf4, $vf5 \n\t"
|
||||
"sqc2 $vf6, 0x0(%0) \n\t"
|
||||
:
|
||||
: "r"(result.xyz), "r"(this->xyz), "f"(t));
|
||||
return result;
|
||||
@@ -96,10 +96,10 @@ Vector3 Vector3::operator/(const float &t) const
|
||||
void Vector3::operator+=(const Vector3 &t)
|
||||
{
|
||||
asm volatile( // VU0 Macro program
|
||||
"lqc2 vf4, 0x0(%0) \n\t"
|
||||
"lqc2 vf5, 0x0(%1) \n\t"
|
||||
"vadd.xyz vf4, vf4, vf5 \n\t"
|
||||
"sqc2 vf4, 0x0(%0) \n\t"
|
||||
"lqc2 $vf4, 0x0(%0) \n\t"
|
||||
"lqc2 $vf5, 0x0(%1) \n\t"
|
||||
"vadd.xyz $vf4, $vf4, $vf5 \n\t"
|
||||
"sqc2 $vf4, 0x0(%0) \n\t"
|
||||
:
|
||||
: "r"(this->xyz), "r"(t.xyz));
|
||||
}
|
||||
@@ -107,11 +107,11 @@ void Vector3::operator+=(const Vector3 &t)
|
||||
void Vector3::operator*=(const float &t)
|
||||
{
|
||||
asm volatile(
|
||||
"lqc2 vf4, 0x0(%0) \n\t"
|
||||
"lqc2 $vf4, 0x0(%0) \n\t"
|
||||
"mfc1 $8, %1 \n\t"
|
||||
"qmtc2 $8, vf5 \n\t"
|
||||
"vmulx.xyz vf4, vf4, vf5 \n\t"
|
||||
"sqc2 vf4, 0x0(%0) \n\t"
|
||||
"qmtc2 $8, $vf5 \n\t"
|
||||
"vmulx.xyz $vf4, $vf4, $vf5 \n\t"
|
||||
"sqc2 $vf4, 0x0(%0) \n\t"
|
||||
:
|
||||
: "r"(this->xyz), "f"(t));
|
||||
}
|
||||
@@ -140,12 +140,12 @@ float Vector3::innerProduct(const Vector3 &v) const
|
||||
{
|
||||
float result;
|
||||
asm volatile( // VU0 Macro program
|
||||
"lqc2 vf4, 0x0(%1) \n\t"
|
||||
"lqc2 vf5, 0x0(%2) \n\t"
|
||||
"vmul.xyz vf6, vf4, vf5 \n\t"
|
||||
"vaddy.x vf6, vf6, vf6 \n\t"
|
||||
"vaddz.x vf6, vf6, vf6 \n\t"
|
||||
"qmfc2 $2, vf6 \n\t"
|
||||
"lqc2 $vf4, 0x0(%1) \n\t"
|
||||
"lqc2 $vf5, 0x0(%2) \n\t"
|
||||
"vmul.xyz $vf6, $vf4, $vf5 \n\t"
|
||||
"vaddy.x $vf6, $vf6, $vf6 \n\t"
|
||||
"vaddz.x $vf6, $vf6, $vf6 \n\t"
|
||||
"qmfc2 $2, $vf6 \n\t"
|
||||
"mtc1 $2, %0 \n\t"
|
||||
: "=f"(result)
|
||||
: "r"(this->xyz), "r"(v.xyz));
|
||||
@@ -157,14 +157,14 @@ float Vector3::length() const
|
||||
{
|
||||
float result;
|
||||
asm volatile( // VU0 Macro program
|
||||
"lqc2 vf4, 0x0(%1) \n\t"
|
||||
"vmul.xyz vf5, vf4, vf4 \n\t"
|
||||
"vaddy.x vf5, vf5, vf5 \n\t"
|
||||
"vaddz.x vf5, vf5, vf5 \n\t"
|
||||
"vsqrt Q , vf5x \n\t"
|
||||
"lqc2 $vf4, 0x0(%1) \n\t"
|
||||
"vmul.xyz $vf5, $vf4, $vf4 \n\t"
|
||||
"vaddy.x $vf5, $vf5, $vf5 \n\t"
|
||||
"vaddz.x $vf5, $vf5, $vf5 \n\t"
|
||||
"vsqrt $Q , $vf5x \n\t"
|
||||
"vwaitq \n\t"
|
||||
"vaddq.x vf8, vf0, Q \n\t"
|
||||
"qmfc2 $2, vf8 \n\t"
|
||||
"vaddq.x $vf8, $vf0, $Q \n\t"
|
||||
"qmfc2 $2, $vf8 \n\t"
|
||||
"mtc1 $2, %0 \n\t"
|
||||
: "=f"(result)
|
||||
: "r"(this->xyz));
|
||||
@@ -175,17 +175,17 @@ float Vector3::length() const
|
||||
void Vector3::normalize()
|
||||
{
|
||||
asm volatile( // VU0 Macro program
|
||||
"lqc2 vf4, 0x0(%0) \n\t"
|
||||
"vmul.xyz vf5, vf4, vf4 \n\t"
|
||||
"vaddy.x vf5, vf5, vf5 \n\t"
|
||||
"vaddz.x vf5, vf5, vf5 \n\t"
|
||||
"vrsqrt Q, vf0w, vf5x \n\t"
|
||||
"lqc2 $vf4, 0x0(%0) \n\t"
|
||||
"vmul.xyz $vf5, $vf4, $vf4 \n\t"
|
||||
"vaddy.x $vf5, $vf5, $vf5 \n\t"
|
||||
"vaddz.x $vf5, $vf5, $vf5 \n\t"
|
||||
"vrsqrt $Q, $vf0w, $vf5x \n\t"
|
||||
"vwaitq \n\t"
|
||||
"vsub.xyz vf6, vf0, vf0 \n\t"
|
||||
"vaddw.xyz vf6, vf6, vf4 \n\t"
|
||||
"vsub.xyz $vf6, $vf0, $vf0 \n\t"
|
||||
"vaddw.xyz $vf6, $vf6, $vf4 \n\t"
|
||||
"vwaitq \n\t"
|
||||
"vmulq.xyz vf6, vf4, Q \n\t"
|
||||
"sqc2 vf6, 0x0(%0) \n\t"
|
||||
"vmulq.xyz $vf6, $vf4, $Q \n\t"
|
||||
"sqc2 $vf6, 0x0(%0) \n\t"
|
||||
:
|
||||
: "r"(this->xyz));
|
||||
}
|
||||
@@ -194,16 +194,16 @@ float Vector3::distanceTo(const Vector3 &v) const
|
||||
{
|
||||
register float result;
|
||||
asm volatile( // VU0 Macro program
|
||||
"lqc2 vf4, 0x0(%1) \n\t"
|
||||
"lqc2 vf5, 0x0(%2) \n\t"
|
||||
"vsub.xyz vf6, vf4, vf5 \n\t"
|
||||
"vmul.xyz vf7, vf6, vf6 \n\t"
|
||||
"vaddy.x vf7, vf7, vf7 \n\t"
|
||||
"vaddz.x vf7, vf7, vf7 \n\t"
|
||||
"vsqrt Q , vf7x \n\t"
|
||||
"lqc2 $vf4, 0x0(%1) \n\t"
|
||||
"lqc2 $vf5, 0x0(%2) \n\t"
|
||||
"vsub.xyz $vf6, $vf4, $vf5 \n\t"
|
||||
"vmul.xyz $vf7, $vf6, $vf6 \n\t"
|
||||
"vaddy.x $vf7, $vf7, $vf7 \n\t"
|
||||
"vaddz.x $vf7, $vf7, $vf7 \n\t"
|
||||
"vsqrt $Q , $vf7x \n\t"
|
||||
"vwaitq \n\t"
|
||||
"vaddq.x vf8, vf0, Q \n\t"
|
||||
"qmfc2 $2, vf8 \n\t"
|
||||
"vaddq.x $vf8, $vf0, $Q \n\t"
|
||||
"qmfc2 $2, $vf8 \n\t"
|
||||
"mtc1 $2, %0 \n\t"
|
||||
: "=f"(result)
|
||||
: "r"(this->xyz), "r"(v.xyz));
|
||||
@@ -217,20 +217,20 @@ u8 Vector3::shouldBeBackfaceCulled(const Vector3 *t_cameraPos, const Vector3 *t_
|
||||
{
|
||||
register float dot;
|
||||
asm volatile(
|
||||
"lqc2 vf4, 0x0(%1) \n\t" // vf4 = cameraPos
|
||||
"lqc2 vf5, 0x0(%2) \n\t" // vf5 = v0
|
||||
"lqc2 vf6, 0x0(%3) \n\t" // vf6 = v1
|
||||
"lqc2 vf7, 0x0(%4) \n\t" // vf7 = v2
|
||||
"vsub.xyz vf8, vf7, vf5 \n\t" // vf8 = vf7(v2) - vf5(v0)
|
||||
"vsub.xyz vf9, vf6, vf5 \n\t" // vf9 = vf6(v1) - vf5(v0)
|
||||
"vopmula.xyz ACC, vf8, vf9 \n\t" // vf6 = cross(vf8, vf9)
|
||||
"vopmsub.xyz vf6, vf9, vf8 \n\t"
|
||||
"vsub.w vf6, vf6, vf6 \n\t"
|
||||
"vsub.xyz vf7, vf5, vf4 \n\t" // vf7 = vf5(v0) - vf4(cameraPos)
|
||||
"vmul.xyz vf5, vf7, vf6 \n\t" // vf5 = dot(vf7, vf6)
|
||||
"vaddy.x vf5, vf5, vf5 \n\t"
|
||||
"vaddz.x vf5, vf5, vf5 \n\t"
|
||||
"qmfc2 $2, vf5 \n\t" // store result on `dot` variable
|
||||
"lqc2 $vf4, 0x0(%1) \n\t" // $vf4 = cameraPos
|
||||
"lqc2 $vf5, 0x0(%2) \n\t" // $vf5 = v0
|
||||
"lqc2 $vf6, 0x0(%3) \n\t" // $vf6 = v1
|
||||
"lqc2 $vf7, 0x0(%4) \n\t" // $vf7 = v2
|
||||
"vsub.xyz $vf8, $vf7, $vf5 \n\t" // $vf8 = $vf7(v2) - $vf5(v0)
|
||||
"vsub.xyz $vf9, $vf6, $vf5 \n\t" // $vf9 = $vf6(v1) - $vf5(v0)
|
||||
"vopmula.xyz $ACC, $vf8, $vf9 \n\t" // $vf6 = cross($vf8, $vf9)
|
||||
"vopmsub.xyz $vf6, $vf9, $vf8 \n\t"
|
||||
"vsub.w $vf6, $vf6, $vf6 \n\t"
|
||||
"vsub.xyz $vf7, $vf5, $vf4 \n\t" // $vf7 = $vf5(v0) - $vf4(cameraPos)
|
||||
"vmul.xyz $vf5, $vf7, $vf6 \n\t" // $vf5 = dot($vf7, $vf6)
|
||||
"vaddy.x $vf5, $vf5, $vf5 \n\t"
|
||||
"vaddz.x $vf5, $vf5, $vf5 \n\t"
|
||||
"qmfc2 $2, $vf5 \n\t" // store result on `dot` variable
|
||||
"mtc1 $2, %0 \n\t"
|
||||
: "=f"(dot)
|
||||
: "r"(t_cameraPos->xyz), "r"(t_v0->xyz), "r"(t_v1->xyz), "r"(t_v2->xyz));
|
||||
@@ -240,14 +240,14 @@ u8 Vector3::shouldBeBackfaceCulled(const Vector3 *t_cameraPos, const Vector3 *t_
|
||||
void Vector3::setByLerp(const Vector3 &t_v1, const Vector3 &t_v2, const float &t_interp, const float &t_scale)
|
||||
{
|
||||
asm volatile(
|
||||
"lqc2 vf4, 0x0(%1) \n\t" // vf4 = v1
|
||||
"lqc2 vf5, 0x0(%2) \n\t" // vf5 = v2
|
||||
"mfc1 $8, %3 \n\t" // vf6 = t
|
||||
"qmtc2 $8, vf6 \n\t" // lerp:
|
||||
"vsub.xyz vf7, vf5, vf4 \n\t" // vf7 = v2 - v1
|
||||
"vmulx.xyz vf8, vf7, vf6 \n\t" // vf8 = vf7 * t
|
||||
"vadd.xyz vf9, vf8, vf4 \n\t" // vf9 = vf8 + vf4
|
||||
"sqc2 vf9, 0x0(%0) \n\t" // v0 = vf9
|
||||
"lqc2 $vf4, 0x0(%1) \n\t" // $vf4 = v1
|
||||
"lqc2 $vf5, 0x0(%2) \n\t" // $vf5 = v2
|
||||
"mfc1 $8, %3 \n\t" // $vf6 = t
|
||||
"qmtc2 $8, $vf6 \n\t" // lerp:
|
||||
"vsub.xyz $vf7, $vf5, $vf4 \n\t" // $vf7 = v2 - v1
|
||||
"vmulx.xyz $vf8, $vf7, $vf6 \n\t" // $vf8 = $vf7 * t
|
||||
"vadd.xyz $vf9, $vf8, $vf4 \n\t" // $vf9 = $vf8 + $vf4
|
||||
"sqc2 $vf9, 0x0(%0) \n\t" // v0 = $vf9
|
||||
:
|
||||
: "r"(&this->xyz), "r"(&t_v1.xyz), "r"(&t_v2.xyz), "f"(t_interp));
|
||||
operator*=(t_scale);
|
||||
|
||||
+58
-58
@@ -195,7 +195,7 @@ u32 Mesh::getDrawData(u32 t_materialIndex, VECTOR *o_vertices, VECTOR *o_normals
|
||||
asm volatile(
|
||||
// VU0 macro program:
|
||||
// Load vector with 1.0F values to VF21
|
||||
"lqc2 vf21, 0x0(%0) \n\t" // load "one vec"
|
||||
"lqc2 $vf21, 0x0(%0) \n\t" // load "one vec"
|
||||
:
|
||||
: "r"(ONE_VEC));
|
||||
|
||||
@@ -221,34 +221,34 @@ u32 Mesh::getDrawData(u32 t_materialIndex, VECTOR *o_vertices, VECTOR *o_normals
|
||||
// Calculate lerp() and store data into calc3Vectors
|
||||
|
||||
// Vertex 0
|
||||
"lqc2 vf4, 0x0(%3) \n\t" // vf4 = v1
|
||||
"lqc2 vf5, 0x0(%6) \n\t" // vf5 = v2
|
||||
"mfc1 $10, %9 \n\t" // vf6 = t
|
||||
"qmtc2 $10, vf6 \n\t" // lerp:
|
||||
"vsub.xyz vf7, vf5, vf4 \n\t" // vf7 = v2 - v1
|
||||
"vmulx.xyz vf8, vf7, vf6 \n\t" // vf8 = vf7 * t
|
||||
"vadd.xyz vf9, vf8, vf4 \n\t" // vf9 = vf8 + vf4
|
||||
"sqc2 vf9, 0x0(%0) \n\t" // v0 = vf9
|
||||
"lqc2 $vf4, 0x0(%3) \n\t" // $vf4 = v1
|
||||
"lqc2 $vf5, 0x0(%6) \n\t" // $vf5 = v2
|
||||
"mfc1 $10, %9 \n\t" // $vf6 = t
|
||||
"qmtc2 $10, $vf6 \n\t" // lerp:
|
||||
"vsub.xyz $vf7, $vf5, $vf4 \n\t" // $vf7 = v2 - v1
|
||||
"vmulx.xyz $vf8, $vf7, $vf6 \n\t" // $vf8 = $vf7 * t
|
||||
"vadd.xyz $vf9, $vf8, $vf4 \n\t" // $vf9 = $vf8 + $vf4
|
||||
"sqc2 $vf9, 0x0(%0) \n\t" // v0 = $vf9
|
||||
|
||||
// Vertex 1
|
||||
"lqc2 vf4, 0x0(%4) \n\t" // vf4 = v1
|
||||
"lqc2 vf5, 0x0(%7) \n\t" // vf5 = v2
|
||||
"mfc1 $10, %9 \n\t" // vf6 = t
|
||||
"qmtc2 $10, vf6 \n\t" // lerp:
|
||||
"vsub.xyz vf7, vf5, vf4 \n\t" // vf7 = v2 - v1
|
||||
"vmulx.xyz vf8, vf7, vf6 \n\t" // vf8 = vf7 * t
|
||||
"vadd.xyz vf9, vf8, vf4 \n\t" // vf9 = vf8 + vf4
|
||||
"sqc2 vf9, 0x0(%1) \n\t" // v0 = vf9
|
||||
"lqc2 $vf4, 0x0(%4) \n\t" // $vf4 = v1
|
||||
"lqc2 $vf5, 0x0(%7) \n\t" // $vf5 = v2
|
||||
"mfc1 $10, %9 \n\t" // $vf6 = t
|
||||
"qmtc2 $10, $vf6 \n\t" // lerp:
|
||||
"vsub.xyz $vf7, $vf5, $vf4 \n\t" // $vf7 = v2 - v1
|
||||
"vmulx.xyz $vf8, $vf7, $vf6 \n\t" // $vf8 = $vf7 * t
|
||||
"vadd.xyz $vf9, $vf8, $vf4 \n\t" // $vf9 = $vf8 + $vf4
|
||||
"sqc2 $vf9, 0x0(%1) \n\t" // v0 = $vf9
|
||||
|
||||
// Vertex 2
|
||||
"lqc2 vf4, 0x0(%5) \n\t" // vf4 = v1
|
||||
"lqc2 vf5, 0x0(%8) \n\t" // vf5 = v2
|
||||
"mfc1 $10, %9 \n\t" // vf6 = t
|
||||
"qmtc2 $10, vf6 \n\t" // lerp:
|
||||
"vsub.xyz vf7, vf5, vf4 \n\t" // vf7 = v2 - v1
|
||||
"vmulx.xyz vf8, vf7, vf6 \n\t" // vf8 = vf7 * t
|
||||
"vadd.xyz vf9, vf8, vf4 \n\t" // vf9 = vf8 + vf4
|
||||
"sqc2 vf9, 0x0(%2) \n\t" // v0 = vf9
|
||||
"lqc2 $vf4, 0x0(%5) \n\t" // $vf4 = v1
|
||||
"lqc2 $vf5, 0x0(%8) \n\t" // $vf5 = v2
|
||||
"mfc1 $10, %9 \n\t" // $vf6 = t
|
||||
"qmtc2 $10, $vf6 \n\t" // lerp:
|
||||
"vsub.xyz $vf7, $vf5, $vf4 \n\t" // $vf7 = v2 - v1
|
||||
"vmulx.xyz $vf8, $vf7, $vf6 \n\t" // $vf8 = $vf7 * t
|
||||
"vadd.xyz $vf9, $vf8, $vf4 \n\t" // $vf9 = $vf8 + $vf4
|
||||
"sqc2 $vf9, 0x0(%2) \n\t" // v0 = $vf9
|
||||
|
||||
:
|
||||
: "r"(calc3Vectors[0].xyz),
|
||||
@@ -267,12 +267,12 @@ u32 Mesh::getDrawData(u32 t_materialIndex, VECTOR *o_vertices, VECTOR *o_normals
|
||||
asm volatile(
|
||||
// VU0 macro program
|
||||
// Copy 0,1,2 vertices
|
||||
"lqc2 vf1, 0x0(%3) \n\t" // load vert
|
||||
"lqc2 vf2, 0x0(%4) \n\t" // load normal
|
||||
"lqc2 vf3, 0x0(%5) \n\t" // load st
|
||||
"sqc2 vf1, 0x0(%0) \n\t" // store vert
|
||||
"sqc2 vf2, 0x0(%1) \n\t" // store normal
|
||||
"sqc2 vf3, 0x0(%2) \n\t" // store st
|
||||
"lqc2 $vf1, 0x0(%3) \n\t" // load vert
|
||||
"lqc2 $vf2, 0x0(%4) \n\t" // load normal
|
||||
"lqc2 $vf3, 0x0(%5) \n\t" // load st
|
||||
"sqc2 $vf1, 0x0(%0) \n\t" // store vert
|
||||
"sqc2 $vf2, 0x0(%1) \n\t" // store normal
|
||||
"sqc2 $vf3, 0x0(%2) \n\t" // store st
|
||||
:
|
||||
: "r"(calc3Vectors[0].xyz),
|
||||
"r"(calc3Vectors[1].xyz),
|
||||
@@ -291,37 +291,37 @@ u32 Mesh::getDrawData(u32 t_materialIndex, VECTOR *o_vertices, VECTOR *o_normals
|
||||
// Copy data and set vert/normal "w" and st "z"+"w" to 1.0F
|
||||
|
||||
// Vertex 0
|
||||
"lqc2 vf1, 0x0(%3) \n\t" // load vert
|
||||
"lqc2 vf2, 0x0(%4) \n\t" // load normal
|
||||
"lqc2 vf3, 0x0(%5) \n\t" // load st
|
||||
"vadd.w vf1, vf20, vf21 \n\t" // set vert.w to 1.0F
|
||||
"vadd.w vf2, vf20, vf21 \n\t" // set normal.W to 1.0F
|
||||
"vadd.zw vf3, vf20, vf21 \n\t" // set st.zw to 1.0F
|
||||
"sqc2 vf1, 0x0(%0) \n\t" // store vert
|
||||
"sqc2 vf2, 0x0(%1) \n\t" // store normal
|
||||
"sqc2 vf3, 0x0(%2) \n\t" // store st
|
||||
"lqc2 $vf1, 0x0(%3) \n\t" // load vert
|
||||
"lqc2 $vf2, 0x0(%4) \n\t" // load normal
|
||||
"lqc2 $vf3, 0x0(%5) \n\t" // load st
|
||||
"vadd.w $vf1, $vf20, $vf21 \n\t" // set vert.w to 1.0F
|
||||
"vadd.w $vf2, $vf20, $vf21 \n\t" // set normal.W to 1.0F
|
||||
"vadd.zw $vf3, $vf20, $vf21 \n\t" // set st.zw to 1.0F
|
||||
"sqc2 $vf1, 0x0(%0) \n\t" // store vert
|
||||
"sqc2 $vf2, 0x0(%1) \n\t" // store normal
|
||||
"sqc2 $vf3, 0x0(%2) \n\t" // store st
|
||||
|
||||
// Vertex 1
|
||||
"lqc2 vf1, 0x0(%9) \n\t" // load vert
|
||||
"lqc2 vf2, 0x0(%10) \n\t" // load normal
|
||||
"lqc2 vf3, 0x0(%11) \n\t" // load st
|
||||
"vadd.w vf1, vf20, vf21 \n\t" // set vert.w to 1.0F
|
||||
"vadd.w vf2, vf20, vf21 \n\t" // set normal.W to 1.0F
|
||||
"vadd.zw vf3, vf20, vf21 \n\t" // set st.zw to 1.0F
|
||||
"sqc2 vf1, 0x0(%6) \n\t" // store vert
|
||||
"sqc2 vf2, 0x0(%7) \n\t" // store normal
|
||||
"sqc2 vf3, 0x0(%8) \n\t" // store st
|
||||
"lqc2 $vf1, 0x0(%9) \n\t" // load vert
|
||||
"lqc2 $vf2, 0x0(%10) \n\t" // load normal
|
||||
"lqc2 $vf3, 0x0(%11) \n\t" // load st
|
||||
"vadd.w $vf1, $vf20, $vf21 \n\t" // set vert.w to 1.0F
|
||||
"vadd.w $vf2, $vf20, $vf21 \n\t" // set normal.W to 1.0F
|
||||
"vadd.zw $vf3, $vf20, $vf21 \n\t" // set st.zw to 1.0F
|
||||
"sqc2 $vf1, 0x0(%6) \n\t" // store vert
|
||||
"sqc2 $vf2, 0x0(%7) \n\t" // store normal
|
||||
"sqc2 $vf3, 0x0(%8) \n\t" // store st
|
||||
|
||||
// Vertex 2
|
||||
"lqc2 vf1, 0x0(%15) \n\t" // load vert
|
||||
"lqc2 vf2, 0x0(%16) \n\t" // load normal
|
||||
"lqc2 vf3, 0x0(%17) \n\t" // load st
|
||||
"vadd.w vf1, vf20, vf21 \n\t" // set vert.w to 1.0F
|
||||
"vadd.w vf2, vf20, vf21 \n\t" // set normal.W to 1.0F
|
||||
"vadd.zw vf3, vf20, vf21 \n\t" // set st.zw to 1.0F
|
||||
"sqc2 vf1, 0x0(%12) \n\t" // store vert
|
||||
"sqc2 vf2, 0x0(%13) \n\t" // store normal
|
||||
"sqc2 vf3, 0x0(%14) \n\t" // store st
|
||||
"lqc2 $vf1, 0x0(%15) \n\t" // load vert
|
||||
"lqc2 $vf2, 0x0(%16) \n\t" // load normal
|
||||
"lqc2 $vf3, 0x0(%17) \n\t" // load st
|
||||
"vadd.w $vf1, $vf20, $vf21 \n\t" // set vert.w to 1.0F
|
||||
"vadd.w $vf2, $vf20, $vf21 \n\t" // set normal.W to 1.0F
|
||||
"vadd.zw $vf3, $vf20, $vf21 \n\t" // set st.zw to 1.0F
|
||||
"sqc2 $vf1, 0x0(%12) \n\t" // store vert
|
||||
"sqc2 $vf2, 0x0(%13) \n\t" // store normal
|
||||
"sqc2 $vf3, 0x0(%14) \n\t" // store st
|
||||
|
||||
:
|
||||
: "r"(o_vertices[addedFaces]),
|
||||
|
||||
@@ -178,6 +178,8 @@ void Audio::startThread(FileService *t_fileService)
|
||||
/** Main thread loop */
|
||||
void Audio::threadLoop()
|
||||
{
|
||||
if (songPlaying)
|
||||
songPlaying = 1; // GCC11: wtf? we need to put some code there, because song is not playing..
|
||||
if (!songPlaying || !songLoaded)
|
||||
return;
|
||||
if (songFinished)
|
||||
|
||||
@@ -328,6 +328,7 @@ void Renderer::draw(Mesh &t_mesh, LightBulb *t_bulbs, u16 t_bulbsCount)
|
||||
VECTOR normals[vertCount] __attribute__((aligned(16)));
|
||||
VECTOR coordinates[vertCount] __attribute__((aligned(16)));
|
||||
Texture *tex = textureRepo.getBySpriteOrMesh(material->getId());
|
||||
// printf("TexId:%d\n", tex->getId());
|
||||
changeTexture(tex);
|
||||
vertCount = t_mesh.getDrawData(i, vertices, normals, coordinates, rotatedCamera);
|
||||
vifSender->drawMesh(&renderData, perspective, vertCount, vertices, normals, coordinates, t_mesh, t_bulbs, t_bulbsCount, &textureBuffer, &material->color, !material->areSTsPresent());
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "../include/utils/math.hpp"
|
||||
|
||||
#include <math.h>
|
||||
#include <fastmath.h>
|
||||
|
||||
float Math::cos(float x)
|
||||
{
|
||||
@@ -72,16 +71,6 @@ float Math::cos(float x)
|
||||
return r;
|
||||
}
|
||||
|
||||
float Math::sqrt(float x)
|
||||
{
|
||||
float r;
|
||||
__asm__ volatile(
|
||||
"sqrt.s %0, %1 \n\t"
|
||||
: "=&f"(r)
|
||||
: "f"(x));
|
||||
return r;
|
||||
}
|
||||
|
||||
float Math::invSqrt(float x) { return 1.0F / sqrt(x); }
|
||||
|
||||
/** Converts Vector3 to PS2SDK's Vector4 */
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "../include/utils/string.hpp"
|
||||
#include "../include/utils/debug.hpp"
|
||||
#include <stdio.h>
|
||||
#define CHAR_BIT 8
|
||||
|
||||
char *String::createU32ToString(u32 a)
|
||||
{
|
||||
|
||||
@@ -73,7 +73,7 @@ void Dolphin::onInit()
|
||||
|
||||
printf("Loading water...\n");
|
||||
|
||||
u32 spiralOffset = (u32)Math::sqrt(WATER_TILES_COUNT);
|
||||
u32 spiralOffset = (u32)sqrt(WATER_TILES_COUNT);
|
||||
waterDrawList = new Mesh *[WATER_TILES_COUNT];
|
||||
calcSpiral(spiralOffset, spiralOffset);
|
||||
water[0].loadObj("water/", "water", WATER_TILE_SCALE, false);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include <utils/math.hpp>
|
||||
#include <utils/debug.hpp>
|
||||
#include <stdlib.h>
|
||||
|
||||
// ----
|
||||
// Constructors/Destructors
|
||||
@@ -26,7 +27,7 @@ FloorManager::FloorManager(int t_floorAmount, TextureRepository *t_texRepo)
|
||||
texRepo = t_texRepo;
|
||||
floorAmount = t_floorAmount;
|
||||
spirals = new Point[t_floorAmount];
|
||||
int floorSpiralMaxOffset = (int)Math::sqrt(t_floorAmount);
|
||||
int floorSpiralMaxOffset = (int)sqrt(t_floorAmount);
|
||||
calcSpiral(floorSpiralMaxOffset, floorSpiralMaxOffset);
|
||||
initFloors();
|
||||
trick = 0.0F;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <modules/gif_sender.hpp>
|
||||
#include <utils/debug.hpp>
|
||||
#include <utils/math.hpp>
|
||||
#include <stdlib.h>
|
||||
|
||||
// ----
|
||||
// Constructors/Destructors
|
||||
|
||||
Reference in New Issue
Block a user