Commit 8559a69a authored by Haven Sanborn Cook's avatar Haven Sanborn Cook
Browse files

made it look very pretty with an 'environment' and some lighting

parent 6014fa2c
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -89,18 +89,29 @@ public class GraphicsAndWindowsTest extends Application {
        //objects[3] = newObject4;


        Box floor = new Box(100000, 10, 100000);
        floor.setTranslateY(255);
        floor.setTranslateZ(250);
        floor.setMaterial(new PhongMaterial(Color.LIGHTGREEN));

        Group group3D = new Group(); // Group of our 3D elements
        group3D.getChildren().add(floor);
        obs.addToGroup(group3D);
        for (MovingObject o : objects ) {
            o.setTranslate(sceneWindow.getXOffset(), sceneWindow.getYOffset(),0);
            group3D.getChildren().add(o.getMesh());
        }

        PointLight lightSource = new PointLight(Color.GRAY);
        lightSource.setTranslateY(-300);
        lightSource.setTranslateZ(250);

        group3D.setTranslateX(windowXOffset);
        group3D.setTranslateY(windowYOffset);
        group3D.setTranslateZ(250);
        group3D.getChildren().add(ourWindow);
        group3D.getChildren().add(new AmbientLight(Color.WHITE));
        group3D.getChildren().add(new AmbientLight(Color.GRAY));
        group3D.getChildren().add(lightSource);

        slingLine = new Line(0,0,0,0);

@@ -148,8 +159,8 @@ public class GraphicsAndWindowsTest extends Application {
         * SubScene to handle 3D components
         * Makes it easier to have 2D and 3D components in the same animation
         */
        SubScene subScene3D = new SubScene(group3D, 1500, 800);
        subScene3D.setFill(Color.SILVER);
        SubScene subScene3D = new SubScene(group3D, 1500, 800, true, SceneAntialiasing.BALANCED);
        subScene3D.setFill(Color.LIGHTBLUE);
        subScene3D.setCamera(camera);


+830 B

File added.

No diff preview for this file type.

+9.47 KiB

File added.

No diff preview for this file type.