Skip to content

Commit

Permalink
fix dynamic expr evaluation issues
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Deubler <[email protected]>
  • Loading branch information
TerminalTim committed Jul 12, 2024
1 parent 9c744ee commit bd960bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/common/src/Expressions/Expression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export abstract class Expression implements IExpression {
resolve(context=this.env.context, mode?: ExpressionMode) {
const {env} = this;
env.setMode(mode);
const result = env.evaluateParsed(this, context);
const result = env.evaluate(this, context);
env.setMode(ExpressionMode.static);
return result;
}
Expand Down
7 changes: 3 additions & 4 deletions packages/display/src/displays/webgl/program/Program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,19 @@ class Program {

private createUniformSetter(uInfo: WebGLActiveInfo, location: WebGLUniformLocation) {
const {gl} = this;
const getVal = (u) => typeof u == 'function' ? u() : u;
switch (uInfo.type) {
case gl.FLOAT:
return (v) => gl.uniform1f(location, getVal(v));
return (v) => gl.uniform1f(location, v);
case gl.FLOAT_MAT4:
return (v) => gl.uniformMatrix4fv(location, false, v);
case gl.FLOAT_VEC2:
return (v) => gl.uniform2f(location, getVal(v[0]), getVal(v[1]));
return (v) => gl.uniform2fv(location, v);
case gl.FLOAT_VEC3:
return (v) => gl.uniform3fv(location, v);
case gl.FLOAT_VEC4:
return (v) => gl.uniform4fv(location, v);
case gl.BOOL:
return (v) => gl.uniform1i(location, getVal(v));
return (v) => gl.uniform1i(location, v);
case gl.SAMPLER_2D:
const tu = this.textureUnits++;
return (v) => {
Expand Down

0 comments on commit bd960bf

Please sign in to comment.