changeset 2819:c6f4b6d77cbb

Automated merge with ssh://jfxsrc.us.oracle.com//javafx/8.0/scrum/graphics/jfx/rt
author Chien Yang <chien.yang@orcale.com>
date Wed, 06 Mar 2013 08:38:45 -0800
parents df3ce8a3d2aa bc78e8b64377
children e2f88c00234e
files
diffstat 2 files changed, 23 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-sg-prism/src/com/sun/javafx/sg/prism/NGShape3D.java	Wed Mar 06 16:26:43 2013 +0100
+++ b/javafx-sg-prism/src/com/sun/javafx/sg/prism/NGShape3D.java	Wed Mar 06 08:38:45 2013 -0800
@@ -107,18 +107,26 @@
         }
 
         Toolkit tk = Toolkit.getToolkit();
-        for(int i=0; i < tk.getLightsInScene().size(); i++) {
-            // Need to make changes to support AmbientLight too.
-            // Will do this once we get the first rendering up.
-            NGPointLight light = (NGPointLight)tk.getLightsInScene().get(i);
-            Affine3D lightWT = light.getWorldTransform();
-            nativeObject.setLight(i,
-                    (float)lightWT.getMxt(),
-                    (float)lightWT.getMyt(),
-                    (float)lightWT.getMzt(),
-                    light.getColor().getRed(),
-                    light.getColor().getGreen(),
-                    light.getColor().getBlue(), 1.0f);
+        for (int i = 0; i < tk.getLightsInScene().size(); i++) {
+            NGLightBase lightBase = (NGLightBase) tk.getLightsInScene().get(i);
+            if (lightBase instanceof NGPointLight) {
+                NGPointLight light = (NGPointLight) lightBase;
+                Affine3D lightWT = light.getWorldTransform();
+                nativeObject.setLight(i,
+                        (float) lightWT.getMxt(),
+                        (float) lightWT.getMyt(),
+                        (float) lightWT.getMzt(),
+                        light.getColor().getRed(),
+                        light.getColor().getGreen(),
+                        light.getColor().getBlue(), 1.0f);
+            } else if (lightBase instanceof NGAmbientLight) {
+                NGAmbientLight light = (NGAmbientLight) lightBase;
+                nativeObject.setAmbient(light.getColor().getRed(),
+                        light.getColor().getGreen(),
+                        light.getColor().getBlue());
+            } else {
+                // Unknown light type
+            }
         }
 
         return nativeObject;
--- a/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/QuantumToolkit.java	Wed Mar 06 16:26:43 2013 +0100
+++ b/javafx-ui-quantum/src/com/sun/javafx/tk/quantum/QuantumToolkit.java	Wed Mar 06 08:38:45 2013 -0800
@@ -1331,7 +1331,9 @@
 
     @Override
     public PGAmbientLight createPGAmbientLight() {
-        return new NGAmbientLight();
+        NGAmbientLight light = new NGAmbientLight();
+        lightsInScene.add(light);
+        return light;
     }
 
     @Override