Java 类javafx.scene.SceneAntialiasing 实例源码

项目:PearPlanner    文件:UIManager.java   
/**
 * Displays the main menu
 *
 * @throws Exception
 */
public void mainMenu() throws Exception
{
    // Load in the .fxml file:
    System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Hello World!");

    FXMLLoader loader = new FXMLLoader(getClass().getResource("/View/MainMenu.fxml"));
    loader.setController(UIManager.mc);
    Parent root = loader.load();

    // Set the scene:
    mainStage.setScene(new Scene(root, 1000, 750, true, SceneAntialiasing.BALANCED));
    mainStage.setTitle("PearPlanner");
    mainStage.getIcons().add(new Image("file:icon.png"));
    mainStage.showAndWait();
}
项目:intellij-ce-playground    文件:SceneBuilderImpl.java   
private void create() {
  myEditorController = new EditorController();
  HierarchyTreeViewController componentTree = new HierarchyTreeViewController(myEditorController);
  ContentPanelController canvas = new ContentPanelController(myEditorController);
  InspectorPanelController propertyTable = new InspectorPanelController(myEditorController);
  LibraryPanelController palette = new LibraryPanelController(myEditorController);

  loadFile();
  startChangeListener();

  SplitPane leftPane = new SplitPane();
  leftPane.setOrientation(Orientation.VERTICAL);
  leftPane.getItems().addAll(palette.getPanelRoot(), componentTree.getPanelRoot());
  leftPane.setDividerPositions(0.5, 0.5);

  SplitPane.setResizableWithParent(leftPane, Boolean.FALSE);
  SplitPane.setResizableWithParent(propertyTable.getPanelRoot(), Boolean.FALSE);

  SplitPane mainPane = new SplitPane();

  mainPane.getItems().addAll(leftPane, canvas.getPanelRoot(), propertyTable.getPanelRoot());
  mainPane.setDividerPositions(0.11036789297658862, 0.8963210702341137);

  myPanel.setScene(new Scene(mainPane, -1, -1, true, SceneAntialiasing.BALANCED));
}
项目:mars-sim    文件:MarsViewer.java   
@Override
public void start(Stage stage) {
    Group group = buildScene();

    Scene scene = new Scene(
      new StackPane(group),
      VIEWPORT_SIZE, VIEWPORT_SIZE,
      true,
      SceneAntialiasing.BALANCED
    );

    scene.setFill(Color.rgb(10, 10, 40));

    scene.setCamera(new PerspectiveCamera());

    stage.setScene(scene);
    stage.show();

    stage.setFullScreen(true);

    rotateAroundYAxis(group).play();
}
项目:fr.xs.jtk    文件:VirtualUniverseView.java   
public VirtualUniverseView(double width, double height, Scene _container) {
        super(new Group(), width, height, true, SceneAntialiasing.BALANCED);
        rootWorld = (Group) this.getRoot();

        camera     = new QuaternionCamera();

        controller = new DefaultQuaternionController();
        if(_container != null)
            controller.setScene(_container);
        controller.setSubScene(this);
        controller.setCamera(camera);

        setFill(Color.BLACK);
        setCamera(camera);

//      rootWorld.getChildren().add(camera);
        rootWorld.getChildren().add(camera.getGroup());
    }
项目:fr.xs.jtk    文件:VirtualUniverseScene.java   
public VirtualUniverseScene(double width, double height) {
        super(new Group(), width, height, true, SceneAntialiasing.BALANCED);
        rootWorld = (Group) this.getRoot();

        camera     = new QuaternionCamera();

        controller = new DefaultQuaternionController();
        controller.setScene(this);
        controller.setCamera(camera);

        setFill(Color.BLACK);
        setCamera(camera);

//      rootWorld.getChildren().add(camera);
        rootWorld.getChildren().add(camera.getGroup());
    }
项目:fr.xs.jtk    文件:TestApplication3DPattern.java   
public TestApplication3DPattern() {
        root = new StackPane();
        scene = new Scene(root, sceneWidth, sceneHeight, true, SceneAntialiasing.BALANCED);

        worldRoot = new Group();
        subscene = new SubScene(worldRoot, sceneWidth, sceneHeight, true, SceneAntialiasing.BALANCED);

        camera = new EulerCamera();
//      camera.setTranslateZ(-1000);

        worldRoot.getChildren().add(camera);

        controller = new DefaultEulerController();
        controller.setScene(scene);
        controller.setSubScene(subscene);
        controller.setCamera(camera);

        scene.setFill(Color.BLACK);
        subscene.setFill(Color.BLACK);
        configure();

//      scene.setCamera(camera);
        subscene.setCamera(camera);

        root.getChildren().addAll(subscene);
    }
项目:code-of-gotham    文件:StageUtil.java   
public Scene initScene(City city, PerspectiveCamera camera, String cityName) {
      Group root = new Group();
      buildCamera(root, camera);
      root.getTransforms().addAll(rxBox, ryBox, rzBox);
      subScene = new SubScene(root, SCENE_WIDTH, SCENE_HEIGHT, true, SceneAntialiasing.BALANCED);
      subScene.setCamera(camera);
      root.getChildren().add(city);

      // 2D
      BorderPane pane = new BorderPane();
      Pane toolBar = null;
try {
    toolBar = new CityToolBarService().load(cityName);
} catch (IOException e) {
    e.printStackTrace();
}
      pane.setBottom(subScene);
      pane.setTop(toolBar);

      Scene scene = new Scene(pane, SCENE_WIDTH, SCENE_HEIGHT);
      subScene.heightProperty().bind(scene.heightProperty());
      subScene.widthProperty().bind(scene.widthProperty());      
      return scene;
  }
项目:Equi    文件:SimpleGraphView3D.java   
public SimpleGraphView3D(boolean perspective) {
    super(new Group(), 800, 800, true, SceneAntialiasing.BALANCED);
    // root is dummy
    node3D = new Node3D();
    node3D.setTranslateX(400);
    node3D.setTranslateY(400);
    setRoot(node3D);
    setFill(Color.gray(0.95));
    if (perspective) {
        setCamera(new PerspectiveCamera());
    }

    MouseHandler3D handler = new MouseHandler3D(node3D);
    setOnMousePressed(handler);
    setOnMouseDragged(handler);
    setOnMouseReleased(handler);

    setOnScroll(new ZoomHandler3D(node3D));
}
项目:PearPlanner    文件:UIManager.java   
/**
 * Displays a GanttishDiagram window for the given Assignment.
 *
 * @param assignment Assignment for which to generate the GanttishDiagram.
 */
public void showGantt(Assignment assignment)
{
    Stage stage = new Stage();

    // Layout:
    VBox layout = new VBox();
    layout.setSpacing(10);
    layout.setPadding(new Insets(15));
    layout.getStylesheets().add("/Content/stylesheet.css");
    // =================

    // Nav bar:
    HBox nav = new HBox();
    nav.setSpacing(15.0);
    // =================

    // Title:
    Label title = new Label("Ganttish Diagram");
    title.getStyleClass().add("title");
    HBox x = new HBox();
    HBox.setHgrow(x, Priority.ALWAYS);
    // =================

    // Buttons:
    Button save = new Button("Save");
    save.setOnAction(e -> {
        String path = this.saveFileDialog(stage);
        GanttishDiagram.createGanttishDiagram(MainController.getSPC().getPlanner(), assignment, path);
    });
    Button close = new Button("Close");
    close.setOnAction(e -> ((Stage) close.getScene().getWindow()).close());
    // =================

    nav.getChildren().addAll(title, x, save, close);

    // Content:
    BufferedImage gantt = GanttishDiagram.createGanttishDiagram(MainController.getSPC().getPlanner(), assignment);
    Image image = SwingFXUtils.toFXImage(gantt, null);
    Pane content = new Pane();
    VBox.setVgrow(content, Priority.ALWAYS);
    content.setBackground(new Background(
            new BackgroundImage(image, BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.DEFAULT,
                    new BackgroundSize(BackgroundSize.AUTO, BackgroundSize.AUTO, false, false, true, false))));
    // =================

    layout.getChildren().addAll(nav, content);

    // Set the scene:
    stage.setScene(new Scene(layout, 1300, 800, true, SceneAntialiasing.BALANCED));
    stage.setTitle("Ganttish Diagram");
    stage.resizableProperty().setValue(true);
    stage.getIcons().add(new Image("file:icon.png"));
    stage.setFullScreen(true);
    stage.showAndWait();
    // =================
}
项目:Gargoyle    文件:Drag3DObject.java   
private void showStage(Stage stage) {
    Scene scene = new Scene(root, sceneWidth, sceneHeight, true, SceneAntialiasing.BALANCED);
    scene.setFill(Color.web("3d3d3d"));

    loadCamera(scene);
    loadControls(scene);

    stage.setTitle("F(X)yz Sample: 3D Dragging");
    stage.setScene(scene);
    stage.show();
}
项目:minecraft-jfx-skin    文件:SkinCanvas.java   
protected SubScene createSubScene() {
    Group group = new Group();
    group.getChildren().add(createPlayerModel());
    group.getTransforms().add(zRotate);

    camera.getTransforms().addAll(yRotate, translate, scale);

    subScene = new SubScene(group, preW, preH, true,
            msaa ? SceneAntialiasing.BALANCED : SceneAntialiasing.DISABLED);
       subScene.setFill(Color.ALICEBLUE);
       subScene.setCamera(camera);

       return subScene;
}
项目:openjfx-8u-dev-tests    文件:SubSceneDepthTestApp.java   
@Override
protected SubScene getTopLeftScene() {
    rootTLMV = buildGroupMover();
    SubScene ss = new SubScene(rootTLMV.getGroup(), SS_WIDTH, SS_HEIGHT, true, SceneAntialiasing.DISABLED);
    ss.setCamera(new PerspectiveCamera());
    return ss;
}
项目:openjfx-8u-dev-tests    文件:SubSceneDepthTestApp.java   
@Override
protected SubScene getTopRightScene() {
    rootTRMV = buildGroupMover();
    rootTRMV.setRotateY(60);

    SubScene ss = new SubScene(rootTRMV.getGroup(), SS_WIDTH, SS_HEIGHT, true, SceneAntialiasing.DISABLED);
    ss.setCamera(new PerspectiveCamera());
    return ss;
}
项目:openjfx-8u-dev-tests    文件:SubSceneDepthTestApp.java   
@Override
protected SubScene getDownLeftScene() {
    rootDLMV = buildGroupMover();
    rootDLMV.setRotateY(-60);
    SubScene ss = new SubScene(rootDLMV.getGroup(), SS_WIDTH, SS_HEIGHT, true, SceneAntialiasing.DISABLED);
    ss.setCamera(new PerspectiveCamera());
    return ss;
}
项目:openjfx-8u-dev-tests    文件:SubSceneShape3DAbstractApp.java   
private SubScene getSubScene(int num) {
    Group root = cases[num].buildAll();
    cases[num].getGroupMover().translateXProperty().set(WIDTH / 4);
    cases[num].getGroupMover().translateYProperty().set(HEIGHT / 4);
    SubScene ss = new SubScene(root, HEIGHT / 2, WIDTH / 2, true, SceneAntialiasing.DISABLED);
    cases[num].addCamera(ss);
    ss.setFill(Color.GREEN);
    if (!isTest()) {
        cases[num].initRotation(ss);
    }
    return ss;
}
项目:openjfx-8u-dev-tests    文件:SubSceneBasicPropsTestApp.java   
@Override
protected SubScene getTopLeftScene() {
    SubScene ss = new SubScene(buildGroup(), SS_WIDTH, SS_HEIGHT, true, SceneAntialiasing.DISABLED);
    ss.setCamera(new PerspectiveCamera());
    scenes[0] = ss;
    return ss;
}
项目:openjfx-8u-dev-tests    文件:SubSceneBasicPropsTestApp.java   
@Override
protected SubScene getTopRightScene() {
    SubScene ss = new SubScene(buildGroup(), SS_WIDTH, SS_HEIGHT, true, SceneAntialiasing.DISABLED);
    ss.setCamera(new PerspectiveCamera());
    scenes[1] = ss;
    return ss;
}
项目:openjfx-8u-dev-tests    文件:SubSceneBasicPropsTestApp.java   
@Override
protected SubScene getDownLeftScene() {
    SubScene ss = new SubScene(buildGroup(), SS_WIDTH, SS_HEIGHT, true, SceneAntialiasing.DISABLED);
    ss.setCamera(new PerspectiveCamera());
    scenes[2] = ss;
    return ss;
}
项目:openjfx-8u-dev-tests    文件:FX3DTestBase.java   
protected void checkScreenshot(String name) {
        /*Will not work after RT-31878*/
//        if (getApplication().isAntiAliasingEnabled()) {
//            name += "-AintiAliasing";
//        }
        /*******************************************/
        /*Will work after RT-31878*/
        if(FX3DAbstractApp.getAntiAliasingMode() == SceneAntialiasing.BALANCED){
            name += "-AABALANCED";
        }
        /*******************************************/
        final String testName = getClass().getSimpleName() + "-" + name;
        ScreenshotUtils.checkScreenshot(testName, scene);
    }
项目:gluon-samples    文件:ContentModel.java   
private void buildSubScene() {
    root3D.getChildren().add(autoScalingGroup);

    subScene = new SubScene(root3D, paneW, paneH, true, SceneAntialiasing.BALANCED);
    subScene.setCamera(camera);
    subScene.setFill(Color.CADETBLUE);
    setListeners(true);
}
项目:mars-sim    文件:SpinningGlobe.java   
@Override
public void start(Stage primaryStage) throws Exception {
    primaryStage.setResizable(false);
    Parent globe = null;
    Scene scene = null;

    //if (OS.contains("window")) {
    //  globe = createFixedGlobe();
    //}
    //else {
        globe = createDraggingGlobe();
    //}

    StackPane root = new StackPane();
    root.setPrefHeight(WIDTH);
    root.setPrefWidth(HEIGHT);
    root.setStyle(//"-fx-border-style: none; "
                "-fx-background-color: transparent; "
                + "-fx-background-radius: 1px;");

    root.getChildren().add(globe);
    scene = new Scene(root, 640, 640, true, SceneAntialiasing.BALANCED);
    scene.setFill(Color.BLACK);

    //if (OS.contains("window")) {

    //}
    //else {
        // Add mouse and keyboard control
        getGlobe().handleMouse(root);
        getGlobe().handleKeyboard(root);
    //}

    primaryStage.setScene(scene);
    primaryStage.show();

}
项目:cirmlive    文件:CiRMLive3d.java   
public Parent createContent() {
    BorderPane p = new BorderPane();
    HBox btBox = new HBox(50, leftBt, lookLeftBt, forwardBt, upBt, downBt, backBt, lookRightBt, rightBt); 
    btBox.alignmentProperty().set(Pos.CENTER);
    p.setBottom(btBox);
    setUpButtons();
    PerspectiveCamera camera = new PerspectiveCamera(true);
    camera.getTransforms().add(cameraTranslate);
    camera.getTransforms().add(cameraRotate);
    camera.setFieldOfView(50);
    camera.setFarClip(10000);
    camera.setNearClip(1);
    p.setDepthTest(DepthTest.ENABLE);
    BorderPane cirmLiveUI = cirmLive.createSceneContent();
    cirmLiveUI.setCache(true);
    cirmLiveUI.setCacheShape(true);
    cirmLiveUI.setCacheHint(CacheHint.QUALITY);
    //cirmLiveUI.setSsetAlignment(camera, Pos.CENTER);
    //cirmLiveUI.setTranslateZ(500);
    //TODO root.getChildren().addAll(c, c2, c3);

    SubScene subScene = new SubScene(cirmLiveUI, 1600, 900, true, SceneAntialiasing.BALANCED);
    subScene.setFill(Color.CORAL);
    subScene.setCamera(camera);
    p.setCenter(subScene);       
    return p;
}
项目:cirmlive    文件:CiRMLive3d.java   
@Override
public void start(Stage primaryStage) throws Exception {
   setUserAgentStylesheet(STYLESHEET_CASPIAN);
    cirmLive = new CiRMLive();
    cirmLive.initClusterStats();
    Parent content = createContent();
    Scene topScene = new Scene(content, 1600, 900, true, SceneAntialiasing.BALANCED);
    topScene.setFill(Color.gray(0.1));
    primaryStage.setScene(topScene);
    primaryStage.setTitle(TITLE);
    primaryStage.setWidth(1600);
    primaryStage.setHeight(950);
    primaryStage.show();
    if (cirmLive.dateList.size() > 0) cirmLive.updateCurrentPieChart();
}
项目:FXyzLib    文件:Drag3DObject.java   
private void showStage(Stage stage) {
    Scene scene = new Scene(root, sceneWidth, sceneHeight, true, SceneAntialiasing.BALANCED);
    scene.setFill(Color.web("3d3d3d"));

    loadCamera(scene);
    loadControls(scene);

    stage.setTitle("F(X)yz Sample: 3D Dragging");
    stage.setScene(scene);
    stage.show();
}
项目:FXyzLib    文件:CameraViewTest.java   
@Override
public void start(Stage stage) throws Exception {

    loadSubScene();
    root.setStyle("-fx-background-color: DEEPSKYBLUE;");
    Scene scene = new Scene(root, 810,610, true, SceneAntialiasing.BALANCED);
    scene.setFill(Color.TRANSPARENT);

    stage.setTitle("MiniMapTest");
    stage.setScene(scene);
    //stage.initStyle(StageStyle.TRANSPARENT);
    stage.show();
    stage.setMaximized(true);
    cameraView.startViewing();
}
项目:classical-physics    文件:Space.java   
public Space(double size, Camera camera) {
    this.transform = new TransformGroup(this.createCenter(size));
    this.transform.rotate(30, -30); // 初期アングルを設定(ちょっと斜め上から見る感じ)

    this.mainView = new SubScene(this.transform.getGroup(), 1200, 750, true, SceneAntialiasing.BALANCED);
    this.mainView.setFill(Color.WHITE);

    this.mainView.addEventHandler(MouseEvent.MOUSE_PRESSED, this.mousePosition::save);
    this.mainView.addEventHandler(MouseEvent.MOUSE_DRAGGED, this::handleMouseDrag);

    this.mainView.setCamera(camera.getCamera());
    camera.moveBackAndFront(size * 2.5);
    this.camera = camera;
}
项目:FX3DAndroid    文件:ThreedApplication.java   
@Override
public void start(Stage stage) throws Exception {
    camera = new PerspectiveCamera(true);
    // setup camera transform for rotational support
    camera.setNearClip(0.1);
    camera.setFarClip(10000.0);
    camera.setTranslateZ(-20);
    makeYUp(camera);

    cameraTransform.setTranslate(0, 0, 0);
    cameraTransform.getChildren().add(camera);
    // cameraTransform.ry.setAngle(-45.0);
    // cameraTransform.rx.setAngle(-10.0);

    // add a Point Light for better viewing of the grid coordinate system
    PointLight point = new PointLight(Color.LIGHTSTEELBLUE);
    AmbientLight ambient = new AmbientLight(Color.LIGHTSKYBLUE);
    cameraTransform.getChildren().addAll(point, ambient);
    point.setTranslateX(camera.getTranslateX());
    point.setTranslateY(camera.getTranslateY());
    point.setTranslateZ(camera.getTranslateZ());

    Group group = new Group(cameraTransform);
    Group sceneRoot = new Group(group);
    Scene scene = new Scene(sceneRoot, sceneWidth, sceneHeight, true, SceneAntialiasing.BALANCED);
    this.pointLight = point;
    this.ambientLight = ambient;
    configSceneColor(scene, point, ambient, cameraTransform);

    scene.setCamera(camera);

    makeObjects(group);
    setActions(scene);
    lastEffect = System.nanoTime();
    AnimationTimer timerEffect = makeAnimation();
    stage.setScene(scene);
    stage.show();
    timerEffect.start();
}
项目:VRL-JFXVis    文件:Main.java   
/**Creates a 3D subscene with a perspectiveCamera, where the specified group node acts as the parent node of
   * the subscene. Dont forget to make the subscene scale with the size of the whole scene, by binding its size
   * (mySubscene.heightProperty().bind(myVBox.heightProperty()))
   **/
  private SubScene createScene3D(Group group,PerspectiveCamera camera) {
  SubScene scene3d = new SubScene(group, sceneWidth, sceneHeight, true, SceneAntialiasing.DISABLED);
  scene3d.setFill(Color.DARKGRAY.darker().darker().darker().darker());
  scene3d.setCamera(camera);

  return scene3d;

}
项目:SettlersJava    文件:MainWindow.java   
public SubScene drawUI(Group uiGroup){
    SubScene subscene = new SubScene(uiGroup, 500, 300, true, SceneAntialiasing.BALANCED);

    for (int i = 0; i < DevelopmentDeck.images.length; i++) {
        Canvas canvas = DevelopmentDeck.images[i];
        double scaleFactor = 50/canvas.getHeight();
        canvas.setScaleX(scaleFactor);
        canvas.setScaleY(scaleFactor);
        uiGroup.getChildren().add(canvas);
        canvas.relocate((canvas.getWidth()*scaleFactor) * (i - .5) , (canvas.getHeight()*scaleFactor) * -.5);
    }

    return subscene;
}
项目:AchillesFx    文件:AchillesFxScene.java   
public AchillesFxScene(Parent root, double width, double height, boolean depthBuffer, SceneAntialiasing antiAliasing) {
    super(root, width, height, depthBuffer, antiAliasing);
}
项目:openjfx-8u-dev-tests    文件:FX3DAbstractApp.java   
public static SceneAntialiasing getAntiAliasingMode(){
    return mode;
}
项目:openjfx-8u-dev-tests    文件:FX3DAbstractApp.java   
public static void setAntiAliasingMode(SceneAntialiasing md){
    mode = md;
}
项目:Antipleurdawn    文件:Main.java   
public void start(Stage stage) throws IOException
{
    Parent root = FXMLLoader.load(getClass().getResource("main.fxml"));

    Scene scene = new Scene(root, 710, 440, false, SceneAntialiasing.BALANCED);

    scene.getStylesheets().add("file:src/main.css");

    updatePlayerTypeBox(scene);

    board = (Board) scene.lookup("#board");
    new BoardOperator(board, client);

    BoardHandler handler = new BoardHandler(board, client, scene);
    PusherBinder binder = (new PusherBinder(client));
    binder.bind(handler);

    handler.onGameBooting(new GameBootedEvent(stage));

    stage.show();
}
项目:mars-sim    文件:Simple3DSphereApp.java   
public Parent createContent() throws Exception {

        Image dImage = new Image(Simple3DSphereApp.class.getResource("/maps/earth-d.jpg").toExternalForm());
        Image nImage = new Image(Simple3DSphereApp.class.getResource("/maps/earth-n.jpg").toExternalForm());
        Image sImage = new Image(Simple3DSphereApp.class.getResource("/maps/earth-s.jpg").toExternalForm());
        Image siImage = new Image(Simple3DSphereApp.class.getResource("/maps/earth-l.jpg").toExternalForm());

        material = new PhongMaterial();
        material.setDiffuseColor(Color.WHITE);
        material.diffuseMapProperty().bind(
                Bindings.when(diffuseMap).then(dImage).otherwise((Image) null));
        material.setSpecularColor(Color.TRANSPARENT);
        material.specularMapProperty().bind(
                Bindings.when(specularMap).then(sImage).otherwise((Image) null));
        material.bumpMapProperty().bind(
                Bindings.when(bumpMap).then(nImage).otherwise((Image) null));
        material.selfIlluminationMapProperty().bind(
                Bindings.when(selfIlluminationMap).then(siImage).otherwise((Image) null));

        earth = new Sphere(5);
        earth.setMaterial(material);
        earth.setRotationAxis(Rotate.Y_AXIS);


        // Create and position camera
        PerspectiveCamera camera = new PerspectiveCamera(true);
        camera.getTransforms().addAll(
                new Rotate(-20, Rotate.Y_AXIS),
                new Rotate(-20, Rotate.X_AXIS),
                new Translate(0, 0, -20));

        sun = new PointLight(Color.rgb(255, 243, 234));
        sun.translateXProperty().bind(sunDistance.multiply(-0.82));
        sun.translateYProperty().bind(sunDistance.multiply(-0.41));
        sun.translateZProperty().bind(sunDistance.multiply(-0.41));
        sun.lightOnProperty().bind(sunLight);

        AmbientLight ambient = new AmbientLight(Color.rgb(1, 1, 1));

        // Build the Scene Graph
        Group root = new Group();
        root.getChildren().add(camera);
        root.getChildren().add(earth);
        root.getChildren().add(sun);
        root.getChildren().add(ambient);

        RotateTransition rt = new RotateTransition(Duration.seconds(24), earth);
        rt.setByAngle(360);
        rt.setInterpolator(Interpolator.LINEAR);
        rt.setCycleCount(Animation.INDEFINITE);
        rt.play();

        // Use a SubScene
        SubScene subScene = new SubScene(root, 400, 300, true, SceneAntialiasing.BALANCED);
        subScene.setFill(Color.TRANSPARENT);
        subScene.setCamera(camera);

        return new Group(subScene);
    }
项目:FXyzLib    文件:CapsuleTest.java   
@Override
public void start(Stage stage) {

    Group capsuleGroup = new Group();        
    for (int i = 0; i < 50; i++) {
        Random r = new Random();
        //A lot of magic numbers in here that just artificially constrain the math
        float randomRadius = (float) ((r.nextFloat() * 100) + 25);
        float randomHeight = (float) ((r.nextFloat() * 300) + 75);
        Color randomColor = new Color(r.nextDouble(), r.nextDouble(), r.nextDouble(), r.nextDouble());

        Capsule cap = new Capsule(randomRadius, randomHeight, randomColor);               
        cap.setEmissiveLightingColor(randomColor);
        cap.setEmissiveLightingOn(r.nextBoolean());
        cap.setDrawMode(r.nextBoolean() ? DrawMode.FILL : DrawMode.LINE);

        double translationX = Math.random() * 1024 * 1.95;
        if (Math.random() >= 0.5) {
            translationX *= -1;
        }
        double translationY = Math.random() * 1024 * 1.95;
        if (Math.random() >= 0.5) {
            translationY *= -1;
        }
        double translationZ = Math.random() * 1024 * 1.95;
        if (Math.random() >= 0.5) {
            translationZ *= -1;
        }
        Translate translate = new Translate(translationX, translationY, translationZ);
        Rotate rotateX = new Rotate(Math.random() * 360, Rotate.X_AXIS);
        Rotate rotateY = new Rotate(Math.random() * 360, Rotate.Y_AXIS);
        Rotate rotateZ = new Rotate(Math.random() * 360, Rotate.Z_AXIS);

        cap.getTransforms().addAll(translate, rotateX, rotateY, rotateZ);

        capsuleGroup.getChildren().add(cap);
    }

    root.getChildren().add(capsuleGroup);

    camera = new AdvancedCamera();
    controller = new FPSController();

    camera.setNearClip(0.1);
    camera.setFarClip(10000.0);
    camera.setFieldOfView(42);
    camera.setController(controller);

    Scene scene = new Scene(new StackPane(root), 1024, 668, true, SceneAntialiasing.BALANCED);
    scene.setCamera(camera);
    scene.setFill(Color.BLACK);

    controller.setScene(scene);

    stage.setTitle("Hello World!");
    stage.setScene(scene);
    stage.show();
    stage.setFullScreen(true);
    stage.setFullScreenExitHint("");
}
项目:FXyzLib    文件:FPSControllerTest.java   
@Override
public void start(Stage stage) {
    Group root = new Group();
    //Make a bunch of semi random Torusesessses(toroids?) and stuff : from torustest
    Group torusGroup = new Group();
    for (int i = 0; i < 30; i++) {
        Random r = new Random();
        //A lot of magic numbers in here that just artificially constrain the math
        float randomRadius = (float) ((r.nextFloat() * 300) + 50);
        float randomTubeRadius = (float) ((r.nextFloat() * 100) + 1);
        int randomTubeDivisions = (int) ((r.nextFloat() * 64) + 1);
        int randomRadiusDivisions = (int) ((r.nextFloat() * 64) + 1);
        Color randomColor = new Color(r.nextDouble(), r.nextDouble(), r.nextDouble(), r.nextDouble());

        Torus torus = new Torus(randomTubeDivisions, randomRadiusDivisions, randomRadius, randomTubeRadius, randomColor);
        torus.setEmissiveLightingColor(randomColor);
        torus.setEmissiveLightingOn(r.nextBoolean());

        double translationX = Math.random() * 1024 * 1.95;
        if (Math.random() >= 0.5) {
            translationX *= -1;
        }
        double translationY = Math.random() * 1024 * 1.95;
        if (Math.random() >= 0.5) {
            translationY *= -1;
        }
        double translationZ = Math.random() * 1024 * 1.95;
        if (Math.random() >= 0.5) {
            translationZ *= -1;
        }
        Translate translate = new Translate(translationX, translationY, translationZ);
        Rotate rotateX = new Rotate(Math.random() * 360, Rotate.X_AXIS);
        Rotate rotateY = new Rotate(Math.random() * 360, Rotate.Y_AXIS);
        Rotate rotateZ = new Rotate(Math.random() * 360, Rotate.Z_AXIS);

        torus.getTransforms().addAll(translate, rotateX, rotateY, rotateZ);
        //torus.getTransforms().add(translate);
        torusGroup.getChildren().add(torus);

    }
    root.getChildren().add(torusGroup);


    Scene scene = new Scene(root, 1400, 1000, true, SceneAntialiasing.BALANCED);
    scene.setFill(Color.BLACK);

    stage.setTitle("SimpleFPSControllerTest");
    stage.setScene(scene);
    stage.show();
    //stage.setMaximized(true);

    FPSController controller = new FPSController();
    controller.setScene(scene);
    controller.setMouseLookEnabled(true);

    AdvancedCamera camera = new AdvancedCamera();
    camera.setController(controller);

    root.getChildren().add(camera);

    scene.setCamera(camera);
}
项目:FXyzLib    文件:ConeTest.java   
@Override
public void start(Stage stage) {

    Group coneGroup = new Group();        
    for (int i = 0; i < 100; i++) {
        Random r = new Random();
        //A lot of magic numbers in here that just artificially constrain the math
        float randomRadius = (float) ((r.nextFloat()*100) + 25);
        float randomHeight = (float) ((r.nextFloat()*300)+ 75);
        int randomDivisions = (int) ((r.nextFloat()*50) + 5);
        Color randomColor = new Color(r.nextDouble(), r.nextDouble(), r.nextDouble(), r.nextDouble());

        Cone cone = new Cone(randomDivisions, randomRadius, randomHeight, randomColor);               
        cone.setEmissiveLightingColor(randomColor);
        cone.setEmissiveLightingOn(r.nextBoolean());
        cone.setDrawMode(r.nextBoolean() ? DrawMode.FILL : DrawMode.LINE);

        double translationX = Math.random() * 1024;
        if (Math.random() >= 0.5) {
            translationX *= -1;
        }
        double translationY = Math.random() * 1024;
        if (Math.random() >= 0.5) {
            translationY *= -1;
        }
        double translationZ = Math.random() * 1024;
        if (Math.random() >= 0.5) {
            translationZ *= -1;
        }
        Translate translate = new Translate(translationX, translationY, translationZ);
        Rotate rotateX = new Rotate(Math.random() * 360, Rotate.X_AXIS);
        Rotate rotateY = new Rotate(Math.random() * 360, Rotate.Y_AXIS);
        Rotate rotateZ = new Rotate(Math.random() * 360, Rotate.Z_AXIS);

        cone.getTransforms().addAll(translate, rotateX, rotateY, rotateZ);

        coneGroup.getChildren().add(cone);
    }
    root.getChildren().add(coneGroup);

    camera = new AdvancedCamera();
    controller = new FPSController();

    camera.setNearClip(0.1);
    camera.setFarClip(10000.0);
    camera.setFieldOfView(42);
    camera.setController(controller);

    Scene scene = new Scene(new StackPane(root), 1024, 668, true, SceneAntialiasing.BALANCED);
    scene.setCamera(camera);
    scene.setFill(Color.BLACK);

    controller.setScene(scene);

    stage.setTitle("Random Cones!");
    stage.setScene(scene);
    stage.show();
    stage.setFullScreen(false);
    stage.setFullScreenExitHint("");
}
项目:FXyzLib    文件:ScatterPlotTest.java   
@Override
public void start(Stage primaryStage) throws Exception {
    Group sceneRoot = new Group();
    Scene scene = new Scene(sceneRoot, sceneWidth, sceneHeight, true, SceneAntialiasing.BALANCED);
    scene.setFill(Color.BLACK);
    camera = new PerspectiveCamera(true);        
    camera.setNearClip(0.1);
    camera.setFarClip(10000.0);
    camera.setTranslateZ(-1000);
    scene.setCamera(camera);

    scatterPlot = new ScatterPlot(1000, 1, true);
    sceneRoot.getChildren().addAll(scatterPlot);

    ArrayList<Double> dataX = new ArrayList<>();
    ArrayList<Double> dataY = new ArrayList<>();
    ArrayList<Double> dataZ = new ArrayList<>();
    for(int i=-250;i<250;i++) {
        dataX.add(new Double(i));
        dataY.add(new Double(Math.sin(i)*50)+i);
        dataZ.add(new Double(Math.cos(i)*50)+i);
    }

    scatterPlot.setXYZData(dataX, dataY, dataZ);

    scene.setOnKeyPressed(event -> {
        double change = 10.0;
        //Add shift modifier to simulate "Running Speed"
        if(event.isShiftDown()) { change = 50.0; }
        //What key did the user press?
        KeyCode keycode = event.getCode();
        //Step 2c: Add Zoom controls
        if(keycode == KeyCode.W) { camera.setTranslateZ(camera.getTranslateZ() + change); }
        if(keycode == KeyCode.S) { camera.setTranslateZ(camera.getTranslateZ() - change); }
        //Step 2d:  Add Strafe controls
        if(keycode == KeyCode.A) { camera.setTranslateX(camera.getTranslateX() - change); }
        if(keycode == KeyCode.D) { camera.setTranslateX(camera.getTranslateX() + change); }
    });        

    //Add a Mouse Handler for Rotations
    Rotate xRotate = new Rotate(0, Rotate.X_AXIS);
    Rotate yRotate = new Rotate(0, Rotate.Y_AXIS);
    Rotate zRotate = new Rotate(0, Rotate.Z_AXIS);

    scatterPlot.getTransforms().addAll(xRotate, yRotate);
    //Use Binding so your rotation doesn't have to be recreated
    xRotate.angleProperty().bind(angleX);
    yRotate.angleProperty().bind(angleY);
    zRotate.angleProperty().bind(angleZ);

    //Start Tracking mouse movements only when a button is pressed
    scene.setOnMousePressed(event -> {
        scenex = event.getSceneX();
        sceney = event.getSceneY();
        fixedXAngle = angleX.get();
        fixedYAngle = angleY.get();
        if(event.isMiddleButtonDown()) {
            scenez = event.getSceneX();
            fixedZAngle = angleZ.get();
        }

    });
    //Angle calculation will only change when the button has been pressed
    scene.setOnMouseDragged(event -> {
        if(event.isMiddleButtonDown()) 
            angleZ.set(fixedZAngle - (scenez - event.getSceneY()));
        else
            angleX.set(fixedXAngle - (scenex - event.getSceneY()));


        angleY.set(fixedYAngle + sceney - event.getSceneX());
    });        

    primaryStage.setTitle("F(X)yz ScatterPlotTest");
    primaryStage.setScene(scene);
    primaryStage.show();        
}
项目:FXyzLib    文件:PolyLine3DTest.java   
@Override
public void start(Stage primaryStage) throws Exception {
    Group sceneRoot = new Group();
    Scene scene = new Scene(sceneRoot, sceneWidth, sceneHeight, true, SceneAntialiasing.BALANCED);
    scene.setFill(Color.BLACK);
    camera = new PerspectiveCamera(true);        
    camera.setNearClip(0.1);
    camera.setFarClip(10000.0);
    camera.setTranslateZ(-1000);
    scene.setCamera(camera);

    ArrayList<Point3D> points = new ArrayList<>();
    for(int i=-250;i<250;i++) {
        points.add(new Point3D(
                    (float) i,
                    (float) Math.sin(i)*50+i,
                    (float) Math.cos(i)*50+i));
    }
    polyLine3D = new PolyLine3D(points,3,Color.STEELBLUE);    
    sceneRoot.getChildren().addAll(polyLine3D);

    scene.setOnKeyPressed(event -> {
        double change = 10.0;
        //Add shift modifier to simulate "Running Speed"
        if(event.isShiftDown()) { change = 50.0; }
        //What key did the user press?
        KeyCode keycode = event.getCode();
        //Step 2c: Add Zoom controls
        if(keycode == KeyCode.W) { camera.setTranslateZ(camera.getTranslateZ() + change); }
        if(keycode == KeyCode.S) { camera.setTranslateZ(camera.getTranslateZ() - change); }
        //Step 2d:  Add Strafe controls
        if(keycode == KeyCode.A) { camera.setTranslateX(camera.getTranslateX() - change); }
        if(keycode == KeyCode.D) { camera.setTranslateX(camera.getTranslateX() + change); }
    });        

    //Add a Mouse Handler for Rotations
    Rotate xRotate = new Rotate(0, Rotate.X_AXIS);
    Rotate yRotate = new Rotate(0, Rotate.Y_AXIS);
    Rotate zRotate = new Rotate(0, Rotate.Z_AXIS);

    polyLine3D.getTransforms().addAll(xRotate, yRotate);
    //Use Binding so your rotation doesn't have to be recreated
    xRotate.angleProperty().bind(angleX);
    yRotate.angleProperty().bind(angleY);
    zRotate.angleProperty().bind(angleZ);

    //Start Tracking mouse movements only when a button is pressed
    scene.setOnMousePressed(event -> {
        scenex = event.getSceneX();
        sceney = event.getSceneY();
        fixedXAngle = angleX.get();
        fixedYAngle = angleY.get();
        if(event.isMiddleButtonDown()) {
            scenez = event.getSceneX();
            fixedZAngle = angleZ.get();
        }

    });
    //Angle calculation will only change when the button has been pressed
    scene.setOnMouseDragged(event -> {
        if(event.isMiddleButtonDown()) 
            angleZ.set(fixedZAngle - (scenez - event.getSceneY()));
        else
            angleX.set(fixedXAngle - (scenex - event.getSceneY()));
        angleY.set(fixedYAngle + sceney - event.getSceneX());
    });        

    primaryStage.setTitle("F(X)yz ScatterPlotTest");
    primaryStage.setScene(scene);
    primaryStage.show();        
}
项目:FXyzLib    文件:BillBoardBehaviorTest.java   
private void createSubscene(){        
    subScene = new SubScene(root, 800, 600, true, SceneAntialiasing.BALANCED);

    camera = new PerspectiveCamera(true);
    cameraTransform.setTranslate(0, 0, 0);
    cameraTransform.getChildren().addAll(camera);
    camera.setNearClip(0.1);
    camera.setFarClip(100000.0);
    camera.setFieldOfView(35);
    camera.setTranslateZ(-cameraDistance);
    cameraTransform.ry.setAngle(-45.0);
    cameraTransform.rx.setAngle(-10.0);
    //add a Point Light for better viewing of the grid coordinate system
    PointLight light = new PointLight(Color.WHITE);

    cameraTransform.getChildren().add(light);
    light.setTranslateX(camera.getTranslateX());
    light.setTranslateY(camera.getTranslateY());
    light.setTranslateZ(camera.getTranslateZ());

    root.getChildren().add(cameraTransform);
    subScene.setCamera(camera);

    initFirstPersonControls(subScene);

    skyBox = new Skybox(new Image("http://www.zfight.com/misc/images/textures/envmaps/violentdays_large.jpg"), 100000, camera);      

    //Make a bunch of semi random Torusesessses(toroids?) and stuff : from torustest
    Group torusGroup = new Group();        
    for (int i = 0; i < 10; i++) {
        Random r = new Random();
        //A lot of magic numbers in here that just artificially constrain the math
        float randomRadius = (float) ((r.nextFloat() * 300) + 50);
        float randomTubeRadius = (float) ((r.nextFloat() * 100) + 1);
        int randomTubeDivisions = (int) ((r.nextFloat() * 64) + 1);
        int randomRadiusDivisions = (int) ((r.nextFloat() * 64) + 1);
        Color randomColor = new Color(r.nextDouble(), r.nextDouble(), r.nextDouble(), r.nextDouble());
        boolean ambientRandom = r.nextBoolean();
        boolean fillRandom = r.nextBoolean();

        if(i == 0){                
            torusGroup.getChildren().add(bill);
        }
        TorusMesh torus = new TorusMesh(randomTubeDivisions, randomRadiusDivisions, randomRadius, randomTubeRadius);

        double translationX = Math.random() * 1024 * 1.95;
        if (Math.random() >= 0.5) {
            translationX *= -1;
        }
        double translationY = Math.random() * 1024 * 1.95;
        if (Math.random() >= 0.5) {
            translationY *= -1;
        }
        double translationZ = Math.random() * 1024 * 1.95;
        if (Math.random() >= 0.5) {
            translationZ *= -1;
        }
        Translate translate = new Translate(translationX, translationY, translationZ);
        Rotate rotateX = new Rotate(Math.random() * 360, Rotate.X_AXIS);
        Rotate rotateY = new Rotate(Math.random() * 360, Rotate.Y_AXIS);
        Rotate rotateZ = new Rotate(Math.random() * 360, Rotate.Z_AXIS);

        torus.getTransforms().addAll(translate, rotateX, rotateY, rotateZ);
        //torus.getTransforms().add(translate);
        torusGroup.getChildren().add(torus);
    }
    root.getChildren().addAll(skyBox, torusGroup);

    rootPane.getChildren().add(subScene);
    //Enable subScene resizing
    subScene.widthProperty().bind(rootPane.widthProperty());
    subScene.heightProperty().bind(rootPane.heightProperty());
    subScene.setFocusTraversable(true);

}