rasterizeTriangle(args)
Rasterize the triangle defined by vertices (row0, col0), (row1, col1), and (row2, col2), using barycentric coordinates. The user provided software rendered (fragment) shader is a function parameterized with the object literal { array: interpolated_data_array, row: i, col: j } and that should return a p5.Color. Refer to the colorizeTriangle() method for an example.
Example
(press any or mouse click)
Syntax
rasterizeTriangle(row0, col0, row1, col1, row2, col2, shader, array0, [array1], [array2])
Parameters
| Param | Description |
|---|---|
row0 |
Number: vertex0 row coordinate |
col0 |
Number: vertex0 col coordinate |
row1 |
Number: vertex1 row coordinate |
col1 |
Number: vertex1 col coordinate |
row2 |
Number: vertex2 row coordinate |
col2 |
Number: vertex2 col coordinate |
shader |
Function: taking { array: interpolated_data_array, row: i, col: j } params and returning a p5.Color |
array0 |
Array: vertex0 attributes to be interpolated |
array1 |
Array: vertex1 attributes to be interpolated default is array0 |
array2 |
Array: vertex2 attributes to be interpolated default is array0 |
What this page's examples use
- p5.quadrille
drawQuadrillecreateQuadrilleclearrasterizeTriangle- p5.js
createCanvasbackgroundcolorrandomintnoFillpoppushstrokestrokeWeighttriangle
Names the analysis can prove are called, and the line each one is documented on. Local variables and members of an unknown receiver are left out.