此 API 是实验性的
其行为可能在 p5.js 的未来版本中发生变化。
A shader hook block that modifies the final color of each pixel after all lighting is applied. This hook can be used inside buildMaterialShader() and similar shader modify() calls to adjust the color before it appears on the screen. Modifications happen between the .begin() and .end() methods of the hook.
finalColor has the following properties:
color: a four-component vector representing the pixel color (red, green, blue, alpha).texCoord: a two-component vector representing the texture coordinates (u, v)
Call .set() on the hook with a vector with four components (red, green, blue, alpha) to update the final color.
This hook is available in:
示例
Notice any errors or typos? Please let us know. Please feel free to edit src/strands/p5.strands.js and open a pull request!