diff --git a/configure.py b/configure.py index 66ecdca8..23651108 100755 --- a/configure.py +++ b/configure.py @@ -24,6 +24,7 @@ args = parser.parse_args() # Completed c/cpp files to link COMPLETE_OBJECTS = [ "MetroTRK/mslsupp", + "MetroidPrime/CAxisAngle", "MetroidPrime/CEntity", "MetroidPrime/TCastTo", "MetroidPrime/UserNames", diff --git a/include/MetaRender/CCubeRenderer.hpp b/include/MetaRender/CCubeRenderer.hpp index 3e595c0c..85642c56 100644 --- a/include/MetaRender/CCubeRenderer.hpp +++ b/include/MetaRender/CCubeRenderer.hpp @@ -5,7 +5,8 @@ #include -#include "MetaRender/Renderer.hpp" +#include "MetaRender/IRenderer.hpp" +#include "Weapons/IWeaponRenderer.hpp" #include "Kyoto/Graphics/CColor.hpp" #include "Kyoto/Math/CAABox.hpp" @@ -19,7 +20,7 @@ class CSkinnedModel; class CModel; -class CCubeRenderer { +class CCubeRenderer : public IRenderer, public IWeaponRenderer { public: virtual ~CCubeRenderer(); // TODO types diff --git a/include/MetaRender/Renderer.hpp b/include/MetaRender/IRenderer.hpp similarity index 100% rename from include/MetaRender/Renderer.hpp rename to include/MetaRender/IRenderer.hpp diff --git a/include/MetroidPrime/CAxisAngle.hpp b/include/MetroidPrime/CAxisAngle.hpp index bd11eed8..6bc3cdde 100644 --- a/include/MetroidPrime/CAxisAngle.hpp +++ b/include/MetroidPrime/CAxisAngle.hpp @@ -5,22 +5,34 @@ #include #include "Kyoto/Math/CVector3f.hpp" +#include "Kyoto/Math/CUnitVector3f.hpp" 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: - CAxisAngle(f32 x, f32 y, f32 z) : mVector(x, y, z) {} + CAxisAngle() : mVector(CVector3f::Zero()) {} explicit CAxisAngle(const CVector3f& vec); + 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; const CVector3f& GetVector() const; + const CAxisAngle& operator*=(const float& rhs); const CAxisAngle& operator+=(const CAxisAngle& rhs); private: CVector3f mVector; }; 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) #endif diff --git a/obj_files.mk b/obj_files.mk index fb91fb97..a1a0582c 100644 --- a/obj_files.mk +++ b/obj_files.mk @@ -9,7 +9,7 @@ METROIDPRIME :=\ $(BUILD_DIR)/asm/MetroidPrime/Cameras/CFirstPersonCamera.o\ $(BUILD_DIR)/asm/MetroidPrime/CObjectList.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/CFrontEndUI.o\ $(BUILD_DIR)/asm/MetroidPrime/CInputGenerator.o\ diff --git a/src/MetroidPrime/CAxisAngle.cpp b/src/MetroidPrime/CAxisAngle.cpp new file mode 100644 index 00000000..9b939819 --- /dev/null +++ b/src/MetroidPrime/CAxisAngle.cpp @@ -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; +}