Work in progress. For the moment works just with CTMLoader. Still not sure where some pieces of code would go.
Upsides:
- initialization time cut down significantly (1.8 seconds => 0.7 seconds for CTM example)
- much smaller GL buffers thanks to fully used indexing (Walt has 6x less vertices)
- consequently much smaller memory footprint all around, both for main and GPU memories,
which means less swapping and better vertex caching
Downsides:
- can't have anymore sharp per-face effects like flat shading (at least if mesh is not constructed in a way where each face has own vertices)
- can't have multiple materials per mesh
- no more easy manipulation of anything (for the moment actually no runtime manipulation at all, typed arrays are just thrown away, dynamic geometries code path not yet implemented)
Doing normalization of normals / binormals / tangents in fragment shader instead of vertex shader. This seems to help with artefacts appearing in certain models with OpenGL rendering backend.
Also added modulating environment reflection by specular map.
Turns out it may be useful after all, seems some GPUs may have troubles dealing with texture coordinates outside of <0,1> (need to be tested if normalization helps there).
This should allow attaching of lights to objects. As a side effect, directional lights positions don't need to be normalized explicitly anymore.
Also changed viewport dimensions passed to render plugins to work with render targets with different dimensions than the screen framebuffer.
And fixed new dependencies in build script.
Hope so. There is now just a single scene graph update per frame render (plus some extra one-shot updates if light cameras are auto-added to scene graph).
Actually, this would break cameras added as childs of objects, reverting.
So there is no clear and simple way to handling multiple scenes unfortunatelly.
Encouraging `scene.add( camera )` seems like the right thing to do then, less problems.
Actually, I think this can be handled magically instead of requiring understanding of the concept that the camera is part of the scenegraph.
While I was at it, I fixed it so you can use a camera for rendering different scenes (the renderer will add it and remove from each scene graph) .
Removed LOD text example. I think LOD example is good enough.
Ubiquity test working again.
Tweaked README to show the new pattern (Scene first thing created).
I had to resurrect parts of old code (keeping track of scene graph changes).
Good news: performance is great, new scene graph gains compound with buffers optimizations and non-array materials refactoring. Together we gained about 15% for rotating cubes performance test (pushing max to 2650 cubes at 60 fps).
Still broken with new scene graph: lod, skinning, collisions, AnaglyphWebGLRenderer, ParallaxBarrierWebGLRenderer, multi-canvas circle example.