summaryrefslogtreecommitdiff
path: root/src/new_render
diff options
context:
space:
mode:
Diffstat (limited to 'src/new_render')
-rw-r--r--src/new_render/draw.h13
-rw-r--r--src/new_render/render.h0
-rw-r--r--src/new_render/render_scene.h20
-rw-r--r--src/new_render/render_types.h59
4 files changed, 92 insertions, 0 deletions
diff --git a/src/new_render/draw.h b/src/new_render/draw.h
new file mode 100644
index 0000000..58e104e
--- /dev/null
+++ b/src/new_render/draw.h
@@ -0,0 +1,13 @@
+/**
+ * @file draw.h
+ * @brief
+ */
+#pragma once
+#include "defines.h"
+#include "maths_types.h"
+#include "render_types.h"
+
+// --- Public APIs
+
+PUB void EncodeDrawModel(Handle model, Mat4 transform);
+PUB void EncodeDrawMesh(Mesh* mesh, Material* material, Mat4 affine);
diff --git a/src/new_render/render.h b/src/new_render/render.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/new_render/render.h
diff --git a/src/new_render/render_scene.h b/src/new_render/render_scene.h
new file mode 100644
index 0000000..7591d8f
--- /dev/null
+++ b/src/new_render/render_scene.h
@@ -0,0 +1,20 @@
+/**
+ * @file render_scene.h
+ * @brief
+ */
+#pragma once
+#include "defines.h"
+#include "render_types.h"
+#include "camera.h"
+
+/** @brief Holds globally bound data for rendering a scene. Typically held by the renderer.
+ * Whenever you call draw functions you can think of this as an implicit parameter. */
+typedef struct RenderScene {
+ Camera camera;
+ PointLight light;
+} RenderScene;
+
+// --- Public APIs
+
+PUB void SetCamera(Camera camera);
+PUB void SetPointLight(PointLight light);
diff --git a/src/new_render/render_types.h b/src/new_render/render_types.h
new file mode 100644
index 0000000..13a45a4
--- /dev/null
+++ b/src/new_render/render_types.h
@@ -0,0 +1,59 @@
+/**
+ * @file render_types.h
+ * @brief
+*/
+
+#pragma once
+#include "defines.h"
+#include "ral.h"
+#include "maths.h"
+
+typedef struct Geometry {
+ VertexFormat format;
+ Vertex_darray* vertices;
+ bool has_indices;
+ u32_darray* indices;
+} Geometry;
+
+typedef struct u32_opt {
+ u32 value;
+ bool has_value;
+} u32_opt;
+
+typedef struct Mesh {
+ BufferHandle vextex_buffer;
+ BufferHandle index_buffer;
+ Geometry* geometry; // NULL means it has been freed CPU-side
+ bool is_uploaded; // has the data been uploaded to the GPU
+} Mesh;
+
+// --- Supported materials
+typedef enum MaterialKind {
+ MAT_BLINN_PHONG,
+ MAT_PBR,
+ MAT_PBR_PARAMS, // uses float values to represent a surface uniformly
+ MAT_COUNT
+} MaterialKind;
+static const char* material_kind_names[] = { "Blinn Phong", "PBR (Textures)", "PBR (Params)",
+ "Count (This should be an error)" };
+
+typedef struct Model {
+ // meshes
+ // materials
+} Model;
+
+// --- Lights
+typedef struct PointLight {
+ Vec3 position;
+ f32 constant, linear, quadratic;
+ Vec3 ambient;
+ Vec3 diffuse;
+ Vec3 specular;
+} PointLight;
+
+typedef struct DirectionalLight {
+ Vec3 direction;
+ Vec3 ambient;
+ Vec3 diffuse;
+ Vec3 specular;
+} DirectionalLight;