summaryrefslogtreecommitdiff
path: root/src/new_render
diff options
context:
space:
mode:
authorOmniscient <omniscient.oce@gmail.com>2024-07-11 21:43:06 +1000
committerOmniscient <omniscient.oce@gmail.com>2024-07-11 21:43:06 +1000
commitfedba7ff68924ff50022405fc9103a5acf7013fe (patch)
treecd4e8ebd21736d460ac0434ce08cc2012bf613e0 /src/new_render
parent9f23f65ec631bcd08f200b3ef517da8acf8d6b17 (diff)
wip
Diffstat (limited to 'src/new_render')
-rw-r--r--src/new_render/immdraw.h14
-rw-r--r--src/new_render/render.c37
-rw-r--r--src/new_render/render.h12
-rw-r--r--src/new_render/render_types.h4
-rw-r--r--src/new_render/shadows.h1
-rw-r--r--src/new_render/skybox.h6
6 files changed, 73 insertions, 1 deletions
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"