surface load optimizations

This commit is contained in:
thecozies
2021-12-11 15:58:27 -06:00
parent b529941cbb
commit f740731fd6
2 changed files with 115 additions and 172 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -6,6 +6,11 @@
#include "surface_collision.h"
#include "types.h"
#define SURFACE_VERTICAL_BUFFER 5
#define NORMAL_FLOOR_THRESHOLD 0.01f
#define NORMAL_CEIL_THRESHOLD -NORMAL_FLOOR_THRESHOLD
extern u8 gSurfacePoolError;
struct SurfaceNode {
@@ -13,26 +18,28 @@ struct SurfaceNode {
struct Surface *surface;
};
enum {
enum SpatialPartitions {
SPATIAL_PARTITION_FLOORS,
SPATIAL_PARTITION_CEILS,
SPATIAL_PARTITION_WALLS,
SPATIAL_PARTITION_WATER
SPATIAL_PARTITION_WATER,
NUM_SPATIAL_PARTITIONS
};
typedef struct SurfaceNode SpatialPartitionCell[4];
typedef struct SurfaceNode SpatialPartitionCell[NUM_SPATIAL_PARTITIONS];
extern SpatialPartitionCell gStaticSurfacePartition[NUM_CELLS][NUM_CELLS];
extern SpatialPartitionCell gDynamicSurfacePartition[NUM_CELLS][NUM_CELLS];
extern struct SurfaceNode *sSurfaceNodePool;
extern struct Surface *sSurfacePool;
extern s16 sSurfacePoolSize;
extern s32 sSurfaceNodePoolSize;
extern s32 sSurfacePoolSize;
void alloc_surface_pools(void);
#ifdef NO_SEGMENTED_MEMORY
u32 get_area_terrain_size(TerrainData *data);
#endif
void load_area_terrain(s32 index, TerrainData *data, RoomData *surfaceRooms, s16 *macroObjects);
void load_area_terrain(s32 index, TerrainData *data, RoomData *surfaceRooms, MacroObject *macroObjects);
void clear_dynamic_surfaces(void);
void load_object_collision_model(void);