Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
name = name.replace(/\s+/g, '-');
if (nameCache[name])
{
nameCache[name]++;
name += `-${nameCache[name]}`;
}
else
{
nameCache[name] = 1;
}
this.vertexSrc = `#define SHADER_NAME ${name}\n${this.vertexSrc}`;
this.fragmentSrc = `#define SHADER_NAME ${name}\n${this.fragmentSrc}`;
this.vertexSrc = setPrecision(this.vertexSrc, settings.PRECISION_VERTEX, PRECISION.HIGH);
this.fragmentSrc = setPrecision(this.fragmentSrc, settings.PRECISION_FRAGMENT, getMaxFragmentPrecision());
}
// currently this does not extract structs only default types
this.extractData(this.vertexSrc, this.fragmentSrc);
// this is where we store shader references..
this.glPrograms = {};
this.syncUniforms = null;
}