mirror of
https://github.com/wahyd4/three.js.git
synced 2026-08-27 22:05:58 +10:00
Implemented MeshNormalMaterial in SVGRenderer
SubstractiveBlending ⟶ SubtractiveBlending
This commit is contained in:
@@ -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 );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user