You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* A shader hook block that modifies the world-space properties of each vertex in a shader. This hook can be used inside <a href="#/p5/buildColorShader">`buildColorShader()`</a> and similar shader <a href="#/p5.Shader/modify">`modify()`</a> calls to customize vertex positions, normals, texture coordinates, and colors before rendering. Modifications happen between the `.begin()` and `.end()` methods of the hook. "World space" refers to the coordinate system of the 3D scene, before any camera or projection transformations are applied.
@@ -258,7 +268,22 @@ if (typeof p5 !== "undefined") {
258
268
*/
259
269
260
270
/**
261
-
* @property {Object} combineColors
271
+
* @typedef {Object} CombineColorsHook
272
+
* @property {any} baseColor
273
+
* @property {any} diffuse
274
+
* @property {any} ambientColor
275
+
* @property {any} ambient
276
+
* @property {any} specularColor
277
+
* @property {any} specular
278
+
* @property {any} emissive
279
+
* @property {any} opacity
280
+
* @property {function(): undefined} begin
281
+
* @property {function(): undefined} end
282
+
* @property {function(color: any): void} set
283
+
*/
284
+
285
+
/**
286
+
* @property {CombineColorsHook} combineColors
262
287
* @beta
263
288
* @description
264
289
* A shader hook block that modifies how color components are combined in the fragment shader. This hook can be used inside <a href="#/p5/buildMaterialShader">`buildMaterialShader()`</a> and similar shader <a href="#/p5.Shader/modify">`modify()`</a> calls to control the final color output of a material. Modifications happen between the `.begin()` and `.end()` methods of the hook.
@@ -591,7 +616,26 @@ if (typeof p5 !== "undefined") {
591
616
*/
592
617
593
618
/**
594
-
* @property {Object} pixelInputs
619
+
* @typedef {Object} PixelInputsHook
620
+
* @property {any} normal
621
+
* @property {any} texCoord
622
+
* @property {any} ambientLight
623
+
* @property {any} ambientMaterial
624
+
* @property {any} specularMaterial
625
+
* @property {any} emissiveMaterial
626
+
* @property {any} color
627
+
* @property {any} shininess
628
+
* @property {any} metalness
629
+
* @property {any} tangent
630
+
* @property {any} center
631
+
* @property {any} position
632
+
* @property {any} strokeWeight
633
+
* @property {function(): undefined} begin
634
+
* @property {function(): undefined} end
635
+
*/
636
+
637
+
/**
638
+
* @property {PixelInputsHook} pixelInputs
595
639
* @beta
596
640
* @description
597
641
* A shader hook block that modifies the properties of each pixel before the final color is calculated. This hook can be used inside <a href="#/p5/buildMaterialShader">`buildMaterialShader()`</a> and similar shader <a href="#/p5.Shader/modify">`modify()`</a> calls to adjust per-pixel data before lighting is applied. Modifications happen between the `.begin()` and `.end()` methods of the hook.
@@ -679,13 +723,23 @@ if (typeof p5 !== "undefined") {
679
723
*/
680
724
681
725
/**
682
-
* @property finalColor
726
+
* @typedef {Object} FinalColorHook
727
+
* @property {any} color
728
+
* @property {any} texCoord
729
+
* @property {function(): undefined} begin
730
+
* @property {function(): undefined} end
731
+
* @property {function(color: any): void} set
732
+
*/
733
+
734
+
/**
735
+
* @property {FinalColorHook} finalColor
683
736
* @beta
684
737
* @description
685
738
* A shader hook block that modifies the final color of each pixel after all lighting is applied. This hook can be used inside <a href="#/p5/buildMaterialShader">`buildMaterialShader()`</a> and similar shader <a href="#/p5.Shader/modify">`modify()`</a> calls to adjust the color before it appears on the screen. Modifications happen between the `.begin()` and `.end()` methods of the hook.
686
739
*
687
740
* `finalColor` has the following properties:
688
741
* - `color`: a four-component vector representing the pixel color (red, green, blue, alpha).
742
+
* - `texCoord`: a two-component vector representing the texture coordinates (u, v)
689
743
*
690
744
* Call `.set()` on the hook with a vector with four components (red, green, blue, alpha) to update the final color.
691
745
*
@@ -762,8 +816,18 @@ if (typeof p5 !== "undefined") {
762
816
*/
763
817
764
818
/**
765
-
* @property {Object} filterColor
766
-
* @beta
819
+
* @typedef {Object} FilterColorHook
820
+
* @property {any} texCoord
821
+
* @property {any} canvasSize
822
+
* @property {any} texelSize
823
+
* @property {any} canvasContent
824
+
* @property {function(): undefined} begin
825
+
* @property {function(): undefined} end
826
+
* @property {function(color: any): void} set
827
+
*/
828
+
829
+
/**
830
+
* @property {FilterColorHook} filterColor
767
831
* @description
768
832
* A shader hook block that sets the color for each pixel in a filter shader. This hook can be used inside <a href="#/p5/buildFilterShader">`buildFilterShader()`</a> to control the output color for each pixel.
769
833
*
@@ -807,7 +871,17 @@ if (typeof p5 !== "undefined") {
807
871
*/
808
872
809
873
/**
810
-
* @property {Object} objectInputs
874
+
* @typedef {Object} ObjectInputsHook
875
+
* @property {any} position
876
+
* @property {any} normal
877
+
* @property {any} texCoord
878
+
* @property {any} color
879
+
* @property {function(): undefined} begin
880
+
* @property {function(): undefined} end
881
+
*/
882
+
883
+
/**
884
+
* @property {ObjectInputsHook} objectInputs
811
885
* @beta
812
886
* @description
813
887
* A shader hook block to modify the properties of each vertex before any transformations are applied. This hook can be used inside <a href="#/p5/buildMaterialShader">`buildMaterialShader()`</a> and similar shader <a href="#/p5.Shader/modify">`modify()`</a> calls to customize vertex positions, normals, texture coordinates, and colors before rendering. Modifications happen between the `.begin()` and `.end()` methods of the hook. "Object space" refers to the coordinate system of the 3D scene before any transformations, cameras, or projection transformations are applied.
@@ -849,7 +923,17 @@ if (typeof p5 !== "undefined") {
849
923
*/
850
924
851
925
/**
852
-
* @property {Object} cameraInputs
926
+
* @typedef {Object} CameraInputsHook
927
+
* @property {any} position
928
+
* @property {any} normal
929
+
* @property {any} texCoord
930
+
* @property {any} color
931
+
* @property {function(): undefined} begin
932
+
* @property {function(): undefined} end
933
+
*/
934
+
935
+
/**
936
+
* @property {CameraInputsHook} cameraInputs
853
937
* @beta
854
938
* @description
855
939
* A shader hook block that adjusts vertex properties from the perspective of the camera. This hook can be used inside <a href="#/p5/buildMaterialShader">`buildMaterialShader()`</a> and similar shader <a href="#/p5.Shader/modify">`modify()`</a> calls to customize vertex positions, normals, texture coordinates, and colors before rendering. "Camera space" refers to the coordinate system of the 3D scene after transformations have been applied, seen relative to the camera.
0 commit comments