提交 bf3dede8 编写于 作者: M Mr.doob

Implemented MeshNormalMaterial in SVGRenderer

SubstractiveBlending ⟶ SubtractiveBlending
上级 4d209ac4
此差异已折叠。
此差异已折叠。
......@@ -9,4 +9,4 @@ THREE.PhongShading = 2;
THREE.NormalBlending = 0;
THREE.AdditiveBlending = 1;
THREE.SubstractiveBlending = 2;
THREE.SubtractiveBlending = 2;
......@@ -339,11 +339,6 @@ THREE.SVGRenderer = function () {
_color.__styleString = material.color.__styleString;
} else if ( material instanceof THREE.MeshDepthMaterial ) {
_w = 1 - ( material.__2near / (material.__farPlusNear - element.z * material.__farMinusNear) );
_color.setRGBA( _w, _w, _w, 1 );
} else if ( material instanceof THREE.MeshLambertMaterial ) {
if ( _enableLighting ) {
......@@ -361,6 +356,15 @@ THREE.SVGRenderer = function () {
}
} else if ( material instanceof THREE.MeshDepthMaterial ) {
_w = 1 - ( material.__2near / (material.__farPlusNear - element.z * material.__farMinusNear) );
_color.setRGBA( _w, _w, _w, 1 );
} else if ( material instanceof THREE.MeshNormalMaterial ) {
_color.setRGBA( normalToComponent( element.normalWorld.x ), normalToComponent( element.normalWorld.y ), normalToComponent( element.normalWorld.z ), 1 );
}
if ( material.wireframe ) {
......@@ -403,6 +407,15 @@ THREE.SVGRenderer = function () {
}
} else if ( material instanceof THREE.MeshDepthMaterial ) {
_w = 1 - ( material.__2near / (material.__farPlusNear - element.z * material.__farMinusNear) );
_color.setRGBA( _w, _w, _w, 1 );
} else if ( material instanceof THREE.MeshNormalMaterial ) {
_color.setRGBA( normalToComponent( element.normalWorld.x ), normalToComponent( element.normalWorld.y ), normalToComponent( element.normalWorld.z ), 1 );
}
if ( material.wireframe ) {
......@@ -459,4 +472,12 @@ THREE.SVGRenderer = function () {
}
function normalToComponent( normal ) {
// https://gist.github.com/665829
return normal < 0 ? Math.min( 1 + normal, 0.5 ) : 0.5 + Math.min( normal, 0.5 );
}
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册