remove vertex high fps interpolation (has no negative effect)

This commit is contained in:
AloXado320 2021-08-31 19:31:49 -05:00
parent 9a986180d8
commit bc8a35f83a
5 changed files with 0 additions and 91 deletions

View file

@ -256,12 +256,6 @@ struct Surface {
} normal;
/*0x28*/ f32 originOffset;
/*0x2C*/ struct Object *object;
#ifdef HIGH_FPS_PC
Vec3s prevVertex1;
Vec3s prevVertex2;
Vec3s prevVertex3;
u32 modifiedTimestamp;
#endif
};
struct MarioBodyState {

View file

@ -397,9 +397,6 @@ f32 find_floor_height_and_data(f32 xPos, f32 yPos, f32 zPos, struct FloorGeometr
return floorHeight;
}
#ifdef HIGH_FPS_PC
u8 gInterpolatingSurfaces;
#endif
/**
* Iterate through the list of floors and find the first floor under a given point.
@ -411,37 +408,16 @@ static struct Surface *find_floor_from_list(struct SurfaceNode *surfaceNode, s32
f32 oo;
f32 height;
struct Surface *floor = NULL;
#ifdef HIGH_FPS_PC
s32 interpolate;
#endif
// Iterate through the list of floors until there are no more floors.
while (surfaceNode != NULL) {
surf = surfaceNode->surface;
surfaceNode = surfaceNode->next;
#ifdef HIGH_FPS_PC
interpolate = gInterpolatingSurfaces && surf->modifiedTimestamp == gGlobalTimer;
#endif
x1 = surf->vertex1[0];
z1 = surf->vertex1[2];
x2 = surf->vertex2[0];
z2 = surf->vertex2[2];
#ifdef HIGH_FPS_PC
if (interpolate) {
f32 diff = (surf->prevVertex1[0] - x1) * (surf->prevVertex1[0] - x1);
diff += (surf->prevVertex1[1] - surf->vertex1[1]) * (surf->prevVertex1[1] - surf->vertex1[1]);
diff += (surf->prevVertex1[2] - z1) * (surf->prevVertex1[2] - z1);
if (diff > 10000) {
interpolate = FALSE;
} else {
x1 = (surf->prevVertex1[0] + x1) / 2;
z1 = (surf->prevVertex1[2] + z1) / 2;
x2 = (surf->prevVertex2[0] + x2) / 2;
z2 = (surf->prevVertex2[2] + z2) / 2;
}
}
#endif
// Check that the point is within the triangle bounds.
if ((z1 - z) * (x2 - x1) - (x1 - x) * (z2 - z1) < 0) {
@ -451,12 +427,6 @@ static struct Surface *find_floor_from_list(struct SurfaceNode *surfaceNode, s32
// To slightly save on computation time, set this later.
x3 = surf->vertex3[0];
z3 = surf->vertex3[2];
#ifdef HIGH_FPS_PC
if (interpolate) {
x3 = (surf->prevVertex3[0] + x3) / 2;
z3 = (surf->prevVertex3[2] + z3) / 2;
}
#endif
if ((z2 - z) * (x3 - x2) - (x2 - x) * (z3 - z2) < 0) {
continue;
@ -476,37 +446,10 @@ static struct Surface *find_floor_from_list(struct SurfaceNode *surfaceNode, s32
continue;
}
#ifdef HIGH_FPS_PC
if (interpolate) {
f32 y1, y2, y3;
f32 mag;
y1 = (surf->prevVertex1[1] + surf->vertex1[1]) / 2;
y2 = (surf->prevVertex2[1] + surf->vertex2[1]) / 2;
y3 = (surf->prevVertex3[1] + surf->vertex3[1]) / 2;
nx = (y2 - y1) * (z3 - z2) - (z2 - z1) * (y3 - y2);
ny = (z2 - z1) * (x3 - x2) - (x2 - x1) * (z3 - z2);
nz = (x2 - x1) * (y3 - y2) - (y2 - y1) * (x3 - x2);
mag = sqrtf(nx * nx + ny * ny + nz * nz);
if (mag < 0.0001) {
continue;
}
mag = (f32)(1.0 / mag);
nx *= mag;
ny *= mag;
nz *= mag;
oo = -(nx * x1 + ny * y1 + nz * z1);
} else {
nx = surf->normal.x;
ny = surf->normal.y;
nz = surf->normal.z;
oo = surf->originOffset;
}
#else
nx = surf->normal.x;
ny = surf->normal.y;
nz = surf->normal.z;
oo = surf->originOffset;
#endif
// If a wall, ignore it. Likely a remnant, should never occur.
if (ny == 0.0f) {
@ -525,17 +468,6 @@ static struct Surface *find_floor_from_list(struct SurfaceNode *surfaceNode, s32
#endif
*pheight = height;
#ifdef HIGH_FPS_PC
if (interpolate) {
static struct Surface s;
s.type = surf->type;
s.normal.x = nx;
s.normal.y = ny;
s.normal.z = nz;
s.originOffset = oo;
return &s;
}
#endif
floor = surf;
break;
}

View file

@ -383,13 +383,6 @@ static struct Surface *read_surface_data(s16 *vertexData, s16 **vertexIndices) {
surface = alloc_surface();
#ifdef HIGH_FPS_PC
vec3s_copy(surface->prevVertex1, surface->vertex1);
vec3s_copy(surface->prevVertex2, surface->vertex2);
vec3s_copy(surface->prevVertex3, surface->vertex3);
surface->modifiedTimestamp = gGlobalTimer;
#endif
surface->vertex1[0] = x1;
surface->vertex2[0] = x2;
surface->vertex3[0] = x3;

View file

@ -15,17 +15,10 @@
static s16 sMovingSandSpeeds[] = { 12, 8, 4, 0 };
#ifdef HIGH_FPS_PC
struct Surface gWaterSurfacePseudoFloor = {
SURFACE_VERY_SLIPPERY, 0, 0, 0, 0, 0, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
{ 0.0f, 1.0f, 0.0f }, 0.0f, NULL, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, 0
};
#else
struct Surface gWaterSurfacePseudoFloor = {
SURFACE_VERY_SLIPPERY, 0, 0, 0, 0, 0, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
{ 0.0f, 1.0f, 0.0f }, 0.0f, NULL,
};
#endif
/**
* Always returns zero. This may have been intended

View file

@ -1052,12 +1052,9 @@ static void geo_process_shadow(struct GraphNodeShadow *node) {
gCurGraphNodeObject->prevShadowPosTimestamp = gGlobalTimer;
}
extern u8 gInterpolatingSurfaces;
gInterpolatingSurfaces = TRUE;
shadowListInterpolated = create_shadow_below_xyz(shadowPosInterpolated[0], shadowPosInterpolated[1],
shadowPosInterpolated[2], shadowScale,
node->shadowSolidity, node->shadowType);
gInterpolatingSurfaces = FALSE;
#endif
shadowList = create_shadow_below_xyz(shadowPos[0], shadowPos[1], shadowPos[2], shadowScale,