diff --git a/src/shaderview.ts b/src/shaderview.ts index 7892242..d5523ed 100644 --- a/src/shaderview.ts +++ b/src/shaderview.ts @@ -40,6 +40,13 @@ export class ShaderView { this.finalShader = this.preprocessShaderCode(shaderString); + const all_uniforms = this.listUniforms(); + for (const uniform_name of Object.keys(all_uniforms)) { + if (!this.uniforms[uniform_name]) { + this.uniforms[uniform_name] = all_uniforms[uniform_name]; + } + } + if (!options?.noRender) { this.render = new ShaderViewRender(this.finalShader, this.uniforms); } @@ -96,7 +103,7 @@ export class ShaderView { } setUniform(name: string, value: any): void { - this.uniforms[name]; + this.uniforms[name].value = value; } setParent(parent: HTMLElement): void { diff --git a/web/index.html b/web/index.html index e655f40..ab5ca26 100644 --- a/web/index.html +++ b/web/index.html @@ -3,24 +3,32 @@ +