The classic color gradient triangle.
$ php examples/01_triangle/triangle.php
This example exists to showcase the interpolation of the barycentric coordinates inside of a drawn triangle.
public function vertex(Vertex $vertex, array &$out) : Vec4
{
$out['color'] = $vertex->color; // set the color attribute
return Vec4::fromVec3($vertex->position); // return vertex positon
}
public function fragment(array &$in, array &$out)
{
$out['color'] = $in['color']->toColorInt();
}