Initial implementation of bounding sphere clipping
This commit is contained in:
@@ -40,6 +40,8 @@ typedef struct {
|
||||
list_vec3f_t *vertices;
|
||||
list_scene_triangle_t *triangles;
|
||||
} model_t;
|
||||
#define NULL_MODEL ((model_t){0})
|
||||
#define IS_NULL_MODEL(MODEL) (MODEL.vertices == NULL && MODEL.triangles == NULL)
|
||||
|
||||
typedef struct {
|
||||
f32 scale;
|
||||
@@ -47,6 +49,11 @@ typedef struct {
|
||||
vec3f_t position;
|
||||
} transform_t;
|
||||
|
||||
typedef struct {
|
||||
vec3f_t centre;
|
||||
f32 radius;
|
||||
} bounding_sphere_t;
|
||||
|
||||
typedef struct {
|
||||
model_t *model;
|
||||
transform_t transform;
|
||||
@@ -57,21 +64,16 @@ typedef struct {
|
||||
f32 distance;
|
||||
} clipping_plane_t;
|
||||
|
||||
#define CLIPPING_PLANE_COUNT 5
|
||||
typedef struct {
|
||||
u64 instance_count;
|
||||
instance_t *instances;
|
||||
camera_t *camera;
|
||||
const mat3x4f_t *proj_matrix;
|
||||
clipping_plane_t near;
|
||||
clipping_plane_t left;
|
||||
clipping_plane_t right;
|
||||
clipping_plane_t bottom;
|
||||
clipping_plane_t top;
|
||||
clipping_plane_t planes[CLIPPING_PLANE_COUNT];
|
||||
} rasteriser_scene_t;
|
||||
|
||||
void render_scene(window_t *wnd, Arena *arena, const rasteriser_scene_t *scene);
|
||||
void render_instance(window_t *wnd, Arena *arena, mat4x4f_t camera_matrix,
|
||||
mat3x4f_t projection_matrix, const instance_t *instance);
|
||||
void draw_wireframe_triangle(window_t *wnd, Arena *arena, triangle_t triangle);
|
||||
void draw_filled_triangle(window_t *wnd, Arena *arena, triangle_t triangle);
|
||||
void draw_shaded_triangle(window_t *wnd, Arena *arena, triangle_t triangle);
|
||||
|
||||
Reference in New Issue
Block a user