You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.5 KiB
57 lines
1.5 KiB
package visualiser.layout;
|
|
|
|
import javafx.geometry.Point3D;
|
|
import javafx.scene.image.Image;
|
|
import javafx.scene.paint.Color;
|
|
import javafx.scene.paint.Material;
|
|
import javafx.scene.paint.PhongMaterial;
|
|
import javafx.scene.shape.MeshView;
|
|
import javafx.scene.shape.Shape3D;
|
|
import javafx.scene.transform.Rotate;
|
|
import javafx.scene.transform.Translate;
|
|
|
|
/**
|
|
* Created by zwu18 on 24/09/17.
|
|
*/
|
|
public class FireParticle extends Subject3D {
|
|
|
|
public FireParticle(){
|
|
super(createFire(), 0);
|
|
|
|
}
|
|
|
|
private static Shape3D createFire(){
|
|
|
|
Image fire = new Image(FireParticle.class.getClassLoader().getResourceAsStream("images/fire.gif"));
|
|
|
|
Plane3D plane = new Plane3D(20, 20, 10, 10);
|
|
|
|
PhongMaterial material = new PhongMaterial();
|
|
material.setDiffuseColor(Color.web("#FFFFFF"));
|
|
material.setSpecularColor(Color.web("#000000"));
|
|
material.setDiffuseMap(fire);
|
|
|
|
|
|
//material.setDiffuseMap(fire);
|
|
|
|
MeshView fireSurface = new MeshView(plane);
|
|
|
|
fireSurface.setMaterial(material);
|
|
fireSurface.setMouseTransparent(true);
|
|
fireSurface.toFront();
|
|
|
|
System.out.println("Fire created");
|
|
|
|
return fireSurface;
|
|
}
|
|
|
|
public void rotateView(Double angle, Double pivotX, Double pivotY, Double pivotZ, Point3D axis){
|
|
Rotate rotate = new Rotate(angle, axis);
|
|
rotate.setPivotX(pivotX);
|
|
rotate.setPivotY(pivotY);
|
|
rotate.setPivotZ(pivotZ);
|
|
this.getMesh().getTransforms().add(rotate);
|
|
}
|
|
|
|
}
|