mirror of
https://github.com/AloUltraExt/sm64ex-alo.git
synced 2025-01-22 07:32:15 -05:00
Remove no reorder surface and probably outdated comment
This commit is contained in:
parent
215aab6f48
commit
cd4d1c8215
2 changed files with 10 additions and 20 deletions
|
@ -37,9 +37,6 @@
|
||||||
// Saves a lot of CPU over silliness, by cleaning only used dynamic cells.
|
// Saves a lot of CPU over silliness, by cleaning only used dynamic cells.
|
||||||
#define BETTER_DYNAMIC_CELLS (0 || COLLISION_FIXES)
|
#define BETTER_DYNAMIC_CELLS (0 || COLLISION_FIXES)
|
||||||
|
|
||||||
// Removes surface priority ordering to save processing time.
|
|
||||||
#define NO_SURFACE_PRIORITY_REORDER (0 || COLLISION_FIXES)
|
|
||||||
|
|
||||||
// Automatically calculates the optimal collision distance for an object based on it's vertices.
|
// Automatically calculates the optimal collision distance for an object based on it's vertices.
|
||||||
#define AUTO_COLLISION_DISTANCE (0 || QOL_FEATURES)
|
#define AUTO_COLLISION_DISTANCE (0 || QOL_FEATURES)
|
||||||
|
|
||||||
|
|
|
@ -187,16 +187,12 @@ static void add_surface_to_cell(s32 dynamic, s32 cellX, s32 cellZ, struct Surfac
|
||||||
list = &gStaticSurfacePartition[cellZ][cellX][listIndex];
|
list = &gStaticSurfacePartition[cellZ][cellX][listIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !NO_SURFACE_PRIORITY_REORDER || WATER_SURFACES
|
//! (Surface Cucking) Surfaces are sorted by the height of their first vertex.
|
||||||
#if WATER_SURFACES
|
// Since vertices aren't ordered by height, this causes many lower triangles
|
||||||
if (listIndex == SPATIAL_PARTITION_WATER)
|
// to be sorted higher. This worsens surface cucking since many functions
|
||||||
#endif
|
// only use the first triangle in surface order that fits, missing higher surfaces.
|
||||||
|
// upperY would be a better sort method, set with optimizations enabled.
|
||||||
{
|
{
|
||||||
//! (Surface Cucking) Surfaces are sorted by the height of their first vertex.
|
|
||||||
// Since vertices aren't ordered by height, this causes many lower triangles
|
|
||||||
// to be sorted higher. This worsens surface cucking since many functions
|
|
||||||
// only use the first triangle in surface order that fits, missing higher surfaces.
|
|
||||||
// upperY would be a better sort method, set with optimizations enabled.
|
|
||||||
s32 surfacePriority = SURFACE_SORT(surface) * sortDir;
|
s32 surfacePriority = SURFACE_SORT(surface) * sortDir;
|
||||||
s32 priority;
|
s32 priority;
|
||||||
// Loop until we find the appropriate place for the surface in the list.
|
// Loop until we find the appropriate place for the surface in the list.
|
||||||
|
@ -210,7 +206,7 @@ static void add_surface_to_cell(s32 dynamic, s32 cellX, s32 cellZ, struct Surfac
|
||||||
list = list->next;
|
list = list->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
newNode->next = list->next;
|
newNode->next = list->next;
|
||||||
list->next = newNode;
|
list->next = newNode;
|
||||||
}
|
}
|
||||||
|
@ -774,19 +770,17 @@ void load_object_surfaces(TerrainData **data, TerrainData *vertexData, u32 dynam
|
||||||
#if AUTO_COLLISION_DISTANCE
|
#if AUTO_COLLISION_DISTANCE
|
||||||
// From Kaze
|
// From Kaze
|
||||||
static f32 get_optimal_collision_distance(struct Object *obj) {
|
static f32 get_optimal_collision_distance(struct Object *obj) {
|
||||||
f32 thisVertDist, maxDist = 0.0f;
|
register f32 thisVertDist, maxDist = 0.0f;
|
||||||
Vec3f thisVertPos, scale;
|
Vec3f thisVertPos;
|
||||||
TerrainData *collisionData = obj->collisionData;
|
TerrainData *collisionData = obj->collisionData;
|
||||||
collisionData++;
|
collisionData++;
|
||||||
u32 vertsLeft = *(collisionData)++;
|
register u32 vertsLeft = *(collisionData)++;
|
||||||
|
|
||||||
vec3_copy(scale, obj->header.gfx.scale);
|
|
||||||
|
|
||||||
// Loop through the collision vertices to find the vertex
|
// Loop through the collision vertices to find the vertex
|
||||||
// with the furthest distance from the model's origin.
|
// with the furthest distance from the model's origin.
|
||||||
while (vertsLeft) {
|
while (vertsLeft) {
|
||||||
// Apply scale to the position
|
// Apply scale to the position
|
||||||
vec3_prod(thisVertPos, collisionData, scale);
|
vec3_prod(thisVertPos, collisionData, obj->header.gfx.scale);
|
||||||
|
|
||||||
// Get the distance to the model's origin.
|
// Get the distance to the model's origin.
|
||||||
thisVertDist = vec3_sumsq(thisVertPos);
|
thisVertDist = vec3_sumsq(thisVertPos);
|
||||||
|
@ -859,7 +853,6 @@ void load_object_collision_model(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if AUTO_COLLISION_DISTANCE
|
#if AUTO_COLLISION_DISTANCE
|
||||||
// A value higher than 500.0f causes crashes with surfaces
|
|
||||||
s32 inColRadius = (
|
s32 inColRadius = (
|
||||||
(sqrLateralDist < sqr(colDist))
|
(sqrLateralDist < sqr(colDist))
|
||||||
&& (verticalMarioDiff > 0 || verticalMarioDiff > -colDist)
|
&& (verticalMarioDiff > 0 || verticalMarioDiff > -colDist)
|
||||||
|
|
Loading…
Reference in a new issue