summaryrefslogtreecommitdiff
path: root/src/maths/primitives.c
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-06-16 01:21:12 +1000
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-06-16 01:21:12 +1000
commit60d1e086242940993432a40a934241dc40b7382c (patch)
tree1f7a16dd4ad527d3c9f201f616d3f1490445009b /src/maths/primitives.c
parentd52654dfdbe16345023fed4c61261dc4c66b96fe (diff)
uniform blocks working. fix spec highlight bug tomorrow
Diffstat (limited to 'src/maths/primitives.c')
-rw-r--r--src/maths/primitives.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/maths/primitives.c b/src/maths/primitives.c
index 86855db..5d9c70f 100644
--- a/src/maths/primitives.c
+++ b/src/maths/primitives.c
@@ -159,7 +159,7 @@ geometry_data geo_create_uvsphere(f32 radius, u32 north_south_lines, u32 east_we
// Top point
vertex top = { .static_3d = { .position = vec3(0, radius, 0),
- .normal = vec3(0, radius, 0),
+ .normal = vec3_normalise(vec3(0, radius, 0)),
.tex_coords = vec2(0, 0) } };
vertex_darray_push(vertices, top);
@@ -173,13 +173,13 @@ geometry_data geo_create_uvsphere(f32 radius, u32 north_south_lines, u32 east_we
// theta should range from 0 to 2PI
f32 theta = TAU * ((f32)j / (f32)north_south_lines);
vec3 position = spherical_to_cartesian_coords(radius, theta, phi);
- f32 d = vec3_len(position);
+ // f32 d = vec3_len(position);
// print_vec3(position);
// printf("Phi %f Theta %f d %d\n", phi, theta, d);
// assert(d == radius); // all points on the sphere should be 'radius' away from the origin
vertex v = { .static_3d = {
.position = position,
- .normal = position, // normal vector on sphere is same as position
+ .normal = vec3_normalise(position), // normal vector on sphere is same as position
.tex_coords = vec2(0, 0) // TODO
} };
vertex_darray_push(vertices, v);
@@ -188,7 +188,7 @@ geometry_data geo_create_uvsphere(f32 radius, u32 north_south_lines, u32 east_we
// Bottom point
vertex bot = { .static_3d = { .position = vec3(0, -radius, 0),
- .normal = vec3(0, -radius, 0),
+ .normal = vec3_normalise(vec3(0, -radius, 0)),
.tex_coords = vec2(0, 0) } };
vertex_darray_push(vertices, bot);
@@ -235,8 +235,7 @@ geometry_data geo_create_uvsphere(f32 radius, u32 north_south_lines, u32 east_we
}
for (int i = 0; i < vertices->len; i++) {
-
- print_vec3(vertices->data[i].static_3d.normal);
+ // print_vec3(vertices->data[i].static_3d.normal);
}
geometry_data geo = {