MCPcopy
hub / github.com/processing/p5.js / setDefaultUniforms

Method setDefaultUniforms

src/webgl/p5.Shader.js:525–547  ·  view source on GitHub ↗

* @private

()

Source from the content-addressed store, hash-verified

523 * @private
524 */
525 setDefaultUniforms() {
526 for (const key in this.hooks.uniforms) {
527 const name = this._renderer.uniformNameFromHookKey(key);
528 const initializer = this.hooks.uniforms[key];
529 let value;
530 if (initializer instanceof Function) {
531 value = initializer();
532 } else {
533 value = initializer;
534 }
535
536 if (value !== undefined && value !== null) {
537 this.setUniform(name, value);
538 }
539 }
540 for (const name in this.hooks.storageUniforms) {
541 const initializer = this.hooks.storageUniforms[name];
542 const value = initializer instanceof Function ? initializer() : initializer;
543 if (value !== undefined && value !== null) {
544 this.setUniform(name, value);
545 }
546 }
547 }
548
549 /**
550 * Copies the shader from one drawing context to another.

Callers 3

_renderPassMethod · 0.80
materialFunction · 0.80
computeMethod · 0.80

Calls 2

setUniformMethod · 0.95

Tested by

no test coverage detected