-
Notifications
You must be signed in to change notification settings - Fork 122
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
Set MapNode material #79
Comments
Hello We can add a callback to set the material, everytime that a new tile is created. Would this work for you? |
It will still be created with MeshBasicMaterial, and changed after, right? I propose options to change it before creation. |
This tripped me up too. I would think that you could pass in a factory function that creates the material, or that you would set I think I expected (and would like) // ...
let node = new Constructor(this, this.mapView, QuadTreePosition.topLeft, level, x, y);
// ...
material = this.material.clone();
material.map = MapNode.defaultTexture;
node.setMaterial(material);
// ... create other child nodes I think it would suffice to have a To actually change the material in From this: const map_view = new MapView(MapView.PLANAR, map_provider) To this: class MyMapPlaneNode extends MapPlaneNode {
constructor(...args) {
super(...args);
this.material = new THREE.MeshBasicMaterial({ transparent: true, opacity: 0.5 });
}
}
const map_view = new MapView(MapView.PLANAR, map_provider);
map_view.setRoot(new MyMapPlaneNode(null, map_view)); I was also a little thrown off by language in the readme which suggests that each node should not necessarily have its own
|
Hi there!
I need to use MeshStandardMaterial for the MapPlaneNode so the light affects it. For now it seems the only way to do it is to extend MapPlaneNode class and change material after
super()
is called.It would be great to have an option to set the material with constructor argument or have MapNode class atribute storing the material class, so it can be reassigned.
Thank you!
The text was updated successfully, but these errors were encountered: