pub struct SpanGouraud<C: Clone> { /* private fields */ }Expand description
Gouraud shading base class.
Stores a triangle with per-vertex colors. Implements VertexSource
to feed the (possibly dilated) triangle outline to the rasterizer.
Dilation produces a 6-vertex beveled polygon for numerical stability,
while the color interpolation coordinates use miter joins calculated
via calc_intersection.
Port of C++ span_gouraud<ColorT>.
Implementations§
Source§impl<C: Clone + Default> SpanGouraud<C>
impl<C: Clone + Default> SpanGouraud<C>
pub fn new() -> Self
Sourcepub fn new_with_triangle(
c1: C,
c2: C,
c3: C,
x1: f64,
y1: f64,
x2: f64,
y2: f64,
x3: f64,
y3: f64,
d: f64,
) -> Self
pub fn new_with_triangle( c1: C, c2: C, c3: C, x1: f64, y1: f64, x2: f64, y2: f64, x3: f64, y3: f64, d: f64, ) -> Self
Construct with colors and triangle geometry.
Sourcepub fn triangle(
&mut self,
x1: f64,
y1: f64,
x2: f64,
y2: f64,
x3: f64,
y3: f64,
d: f64,
)
pub fn triangle( &mut self, x1: f64, y1: f64, x2: f64, y2: f64, x3: f64, y3: f64, d: f64, )
Set the triangle geometry and optionally dilate it.
When d != 0, the triangle is dilated to form a 6-vertex beveled
polygon for numerical stability. The color interpolation coordinates
are recalculated using miter-join intersections.
Sourcepub fn arrange_vertices(&self) -> [CoordType<C>; 3]
pub fn arrange_vertices(&self) -> [CoordType<C>; 3]
Sort vertices by Y coordinate (top to bottom).
Returns an array of three CoordType sorted so that
result[0].y <= result[1].y <= result[2].y.