Added silent failure, for calling pre-existing math function

This commit is contained in:
Eugene Cheah 2016-02-15 06:02:18 +08:00
parent 21377d9485
commit 5a3bb50057

View File

@ -97,7 +97,10 @@ var functionBuilder = (function() {
function webglString_fromFunctionNames(functionList) {
var ret = [];
for(var i=0; i<functionList.length; ++i) {
ret.push( this.nodeMap[functionList[i]].getWebglFunctionString() );
var node = this.nodeMap[functionList[i]];
if(node) {
ret.push( this.nodeMap[functionList[i]].getWebglFunctionString() );
}
}
return ret.join("\n");
}
@ -120,5 +123,24 @@ var functionBuilder = (function() {
}
functionBuilder.prototype.webglString = webglString;
//---------------------------------------------------------
//
// Polyfill stuff
//
//---------------------------------------------------------
// Round function used in polyfill
function round(a) { return Math.floor( a + 0.5 ); }
///
/// Function: polyfillStandardFunctions
///
/// Polyfill in the missing Math funcitons (round)
///
function polyfillStandardFunctions() {
this.addFunction(null, round);
}
functionBuilder.prototype.polyfillStandardFunctions = polyfillStandardFunctions;
return functionBuilder;
})();