< prev index next >

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

Print this page




  63  * Note that this is a conditional feature. See
  64  * {@link javafx.application.ConditionalFeature#SCENE3D ConditionalFeature.SCENE3D}
  65  * for more information.
  66  *
  67  * @since JavaFX 8.0
  68  */
  69 public abstract class LightBase extends Node {
  70     static {
  71          // This is used by classes in different packages to get access to
  72          // private and package private methods.
  73         LightBaseHelper.setLightBaseAccessor(new LightBaseHelper.LightBaseAccessor() {
  74             @Override
  75             public void doMarkDirty(Node node, DirtyBits dirtyBit) {
  76                 ((LightBase) node).doMarkDirty(dirtyBit);
  77             }
  78 
  79             @Override
  80             public void doUpdatePeer(Node node) {
  81                 ((LightBase) node).doUpdatePeer();
  82             }
















  83         });
  84     }
  85 
  86     private Affine3D localToSceneTx = new Affine3D();
  87 
  88     {
  89         // To initialize the class helper at the begining each constructor of this class
  90         LightBaseHelper.initHelper(this);
  91     }
  92 
  93     /**
  94      * Creates a new instance of {@code LightBase} class with a default Color.WHITE light source.
  95      */
  96     protected LightBase() {
  97         this(Color.WHITE);
  98     }
  99 
 100     /**
 101      * Creates a new instance of {@code LightBase} class using the specified color.
 102      *


 283                 } else {
 284                     Object ngList[] = new Object[tmpScope.size()];
 285                     for (int i = 0; i < tmpScope.size(); i++) {
 286                         Node n = tmpScope.get(i);
 287                         ngList[i] = n.getPeer();
 288                     }
 289                     peer.setScope(ngList);
 290                 }
 291             }
 292         }
 293 
 294         if (isDirty(DirtyBits.NODE_LIGHT_TRANSFORM)) {
 295             localToSceneTx.setToIdentity();
 296             TransformHelper.apply(getLocalToSceneTransform(), localToSceneTx);
 297             // TODO: 3D - For now, we are treating the scene as world. This may need to change
 298             // for the fixed eye position case.
 299             peer.setWorldTransform(localToSceneTx);
 300         }
 301     }
 302 
 303      /**
 304      * @treatAsPrivate implementation detail
 305      * @deprecated This is an internal API that is not intended for use and will be removed in the next version
 306      */
 307     @Deprecated
 308     @Override
 309     public BaseBounds impl_computeGeomBounds(BaseBounds bounds, BaseTransform tx) {
 310         // TODO: 3D - Check is this the right default
 311         return new BoxBounds();
 312     }
 313 
 314     /**
 315      * @treatAsPrivate implementation detail
 316      * @deprecated This is an internal API that is not intended for use and will be removed in the next version
 317      */
 318     @Deprecated
 319     @Override
 320     protected boolean impl_computeContains(double localX, double localY) {
 321         // TODO: 3D - Check is this the right default
 322         return false;
 323     }
 324 
 325     /**
 326      * @treatAsPrivate implementation detail
 327      * @deprecated This is an internal API that is not intended for use and will be removed in the next version
 328      */
 329     @Deprecated
 330     @Override
 331     public Object impl_processMXNode(MXNodeAlgorithm alg, MXNodeAlgorithmContext ctx) {
 332         throw new UnsupportedOperationException("Not supported yet.");
 333     }
 334 
 335 }


  63  * Note that this is a conditional feature. See
  64  * {@link javafx.application.ConditionalFeature#SCENE3D ConditionalFeature.SCENE3D}
  65  * for more information.
  66  *
  67  * @since JavaFX 8.0
  68  */
  69 public abstract class LightBase extends Node {
  70     static {
  71          // This is used by classes in different packages to get access to
  72          // private and package private methods.
  73         LightBaseHelper.setLightBaseAccessor(new LightBaseHelper.LightBaseAccessor() {
  74             @Override
  75             public void doMarkDirty(Node node, DirtyBits dirtyBit) {
  76                 ((LightBase) node).doMarkDirty(dirtyBit);
  77             }
  78 
  79             @Override
  80             public void doUpdatePeer(Node node) {
  81                 ((LightBase) node).doUpdatePeer();
  82             }
  83 
  84             @Override
  85             public BaseBounds doComputeGeomBounds(Node node,
  86             BaseBounds bounds, BaseTransform tx) {
  87                 return ((LightBase) node).doComputeGeomBounds(bounds, tx);
  88             }
  89 
  90             @Override
  91             public boolean doComputeContains(Node node, double localX, double localY) {
  92                 return ((LightBase) node).doComputeContains(localX, localY);
  93             }
  94 
  95             @Override
  96             public Object doProcessMXNode(Node node, MXNodeAlgorithm alg, MXNodeAlgorithmContext ctx) {
  97                 return ((LightBase) node).doProcessMXNode(alg, ctx);
  98             }
  99         });
 100     }
 101 
 102     private Affine3D localToSceneTx = new Affine3D();
 103 
 104     {
 105         // To initialize the class helper at the begining each constructor of this class
 106         LightBaseHelper.initHelper(this);
 107     }
 108 
 109     /**
 110      * Creates a new instance of {@code LightBase} class with a default Color.WHITE light source.
 111      */
 112     protected LightBase() {
 113         this(Color.WHITE);
 114     }
 115 
 116     /**
 117      * Creates a new instance of {@code LightBase} class using the specified color.
 118      *


 299                 } else {
 300                     Object ngList[] = new Object[tmpScope.size()];
 301                     for (int i = 0; i < tmpScope.size(); i++) {
 302                         Node n = tmpScope.get(i);
 303                         ngList[i] = n.getPeer();
 304                     }
 305                     peer.setScope(ngList);
 306                 }
 307             }
 308         }
 309 
 310         if (isDirty(DirtyBits.NODE_LIGHT_TRANSFORM)) {
 311             localToSceneTx.setToIdentity();
 312             TransformHelper.apply(getLocalToSceneTransform(), localToSceneTx);
 313             // TODO: 3D - For now, we are treating the scene as world. This may need to change
 314             // for the fixed eye position case.
 315             peer.setWorldTransform(localToSceneTx);
 316         }
 317     }
 318 
 319     /*
 320      * Note: This method MUST only be called via its accessor method.

 321      */
 322     private BaseBounds doComputeGeomBounds(BaseBounds bounds, BaseTransform tx) {


 323         // TODO: 3D - Check is this the right default
 324         return new BoxBounds();
 325     }
 326 
 327     /*
 328      * Note: This method MUST only be called via its accessor method.

 329      */
 330     private boolean doComputeContains(double localX, double localY) {


 331         // TODO: 3D - Check is this the right default
 332         return false;
 333     }
 334 
 335     /*
 336      * Note: This method MUST only be called via its accessor method.

 337      */
 338     private Object doProcessMXNode(MXNodeAlgorithm alg, MXNodeAlgorithmContext ctx) {


 339         throw new UnsupportedOperationException("Not supported yet.");
 340     }
 341 
 342 }
< prev index next >