@@ -26,6 +26,7 @@ THREE.SVGRenderer = function () {
2626
2727 _w , // z-buffer to w-buffer
2828 _vector3 = new THREE . Vector3 ( ) , // Needed for PointLight
29+ _centroid = new THREE . Vector3 ( ) ,
2930
3031 _svgPathPool = [ ] , _svgLinePool = [ ] , _svgRectPool = [ ] ,
3132 _svgNode , _pathCount = 0 , _lineCount = 0 , _rectCount = 0 ,
@@ -96,7 +97,7 @@ THREE.SVGRenderer = function () {
9697
9798 }
9899
99- _svg . style . backgroundColor = "#" + _clearColor . getHexString ( ) ;
100+ _svg . style . backgroundColor = _clearColor . getStyle ( ) ;
100101
101102 } ;
102103
@@ -125,7 +126,7 @@ THREE.SVGRenderer = function () {
125126 var element = _elements [ e ] ;
126127 var material = element . material ;
127128
128- if ( material === undefined || material . visible === false ) continue ;
129+ if ( material === undefined || material . opacity === 0 ) continue ;
129130
130131 _elemBox . makeEmpty ( ) ;
131132
@@ -332,7 +333,9 @@ THREE.SVGRenderer = function () {
332333
333334 _color . copy ( _ambientLight ) ;
334335
335- calculateLight ( _lights , element . centroidModel , element . normalModel , _color ) ;
336+ _centroid . copy ( v1 . positionWorld ) . add ( v2 . positionWorld ) . add ( v3 . positionWorld ) . divideScalar ( 3 ) ;
337+
338+ calculateLight ( _lights , _centroid , element . normalModel , _color ) ;
336339
337340 _color . multiply ( _diffuseColor ) . add ( material . emissive ) ;
338341
0 commit comments