summaryrefslogtreecommitdiff
path: root/src/new_render/render_frame.h
blob: 11b24f2e3624a2f03461bd93e4b7ddcf3ea11758 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#pragma once
#include "camera.h"
#include "defines.h"
#include "ral_types.h"
#include "render_types.h"

// Frame lifecycle on CPU

// 1. extract
// 2. culling
// 3. render
// 4. dispatch (combined with render for now)

typedef struct Cull_Result {
  u64 n_visible_objects;
  u64 n_culled_objects;
  u32* visible_ent_indices; // allocated on frame arena
  size_t index_count;
} Cull_Result;

// everything that can be in the world, knows how to extract rendering data
typedef void (*ExtractRenderData)(void* world_data);

typedef struct Renderer Renderer;

/** @brief Produces a smaller set of only those meshes visible in the camera frustum on the CPU */
Cull_Result Frame_Cull(Renderer* ren, RenderEnt* entities, size_t entity_count, Camera *camera);