1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-02 22:14:33 +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:
Robin Allen 2022-04-08 23:50:28 +01:00 committed by GitHub
parent b9b40805f7
commit 9984c267d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 210 additions and 170 deletions

View file

@ -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) {

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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));

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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) {

View file

@ -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;

View file

@ -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) {

View file

@ -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] = {