- Updated View3D to use Subject3D wrappers instead of Shape3D - Fixed HostController for the new architecture - Made position and heading observable in VisualiserBoat - Attached listeners to each VisualiserBoat in RaceController #story[1261]main
parent
368bb8ddb3
commit
0ee448e17d
@ -0,0 +1,72 @@
|
||||
package visualiser.layout;
|
||||
|
||||
import javafx.scene.shape.Shape3D;
|
||||
import javafx.scene.transform.Rotate;
|
||||
import javafx.scene.transform.Translate;
|
||||
|
||||
/**
|
||||
* Wrapper for controlling the position and heading of rendered 3D models.
|
||||
*/
|
||||
public class Subject3D {
|
||||
/**
|
||||
* Rendered mesh
|
||||
*/
|
||||
private Shape3D mesh;
|
||||
|
||||
/**
|
||||
* Position translation updated by state listeners
|
||||
*/
|
||||
private Translate position;
|
||||
/**
|
||||
* Heading rotation updated by state listeners
|
||||
*/
|
||||
private Rotate heading;
|
||||
|
||||
/**
|
||||
* Constructor for view subject wrapper
|
||||
* @param mesh to be rendered
|
||||
*/
|
||||
public Subject3D(Shape3D mesh) {
|
||||
this.mesh = mesh;
|
||||
this.position = new Translate();
|
||||
this.heading = new Rotate(0, Rotate.Y_AXIS);
|
||||
|
||||
this.mesh.getTransforms().addAll(heading, new Rotate(-90, Rotate.X_AXIS), position);
|
||||
}
|
||||
|
||||
public Shape3D getMesh() {
|
||||
return mesh;
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
return this.position.getX();
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
return this.position.getY();
|
||||
}
|
||||
|
||||
public double getZ() {
|
||||
return this.position.getZ();
|
||||
}
|
||||
|
||||
public void setX(double x) {
|
||||
this.position.setX(x);
|
||||
}
|
||||
|
||||
public void setY(double y) {
|
||||
this.position.setY(y);
|
||||
}
|
||||
|
||||
public void setZ(double z) {
|
||||
this.position.setZ(z);
|
||||
}
|
||||
|
||||
public double getHeading() {
|
||||
return this.heading.getAngle();
|
||||
}
|
||||
|
||||
public void setHeading(double angle) {
|
||||
this.heading.setAngle(angle);
|
||||
}
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
package visualiser.model;
|
||||
|
||||
import com.interactivemesh.jfx.importer.Importer;
|
||||
import javafx.scene.layout.Pane;
|
||||
|
||||
/**
|
||||
* Created by fwy13 on 29/08/17.
|
||||
*/
|
||||
public class BoatDisplay3D extends Pane {
|
||||
|
||||
|
||||
public BoatDisplay3D(String filePath){
|
||||
super();
|
||||
// Shape3D
|
||||
// this.getChildren().add();
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in new issue