Parameters
| Name | Description | Default |
|---|---|---|
ctx | Canvas 2D context used for drawing. | — |
material | Material supplying the RGB color. | — |
mesh | Mesh supplying the | — |
Function
renderBasicMaterial(ctx: CanvasRenderingContext2D, material: BasicMaterial, mesh: Mesh): voidRenders a BasicMaterial as a filled path on a Canvas 2D context.
This function is the default Canvas2DFunction callback used for
BasicMaterial. It reads the mesh’s position2d attribute. If that
attribute has no data, it returns without changing the context. Otherwise,
it sets ctx.fillStyle to an rgb(...) value whose channels are the
material color channels multiplied by 255, passes the positions to
vertices with path closing enabled, and calls ctx.fill().
The material alpha channel is not applied. The callback leaves
ctx.globalAlpha unchanged because the corresponding assignment remains
disabled in the implementation.