瀏覽代碼

SVGRenderer: Reverted lost changes and using getStyle() instead.

Mr.doob 11 年之前
父節點
當前提交
fca5866e28
共有 1 個文件被更改,包括 6 次插入3 次删除
  1. 6 3
      examples/js/renderers/SVGRenderer.js

+ 6 - 3
examples/js/renderers/SVGRenderer.js

@@ -26,6 +26,7 @@ THREE.SVGRenderer = function () {
 
 	_w, // z-buffer to w-buffer
 	_vector3 = new THREE.Vector3(), // Needed for PointLight
+	_centroid = new THREE.Vector3(),
 
 	_svgPathPool = [], _svgLinePool = [], _svgRectPool = [],
 	_svgNode, _pathCount = 0, _lineCount = 0, _rectCount = 0,
@@ -96,7 +97,7 @@ THREE.SVGRenderer = function () {
 
 		}
 		
-		_svg.style.backgroundColor = "#" + _clearColor.getHexString();
+		_svg.style.backgroundColor = _clearColor.getStyle();
 
 	};
 
@@ -125,7 +126,7 @@ THREE.SVGRenderer = function () {
 			var element = _elements[ e ];
 			var material = element.material;
 
-			if ( material === undefined || material.visible === false ) continue;
+			if ( material === undefined || material.opacity === 0 ) continue;
 
 			_elemBox.makeEmpty();
 
@@ -332,7 +333,9 @@ THREE.SVGRenderer = function () {
 
 			_color.copy( _ambientLight );
 
-			calculateLight( _lights, element.centroidModel, element.normalModel, _color );
+			_centroid.copy( v1.positionWorld ).add( v2.positionWorld ).add( v3.positionWorld ).divideScalar( 3 );
+
+			calculateLight( _lights, _centroid, element.normalModel, _color );
 
 			_color.multiply( _diffuseColor ).add( material.emissive );