Compare commits
3 Commits
d0b293ec9a
...
c66b4e4870
Author | SHA1 | Date | |
---|---|---|---|
c66b4e4870 | |||
0e6235da9a | |||
e905fed7a5 |
@ -45,9 +45,9 @@ int main(void) {
|
||||
.ambient = 0.3f,
|
||||
.diffuse = 1.5f,
|
||||
.specular = 2.0f,
|
||||
// .ambient = 0.0f,
|
||||
// .ambient = 1.0f,
|
||||
// .diffuse = 0.0f,
|
||||
// .specular = 2.0f,
|
||||
// .specular = 0.0f,
|
||||
.shininess = 1.5f,
|
||||
};
|
||||
obj.material = material;
|
||||
|
@ -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 (int i = 2; i--;) {
|
||||
for (u64 i = 0; 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.f - (u.x + u.y) / u.z, u.y / u.z, u.x / u.z};
|
||||
return (V3f){1.0f - (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) {
|
||||
|
@ -5,6 +5,8 @@
|
||||
#include "typed_list.h"
|
||||
#include <math.h>
|
||||
|
||||
#define V3_ELEM_COUNT 3
|
||||
|
||||
typedef struct i64x2 V2i;
|
||||
struct i64x2 {
|
||||
i64 x;
|
||||
@ -32,7 +34,7 @@ struct f32x2 {
|
||||
typedef struct f32x3 V3f;
|
||||
struct f32x3 {
|
||||
union {
|
||||
f32 elements[3];
|
||||
f32 elements[V3_ELEM_COUNT];
|
||||
struct {
|
||||
union {
|
||||
f32 x;
|
||||
|
Loading…
x
Reference in New Issue
Block a user