MCPcopy Index your code
hub / github.com/PavelDoGreat/WebGL-Fluid-Simulation / setKeywords

Method setKeywords

script.js:360–377  ·  view source on GitHub ↗
(keywords)

Source from the content-addressed store, hash-verified

358 }
359
360 setKeywords (keywords) {
361 let hash = 0;
362 for (let i = 0; i < keywords.length; i++)
363 hash += hashCode(keywords[i]);
364
365 let program = this.programs[hash];
366 if (program == null)
367 {
368 let fragmentShader = compileShader(gl.FRAGMENT_SHADER, this.fragmentShaderSource, keywords);
369 program = createProgram(this.vertexShader, fragmentShader);
370 this.programs[hash] = program;
371 }
372
373 if (program == this.activeProgram) return;
374
375 this.uniforms = getUniforms(program);
376 this.activeProgram = program;
377 }
378
379 bind () {
380 gl.useProgram(this.activeProgram);

Callers 1

updateKeywordsFunction · 0.80

Calls 4

hashCodeFunction · 0.85
compileShaderFunction · 0.85
createProgramFunction · 0.85
getUniformsFunction · 0.85

Tested by

no test coverage detected