Fix barycentric coordinates calculation (#2)

Reviewed-on: #2

	* Set up for debugging
	* Replace get_barycentric_coords with different calculation
	* Update commented lines
	* Add V3_ELEM_COUNT macro
	* Change loop in barycentric coordinates calculation function
	* Update debug values
	* Simplify barycentric coordinates function
	* Remove debug lines
Co-authored-by: Abdelrahman <said.abdelrahman89@gmail.com>
Co-committed-by: Abdelrahman <said.abdelrahman89@gmail.com>
This commit is contained in:
2024-08-26 17:12:44 +00:00
committed by Abdelrahman Said
parent 57dcf6457c
commit 319bad9659
4 changed files with 32 additions and 38 deletions

View File

@@ -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,16 +34,21 @@ struct f32x2 {
typedef struct f32x3 V3f;
struct f32x3 {
union {
f32 x;
f32 r;
};
union {
f32 y;
f32 g;
};
union {
f32 z;
f32 b;
f32 elements[V3_ELEM_COUNT];
struct {
union {
f32 x;
f32 r;
};
union {
f32 y;
f32 g;
};
union {
f32 z;
f32 b;
};
};
};
};