diff options
| author | Tharo <17233964+Thar0@users.noreply.github.com> | 2023-09-16 22:16:58 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-16 17:16:58 -0400 |
| commit | 9b207c356a66aec59815cbbd557f40d48d7cccdd (patch) | |
| tree | c21d897790081774101831ac610682317ef5a149 /include | |
| parent | 239a172114b891fffe7af21777dc5313f0de9441 (diff) | |
Document Framebuffer Filters, VisCvg and VisZbuf (#1534)
* Document z_viscvg and z_viszbuf
Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>
Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
* Few more notes
* Some more notes
Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>
* Review
* Americanisation, FB RGB
* Oops
* Review
* Minor documentation modifications
* Header, base struct and enums
Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>
* functions.h fix
* Suggested changes, further adjustments to file doc comments
* Further suggested changes, standardize capitalization of gfxP
* g
---------
Co-authored-by: Elliptic Ellipsis <elliptic.ellipsis@gmail.com>
Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/functions.h | 41 | ||||
| -rw-r--r-- | include/z64.h | 26 | ||||
| -rw-r--r-- | include/z64vis.h | 87 |
3 files changed, 104 insertions, 50 deletions
diff --git a/include/functions.h b/include/functions.h index 8430208a2..73ec1d5c7 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1069,7 +1069,7 @@ void Gfx_SetupDL_37Opa(GraphicsContext* gfxCtx); Gfx* Gfx_SetupDL_39(Gfx* gfx); void Gfx_SetupDL_39Opa(GraphicsContext* gfxCtx); void Gfx_SetupDL_39Overlay(GraphicsContext* gfxCtx); -void Gfx_SetupDL_39Ptr(Gfx** gfxp); +void Gfx_SetupDL_39Ptr(Gfx** gfxP); void Gfx_SetupDL_40Opa(GraphicsContext* gfxCtx); void Gfx_SetupDL_41Opa(GraphicsContext* gfxCtx); void Gfx_SetupDL_47Xlu(GraphicsContext* gfxCtx); @@ -1081,8 +1081,8 @@ void Gfx_SetupDL_42Overlay(GraphicsContext* gfxCtx); void Gfx_SetupDL_27Xlu(GraphicsContext* gfxCtx); void Gfx_SetupDL_60NoCDXlu(GraphicsContext* gfxCtx); void Gfx_SetupDL_61Xlu(GraphicsContext* gfxCtx); -void Gfx_SetupDL_56Ptr(Gfx** gfxp); -Gfx* Gfx_BranchTexScroll(Gfx** gfxp, u32 x, u32 y, s32 width, s32 height); +void Gfx_SetupDL_56Ptr(Gfx** gfxP); +Gfx* Gfx_BranchTexScroll(Gfx** gfxP, u32 x, u32 y, s32 width, s32 height); Gfx* func_80094E78(GraphicsContext* gfxCtx, u32 x, u32 y); Gfx* Gfx_TexScroll(GraphicsContext* gfxCtx, u32 x, u32 y, s32 width, s32 height); Gfx* Gfx_TwoTexScroll(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, u32 x2, @@ -1187,7 +1187,7 @@ 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, s32 mask, Gfx** gfxp); +s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxP); s32 View_ErrorCheckEyePosition(f32 eyeX, f32 eyeY, f32 eyeZ); void ViMode_LogPrint(OSViMode* osViMode); void ViMode_Configure(ViMode* viMode, s32 type, s32 tvType, s32 loRes, s32 antialiasOff, s32 modeN, s32 fb16Bit, @@ -1198,15 +1198,6 @@ void ViMode_Init(ViMode* viMode); void ViMode_Destroy(ViMode* viMode); void ViMode_ConfigureFeatures(ViMode* viMode, s32 viFeatures); void ViMode_Update(ViMode* viMode, Input* input); -void func_800ACE70(struct_801664F0* this); -void func_800ACE90(struct_801664F0* this); -void func_800ACE98(struct_801664F0* this, Gfx** gfxp); -void VisMono_Init(VisMono* this); -void VisMono_Destroy(VisMono* this); -void VisMono_Draw(VisMono* this, Gfx** gfxp); -void func_800AD920(struct_80166500* this); -void func_800AD950(struct_80166500* this); -void func_800AD958(struct_80166500* this, Gfx** gfxp); void PlayerCall_InitFuncPtrs(void); void TransitionTile_Destroy(TransitionTile* this); TransitionTile* TransitionTile_Init(TransitionTile* this, s32 cols, s32 rows); @@ -1305,15 +1296,15 @@ void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf, void PreRender_Init(PreRender* this); void PreRender_SetValues(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf); void PreRender_Destroy(PreRender* this); -void func_800C170C(PreRender* this, Gfx** gfxp, void* buf, void* bufSave, u32 r, u32 g, u32 b, u32 a); -void func_800C1AE8(PreRender* this, Gfx** gfxp, void* fbuf, void* fbufSave); -void PreRender_SaveZBuffer(PreRender* this, Gfx** gfxp); -void PreRender_SaveFramebuffer(PreRender* this, Gfx** gfxp); -void PreRender_DrawCoverage(PreRender* this, Gfx** gfxp); -void PreRender_RestoreZBuffer(PreRender* this, Gfx** gfxp); -void func_800C213C(PreRender* this, Gfx** gfxp); -void PreRender_RestoreFramebuffer(PreRender* this, Gfx** gfxp); -void PreRender_CopyImageRegion(PreRender* this, Gfx** gfxp); +void func_800C170C(PreRender* this, Gfx** gfxP, void* buf, void* bufSave, u32 r, u32 g, u32 b, u32 a); +void func_800C1AE8(PreRender* this, Gfx** gfxP, void* fbuf, void* fbufSave); +void PreRender_SaveZBuffer(PreRender* this, Gfx** gfxP); +void PreRender_SaveFramebuffer(PreRender* this, Gfx** gfxP); +void PreRender_DrawCoverage(PreRender* this, Gfx** gfxP); +void PreRender_RestoreZBuffer(PreRender* this, Gfx** gfxP); +void func_800C213C(PreRender* this, Gfx** gfxP); +void PreRender_RestoreFramebuffer(PreRender* this, Gfx** gfxP); +void PreRender_CopyImageRegion(PreRender* this, Gfx** gfxP); void PreRender_ApplyFilters(PreRender* this); void AudioMgr_StopAllSfx(void); void func_800C3C80(AudioMgr* audioMgr); @@ -1323,8 +1314,8 @@ void AudioMgr_ThreadEntry(void* arg0); void AudioMgr_Unlock(AudioMgr* audioMgr); void AudioMgr_Init(AudioMgr* audioMgr, void* stack, OSPri pri, OSId id, Scheduler* sched, IrqMgr* irqMgr); void GameState_FaultPrint(void); -void GameState_SetFBFilter(Gfx** gfx); -void GameState_DrawInputDisplay(u16 input, Gfx** gfx); +void GameState_SetFBFilter(Gfx** gfxP); +void GameState_DrawInputDisplay(u16 input, Gfx** gfxP); void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx); void GameState_SetFrameBuffer(GraphicsContext* gfxCtx); void GameState_ReqPadData(GameState* gameState); @@ -1358,7 +1349,7 @@ void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, s32 line); Gfx* Graph_GfxPlusOne(Gfx* gfx); Gfx* Graph_BranchDlist(Gfx* gfx, Gfx* dst); -void* Graph_DlistAlloc(Gfx** gfx, u32 size); +void* Graph_DlistAlloc(Gfx** gfxP, u32 size); ListAlloc* ListAlloc_Init(ListAlloc* this); void* ListAlloc_Alloc(ListAlloc* this, u32 size); void ListAlloc_Free(ListAlloc* this, void* data); diff --git a/include/z64.h b/include/z64.h index d0032b6ea..0e7698115 100644 --- a/include/z64.h +++ b/include/z64.h @@ -35,6 +35,7 @@ #include "z64skybox.h" #include "z64sram.h" #include "z64view.h" +#include "z64vis.h" #include "alignment.h" #include "seqcmd.h" #include "sequence.h" @@ -795,29 +796,4 @@ typedef struct { /* 0x84 */ u32 unk_84; } ViMode; // size = 0x88 -// Vis... -typedef struct { - /* 0x00 */ u32 type; - /* 0x04 */ u32 setScissor; - /* 0x08 */ Color_RGBA8_u32 color; - /* 0x0C */ Color_RGBA8_u32 envColor; -} struct_801664F0; // size = 0x10 - -typedef struct { - /* 0x00 */ u32 unk_00; - /* 0x04 */ u32 setScissor; - /* 0x08 */ Color_RGBA8_u32 primColor; - /* 0x0C */ Color_RGBA8_u32 envColor; - /* 0x10 */ u16* tlut; - /* 0x14 */ Gfx* dList; -} VisMono; // size = 0x18 - -// Vis... -typedef struct { - /* 0x00 */ u32 useRgba; - /* 0x04 */ u32 setScissor; - /* 0x08 */ Color_RGBA8_u32 primColor; - /* 0x08 */ Color_RGBA8_u32 envColor; -} struct_80166500; // size = 0x10 - #endif diff --git a/include/z64vis.h b/include/z64vis.h new file mode 100644 index 000000000..c88d6de48 --- /dev/null +++ b/include/z64vis.h @@ -0,0 +1,87 @@ +#ifndef Z64_VIS_H +#define Z64_VIS_H + +#include "ultra64.h" +#include "color.h" + +typedef enum { + /* 0 */ FB_FILTER_NONE, + /* 1 */ FB_FILTER_CVG_RGB, + /* 2 */ FB_FILTER_CVG_RGB_UNIFORM, + /* 3 */ FB_FILTER_CVG_ONLY, + /* 4 */ FB_FILTER_CVG_RGB_FOG, // Not recommended, easily overflows blender + /* 5 */ FB_FILTER_ZBUF_IA, + /* 6 */ FB_FILTER_ZBUF_RGBA, + /* 7 */ FB_FILTER_MONO +} FramebufferFilterType; + +typedef enum { + /* 0 */ VIS_NO_SETSCISSOR, + /* 1 */ VIS_SETSCISSOR +} VisScissorType; + +typedef struct { + /* 0x00 */ u32 type; + /* 0x04 */ u32 scissorType; + /* 0x08 */ Color_RGBA8_u32 primColor; + /* 0x0C */ Color_RGBA8_u32 envColor; +} Vis; // size = 0x10 + + + +/* Cvg: Coverage */ + +#define FB_FILTER_TO_CVG_TYPE(filter) (filter) + +typedef enum { + /* 0 */ VIS_CVG_TYPE_NONE = FB_FILTER_TO_CVG_TYPE(FB_FILTER_NONE), + /* 1 */ VIS_CVG_TYPE_CVG_RGB = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_RGB), + /* 2 */ VIS_CVG_TYPE_CVG_RGB_UNIFORM = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_RGB_UNIFORM), + /* 3 */ VIS_CVG_TYPE_CVG_ONLY = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_ONLY), + /* 4 */ VIS_CVG_TYPE_CVG_RGB_FOG = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_RGB_FOG) +} VisCvgType; + +typedef struct { + /* 0x00 */ Vis vis; +} VisCvg; // size = 0x10 + +void VisCvg_Init(VisCvg* this); +void VisCvg_Destroy(VisCvg* this); +void VisCvg_Draw(VisCvg* this, Gfx** gfxP); + + + +/* Mono: Desaturation */ + +// Only one type + +typedef struct { + /* 0x00 */ Vis vis; + /* 0x10 */ u16* tlut; + /* 0x14 */ Gfx* dList; +} VisMono; // size = 0x18 + +void VisMono_Init(VisMono* this); +void VisMono_Destroy(VisMono* this); +void VisMono_Draw(VisMono* this, Gfx** gfxP); + + + +/* ZBuf: Z-Buffer */ + +#define FB_FILTER_TO_ZBUF_TYPE(filter) ((filter) - FB_FILTER_ZBUF_IA) + +typedef enum { + /* 0 */ VIS_ZBUF_TYPE_IA = FB_FILTER_TO_ZBUF_TYPE(FB_FILTER_ZBUF_IA), + /* 1 */ VIS_ZBUF_TYPE_RGBA = FB_FILTER_TO_ZBUF_TYPE(FB_FILTER_ZBUF_RGBA) +} VisZBufType; + +typedef struct { + /* 0x00 */ Vis vis; +} VisZBuf; // size = 0x10 + +void VisZBuf_Init(VisZBuf* this); +void VisZBuf_Destroy(VisZBuf* this); +void VisZBuf_Draw(VisZBuf* this, Gfx** gfxP); + +#endif |
