summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorhatal175 <hatal175@users.noreply.github.com>2023-07-08 06:06:50 +0300
committerGitHub <noreply@github.com>2023-07-08 06:06:50 +0300
commitcf26cd610d4e88f391c7d854b5da5b7460d130c5 (patch)
tree60e6811736d30ccc13d62b086ab37e96a7c1f337 /include
parentc59ac1f2e9593aaf31a3394777a122e5678c963b (diff)
parentb9383052a342986015d51c59440944b6b8ccf740 (diff)
Merge pull request #364 from hatal175/m_do_graphics
Work on m_Do_graphic
Diffstat (limited to 'include')
-rw-r--r--include/JSystem/JGeometry.h39
-rw-r--r--include/JSystem/JParticle/JPAParticle.h5
-rw-r--r--include/d/kankyo/d_kankyo.h2
-rw-r--r--include/dolphin/mtx/vec.h14
-rw-r--r--include/f_op/f_op_camera_mng.h4
-rw-r--r--include/m_Do/m_Do_graphic.h9
6 files changed, 72 insertions, 1 deletions
diff --git a/include/JSystem/JGeometry.h b/include/JSystem/JGeometry.h
index dd984bcc85..8f37b01fc9 100644
--- a/include/JSystem/JGeometry.h
+++ b/include/JSystem/JGeometry.h
@@ -3,6 +3,8 @@
#include "dolphin/mtx/vec.h"
#include "dolphin/types.h"
+#include "MSL_C/float.h"
+#include "MSL_C/math.h"
namespace JGeometry {
@@ -46,6 +48,11 @@ inline void setTVec3f(const f32* vec_a, f32* vec_b) {
};
}
+inline float fsqrt_step(float mag) {
+ f32 root = __frsqrte(mag);
+ return 0.5f * root * (3.0f - mag * (root * root));
+}
+
template <>
struct TVec3<f32> {
f32 x;
@@ -110,6 +117,38 @@ struct TVec3<f32> {
};
return *this;
}
+
+ f32 squared() {
+ return C_VECSquareMag((Vec*)&x);
+ }
+
+ void normalize() {
+ f32 sq = squared();
+ if (sq <= FLT_EPSILON * 32.0f) {
+ return;
+ }
+ f32 norm;
+ if (sq <= 0.0f) {
+ norm = sq;
+ } else {
+ norm = fsqrt_step(sq);
+ }
+ scale(norm);
+ }
+
+ void scale(register f32 sc) {
+ register f32 z;
+ register f32 x_y;
+ register f32* dst = &x;
+ asm {
+ psq_l x_y, 0(dst), 0, 0
+ psq_l z, 8(dst), 1, 0
+ ps_muls0 x_y, x_y, sc
+ psq_st x_y, 0(dst), 0, 0
+ ps_muls0 x_y, z, sc
+ psq_st x_y, 8(dst), 1, 0
+ };
+ }
};
template <typename T>
diff --git a/include/JSystem/JParticle/JPAParticle.h b/include/JSystem/JParticle/JPAParticle.h
index ed4fe9142a..3d27dca8e4 100644
--- a/include/JSystem/JParticle/JPAParticle.h
+++ b/include/JSystem/JParticle/JPAParticle.h
@@ -75,6 +75,11 @@ public:
template <class T>
struct JPANode {
+ JPANode() {
+ mpPrev = NULL;
+ mpNext = NULL;
+ }
+ ~JPANode() {}
JPANode<T>* mpPrev;
JPANode<T>* mpNext;
T mData;
diff --git a/include/d/kankyo/d_kankyo.h b/include/d/kankyo/d_kankyo.h
index a1655a0773..24f7e67cb0 100644
--- a/include/d/kankyo/d_kankyo.h
+++ b/include/d/kankyo/d_kankyo.h
@@ -525,7 +525,7 @@ public:
/* 0x12F4 */ dKy_color_data_struct* mResColorDataTbl;
/* 0x12F8 */ s8 mFogDensity;
/* 0x12F9 */ u8 field_0x12f9;
- /* 0x12FA */ u8 field_0x12fa;
+ /* 0x12FA */ u8 mIsBlure;
/* 0x12FB */ u8 field_0x12fb;
/* 0x12FC */ s8 field_0x12fc;
/* 0x12FD */ u8 mDarktimeWeek;
diff --git a/include/dolphin/mtx/vec.h b/include/dolphin/mtx/vec.h
index 29b3961af7..0167c0aad7 100644
--- a/include/dolphin/mtx/vec.h
+++ b/include/dolphin/mtx/vec.h
@@ -33,6 +33,20 @@ f32 PSVECDistance(const Vec* a, const Vec* b);
void C_VECHalfAngle(const Vec* a, const Vec* b, Vec* half);
void C_VECReflect(const Vec* src, const Vec* normal, Vec* dst);
+inline f32 C_VECSquareMag(const Vec* v) {
+ register f32 x_y;
+ register f32 z;
+ register const f32* src = &v->x;
+ asm {
+ psq_l x_y, 0(src), 0, 0
+ ps_mul x_y, x_y, x_y
+ lfs z, 8(src)
+ ps_madd z, z, z, x_y
+ ps_sum0 z, z, x_y, x_y
+ };
+ return z;
+}
+
#ifdef __cplusplus
};
#endif
diff --git a/include/f_op/f_op_camera_mng.h b/include/f_op/f_op_camera_mng.h
index d022417bad..37ee8dfcbe 100644
--- a/include/f_op/f_op_camera_mng.h
+++ b/include/f_op/f_op_camera_mng.h
@@ -62,6 +62,10 @@ inline s16 fopCamM_GetAngleY(camera_class* i_camera) {
return i_camera->mAngle.y;
}
+inline f32 fopCamM_GetFovy(camera_class* i_camera) {
+ return i_camera->mFovy;
+}
+
u32 fopCamM_Create(int i_cameraIdx, s16 pProcName, void* param_3);
void fopCamM_Management(void);
u32 fopCamM_GetParam(camera_class* pCamera);
diff --git a/include/m_Do/m_Do_graphic.h b/include/m_Do/m_Do_graphic.h
index 1c24974dc5..d6884266fa 100644
--- a/include/m_Do/m_Do_graphic.h
+++ b/include/m_Do/m_Do_graphic.h
@@ -62,7 +62,11 @@ public:
static void offFade() { mFade = 0; }
static u8 isFade() { return mFade; }
static void offBlure() { mBlureFlag = false; }
+ static bool isBlure() { return mBlureFlag; }
+ static u8 getBlureRate() { return mBlureRate; }
+ static MtxP getBlureMtx() { return mBlureMtx; }
static void offAutoForcus() { data_80450BE7 = 0; }
+ static bool isAutoForcus() { return data_80450BE7; }
static void setTickRate(u32 rate) { JFWDisplay::getManager()->setTickRate(rate); }
static void waitBlanking(int wait) { JFWDisplay::getManager()->waitBlanking(wait); }
static f32 getWidthF() { return 608.0f; }
@@ -81,12 +85,16 @@ public:
static ResTIMG* getFrameBufferTimg() { return mFrameBufferTimg; }
static ResTIMG* getZbufferTimg() { return mZbufferTimg; }
static void* getFrameBufferTex() { return mFrameBufferTex; }
+ static void* getZbufferTex() { return mZbufferTex; }
static void setFadeRate(f32 rate) { mFadeRate = rate; }
static f32 getFadeRate() { return mFadeRate; }
static bloom_c* getBloom() { return &m_bloom; }
static GXColor& getFadeColor() { return mFadeColor; }
static GXColor& getBackColor() { return mBackColor; }
static void endRender() { JFWDisplay::getManager()->endRender(); }
+ static GXTexObj* getZbufferTexObj() { return &mZbufferTexObj; }
+ static GXTexObj* getFrameBufferTexObj() { return &mFrameBufferTexObj; }
+ static f32 getInvScale() { return 1.0f; }
static GXTexObj mFrameBufferTexObj;
static GXTexObj mZbufferTexObj;
@@ -102,6 +110,7 @@ public:
static f32 mFadeRate;
static f32 mFadeSpeed;
static bool mBlureFlag;
+ static u8 mBlureRate;
static u8 mFade;
};