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

Function renderLine

Three.js/js/Three60.js:15758–15830  ·  view source on GitHub ↗
( v1, v2, element, material )

Source from the content-addressed store, hash-verified

15756 }
15757
15758 function renderLine( v1, v2, element, material ) {
15759
15760 setOpacity( material.opacity );
15761 setBlending( material.blending );
15762
15763 _context.beginPath();
15764 _context.moveTo( v1.positionScreen.x, v1.positionScreen.y );
15765 _context.lineTo( v2.positionScreen.x, v2.positionScreen.y );
15766
15767 if ( material instanceof THREE.LineBasicMaterial ) {
15768
15769 setLineWidth( material.linewidth );
15770 setLineCap( material.linecap );
15771 setLineJoin( material.linejoin );
15772
15773 if ( material.vertexColors !== THREE.VertexColors ) {
15774
15775 setStrokeStyle( material.color.getStyle() );
15776
15777 } else {
15778
15779 var colorStyle1 = element.vertexColors[0].getStyle();
15780 var colorStyle2 = element.vertexColors[1].getStyle();
15781
15782 if ( colorStyle1 === colorStyle2 ) {
15783
15784 setStrokeStyle( colorStyle1 );
15785
15786 } else {
15787
15788 try {
15789
15790 var grad = _context.createLinearGradient(
15791 v1.positionScreen.x,
15792 v1.positionScreen.y,
15793 v2.positionScreen.x,
15794 v2.positionScreen.y
15795 );
15796 grad.addColorStop( 0, colorStyle1 );
15797 grad.addColorStop( 1, colorStyle2 );
15798
15799 } catch ( exception ) {
15800
15801 grad = colorStyle1;
15802
15803 }
15804
15805 setStrokeStyle( grad );
15806
15807 }
15808
15809 }
15810
15811 _context.stroke();
15812 _elemBox.expandByScalar( material.linewidth * 2 );
15813
15814 } else if ( material instanceof THREE.LineDashedMaterial ) {
15815

Callers 1

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