Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/webgl/material.js
Original file line number Diff line number Diff line change
Expand Up @@ -1567,8 +1567,8 @@ function material(p5, fn) {
* @param {Object} hooks An object specifying p5.strands hooks in GLSL.
* @returns {p5.Shader} The material shader.
*/
fn.buildMaterialShader = function (cb) {
return this.baseMaterialShader().modify(cb);
fn.buildMaterialShader = function (cb, context) {
return this.baseMaterialShader().modify(cb, context);
};

/**
Expand Down Expand Up @@ -1631,7 +1631,7 @@ function material(p5, fn) {
fn.loadMaterialShader = async function (url, onSuccess, onFail) {
try {
const cb = await urlToStrandsCallback(url);
let shader = withGlobalStrands(this, () => this.buildMaterialShader(cb));
let shader = withGlobalStrands(this, () => this.buildMaterialShader(cb, context));
if (onSuccess) {
shader = onSuccess(shader) || shader;
}
Expand Down Expand Up @@ -1783,8 +1783,8 @@ function material(p5, fn) {
* @param {Object} hooks An object specifying p5.strands hooks in GLSL.
* @returns {p5.Shader} The normal shader.
*/
fn.buildNormalShader = function (cb) {
return this.baseNormalShader().modify(cb);
fn.buildNormalShader = function (cb, context) {
return this.baseNormalShader().modify(cb, context);
};

/**
Expand Down Expand Up @@ -1849,7 +1849,7 @@ function material(p5, fn) {
try {
const cb = await urlToStrandsCallback(url);
let shader = this.withGlobalStrands(this, () =>
this.buildNormalShader(cb),
this.buildNormalShader(cb, this),
);
if (onSuccess) {
shader = onSuccess(shader) || shader;
Expand Down Expand Up @@ -1947,8 +1947,8 @@ function material(p5, fn) {
* @param {Object} hooks An object specifying p5.strands hooks in GLSL.
* @returns {p5.Shader} The color shader.
*/
fn.buildColorShader = function (cb) {
return this.baseColorShader().modify(cb);
fn.buildColorShader = function (cb, context) {
return this.baseColorShader().modify(cb, context);
};

/**
Expand Down Expand Up @@ -2012,7 +2012,7 @@ function material(p5, fn) {
fn.loadColorShader = async function (url, onSuccess, onFail) {
try {
const cb = await urlToStrandsCallback(url);
let shader = withGlobalStrands(this, () => this.buildColorShader(cb));
let shader = withGlobalStrands(this, () => this.buildColorShader(cb, this));
if (onSuccess) {
shader = onSuccess(shader) || shader;
}
Expand Down Expand Up @@ -2202,8 +2202,8 @@ function material(p5, fn) {
* @param {Object} hooks An object specifying p5.strands hooks in GLSL.
* @returns {p5.Shader} The stroke shader.
*/
fn.buildStrokeShader = function (cb) {
return this.baseStrokeShader().modify(cb);
fn.buildStrokeShader = function (cb, context) {
return this.baseStrokeShader().modify(cb, context);
};

/**
Expand Down Expand Up @@ -2271,7 +2271,7 @@ function material(p5, fn) {
fn.loadStrokeShader = async function (url, onSuccess, onFail) {
try {
const cb = await urlToStrandsCallback(url);
let shader = withGlobalStrands(this, () => this.buildStrokeShader(cb));
let shader = withGlobalStrands(this, () => this.buildStrokeShader(cb, this));
if (onSuccess) {
shader = onSuccess(shader) || shader;
}
Expand Down