3d-renderer/scripts/triangle.h

39 lines
584 B
C

#ifndef TRIANGLE_H
#define TRIANGLE_H
#include <stdint.h>
#include "texture.h"
#include "vector.h"
#include "texture.h"
typedef uint32_t color_t;
typedef struct {
int a;
int b;
int c;
tex2_t a_uv;
tex2_t b_uv;
tex2_t c_uv;
color_t color;
} face_t;
typedef struct {
int x;
int y;
} int_vec2_t;
typedef struct {
vec2_t points[3];
tex2_t texcoords[3];
color_t color;
float average_depth;
} triangle_t;
void draw_filled_triangle(triangle_t triangle);
void draw_textured_triangle(triangle_t triangle, uint32_t* texture);
#endif