1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-10-20 05:30:26 +00:00

Cleanup VecSph: Better Distinguish Between "Spherical" vs. "Geographic" Coordinates (#1407)

* begin geo and sph docs

* cleanup

* cleanup

* cleanup struct

* PR suggestions

* spacing
This commit is contained in:
engineer124 2022-10-15 09:43:59 -04:00 committed by GitHub
commit a2d62eedb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 561 additions and 539 deletions

View file

@ -950,10 +950,10 @@ f32 OLib_Vec3fDistXZ(Vec3f* a, Vec3f* b);
f32 OLib_ClampMinDist(f32 val, f32 min);
f32 OLib_ClampMaxDist(f32 val, f32 max);
Vec3f* OLib_Vec3fDistNormalize(Vec3f* dest, Vec3f* a, Vec3f* b);
Vec3f* OLib_VecSphGeoToVec3f(Vec3f* dest, VecSph* sph);
Vec3f* OLib_VecGeoToVec3f(Vec3f* dest, VecGeo* geo);
VecSph* OLib_Vec3fToVecSph(VecSph* dest, Vec3f* vec);
VecSph* OLib_Vec3fToVecSphGeo(VecSph* dest, Vec3f* vec);
VecSph* OLib_Vec3fDiffToVecSphGeo(VecSph* dest, Vec3f* a, Vec3f* b);
VecGeo* OLib_Vec3fToVecGeo(VecGeo* dest, Vec3f* vec);
VecGeo* OLib_Vec3fDiffToVecGeo(VecGeo* dest, Vec3f* a, Vec3f* b);
Vec3f* OLib_Vec3fDiffRad(Vec3f* dest, Vec3f* a, Vec3f* b);
s16 OnePointCutscene_Init(PlayState* play, s16 csId, s16 timer, Actor* actor, s16 parentCamId);
s16 OnePointCutscene_EndCutscene(PlayState* play, s16 subCamId);
@ -1360,7 +1360,7 @@ u32 Letterbox_GetSize(void);
void Letterbox_Init(void);
void Letterbox_Destroy(void);
void Letterbox_Update(s32 updateRate);
// ? DbCamera_AddVecSph(?);
// ? DbCamera_AddVecGeoToVec3f(?);
// ? DbCamera_CalcUpFromPitchYawRoll(?);
// ? DbCamera_SetTextValue(?);
// ? DbCamera_Vec3SToF(?);

View file

@ -439,7 +439,9 @@ typedef struct {
typedef struct {
/* 0x00 */ SwingAnimation swing;
/* 0x1C */ f32 unk_1C;
/* 0x20 */ VecSph unk_20;
/* 0x20 */ f32 unk_20;
/* 0x24 */ s16 unk_24;
/* 0x26 */ s16 unk_26;
} Jump1ReadWriteData; // size = 0x28
typedef struct {
@ -670,7 +672,9 @@ typedef struct {
} KeepOn3ReadOnlyData; // size = 0x2C
typedef struct {
/* 0x00 */ Vec3f eyeToAtTarget; // esentially a VecSph, but all floats.
/* 0x00 */ f32 eyeToAtTargetR;
/* 0x08 */ f32 eyeToAtTargetYaw;
/* 0x04 */ f32 eyeToAtTargetPitch;
/* 0x0C */ Actor* target;
/* 0x10 */ Vec3f atTarget;
/* 0x1C */ s16 animTimer;
@ -1098,7 +1102,7 @@ typedef struct {
/* 0x10 */ Vec3f eyeTarget;
/* 0x1C */ Vec3f playerPos;
/* 0x28 */ f32 fovTarget;
/* 0x2C */ VecSph atEyeOffsetTarget;
/* 0x2C */ VecGeo atEyeOffsetTarget;
/* 0x34 */ s16 rollTarget;
/* 0x36 */ s16 curKeyFrameIdx;
/* 0x38 */ s16 unk_38;
@ -1344,7 +1348,7 @@ typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ Vec3f norm;
/* 0x18 */ CollisionPoly* poly;
/* 0x1C */ VecSph sphNorm;
/* 0x1C */ VecGeo geoNorm;
/* 0x24 */ s32 bgId;
} CamColChk; // size = 0x28

View file

@ -69,12 +69,19 @@ typedef struct {
/* 0x000C */ Vec3f b;
} Linef; // size = 0x18
// Defines a point in the spherical coordinate system
typedef struct {
/* 0x00 */ f32 r; // radius
/* 0x04 */ s16 pitch; // polar (zenith) angle
/* 0x06 */ s16 yaw; // azimuthal angle
} VecSph; // size = 0x08
/* 0x0 */ f32 r; // radius
/* 0x4 */ s16 pitch; // depends on coordinate system. See below.
/* 0x6 */ s16 yaw; // azimuthal angle
} VecSphGeo; // size = 0x8
// Defines a point in the spherical coordinate system.
// Pitch is 0 along the positive y-axis (up)
typedef VecSphGeo VecSph;
// Defines a point in the geographic coordinate system.
// Pitch is 0 along the xz-plane (horizon)
typedef VecSphGeo VecGeo;
#define LERP(x, y, scale) (((y) - (x)) * (scale) + (x))
#define LERP32(x, y, scale) ((s32)(((y) - (x)) * (scale)) + (x))