Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ThreeJS r125 is incompatible with MeshLine #133

Open
Blakeinstein opened this issue Mar 3, 2021 · 2 comments
Open

ThreeJS r125 is incompatible with MeshLine #133

Blakeinstein opened this issue Mar 3, 2021 · 2 comments

Comments

@Blakeinstein
Copy link

Blakeinstein commented Mar 3, 2021

Since THREE.Geometry got deprecated, this section breaks

MeshLine.prototype.setGeometry = function(g, c) {
		// as the input geometry are mutated we store them
		// for later retreival when necessary (declaritive architectures)
		this._geometry = g;
		if (g instanceof THREE.Geometry) {
			this.setPoints(g.vertices, c);
		} else if (g instanceof THREE.BufferGeometry) {
			this.setPoints(g.getAttribute("position").array, c);
		} else {
			this.setPoints(g, c);
		}
}

A simple removal of if (g instanceof THREE.Geometry) should resolve this issue.

@Blakeinstein
Copy link
Author

A simple workaround, for the users currently is to add the following code to their js files.

MeshLine.prototype.setGeometry = function(g, c) {
	// as the input geometry are mutated we store them
	// for later retreival when necessary (declaritive architectures)
	this._geometry = g;
	if (g instanceof THREE.BufferGeometry) {
		this.setPoints(g.getAttribute("position").array, c);
	} else {
		this.setPoints(g, c);
	}
}

@milewski
Copy link

milewski commented Mar 14, 2021

Another way to go around this issue is to use setPoints instead of setGeometry

const line = new MeshLine();
line.setPoints(new Float32Array(positions));

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

No branches or pull requests

2 participants