3d-renderer/scripts/triangle.h
2025-07-16 23:53:19 -07:00

40 lines
671 B
C

#ifndef TRIANGLE_H
#define TRIANGLE_H
#include <stdint.h>
#include "texture.h"
#include "swap.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(int x0, int y0, int x1, int y1, int x2, int y2, color_t color);
void draw_textured_triangle(int x0, int y0, int x1, int y1, int x2, int y2, uint32_t* texture);
#endif