jFx3DTest/src/main/java/com/ThreeDtest/application/Main.java

49 lines
1.0 KiB
Java
Raw Normal View History

2019-03-30 22:31:04 +01:00
package main.java.com.ThreeDtest.application;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
2019-04-01 00:43:06 +02:00
import javafx.scene.SceneAntialiasing;
2019-04-02 21:01:52 +02:00
import javafx.scene.image.Image;
2019-04-01 22:12:19 +02:00
import javafx.scene.layout.BorderPane;
2019-03-30 22:31:04 +01:00
public class Main extends Application
{
2019-04-01 00:43:06 +02:00
@Override
public void start(Stage primaryStage)
{
try {
2019-03-30 22:31:04 +01:00
2019-04-01 22:12:19 +02:00
BorderPane demoPane = new BorderPane(); // Pane for this demo
2019-04-01 00:43:06 +02:00
primaryStage.setTitle("jFx3Dtest");
2019-04-02 21:28:23 +02:00
2019-04-01 22:12:19 +02:00
Scene scene = new Scene(demoPane, 600, 600, true,
2019-04-01 00:43:06 +02:00
SceneAntialiasing.BALANCED);
2019-03-30 22:31:04 +01:00
2019-04-02 21:01:52 +02:00
// Create new Preview
2019-04-02 21:28:23 +02:00
Texture3DPreview preview = new Texture3DPreview(300, 300);
2019-04-02 21:01:52 +02:00
2019-04-02 21:28:23 +02:00
final String DIFFUSE_MAP = "https://bit.ly/2FTajSP";
2019-04-02 21:01:52 +02:00
2019-04-02 21:28:23 +02:00
Image texture = new Image(DIFFUSE_MAP);
2019-04-02 21:01:52 +02:00
2019-04-02 21:28:23 +02:00
preview.setTexture(texture);
2019-04-02 21:01:52 +02:00
2019-04-01 22:57:19 +02:00
// Get the generated 3D preview as StackPane
demoPane.setCenter(preview.getPreviewPane());
2019-04-01 00:43:06 +02:00
primaryStage.setScene(scene);
primaryStage.show();
2019-04-02 21:01:52 +02:00
2019-04-01 00:43:06 +02:00
} catch (Exception e) {
e.printStackTrace();
}
2019-03-30 22:31:04 +01:00
}
public static void main(String[] args)
{
launch(args);
}
2019-04-01 00:43:06 +02:00
}