Revert Vector change, build as a PRX

This commit is contained in:
Wally4000 2024-01-26 15:09:43 +11:00
parent 299bad4983
commit 4de4e22eac
4 changed files with 48 additions and 37 deletions

View file

@ -238,6 +238,7 @@ link_libraries(ZLIB::ZLIB)
BACKGROUND_PATH ${PROJECT_SOURCE_DIR}/Source/SysPSP/Resources/eboot_icons/pic1.png
PREVIEW_PATH NULL
TITLE DaedalusX64
BUILD_PRX
)
endif(PSP)

View file

@ -7,35 +7,35 @@
class v2
{
public:
constexpr v2() {}
constexpr v2( float _x, float _y ) : x( _x ), y( _y ) {}
v2() {}
v2( float _x, float _y ) : x( _x ), y( _y ) {}
constexpr v2 operator+( const v2 & v ) const
v2 operator+( const v2 & v ) const
{
return v2( x + v.x, y + v.y );
}
constexpr v2 operator-( const v2 & v ) const
v2 operator-( const v2 & v ) const
{
return v2( x - v.x, y - v.y );
}
constexpr v2 operator+() const
v2 operator+() const
{
return *this;
}
constexpr v2 operator-() const
v2 operator-() const
{
return v2( -x, -y );
}
constexpr v2 operator*( float s ) const
v2 operator*( float s ) const
{
return v2( x * s, y * s );
}
friend constexpr v2 operator*( float s, const v2 & v )
inline friend v2 operator*( float s, const v2 & v )
{
return v2( v.x * s, v.y * s );
}
@ -46,7 +46,7 @@ public:
return v2( x * r, y * r );
}
v2 & operator+=( const v2 & rhs )
const v2 & operator+=( const v2 & rhs )
{
x += rhs.x;
y += rhs.y;

View file

@ -2,51 +2,51 @@
#define MATH_VECTOR3_H_
#include "Math/Math.h" // VFPU Math
#include <algorithm>
class v3
{
public:
constexpr v3() {}
constexpr v3( float _x, float _y, float _z ) : x( _x ), y( _y ), z( _z ) {}
v3() {}
v3( float _x, float _y, float _z ) : x( _x ), y( _y ), z( _z ) {}
constexpr v3 operator+( const v3 & v ) const
v3 operator+( const v3 & v ) const
{
return v3( x + v.x, y + v.y, z + v.z );
}
constexpr v3 operator-( const v3 & v ) const
v3 operator-( const v3 & v ) const
{
return v3( x - v.x, y - v.y, z - v.z );
}
constexpr v3 operator+() const
v3 operator+() const
{
return *this;
}
constexpr v3 operator-() const
v3 operator-() const
{
return v3( -x, -y, -z );
}
constexpr v3 operator*( float s ) const
v3 operator*( float s ) const
{
return v3( x * s, y * s, z * s );
return std::move(v3( x * s, y * s, z * s ));
}
constexpr friend v3 operator*( float s, const v3 & v )
inline friend v3 operator*( float s, const v3 & v )
{
return v3( v.x * s, v.y * s, v.z * s );
return std::move(v3( v.x * s, v.y * s, v.z * s ));
}
constexpr v3 operator/( float s ) const
v3 operator/( float s ) const
{
float r( 1.0f / s );
return v3( x * r, y * r, z * r );
}
constexpr const v3 & operator+=( const v3 & rhs )
const v3 & operator+=( const v3 & rhs )
{
x += rhs.x;
y += rhs.y;
@ -54,7 +54,7 @@ public:
return *this;
}
constexpr v3 & operator*=( float s )
const v3 & operator*=( float s )
{
x *= s;
y *= s;
@ -86,17 +86,28 @@ public:
return sqrtf( (x*x)+(y*y)+(z*z) );
}
constexpr float LengthSq() const
float LengthSq() const
{
return ( x * x) + ( y * y ) + ( z * z );
return (x*x)+(y*y)+(z*z);
}
constexpr float MinComponent() const
float MinComponent() const
{
return std::min(std::min(x, y), z);
if(x < y && x < z)
{
return x;
}
else if(y < z)
{
return y;
}
else
{
return z;
}
}
constexpr float Dot( const v3 & rhs ) const
float Dot( const v3 & rhs ) const
{
return (x*rhs.x) + (y*rhs.y) + (z*rhs.z);
}

View file

@ -5,11 +5,11 @@
#include "Base/Types.h"
class v4
class alignas(DATA_ALIGN) v4
{
public:
constexpr v4() {}
constexpr v4( float _x, float _y, float _z, float _w ) : x( _x ), y( _y ), z( _z ), w( _w ) {}
v4() {}
v4( float _x, float _y, float _z, float _w ) : x( _x ), y( _y ), z( _z ), w( _w ) {}
float Normalise()
{
@ -29,17 +29,16 @@ public:
return len_sq;
}
constexpr v4 operator+( const v4 & v ) const
v4 operator+( const v4 & v ) const
{
return (v4( x + v.x, y + v.y, z + v.z, w + v.w ));
}
constexpr v4 operator-( const v4 & v ) const
v4 operator-( const v4 & v ) const
{
return v4( x - v.x, y - v.y, z - v.z, w - v.w );
}
constexpr v4 operator*( float s ) const
v4 operator*( float s ) const
{
return v4( x * s, y * s, z * s, w * s );
}
@ -49,12 +48,12 @@ public:
return sqrtf( (x*x)+(y*y)+(z*z)+(w*w) );
}
constexpr float LengthSq() const
float LengthSq() const
{
return (x*x)+(y*y)+(z*z)+(w*w);
}
constexpr float Dot( const v4 & rhs ) const
float Dot( const v4 & rhs ) const
{
return (x*rhs.x) + (y*rhs.y) + (z*rhs.z) + (w*rhs.w);
}