Added colour indication to next mark
- Colour is swapped with end mark in leg when mark is passed #story[1195]
This commit is contained in:
@@ -12,6 +12,10 @@ public class Subject3D {
|
||||
* Rendered mesh
|
||||
*/
|
||||
private Shape3D mesh;
|
||||
/**
|
||||
* Source ID of subject in game model
|
||||
*/
|
||||
private int sourceID;
|
||||
|
||||
/**
|
||||
* Position translation updated by state listeners
|
||||
@@ -27,8 +31,9 @@ public class Subject3D {
|
||||
* Constructor for view subject wrapper
|
||||
* @param mesh to be rendered
|
||||
*/
|
||||
public Subject3D(Shape3D mesh) {
|
||||
public Subject3D(Shape3D mesh, int sourceID) {
|
||||
this.mesh = mesh;
|
||||
this.sourceID = sourceID;
|
||||
this.position = new Translate();
|
||||
this.heading = new Rotate(0, Rotate.Y_AXIS);
|
||||
|
||||
@@ -39,6 +44,10 @@ public class Subject3D {
|
||||
return mesh;
|
||||
}
|
||||
|
||||
public int getSourceID() {
|
||||
return sourceID;
|
||||
}
|
||||
|
||||
public Translate getPosition() {
|
||||
return this.position;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,11 @@ public class View3D extends Pane {
|
||||
/**
|
||||
* Map for selecting Subject3D from Shape3D
|
||||
*/
|
||||
private Map<Shape3D, Subject3D> selectionMap;
|
||||
private Map<Shape3D, Subject3D> shapeMap;
|
||||
/**
|
||||
* Map for selecting Shape3D from source ID
|
||||
*/
|
||||
private Map<Integer, Shape3D> sourceMap;
|
||||
/**
|
||||
* Subject tracked by camera
|
||||
*/
|
||||
@@ -92,7 +96,8 @@ public class View3D extends Pane {
|
||||
*/
|
||||
public View3D() {
|
||||
this.world = new Group();
|
||||
this.selectionMap = new HashMap<>();
|
||||
this.shapeMap = new HashMap<>();
|
||||
this.sourceMap = new HashMap<>();
|
||||
this.target = null;
|
||||
this.scene = new SubScene(world, 300, 300);
|
||||
|
||||
@@ -140,17 +145,23 @@ public class View3D extends Pane {
|
||||
if (c.wasRemoved() || c.wasAdded()) {
|
||||
for (Subject3D shape : c.getRemoved()) {
|
||||
world.getChildren().remove(shape.getMesh());
|
||||
selectionMap.remove(shape.getMesh());
|
||||
shapeMap.remove(shape.getMesh());
|
||||
sourceMap.remove(shape.getSourceID());
|
||||
}
|
||||
for (Subject3D shape : c.getAddedSubList()) {
|
||||
world.getChildren().add(shape.getMesh());
|
||||
selectionMap.put(shape.getMesh(), shape);
|
||||
shapeMap.put(shape.getMesh(), shape);
|
||||
sourceMap.put(shape.getSourceID(), shape.getMesh());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Shape3D getShape(int sourceID) {
|
||||
return sourceMap.get(sourceID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Intercept mouse clicks on subjects in view. The applied listener cannot be removed.
|
||||
*/
|
||||
@@ -158,7 +169,7 @@ public class View3D extends Pane {
|
||||
scene.setOnMousePressed(e -> {
|
||||
PickResult result = e.getPickResult();
|
||||
if(result != null && result.getIntersectedNode() != null && result.getIntersectedNode() instanceof Shape3D) {
|
||||
trackSubject(selectionMap.get(result.getIntersectedNode()));
|
||||
trackSubject(shapeMap.get(result.getIntersectedNode()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user