mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-06 08:25:19 +01:00
41 lines
948 B
Java
41 lines
948 B
Java
package cad.fx;
|
|
|
|
import eu.mihosoft.vrl.v3d.CSG;
|
|
import eu.mihosoft.vrl.v3d.Polygon;
|
|
import javafx.scene.Group;
|
|
import javafx.scene.Parent;
|
|
import javafx.scene.shape.MeshView;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
public class CSGNode extends MeshView {
|
|
|
|
private final CadContext context;
|
|
|
|
public CSGNode(CSGMesh mesh, CadContext context) {
|
|
super(mesh);
|
|
this.context = context;
|
|
setMaterial(Utils3D.DEFAULT_MATERIAL);
|
|
setOnMouseClicked(e -> {
|
|
context.clickOnNode(this, e);
|
|
});
|
|
}
|
|
|
|
private void highlight(Polygon poly) {
|
|
System.out.println(poly);
|
|
}
|
|
|
|
public final Map<Surface, Sketch> sketches = new HashMap<>();
|
|
|
|
public Sketch getSketch(Surface surface) {
|
|
Sketch sketch = sketches.get(surface);
|
|
if (sketch == null) {
|
|
sketch = new Sketch(surface);
|
|
((Group) getParent()).getChildren().add(sketch.drawLayer);
|
|
sketches.put(surface, sketch);
|
|
}
|
|
return sketch;
|
|
}
|
|
|
|
}
|