rasterizer

C++ software renderer

clip.h

554 B
 1#include <vector>
 2
 3#include "globals.h"
 4#include "util_math.h"
 5
 6using std::vector;
 7
 8struct ClipVertex {
 9    vec4f pos;
10    vec3f color;
11    vec3f normal;
12    vec2f uv;
13    float inv_w;
14};
15
16// canonical view volume
17float plane_x_min(const vec4f &v);
18float plane_x_max(const vec4f &v);
19float plane_y_min(const vec4f &v);
20float plane_y_max(const vec4f &v);
21float plane_z_min(const vec4f &v);
22float plane_z_max(const vec4f &v);
23
24vector<ClipVertex> clip_polygon_with_attrs(
25    vec4f *clip_positions, vec2f *input_uv, vec3f input_color, vec3f input_normal
26);