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

Made CanvasRenderer and SVGRenderer behave like WebGLRenderer with...

Made CanvasRenderer and SVGRenderer behave like WebGLRenderer with MeshLambertMaterial and no lights.
上级 f2da4233
......@@ -17,7 +17,6 @@ THREE.SVGRenderer = function () {
_clipBox = new THREE.Box2(),
_elemBox = new THREE.Box2(),
_enableLighting = false,
_color = new THREE.Color(),
_diffuseColor = new THREE.Color(),
_emissiveColor = new THREE.Color(),
......@@ -111,14 +110,8 @@ THREE.SVGRenderer = function () {
_pathCount = 0; _circleCount = 0; _lineCount = 0;
_enableLighting = _lights.length > 0;
if ( _enableLighting ) {
calculateLights( _lights );
}
for ( e = 0, el = _elements.length; e < el; e ++ ) {
element = _elements[ e ];
......@@ -283,8 +276,6 @@ THREE.SVGRenderer = function () {
if ( material instanceof THREE.ParticleCircleMaterial ) {
if ( _enableLighting ) {
_color.r = _ambientLight.r + _directionalLights.r + _pointLights.r;
_color.g = _ambientLight.g + _directionalLights.g + _pointLights.g;
_color.b = _ambientLight.b + _directionalLights.b + _pointLights.b;
......@@ -295,12 +286,6 @@ THREE.SVGRenderer = function () {
_color.updateStyleString();
} else {
_color = material.color;
}
_svgNode.setAttribute( 'style', 'fill: ' + _color.__styleString );
}
......@@ -358,20 +343,12 @@ THREE.SVGRenderer = function () {
}
if ( _enableLighting ) {
_color.copy( _ambientLight );
calculateLight( _lights, element.centroidModel, element.normalModel, _color );
_color.multiply( _diffuseColor ).add( _emissiveColor );
} else {
_color.copy( _diffuseColor );
}
} else if ( material instanceof THREE.MeshDepthMaterial ) {
_w = 1 - ( material.__2near / (material.__farPlusNear - element.z * material.__farMinusNear) );
......@@ -428,20 +405,12 @@ THREE.SVGRenderer = function () {
}
if ( _enableLighting ) {
_color.copy( _ambientLight );
calculateLight( _lights, element.centroidModel, element.normalModel, _color );
_color.multiply( _diffuseColor ).add( _emissiveColor );
} else {
_color.copy( _diffuseColor );
}
} else if ( material instanceof THREE.MeshDepthMaterial ) {
_w = 1 - ( material.__2near / (material.__farPlusNear - element.z * material.__farMinusNear) );
......
......@@ -63,7 +63,6 @@ THREE.CanvasRenderer = function ( parameters ) {
_clearBox = new THREE.Box2(),
_elemBox = new THREE.Box2(),
_enableLighting = false,
_ambientLight = new THREE.Color(),
_directionalLights = new THREE.Color(),
_pointLights = new THREE.Color(),
......@@ -276,14 +275,8 @@ THREE.CanvasRenderer = function ( parameters ) {
_context.fillRect( _clipBox.min.x, _clipBox.min.y, _clipBox.max.x - _clipBox.min.x, _clipBox.max.y - _clipBox.min.y );
*/
_enableLighting = _lights.length > 0;
if ( _enableLighting === true ) {
calculateLights();
}
for ( var e = 0, el = _elements.length; e < el; e++ ) {
var element = _elements[ e ];
......@@ -641,8 +634,6 @@ THREE.CanvasRenderer = function ( parameters ) {
}
if ( _enableLighting === true ) {
if ( material.wireframe === false && material.shading == THREE.SmoothShading && element.vertexNormalsLength == 3 ) {
_color1.copy( _ambientLight );
......@@ -676,14 +667,6 @@ THREE.CanvasRenderer = function ( parameters ) {
}
} else {
material.wireframe === true
? strokePath( material.color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin )
: fillPath( material.color );
}
} else if ( material instanceof THREE.MeshBasicMaterial || material instanceof THREE.MeshLambertMaterial || material instanceof THREE.MeshPhongMaterial ) {
if ( material.map !== null ) {
......@@ -825,8 +808,6 @@ THREE.CanvasRenderer = function ( parameters ) {
}
if ( _enableLighting === true ) {
if ( material.wireframe === false && material.shading == THREE.SmoothShading && element.vertexNormalsLength == 4 ) {
_color1.copy( _ambientLight );
......@@ -870,18 +851,6 @@ THREE.CanvasRenderer = function ( parameters ) {
}
} else {
_color.addColors( _diffuseColor, _emissiveColor );
drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y );
material.wireframe === true
? strokePath( _color, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin )
: fillPath( _color );
}
} else if ( material instanceof THREE.MeshBasicMaterial ) {
_color.copy( material.color );
......@@ -937,8 +906,6 @@ THREE.CanvasRenderer = function ( parameters ) {
}
} else if ( material instanceof THREE.MeshDepthMaterial ) {
_near = camera.near;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册