Problem was having too many concurrent workers opened at once. Garbage collection apparently works very slowly on workers. Solution was to close them manually, after model data is sent to main thread.
Also some progress with Blender scene exporter. Some scenes now export correctly, though monkey test scene got worse, even with less hacky code.
- Fixed TorusKnot face orientation.
- Added UVs to Cylinder (Cylindrical Mapping)
- Fixed Lathe UVs
There is something wrong with texture mapping, u needs to be inverted all the time. Something to researching on.
It's not possible for the lens flare to update on visibility any more, only its screen position. Potentially, we could add offset+factor for opacity/scale/rotation that is dependent on visibility in shader. Or just custom shaders.
Anyway, it's way faster than readPixels :)
If you want to get edges, run converter like with "-e" flag:
python convert_obj_three.py -i model.obj -o model.js -e
Output seems to match Blender exporter.
There is a new class Edge which stores vertices and faces for edge (I wasn't sure if indices or references would be better, so at least for the moment it contains both).
Geometry now contains a list of such edges, created in JSONLoader, based on edge data exported from Blender.
From Blender we get a list of vertex index pairs, from which in Geometry.computeEdgeFaces() we compute faces which share this particular edge and store them in the Edge object.
Not sure if edges work properly till we don't have something using them. For now I just checked cube data exported from Blender and it seems fine.
Also did some whitespace cleanup here and there.
- OBJ converter now has "-b" option for baking materials' diffuse colors into face colors
(if there are morph colormap OBJs/MTLs, first colormap will be used)
(material will get "vertexColors" property set to "face")
- Blender importer now bakes JSON face colors into Blender vertex colors
- Loader now handles "material.vertexColors" with more options
- nonexistant property or false will set material to THREE.NoColors
- "face" will set material to THREE.FaceColors
- anything else will get THREE.VertexColors
- fixed bug in JSONLoader where face colors were not properly initialized
To be used like this:
python convert_obj_three.py -i model.obj -o model.js -m "morphA_*.obj morphB_*.obj" -c "modelA_colors.obj modelB_colors.obj" -s flat -a none
- for shader reuse materials from the standard library are now identified just by shader name (MeshShaderMaterials still use full code)
- unique shader id strings are constructed via array.join instead of string plus
- uniform and attribute locations are now cached in buildProgram (biggest one)
Also some smaller optimizations and cleanups in DOF example.
In such case faces will not get material index in JSON data and then no material reference in Face objects, so MeshFaceMaterial is not going to show anything and you have to add your own material for the whole mesh after loading.
Tested on few models and it seems to work, new JSON format allows to omit materials :)
Added depthBuffer/stencilBuffer flags to WebGLRenderTarget and support for that in WebGLRenderer. Done to support stencil shadows in renderTarget. For some reason { depthBuffer:false, stencilBuffer:true } doesn't work so this is deafulted to both:false.