當前位置: 首頁>>代碼示例>>Java>>正文


Java PerspectiveCamera類代碼示例

本文整理匯總了Java中javafx.scene.PerspectiveCamera的典型用法代碼示例。如果您正苦於以下問題:Java PerspectiveCamera類的具體用法?Java PerspectiveCamera怎麽用?Java PerspectiveCamera使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PerspectiveCamera類屬於javafx.scene包,在下文中一共展示了PerspectiveCamera類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: showMasterDetailInWindow

import javafx.scene.PerspectiveCamera; //導入依賴的package包/類
private void showMasterDetailInWindow(final Stage stage, final Database database, final MasterDetailViewFeatures features) throws JAXBException, IOException {
    final Parent viewRoot = ViewFactory.createMasterDetailView(database, features);

    final Rectangle clip = new Rectangle();
    clip.setArcHeight(18);
    clip.setArcWidth(18);
    clip.widthProperty().bind(stage.widthProperty());
    clip.heightProperty().bind(stage.heightProperty());

    //TODO: Only clipping or PerspectiveCamera is working... :(
    features.customWindowClipProperty().addListener((obs, oldVal, newVal) -> {
        if (newVal) {
            viewRoot.setClip(clip);
        } else {
            viewRoot.setClip(null);
        }
    });

    final Scene scene = new Scene(viewRoot);

    features.useCssProperty().addListener((obs, oldVal, newVal) -> {
        updateStylesheets(scene, newVal);
    });

    updateStylesheets(scene, features.isUseCss());

    scene.setFill(Color.TRANSPARENT);
    scene.setCamera(new PerspectiveCamera());

    if (features.isCustomWindowUI()) {
        stage.initStyle(StageStyle.TRANSPARENT);
    }

    stage.setTitle("Movie Database");
    stage.setScene(scene);
    stage.setWidth(1100);
    stage.setHeight(720);
    stage.centerOnScreen();
    stage.show();

    final FeaturesDialog featuresDialog = new FeaturesDialog(stage);
    featuresDialog.addFeature(new Feature("Layout & Style", "demo2-css", features.useCssProperty()));
    featuresDialog.addFeature(new Feature("Image Background", "demo2-image-background",features.movieBackgroundProperty()));
    featuresDialog.addFeature(new Feature("List Animation", "demo2-list-animation",features.listAnimationProperty()));
    featuresDialog.addFeature(new Feature("List Shadow", "demo2-list-shadow",features.listShadowProperty()));
    // featuresDialog.addFeature(new Feature("List Cache", "demo2-list-cache",features.listCacheProperty()));
    featuresDialog.addFeature(new Feature("Poster Transform", "demo2-poster-transform",features.posterTransformProperty()));
    featuresDialog.addFeature(new Feature("Custom Window UI", "demo2-custom-window-ui",features.customWindowUIProperty()));
    featuresDialog.addFeature(new Feature("Custom Window Clip", "demo2-custom-window-clip", features.customWindowClipProperty()));
    featuresDialog.show();
}
 
開發者ID:hendrikebbers,項目名稱:ExtremeGuiMakeover,代碼行數:52,代碼來源:MovieApp.java

示例2: interpolate

import javafx.scene.PerspectiveCamera; //導入依賴的package包/類
@Override
protected void interpolate(double d) {
    if (first) { // setup
        flipNode.setRotationAxis(Rotate.Y_AXIS);
        oldCamera = flipNode.getScene().getCamera();
        flipNode.getScene().setCamera(new PerspectiveCamera());
        first = false;
    }
    super.interpolate(d);
    if (d == 1) { // restore
        first = true;
        flipNode.setRotate(0);
        flipNode.setRotationAxis(Rotate.Z_AXIS);
        flipNode.getScene().setCamera(oldCamera);
    }
}
 
開發者ID:EricCanull,項目名稱:fxexperience2,代碼行數:17,代碼來源:FlipTransition.java

示例3: start

import javafx.scene.PerspectiveCamera; //導入依賴的package包/類
@Override
public void start(Stage stage) {        
    BorderPane pane = new BorderPane(flipPanel);
    pane.setPrefSize(400, 250);
    pane.setPadding(new Insets(50, 50, 50, 50));
    pane.setBackground(new Background(new BackgroundFill(Color.rgb(68, 68, 68), CornerRadii.EMPTY, Insets.EMPTY)));

    PerspectiveCamera camera = new PerspectiveCamera(false);
    camera.setFieldOfView(20);

    Scene scene = new Scene(pane);
    scene.setCamera(camera);
    scene.getStylesheets().add(Demo.class.getResource("styles.css").toExternalForm());

    stage.setTitle("FlipPanel Demo");
    stage.setScene(scene);
    stage.show();
}
 
開發者ID:Naoghuman,項目名稱:Incubator,代碼行數:19,代碼來源:Demo.java

示例4: loadCamera

import javafx.scene.PerspectiveCamera; //導入依賴的package包/類
private void loadCamera(Scene scene) {
	//initialize camera 
	camera = new PerspectiveCamera(true);
	camera.setVerticalFieldOfView(RUN_JASON);

	//setup camera transform for rotational support 
	cameraTransform.setTranslate(0, 0, 0);
	cameraTransform.getChildren().add(camera);
	camera.setNearClip(0.1);
	camera.setFarClip(100000.0);
	camera.setTranslateZ(-5000);
	cameraTransform.ry.setAngle(0.0);
	cameraTransform.rx.setAngle(-45.0);

	//add a Point Light for better viewing of the grid coordinate system 
	PointLight light = new PointLight(Color.GAINSBORO);
	cameraTransform.getChildren().add(light);
	cameraTransform.getChildren().add(new AmbientLight(Color.WHITE));
	light.setTranslateX(camera.getTranslateX());
	light.setTranslateY(camera.getTranslateY());
	light.setTranslateZ(camera.getTranslateZ());
	//attach camera to scene 
	scene.setCamera(camera);

}
 
開發者ID:callakrsos,項目名稱:Gargoyle,代碼行數:26,代碼來源:Drag3DObject.java

示例5: initScene

import javafx.scene.PerspectiveCamera; //導入依賴的package包/類
@Override
protected void initScene() {
    DefaultMeshBuilder dmb = new DefaultMeshBuilder() {

        @Override
        protected double function(double fx, double fy) {
            return 1;
        }
    };
    MeshView meshView = new MeshView(dmb.getTriangleMesh());
    meshView.setScaleX(100);
    meshView.setScaleY(100);
    meshView.setScaleZ(100);
    Sphere s = new Sphere(50);
    s.setTranslateX(WIDTH / 2);
    s.setTranslateY(HEIGHT / 2);
    Group root = new Group(s, meshView);
    scene = createScene(root, WIDTH, HEIGHT);
    scene.setCamera(new PerspectiveCamera());
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:21,代碼來源:SystemTestApp.java

示例6: LocalTo_TransformsScene

import javafx.scene.PerspectiveCamera; //導入依賴的package包/類
public LocalTo_TransformsScene()
{
    super(hBox, 150, 150, true);
    setCamera(new PerspectiveCamera());

    StackPane firstPane = new StackPane();
    StackPane secondPane = new StackPane();
    StackPane thirdPane = new StackPane();
    StackPane nestedPane = new StackPane();
    StackPane doubleNestedPane = new StackPane();
    StackPane forthPane = new StackPane();

    Circle circle1 = CircleBuilder.create().radius(20).id("circle_one").build();
    Circle circle2 = CircleBuilder.create().radius(20).id("circle_two").build();
    Circle circle3 = CircleBuilder.create().radius(20).id("circle_three").build();
    Circle circle4 = CircleBuilder.create().radius(20).id("circle_four").translateZ(-50).build();

    forthPane.getChildren().add(circle4);
    doubleNestedPane.getChildren().add(circle3);
    nestedPane.getChildren().add(doubleNestedPane);
    thirdPane.getChildren().add(nestedPane);
    secondPane.getChildren().add(circle2);
    firstPane.getChildren().add(circle1);
    hBox.getChildren().addAll(firstPane, secondPane, thirdPane, forthPane);
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:26,代碼來源:LocalTo_TransformsApp.java

示例7: Scene3D

import javafx.scene.PerspectiveCamera; //導入依賴的package包/類
public Scene3D(Parent parent, double width, double height) {
//    super(new Group(parent), width, height, true);  // see http://javafx-jira.kenai.com/browse/RT-22696
    super(new Group(parent), width, height);


     if (true == Platform.isSupported(ConditionalFeature.SCENE3D)) {
         setCamera(new PerspectiveCamera());

         Translate centerTranslate = new Translate();
         centerTranslate.xProperty().bind(widthProperty().divide(2));
         centerTranslate.yProperty().bind(heightProperty().divide(2));

         getRoot().getTransforms().addAll(centerTranslate, translateZ, rotateX, rotateY, translateY);
       //  getRoot().setDepthTest(DepthTest.ENABLE);// see http://javafx-jira.kenai.com/browse/RT-22696
     }

 }
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:18,代碼來源:Scene3D.java

示例8: start

import javafx.scene.PerspectiveCamera; //導入依賴的package包/類
@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();
}
 
開發者ID:mars-sim,項目名稱:mars-sim,代碼行數:23,代碼來源:MarsViewer.java

示例9: checkCamera

import javafx.scene.PerspectiveCamera; //導入依賴的package包/類
/**
 * Check that the camera is added to the parent INode's JavaFX node
 * correctly.
 */
@Test
public void checkCamera() {

	// Create a camera, an attachment containing that camera, and the node
	Camera camera = new PerspectiveCamera();
	FXCameraAttachment attachment = new FXCameraAttachment(camera);
	GNode node = new GNode();
	Group fxNode = new Group();
	node.setProperty(INode.RENDERER_NODE_PROP, fxNode);

	// Check that the attachment has the camera
	assertTrue(attachment.getFxCamera() == camera);

	// Attach to the node and check that the camera has been added to the
	// JavaFX node
	attachment.attach(node);
	assertTrue(Util.getFxGroup(node).getChildren().contains(camera));

	// Detach from the node and check that the camera has been removed from
	// the JavaFX node.
	attachment.detach(node);
	assertFalse(Util.getFxGroup(node).getChildren().contains(camera));
}
 
開發者ID:eclipse,項目名稱:eavp,代碼行數:28,代碼來源:FXCameraAttachmentTester.java

示例10: createDefaultCamera

import javafx.scene.PerspectiveCamera; //導入依賴的package包/類
/**
 * <p>
 * Creates the current geometry editor camera.
 * </p>
 * 
 * @param parent
 *            the parent to create the camera on
 * 
 */
protected void createDefaultCamera(Group parent) {
	PerspectiveCamera perspCamera = new PerspectiveCamera(true);
	perspCamera.setNearClip(0.1);
	perspCamera.setFarClip(4000.0);
	perspCamera.setFieldOfView(35);
	perspCamera.setTranslateX(0);
	perspCamera.setTranslateY(0);

	parent.getChildren().add(perspCamera);

	// Hacked in camera (for now)
	FXCameraAttachment cameraAttachment = new FXCameraAttachment(
			perspCamera);
	setCamera(cameraAttachment);
}
 
開發者ID:eclipse,項目名稱:eavp,代碼行數:25,代碼來源:FXViewer.java

示例11: Skybox

import javafx.scene.PerspectiveCamera; //導入依賴的package包/類
public Skybox(Image topImg, Image bottomImg, Image leftImg, Image rightImg, Image frontImg, Image backImg, double size, PerspectiveCamera camera) {
    super();            
    this.imageType = SkyboxImageType.MULTIPLE;
            
    this.topImg = topImg;
    this.bottomImg = bottomImg;
    this.leftImg = leftImg;
    this.rightImg = rightImg;
    this.frontImg = frontImg;
    this.backImg = backImg;
    this.size.set(size);
    this.camera = camera;
    
    loadImageViews();
    
    getTransforms().add(affine);
                    
    getChildren().addAll(views);
    
    startTimer();
}
 
開發者ID:sanke69,項目名稱:fr.xs.jtk,代碼行數:22,代碼來源:Skybox.java

示例12: calculateEdgeAngle

import javafx.scene.PerspectiveCamera; //導入依賴的package包/類
/**
 * Calculates the angle needed for the given {@link Node} to be edge-on with
 * the user.
 * 
 * @param pNode the {@link Node}.
 * @param pOrientation the {@link Orientation}.
 * @return the angle needed for the {@link Node} the be viewed edge-on.
 */
public static double calculateEdgeAngle(Node pNode, Orientation pOrientation)
{
	Scene scene = pNode.getScene();
	Camera camera = scene.getCamera();
	
	if (camera instanceof PerspectiveCamera)
	{
		PerspectiveCamera perspectiveCamera = (PerspectiveCamera)camera;
		
		double distanceFromCenter = getDistanceFromCenter(scene, pNode, pOrientation);
		double rotationFromCenter = getAngleFromCenter(scene, perspectiveCamera, distanceFromCenter);
		return 90 - rotationFromCenter;
	}
	
	return 90;
}
 
開發者ID:ivartanian,項目名稱:JVx.javafx,代碼行數:25,代碼來源:FXAnimator.java

示例13: initScene

import javafx.scene.PerspectiveCamera; //導入依賴的package包/類
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;
  }
 
開發者ID:canoo,項目名稱:code-of-gotham,代碼行數:25,代碼來源:StageUtil.java

示例14: SimpleGraphView3D

import javafx.scene.PerspectiveCamera; //導入依賴的package包/類
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));
}
 
開發者ID:kcoolsae,項目名稱:Equi,代碼行數:20,代碼來源:SimpleGraphView3D.java

示例15: loadCamera

import javafx.scene.PerspectiveCamera; //導入依賴的package包/類
private void loadCamera(Scene scene) {
    //initialize camera
    camera = new PerspectiveCamera(true);
    camera.setVerticalFieldOfView(RUN_JASON);

    //setup camera transform for rotational support
    cameraTransform.setTranslate(0, 0, 0);
    cameraTransform.getChildren().add(camera);
    camera.setNearClip(0.1);
    camera.setFarClip(100000.0);
    camera.setTranslateZ(-5000);
    cameraTransform.ry.setAngle(0.0);
    cameraTransform.rx.setAngle(-45.0);

    //add a Point Light for better viewing of the grid coordinate system
    PointLight light = new PointLight(Color.GAINSBORO);
    cameraTransform.getChildren().add(light);
    cameraTransform.getChildren().add(new AmbientLight(Color.WHITE));
    light.setTranslateX(camera.getTranslateX());
    light.setTranslateY(camera.getTranslateY());
    light.setTranslateZ(camera.getTranslateZ());
    //attach camera to scene
    scene.setCamera(camera);

}
 
開發者ID:FXyz,項目名稱:FXyzLib,代碼行數:26,代碼來源:Drag3DObject.java


注:本文中的javafx.scene.PerspectiveCamera類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。