< prev index next >

modules/graphics/src/main/java/javafx/scene/LightBase.java

Print this page


   1 /*
   2  * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javafx.scene;
  27 
  28 import com.sun.javafx.collections.TrackableObservableList;
  29 import com.sun.javafx.geom.BaseBounds;
  30 import com.sun.javafx.geom.BoxBounds;
  31 import com.sun.javafx.geom.transform.Affine3D;
  32 import com.sun.javafx.geom.transform.BaseTransform;
  33 import com.sun.javafx.jmx.MXNodeAlgorithm;
  34 import com.sun.javafx.jmx.MXNodeAlgorithmContext;
  35 import com.sun.javafx.scene.DirtyBits;

  36 import com.sun.javafx.sg.prism.NGLightBase;
  37 import com.sun.javafx.tk.Toolkit;
  38 import javafx.application.ConditionalFeature;
  39 import javafx.application.Platform;
  40 import javafx.beans.InvalidationListener;
  41 import javafx.beans.Observable;
  42 import javafx.beans.property.BooleanProperty;
  43 import javafx.beans.property.ObjectProperty;
  44 import javafx.beans.property.SimpleBooleanProperty;
  45 import javafx.beans.property.SimpleObjectProperty;
  46 import javafx.collections.ListChangeListener.Change;
  47 import javafx.collections.ObservableList;
  48 import javafx.scene.paint.Color;
  49 import javafx.scene.shape.Shape3D;
  50 import sun.util.logging.PlatformLogger;
  51 
  52 /**
  53  * The {@code LightBase} class provides definitions of common properties for
  54  * objects that represent a form of Light source.  These properties
  55  * include:


 260         }
 261 
 262         if (impl_isDirty(DirtyBits.NODE_LIGHT_SCOPE)) {
 263             if (scope != null) {
 264                 ObservableList<Node> tmpScope = getScope();
 265                 if (tmpScope.isEmpty()) {
 266                     peer.setScope(null);
 267                 } else {
 268                     Object ngList[] = new Object[tmpScope.size()];
 269                     for (int i = 0; i < tmpScope.size(); i++) {
 270                         Node n = tmpScope.get(i);
 271                         ngList[i] = n.impl_getPeer();
 272                     }
 273                     peer.setScope(ngList);
 274                 }
 275             }
 276         }
 277 
 278         if (impl_isDirty(DirtyBits.NODE_LIGHT_TRANSFORM)) {
 279             localToSceneTx.setToIdentity();
 280             getLocalToSceneTransform().impl_apply(localToSceneTx);
 281             // TODO: 3D - For now, we are treating the scene as world. This may need to change
 282             // for the fixed eye position case.
 283             peer.setWorldTransform(localToSceneTx);
 284         }
 285     }
 286 
 287      /**
 288      * @treatAsPrivate implementation detail
 289      * @deprecated This is an internal API that is not intended for use and will be removed in the next version
 290      */
 291     @Deprecated
 292     @Override
 293     public BaseBounds impl_computeGeomBounds(BaseBounds bounds, BaseTransform tx) {
 294         // TODO: 3D - Check is this the right default
 295         return new BoxBounds();
 296     }
 297 
 298     /**
 299      * @treatAsPrivate implementation detail
 300      * @deprecated This is an internal API that is not intended for use and will be removed in the next version
   1 /*
   2  * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javafx.scene;
  27 
  28 import com.sun.javafx.collections.TrackableObservableList;
  29 import com.sun.javafx.geom.BaseBounds;
  30 import com.sun.javafx.geom.BoxBounds;
  31 import com.sun.javafx.geom.transform.Affine3D;
  32 import com.sun.javafx.geom.transform.BaseTransform;
  33 import com.sun.javafx.jmx.MXNodeAlgorithm;
  34 import com.sun.javafx.jmx.MXNodeAlgorithmContext;
  35 import com.sun.javafx.scene.DirtyBits;
  36 import com.sun.javafx.scene.transform.TransformHelper;
  37 import com.sun.javafx.sg.prism.NGLightBase;
  38 import com.sun.javafx.tk.Toolkit;
  39 import javafx.application.ConditionalFeature;
  40 import javafx.application.Platform;
  41 import javafx.beans.InvalidationListener;
  42 import javafx.beans.Observable;
  43 import javafx.beans.property.BooleanProperty;
  44 import javafx.beans.property.ObjectProperty;
  45 import javafx.beans.property.SimpleBooleanProperty;
  46 import javafx.beans.property.SimpleObjectProperty;
  47 import javafx.collections.ListChangeListener.Change;
  48 import javafx.collections.ObservableList;
  49 import javafx.scene.paint.Color;
  50 import javafx.scene.shape.Shape3D;
  51 import sun.util.logging.PlatformLogger;
  52 
  53 /**
  54  * The {@code LightBase} class provides definitions of common properties for
  55  * objects that represent a form of Light source.  These properties
  56  * include:


 261         }
 262 
 263         if (impl_isDirty(DirtyBits.NODE_LIGHT_SCOPE)) {
 264             if (scope != null) {
 265                 ObservableList<Node> tmpScope = getScope();
 266                 if (tmpScope.isEmpty()) {
 267                     peer.setScope(null);
 268                 } else {
 269                     Object ngList[] = new Object[tmpScope.size()];
 270                     for (int i = 0; i < tmpScope.size(); i++) {
 271                         Node n = tmpScope.get(i);
 272                         ngList[i] = n.impl_getPeer();
 273                     }
 274                     peer.setScope(ngList);
 275                 }
 276             }
 277         }
 278 
 279         if (impl_isDirty(DirtyBits.NODE_LIGHT_TRANSFORM)) {
 280             localToSceneTx.setToIdentity();
 281             TransformHelper.apply(getLocalToSceneTransform(), localToSceneTx);
 282             // TODO: 3D - For now, we are treating the scene as world. This may need to change
 283             // for the fixed eye position case.
 284             peer.setWorldTransform(localToSceneTx);
 285         }
 286     }
 287 
 288      /**
 289      * @treatAsPrivate implementation detail
 290      * @deprecated This is an internal API that is not intended for use and will be removed in the next version
 291      */
 292     @Deprecated
 293     @Override
 294     public BaseBounds impl_computeGeomBounds(BaseBounds bounds, BaseTransform tx) {
 295         // TODO: 3D - Check is this the right default
 296         return new BoxBounds();
 297     }
 298 
 299     /**
 300      * @treatAsPrivate implementation detail
 301      * @deprecated This is an internal API that is not intended for use and will be removed in the next version
< prev index next >