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

Function renderLine

7DFPS/js/Three.js:15781–15853  ·  view source on GitHub ↗
( v1, v2, element, material )

Source from the content-addressed store, hash-verified

15779 }
15780
15781 function renderLine( v1, v2, element, material ) {
15782
15783 setOpacity( material.opacity );
15784 setBlending( material.blending );
15785
15786 _context.beginPath();
15787 _context.moveTo( v1.positionScreen.x, v1.positionScreen.y );
15788 _context.lineTo( v2.positionScreen.x, v2.positionScreen.y );
15789
15790 if ( material instanceof THREE.LineBasicMaterial ) {
15791
15792 setLineWidth( material.linewidth );
15793 setLineCap( material.linecap );
15794 setLineJoin( material.linejoin );
15795
15796 if ( material.vertexColors !== THREE.VertexColors ) {
15797
15798 setStrokeStyle( material.color.getStyle() );
15799
15800 } else {
15801
15802 var colorStyle1 = element.vertexColors[0].getStyle();
15803 var colorStyle2 = element.vertexColors[1].getStyle();
15804
15805 if ( colorStyle1 === colorStyle2 ) {
15806
15807 setStrokeStyle( colorStyle1 );
15808
15809 } else {
15810
15811 try {
15812
15813 var grad = _context.createLinearGradient(
15814 v1.positionScreen.x,
15815 v1.positionScreen.y,
15816 v2.positionScreen.x,
15817 v2.positionScreen.y
15818 );
15819 grad.addColorStop( 0, colorStyle1 );
15820 grad.addColorStop( 1, colorStyle2 );
15821
15822 } catch ( exception ) {
15823
15824 grad = colorStyle1;
15825
15826 }
15827
15828 setStrokeStyle( grad );
15829
15830 }
15831
15832 }
15833
15834 _context.stroke();
15835 _elemBox.expandByScalar( material.linewidth * 2 );
15836
15837 } else if ( material instanceof THREE.LineDashedMaterial ) {
15838

Callers 1

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