From fedba7ff68924ff50022405fc9103a5acf7013fe Mon Sep 17 00:00:00 2001 From: Omniscient Date: Thu, 11 Jul 2024 21:43:06 +1000 Subject: wip --- src/new_render/immdraw.h | 14 ++++++++++++++ src/new_render/render.c | 37 +++++++++++++++++++++++++++++++++++++ src/new_render/render.h | 12 ++++++++++++ src/new_render/render_types.h | 4 ++++ src/new_render/shadows.h | 1 - src/new_render/skybox.h | 6 ++++++ 6 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 src/new_render/immdraw.h create mode 100644 src/new_render/render.c create mode 100644 src/new_render/skybox.h (limited to 'src/new_render') diff --git a/src/new_render/immdraw.h b/src/new_render/immdraw.h new file mode 100644 index 0000000..c2c3a24 --- /dev/null +++ b/src/new_render/immdraw.h @@ -0,0 +1,14 @@ +/** + * @brief Immediate-mode drawing APIs + */ + +#pragma once +#include "defines.h" +#include "maths_types.h" + +// --- Public API + + +void Immdraw_Cuboid(Transform tf); +void Immdraw_Sphere(Transform tf, f32 size); +void Immdraw_TransformGizmo(Transform tf, f32 size); diff --git a/src/new_render/render.c b/src/new_render/render.c new file mode 100644 index 0000000..455b730 --- /dev/null +++ b/src/new_render/render.c @@ -0,0 +1,37 @@ +/** + * @brief + */ + +#include "render.h" +#include "maths_types.h" +#include "shadow.h" + +struct RendererConfig { + char window_name[256]; + u32 scr_width, scr_height; + Vec3 clear_colour; +}; + +struct Renderer { + struct GLFWwindow* window; + RendererConfig config; + GPU_Device device; + GPU_Swapchain swapchain; + GPU_Renderpass* default_renderpass; + bool frame_aborted; + RenderScene scene; + PBR_Storage pbr; + Shadow_Storage shadows; + Terrain_Storage terrain; + Text_Storage text; + ResourcePools* resource_pools; +}; + +bool Renderer_Init(RendererConfig config, Renderer* renderer) { + // set the RAL backend up + + // create our renderpasses + Shadow_Init(&renderer->shadows); + + return true; +} diff --git a/src/new_render/render.h b/src/new_render/render.h index e69de29..93b2366 100644 --- a/src/new_render/render.h +++ b/src/new_render/render.h @@ -0,0 +1,12 @@ +/** + * @brief + */ + +#pragma once +#include "defines.h" + +typedef struct Renderer Renderer; +typedef struct RendererConfig RendererConfig; + +PUB bool Renderer_Init(RendererConfig config, Renderer* renderer); +PUB void Renderer_Shutdown(Renderer* renderer); diff --git a/src/new_render/render_types.h b/src/new_render/render_types.h index 13a45a4..63c472e 100644 --- a/src/new_render/render_types.h +++ b/src/new_render/render_types.h @@ -37,6 +37,10 @@ typedef enum MaterialKind { static const char* material_kind_names[] = { "Blinn Phong", "PBR (Textures)", "PBR (Params)", "Count (This should be an error)" }; +typedef struct Material { + char name[64]; +} Material; + typedef struct Model { // meshes // materials diff --git a/src/new_render/shadows.h b/src/new_render/shadows.h index 4f10f35..fd1c45d 100644 --- a/src/new_render/shadows.h +++ b/src/new_render/shadows.h @@ -1,5 +1,4 @@ /** - * @file shadows.h * @brief Functions for adding shadows to scene rendering. */ diff --git a/src/new_render/skybox.h b/src/new_render/skybox.h new file mode 100644 index 0000000..10ec4f9 --- /dev/null +++ b/src/new_render/skybox.h @@ -0,0 +1,6 @@ +/** + * @brief + */ + +#pragma once +#include "defines.h" -- cgit v1.2.3-70-g09d2