loader.loadAscii and loader.loadBinary now take just one parameter with following properties:
- model (required)
- callback (required)
- texture_path (optional: if not specified, textures will be assumed to be in the same folder as JS model file)
- bin_path (optional: if not specified, binary file will be assumed to be in the same folder as JS model file)
Example use:
loader.loadBinary( { model: "model.js", bin_path: "path/bin", texture_path: "path/img",
callback: function( geometry ) { createScene( geometry ) } } );
Code is still rough around edges (it can be made nicer), though it should already produce one-to-one results with ubershader.
Side-effect is that scene is no longer required as WebGLRenderer constructor parameter. Shader programs are now constructed upon first frame render and only then scene lights are examined.
Also changed MeshShaderMaterial demos to show how to use cloning. For these particular demos uniforms cloning is not really necessary as they use only one instance of shader material, but for example, if there were two normal mapped models in one scene, each model would need separate material with own uniforms.
Diffuse map and ambient occlusion maps are now optional in normal map shader.
By default, both are disabled, so they need to be enabled explicitly like this:
uniforms[ "enableAO" ].value = true;
uniforms[ "enableDiffuse" ].value = true;
This allows to work around ANGLE antialiasing issue appearing when compositing WebGL framebuffer with transparent background color with HTML canvas element background (while keeping antialiasing on).
WebGLRenderer constructor now takes JSON object with few optional parameters:
renderer = new THREE.WebGLRenderer { scene: scene,
antialias: true,
clearColor: 0x000000,
clearAlpha: 0 };
Here is how to change clear color in runtime:
renderer.setClearColor( 0xff0000, 1 );
A lot of things going on in this commit:
- added tangents computation for geometries
- mesh must have UV coordinates
- to be called explicitly once geometry is loaded like this: geometry.computeTangents()
- tangents are stored in Vertex objects
- quads are not solved properly (though workaround hack seems to work at least somehow, as far as each vertex appears at least somewhere)
- extended VBOs in WebGLRenderer to include tangent streams (when available)
- added "normal" shader to ShaderUtils (to be used with MeshShaderMaterial)
- Blinn-Phong with one directional and one point light (7 varyings gone, just one spare)
- normal maps are in tangent space
- displacement maps use simple luminance value (could be changed if better precision is needed)
- displacement mapping uses vertex texture fetch
- this requires GPU with Shader Model 3.0
- not currently supported in ANGLE
- for this, added "supportsVertexTextures" method to WebGLRenderer API, so that application can handle this