本文整理汇总了Java中javafx.scene.AmbientLight类的典型用法代码示例。如果您正苦于以下问题:Java AmbientLight类的具体用法?Java AmbientLight怎么用?Java AmbientLight使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AmbientLight类属于javafx.scene包,在下文中一共展示了AmbientLight类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadCamera
import javafx.scene.AmbientLight; //导入依赖的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);
}
示例2: init
import javafx.scene.AmbientLight; //导入依赖的package包/类
private void init(){
redMaterial.setDiffuseColor(Color.DARKRED);
redMaterial.setSpecularColor(Color.RED);
greenMaterial.setDiffuseColor(Color.DARKGREEN);
greenMaterial.setSpecularColor(Color.GREEN);
blueMaterial.setDiffuseColor(Color.DARKBLUE);
blueMaterial.setSpecularColor(Color.BLUE);
buildAxes(axesSize, axesThickness);
buildPanels(axesSize);
buildGrids(axesSize, gridLineSpacing);
buildEventHandlers();
getChildren().add(cubeWorldChildren); //Holds ScatterPlot data
if(selfLightEnabled) {
AmbientLight light = new AmbientLight(Color.WHITE);
getChildren().add(light);
}
}
示例3: loadCamera
import javafx.scene.AmbientLight; //导入依赖的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);
}
示例4: getAmbient
import javafx.scene.AmbientLight; //导入依赖的package包/类
public AmbientLight getAmbient() {
return new GetAction<AmbientLight>() {
@Override
public void run(Object... os) throws Exception {
setResult(vl.getAmbient());
}
}.dispatch(Root.ROOT.getEnvironment());
}
示例5: setupSceneInternals
import javafx.scene.AmbientLight; //导入依赖的package包/类
/**
* <p>
* Creates scene elements that aren't meant to be manipulated by the user
* (markers, camera, etc.)
* </p>
*/
protected void setupSceneInternals(Group parent) {
// Create scene plane for frame of reference.
Box box = new Box(1000, 0, 1000);
box.setMouseTransparent(true);
box.setDrawMode(DrawMode.LINE);
box.setMaterial(new PhongMaterial(Color.ANTIQUEWHITE));
AmbientLight ambientLight = new AmbientLight(Color.rgb(100, 100, 100));
PointLight light1 = new PointLight(Color.ANTIQUEWHITE);
light1.setMouseTransparent(true);
light1.setTranslateY(-350);
PointLight light2 = new PointLight(Color.ANTIQUEWHITE);
light2.setMouseTransparent(true);
light2.setTranslateZ(350);
PointLight light3 = new PointLight(Color.ANTIQUEWHITE);
light3.setMouseTransparent(true);
light3.setTranslateZ(-350);
PointLight light4 = new PointLight(Color.ANTIQUEWHITE);
light4.setMouseTransparent(true);
light4.setTranslateZ(350);
TransformGizmo gizmo = new TransformGizmo(1000);
gizmo.showHandles(false);
parent.getChildren().addAll(gizmo, box, light1, light2, light3, light4,
ambientLight);
}
示例6: setupSceneInternals
import javafx.scene.AmbientLight; //导入依赖的package包/类
@Override
protected void setupSceneInternals(Group parent) {
// Create scene plane for frame of reference.
plane = new Box(1000, 0, 1000);
plane.setMouseTransparent(true);
plane.setDrawMode(DrawMode.LINE);
plane.setMaterial(new PhongMaterial(Color.ANTIQUEWHITE));
AmbientLight ambientLight = new AmbientLight(Color.rgb(100, 100, 100));
PointLight light1 = new PointLight(Color.ANTIQUEWHITE);
light1.setMouseTransparent(true);
light1.setTranslateY(-350);
PointLight light2 = new PointLight(Color.ANTIQUEWHITE);
light2.setMouseTransparent(true);
light2.setTranslateZ(350);
PointLight light3 = new PointLight(Color.ANTIQUEWHITE);
light3.setMouseTransparent(true);
light3.setTranslateZ(-350);
PointLight light4 = new PointLight(Color.ANTIQUEWHITE);
light4.setMouseTransparent(true);
light4.setTranslateZ(350);
axes = new TransformGizmo(1000);
axes.showHandles(false);
parent.getChildren().addAll(axes, plane, light1, light2, light3, light4,
ambientLight);
}
示例7: setupSceneInternals
import javafx.scene.AmbientLight; //导入依赖的package包/类
/**
* <p>
* Creates scene elements that aren't meant to be manipulated by the user
* (markers, camera, etc.)
* </p>
*/
@Override
protected void setupSceneInternals(Group parent) {
// Create the ambient light
AmbientLight ambientLight = new AmbientLight(Color.rgb(100, 100, 100));
// Create the point lights
PointLight light1 = new PointLight(Color.ANTIQUEWHITE);
light1.setMouseTransparent(true);
light1.setTranslateY(-350);
PointLight light2 = new PointLight(Color.ANTIQUEWHITE);
light2.setMouseTransparent(true);
light2.setTranslateZ(350);
PointLight light3 = new PointLight(Color.ANTIQUEWHITE);
light3.setMouseTransparent(true);
light3.setTranslateZ(-350);
PointLight light4 = new PointLight(Color.ANTIQUEWHITE);
light4.setMouseTransparent(true);
light4.setTranslateZ(350);
// Create the background grid
gizmo = new AxisGridGizmo(SCALE);
// Add everything to the scene
parent.getChildren().addAll(gizmo, light1, light2, light3, light4,
ambientLight);
}
示例8: ShapeContainer
import javafx.scene.AmbientLight; //导入依赖的package包/类
public ShapeContainer(T shape) {
this.shape = shape;
this.material = new PhongMaterial();
this.emissive = new PointLight();
this.selfIllumination = new AmbientLight();
this.selfIllumination.getScope().add(ShapeContainer.this);
initialize();
}
示例9: testGetAmbientLightAdjuster
import javafx.scene.AmbientLight; //导入依赖的package包/类
@Test
public void testGetAmbientLightAdjuster() {
Adjuster adjuster = Adjuster.getAdjuster(AmbientLight.class);
assertThat(adjuster, is(instanceOf(NodeAdjuster.class)));
assertThat(adjuster.getNodeClass(), is(sameInstance(Node.class)));
}
示例10: buildLights
import javafx.scene.AmbientLight; //导入依赖的package包/类
private void buildLights() {
AmbientLight ambientLight = new AmbientLight(Color.color(0.5, 0.5, 0.5));
// Since this is attached to root, X is right, Y is down, Z is back
PointLight light1 = new PointLight(Color.WHITE);
light1.setTranslateX(20); // right
light1.setTranslateY(-20); // up
light1.setTranslateZ(-20); // forward
PointLight light2 = new PointLight(Color.color(0.6, 0.6, 0.6));
light2.setTranslateX(-20); // left
light2.setTranslateY(-20); // up
// light2.setTranslateZ(-20); // forward
// PointLight light3 = new PointLight(Color.color(0.3, 0.3, 0.3));
// light3.setTranslateY(20); // bottom
root.getChildren().addAll(ambientLight, light1, light2);
}
示例11: start
import javafx.scene.AmbientLight; //导入依赖的package包/类
@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();
}
示例12: configSceneColor
import javafx.scene.AmbientLight; //导入依赖的package包/类
@Override
protected void configSceneColor(Scene scene, PointLight point, AmbientLight ambient, CameraTransformer lights) {
scene.setFill(GRAY);
// int c = 128;
// int d = 192;
// point.setColor(rgb(c, c, c + 32, 0.2));
// ambient.setColor(rgb(d, d, d, 0.9));
// point.setColor(rgb(221, 221, 221));
// point.setColor(rgb(240, 240, 240));
// ambient.setColor(rgb(51, 51, 51));
// ambient.setColor(rgb(201, 201, 201));
// ambient.setColor(rgb(78, 78, 78));// 0.3f
ambient.setColor(rgb(240, 240, 240, 0.95));
point.setColor(rgb(179, 204, 204)); // 0.7, 0.8, 0.8
// point.setColor(BLACK);
// ambient.setColor(BLUE);
// AmbientLight ambient2 = new AmbientLight(Color.WHITE);
// ambient2.setTranslateZ(1);
// ambient2.setTranslateY(3);
// lights.getChildren().add(ambient2);
// scene.setOnKeyPressed(e -> {
// KeyCode keyCode = e.getCode();
// });
// scene.setOnMouseClicked(e -> {
// if (e.isSecondaryButtonDown()) {
// brightness -= 0.1;
// if (brightness < 0.1) brightness = 1;
// } else {
// saturation += 0.1;
// if (saturation > 1) {
// saturation = 0;
// hue += 10;
// }
// }
// // setMaterial(material, Color.hsb(hue, saturation, brightness));
// });
}
示例13: getAmbient
import javafx.scene.AmbientLight; //导入依赖的package包/类
public AmbientLight getAmbient(){
if(type==LightType.Point){
return null;
}
return (AmbientLight)lightBase;
}
示例14: createContent
import javafx.scene.AmbientLight; //导入依赖的package包/类
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);
}
示例15: PolyLine3D
import javafx.scene.AmbientLight; //导入依赖的package包/类
public PolyLine3D(List<Point3D> points, int width, Color color) {
this.points = points;
this.width = width;
this.color = color;
setDepthTest(DepthTest.ENABLE);
mesh = new TriangleMesh();
//add each point. For each point add another point shifted on Z axis by width
//This extra point allows us to build triangles later
for(Point3D point: points) {
mesh.getPoints().addAll(point.x,point.y,point.z);
mesh.getPoints().addAll(point.x,point.y,point.z+width);
}
//add dummy Texture Coordinate
mesh.getTexCoords().addAll(0,0);
//Now generate trianglestrips for each line segment
for(int i=2;i<points.size()*2;i+=2) { //add each segment
//Vertices wound counter-clockwise which is the default front face of any Triange
//These triangles live on the frontside of the line facing the camera
mesh.getFaces().addAll(i,0,i-2,0,i+1,0); //add primary face
mesh.getFaces().addAll(i+1,0,i-2,0,i-1,0); //add secondary Width face
//Add the same faces but wind them clockwise so that the color looks correct when camera is rotated
//These triangles live on the backside of the line facing away from initial the camera
mesh.getFaces().addAll(i+1,0,i-2,0,i,0); //add primary face
mesh.getFaces().addAll(i-1,0,i-2,0,i+1,0); //add secondary Width face
}
//Need to add the mesh to a MeshView before adding to our 3D scene
meshView = new MeshView(mesh);
meshView.setDrawMode(DrawMode.FILL); //Fill so that the line shows width
material = new PhongMaterial(color);
material.setDiffuseColor(color);
material.setSpecularColor(color);
meshView.setMaterial(material);
//Make sure you Cull the Back so that no black shows through
meshView.setCullFace(CullFace.BACK);
//Add some ambient light so folks can see it
AmbientLight light = new AmbientLight(Color.WHITE);
light.getScope().add(meshView);
getChildren().add(light);
getChildren().add(meshView);
}