###pex-gl
-
all gl related obj wrappers
-
class namespace vs method namepspace
var gl = require('pex-gl'); var Mesh = gl.Mesh;
var Program = gl.Program;
//Parses .obj file, returns .json | |
var colors = require('colors'), | |
argv = require('minimist')(process.argv.slice(2),{string:['o','m','p']}), | |
fs = require('fs'), | |
path = require('path'); | |
function logUsageAndExit(){ | |
console.log(('Usage: [pathToObjFile] -o [pathToOutJson] [-m] [-p]').yellow); |
v0.11.14 |
###pex-gl
all gl related obj wrappers
class namespace vs method namepspace
var gl = require('pex-gl');
var Mesh = gl.Mesh;
var Program = gl.Program;
#General
###Private/Public/Explicitness
###Documentation
A quick test to see if filling group of shapes is more performant than filling each shape separately. FillStyle is wrapped to imitate the processing api, in 'normal' mode 'fill' just sets the current fillStyle, ellipse() constructs a new path via 'beginPath' and immediately closes it by applying the fillStyle with 'fill'. In 'flush' mode 'fill' already begins to construct a new path via 'beginPath' right after setting the fillStyle. All subsequent calls to ellipse only append new path segments to the same path. The current path gets closed by calling 'fill' again or automatically right after draw().
Draw-calls are stacked and processed at the end of the draw loop. The shape to be drawn is rendered on an off-screen canvas, if the required shape is larger than the buffered one, the off-screen version gets updated otherwise a scaled down version will be drawn on the target canvas. Colored versions of the off-screen shape are stored into a lookup-table and updated if the base shape changes.
Obviously this works best if the color palette is limited.
A quick test to check if merging immediate mode draw method calls on the fly and batch executing them at the end of each draw loop (to reduce the number of fill / beginPath / endPath calls to a minimum ) does yield to performance benefits.
Unfortunately processing the stack is really slow.
function App(){ | |
this._queue = []; | |
this._queueProcessing = false; | |
this._worker = new Worker('worker.js'); | |
var self = this; | |
this._worker.addEventListener('message', function(e){ | |
var returnObj; | |
var dataObj = e.data; |