Search in sources :

Example 11 with AmbientLight

use of javafx.scene.AmbientLight in project FXyzLib by Birdasaur.

the class CubeWorld method init.

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();
    //Holds ScatterPlot data
    getChildren().add(cubeWorldChildren);
    if (selfLightEnabled) {
        AmbientLight light = new AmbientLight(Color.WHITE);
        getChildren().add(light);
    }
}
Also used : AmbientLight(javafx.scene.AmbientLight)

Example 12 with AmbientLight

use of javafx.scene.AmbientLight in project Gargoyle by callakrsos.

the class Drag3DObject method loadCamera.

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);
}
Also used : PerspectiveCamera(javafx.scene.PerspectiveCamera) PointLight(javafx.scene.PointLight) AmbientLight(javafx.scene.AmbientLight)

Aggregations

AmbientLight (javafx.scene.AmbientLight)12 PerspectiveCamera (javafx.scene.PerspectiveCamera)10 PointLight (javafx.scene.PointLight)10 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)8 Group (javafx.scene.Group)8 Scene (javafx.scene.Scene)8 KeyCode (javafx.scene.input.KeyCode)8 MouseEvent (javafx.scene.input.MouseEvent)8 AnimationTimer (javafx.animation.AnimationTimer)7 Rotate (javafx.scene.transform.Rotate)5 Point3D (org.fxyz.geometry.Point3D)5 OBJWriter (org.fxyz.utils.OBJWriter)4 ArrayList (java.util.ArrayList)3 KeyFrame (javafx.animation.KeyFrame)3 KeyValue (javafx.animation.KeyValue)3 Timeline (javafx.animation.Timeline)3 Color (javafx.scene.paint.Color)3 PhongMaterial (javafx.scene.paint.PhongMaterial)3 List (java.util.List)2 Application (javafx.application.Application)2