View & Shrink_Window Docs (#1049)

* view and shrink_window docs

* cleanup

* move func declaration to header

* move struct to local

* PR Suggestions

* g to s
This commit is contained in:
engineer124
2022-10-02 11:32:57 -03:00
committed by GitHub
parent 063d24f491
commit 841da5f138
36 changed files with 362 additions and 276 deletions
-41
View File
@@ -2261,35 +2261,6 @@ void SkinMatrix_SetYRotation(MtxF* mf, s16 a);
void SkinMatrix_MulYRotation(MtxF* mf, s16 a);
void SkinMatrix_SetZRotation(MtxF* mf, s16 a);
void View_ViewportToVp(Vp* dest, Viewport* src);
void View_Init(View* view, GraphicsContext* gfxCtx);
void View_SetViewOrientation(View* view, Vec3f* eye, Vec3f* at, Vec3f* up);
void func_8013F050(View* view, Vec3f* eye, Vec3f* at, Vec3f* up);
void View_SetScale(View* view, f32 scale);
void View_GetScale(View* view, f32* scale);
void func_8013F0D0(View* view, f32 fovy, f32 zNear, f32 zFar);
void func_8013F100(View* view, f32* fovy, f32* zNear, f32* zFar);
void func_8013F120(View* view, f32 fovy, f32 zNear, f32 zFar);
void func_8013F15C(View* view, f32* fovy, f32* zNear, f32* zFar);
void View_SetViewport(View* view, Viewport* viewport);
void View_GetViewport(View* view, Viewport* viewport);
void View_WriteScissor(Gfx** gfx, s32 ulx, s32 uly, s32 lrx, s32 lry);
void View_SyncAndWriteScissor(View* view, Gfx** gfx);
void View_SetScissorForLetterbox(View* view);
s32 View_SetDistortionDirRot(View* view, f32 dirRotX, f32 dirRotY, f32 dirRotZ);
s32 View_SetDistortionScale(View* view, f32 scaleX, f32 scaleY, f32 scaleZ);
s32 View_SetDistortionSpeed(View* view, f32 speed);
s32 View_InitDistortion(View* view);
s32 View_ClearDistortion(View* view);
s32 View_SetDistortion(View* view, Vec3f dirRot, Vec3f scale, f32 speed);
s32 View_StepDistortion(View* view, Mtx* projectionMtx);
void View_RenderView(View* view, s32 uParm2);
s32 View_RenderToPerspectiveMatrix(View* view);
s32 View_RenderToOrthographicMatrix(View* view);
s32 func_8013FBC8(View* view);
s32 func_8013FD74(View* view);
s32 func_80140024(View* view);
s32 func_801400CC(View* view, Gfx** gfxp);
void func_80140260(OSViMode* vimode);
// void func_8014026C(OSViMode* param_1, UNK_TYPE1 param_2, s32 param_3, s32 param_4, s32 param_5, s32 param_6, s32 param_7, s32 param_8, UNK_TYPE4 param_9, s32 param_10, s16 param_11, u32 param_12, UNK_TYPE4 param_13);
// void func_80140730(void);
@@ -2399,18 +2370,6 @@ void Message_FindCreditsMessage(PlayState* play, u16 textId);
void func_8015E7EC(PlayState* play, UNK_PTR puParm2);
// void func_8015F8A8(UNK_TYPE4 ctxt);
void ShrinkWindow_SetLetterboxTarget(s32 target);
s32 ShrinkWindow_GetLetterboxTarget(void);
void ShrinkWindow_SetLetterboxMagnitude(s32 magnitude);
s32 ShrinkWindow_GetLetterboxMagnitude(void);
void ShrinkWindow_SetPillarboxTarget(s32 target);
s32 ShrinkWindow_GetPillarboxTarget(void);
void ShrinkWindow_SetPillarboxMagnitude(s32 magnitude);
s32 ShrinkWindow_GetPillarboxMagnitude(void);
void ShrinkWindow_Init(void);
void ShrinkWindow_Destroy(void);
void ShrinkWindow_Update(s32 framerateDivisor);
void ShrinkWindow_Draw(GraphicsContext* gfxCtx);
// void func_80161180(void);
s32 func_8016119C(Camera* camera, DbCameraUnkStruct* arg1);
// void func_8016122C(void);
-2
View File
@@ -3181,8 +3181,6 @@ extern s16 D_801F4E7A;
// extern UNK_TYPE1 D_801F6B1E;
// extern UNK_TYPE1 D_801F6B20;
// extern UNK_TYPE1 D_801F6B22;
extern ShrinkWindowContext gShrinkWindowContext;
extern ShrinkWindowContext* gShrinkWindowContextPtr;
// extern UNK_TYPE4 D_801F6B50;
// extern UNK_TYPE1 D_801F6B58;
extern void (*sKaleidoScopeUpdateFunc)(PlayState* play);
-7
View File
@@ -286,13 +286,6 @@ typedef struct {
/* 0x10 */ OSTime resetTime;
} NmiBuff; // size >= 0x18
typedef struct {
/* 0x0 */ s8 letterboxTarget;
/* 0x1 */ s8 letterboxMagnitude;
/* 0x2 */ s8 pillarboxTarget;
/* 0x3 */ s8 pillarboxMagnitude;
} ShrinkWindowContext; // size = 0x4
typedef void(*osCreateThread_func)(void*);
typedef enum {
+23
View File
@@ -0,0 +1,23 @@
#ifndef Z64SHRINK_WINDOW_H
#define Z64SHRINK_WINDOW_H
#include "PR/ultratypes.h"
struct GraphicsContext;
void ShrinkWindow_Letterbox_SetSizeTarget(s32 target);
s32 ShrinkWindow_Letterbox_GetSizeTarget(void);
void ShrinkWindow_Letterbox_SetSize(s32 size);
s32 ShrinkWindow_Letterbox_GetSize(void);
void ShrinkWindow_Pillarbox_SetSizeTarget(s32 target);
s32 ShrinkWindow_Pillarbox_GetSizeTarget(void);
void ShrinkWindow_Pillarbox_SetSize(s32 size);
s32 ShrinkWindow_Pillarbox_GetSize(void);
void ShrinkWindow_Init(void);
void ShrinkWindow_Destroy(void);
void ShrinkWindow_Update(s32 framerateDivisor);
void ShrinkWindow_Draw(GraphicsContext* gfxCtx);
#endif
+38 -3
View File
@@ -33,16 +33,27 @@ typedef struct View {
/* 0x0E0 */ Mtx unkE0;
/* 0x120 */ Mtx* projectionPtr;
/* 0x124 */ Mtx* viewingPtr;
/* 0x128 */ Vec3f distortionDirRot;
/* 0x128 */ Vec3f distortionOrientation;
/* 0x134 */ Vec3f distortionScale;
/* 0x140 */ f32 distortionSpeed;
/* 0x144 */ Vec3f curDistortionDirRot;
/* 0x144 */ Vec3f curDistortionOrientation;
/* 0x150 */ Vec3f curDistortionScale;
/* 0x15C */ u16 normal; // used to normalize the projection matrix
/* 0x15C */ u16 perspNorm; // used to normalize the projection matrix
/* 0x160 */ u32 flags; // bit 3: Render to an orthographic perspective
/* 0x164 */ s32 unk164;
} View; // size = 0x168
#define VIEW_VIEWING (1 << 0)
#define VIEW_VIEWPORT (1 << 1)
#define VIEW_PROJECTION_PERSPECTIVE (1 << 2)
#define VIEW_PROJECTION_ORTHO (1 << 3)
#define VIEW_ALL (VIEW_VIEWING | VIEW_VIEWPORT | VIEW_PROJECTION_PERSPECTIVE | VIEW_PROJECTION_ORTHO)
#define VIEW_FORCE_VIEWING (VIEW_VIEWING << 4)
#define VIEW_FORCE_VIEWPORT (VIEW_VIEWPORT << 4)
#define VIEW_FORCE_PROJECTION_PERSPECTIVE (VIEW_PROJECTION_PERSPECTIVE << 4)
#define VIEW_FORCE_PROJECTION_ORTHO (VIEW_PROJECTION_ORTHO << 4)
#define SET_FULLSCREEN_VIEWPORT(view) \
{ \
Viewport viewport; \
@@ -54,4 +65,28 @@ typedef struct View {
} \
(void)0
void View_Init(View* view, struct GraphicsContext* gfxCtx);
void View_LookAt(View* view, Vec3f* eye, Vec3f* at, Vec3f* up);
void View_SetScale(View* view, f32 scale);
void View_GetScale(View* view, f32* scale);
void View_SetPerspective(View* view, f32 fovy, f32 zNear, f32 zFar);
void View_GetPerspective(View* view, f32* fovy, f32* zNear, f32* zFar);
void View_SetOrtho(View* view, f32 fovy, f32 zNear, f32 zFar);
void View_GetOrtho(View* view, f32* fovy, f32* zNear, f32* zFar);
void View_SetViewport(View* view, Viewport* viewport);
void View_GetViewport(View* view, Viewport* viewport);
s32 View_SetDistortionOrientation(View* view, f32 rotX, f32 rotY, f32 rotZ);
s32 View_SetDistortionScale(View* view, f32 scaleX, f32 scaleY, f32 scaleZ);
s32 View_SetDistortionSpeed(View* view, f32 speed);
s32 View_InitDistortion(View* view);
s32 View_ClearDistortion(View* view);
s32 View_SetDistortion(View* view, Vec3f orientation, Vec3f scale, f32 speed);
void View_Apply(View* view, s32 mask);
s32 View_ApplyOrthoToOverlay(View* view);
s32 View_ApplyPerspectiveToOverlay(View* view);
s32 View_UpdateViewingMatrix(View* view);
s32 View_ApplyTo(View* view, Gfx** gfxp);
#endif