Java 类javafx.scene.PointLight 实例源码

项目:Gargoyle    文件:Drag3DObject.java   
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);

}
项目:FXyzLib    文件:Drag3DObject.java   
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);

}
项目:openjfx-8u-dev-tests    文件:ShapesTestCase.java   
private Group getLight(Group grp) {
    Group root;

    pointLight = new PointLight(Color.ANTIQUEWHITE);
    pointLight.setTranslateX(15);
    pointLight.setTranslateY(-10 * SCALE);
    pointLight.setTranslateZ(-100 * SCALE);
    root = new Group(grp, pointLight);

    root.setFocusTraversable(true);
    return root;
}
项目:openjfx-8u-dev-tests    文件:SubSceneDepthTestApp.java   
private static Group buildGroup() {
        Group grp = new Group();
        Sphere s = new Sphere();
        Box b = new Box();
        s.setScaleX(SCALE);
        s.setScaleY(SCALE);
        s.setScaleZ(SCALE);
        s.setTranslateX(-130);
        b.setScaleX(SCALE);
        b.setScaleY(SCALE);
        b.setScaleZ(SCALE);
        b.setTranslateX(130);
        PhongMaterial material = new PhongMaterial();
        material.setDiffuseColor(Color.LIGHTGRAY);
        material.setSpecularColor(Color.rgb(30, 30, 30));
        s.setMaterial(material);
        b.setMaterial(material);
        PointLight pl = new PointLight(Color.AQUA);
        pl.setTranslateZ(-1000);
        Sphere lightBalance = new Sphere();
//        lightBalance.setScaleX(0.1);
//        lightBalance.setScaleX(0.1);
//        lightBalance.setScaleX(0.1);
        lightBalance.setTranslateZ(1000);
        grp.getChildren().addAll(s, b,pl,lightBalance);
        return grp;
    }
项目:openjfx-8u-dev-tests    文件:ShellVisibleLight.java   
public PointLight getPoint() {
    return new GetAction<PointLight>() {
        @Override
        public void run(Object... os) throws Exception {
            setResult(vl.getPoint());
        }
    }.dispatch(Root.ROOT.getEnvironment());
}
项目:eavp    文件:FXViewer.java   
/**
 * <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);

}
项目:eavp    文件:FXGeometryViewer.java   
@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);

}
项目:eavp    文件:FXMeshViewer.java   
/**
 * <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);

}
项目:fr.xs.jtk    文件:ShapeContainer.java   
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();
}
项目:fr.xs.jtk    文件:QuaternionCamera.java   
public QuaternionCamera() {
    super();

    PointLight light = new PointLight(Color.WHITE);
    getChildren().add(light);

    lookAt(0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
}
项目:fr.xs.jtk    文件:CubeViewer.java   
private void init(){
    buildAxes(axesSize, axesThickness);
    buildPanels(axesSize);
    buildGrids(axesSize, gridLineSpacing);
    buildEventHandlers();        
    getChildren().add(scatterDataGroup); //Holds ScatterPlot data
    if(selfLightEnabled) {
        PointLight light = new PointLight(Color.WHITE);
        getChildren().add(light);
    }
    setDepthTest(DepthTest.ENABLE);
}
项目:fr.xs.jtk    文件:ClothMeshTest.java   
@Override
    public Group testObject3D() {
        Group group = new Group();

        ClothMesh cloth = new ClothMesh();        
        cloth.setPerPointMass(10);
        cloth.setBendStrength(0.5);
        cloth.setStretchStrength(1.0);
        cloth.setShearStrength(0.55);
        cloth.setDrawMode(DrawMode.LINE);
        cloth.setCullFace(CullFace.NONE);
//        cloth.setDiffuseMap(new Image("https://kenai.com/attachments/wiki_images/duke/Duke3DprogressionSmall.jpg"));
        cloth.setSpecularPower(5);

        PointLight light2 = new PointLight(Color.GAINSBORO);
        light2.setTranslateZ(-1500);
        PointLight light3 = new PointLight(Color.AZURE);
        light3.setTranslateZ(2500);
        Group g = new Group();
        g.getChildren().addAll(cloth, light2, light3);

        group.getChildren().add(g);
        group.setPickOnBounds(false);

        cloth.startSimulation();

        return group;
    }
项目:FXyzLib    文件:ShapeContainer.java   
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();
}
项目:FXyzLib    文件:CubeViewer.java   
private void init(){
    buildAxes(axesSize, axesThickness);
    buildPanels(axesSize);
    buildGrids(axesSize, gridLineSpacing);
    buildEventHandlers();        
    getChildren().add(scatterDataGroup); //Holds ScatterPlot data
    if(selfLightEnabled) {
        PointLight light = new PointLight(Color.WHITE);
        getChildren().add(light);
    }
    setDepthTest(DepthTest.ENABLE);
}
项目:javafx-dpi-scaling    文件:AdjusterTest.java   
@Test
public void testGetPointLightAdjuster() {
    Adjuster adjuster = Adjuster.getAdjuster(PointLight.class);

    assertThat(adjuster, is(instanceOf(NodeAdjuster.class)));
    assertThat(adjuster.getNodeClass(), is(sameInstance(Node.class)));
}
项目:COrnLathe    文件:View3DPanel.java   
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);
  }
项目:FX3DAndroid    文件:ShapeContainer.java   
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();
}
项目:FX3DAndroid    文件:CubeViewer.java   
private void init(){
    buildAxes(axesSize, axesThickness);
    buildPanels(axesSize);
    buildGrids(axesSize, gridLineSpacing);
    buildEventHandlers();        
    getChildren().add(scatterDataGroup); //Holds ScatterPlot data
    if(selfLightEnabled) {
        PointLight light = new PointLight(Color.WHITE);
        getChildren().add(light);
    }
    setDepthTest(DepthTest.ENABLE);
}
项目:FX3DAndroid    文件:ThreedApplication.java   
@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();
}
项目:FX3DAndroid    文件:ScadaApplication.java   
@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));
    // });
}
项目:openjfx-8u-dev-tests    文件:VisibleLight.java   
public PointLight getPoint(){
    if(type==LightType.Ambient){
        return null;
    }
    return (PointLight)lightBase;
}
项目:openjfx-8u-dev-tests    文件:DepthTestAbstractApp.java   
private LightBase getLight() {
    PointLight pl = new PointLight(Color.WHITE);
    pl.setTranslateZ(-10);
    return pl;
}
项目:mars-sim    文件:Simple3DSphereApp.java   
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);
    }
项目:fr.xs.jtk    文件:ShapeContainer.java   
@Override
public PointLight getEmissiveLight() {
    return emissive;
}
项目:fr.xs.jtk    文件:PivotTest.java   
@Override
public Group testObject3D() {
    root.getChildren().add(new AmbientLight(Color.color(0.1, 0.1, 0.1)));

    buildAxes(axis);
    Pivot p1 = new Pivot(-AXIS_LENGTH / 2, 0, -AXIS_LENGTH / 2);
    buildAxes(p1);
    Pivot p2 = new Pivot(AXIS_LENGTH / 2, 0, -AXIS_LENGTH / 2);
    buildAxes(p2);
    Pivot p3 = new Pivot(-AXIS_LENGTH / 2, 0, AXIS_LENGTH / 2);
    buildAxes(p3);
    Pivot p4 = new Pivot(AXIS_LENGTH / 2, 0, AXIS_LENGTH / 2);
    buildAxes(p4);

    Sphere s = new Sphere(100);
    s.setMaterial(PhongPhactory.fromImage("data/ball.jpg"));
    earth.getChildren().add(s);
    root.getChildren().add(earth);

    camera.getChildren().add(cam);

    PointLight l = new PointLight(Color.WHITE);
    light.getChildren().add(l);
    light.setPosition(300, -200, -300);
    buildAxes(light); // adding the axis will add light pivot to scene

    PointLight rl = new PointLight(Color.DARKRED);
    redLight.getChildren().add(rl);
    redLight.setPosition(-300, -200, 300);
    buildAxes(redLight);

    Box b = new Box(1200, 600, 1200);
    box.getChildren().add(b);
    box.setPosition(0, 0, 0);
    b.setCullFace(CullFace.FRONT);
    b.setMaterial(PhongPhactory.fromImage("/data/crate.jpg"));
    root.getChildren().add(box);

    Timeline t = new Timeline(new KeyFrame(Duration.millis(20), e -> {
        a = a + 0.02;

        earth.setEularRotation(a, -a * 4, -a);

        axis.setPosition(Math.cos(a) * (AXIS_LENGTH / 2), 0, Math.sin(a) * (AXIS_LENGTH / 2));
        camera.setPosition(Math.cos(-a / 4) * (AXIS_LENGTH * 4), -AXIS_LENGTH, Math.sin(-a / 4) * (AXIS_LENGTH * 4));
        camera.lookAt(axis.getPosition(), up);

    }));
    t.setCycleCount(Timeline.INDEFINITE);
    t.play();

    return root;
}
项目:FXyzLib    文件:ShapeContainer.java   
@Override
public PointLight getEmissiveLight() {
    return emissive;
}
项目:FXyzLib    文件:AdvancedCamera.java   
public PointLight getHeadLight() {
    return headLight;
}
项目:FXyzLib    文件:BillBoardBehaviorTest.java   
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);

}
项目:FXyzLib    文件:SpheroidTest.java   
@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();
}
项目:FXTutorials    文件:Tutorial.java   
private Parent createContent() {
    Cube c = new Cube(1, Color.GREEN);
    c.setTranslateX(-1);
    c.setRotationAxis(Rotate.Y_AXIS);
    c.setRotate(45);

    Cube c2 = new Cube(1, Color.BLUE);
    c2.setTranslateX(1);
    c2.setRotationAxis(Rotate.Y_AXIS);
    c2.setRotate(45);

    Cube c3 = new Cube(1, Color.RED);
    c3.setRotationAxis(Rotate.Y_AXIS);
    c3.setRotate(45);

    camera = new PerspectiveCamera(true);
    translate = new Translate(0, 0, -10);
    rotate = new Rotate(0, new Point3D(0, 1, 0));
    camera.getTransforms().addAll(translate, rotate);

    PointLight light = new PointLight(Color.WHITE);
    light.setTranslateX(3);
    light.setTranslateZ(-5);

    TranslateTransition tt = new TranslateTransition(Duration.seconds(2), light);
    tt.setFromX(-3);
    tt.setToX(3);
    tt.setAutoReverse(true);
    tt.setCycleCount(Animation.INDEFINITE);

    AmbientLight globalLight = new AmbientLight(Color.WHITE.deriveColor(0, 1, 0.2, 1));


    worldRoot.getChildren().addAll(c, c2, c3, globalLight, light);

    SubScene subScene = new SubScene(worldRoot, 800, 600, true, SceneAntialiasing.BALANCED);
    subScene.setCamera(camera);

    tt.play();

    return new Group(new Rectangle(800, 600), subScene);
}
项目:FX3DAndroid    文件:ShapeContainer.java   
@Override
public PointLight getEmissiveLight() {
    return emissive;
}
项目:FX3DAndroid    文件:AdvancedCamera.java   
public PointLight getHeadLight() {
    return headLight;
}
项目:FX3DAndroid    文件:ThreedApplication.java   
protected void configSceneColor(Scene scene, PointLight point, AmbientLight ambient, CameraTransformer lights) {
    scene.setFill(Color.BLACK);
}
项目:VRL-JFXVis    文件:Main.java   
@Override
public void start(Stage primaryStage) throws Exception {
    try {
        currentStage = primaryStage;
        ultraRoot = new Group();


        // Create camera
        camera = new PerspectiveCamera(true);
        camera.setFarClip(100000);

        // and position it
        camera.getTransforms().addAll(
                new Rotate(0, Rotate.Y_AXIS),
                new Rotate(0, Rotate.X_AXIS),
                new Translate(0, 0, -50));

        // add camera as node to scene graph

        VBox guiGroup = addGuiElements();
        // Setup a scene
        SubScene subscene = createScene3D(ultraRoot, camera);
        VBox layout = new VBox( guiGroup, subscene);
        subscene.heightProperty().bind(layout.heightProperty());
        subscene.widthProperty().bind(layout.widthProperty());
        layout.setSpacing(0.0);
        scene = new Scene(layout, 1024, 768, true);

        scene.setFill(Color.DARKGRAY.darker().darker().darker().darker());
        //Add the scene to the stage and show the stage
        PointLight light2 = new PointLight(Color.LIGHTGRAY);
        ultraRoot.getChildren().add(light2);
        light2.getTransforms().add(new Translate(-50, 10, -520));

        AmbientLight light3 = new AmbientLight(new Color(0.35,0.35,0.35,1.0));
        ultraRoot.getChildren().add(light3);
        primaryStage.setScene(scene);
        primaryStage.show();

        handleKeyboard(scene, camera);
        //handleMouse(scene, camera);   


        listener = new LeapMotionListener();
        controller = new Controller();

        controller.addListener(listener);
        addGlobalLeapMotionPropertyListener();

        for (int i = 0; i < cArray.length; i++) { //initialize the cylinder array for the hand bones
            cArray[i] = new Cylinder(1, 1, 20); //using a fixed size array for the hand bones avoids memory issues
            cArray[i].setMouseTransparent(true); //but limits the max. amount of hands that can be registered at the same time
        //set it mouse transparent, so that it wont block the mouse click events by the robot
            cArray[i].setMaterial(handSphereMat);
        }                                       

    } catch (Exception e) {
        e.printStackTrace(System.out);
        System.exit(1);
    }


}
项目:fr.xs.jtk    文件:ShapeContainerBase.java   
public PointLight getEmissiveLight();
项目:FXyzLib    文件:ShapeContainerBase.java   
public PointLight getEmissiveLight();
项目:FX3DAndroid    文件:ShapeContainerBase.java   
public PointLight getEmissiveLight();