diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/jsifier.js | 6 | ||||
-rw-r--r-- | src/library_gl.js | 7 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index 8e688d8d..904517e1 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -375,11 +375,15 @@ function JSify(data, functionsOnly, givenFunctions) { processItem: function(item) { function addFromLibrary(ident) { if (ident in addedLibraryItems) return ''; + addedLibraryItems[ident] = true; + + // dependencies can be JS functions, which we just run + if (typeof ident == 'function') return ident(); + // Don't replace implemented functions with library ones (which can happen when we add dependencies). // Note: We don't return the dependencies here. Be careful not to end up where this matters if (('_' + ident) in Functions.implementedFunctions) return ''; - addedLibraryItems[ident] = true; var snippet = LibraryManager.library[ident]; var redirectedIdent = null; var deps = LibraryManager.library[ident + '__deps'] || []; diff --git a/src/library_gl.js b/src/library_gl.js index dbde945c..3c33ec2c 100644 --- a/src/library_gl.js +++ b/src/library_gl.js @@ -14,6 +14,8 @@ var LibraryGL = { uniforms: {}, shaders: {}, + matrix: {}, + // Linear lookup in one of the tables (buffers, programs, etc.). TODO: consider using a weakmap to make this faster, if it matters scan: function(table, object) { for (var item in table) { @@ -834,6 +836,11 @@ var LibraryGL = { } return Runtime.addFunction(func); } + }, + + glBegin__deps: ['$GL', function() { return 'GL.matrix.lib = ' + read('gl-matrix.js') }], + glBegin: function() { + Module.print('TODO'); } }; |