Fix portal face clipping issue

This commit is contained in:
James Lambert 2022-07-07 22:30:55 -06:00
parent 7b5b54d8c1
commit 421c943132
7 changed files with 29 additions and 12 deletions

View file

@ -35,13 +35,13 @@ SECTIONS
build/asm/entry.o(.text);
CODE_SEGMENT(.text);
/usr/lib/n64/PR/rspboot.o(.text);
/usr/lib/n64/PR/gspF3DEX2.fifo.o(.text);
/usr/lib/n64/PR/gspF3DEX2.NoN.fifo.o(.text);
/usr/lib/n64/PR/aspMain.o(.text);
/* data */
CODE_SEGMENT(.data*);
/usr/lib/n64/PR/rspboot.o(.data*);
/usr/lib/n64/PR/gspF3DEX2.fifo.o(.data*);
/usr/lib/n64/PR/gspF3DEX2.NoN.fifo.o(.data*);
/usr/lib/n64/PR/aspMain.o(.data*);
/* rodata */

View file

@ -79,8 +79,8 @@ void graphicsCreateTask(struct GraphicsTask* targetTask, GraphicsCallback callba
task->flags = OS_TASK_LOADABLE;
task->ucode_boot = (u64*)rspbootTextStart;
task->ucode_boot_size = (u32)rspbootTextEnd - (u32)rspbootTextStart;
task->ucode = (u64*)gspF3DEX2_fifoTextStart;
task->ucode_data = (u64*)gspF3DEX2_fifoDataStart;
task->ucode = (u64*)gspF3DEX2_NoN_fifoTextStart;
task->ucode_data = (u64*)gspF3DEX2_NoN_fifoDataStart;
task->output_buff = (u64*)rdpOutput;
task->output_buff_size = (u64*)rdpOutput + RDP_OUTPUT_SIZE/sizeof(u64);
task->ucode_data_size = SP_UCODE_DATA_SIZE;

View file

@ -32,6 +32,10 @@ Vp* renderStateRequestViewport(struct RenderState* renderState) {
return renderStateRequestMemory(renderState, sizeof(Vp));
}
Vtx* renderStateRequestVertices(struct RenderState* renderState, unsigned count) {
return renderStateRequestMemory(renderState, sizeof(Vtx) * count);
}
void renderStateFlushCache(struct RenderState* renderState) {
osWritebackDCache(renderState, sizeof(struct RenderState));
}

View file

@ -22,6 +22,7 @@ void renderStateInit(struct RenderState* renderState, u16* framebuffer, u16* dep
Mtx* renderStateRequestMatrices(struct RenderState* renderState, unsigned count);
Light* renderStateRequestLights(struct RenderState* renderState, unsigned count);
Vp* renderStateRequestViewport(struct RenderState* renderState);
Vtx* renderStateRequestVertices(struct RenderState* renderState, unsigned count);
void renderStateFlushCache(struct RenderState* renderState);
Gfx* renderStateAllocateDLChunk(struct RenderState* renderState, unsigned count);
Gfx* renderStateReplaceDL(struct RenderState* renderState, Gfx* nextDL);

View file

@ -3,9 +3,16 @@
#include "../math/box2d.h"
#include "../math/vector3.h"
#include "../math/vector2s16.h"
#include <ultra64.h>
#define MAX_NEAR_POLYGON_SIZE 12
struct ScreenClipper {
float pointTransform[4][4];
struct Vector2s16 nearPolygon[MAX_NEAR_POLYGON_SIZE];
short nearPolygonCount;
};
struct Camera;

View file

@ -7,6 +7,7 @@
#include "dynamic_scene.h"
#include "../physics/collision_scene.h"
#include "../math/mathf.h"
#include "../math/vector2s16.h"
#include "../build/assets/models/portal/portal_blue.h"
#include "../build/assets/models/portal/portal_orange.h"
@ -20,15 +21,17 @@
#define PORTAL_SCALE_Y 0.8f
#define PORTAL_SCALE_X 0.95f
#define PORTAL_FACE_OFFSET (-0.014106 * SCENE_SCALE)
struct Vector3 gPortalOutline[PORTAL_LOOP_SIZE] = {
{0.0f, 1.0f * SCENE_SCALE * PORTAL_SCALE_Y, 0.0f},
{0.353553f * SCENE_SCALE * PORTAL_SCALE_X, 0.707107f * SCENE_SCALE * PORTAL_SCALE_Y, 0.0f},
{0.5f * SCENE_SCALE * PORTAL_SCALE_X, 0.0f, 0.0f},
{0.353553f * SCENE_SCALE * PORTAL_SCALE_X, -0.707107f * SCENE_SCALE * PORTAL_SCALE_Y, 0.0f},
{0.0f, -1.0f * SCENE_SCALE * PORTAL_SCALE_Y, 0.0f},
{-0.353553f * SCENE_SCALE * PORTAL_SCALE_X, -0.707107f * SCENE_SCALE * PORTAL_SCALE_Y, 0.0f},
{-0.5f * SCENE_SCALE* PORTAL_SCALE_X, 0.0f, 0.0f},
{-0.353553f * SCENE_SCALE * PORTAL_SCALE_X, 0.707107f * SCENE_SCALE * PORTAL_SCALE_Y, 0.0f},
{-0.353553f * SCENE_SCALE * PORTAL_SCALE_X, 0.707107f * SCENE_SCALE * PORTAL_SCALE_Y, PORTAL_FACE_OFFSET},
{-0.5f * SCENE_SCALE* PORTAL_SCALE_X, 0.0f, PORTAL_FACE_OFFSET},
{-0.353553f * SCENE_SCALE * PORTAL_SCALE_X, -0.707107f * SCENE_SCALE * PORTAL_SCALE_Y, PORTAL_FACE_OFFSET},
{0.0f, -1.0f * SCENE_SCALE * PORTAL_SCALE_Y, PORTAL_FACE_OFFSET},
{0.353553f * SCENE_SCALE * PORTAL_SCALE_X, -0.707107f * SCENE_SCALE * PORTAL_SCALE_Y, PORTAL_FACE_OFFSET},
{0.5f * SCENE_SCALE * PORTAL_SCALE_X, 0.0f, PORTAL_FACE_OFFSET},
{0.353553f * SCENE_SCALE * PORTAL_SCALE_X, 0.707107f * SCENE_SCALE * PORTAL_SCALE_Y, PORTAL_FACE_OFFSET},
{0.0f, 1.0f * SCENE_SCALE * PORTAL_SCALE_Y, PORTAL_FACE_OFFSET},
};
struct Vector3 gPortalOutlineWorld[PORTAL_LOOP_SIZE] = {
@ -327,6 +330,7 @@ void portalRender(struct Portal* portal, struct Portal* otherPortal, struct Rend
} else {
gSPDisplayList(renderState->dl++, portal_portal_orange_model_gfx);
}
gSPPopMatrix(renderState->dl++, G_MTX_MODELVIEW);
}

View file

@ -3,6 +3,7 @@
#include "../math/transform.h"
#include "../math/plane.h"
#include "../math/vector2s16.h"
#include "../graphics/renderstate.h"
#include "camera.h"
#include "static_scene.h"