Skip to content

Commit 5a3bb50

Browse files
committed
Added silent failure, for calling pre-existing math function
1 parent 21377d9 commit 5a3bb50

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

src/backend/functionBuilder.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ var functionBuilder = (function() {
9797
function webglString_fromFunctionNames(functionList) {
9898
var ret = [];
9999
for(var i=0; i<functionList.length; ++i) {
100-
ret.push( this.nodeMap[functionList[i]].getWebglFunctionString() );
100+
var node = this.nodeMap[functionList[i]];
101+
if(node) {
102+
ret.push( this.nodeMap[functionList[i]].getWebglFunctionString() );
103+
}
101104
}
102105
return ret.join("\n");
103106
}
@@ -120,5 +123,24 @@ var functionBuilder = (function() {
120123
}
121124
functionBuilder.prototype.webglString = webglString;
122125

126+
//---------------------------------------------------------
127+
//
128+
// Polyfill stuff
129+
//
130+
//---------------------------------------------------------
131+
132+
// Round function used in polyfill
133+
function round(a) { return Math.floor( a + 0.5 ); }
134+
135+
///
136+
/// Function: polyfillStandardFunctions
137+
///
138+
/// Polyfill in the missing Math funcitons (round)
139+
///
140+
function polyfillStandardFunctions() {
141+
this.addFunction(null, round);
142+
}
143+
functionBuilder.prototype.polyfillStandardFunctions = polyfillStandardFunctions;
144+
123145
return functionBuilder;
124146
})();

0 commit comments

Comments
 (0)