• A
    Added normal + ambient occlusion + displacement mapping demo. · ac5276b4
    alteredq 提交于
    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
    ac5276b4
ThreeExtras.js 104.1 KB