import javafx.application.Application; import javafx.scene.Group; import javafx.scene.PerspectiveCamera; import javafx.scene.PointLight; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.paint.Color; import javafx.scene.paint.PhongMaterial; import javafx.scene.shape.Sphere; import javafx.stage.Stage; /* * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. */ /** * * @author Andrew Glushchenko */ public class SelfIlTestApp extends Application{ private Image map = new Image(getClass().getResourceAsStream("images/selfIllumination.png")); @Override public void start(Stage stage) throws Exception { Group root = new Group(); Sphere s = new Sphere(100); PhongMaterial material = new PhongMaterial(Color.AQUA); material.setSelfIlluminationMap(map); s.setMaterial(material); s.setTranslateX(250); s.setTranslateY(250); PointLight pl = new PointLight(Color.RED); pl.setTranslateX(500); pl.setTranslateY(500); pl.setLightOn(false); root.getChildren().addAll(s,pl); Scene scene = new Scene(root,500,500,true); scene.setCamera(new PerspectiveCamera()); stage.setScene(scene); stage.show(); } public static void main(String[] args) { launch(args); } }