提交 df4876db 编写于 作者: B Ben Houston

add support for front/back/double to MeshNormalMaterial

上级 576c75da
......@@ -59,7 +59,8 @@
var params = {
material: 'normal',
camera: 'perspective'
camera: 'perspective',
side: 'double'
};
var cameraOrtho, cameraPerspective;
......@@ -84,7 +85,7 @@
var gui = new dat.GUI();
gui.add( params, 'material', [ 'standard', 'normal', 'depthBasic', 'depthRGBA' ] );
gui.add( params, 'camera', [ 'perspective', 'ortho' ] );
gui.add( params, 'side', [ 'front', 'back', 'double' ] );
}
function init() {
......@@ -188,7 +189,9 @@
side: THREE.DoubleSide
} );
materialNormal = new THREE.MeshNormalMaterial();
materialNormal = new THREE.MeshNormalMaterial( {
side: THREE.DoubleSide
} );
//
......@@ -266,6 +269,14 @@
}
switch ( params.side ) {
case 'front': material.side = THREE.FrontSide; break;
case 'back': material.side = THREE.BackSide; break;
case 'double': material.side = THREE.DoubleSide; break;
}
mesh.material = material;
}
......
......@@ -9,7 +9,9 @@ varying vec3 vNormal;
void main() {
#include <clipping_planes_fragment>
gl_FragColor = vec4( packNormalToRGB( vNormal ), opacity );
#include <normal_flip>
gl_FragColor = vec4( packNormalToRGB( vNormal * flipNormal ), opacity );
#include <logdepthbuf_fragment>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册