summaryrefslogtreecommitdiff
path: root/src/new_render
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-07-27 17:40:29 +1000
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-07-27 17:40:29 +1000
commitbaa4f15774e2eb179a9b6ad6f3b781e0c3e85af3 (patch)
tree71c7cbc81f86d720e730c0d314b9b295d2f8141d /src/new_render
parentaa0fe8457cfff9c47c0c9fa4a1c86a79c7cbf9c5 (diff)
remove the editor folder
Diffstat (limited to 'src/new_render')
-rw-r--r--src/new_render/pbr.c2
-rw-r--r--src/new_render/pbr.h9
-rw-r--r--src/new_render/render.c8
-rw-r--r--src/new_render/render.h5
-rw-r--r--src/new_render/render_types.h7
5 files changed, 23 insertions, 8 deletions
diff --git a/src/new_render/pbr.c b/src/new_render/pbr.c
index 09da50e..4a91080 100644
--- a/src/new_render/pbr.c
+++ b/src/new_render/pbr.c
@@ -94,7 +94,7 @@ void PBR_Execute(PBR_Storage* storage, Camera camera, TextureHandle shadowmap_te
lights_data = { .pointLights = {
// FIXME: add lights to our RenderScene structure. for now these are
// hardcoded
- (pbr_point_light){ .pos = vec3(10, 10, 10), .color = light_color },
+ (pbr_point_light){ .pos = vec3(0.0, 2.0, 2.0), .color = light_color },
(pbr_point_light){ .pos = vec3(-10, 10, 10), .color = light_color },
(pbr_point_light){ .pos = vec3(10, -10, 10), .color = light_color },
(pbr_point_light){ .pos = vec3(-10, -10, 10), .color = light_color },
diff --git a/src/new_render/pbr.h b/src/new_render/pbr.h
index d8c9405..cbdc577 100644
--- a/src/new_render/pbr.h
+++ b/src/new_render/pbr.h
@@ -48,11 +48,10 @@ typedef struct PBR_Textures {
TextureHandle ao_map;
} PBR_Textures;
-// --- Internal
-
-typedef struct MaterialMap MaterialMap;
+PUB Material PBRMaterialDefault();
+PUB ShaderDataLayout PBRMaterial_GetLayout(void* data);
-Material PBRMaterialDefault();
+// --- Internal
GPU_Renderpass* PBR_RPassCreate();
@@ -60,5 +59,3 @@ GPU_Pipeline* PBR_PipelineCreate(GPU_Renderpass* rpass);
void PBR_Execute(PBR_Storage* storage, Camera camera, TextureHandle shadowmap_tex,
RenderEnt* entities, size_t entity_count);
-
-ShaderDataLayout PBRMaterial_GetLayout(void* data); \ No newline at end of file
diff --git a/src/new_render/render.c b/src/new_render/render.c
index 235f1cb..77a3269 100644
--- a/src/new_render/render.c
+++ b/src/new_render/render.c
@@ -37,6 +37,7 @@ struct Renderer {
GPU_Swapchain swapchain;
GPU_Renderpass* default_renderpass;
bool frame_aborted;
+ RenderMode render_mode;
RenderScene scene;
PBR_Storage* pbr;
Shadow_Storage* shadows;
@@ -54,6 +55,7 @@ Renderer* get_renderer() { return g_core.renderer; }
bool Renderer_Init(RendererConfig config, Renderer* ren, GLFWwindow** out_window,
GLFWwindow* optional_window) {
INFO("Renderer init");
+ ren->render_mode = RENDER_MODE_DEFAULT;
ren->frame_arena = arena_create(malloc(FRAME_ARENA_SIZE), FRAME_ARENA_SIZE);
@@ -293,6 +295,7 @@ TextureHandle Render_GetWhiteTexture() {
return ren->white_1x1;
}
+/** @return an arena allocator that gets cleared at the beginning of every render frame */
arena* Render_GetFrameArena() {
Renderer* ren = Core_GetRenderer(&g_core);
return &ren->frame_arena;
@@ -305,4 +308,9 @@ Mesh_pool* Render_GetMeshPool() {
Material_pool* Render_GetMaterialPool() {
Renderer* ren = Core_GetRenderer(&g_core);
return &ren->material_pool;
+}
+
+void Render_SetRenderMode(RenderMode mode) {
+ Renderer* ren = Core_GetRenderer(&g_core);
+ ren->render_mode = mode;
} \ No newline at end of file
diff --git a/src/new_render/render.h b/src/new_render/render.h
index ef11b5f..b7af7cb 100644
--- a/src/new_render/render.h
+++ b/src/new_render/render.h
@@ -84,4 +84,7 @@ Terrain_Storage* Render_GetTerrainStorage();
TextureHandle Render_GetWhiteTexture();
arena* Render_GetFrameArena();
Mesh_pool* Render_GetMeshPool();
-Material_pool* Render_GetMaterialPool(); \ No newline at end of file
+Material_pool* Render_GetMaterialPool();
+
+// --- Setters
+void Render_SetRenderMode(RenderMode mode); \ No newline at end of file
diff --git a/src/new_render/render_types.h b/src/new_render/render_types.h
index 2b7a77a..5fdca8a 100644
--- a/src/new_render/render_types.h
+++ b/src/new_render/render_types.h
@@ -17,6 +17,13 @@ CORE_DEFINE_HANDLE(MeshHandle);
#define INVALID_MATERIAL_HANDLE ((MaterialHandle){ .raw = 9999992 })
#define INVALID_MESH_HANDLE ((MeshHandle){ .raw = 9999993 })
+typedef enum RenderMode {
+ RENDER_MODE_DEFAULT,
+ RENDER_MODE_WIREFRAME,
+ RENDER_MODE_WIREFRAME_ON_LIT,
+ RENDER_MODE_COUNT
+} RenderMode;
+
typedef struct Geometry {
VertexFormat format;
Vertex_darray* vertices;