diff options
Diffstat (limited to 'arm9/lib/include')
-rw-r--r-- | arm9/lib/include/NNS_g3d.h | 12 | ||||
-rw-r--r-- | arm9/lib/include/fx.h | 16 |
2 files changed, 25 insertions, 3 deletions
diff --git a/arm9/lib/include/NNS_g3d.h b/arm9/lib/include/NNS_g3d.h index b927ecfb..f9a3a1b8 100644 --- a/arm9/lib/include/NNS_g3d.h +++ b/arm9/lib/include/NNS_g3d.h @@ -74,4 +74,16 @@ static inline void NNS_G3dGlbLookAt(const VecFx32 * camPos, const VecFx32 * camU NNS_G3dGlb.flag &= ~(NNS_G3D_GLB_FLAG_INVCAMERA_UPTODATE | NNS_G3D_GLB_FLAG_INVBASECAMERA_UPTODATE | NNS_G3D_GLB_FLAG_INVCAMERAPROJ_UPTODATE | NNS_G3D_GLB_FLAG_BASECAMERA_UPTODATE);
}
+static inline void NNS_G3dGlbPerspective(fx32 fovySin, fx32 fovyCos, fx32 aspect, fx32 n, fx32 f)
+{
+ MTX_Perspective(fovySin, fovyCos, aspect, n, f, &NNS_G3dGlb.projMtx);
+ NNS_G3dGlb.flag &= ~(NNS_G3D_GLB_FLAG_INVPROJ_UPTODATE | NNS_G3D_GLB_FLAG_INVCAMERAPROJ_UPTODATE);
+}
+
+static inline void NNS_G3dGlbOrtho(fx32 t, fx32 b, fx32 l, fx32 r, fx32 n, fx32 f)
+{
+ MTX_Ortho(t, b, l, r, n, f, &NNS_G3dGlb.projMtx);
+ NNS_G3dGlb.flag &= ~(NNS_G3D_GLB_FLAG_INVPROJ_UPTODATE | NNS_G3D_GLB_FLAG_INVCAMERAPROJ_UPTODATE);
+}
+
#endif //GUARD_NNS_G3D_H
diff --git a/arm9/lib/include/fx.h b/arm9/lib/include/fx.h index 5e8b5dca..de851f62 100644 --- a/arm9/lib/include/fx.h +++ b/arm9/lib/include/fx.h @@ -13,15 +13,15 @@ u16 FX_Atan(fx32 x); u16 FX_Atan2(fx32 x, fx32 y); //Vec -void VEC_Add(struct Vecx32 *x, struct Vecx32 *y, struct Vecx32 *dst); -void VEC_Subtract(struct Vecx32 *x, struct Vecx32 *y, struct Vecx32 *dst); +void VEC_Add(const struct Vecx32 *a, const struct Vecx32 *b, struct Vecx32 *dst); +void VEC_Subtract(const struct Vecx32 *a, const struct Vecx32 *b, struct Vecx32 *dst); void VEC_Fx16Add(struct Vecx16 *x, struct Vecx16 *y, struct Vecx16 *dst); fx32 VEC_DotProduct(const struct Vecx32 *a, const struct Vecx32 *b); fx32 VEC_Fx16DotProduct(struct Vecx16 *a, struct Vecx16 *b); void VEC_CrossProduct(const struct Vecx32 *a, const struct Vecx32 *b, struct Vecx32 *dst); void VEC_Fx16CrossProduct(struct Vecx16 *a, struct Vecx16 *b, struct Vecx16 *dst); fx32 VEC_Mag(struct Vecx32 *a); -void VEC_Normalize(struct Vecx32 *a, struct Vecx32 *dst); +void VEC_Normalize(const struct Vecx32 *a, struct Vecx32 *dst); void VEC_Fx16Normalize(struct Vecx16 *a, struct Vecx16 *dst); void VEC_MultAdd(fx32 factor, struct Vecx32 *a, struct Vecx32 *b, struct Vecx32 *dst); @@ -110,4 +110,14 @@ static inline void MTX_LookAt(const VecFx32 * camPos, const VecFx32 * camUp, con G3i_LookAt_(camPos, camUp, target, FALSE, mtx); } +static inline void MTX_Perspective(fx32 fovySin, fx32 fovyCos, fx32 aspect, fx32 n, fx32 f, MtxFx44 * mtx) +{ + G3i_PerspectiveW_(fovySin, fovyCos, aspect, n, f, FX32_ONE, FALSE, mtx); +} + +static inline void MTX_Ortho(fx32 t, fx32 b, fx32 l, fx32 r, fx32 n, fx32 f, MtxFx44 * mtx) +{ + G3i_OrthoW_(t, b, l, r, n, f, FX32_ONE, FALSE, mtx); +} + #endif //GUARD_FX_H |