Skip to content

Conversation

@jeffpyke
Copy link

@jeffpyke jeffpyke commented Sep 3, 2020

Performance optimization to avoid constructing an extra mesh and material in the super class if geometry and material are passed in.

@mrdoob
Copy link
Owner

mrdoob commented Sep 4, 2020

I think it would be better to do this instead?

THREE.Line2 = function ( geometry, material ) {

	if ( geometry === undefined ) geometry = new THREE.LineGeometry();
	if ( material === undefined ) material = new THREE.LineMaterial( { color: Math.random() * 0xffffff } );

	THREE.LineSegments2.call( this, geometry, material );

	this.type = 'Line2';

};

@mrdoob mrdoob added this to the r121 milestone Sep 4, 2020
@jeffpyke
Copy link
Author

jeffpyke commented Sep 4, 2020

Done.

@mrdoob mrdoob merged commit 2c9fce0 into mrdoob:dev Sep 4, 2020
@mrdoob
Copy link
Owner

mrdoob commented Sep 4, 2020

Thanks!

@WestLangley WestLangley changed the title Pass geometry and material into super constructor Line2: Pass geometry and material into super constructor Sep 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants