Fix weird portal surface glitch when portal is moved

This commit is contained in:
James Lambert 2023-10-25 21:56:32 -06:00
parent 0d21f9818b
commit 996de635b6
3 changed files with 31 additions and 30 deletions

View file

@ -211,10 +211,10 @@ That will generate the rom at `/build/portal64.z64`
<br /> <br />
## Current New Feature TODO List ## Current New Feature TODO List
- [ ] figure out why portals somtimes are in front of window
- [ ] optimize static culling - [ ] optimize static culling
- [ ] jump animation - [ ] jump animation
- [ ] pausing while glados is speaking can end her speech early - [ ] pausing while glados is speaking can end her speech early
- [x] figure out why portals somtimes are in front of window
- [x] portal hole cutting problems - [x] portal hole cutting problems
- [x] crashed when dying in test chamber 05 when hit by pellet in mid air while touching a portal - [x] crashed when dying in test chamber 05 when hit by pellet in mid air while touching a portal
- [x] rumble pak support - [x] rumble pak support

View file

@ -1141,7 +1141,7 @@ materials:
fmt: G_IM_FMT_RGBA fmt: G_IM_FMT_RGBA
siz: G_IM_SIZ_32b siz: G_IM_SIZ_32b
gDPSetRenderMode: G_RM_XLU_SURF gDPSetRenderMode: G_RM_ZB_XLU_SURF
gDPSetCombineMode: gDPSetCombineMode:
color: ["0", "0", "0", "TEXEL0"] color: ["0", "0", "0", "TEXEL0"]
@ -1160,7 +1160,7 @@ materials:
t: t:
shift: 1 shift: 1
gDPSetRenderMode: G_RM_XLU_SURF gDPSetRenderMode: G_RM_ZB_XLU_SURF
gDPSetCombineMode: gDPSetCombineMode:
color: ["1", "PRIMITIVE", "TEXEL0_ALPHA", "PRIMITIVE"] color: ["1", "PRIMITIVE", "TEXEL0_ALPHA", "PRIMITIVE"]

View file

@ -25,33 +25,6 @@
#define ASPECT_SD 1.333333333333333 // 4:3 #define ASPECT_SD 1.333333333333333 // 4:3
#define ASPECT_WIDE 1.777777777777778 // 16:9 #define ASPECT_WIDE 1.777777777777778 // 16:9
void renderPropsInit(struct RenderProps* props, struct Camera* camera, float aspectRatio, struct RenderState* renderState, u16 roomIndex) {
props->camera = *camera;
props->aspectRatio = aspectRatio;
cameraSetupMatrices(camera, renderState, aspectRatio, &fullscreenViewport, 1, &props->cameraMatrixInfo);
props->viewport = &fullscreenViewport;
props->currentDepth = gSaveData.controls.portalRenderDepth;
props->exitPortalIndex = NO_PORTAL;
props->fromRoom = roomIndex;
props->parentStageIndex = -1;
props->clippingPortalIndex = -1;
props->minX = 0;
props->minY = 0;
props->maxX = SCREEN_WD;
props->maxY = SCREEN_HT;
props->previousProperties = NULL;
props->nextProperites[0] = NULL;
props->nextProperites[1] = NULL;
props->portalRenderType = 0;
props->visiblerooms = 0;
}
void renderPropscheckViewportSize(int* min, int* max, int screenSize) { void renderPropscheckViewportSize(int* min, int* max, int screenSize) {
if (*max < MIN_VP_WIDTH) { if (*max < MIN_VP_WIDTH) {
*max = MIN_VP_WIDTH; *max = MIN_VP_WIDTH;
@ -110,6 +83,34 @@ Vp* renderPropsBuildViewport(struct RenderProps* props, struct RenderState* rend
return viewport; return viewport;
} }
void renderPropsInit(struct RenderProps* props, struct Camera* camera, float aspectRatio, struct RenderState* renderState, u16 roomIndex) {
props->camera = *camera;
props->aspectRatio = aspectRatio;
cameraSetupMatrices(camera, renderState, aspectRatio, &fullscreenViewport, 1, &props->cameraMatrixInfo);
props->currentDepth = gSaveData.controls.portalRenderDepth;
props->exitPortalIndex = NO_PORTAL;
props->fromRoom = roomIndex;
props->parentStageIndex = -1;
props->clippingPortalIndex = -1;
props->minX = 0;
props->minY = 0;
props->maxX = SCREEN_WD;
props->maxY = SCREEN_HT;
props->viewport = renderPropsBuildViewport(props, renderState);
props->previousProperties = NULL;
props->nextProperites[0] = NULL;
props->nextProperites[1] = NULL;
props->portalRenderType = 0;
props->visiblerooms = 0;
}
void renderPlanFinishView(struct RenderPlan* renderPlan, struct Scene* scene, struct RenderProps* properties, struct RenderState* renderState); void renderPlanFinishView(struct RenderPlan* renderPlan, struct Scene* scene, struct RenderProps* properties, struct RenderState* renderState);
inline static float getAspect() inline static float getAspect()