mirror of
https://github.com/zeldaret/oot
synced 2026-08-21 22:40:55 -04:00
Small Skin system documentation pass (#1017)
* some docs * rename a bunch of callbacks * more cleanup * format * last cleanup * some updates * more docs * done i think * name flag and format * name unused variable * comments * revert unwanted change * z64skin.h * format * Address review * Rename PostLimbDraw callbacks to PostDraw and some PR addressing * add true/false for setTranslation * ahhhh * remove "you" Co-authored-by: fig02 <fig02srl@gmail.com>
This commit is contained in:
+13
-18
@@ -1277,24 +1277,19 @@ void SkelAnime_UpdateTranslation(SkelAnime* skelAnime, Vec3f* pos, s16 angle);
|
||||
s32 Animation_OnFrame(SkelAnime* skelAnime, f32 frame);
|
||||
void SkelAnime_Free(SkelAnime* skelAnime, GlobalContext* globalCtx);
|
||||
void SkelAnime_CopyFrameTable(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src);
|
||||
void func_800A57C0(MtxF* mtx, Struct_800A57C0* arg1, Struct_800A598C* arg2, Vtx* arg3, Vec3f* arg4);
|
||||
void func_800A598C(GraphicsContext* gfxCtx, PSkinAwb* skin, s32 limbIndex, s32 arg3);
|
||||
void func_800A5E28(GraphicsContext* gfxCtx, PSkinAwb* skin, s32 limbIndex, s32 arg3, s32 arg4);
|
||||
void func_800A5F60(GraphicsContext* gfxCtx, PSkinAwb* skin, s32 limbIndex, Gfx* arg3, s32 arg4);
|
||||
void func_800A60D8(Actor* actor, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, SkinCallback2 arg4,
|
||||
s32 arg5, s32 arg6, s32 arg7);
|
||||
void func_800A6330(Actor* actor, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, s32 arg4);
|
||||
void func_800A6360(Actor* this, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, SkinCallback2 arg4,
|
||||
s32 arg5);
|
||||
void func_800A63CC(Actor* actor, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, SkinCallback2 arg4,
|
||||
s32 arg5, s32 arg6, s32 arg7);
|
||||
void func_800A6408(PSkinAwb* skin, s32 joint, Vec3f* arg2, Vec3f* arg3);
|
||||
void func_800A6460(GlobalContext* globalCtx, PSkinAwb* skin, s32 arg2);
|
||||
void func_800A663C(GlobalContext* globalCtx, PSkinAwb* skin, SkeletonHeader* skeletonHeader,
|
||||
AnimationHeader* animationHeader);
|
||||
void func_800A6888(GlobalContext* globalCtx, PSkinAwb* skin);
|
||||
s32 func_800A698C(PSkinAwb* skin, SkinLimb** limbs, MtxF* arg2, u8 arg3, u8 arg4);
|
||||
s32 func_800A6AC4(PSkinAwb* skin, MtxF* arg1, Actor* actor, s32 arg3);
|
||||
|
||||
void Skin_UpdateVertices(MtxF* mtx, SkinVertex* skinVertices, SkinLimbModif* modifEntry, Vtx* vtxBuf, Vec3f* pos);
|
||||
void Skin_DrawAnimatedLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, s32 arg3, s32 drawFlags);
|
||||
void Skin_DrawLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, Gfx* dlistOverride, s32 drawFlags);
|
||||
void func_800A6330(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, s32 setTranslation);
|
||||
void func_800A6360(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation);
|
||||
void func_800A6394(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6);
|
||||
void func_800A63CC(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6, s32 drawFlags);
|
||||
void Skin_GetLimbPos(Skin* skin, s32 limbIndex, Vec3f* arg2, Vec3f* dst);
|
||||
void Skin_Init(GlobalContext* globalCtx, Skin* skin, SkeletonHeader* skeletonHeader, AnimationHeader* animationHeader);
|
||||
void Skin_Free(GlobalContext* globalCtx, Skin* skin);
|
||||
s32 Skin_ApplyAnimTransformations(Skin* skin, MtxF* mf, Actor* actor, s32 setTranslation);
|
||||
|
||||
void SkinMatrix_Vec3fMtxFMultXYZW(MtxF* mf, Vec3f* src, Vec3f* xyzDest, f32* wDest);
|
||||
void SkinMatrix_Vec3fMtxFMultXYZ(MtxF* mf, Vec3f* src, Vec3f* dest);
|
||||
void SkinMatrix_MtxFMtxFMult(MtxF* mfA, MtxF* mfB, MtxF* dest);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "z64dma.h"
|
||||
#include "z64math.h"
|
||||
#include "z64map_mark.h"
|
||||
#include "z64skin.h"
|
||||
#include "z64transition.h"
|
||||
#include "z64interface.h"
|
||||
#include "sequence.h"
|
||||
|
||||
@@ -45,14 +45,6 @@ typedef struct {
|
||||
/* 0x08 */ Gfx* dLists[2]; // Near and far
|
||||
} LodLimb; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ Vec3s jointPos; // Root is position in model space, children are relative to parent
|
||||
/* 0x06 */ u8 child;
|
||||
/* 0x07 */ u8 sibling;
|
||||
/* 0x08 */ s32 unk_8; // Type of data contained in segment
|
||||
/* 0x0C */ void* segment; // Segment address of data. Currently unclear what.
|
||||
} SkinLimb; // size = 0x10
|
||||
|
||||
typedef struct LegacyLimb {
|
||||
/* 0x000 */ Gfx* dList;
|
||||
/* 0x004 */ Vec3f trans;
|
||||
@@ -271,53 +263,4 @@ typedef struct SkelAnime {
|
||||
/* 0x3E */ Vec3s baseTransl; // Base modelspace translation.
|
||||
} SkelAnime; // size = 0x44
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ u16 unk_0;
|
||||
/* 0x002 */ s16 unk_2;
|
||||
/* 0x004 */ s16 unk_4;
|
||||
/* 0x006 */ s8 unk_6;
|
||||
/* 0x007 */ s8 unk_7;
|
||||
/* 0x008 */ s8 unk_8;
|
||||
/* 0x009 */ u8 unk_9;
|
||||
} Struct_800A57C0; // size = 0xA
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ u8 unk_0;
|
||||
/* 0x002 */ s16 x;
|
||||
/* 0x004 */ s16 y;
|
||||
/* 0x006 */ s16 z;
|
||||
/* 0x008 */ u8 unk_8;
|
||||
} Struct_800A598C_2; // size = 0xA
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ u16 unk_0;
|
||||
/* 0x002 */ u16 unk_2;
|
||||
/* 0x004 */ u16 unk_4;
|
||||
/* 0x008 */ Struct_800A57C0* unk_8;
|
||||
/* 0x00C */ Struct_800A598C_2* unk_C;
|
||||
} Struct_800A598C; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ u16 unk_0;
|
||||
/* 0x002 */ u16 unk_2;
|
||||
/* 0x004 */ Struct_800A598C* unk_4;
|
||||
/* 0x008 */ Gfx* unk_8;
|
||||
} Struct_800A5E28; // size = 0xC
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ u8 unk_0;
|
||||
/* 0x004 */ Vtx* buf[2];
|
||||
} SkinAvb; // size = 0xC
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ SkeletonHeader* skeletonHeader;
|
||||
/* 0x004 */ MtxF mtx;
|
||||
/* 0x044 */ s32 avbCount;
|
||||
/* 0x048 */ SkinAvb* avbTbl;
|
||||
/* 0x04C */ SkelAnime skelAnime;
|
||||
} PSkinAwb; // size = 0x90
|
||||
|
||||
typedef void (*SkinCallback)(struct Actor*, struct GlobalContext*, PSkinAwb*);
|
||||
typedef s32 (*SkinCallback2)(struct Actor*, struct GlobalContext*, s32, PSkinAwb*);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
#ifndef Z64_SKIN_H
|
||||
#define Z64_SKIN_H
|
||||
|
||||
#include "z64animation.h"
|
||||
|
||||
/**
|
||||
* Holds a compact version of a vertex used in the Skin system
|
||||
* It is used to initialise the Vtx used by an animated limb
|
||||
*/
|
||||
typedef struct {
|
||||
/* 0x00 */ u16 index;
|
||||
/* 0x02 */ s16 s; // s and t are texture coordinates (also known as u and v)
|
||||
/* 0x04 */ s16 t;
|
||||
/* 0x06 */ s8 normX;
|
||||
/* 0x07 */ s8 normY;
|
||||
/* 0x08 */ s8 normZ;
|
||||
/* 0x09 */ u8 alpha;
|
||||
} SkinVertex; // size = 0xA
|
||||
|
||||
/**
|
||||
* Describes a position displacement and a scale to be applied to a limb at index `limbIndex`
|
||||
*/
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 limbIndex;
|
||||
/* 0x02 */ s16 x;
|
||||
/* 0x04 */ s16 y;
|
||||
/* 0x06 */ s16 z;
|
||||
/* 0x08 */ u8 scale;
|
||||
} SkinTransformation; // size = 0xA
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u16 vtxCount; // number of vertices in this modif entry
|
||||
/* 0x02 */ u16 transformCount;
|
||||
/* 0x04 */ u16 unk_4; // index of limbTransformations?
|
||||
/* 0x08 */ SkinVertex* skinVertices;
|
||||
/* 0x0C */ SkinTransformation* limbTransformations;
|
||||
} SkinLimbModif; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u16 totalVtxCount; // total vertex count for all modif entries
|
||||
/* 0x02 */ u16 limbModifCount;
|
||||
/* 0x04 */ SkinLimbModif* limbModifications;
|
||||
/* 0x08 */ Gfx* dlist;
|
||||
} SkinAnimatedLimbData; // size = 0xC
|
||||
|
||||
// ZAPD compatibility typedefs
|
||||
// TODO: Remove when ZAPD adds support for them
|
||||
typedef SkinVertex Struct_800A57C0;
|
||||
typedef SkinTransformation Struct_800A598C_2;
|
||||
typedef SkinAnimatedLimbData Struct_800A5E28;
|
||||
typedef SkinLimbModif Struct_800A598C;
|
||||
|
||||
#define SKIN_LIMB_TYPE_ANIMATED 4
|
||||
#define SKIN_LIMB_TYPE_NORMAL 11
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ Vec3s jointPos; // Root is position in model space, children are relative to parent
|
||||
/* 0x06 */ u8 child;
|
||||
/* 0x07 */ u8 sibling;
|
||||
/* 0x08 */ s32 segmentType; // Type of data contained in segment
|
||||
/* 0x0C */ void* segment; // Gfx* if segmentType is SKIN_LIMB_TYPE_NORMAL, SkinAnimatedLimbData* if segmentType is SKIN_LIMB_TYPE_ANIMATED, NULL otherwise
|
||||
} SkinLimb; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ u8 index; // alternates every draw cycle
|
||||
/* 0x004 */ Vtx* buf[2]; // number of vertices in buffer determined by `totalVtxCount`
|
||||
} SkinLimbVtx; // size = 0xC
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ SkeletonHeader* skeletonHeader;
|
||||
/* 0x004 */ MtxF mtx;
|
||||
/* 0x044 */ s32 limbCount;
|
||||
/* 0x048 */ SkinLimbVtx* vtxTable; // double buffered list of vertices for each limb
|
||||
/* 0x04C */ SkelAnime skelAnime;
|
||||
} Skin; // size = 0x90
|
||||
|
||||
typedef void (*SkinPostDraw)(struct Actor*, struct GlobalContext*, Skin*);
|
||||
typedef s32 (*SkinOverrideLimbDraw)(struct Actor*, struct GlobalContext*, s32, Skin*);
|
||||
|
||||
#define SKIN_DRAW_FLAG_CUSTOM_TRANSFORMS (1 << 0)
|
||||
#define SKIN_DRAW_FLAG_CUSTOM_MATRIX (1 << 1)
|
||||
|
||||
#define SKIN_TRANSFORM_IS_FHG 0x23
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user