@Override public Node mkRoot() { try { Parent node = FXMLLoader.load(getClass().getResource("/ComplexScene.fxml")); node.setPickOnBounds(true); node.setMouseTransparent(true); WebView webview = (WebView) node.lookup("webview"); if(webview != null){ webview.getEngine().load("http://purecss3.net/doraemon/doraemon_css3.html"); } GesturePane pane = new GesturePane(new SubScene(node, 500, 500)); VBox.setVgrow(pane, Priority.ALWAYS); Label description = new Label("Zoom and scroll on the SubScene below, " + "observe that controls in JavaFX are vectors " + "and that lighting effects are respected" + "(different zoom alters light distance)."); description.setWrapText(true); description.setPadding(new Insets(16)); return new VBox(description, pane); } catch (IOException e) { throw new RuntimeException(e); } }
@Override protected VBox getControlsForSubScene(SubScene ss) { GroupMover targetMover; if(ss.getRoot() == rootDLMV.getGroup()){ targetMover = rootDLMV; }else if(ss.getRoot() == rootTLMV.getGroup()){ targetMover = rootTLMV; }else if(ss.getRoot() == rootTRMV.getGroup()){ targetMover = rootTRMV; }else{ throw new IllegalArgumentException("SubScene does not applicable to this application"); } ScrollBar rotYBar = new ScrollBar(); VBox controls = new VBox(new HBox(new Label("Rotate"),rotYBar)); rotYBar.setMin(-360); rotYBar.setMax(360); rotYBar.setValue(targetMover.rotateYProperty().get()); rotYBar.valueProperty().bindBidirectional(targetMover.rotateYProperty()); return controls; }
public Parent createDraggingGlobe() { boolean support = Platform.isSupported(ConditionalFeature.SCENE3D); if (support) logger.info("JavaFX 3D features supported"); else logger.info("JavaFX 3D features NOT supported"); globe = new Globe(); rotateGlobe(); // Use a SubScene subScene = new SubScene(globe.getRoot(), WIDTH, HEIGHT);//, true, SceneAntialiasing.BALANCED); subScene.setId("sub"); subScene.setCamera(globe.getCamera());//subScene)); //return new Group(subScene); return new HBox(subScene); }
public CameraView(SubScene scene) { // Make sure "world" is a group assert scene.getRoot().getClass().equals(Group.class); worldToView = (Group)scene.getRoot(); // cameraTransform.setTranslate(0, 0, -500); camera.setNearClip(0.1); camera.setFarClip(15000.0); camera.setTranslateZ(-1500); // cameraTransform.ry.setAngle(-45.0); // cameraTransform.rx.setAngle(-10.0); params.setCamera(camera); params.setDepthBuffer(true); params.setFill(Color.rgb(0, 0, 0, 0.5)); viewTimer = new AnimationTimer() { @Override public void handle(long now) { redraw(); } }; }
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); }
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; }
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Settlers of Catan"); Group root = new Group(); GameGroup game = new GameGroup(); Group cameraGroup = new Group(); Group uiGroup = new Group(); game.addTiles(); SubScene uiScene = drawUI(uiGroup); SubScene cameraScene = setupCamera(cameraGroup); root.getChildren().addAll(cameraScene, uiScene); cameraGroup.getChildren().add(game); Scene scene = new Scene(root); primaryStage.setScene(scene); primaryStage.show(); }
public ViewPane(MyGraphView graphView) { // Setup Main Pane AnchorPane.setBottomAnchor(this, 0.0); AnchorPane.setTopAnchor(this, 0.0); AnchorPane.setLeftAnchor(this, 0.0); AnchorPane.setRightAnchor(this, 0.0); this.setStyle("-fx-background-color : whitesmoke"); // Create new scene with graphView this.myGraphView = graphView; bottomPane = new Pane(); topPane = new Pane(); topPane.setPickOnBounds(false); stackPane = new StackPane(bottomPane, myGraphView, topPane); viewScene = new SubScene(stackPane, this.getWidth(), this.getHeight()); viewScene.widthProperty().bind(this.widthProperty()); viewScene.heightProperty().bind(this.heightProperty()); viewScene.setPickOnBounds(false); // Add StackPane in SubScene and add content. getChildren().addAll(viewScene); // Bind LayoutWidth to this here myGraphView.animationService.widthProperty.bind(this.widthProperty()); myGraphView.animationService.heightProperty.bind(this.heightProperty()); hoverInfo = new SimpleStringProperty(""); this.groupNodeInitLocation = new HashMap<>(); // Setup interactions and view elements setupTransforms(); initRectangle(); addMouseInteractions(); }
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; }
@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; }
@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; }
@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; }
@Override protected Camera addCamera(SubScene scene) { PerspectiveCamera pc = new PerspectiveCamera(true); scene.setCamera(pc); pc.setFarClip(10000); return pc; }
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; }
@Override protected VBox getControlsForSubScene(SubScene ss) { ShapesTestCase stc = null; if (ss.equals(scenes[0])) { stc = cases[0]; } else if (ss.equals(scenes[1])) { stc = cases[1]; } else { stc = cases[2]; } return new VBox(stc.getControlPane(), stc.getShapePane()); }
@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; }
@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; }
@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; }
private boolean setFill(SubScene ss, Color color) { Paint fill = ss.getFill(); if (fill == color) { return true; } ss.setFill(color); return color != fill; }
private boolean setWidth(SubScene ss, double d) { double old = ss.getWidth(); if (old == d) { return true; } ss.setWidth(d); return old != ss.getWidth(); }
private boolean setHeight(SubScene ss, double d) { double old = ss.getHeight(); if (old == d) { return true; } ss.setHeight(d); return old != ss.getHeight(); }
private SubScene buildGroup(int num) { Sphere s = new Sphere(50); nodes[num] = s; Group grp = new Group(s); grp.setTranslateX(SS_WIDTH / 2); grp.setTranslateY(SS_HEIGHT / 2); roots[num] = grp; SubScene ss = createSubScene(grp, SS_WIDTH, SS_HEIGHT); ss.setCamera(new PerspectiveCamera()); return ss; }
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); }
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; }
private void setEventHandlers(SubScene scene) { scene.addEventHandler(KeyEvent.ANY, k -> handleKeyEvent(k)); scene.addEventHandler(MouseEvent.ANY, m -> handleMouseEvent(m)); scene.addEventHandler(ScrollEvent.ANY, s -> handleScrollEvent(s)); }
public CameraView(SubScene scene) { // Make sure "world" is a group assert scene.getRoot().getClass().equals(Group.class); worldToView = (Group)scene.getRoot(); camera = new PerspectiveCamera(true); // cameraTransform.setTranslate(0, 0, -500); cameraTransform.getChildren().add(camera); camera.setNearClip(0.1); camera.setFarClip(15000.0); camera.setTranslateZ(-1500); // cameraTransform.ry.setAngle(-45.0); // cameraTransform.rx.setAngle(-10.0); params.setCamera(camera); params.setDepthBuffer(true); params.setFill(Color.rgb(0, 0, 0, 0.5)); viewTimer = new AnimationTimer() { @Override public void handle(long now) { redraw(); } }; }
@Test public void testGetSubSceneAdjuster() { Adjuster adjuster = Adjuster.getAdjuster(SubScene.class); assertThat(adjuster, is(instanceOf(NodeAdjuster.class))); assertThat(adjuster.getNodeClass(), is(sameInstance(Node.class))); }
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; }
private void buildSubScene() { root3D.getChildren().add(autoScalingGroup); subScene = new SubScene(root3D,paneW,paneH,true,javafx.scene.SceneAntialiasing.BALANCED); subScene.setCamera(camera); subScene.setFill(Color.CADETBLUE); setListeners(true); }
/**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; }
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; }
public SubScene getView() { if(currentMap != null) return new MapCreatorView(this, currentMap); else return new MapCreatorView(this); }
public SubScene getView() { return new ProductManagerView(this); }
public SubScene getView() { return new ClientManagerView(this); }
public SubScene getView() { return new StatisticsView(this); }
public SubScene getView() { return new IncidentsManagerView(this); }
public SubScene getView() { return new SupplierManagerView(this); }