MCPcopy
hub / github.com/stemkoski/stemkoski.github.com / renderLine

Function renderLine

Three.js/js/Three66.js:16626–16698  ·  view source on GitHub ↗
( v1, v2, element, material )

Source from the content-addressed store, hash-verified

16624 }
16625
16626 function renderLine( v1, v2, element, material ) {
16627
16628 setOpacity( material.opacity );
16629 setBlending( material.blending );
16630
16631 _context.beginPath();
16632 _context.moveTo( v1.positionScreen.x, v1.positionScreen.y );
16633 _context.lineTo( v2.positionScreen.x, v2.positionScreen.y );
16634
16635 if ( material instanceof THREE.LineBasicMaterial ) {
16636
16637 setLineWidth( material.linewidth );
16638 setLineCap( material.linecap );
16639 setLineJoin( material.linejoin );
16640
16641 if ( material.vertexColors !== THREE.VertexColors ) {
16642
16643 setStrokeStyle( material.color.getStyle() );
16644
16645 } else {
16646
16647 var colorStyle1 = element.vertexColors[0].getStyle();
16648 var colorStyle2 = element.vertexColors[1].getStyle();
16649
16650 if ( colorStyle1 === colorStyle2 ) {
16651
16652 setStrokeStyle( colorStyle1 );
16653
16654 } else {
16655
16656 try {
16657
16658 var grad = _context.createLinearGradient(
16659 v1.positionScreen.x,
16660 v1.positionScreen.y,
16661 v2.positionScreen.x,
16662 v2.positionScreen.y
16663 );
16664 grad.addColorStop( 0, colorStyle1 );
16665 grad.addColorStop( 1, colorStyle2 );
16666
16667 } catch ( exception ) {
16668
16669 grad = colorStyle1;
16670
16671 }
16672
16673 setStrokeStyle( grad );
16674
16675 }
16676
16677 }
16678
16679 _context.stroke();
16680 _elemBox.expandByScalar( material.linewidth * 2 );
16681
16682 } else if ( material instanceof THREE.LineDashedMaterial ) {
16683

Callers 1

Three66.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