mirror of
https://github.com/zeldaret/oot.git
synced 2024-12-27 07:07:09 +00:00
Names for some view things (#1191)
* Names for some view things * Review: ORTHOGRAPHIC → ORTHO * Review: dirty → dirtyFlags * Review: Doc comment style * Review: Define constants in terms of each other * Review: Rename the ApplyToOverlay functions * Update include/z64.h Co-authored-by: fig02 <fig02srl@gmail.com> * Review: Better View_LookAtInternal doc * arg1 → mask * View_LookAtInternal → View_LookAtUnsafe * Review: View_SanityCheckEyePosition → View_ErrorCheckEyePosition * sViewNotInitialized → sLogOnNextViewInit * Remove VIEW_FORCE_ALL * near/far → zNear/zFar Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * lookAt → at Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * near/far → zNear/zFar * View_ApplyPerspective/Ortho: Remove from header instead of commenting * lookAt → at * Add fwd decls * Fix external view->at accesses * Missed these somehow * lookAt → at * Omit "Apply" in comments * dirtyFlags → flags * View_ApplyScissor → View_ApplyShrinkWindow * Update src/code/z_view.c Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> Co-authored-by: fig02 <fig02srl@gmail.com> Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
This commit is contained in:
parent
b9b40805f7
commit
9984c267d9
24 changed files with 210 additions and 170 deletions
|
@ -1347,14 +1347,14 @@ void func_800AA178(u32);
|
|||
View* View_New(GraphicsContext* gfxCtx);
|
||||
void View_Free(View* view);
|
||||
void View_Init(View*, GraphicsContext*);
|
||||
void func_800AA358(View* view, Vec3f* eye, Vec3f* lookAt, Vec3f* up);
|
||||
void func_800AA3F0(View* view, Vec3f* eye, Vec3f* lookAt, Vec3f* up);
|
||||
void View_LookAt(View* view, Vec3f* eye, Vec3f* lookAt, Vec3f* up);
|
||||
void View_LookAtUnsafe(View* view, Vec3f* eye, Vec3f* lookAt, Vec3f* up);
|
||||
void View_SetScale(View* view, f32 scale);
|
||||
void View_GetScale(View* view, f32* scale);
|
||||
void func_800AA460(View* view, f32 fovy, f32 near, f32 far);
|
||||
void func_800AA48C(View* view, f32* fovy, f32* near, f32* far);
|
||||
void func_800AA4A8(View* view, f32 fovy, f32 near, f32 far);
|
||||
void func_800AA4E0(View* view, f32* fovy, f32* near, f32* far);
|
||||
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);
|
||||
void View_SetDistortionOrientation(View* view, f32 rotX, f32 rotY, f32 rotZ);
|
||||
|
@ -1364,14 +1364,12 @@ void View_InitDistortion(View* view);
|
|||
void View_ClearDistortion(View* view);
|
||||
void View_SetDistortion(View* view, Vec3f orientation, Vec3f scale, f32 speed);
|
||||
s32 View_StepDistortion(View* view, Mtx* projectionMtx);
|
||||
void func_800AAA50(View* view, s32 arg1);
|
||||
s32 func_800AAA9C(View* view);
|
||||
s32 func_800AB0A8(View* view);
|
||||
s32 func_800AB2C4(View* view);
|
||||
s32 func_800AB560(View* view);
|
||||
s32 func_800AB944(View* view);
|
||||
s32 func_800AB9EC(View* view, s32 arg1, Gfx** p);
|
||||
s32 func_800ABE74(f32 eyeX, f32 eyeY, f32 eyeZ);
|
||||
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** p);
|
||||
s32 View_ErrorCheckEyePosition(f32 eyeX, f32 eyeY, f32 eyeZ);
|
||||
void ViMode_LogPrint(OSViMode* viMode);
|
||||
void ViMode_Configure(ViMode* viMode, s32 mode, s32 type, s32 unk_70, s32 unk_74, s32 unk_78, s32 unk_7C, s32 width,
|
||||
s32 height, s32 unk_left, s32 unk_right, s32 unk_top, s32 unk_bottom);
|
||||
|
|
|
@ -171,7 +171,7 @@ typedef struct {
|
|||
/* 0x0020 */ f32 zFar; // distance to far clipping plane
|
||||
/* 0x0024 */ f32 scale; // scale for matrix elements
|
||||
/* 0x0028 */ Vec3f eye;
|
||||
/* 0x0034 */ Vec3f lookAt;
|
||||
/* 0x0034 */ Vec3f at;
|
||||
/* 0x0040 */ Vec3f up;
|
||||
/* 0x0050 */ Vp vp;
|
||||
/* 0x0060 */ Mtx projection;
|
||||
|
@ -188,6 +188,17 @@ typedef struct {
|
|||
/* 0x0124 */ s32 unk_124;
|
||||
} View; // size = 0x128
|
||||
|
||||
#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)
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 seqId;
|
||||
/* 0x01 */ u8 natureAmbienceId;
|
||||
|
|
|
@ -70,12 +70,12 @@ void SpeedMeter_DrawTimeEntries(SpeedMeter* this, GraphicsContext* gfxCtx) {
|
|||
}
|
||||
|
||||
View_Init(&view, gfxCtx);
|
||||
view.flags = 0xA;
|
||||
view.flags = VIEW_VIEWPORT | VIEW_PROJECTION_ORTHO;
|
||||
|
||||
SET_FULLSCREEN_VIEWPORT(&view);
|
||||
|
||||
gfx = OVERLAY_DISP;
|
||||
func_800AB9EC(&view, 0xF, &gfx);
|
||||
View_ApplyTo(&view, VIEW_ALL, &gfx);
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
gDPSetOtherMode(gfx++,
|
||||
|
@ -126,12 +126,12 @@ void SpeedMeter_DrawAllocEntry(SpeedMeterAllocEntry* this, GraphicsContext* gfxC
|
|||
OPEN_DISPS(gfxCtx, "../speed_meter.c", 318);
|
||||
|
||||
View_Init(&view, gfxCtx);
|
||||
view.flags = 0xA;
|
||||
view.flags = VIEW_VIEWPORT | VIEW_PROJECTION_ORTHO;
|
||||
|
||||
SET_FULLSCREEN_VIEWPORT(&view);
|
||||
|
||||
gfx = OVERLAY_DISP;
|
||||
func_800AB9EC(&view, 0xF, &gfx);
|
||||
View_ApplyTo(&view, VIEW_ALL, &gfx);
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
gDPSetOtherMode(gfx++,
|
||||
|
|
|
@ -1319,7 +1319,7 @@ Gfx* func_8002E830(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext*
|
|||
eye->x, eye->y, eye->z, object->x, object->y, object->z, lightDir->x, lightDir->y, lightDir->z);
|
||||
}
|
||||
|
||||
func_800ABE74(correctedEyeX, eye->y, eye->z);
|
||||
View_ErrorCheckEyePosition(correctedEyeX, eye->y, eye->z);
|
||||
guLookAtHilite(&D_8015BBA8, lookAt, *hilite, correctedEyeX, eye->y, eye->z, object->x, object->y, object->z, 0.0f,
|
||||
1.0f, 0.0f, lightDir->x, lightDir->y, lightDir->z, lightDir->x, lightDir->y, lightDir->z, 0x10,
|
||||
0x10);
|
||||
|
|
|
@ -5097,9 +5097,9 @@ s32 Camera_Unique9(Camera* camera) {
|
|||
anim->atTarget = anim->curKeyFrame->atTargetInit;
|
||||
} else if (atInitFlags == 2) {
|
||||
if (anim->isNewKeyFrame) {
|
||||
anim->atTarget.x = camera->globalCtx->view.lookAt.x + anim->curKeyFrame->atTargetInit.x;
|
||||
anim->atTarget.y = camera->globalCtx->view.lookAt.y + anim->curKeyFrame->atTargetInit.y;
|
||||
anim->atTarget.z = camera->globalCtx->view.lookAt.z + anim->curKeyFrame->atTargetInit.z;
|
||||
anim->atTarget.x = camera->globalCtx->view.at.x + anim->curKeyFrame->atTargetInit.x;
|
||||
anim->atTarget.y = camera->globalCtx->view.at.y + anim->curKeyFrame->atTargetInit.y;
|
||||
anim->atTarget.z = camera->globalCtx->view.at.z + anim->curKeyFrame->atTargetInit.z;
|
||||
}
|
||||
} else if (atInitFlags == 3) {
|
||||
if (anim->isNewKeyFrame) {
|
||||
|
@ -7473,7 +7473,7 @@ Vec3s Camera_Update(Camera* camera) {
|
|||
if (gDbgCamEnabled) {
|
||||
camera->globalCtx->view.fovy = D_8015BD80.fov;
|
||||
DbCamera_Update(&D_8015BD80, camera);
|
||||
func_800AA358(&camera->globalCtx->view, &D_8015BD80.eye, &D_8015BD80.at, &D_8015BD80.unk_1C);
|
||||
View_LookAt(&camera->globalCtx->view, &D_8015BD80.eye, &D_8015BD80.at, &D_8015BD80.unk_1C);
|
||||
if (R_DBG_CAM_UPDATE) {
|
||||
osSyncPrintf("camera: debug out\n");
|
||||
}
|
||||
|
@ -7524,7 +7524,7 @@ Vec3s Camera_Update(Camera* camera) {
|
|||
View_SetScale(&camera->globalCtx->view, 1.0f);
|
||||
}
|
||||
camera->globalCtx->view.fovy = viewFov;
|
||||
func_800AA358(&camera->globalCtx->view, &viewEye, &viewAt, &viewUp);
|
||||
View_LookAt(&camera->globalCtx->view, &viewEye, &viewAt, &viewUp);
|
||||
camera->camDir.x = eyeAtAngle.pitch;
|
||||
camera->camDir.y = eyeAtAngle.yaw;
|
||||
camera->camDir.z = 0;
|
||||
|
|
|
@ -1408,9 +1408,9 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env
|
|||
dist = Math3D_Vec3f_DistXYZ(&pos, &view->eye) / 12.0f;
|
||||
|
||||
// compute a unit vector in the look direction
|
||||
tempX = view->lookAt.x - view->eye.x;
|
||||
tempY = view->lookAt.y - view->eye.y;
|
||||
tempZ = view->lookAt.z - view->eye.z;
|
||||
tempX = view->at.x - view->eye.x;
|
||||
tempY = view->at.y - view->eye.y;
|
||||
tempZ = view->at.z - view->eye.z;
|
||||
|
||||
length = sqrtf(SQ(tempX) + SQ(tempY) + SQ(tempZ));
|
||||
|
||||
|
@ -1584,9 +1584,9 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext*
|
|||
if (!(globalCtx->cameraPtrs[0]->unk_14C & 0x100) && (globalCtx->envCtx.unk_EE[2] == 0)) {
|
||||
OPEN_DISPS(gfxCtx, "../z_kankyo.c", 2799);
|
||||
|
||||
vec.x = view->lookAt.x - view->eye.x;
|
||||
vec.y = view->lookAt.y - view->eye.y;
|
||||
vec.z = view->lookAt.z - view->eye.z;
|
||||
vec.x = view->at.x - view->eye.x;
|
||||
vec.y = view->at.y - view->eye.y;
|
||||
vec.z = view->at.z - view->eye.z;
|
||||
|
||||
length = sqrtf(SQXYZ(vec));
|
||||
|
||||
|
@ -1859,8 +1859,8 @@ void Environment_DrawLightning(GlobalContext* globalCtx, s32 unused) {
|
|||
for (i = 0; i < ARRAY_COUNT(sLightningBolts); i++) {
|
||||
switch (sLightningBolts[i].state) {
|
||||
case LIGHTNING_BOLT_START:
|
||||
dx = globalCtx->view.lookAt.x - globalCtx->view.eye.x;
|
||||
dz = globalCtx->view.lookAt.z - globalCtx->view.eye.z;
|
||||
dx = globalCtx->view.at.x - globalCtx->view.eye.x;
|
||||
dz = globalCtx->view.at.z - globalCtx->view.eye.z;
|
||||
|
||||
x = dx / sqrtf(SQ(dx) + SQ(dz));
|
||||
z = dz / sqrtf(SQ(dx) + SQ(dz));
|
||||
|
|
|
@ -1936,7 +1936,7 @@ void Message_DrawTextBox(GlobalContext* globalCtx, Gfx** p) {
|
|||
|
||||
void Message_SetView(View* view) {
|
||||
SET_FULLSCREEN_VIEWPORT(view);
|
||||
func_800AB2C4(view);
|
||||
View_ApplyOrthoToOverlay(view);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -75,7 +75,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act
|
|||
if (timer < 20) {
|
||||
timer = 20;
|
||||
}
|
||||
D_801208EC[0].atTargetInit = globalCtx->view.lookAt;
|
||||
D_801208EC[0].atTargetInit = globalCtx->view.at;
|
||||
D_801208EC[0].eyeTargetInit = globalCtx->view.eye;
|
||||
D_801208EC[0].fovTargetInit = globalCtx->view.fovy;
|
||||
D_801208EC[1].atTargetInit = mainCam->at;
|
||||
|
@ -91,7 +91,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act
|
|||
func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C);
|
||||
break;
|
||||
case 1030:
|
||||
D_80120964[0].atTargetInit = globalCtx->view.lookAt;
|
||||
D_80120964[0].atTargetInit = globalCtx->view.at;
|
||||
D_80120964[0].eyeTargetInit = globalCtx->view.eye;
|
||||
D_80120964[0].fovTargetInit = globalCtx->view.fovy;
|
||||
OLib_Vec3fDiffToVecSphGeo(&spD0, &mainCam->at, &mainCam->eye);
|
||||
|
@ -104,7 +104,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act
|
|||
func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C);
|
||||
break;
|
||||
case 5000:
|
||||
D_801209B4[0].atTargetInit = D_801209B4[1].atTargetInit = globalCtx->view.lookAt;
|
||||
D_801209B4[0].atTargetInit = D_801209B4[1].atTargetInit = globalCtx->view.at;
|
||||
D_801209B4[0].eyeTargetInit = globalCtx->view.eye;
|
||||
D_801209B4[0].fovTargetInit = D_801209B4[2].fovTargetInit = globalCtx->view.fovy;
|
||||
OLib_Vec3fDiffToVecSphGeo(&spD0, &actor->focus.pos, &mainCam->at);
|
||||
|
@ -232,9 +232,9 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act
|
|||
if ((sp82 > 0) && (sp82 < 320) && (sp7E > 0) && (sp7E < 240) && (sp80 > 0) && (sp80 < 320) && (sp7C > 0) &&
|
||||
(sp7C < 240) &&
|
||||
!OnePointCutscene_BgCheckLineTest(&globalCtx->colCtx, &actor->focus.pos, &player->actor.focus.pos)) {
|
||||
D_80121184[0].atTargetInit.x = (globalCtx->view.lookAt.x + actor->focus.pos.x) * 0.5f;
|
||||
D_80121184[0].atTargetInit.y = (globalCtx->view.lookAt.y + actor->focus.pos.y) * 0.5f;
|
||||
D_80121184[0].atTargetInit.z = (globalCtx->view.lookAt.z + actor->focus.pos.z) * 0.5f;
|
||||
D_80121184[0].atTargetInit.x = (globalCtx->view.at.x + actor->focus.pos.x) * 0.5f;
|
||||
D_80121184[0].atTargetInit.y = (globalCtx->view.at.y + actor->focus.pos.y) * 0.5f;
|
||||
D_80121184[0].atTargetInit.z = (globalCtx->view.at.z + actor->focus.pos.z) * 0.5f;
|
||||
D_80121184[0].eyeTargetInit = globalCtx->view.eye;
|
||||
D_80121184[0].eyeTargetInit.y = player->actor.focus.pos.y + 20.0f;
|
||||
D_80121184[0].fovTargetInit = mainCam->fov * 0.75f;
|
||||
|
@ -490,7 +490,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act
|
|||
csCam->unk_14C |= 2;
|
||||
break;
|
||||
case 3140:
|
||||
D_80121C24[0].atTargetInit = globalCtx->view.lookAt;
|
||||
D_80121C24[0].atTargetInit = globalCtx->view.at;
|
||||
D_80121C24[0].eyeTargetInit = globalCtx->view.eye;
|
||||
D_80121C24[0].fovTargetInit = globalCtx->view.fovy;
|
||||
|
||||
|
@ -674,7 +674,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act
|
|||
Quake_SetCountdown(i, timer);
|
||||
break;
|
||||
case 3290:
|
||||
D_80121F1C[0].atTargetInit = globalCtx->view.lookAt;
|
||||
D_80121F1C[0].atTargetInit = globalCtx->view.at;
|
||||
D_80121F1C[0].eyeTargetInit = globalCtx->view.eye;
|
||||
D_80121F1C[0].fovTargetInit = globalCtx->view.fovy;
|
||||
Actor_GetFocus(&spA0, actor);
|
||||
|
@ -691,7 +691,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act
|
|||
Quake_SetCountdown(i, 5);
|
||||
break;
|
||||
case 3340:
|
||||
D_80121FBC[0].atTargetInit = globalCtx->view.lookAt;
|
||||
D_80121FBC[0].atTargetInit = globalCtx->view.at;
|
||||
D_80121FBC[0].eyeTargetInit = globalCtx->view.eye;
|
||||
D_80121FBC[0].fovTargetInit = globalCtx->view.fovy;
|
||||
|
||||
|
@ -714,7 +714,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act
|
|||
func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C);
|
||||
break;
|
||||
case 3350:
|
||||
D_801220D4[0].atTargetInit = globalCtx->view.lookAt;
|
||||
D_801220D4[0].atTargetInit = globalCtx->view.at;
|
||||
D_801220D4[0].eyeTargetInit = globalCtx->view.eye;
|
||||
D_801220D4[0].fovTargetInit = globalCtx->view.fovy;
|
||||
if (actor->world.pos.x > 0.0f) {
|
||||
|
@ -996,7 +996,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act
|
|||
}
|
||||
break;
|
||||
case 1000:
|
||||
D_801232A4[0].atTargetInit = globalCtx->view.lookAt;
|
||||
D_801232A4[0].atTargetInit = globalCtx->view.at;
|
||||
D_801232A4[0].eyeTargetInit = globalCtx->view.eye;
|
||||
D_801232A4[0].fovTargetInit = globalCtx->view.fovy;
|
||||
|
||||
|
@ -1057,7 +1057,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act
|
|||
func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C);
|
||||
break;
|
||||
case 9703:
|
||||
D_80123894[0].atTargetInit = globalCtx->view.lookAt;
|
||||
D_80123894[0].atTargetInit = globalCtx->view.at;
|
||||
D_80123894[0].eyeTargetInit = globalCtx->view.eye;
|
||||
D_80123894[0].fovTargetInit = globalCtx->view.fovy;
|
||||
if (LINK_IS_ADULT) {
|
||||
|
@ -1071,7 +1071,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act
|
|||
func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C);
|
||||
break;
|
||||
case 9704:
|
||||
D_8012390C[0].atTargetInit = globalCtx->view.lookAt;
|
||||
D_8012390C[0].atTargetInit = globalCtx->view.at;
|
||||
D_8012390C[0].eyeTargetInit = globalCtx->view.eye;
|
||||
D_8012390C[0].fovTargetInit = globalCtx->view.fovy;
|
||||
|
||||
|
@ -1081,7 +1081,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act
|
|||
func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C);
|
||||
break;
|
||||
case 9705:
|
||||
D_8012395C[0].atTargetInit = globalCtx->view.lookAt;
|
||||
D_8012395C[0].atTargetInit = globalCtx->view.at;
|
||||
D_8012395C[0].eyeTargetInit = globalCtx->view.eye;
|
||||
D_8012395C[0].fovTargetInit = globalCtx->view.fovy;
|
||||
|
||||
|
@ -1178,7 +1178,7 @@ s16 OnePointCutscene_Init(GlobalContext* globalCtx, s16 csId, s16 timer, Actor*
|
|||
csCam->timer = timer;
|
||||
csCam->target = actor;
|
||||
|
||||
csCam->at = globalCtx->view.lookAt;
|
||||
csCam->at = globalCtx->view.at;
|
||||
csCam->eye = globalCtx->view.eye;
|
||||
csCam->fov = globalCtx->view.fovy;
|
||||
|
||||
|
|
|
@ -2975,7 +2975,7 @@ void func_8008A8B8(GlobalContext* globalCtx, s32 topY, s32 bottomY, s32 leftX, s
|
|||
up.x = up.z = 0.0f;
|
||||
up.y = 1.0f;
|
||||
|
||||
func_800AA358(&interfaceCtx->view, &eye, &lookAt, &up);
|
||||
View_LookAt(&interfaceCtx->view, &eye, &lookAt, &up);
|
||||
|
||||
interfaceCtx->viewport.topY = topY;
|
||||
interfaceCtx->viewport.bottomY = bottomY;
|
||||
|
@ -2983,13 +2983,13 @@ void func_8008A8B8(GlobalContext* globalCtx, s32 topY, s32 bottomY, s32 leftX, s
|
|||
interfaceCtx->viewport.rightX = rightX;
|
||||
View_SetViewport(&interfaceCtx->view, &interfaceCtx->viewport);
|
||||
|
||||
func_800AA460(&interfaceCtx->view, 60.0f, 10.0f, 60.0f);
|
||||
func_800AB560(&interfaceCtx->view);
|
||||
View_SetPerspective(&interfaceCtx->view, 60.0f, 10.0f, 60.0f);
|
||||
View_ApplyPerspectiveToOverlay(&interfaceCtx->view);
|
||||
}
|
||||
|
||||
void func_8008A994(InterfaceContext* interfaceCtx) {
|
||||
SET_FULLSCREEN_VIEWPORT(&interfaceCtx->view);
|
||||
func_800AB2C4(&interfaceCtx->view);
|
||||
View_ApplyOrthoToOverlay(&interfaceCtx->view);
|
||||
}
|
||||
|
||||
void Interface_Draw(GlobalContext* globalCtx) {
|
||||
|
|
|
@ -1086,8 +1086,8 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
|
|||
POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP);
|
||||
POLY_XLU_DISP = Gameplay_SetFog(globalCtx, POLY_XLU_DISP);
|
||||
|
||||
func_800AA460(&globalCtx->view, globalCtx->view.fovy, globalCtx->view.zNear, globalCtx->lightCtx.fogFar);
|
||||
func_800AAA50(&globalCtx->view, 15);
|
||||
View_SetPerspective(&globalCtx->view, globalCtx->view.fovy, globalCtx->view.zNear, globalCtx->lightCtx.fogFar);
|
||||
View_Apply(&globalCtx->view, VIEW_ALL);
|
||||
|
||||
// The billboard matrix temporarily stores the viewing matrix
|
||||
Matrix_MtxToMtxF(&globalCtx->view.viewing, &globalCtx->billboardMtxF);
|
||||
|
@ -1118,11 +1118,11 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
|
|||
View view;
|
||||
|
||||
View_Init(&view, gfxCtx);
|
||||
view.flags = 2 | 8;
|
||||
view.flags = VIEW_VIEWPORT | VIEW_PROJECTION_ORTHO;
|
||||
|
||||
SET_FULLSCREEN_VIEWPORT(&view);
|
||||
|
||||
func_800AB9EC(&view, 15, &gfxP);
|
||||
View_ApplyTo(&view, VIEW_ALL, &gfxP);
|
||||
globalCtx->transitionCtx.draw(&globalCtx->transitionCtx.data, &gfxP);
|
||||
}
|
||||
|
||||
|
@ -1305,7 +1305,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
|
|||
|
||||
if (globalCtx->view.unk_124 != 0) {
|
||||
Camera_Update(GET_ACTIVE_CAM(globalCtx));
|
||||
func_800AB944(&globalCtx->view);
|
||||
View_UpdateViewingMatrix(&globalCtx->view);
|
||||
globalCtx->view.unk_124 = 0;
|
||||
if (globalCtx->skyboxId && (globalCtx->skyboxId != SKYBOX_UNSET_1D) && !globalCtx->envCtx.skyboxDisabled) {
|
||||
SkyboxDraw_UpdateMatrix(&globalCtx->skyboxCtx, globalCtx->view.eye.x, globalCtx->view.eye.y,
|
||||
|
|
|
@ -18,8 +18,8 @@ void Sample_Draw(SampleContext* this) {
|
|||
|
||||
func_80095248(gfxCtx, 0, 0, 0);
|
||||
|
||||
view->flags = 1 | 2 | 4;
|
||||
func_800AAA50(view, 15);
|
||||
view->flags = VIEW_VIEWING | VIEW_VIEWPORT | VIEW_PROJECTION_PERSPECTIVE;
|
||||
View_Apply(view, VIEW_ALL);
|
||||
|
||||
{
|
||||
Mtx* mtx = Graph_Alloc(gfxCtx, sizeof(Mtx));
|
||||
|
@ -55,7 +55,7 @@ void Sample_SetupView(SampleContext* this) {
|
|||
|
||||
View_Init(view, gfxCtx);
|
||||
SET_FULLSCREEN_VIEWPORT(view);
|
||||
func_800AA460(view, 60.0f, 10.0f, 12800.0f);
|
||||
View_SetPerspective(view, 60.0f, 10.0f, 12800.0f);
|
||||
|
||||
{
|
||||
Vec3f eye;
|
||||
|
@ -72,7 +72,7 @@ void Sample_SetupView(SampleContext* this) {
|
|||
up.z = 0.0f;
|
||||
up.y = 1.0f;
|
||||
|
||||
func_800AA358(view, &eye, &lookAt, &up);
|
||||
View_LookAt(view, &eye, &lookAt, &up);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
#include "global.h"
|
||||
#include "vt.h"
|
||||
|
||||
vu32 D_8012ABF0 = true;
|
||||
vu32 sLogOnNextViewInit = true;
|
||||
|
||||
s32 View_ApplyPerspective(View*);
|
||||
s32 View_ApplyOrtho(View*);
|
||||
|
||||
void View_ViewportToVp(Vp* dest, Viewport* src) {
|
||||
s32 width = src->rightX - src->leftX;
|
||||
|
@ -45,42 +48,46 @@ void View_Init(View* view, GraphicsContext* gfxCtx) {
|
|||
view->fovy = 60.0f;
|
||||
view->zNear = 10.0f;
|
||||
view->zFar = 12800.0f;
|
||||
view->lookAt.x = 0.0f;
|
||||
view->at.x = 0.0f;
|
||||
view->up.x = 0.0f;
|
||||
view->up.y = 1.0f;
|
||||
view->up.z = 0.0f;
|
||||
view->eye.z = -1.0f;
|
||||
|
||||
if (D_8012ABF0) {
|
||||
if (D_8012ABF0 == 0) {}
|
||||
if (sLogOnNextViewInit) {
|
||||
if (sLogOnNextViewInit == false) {}
|
||||
osSyncPrintf("\nview: initialize ---\n");
|
||||
D_8012ABF0 = false;
|
||||
sLogOnNextViewInit = false;
|
||||
}
|
||||
|
||||
view->unk_124 = 0;
|
||||
view->flags = 1 | 2 | 4;
|
||||
view->flags = VIEW_VIEWING | VIEW_VIEWPORT | VIEW_PROJECTION_PERSPECTIVE;
|
||||
View_InitDistortion(view);
|
||||
}
|
||||
|
||||
void func_800AA358(View* view, Vec3f* eye, Vec3f* lookAt, Vec3f* up) {
|
||||
if (eye->x == lookAt->x && eye->z == lookAt->z) {
|
||||
void View_LookAt(View* view, Vec3f* eye, Vec3f* at, Vec3f* up) {
|
||||
if (eye->x == at->x && eye->z == at->z) {
|
||||
eye->x += 0.1f;
|
||||
}
|
||||
|
||||
view->eye = *eye;
|
||||
view->lookAt = *lookAt;
|
||||
view->at = *at;
|
||||
view->up = *up;
|
||||
view->flags |= 1;
|
||||
view->flags |= VIEW_VIEWING;
|
||||
}
|
||||
|
||||
void func_800AA3F0(View* view, Vec3f* eye, Vec3f* lookAt, Vec3f* up) {
|
||||
/*
|
||||
* Unused. View_LookAt is always used instead. This version is similar but
|
||||
* is missing the input sanitization and the update to the flags.
|
||||
*/
|
||||
void View_LookAtUnsafe(View* view, Vec3f* eye, Vec3f* at, Vec3f* up) {
|
||||
view->eye = *eye;
|
||||
view->lookAt = *lookAt;
|
||||
view->at = *at;
|
||||
view->up = *up;
|
||||
}
|
||||
|
||||
void View_SetScale(View* view, f32 scale) {
|
||||
view->flags |= 4;
|
||||
view->flags |= VIEW_PROJECTION_PERSPECTIVE;
|
||||
view->scale = scale;
|
||||
}
|
||||
|
||||
|
@ -88,43 +95,47 @@ void View_GetScale(View* view, f32* scale) {
|
|||
*scale = view->scale;
|
||||
}
|
||||
|
||||
void func_800AA460(View* view, f32 fovy, f32 near, f32 far) {
|
||||
void View_SetPerspective(View* view, f32 fovy, f32 zNear, f32 zFar) {
|
||||
view->fovy = fovy;
|
||||
view->zNear = near;
|
||||
view->zFar = far;
|
||||
view->flags |= 4;
|
||||
view->zNear = zNear;
|
||||
view->zFar = zFar;
|
||||
view->flags |= VIEW_PROJECTION_PERSPECTIVE;
|
||||
}
|
||||
|
||||
void func_800AA48C(View* view, f32* fovy, f32* near, f32* far) {
|
||||
void View_GetPerspective(View* view, f32* fovy, f32* zNear, f32* zFar) {
|
||||
*fovy = view->fovy;
|
||||
*near = view->zNear;
|
||||
*far = view->zFar;
|
||||
*zNear = view->zNear;
|
||||
*zFar = view->zFar;
|
||||
}
|
||||
|
||||
void func_800AA4A8(View* view, f32 fovy, f32 near, f32 far) {
|
||||
void View_SetOrtho(View* view, f32 fovy, f32 zNear, f32 zFar) {
|
||||
view->fovy = fovy;
|
||||
view->zNear = near;
|
||||
view->zFar = far;
|
||||
view->flags |= 8;
|
||||
view->zNear = zNear;
|
||||
view->zFar = zFar;
|
||||
view->flags |= VIEW_PROJECTION_ORTHO;
|
||||
view->scale = 1.0f;
|
||||
}
|
||||
|
||||
void func_800AA4E0(View* view, f32* fovy, f32* near, f32* far) {
|
||||
/*
|
||||
* Identical to View_GetPerspective, and never called.
|
||||
* Named as it seems to fit the "set, get" pattern.
|
||||
*/
|
||||
void View_GetOrtho(View* view, f32* fovy, f32* zNear, f32* zFar) {
|
||||
*fovy = view->fovy;
|
||||
*near = view->zNear;
|
||||
*far = view->zFar;
|
||||
*zNear = view->zNear;
|
||||
*zFar = view->zFar;
|
||||
}
|
||||
|
||||
void View_SetViewport(View* view, Viewport* viewport) {
|
||||
view->viewport = *viewport;
|
||||
view->flags |= 2;
|
||||
view->flags |= VIEW_VIEWPORT;
|
||||
}
|
||||
|
||||
void View_GetViewport(View* view, Viewport* viewport) {
|
||||
*viewport = view->viewport;
|
||||
}
|
||||
|
||||
void func_800AA550(View* view) {
|
||||
void View_ApplyShrinkWindow(View* view) {
|
||||
s32 varY;
|
||||
s32 varX;
|
||||
s32 pad;
|
||||
|
@ -255,17 +266,20 @@ s32 View_StepDistortion(View* view, Mtx* projectionMtx) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void func_800AAA50(View* view, s32 arg1) {
|
||||
arg1 = (view->flags & arg1) | (arg1 >> 4);
|
||||
/**
|
||||
* Apply view to POLY_OPA_DISP, POLY_XLU_DISP (and OVERLAY_DISP if ortho)
|
||||
*/
|
||||
void View_Apply(View* view, s32 mask) {
|
||||
mask = (view->flags & mask) | (mask >> 4);
|
||||
|
||||
if (arg1 & 8) {
|
||||
func_800AB0A8(view);
|
||||
if (mask & VIEW_PROJECTION_ORTHO) {
|
||||
View_ApplyOrtho(view);
|
||||
} else {
|
||||
func_800AAA9C(view);
|
||||
View_ApplyPerspective(view);
|
||||
}
|
||||
}
|
||||
|
||||
s32 func_800AAA9C(View* view) {
|
||||
s32 View_ApplyPerspective(View* view) {
|
||||
f32 aspect;
|
||||
s32 width;
|
||||
s32 height;
|
||||
|
@ -276,16 +290,18 @@ s32 func_800AAA9C(View* view) {
|
|||
|
||||
OPEN_DISPS(gfxCtx, "../z_view.c", 596);
|
||||
|
||||
// Viewport
|
||||
vp = Graph_Alloc(gfxCtx, sizeof(Vp));
|
||||
LogUtils_CheckNullPointer("vp", vp, "../z_view.c", 601);
|
||||
View_ViewportToVp(vp, &view->viewport);
|
||||
view->vp = *vp;
|
||||
|
||||
func_800AA550(view);
|
||||
View_ApplyShrinkWindow(view);
|
||||
|
||||
gSPViewport(POLY_OPA_DISP++, vp);
|
||||
gSPViewport(POLY_XLU_DISP++, vp);
|
||||
|
||||
// Perspective projection
|
||||
projection = Graph_Alloc(gfxCtx, sizeof(Mtx));
|
||||
LogUtils_CheckNullPointer("projection", projection, "../z_view.c", 616);
|
||||
view->projectionPtr = projection;
|
||||
|
@ -332,22 +348,24 @@ s32 func_800AAA9C(View* view) {
|
|||
gSPPerspNormalize(POLY_XLU_DISP++, view->normal);
|
||||
gSPMatrix(POLY_XLU_DISP++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
|
||||
|
||||
// View matrix (look-at)
|
||||
viewing = Graph_Alloc(gfxCtx, sizeof(Mtx));
|
||||
LogUtils_CheckNullPointer("viewing", viewing, "../z_view.c", 667);
|
||||
view->viewingPtr = viewing;
|
||||
|
||||
if (view->eye.x == view->lookAt.x && view->eye.y == view->lookAt.y && view->eye.z == view->lookAt.z) {
|
||||
if (view->eye.x == view->at.x && view->eye.y == view->at.y && view->eye.z == view->at.z) {
|
||||
view->eye.x += 1.0f;
|
||||
view->eye.y += 1.0f;
|
||||
view->eye.z += 1.0f;
|
||||
}
|
||||
|
||||
func_800ABE74(view->eye.x, view->eye.y, view->eye.z);
|
||||
guLookAt(viewing, view->eye.x, view->eye.y, view->eye.z, view->lookAt.x, view->lookAt.y, view->lookAt.z, view->up.x,
|
||||
View_ErrorCheckEyePosition(view->eye.x, view->eye.y, view->eye.z);
|
||||
guLookAt(viewing, view->eye.x, view->eye.y, view->eye.z, view->at.x, view->at.y, view->at.z, view->up.x,
|
||||
view->up.y, view->up.z);
|
||||
|
||||
view->viewing = *viewing;
|
||||
|
||||
// Debug print view matrix
|
||||
if (QREG(88) & 2) {
|
||||
s32 i;
|
||||
MtxF mf;
|
||||
|
@ -368,7 +386,7 @@ s32 func_800AAA9C(View* view) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
s32 func_800AB0A8(View* view) {
|
||||
s32 View_ApplyOrtho(View* view) {
|
||||
Vp* vp;
|
||||
Mtx* projection;
|
||||
GraphicsContext* gfxCtx = view->gfxCtx;
|
||||
|
@ -380,7 +398,7 @@ s32 func_800AB0A8(View* view) {
|
|||
View_ViewportToVp(vp, &view->viewport);
|
||||
view->vp = *vp;
|
||||
|
||||
func_800AA550(view);
|
||||
View_ApplyShrinkWindow(view);
|
||||
|
||||
gSPViewport(POLY_OPA_DISP++, vp);
|
||||
gSPViewport(POLY_XLU_DISP++, vp);
|
||||
|
@ -403,7 +421,10 @@ s32 func_800AB0A8(View* view) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
s32 func_800AB2C4(View* view) {
|
||||
/**
|
||||
* Apply scissor, viewport and projection (ortho) to OVERLAY_DISP.
|
||||
*/
|
||||
s32 View_ApplyOrthoToOverlay(View* view) {
|
||||
Vp* vp;
|
||||
Mtx* projection;
|
||||
GraphicsContext* gfxCtx;
|
||||
|
@ -438,7 +459,10 @@ s32 func_800AB2C4(View* view) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
s32 func_800AB560(View* view) {
|
||||
/**
|
||||
* Apply scissor, viewport, view and projection (perspective) to OVERLAY_DISP.
|
||||
*/
|
||||
s32 View_ApplyPerspectiveToOverlay(View* view) {
|
||||
s32 pad[2];
|
||||
f32 aspect;
|
||||
s32 width;
|
||||
|
@ -479,14 +503,15 @@ s32 func_800AB560(View* view) {
|
|||
LogUtils_CheckNullPointer("viewing", viewing, "../z_view.c", 848);
|
||||
view->viewingPtr = viewing;
|
||||
|
||||
if (view->eye.x == view->lookAt.x && view->eye.y == view->lookAt.y && view->eye.z == view->lookAt.z) {
|
||||
// This check avoids a divide-by-zero in guLookAt if eye == at
|
||||
if (view->eye.x == view->at.x && view->eye.y == view->at.y && view->eye.z == view->at.z) {
|
||||
view->eye.x += 1.0f;
|
||||
view->eye.y += 1.0f;
|
||||
view->eye.z += 1.0f;
|
||||
}
|
||||
|
||||
func_800ABE74(view->eye.x, view->eye.y, view->eye.z);
|
||||
guLookAt(viewing, view->eye.x, view->eye.y, view->eye.z, view->lookAt.x, view->lookAt.y, view->lookAt.z, view->up.x,
|
||||
View_ErrorCheckEyePosition(view->eye.x, view->eye.y, view->eye.z);
|
||||
guLookAt(viewing, view->eye.x, view->eye.y, view->eye.z, view->at.x, view->at.y, view->at.z, view->up.x,
|
||||
view->up.y, view->up.z);
|
||||
|
||||
view->viewing = *viewing;
|
||||
|
@ -498,11 +523,14 @@ s32 func_800AB560(View* view) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
s32 func_800AB944(View* view) {
|
||||
/**
|
||||
* Just updates view's view matrix from its eye/at/up vectors. Opens disps but doesn't use them.
|
||||
*/
|
||||
s32 View_UpdateViewingMatrix(View* view) {
|
||||
OPEN_DISPS(view->gfxCtx, "../z_view.c", 878);
|
||||
|
||||
func_800ABE74(view->eye.x, view->eye.y, view->eye.z);
|
||||
guLookAt(view->viewingPtr, view->eye.x, view->eye.y, view->eye.z, view->lookAt.x, view->lookAt.y, view->lookAt.z,
|
||||
View_ErrorCheckEyePosition(view->eye.x, view->eye.y, view->eye.z);
|
||||
guLookAt(view->viewingPtr, view->eye.x, view->eye.y, view->eye.z, view->at.x, view->at.y, view->at.z,
|
||||
view->up.x, view->up.y, view->up.z);
|
||||
|
||||
CLOSE_DISPS(view->gfxCtx, "../z_view.c", 886);
|
||||
|
@ -510,7 +538,7 @@ s32 func_800AB944(View* view) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
s32 func_800AB9EC(View* view, s32 arg1, Gfx** gfxp) {
|
||||
s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxp) {
|
||||
Gfx* gfx = *gfxp;
|
||||
GraphicsContext* gfxCtx = view->gfxCtx;
|
||||
s32 width;
|
||||
|
@ -519,9 +547,9 @@ s32 func_800AB9EC(View* view, s32 arg1, Gfx** gfxp) {
|
|||
Mtx* projection;
|
||||
Mtx* viewing;
|
||||
|
||||
arg1 = (view->flags & arg1) | (arg1 >> 4);
|
||||
mask = (view->flags & mask) | (mask >> 4);
|
||||
|
||||
if (arg1 & 2) {
|
||||
if (mask & VIEW_VIEWPORT) {
|
||||
vp = Graph_Alloc(gfxCtx, sizeof(Vp));
|
||||
LogUtils_CheckNullPointer("vp", vp, "../z_view.c", 910);
|
||||
View_ViewportToVp(vp, &view->viewport);
|
||||
|
@ -534,7 +562,7 @@ s32 func_800AB9EC(View* view, s32 arg1, Gfx** gfxp) {
|
|||
gSPViewport(gfx++, vp);
|
||||
}
|
||||
|
||||
if (arg1 & 8) {
|
||||
if (mask & VIEW_PROJECTION_ORTHO) {
|
||||
projection = Graph_Alloc(gfxCtx, sizeof(Mtx));
|
||||
LogUtils_CheckNullPointer("projection", projection, "../z_view.c", 921);
|
||||
view->projectionPtr = projection;
|
||||
|
@ -545,7 +573,7 @@ s32 func_800AB9EC(View* view, s32 arg1, Gfx** gfxp) {
|
|||
view->projection = *projection;
|
||||
|
||||
gSPMatrix(gfx++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
|
||||
} else if (arg1 & 6) {
|
||||
} else if (mask & (VIEW_PROJECTION_PERSPECTIVE | VIEW_VIEWPORT)) {
|
||||
projection = Graph_Alloc(gfxCtx, sizeof(Mtx));
|
||||
LogUtils_CheckNullPointer("projection", projection, "../z_view.c", 932);
|
||||
view->projectionPtr = projection;
|
||||
|
@ -562,13 +590,13 @@ s32 func_800AB9EC(View* view, s32 arg1, Gfx** gfxp) {
|
|||
gSPMatrix(gfx++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
|
||||
}
|
||||
|
||||
if (arg1 & 1) {
|
||||
if (mask & VIEW_VIEWING) {
|
||||
viewing = Graph_Alloc(gfxCtx, sizeof(Mtx));
|
||||
LogUtils_CheckNullPointer("viewing", viewing, "../z_view.c", 948);
|
||||
view->viewingPtr = viewing;
|
||||
|
||||
func_800ABE74(view->eye.x, view->eye.y, view->eye.z);
|
||||
guLookAt(viewing, view->eye.x, view->eye.y, view->eye.z, view->lookAt.x, view->lookAt.y, view->lookAt.z,
|
||||
View_ErrorCheckEyePosition(view->eye.x, view->eye.y, view->eye.z);
|
||||
guLookAt(viewing, view->eye.x, view->eye.y, view->eye.z, view->at.x, view->at.y, view->at.z,
|
||||
view->up.x, view->up.y, view->up.z);
|
||||
|
||||
view->viewing = *viewing;
|
||||
|
@ -582,7 +610,10 @@ s32 func_800AB9EC(View* view, s32 arg1, Gfx** gfxp) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
s32 func_800ABE74(f32 eyeX, f32 eyeY, f32 eyeZ) {
|
||||
/**
|
||||
* Logs an error and returns nonzero if camera is too far from the origin.
|
||||
*/
|
||||
s32 View_ErrorCheckEyePosition(f32 eyeX, f32 eyeY, f32 eyeZ) {
|
||||
s32 error = 0;
|
||||
|
||||
if (SQ(eyeX) + SQ(eyeY) + SQ(eyeZ) > SQ(32767.0f)) {
|
||||
|
|
|
@ -526,9 +526,9 @@ void DemoKankyo_DrawRain(Actor* thisx, GlobalContext* globalCtx) {
|
|||
for (i = 0; i < 30; i++) {
|
||||
s32 pad[2];
|
||||
|
||||
dx = globalCtx->view.lookAt.x - globalCtx->view.eye.x;
|
||||
dy = globalCtx->view.lookAt.y - globalCtx->view.eye.y;
|
||||
dz = globalCtx->view.lookAt.z - globalCtx->view.eye.z;
|
||||
dx = globalCtx->view.at.x - globalCtx->view.eye.x;
|
||||
dy = globalCtx->view.at.y - globalCtx->view.eye.y;
|
||||
dz = globalCtx->view.at.z - globalCtx->view.eye.z;
|
||||
norm = sqrtf(SQ(dx) + SQ(dy) + SQ(dz));
|
||||
|
||||
if (globalCtx->sceneNum != SCENE_TOKINOMA) {
|
||||
|
|
|
@ -187,13 +187,13 @@ void func_809B5670(EnAttackNiw* this, GlobalContext* globalCtx) {
|
|||
|
||||
this->actor.speedXZ = 10.0f;
|
||||
|
||||
tmpf1 = (this->unk_298.x + globalCtx->view.lookAt.x) - globalCtx->view.eye.x;
|
||||
tmpf2 = (this->unk_298.y + globalCtx->view.lookAt.y) - globalCtx->view.eye.y;
|
||||
tmpf3 = (this->unk_298.z + globalCtx->view.lookAt.z) - globalCtx->view.eye.z;
|
||||
tmpf1 = (this->unk_298.x + globalCtx->view.at.x) - globalCtx->view.eye.x;
|
||||
tmpf2 = (this->unk_298.y + globalCtx->view.at.y) - globalCtx->view.eye.y;
|
||||
tmpf3 = (this->unk_298.z + globalCtx->view.at.z) - globalCtx->view.eye.z;
|
||||
|
||||
sp34.x = globalCtx->view.lookAt.x + tmpf1;
|
||||
sp34.y = globalCtx->view.lookAt.y + tmpf2;
|
||||
sp34.z = globalCtx->view.lookAt.z + tmpf3;
|
||||
sp34.x = globalCtx->view.at.x + tmpf1;
|
||||
sp34.y = globalCtx->view.at.y + tmpf2;
|
||||
sp34.z = globalCtx->view.at.z + tmpf3;
|
||||
|
||||
this->unk_2D4 = Math_Vec3f_Yaw(&this->actor.world.pos, &sp34);
|
||||
this->unk_2D0 = Math_Vec3f_Pitch(&this->actor.world.pos, &sp34) * -1.0f;
|
||||
|
|
|
@ -77,9 +77,9 @@ void EnBomBowlPit_DetectHit(EnBomBowlPit* this, GlobalContext* globalCtx) {
|
|||
this->unk_1C8.x = this->unk_1C8.y = this->unk_1C8.z = 0.1f;
|
||||
this->unk_1A4.x = this->unk_1A4.y = this->unk_1A4.z = 0.1f;
|
||||
|
||||
this->unk_180.x = this->unk_168.x = globalCtx->view.lookAt.x;
|
||||
this->unk_180.y = this->unk_168.y = globalCtx->view.lookAt.y;
|
||||
this->unk_180.z = this->unk_168.z = globalCtx->view.lookAt.z;
|
||||
this->unk_180.x = this->unk_168.x = globalCtx->view.at.x;
|
||||
this->unk_180.y = this->unk_168.y = globalCtx->view.at.y;
|
||||
this->unk_180.z = this->unk_168.z = globalCtx->view.at.z;
|
||||
|
||||
this->unk_18C.x = this->unk_174.x = globalCtx->view.eye.x;
|
||||
this->unk_18C.y = this->unk_174.y = globalCtx->view.eye.y;
|
||||
|
|
|
@ -313,9 +313,9 @@ void EnDivingGame_SetupRupeeThrow(EnDivingGame* this, GlobalContext* globalCtx)
|
|||
this->rupeesLeftToThrow = 10;
|
||||
}
|
||||
this->unk_2DC.x = this->unk_2DC.y = this->unk_2DC.z = this->unk_300.x = this->unk_300.y = this->unk_300.z = 0.1f;
|
||||
this->camLookAt.x = globalCtx->view.lookAt.x;
|
||||
this->camLookAt.y = globalCtx->view.lookAt.y;
|
||||
this->camLookAt.z = globalCtx->view.lookAt.z;
|
||||
this->camLookAt.x = globalCtx->view.at.x;
|
||||
this->camLookAt.y = globalCtx->view.at.y;
|
||||
this->camLookAt.z = globalCtx->view.at.z;
|
||||
this->camEye.x = globalCtx->view.eye.x;
|
||||
this->camEye.y = globalCtx->view.eye.y + 80.0f;
|
||||
this->camEye.z = globalCtx->view.eye.z + 250.0f;
|
||||
|
|
|
@ -164,9 +164,9 @@ void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
if (spawnerState != ENCOUNT2_INACTIVE) {
|
||||
// Direction vector for the direction the camera is facing
|
||||
tempVec1X = globalCtx->view.lookAt.x - globalCtx->view.eye.x;
|
||||
tempVec1Y = globalCtx->view.lookAt.y - globalCtx->view.eye.y;
|
||||
tempVec1Z = globalCtx->view.lookAt.z - globalCtx->view.eye.z;
|
||||
tempVec1X = globalCtx->view.at.x - globalCtx->view.eye.x;
|
||||
tempVec1Y = globalCtx->view.at.y - globalCtx->view.eye.y;
|
||||
tempVec1Z = globalCtx->view.at.z - globalCtx->view.eye.z;
|
||||
|
||||
// Normalised direction vector for the direction the camera is facing
|
||||
magnitude = sqrtf(SQ(tempVec1X) + SQ(tempVec1Y) + SQ(tempVec1Z));
|
||||
|
|
|
@ -279,9 +279,9 @@ void EnExItem_BowlPrize(EnExItem* this, GlobalContext* globalCtx) {
|
|||
if (this->type == EXITEM_BOMBCHUS_BOWLING) {
|
||||
sp3C = 220.0f;
|
||||
}
|
||||
tmpf1 = globalCtx->view.lookAt.x - globalCtx->view.eye.x;
|
||||
tmpf2 = globalCtx->view.lookAt.y - globalCtx->view.eye.y;
|
||||
tmpf3 = globalCtx->view.lookAt.z + sp3C - globalCtx->view.eye.z;
|
||||
tmpf1 = globalCtx->view.at.x - globalCtx->view.eye.x;
|
||||
tmpf2 = globalCtx->view.at.y - globalCtx->view.eye.y;
|
||||
tmpf3 = globalCtx->view.at.z + sp3C - globalCtx->view.eye.z;
|
||||
tmpf4 = sqrtf(SQ(tmpf1) + SQ(tmpf2) + SQ(tmpf3));
|
||||
|
||||
tmpf5 = (tmpf1 / tmpf4) * 5.0f;
|
||||
|
@ -362,9 +362,9 @@ void EnExItem_TargetPrizeApproach(EnExItem* this, GlobalContext* globalCtx) {
|
|||
|
||||
if (this->timer != 0) {
|
||||
if (this->prizeRotateTimer != 0) {
|
||||
tmpf1 = globalCtx->view.lookAt.x - globalCtx->view.eye.x;
|
||||
tmpf2 = globalCtx->view.lookAt.y - 10.0f - globalCtx->view.eye.y;
|
||||
tmpf3 = globalCtx->view.lookAt.z + 10.0f - globalCtx->view.eye.z;
|
||||
tmpf1 = globalCtx->view.at.x - globalCtx->view.eye.x;
|
||||
tmpf2 = globalCtx->view.at.y - 10.0f - globalCtx->view.eye.y;
|
||||
tmpf3 = globalCtx->view.at.z + 10.0f - globalCtx->view.eye.z;
|
||||
tmpf4 = sqrtf(SQ(tmpf1) + SQ(tmpf2) + SQ(tmpf3));
|
||||
|
||||
tmpf5 = (tmpf1 / tmpf4) * 5.0f;
|
||||
|
|
|
@ -347,9 +347,9 @@ void EnNiw_SpawnAttackCucco(EnNiw* this, GlobalContext* globalCtx) {
|
|||
Actor* attackCucco;
|
||||
|
||||
if ((this->timer5 == 0) && (this->unk_296 < 7)) {
|
||||
viewX = globalCtx->view.lookAt.x - globalCtx->view.eye.x;
|
||||
viewY = globalCtx->view.lookAt.y - globalCtx->view.eye.y;
|
||||
viewZ = globalCtx->view.lookAt.z - globalCtx->view.eye.z;
|
||||
viewX = globalCtx->view.at.x - globalCtx->view.eye.x;
|
||||
viewY = globalCtx->view.at.y - globalCtx->view.eye.y;
|
||||
viewZ = globalCtx->view.at.z - globalCtx->view.eye.z;
|
||||
attackCuccoPos.x = ((Rand_ZeroOne() - 0.5f) * viewX) + globalCtx->view.eye.x;
|
||||
attackCuccoPos.y = Rand_CenteredFloat(0.3f) + ((globalCtx->view.eye.y + 50.0f) + (viewY * 0.5f));
|
||||
attackCuccoPos.z = ((Rand_ZeroOne() - 0.5f) * viewZ) + globalCtx->view.eye.z;
|
||||
|
@ -983,9 +983,9 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
}
|
||||
if (thisx->floorHeight <= BGCHECK_Y_MIN || thisx->floorHeight >= 32000.0f) {
|
||||
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 上下? ☆☆☆☆☆ %f\n" VT_RST, thisx->floorHeight);
|
||||
cam.x = globalCtx->view.lookAt.x - globalCtx->view.eye.x;
|
||||
cam.y = globalCtx->view.lookAt.y - globalCtx->view.eye.y;
|
||||
cam.z = globalCtx->view.lookAt.z - globalCtx->view.eye.z;
|
||||
cam.x = globalCtx->view.at.x - globalCtx->view.eye.x;
|
||||
cam.y = globalCtx->view.at.y - globalCtx->view.eye.y;
|
||||
cam.z = globalCtx->view.at.z - globalCtx->view.eye.z;
|
||||
camResult = cam.y / sqrtf(SQ(cam.x) + SQ(cam.y) + SQ(cam.z));
|
||||
osSyncPrintf(VT_FGCOL(RED) "☆☆☆☆☆ 範囲外X! ☆☆☆☆☆ %f\n" VT_RST, thisx->world.pos.x);
|
||||
osSyncPrintf(VT_FGCOL(RED) "☆☆☆☆☆ 範囲外Y! ☆☆☆☆☆ %f\n" VT_RST, thisx->world.pos.y);
|
||||
|
|
|
@ -229,9 +229,9 @@ void ObjectKankyo_Fairies(ObjectKankyo* this, GlobalContext* globalCtx) {
|
|||
|
||||
for (i = 0; i < globalCtx->envCtx.unk_EE[3]; i++) {
|
||||
// spawn in front of the camera
|
||||
dx = globalCtx->view.lookAt.x - globalCtx->view.eye.x;
|
||||
dy = globalCtx->view.lookAt.y - globalCtx->view.eye.y;
|
||||
dz = globalCtx->view.lookAt.z - globalCtx->view.eye.z;
|
||||
dx = globalCtx->view.at.x - globalCtx->view.eye.x;
|
||||
dy = globalCtx->view.at.y - globalCtx->view.eye.y;
|
||||
dz = globalCtx->view.at.z - globalCtx->view.eye.z;
|
||||
dist = sqrtf(SQ(dx) + SQ(dy) + SQ(dz));
|
||||
|
||||
viewForwards.x = dx / dist;
|
||||
|
@ -600,9 +600,9 @@ void ObjectKankyo_DrawSnow(ObjectKankyo* this2, GlobalContext* globalCtx2) {
|
|||
switch (this->effects[i].state) {
|
||||
case 0:
|
||||
// spawn in front of the camera
|
||||
dx = globalCtx->view.lookAt.x - globalCtx->view.eye.x;
|
||||
dy = globalCtx->view.lookAt.y - globalCtx->view.eye.y;
|
||||
dz = globalCtx->view.lookAt.z - globalCtx->view.eye.z;
|
||||
dx = globalCtx->view.at.x - globalCtx->view.eye.x;
|
||||
dy = globalCtx->view.at.y - globalCtx->view.eye.y;
|
||||
dz = globalCtx->view.at.z - globalCtx->view.eye.z;
|
||||
dist = sqrtf(SQ(dx) + SQ(dy) + SQ(dz));
|
||||
|
||||
// fake
|
||||
|
@ -624,9 +624,9 @@ void ObjectKankyo_DrawSnow(ObjectKankyo* this2, GlobalContext* globalCtx2) {
|
|||
break;
|
||||
|
||||
case 1:
|
||||
dx = globalCtx->view.lookAt.x - globalCtx->view.eye.x;
|
||||
dy = globalCtx->view.lookAt.y - globalCtx->view.eye.y;
|
||||
dz = globalCtx->view.lookAt.z - globalCtx->view.eye.z;
|
||||
dx = globalCtx->view.at.x - globalCtx->view.eye.x;
|
||||
dy = globalCtx->view.at.y - globalCtx->view.eye.y;
|
||||
dz = globalCtx->view.at.z - globalCtx->view.eye.z;
|
||||
dist = sqrtf(SQ(dx) + SQ(dy) + SQ(dz));
|
||||
|
||||
baseX = globalCtx->view.eye.x + dx / dist * 80.0f;
|
||||
|
|
|
@ -38,8 +38,8 @@ void FileChoose_SetView(FileChooseContext* this, f32 eyeX, f32 eyeY, f32 eyeZ) {
|
|||
|
||||
up.y = 1.0f;
|
||||
|
||||
func_800AA358(&this->view, &eye, &lookAt, &up);
|
||||
func_800AAA50(&this->view, 0x7F);
|
||||
View_LookAt(&this->view, &eye, &lookAt, &up);
|
||||
View_Apply(&this->view, VIEW_ALL | VIEW_FORCE_VIEWING | VIEW_FORCE_VIEWPORT | VIEW_FORCE_PROJECTION_PERSPECTIVE);
|
||||
}
|
||||
|
||||
Gfx* FileChoose_QuadTextureIA8(Gfx* gfx, void* texture, s16 width, s16 height, s16 point) {
|
||||
|
|
|
@ -643,7 +643,7 @@ void Select_DrawMenu(SelectContext* this) {
|
|||
gSPSegment(POLY_OPA_DISP++, 0x00, NULL);
|
||||
func_80095248(gfxCtx, 0, 0, 0);
|
||||
SET_FULLSCREEN_VIEWPORT(&this->view);
|
||||
func_800AAA50(&this->view, 0xF);
|
||||
View_Apply(&this->view, VIEW_ALL);
|
||||
func_80094140(gfxCtx);
|
||||
|
||||
printer = alloca(sizeof(GfxPrint));
|
||||
|
@ -667,7 +667,7 @@ void Select_DrawLoadingScreen(SelectContext* this) {
|
|||
gSPSegment(POLY_OPA_DISP++, 0x00, NULL);
|
||||
func_80095248(gfxCtx, 0, 0, 0);
|
||||
SET_FULLSCREEN_VIEWPORT(&this->view);
|
||||
func_800AAA50(&this->view, 0xF);
|
||||
View_Apply(&this->view, VIEW_ALL);
|
||||
func_80094140(gfxCtx);
|
||||
|
||||
printer = alloca(sizeof(GfxPrint));
|
||||
|
@ -688,7 +688,7 @@ void Select_Draw(SelectContext* this) {
|
|||
gSPSegment(POLY_OPA_DISP++, 0x00, NULL);
|
||||
func_80095248(gfxCtx, 0, 0, 0);
|
||||
SET_FULLSCREEN_VIEWPORT(&this->view);
|
||||
func_800AAA50(&this->view, 0xF);
|
||||
View_Apply(&this->view, VIEW_ALL);
|
||||
|
||||
if (!this->state.running) {
|
||||
Select_DrawLoadingScreen(this);
|
||||
|
@ -733,7 +733,7 @@ void Select_Init(GameState* thisx) {
|
|||
this->opt = 0;
|
||||
this->count = ARRAY_COUNT(sScenes);
|
||||
View_Init(&this->view, this->state.gfxCtx);
|
||||
this->view.flags = (0x08 | 0x02);
|
||||
this->view.flags = (VIEW_PROJECTION_ORTHO | VIEW_VIEWPORT);
|
||||
this->verticalInputAccumulator = 0;
|
||||
this->verticalInput = 0;
|
||||
this->timerUp = 0;
|
||||
|
|
|
@ -49,9 +49,9 @@ void Title_SetupView(TitleContext* this, f32 x, f32 y, f32 z) {
|
|||
lookAt.x = lookAt.y = lookAt.z = 0.0f;
|
||||
up.y = 1.0f;
|
||||
|
||||
func_800AA460(view, 30.0f, 10.0f, 12800.0f);
|
||||
func_800AA358(view, &eye, &lookAt, &up);
|
||||
func_800AAA50(view, 0xF);
|
||||
View_SetPerspective(view, 30.0f, 10.0f, 12800.0f);
|
||||
View_LookAt(view, &eye, &lookAt, &up);
|
||||
View_Apply(view, VIEW_ALL);
|
||||
}
|
||||
|
||||
void Title_Draw(TitleContext* this) {
|
||||
|
|
|
@ -1428,8 +1428,8 @@ void KaleidoScope_SetView(PauseContext* pauseCtx, f32 x, f32 y, f32 z) {
|
|||
up.x = up.z = 0.0f;
|
||||
up.y = 1.0f;
|
||||
|
||||
func_800AA358(&pauseCtx->view, &eye, &lookAt, &up);
|
||||
func_800AAA50(&pauseCtx->view, 127);
|
||||
View_LookAt(&pauseCtx->view, &eye, &lookAt, &up);
|
||||
View_Apply(&pauseCtx->view, VIEW_ALL | VIEW_FORCE_VIEWING | VIEW_FORCE_VIEWPORT | VIEW_FORCE_PROJECTION_PERSPECTIVE);
|
||||
}
|
||||
|
||||
static u8 D_8082AE48[][4] = {
|
||||
|
|
Loading…
Reference in a new issue