Compare commits

..

No commits in common. "c66b4e487049396002f3e5bb00aec55fe2e14443" and "d0b293ec9ad7ceb3bcfd48cb61b024f4ea1b4abc" have entirely different histories.

3 changed files with 5 additions and 7 deletions

View File

@ -45,9 +45,9 @@ int main(void) {
.ambient = 0.3f,
.diffuse = 1.5f,
.specular = 2.0f,
// .ambient = 1.0f,
// .ambient = 0.0f,
// .diffuse = 0.0f,
// .specular = 0.0f,
// .specular = 2.0f,
.shininess = 1.5f,
};
obj.material = material;

View File

@ -195,7 +195,7 @@ internal TriangleBBox get_triangle_bbox(const Image *img,
internal V3f get_barycentric_coords(V3f a, V3f b, V3f c, V3f p) {
V3f s[2];
for (u64 i = 0; i < 2; ++i) {
for (int i = 2; i--;) {
s[i].x = c.elements[i] - a.elements[i];
s[i].y = b.elements[i] - a.elements[i];
s[i].z = a.elements[i] - p.elements[i];
@ -206,7 +206,7 @@ internal V3f get_barycentric_coords(V3f a, V3f b, V3f c, V3f p) {
return (V3f){-1.0f, 1.0f, 1.0f};
}
return (V3f){1.0f - (u.x + u.y) / u.z, u.y / u.z, u.x / u.z};
return (V3f){1.f - (u.x + u.y) / u.z, u.y / u.z, u.x / u.z};
}
internal V3f get_viewport_vertex(const V3f *vertex, const Image *img) {

View File

@ -5,8 +5,6 @@
#include "typed_list.h"
#include <math.h>
#define V3_ELEM_COUNT 3
typedef struct i64x2 V2i;
struct i64x2 {
i64 x;
@ -34,7 +32,7 @@ struct f32x2 {
typedef struct f32x3 V3f;
struct f32x3 {
union {
f32 elements[V3_ELEM_COUNT];
f32 elements[3];
struct {
union {
f32 x;