Added Python script for file concatenation with keeping track of file start offsets.
This single file way is a bit slower, but should be easier on server / workers (before every part spawned own worker, now all parts for a single model are handled by a single worker).
CTM pipeline produces very small and efficient models, just it's quite involved.
Models with multiple materials need to be split into separate files. For this there "split_obj.py" helper script.
Also, as CTM format uses indexed shared vertices, with more complex UV unwrapping mesh may need to get preprocessed to create extra vertices for faces which have different UVs for the same vertices (MeshLab can do this).
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)
OpenCTM mesh format looks quite promising, smaller than UTF8 and more robust, just geometry creation time is slower (decompression is done in JavaScript as opposed to piggybacking on built-in http gzip).
UV mapping of extruded geometry was miscalculated.
- ExtrudeGeometry was documented to take a Three.Material for the
"material" and "extrudeMaterial" parameters, but the examples and
usage in TextGeometry showed that these were in fact indices into
the materials array. This meant that the tests such as "if (material)"
would evaluate to false if the index passed in was 0 (a very typical
index to choose :). Simply have the tests check against undefined and
update the documentation.
- Also, the code that converted a shape into a set of triangles was
miscalculating the UV offsets. It was correctly dividing the UV by
the bounding box of the old shape, but was forgetting to offset the
value from the minimum (which potentially led to negative UVs).
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.
Also some refactoring in plugins.
Still not really satisfied with a solution, will need to handle somehow ordering of plugins (both among them and with respect to rest of rendering, this would be needed for example to be able to redo shadow maps as a plugin).
Dynamic terrain example now creates a specular texture from the color texture. That saves 2.17 MB download.
Just I had to drop materials pre-initialization, for some reason this doesn't play nice with having extra scene / render target :S.
In theory also detail normal texture could be computed from the color texture, just we need some nicer normal map filter (Gimp plugin has 9 different ones).
It was quite a pain - ArrayBuffers / Typed Arrays are fussy about byte alignment - but seems to be worth it.
Parsing times are down (modest gains for small objects / Firefox, bigger gains for large objects / Chrome, performance gains from 10% - 200%).
Also as a positive side effect, changing interleaved face arrays into uniform arrays seems to have helped a bit with gzip compression (about 6% smaller size for gzipped 526K Lucy).
Fixed Blender importer to work with Blender 2.60, add option for importing workers or non-worker models.
Fixed more examples to use worker-less format. All examples should work now.
Only Max exporter should be left to change.