本文整理匯總了Java中javafx.scene.PerspectiveCamera.setFieldOfView方法的典型用法代碼示例。如果您正苦於以下問題:Java PerspectiveCamera.setFieldOfView方法的具體用法?Java PerspectiveCamera.setFieldOfView怎麽用?Java PerspectiveCamera.setFieldOfView使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.PerspectiveCamera
的用法示例。
在下文中一共展示了PerspectiveCamera.setFieldOfView方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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();
}
示例2: 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);
}
示例3: start
import javafx.scene.PerspectiveCamera; //導入方法依賴的package包/類
@Override public void start(Stage stage) {
FlowGridPane pane = new FlowGridPane(7, 5,
percentageTile, clockTile, gaugeTile, sparkLineTile, areaChartTile,
lineChartTile, timerControlTile, numberTile, textTile,
highLowTile, plusMinusTile, sliderTile, switchTile, timeTile,
barChartTile, customTile, leaderBoardTile, worldTile, mapTile,
radialChartTile, donutChartTile, circularProgressTile, stockTile,
gaugeSparkLineTile, radarChartTile1, radarChartTile2,
smoothAreaChartTile, countryTile, ephemerisTile, characterTile,
flipTile, switchSliderTile, dateTile, calendarTile);//, weatherTile);
pane.setHgap(5);
pane.setVgap(5);
pane.setAlignment(Pos.CENTER);
pane.setCenterShape(true);
pane.setPadding(new Insets(5));
//pane.setPrefSize(800, 600);
pane.setBackground(new Background(new BackgroundFill(Color.web("#101214"), CornerRadii.EMPTY, Insets.EMPTY)));
PerspectiveCamera camera = new PerspectiveCamera();
camera.setFieldOfView(10);
Scene scene = new Scene(pane);
scene.setCamera(camera);
stage.setTitle("TilesFX");
stage.setScene(scene);
stage.show();
timer.start();
mapTile.addPoiLocation(new Location(51.85, 7.75, "Test"));
mapTile.removePoiLocation(new Location(51.85, 7.75, "Test"));
}
示例4: start
import javafx.scene.PerspectiveCamera; //導入方法依賴的package包/類
@Override
public void start(Stage stage) {
FlowGridPane pane = new FlowGridPane(7, 4, percentageTile, clockTile, gaugeTile, sparkLineTile, areaChartTile,
lineChartTile, timerControlTile, numberTile, textTile, highLowTile, plusMinusTile, sliderTile,
switchTile, timeTile, barChartTile, customTile, leaderBoardTile, worldTile, mapTile, radialChartTile,
donutChartTile, circularProgressTile, stockTile, gaugeSparkLineTile, radarChartTile1, radarChartTile2,
smoothAreaChartTile, countryTile, flipTile);// , weatherTile);
pane.setHgap(5);
pane.setVgap(5);
pane.setAlignment(Pos.CENTER);
pane.setCenterShape(true);
pane.setPadding(new Insets(5));
// pane.setPrefSize(800, 600);
pane.setBackground(new Background(new BackgroundFill(Color.web("#101214"), CornerRadii.EMPTY, Insets.EMPTY)));
PerspectiveCamera camera = new PerspectiveCamera();
camera.setFieldOfView(7);
Scene scene = new Scene(pane);
scene.setCamera(camera);
stage.setTitle("TilesFX");
stage.setScene(scene);
stage.show();
timer.start();
mapTile.addPoiLocation(new Location(51.85, 7.75, "Test"));
mapTile.removePoiLocation(new Location(51.85, 7.75, "Test"));
}
示例5: createContent
import javafx.scene.PerspectiveCamera; //導入方法依賴的package包/類
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;
}
示例6: start
import javafx.scene.PerspectiveCamera; //導入方法依賴的package包/類
@Override public void start(Stage stage) {
FlowGridPane pane = new FlowGridPane(8, 5,
percentageTile, clockTile, gaugeTile, sparkLineTile, areaChartTile,
lineChartTile, timerControlTile, numberTile, textTile,
highLowTile, plusMinusTile, sliderTile, switchTile, timeTile,
barChartTile, customTile, leaderBoardTile, worldTile, mapTile,
radialChartTile, donutChartTile, circularProgressTile, stockTile,
gaugeSparkLineTile, radarChartTile1, radarChartTile2,
smoothAreaChartTile, countryTile, ephemerisTile, characterTile,
flipTile, switchSliderTile, dateTile, calendarTile, sunburstTile,
matrixTile, radialPercentageTile);//, weatherTile);
pane.setHgap(5);
pane.setVgap(5);
pane.setAlignment(Pos.CENTER);
pane.setCenterShape(true);
pane.setPadding(new Insets(5));
//pane.setPrefSize(800, 600);
pane.setBackground(new Background(new BackgroundFill(Color.web("#101214"), CornerRadii.EMPTY, Insets.EMPTY)));
PerspectiveCamera camera = new PerspectiveCamera();
camera.setFieldOfView(10);
Scene scene = new Scene(pane);
scene.setCamera(camera);
stage.setTitle("TilesFX");
stage.setScene(scene);
stage.show();
// Calculate number of nodes
calcNoOfNodes(pane);
System.out.println(noOfNodes + " Nodes in SceneGraph");
timer.start();
mapTile.addPoiLocation(new Location(51.85, 7.75, "Test"));
mapTile.removePoiLocation(new Location(51.85, 7.75, "Test"));
radialPercentageTile.showNotifier(true);
}
示例7: createSubscene
import javafx.scene.PerspectiveCamera; //導入方法依賴的package包/類
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);
}
示例8: start
import javafx.scene.PerspectiveCamera; //導入方法依賴的package包/類
@Override
public void start(Stage stage) {
Group spheroidGroup = 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 randomMajorRadius = (float) ((r.nextFloat() * 300) + 50);
float randomMinorRadius = (float) ((r.nextFloat() * 300) + 50);
int randomDivisions = (int) ((r.nextFloat() * 64) + 1);
Color randomColor = new Color(r.nextDouble(), r.nextDouble(), r.nextDouble(), r.nextDouble());
Spheroid sm = new Spheroid(randomDivisions, randomMajorRadius, randomMinorRadius, randomColor);
sm.setDrawMode(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);
sm.getTransforms().addAll(translate, rotateX, rotateY, rotateZ);
spheroidGroup.getChildren().add(sm);
}
root.getChildren().add(spheroidGroup);
System.out.println(spheroidGroup.getChildren().size());
camera = new PerspectiveCamera(true);
cameraTransform.setTranslate(0, 0, 0);
cameraTransform.getChildren().addAll(camera);
camera.setNearClip(0.1);
camera.setFarClip(10000.0);
camera.setFieldOfView(42);
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);
Scene scene = new Scene(new StackPane(root), 1024, 668, true, SceneAntialiasing.BALANCED);
scene.setCamera(camera);
scene.setFill(Color.BLACK);
initFirstPersonControls(scene);
stage.setTitle("Hello World!");
stage.setScene(scene);
stage.show();
}