MCPcopy Index your code
hub / github.com/stemkoski/stemkoski.github.com / renderLine

Function renderLine

Three.js/js/Three59dev.js:15408–15480  ·  view source on GitHub ↗
( v1, v2, element, material )

Source from the content-addressed store, hash-verified

15406 }
15407
15408 function renderLine( v1, v2, element, material ) {
15409
15410 setOpacity( material.opacity );
15411 setBlending( material.blending );
15412
15413 _context.beginPath();
15414 _context.moveTo( v1.positionScreen.x, v1.positionScreen.y );
15415 _context.lineTo( v2.positionScreen.x, v2.positionScreen.y );
15416
15417 if ( material instanceof THREE.LineBasicMaterial ) {
15418
15419 setLineWidth( material.linewidth );
15420 setLineCap( material.linecap );
15421 setLineJoin( material.linejoin );
15422
15423 if ( material.vertexColors !== THREE.VertexColors ) {
15424
15425 setStrokeStyle( material.color.getStyle() );
15426
15427 } else {
15428
15429 var colorStyle1 = element.vertexColors[0].getStyle();
15430 var colorStyle2 = element.vertexColors[1].getStyle();
15431
15432 if ( colorStyle1 === colorStyle2 ) {
15433
15434 setStrokeStyle( colorStyle1 );
15435
15436 } else {
15437
15438 try {
15439
15440 var grad = _context.createLinearGradient(
15441 v1.positionScreen.x,
15442 v1.positionScreen.y,
15443 v2.positionScreen.x,
15444 v2.positionScreen.y
15445 );
15446 grad.addColorStop( 0, colorStyle1 );
15447 grad.addColorStop( 1, colorStyle2 );
15448
15449 } catch ( exception ) {
15450
15451 grad = colorStyle1;
15452
15453 }
15454
15455 setStrokeStyle( grad );
15456
15457 }
15458
15459 }
15460
15461 _context.stroke();
15462 _elemBox.expandByScalar( material.linewidth * 2 );
15463
15464 } else if ( material instanceof THREE.LineDashedMaterial ) {
15465

Callers 1

Three59dev.jsFile · 0.70

Calls 7

setOpacityFunction · 0.70
setBlendingFunction · 0.70
setLineWidthFunction · 0.70
setLineCapFunction · 0.70
setLineJoinFunction · 0.70
setStrokeStyleFunction · 0.70
setDashAndGapFunction · 0.70

Tested by

no test coverage detected