Match and link CAxisAngle

This commit is contained in:
Phillip Stephens 2022-10-08 10:39:03 -07:00
parent 1029d92fd4
commit e6969f0236
6 changed files with 68 additions and 5 deletions

View File

@ -24,6 +24,7 @@ args = parser.parse_args()
# Completed c/cpp files to link # Completed c/cpp files to link
COMPLETE_OBJECTS = [ COMPLETE_OBJECTS = [
"MetroTRK/mslsupp", "MetroTRK/mslsupp",
"MetroidPrime/CAxisAngle",
"MetroidPrime/CEntity", "MetroidPrime/CEntity",
"MetroidPrime/TCastTo", "MetroidPrime/TCastTo",
"MetroidPrime/UserNames", "MetroidPrime/UserNames",

View File

@ -5,7 +5,8 @@
#include <dolphin/gx/GXEnum.h> #include <dolphin/gx/GXEnum.h>
#include "MetaRender/Renderer.hpp" #include "MetaRender/IRenderer.hpp"
#include "Weapons/IWeaponRenderer.hpp"
#include "Kyoto/Graphics/CColor.hpp" #include "Kyoto/Graphics/CColor.hpp"
#include "Kyoto/Math/CAABox.hpp" #include "Kyoto/Math/CAABox.hpp"
@ -19,7 +20,7 @@
class CSkinnedModel; class CSkinnedModel;
class CModel; class CModel;
class CCubeRenderer { class CCubeRenderer : public IRenderer, public IWeaponRenderer {
public: public:
virtual ~CCubeRenderer(); virtual ~CCubeRenderer();
// TODO types // TODO types

View File

@ -5,22 +5,34 @@
#include <math.h> #include <math.h>
#include "Kyoto/Math/CVector3f.hpp" #include "Kyoto/Math/CVector3f.hpp"
#include "Kyoto/Math/CUnitVector3f.hpp"
class CAxisAngle { class CAxisAngle {
static const CAxisAngle sIdentity;
friend CAxisAngle operator+(const CAxisAngle&, const CAxisAngle&);
friend CAxisAngle operator*(const CAxisAngle&, const float&);
friend CAxisAngle operator*(const float&, const CAxisAngle&);
public: public:
CAxisAngle(f32 x, f32 y, f32 z) : mVector(x, y, z) {} CAxisAngle() : mVector(CVector3f::Zero()) {}
explicit CAxisAngle(const CVector3f& vec); explicit CAxisAngle(const CVector3f& vec);
static const CAxisAngle& Identity(); explicit CAxisAngle(const CUnitVector3f& vec, float);
CAxisAngle(f32 x, f32 y, f32 z) : mVector(x, y, z) {}
void FromVector(const CVector3f& angle);
static const CAxisAngle& Identity();
float GetAngle() const; float GetAngle() const;
const CVector3f& GetVector() const; const CVector3f& GetVector() const;
const CAxisAngle& operator*=(const float& rhs);
const CAxisAngle& operator+=(const CAxisAngle& rhs); const CAxisAngle& operator+=(const CAxisAngle& rhs);
private: private:
CVector3f mVector; CVector3f mVector;
}; };
CAxisAngle operator+(const CAxisAngle& lhs, const CAxisAngle& rhs); CAxisAngle operator+(const CAxisAngle& lhs, const CAxisAngle& rhs);
CAxisAngle operator*(const CAxisAngle& lhs,const float& rhs);
CAxisAngle operator*(const float& rhs, const CAxisAngle& lhs);
CHECK_SIZEOF(CAxisAngle, 0xc) CHECK_SIZEOF(CAxisAngle, 0xc)
#endif #endif

View File

@ -9,7 +9,7 @@ METROIDPRIME :=\
$(BUILD_DIR)/asm/MetroidPrime/Cameras/CFirstPersonCamera.o\ $(BUILD_DIR)/asm/MetroidPrime/Cameras/CFirstPersonCamera.o\
$(BUILD_DIR)/asm/MetroidPrime/CObjectList.o\ $(BUILD_DIR)/asm/MetroidPrime/CObjectList.o\
$(BUILD_DIR)/asm/MetroidPrime/Player/CPlayer.o\ $(BUILD_DIR)/asm/MetroidPrime/Player/CPlayer.o\
$(BUILD_DIR)/asm/MetroidPrime/CAxisAngle.o\ $(BUILD_DIR)/src/MetroidPrime/CAxisAngle.o\
$(BUILD_DIR)/asm/MetroidPrime/CEulerAngles.o\ $(BUILD_DIR)/asm/MetroidPrime/CEulerAngles.o\
$(BUILD_DIR)/asm/MetroidPrime/CFrontEndUI.o\ $(BUILD_DIR)/asm/MetroidPrime/CFrontEndUI.o\
$(BUILD_DIR)/asm/MetroidPrime/CInputGenerator.o\ $(BUILD_DIR)/asm/MetroidPrime/CInputGenerator.o\

View File

@ -0,0 +1,49 @@
#include "MetroidPrime/CAxisAngle.hpp"
const CAxisAngle CAxisAngle::sIdentity;
CAxisAngle::CAxisAngle(const CVector3f& vec) : mVector(vec) {}
CAxisAngle::CAxisAngle(const CUnitVector3f& vec, float angle) : mVector(vec * angle) {}
void CAxisAngle::FromVector(const CVector3f& axis) {
mVector = axis;
}
const CAxisAngle& CAxisAngle::Identity() {
return sIdentity;
}
const CVector3f& CAxisAngle::GetVector() const {
return mVector;
}
float CAxisAngle::GetAngle() const {
return mVector.Magnitude();
}
const CAxisAngle& CAxisAngle::operator*=(const float& rhs) {
mVector *= rhs;
return *this;
}
const CAxisAngle& CAxisAngle::operator+=(const CAxisAngle& rhs) {
mVector += rhs.mVector;
return *this;
}
CAxisAngle operator*(const CAxisAngle& lhs,const float& rhs) {
CAxisAngle angle;
angle.mVector = lhs.mVector * rhs;
return angle;
}
CAxisAngle operator*(const float& lhs, const CAxisAngle& rhs) {
CAxisAngle angle;
angle.mVector = lhs * rhs.mVector;
return angle;
}
CAxisAngle operator+(const CAxisAngle& lhs, const CAxisAngle& rhs) {
CAxisAngle angle = lhs;
angle.mVector = lhs.mVector + rhs.mVector;
return angle;
}