Support Forum G3D Web Page |
SIMD optimized code to clip a triangle or quadrilateral against a plane in GLSL.
More...
Public Member Functions | |
int | clip3 (const in vec3 n, in out vec3 v0, in out vec3 v1, in out vec3 v2, out vec3 v3) |
Computes the intersection of triangle v0-v1-v2 with the half-space (x,y,z) * n > 0. More... | |
int | clip4 (const in vec3 n, in out vec3 v0, in out vec3 v1, in out vec3 v2, in out vec3 v3, out vec3 v4) |
Computes the intersection of quadrilateral v0-v1-v2-v3 with the half-space (x,y,z)*n > 0. More... | |
Public Attributes | |
const float | clipEpsilon = 0.00001 |
const float | clipEpsilon2 = 0.01 |
SIMD optimized code to clip a triangle or quadrilateral against a plane in GLSL.
Design goals are to:
|
inline |
Computes the intersection of triangle v0-v1-v2 with the half-space (x,y,z) * n > 0.
The result is a convex polygon in v0-v1-v2-v3. Vertex v3 may be degenerate and equal to the first vertex.
|
inline |
Computes the intersection of quadrilateral v0-v1-v2-v3 with the half-space (x,y,z)*n > 0.
If there is no intersection, returns 0. If there is an intersection, returns the number of unique vertices, k. Vertex [(k+1) % 5] is always equal to v0.
const float glsl::clip_glsl::clipEpsilon = 0.00001 |
const float glsl::clip_glsl::clipEpsilon2 = 0.01 |