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

Function renderLine

Three.js/js/Three62dev.js:15804–15876  ·  view source on GitHub ↗
( v1, v2, element, material )

Source from the content-addressed store, hash-verified

15802 }
15803
15804 function renderLine( v1, v2, element, material ) {
15805
15806 setOpacity( material.opacity );
15807 setBlending( material.blending );
15808
15809 _context.beginPath();
15810 _context.moveTo( v1.positionScreen.x, v1.positionScreen.y );
15811 _context.lineTo( v2.positionScreen.x, v2.positionScreen.y );
15812
15813 if ( material instanceof THREE.LineBasicMaterial ) {
15814
15815 setLineWidth( material.linewidth );
15816 setLineCap( material.linecap );
15817 setLineJoin( material.linejoin );
15818
15819 if ( material.vertexColors !== THREE.VertexColors ) {
15820
15821 setStrokeStyle( material.color.getStyle() );
15822
15823 } else {
15824
15825 var colorStyle1 = element.vertexColors[0].getStyle();
15826 var colorStyle2 = element.vertexColors[1].getStyle();
15827
15828 if ( colorStyle1 === colorStyle2 ) {
15829
15830 setStrokeStyle( colorStyle1 );
15831
15832 } else {
15833
15834 try {
15835
15836 var grad = _context.createLinearGradient(
15837 v1.positionScreen.x,
15838 v1.positionScreen.y,
15839 v2.positionScreen.x,
15840 v2.positionScreen.y
15841 );
15842 grad.addColorStop( 0, colorStyle1 );
15843 grad.addColorStop( 1, colorStyle2 );
15844
15845 } catch ( exception ) {
15846
15847 grad = colorStyle1;
15848
15849 }
15850
15851 setStrokeStyle( grad );
15852
15853 }
15854
15855 }
15856
15857 _context.stroke();
15858 _elemBox.expandByScalar( material.linewidth * 2 );
15859
15860 } else if ( material instanceof THREE.LineDashedMaterial ) {
15861

Callers 1

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