91 float len = glm::length(
plane.normal);
95 out.normal =
Vec3(0.0f, 0.0f, 0.0f);
105 out.offset = glm::dot(
n, eye) +
plane.offset;
135 const Color &
c0,
const Color &
c1,
const Color &
c2,
137 const ClipPlane &
plane,
Low-level math utilities for the rendering pipeline.
glm::vec2 Vec2
2-component floating-point vector (xy).
glm::mat4 Mat4
4×4 floating-point matrix.
glm::vec3 Vec3
3-component floating-point vector (xyz).
Vec3 transform_direction(const Mat4 &m, const Vec3 &d)
Transform a direction vector by a 4×4 matrix (with implicit w=0).
int clip_triangle_view_plane(const Vec3 &v0, const Vec3 &v1, const Vec3 &v2, const Vec3 &n0, const Vec3 &n1, const Vec3 &n2, const Color &c0, const Color &c1, const Color &c2, const Vec2 &uv0, const Vec2 &uv1, const Vec2 &uv2, const ClipPlane &plane, std::vector< ClipVertex > &output_vertices, std::vector< Triangle > &output_triangles)
Clip a triangle against an arbitrary plane in view space.
ClipPlane clip_plane_to_view_space(const ClipPlane &plane, const Vec3 &eye, const Mat4 &view)
Convert a ClipPlane to view (eye) space, ready for clipping.
@ WORLD
World (scene) space: the plane is fixed in the scene, so it does not move when the camera moves.
int clip_triangle_near_plane(const ClipVertex &v0, const ClipVertex &v1, const ClipVertex &v2, std::vector< ClipVertex > &output_vertices, std::vector< Triangle > &output_triangles)
Clip a triangle against the near clipping plane in clip space.
glm::vec4 Vec4
4-component floating-point vector (xyzw).
A clipping plane that can hide parts of the scene.
PlaneSpace space
The space ClipPlane::normal and ClipPlane::offset refer to.
A processed vertex in clip space, ready for perspective divide.
Vec2 uv
Texture coordinates.
Vec3 normal
Vertex normal (in view space).
Vec4 position
Homogeneous clip-space position (before divide by w).
An RGBA color with floating-point components.
int x
Left edge of the bitmap, in image pixels.
Fundamental types used throughout the scimesh rendering engine.