rasterizer

c++ software renderer

clip.hpp

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