import javafx.application.Application;
import javafx.geometry.Point3D;
import javafx.scene.Group;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.paint.PhongMaterial;
import javafx.scene.shape.Cylinder;
import javafx.stage.Stage;

public class DiffuseMap_3D extends Application {
    final int SCENE_WIDTH = 600;
    final int SCENE_HEIGHT = 600;
    public Parent createContent() throws Exception {
        Cylinder testCylinder = new Cylinder(100.0, 200.0);
        testCylinder.setLayoutX(SCENE_WIDTH/4);
        testCylinder.setLayoutY(SCENE_HEIGHT/2);

        Image diffuseMap = new Image("04.jpg");
        //Image diffuseMap = new Image("duke.png");
        PhongMaterial phongMaterial = new PhongMaterial();
        phongMaterial.setDiffuseMap(diffuseMap);
        testCylinder.setMaterial(phongMaterial);

        testCylinder.setRotationAxis(new Point3D(1,1,1));
        testCylinder.setRotate(45);
        Group root = new Group();
        root.getChildren().add(testCylinder);
        return root;
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        Scene scene = new Scene(createContent(), SCENE_WIDTH, SCENE_HEIGHT);
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    /**
     * Java main for when running without JavaFX launcher
     */
    public static void main(String[] args) {
        launch(args);
    }
}
