summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOmniscient <omniscient.oce@gmail.com>2024-06-18 11:03:52 +1000
committerOmniscient <omniscient.oce@gmail.com>2024-06-18 11:03:52 +1000
commitb2c9782ab2f4abec8f8548e667a8f2ad6e36bd4b (patch)
tree34973f37f585439357a5e455225d272e9398a742 /src
parent4b5695ce26a8f821dfac987e8e11a6ba5eeff610 (diff)
wip
Diffstat (limited to 'src')
-rw-r--r--src/maths/primitives.c26
-rw-r--r--src/renderer/builtin_materials.h5
-rw-r--r--src/renderer/immediate.c10
-rw-r--r--src/resources/gltf.c4
4 files changed, 18 insertions, 27 deletions
diff --git a/src/maths/primitives.c b/src/maths/primitives.c
index 2fbe71a..57e85a2 100644
--- a/src/maths/primitives.c
+++ b/src/maths/primitives.c
@@ -29,10 +29,10 @@ void geo_free_data(geometry_data* geo) {
// vertices
vec3 plane_vertex_positions[] = {
- (vec3){ -0.5, 0, -0.5},
- (vec3){ 0.5, 0, -0.5},
- (vec3){ -0.5, 0, 0.5},
- (vec3){ 0.5, 0, 0.5},
+ (vec3){ -0.5, 0, -0.5 },
+ (vec3){ 0.5, 0, -0.5 },
+ (vec3){ -0.5, 0, 0.5 },
+ (vec3){ 0.5, 0, 0.5 },
};
geometry_data geo_create_plane(f32x2 extents) {
@@ -49,17 +49,15 @@ geometry_data geo_create_plane(f32x2 extents) {
VERT_3D(vertices, vert_pos[1], VEC3_Y, vec2(1, 0));
VERT_3D(vertices, vert_pos[2], VEC3_Y, vec2(0, 1));
VERT_3D(vertices, vert_pos[3], VEC3_Y, vec2(1, 1));
-
- push_triangle(indices, 2,1,0);
- push_triangle(indices, 1,2,3);
- geometry_data geo = {
- .format = VERTEX_STATIC_3D,
- .vertices = vertices,
- .has_indices = true,
- .indices = indices,
- .colour = (rgba){ 0, 0, 0, 1 }
- };
+ push_triangle(indices, 2, 1, 0);
+ push_triangle(indices, 1, 2, 3);
+
+ geometry_data geo = { .format = VERTEX_STATIC_3D,
+ .vertices = vertices,
+ .has_indices = true,
+ .indices = indices,
+ .colour = (rgba){ 0, 0, 0, 1 } };
return geo;
}
diff --git a/src/renderer/builtin_materials.h b/src/renderer/builtin_materials.h
index 1a04f32..f0e7d2f 100644
--- a/src/renderer/builtin_materials.h
+++ b/src/renderer/builtin_materials.h
@@ -11,10 +11,7 @@
#pragma once
#include <assert.h>
-#include "colours.h"
#include "defines.h"
-#include "maths.h"
-#include "ral.h"
#include "ral_types.h"
// Currently supported materials
@@ -154,4 +151,4 @@ static shader_data_layout pbr_textured_shader_layout(void* data) {
return (shader_data_layout){ .name = "pbr_params", .bindings = { b1, b2, b3, b4, b5, b6 }, .bindings_count = 6
};
-} \ No newline at end of file
+}
diff --git a/src/renderer/immediate.c b/src/renderer/immediate.c
index b3431fa..63a62b8 100644
--- a/src/renderer/immediate.c
+++ b/src/renderer/immediate.c
@@ -12,7 +12,7 @@ typedef struct immdraw_system {
mesh cube;
mesh sphere;
// command lists
-
+
} immdraw_system;
bool immdraw_system_init(immdraw_system* state) {
@@ -28,13 +28,9 @@ bool immdraw_system_init(immdraw_system* state) {
return true;
}
-void immdraw_plane(vec3 pos, quat rotation, f32 u_scale, f32 v_scale, vec4 colour) {
-
-}
+void immdraw_plane(vec3 pos, quat rotation, f32 u_scale, f32 v_scale, vec4 colour) {}
-void immdraw_system_render(immdraw_system* state) {
-
-}
+void immdraw_system_render(immdraw_system* state) {}
// void imm_draw_sphere(vec3 pos, f32 radius, vec4 colour) {
// // Create the vertices
diff --git a/src/resources/gltf.c b/src/resources/gltf.c
index f136595..c51e30d 100644
--- a/src/resources/gltf.c
+++ b/src/resources/gltf.c
@@ -377,9 +377,9 @@ bool model_load_gltf_str(const char *file_string, const char *filepath, str8 rel
geometry->vertices = geo_vertices;
geometry->indices = geo_indices;
geometry->has_indices = has_indices;
-
+
mesh m = mesh_create(geometry, true);
- m.material_index = (u32_opt){.has_value = mat_idx == 9999, .value = mat_idx };
+ m.material_index = (u32_opt){ .has_value = mat_idx == 9999, .value = mat_idx };
mesh_darray_push(out_model->meshes, m);
}