Skip to content

Commit 408beaf

Browse files
committed
Fix && || logical operators in if statements
1 parent e90b8aa commit 408beaf

2 files changed

Lines changed: 3 additions & 21 deletions

File tree

src/backend/functionNode_webgl.js

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,6 @@ var functionNode_webgl = (function() {
281281
return retArr;
282282
}
283283

284-
var epsilon = 0.00001;
285-
286284
/// Prases the abstract syntax tree, binary expression
287285
///
288286
/// @param ast the AST object to parse
@@ -297,12 +295,6 @@ var functionNode_webgl = (function() {
297295
retArr.push(",");
298296
ast_generic(ast.right, retArr, funcParam);
299297
retArr.push(")");
300-
} else if (ast.operator == "==" || ast.operator == "===") {
301-
retArr.push("abs((");
302-
ast_generic(ast.left, retArr, funcParam);
303-
retArr.push(") - (");
304-
ast_generic(ast.right, retArr, funcParam);
305-
retArr.push(")) < " + epsilon);
306298
} else {
307299
ast_generic(ast.left, retArr, funcParam);
308300
retArr.push(ast.operator);
@@ -523,17 +515,9 @@ var functionNode_webgl = (function() {
523515
}
524516

525517
function ast_LogicalExpression(logNode, retArr, funcParam) {
526-
if (logNode.operator == "==" || logNode.operator == "===") {
527-
retArr.push("abs((");
528-
ast_generic(logNode.left, retArr, funcParam);
529-
retArr.push(") - (");
530-
ast_generic(logNode.right, retArr, funcParam);
531-
retArr.push(")) < " + epsilon);
532-
} else {
533-
ast_generic(logNode.left, retArr, funcParam);
534-
ast_generic(logNode.operator, retArr, funcParam);
535-
ast_generic(logNode.right, retArr, funcParam);
536-
}
518+
ast_generic(logNode.left, retArr, funcParam);
519+
retArr.push(logNode.operator);
520+
ast_generic(logNode.right, retArr, funcParam);
537521
return retArr;
538522
}
539523

src/backend/mode_gpu.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,6 @@
280280
'highp float decode32(highp vec4 rgba) {',
281281
(endianness == 'LE' ? '' : ' rgba.rgba = rgba.abgr;'),
282282
' rgba *= 255.0;',
283-
' rgba = floor(rgba+0.5);',
284283
' highp float sign = rgba.a > 127.0 ? -1.0 : 1.0;',
285284
' highp float exponent = 2.0 * integerMod(rgba.a, 128.0) + (rgba.b > 127.0 ? 1.0 : 0.0);',
286285
' highp float res;',
@@ -467,7 +466,6 @@
467466

468467
var argBuffer = new Uint8Array((new Float32Array(paramArray)).buffer);
469468
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, paramSize[0], paramSize[1], 0, gl.RGBA, gl.UNSIGNED_BYTE, argBuffer);
470-
471469
textures[textureCount] = texture;
472470

473471
var paramLoc = gl.getUniformLocation(program, "user_" + paramNames[textureCount]);

0 commit comments

Comments
 (0)