Explorar o código

SVGRenderer: use svg:path for line drawing

Idea to use svg:path for all SVG primitives.
Later one can concatenate svg:path if they have identical styles
Sergey Linev %!s(int64=8) %!d(string=hai) anos
pai
achega
23cc902593
Modificáronse 1 ficheiros con 2 adicións e 5 borrados
  1. 2 5
      examples/js/renderers/SVGRenderer.js

+ 2 - 5
examples/js/renderers/SVGRenderer.js

@@ -350,12 +350,9 @@ THREE.SVGRenderer = function () {
 
 	function renderLine( v1, v2, element, material ) {
 
-		_svgNode = getLineNode( _lineCount ++ );
+		_svgNode = getPathNode( _pathCount ++ );
 
-		_svgNode.setAttribute( 'x1', v1.positionScreen.x );
-		_svgNode.setAttribute( 'y1', v1.positionScreen.y );
-		_svgNode.setAttribute( 'x2', v2.positionScreen.x );
-		_svgNode.setAttribute( 'y2', v2.positionScreen.y );
+		_svgNode.setAttribute( 'd', 'M ' + v1.positionScreen.x + ' ' + v1.positionScreen.y + ' L ' + v2.positionScreen.x + ' ' + v2.positionScreen.y );
 
 		if ( material instanceof THREE.LineBasicMaterial ) {