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

Function renderLine

Three.js/js/Three62.js:15846–15918  ·  view source on GitHub ↗
( v1, v2, element, material )

Source from the content-addressed store, hash-verified

15844 }
15845
15846 function renderLine( v1, v2, element, material ) {
15847
15848 setOpacity( material.opacity );
15849 setBlending( material.blending );
15850
15851 _context.beginPath();
15852 _context.moveTo( v1.positionScreen.x, v1.positionScreen.y );
15853 _context.lineTo( v2.positionScreen.x, v2.positionScreen.y );
15854
15855 if ( material instanceof THREE.LineBasicMaterial ) {
15856
15857 setLineWidth( material.linewidth );
15858 setLineCap( material.linecap );
15859 setLineJoin( material.linejoin );
15860
15861 if ( material.vertexColors !== THREE.VertexColors ) {
15862
15863 setStrokeStyle( material.color.getStyle() );
15864
15865 } else {
15866
15867 var colorStyle1 = element.vertexColors[0].getStyle();
15868 var colorStyle2 = element.vertexColors[1].getStyle();
15869
15870 if ( colorStyle1 === colorStyle2 ) {
15871
15872 setStrokeStyle( colorStyle1 );
15873
15874 } else {
15875
15876 try {
15877
15878 var grad = _context.createLinearGradient(
15879 v1.positionScreen.x,
15880 v1.positionScreen.y,
15881 v2.positionScreen.x,
15882 v2.positionScreen.y
15883 );
15884 grad.addColorStop( 0, colorStyle1 );
15885 grad.addColorStop( 1, colorStyle2 );
15886
15887 } catch ( exception ) {
15888
15889 grad = colorStyle1;
15890
15891 }
15892
15893 setStrokeStyle( grad );
15894
15895 }
15896
15897 }
15898
15899 _context.stroke();
15900 _elemBox.expandByScalar( material.linewidth * 2 );
15901
15902 } else if ( material instanceof THREE.LineDashedMaterial ) {
15903

Callers 1

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