Skip to content

Commit f4872c4

Browse files
committed
Fix getPixelInputs description and getFinalColor example
1 parent 6e1311d commit f4872c4

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/webgl/ShaderGenerator.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,9 +1821,23 @@ if (typeof p5 !== 'undefined') {
18211821
/**
18221822
* @method getPixelInputs
18231823
* @description
1824-
* Registers a callback to modify the properties of each fragment (pixel) before the final color is calculated in the fragment shader. This hook can be used inside <a href="#/p5/baseMaterialShader">baseMaterialShader()</a>.modify() and similar shader modify calls to change opacity or other per-pixel properties. The callback receives an object with the following properties:
1825-
* - `opacity`: a number between 0 and 1 for the pixel's transparency
1826-
* - (Other properties may be available depending on the shader.)
1824+
* Registers a callback to modify per-fragment inputs before the final color is computed in the fragment shader. The available properties differ by shader:
1825+
* - For baseMaterialShader():
1826+
* - `normal` (vec3): surface normal
1827+
* - `texCoord` (vec2): texture coordinates
1828+
* - `ambientLight` (vec3): ambient light color
1829+
* - `ambientMaterial` (vec3): ambient material color
1830+
* - `specularMaterial` (vec3): specular material color
1831+
* - `emissiveMaterial` (vec3): emissive material color
1832+
* - `color` (vec4): base color (unpremultiplied)
1833+
* - `shininess` (float)
1834+
* - `metalness` (float)
1835+
* - For baseStrokeShader():
1836+
* - `color` (vec4): base color
1837+
* - `tangent` (vec2): tangent direction
1838+
* - `center` (vec2): stroke center for the current fragment
1839+
* - `position` (vec2): fragment position in stroke space
1840+
* - `strokeWeight` (float)
18271841
*
18281842
* Return the modified object to update the fragment.
18291843
*
@@ -1933,7 +1947,7 @@ if (typeof p5 !== 'undefined') {
19331947
* background(230);
19341948
* shader(myShader);
19351949
* noStroke();
1936-
* fill('green');
1950+
* fill('blue');
19371951
* circle(0, 0, 100);
19381952
* }
19391953
* </code>

0 commit comments

Comments
 (0)