< prev index next >

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

Print this page




 103  * </p>
 104  *
 105  * @since JavaFX 2.0
 106  */
 107 public abstract class Camera extends Node {
 108     static {
 109          // This is used by classes in different packages to get access to
 110          // private and package private methods.
 111         CameraHelper.setCameraAccessor(new CameraHelper.CameraAccessor() {
 112             @Override
 113             public void doMarkDirty(Node node, DirtyBits dirtyBit) {
 114                 ((Camera) node).doMarkDirty(dirtyBit);
 115             }
 116 
 117             @Override
 118             public void doUpdatePeer(Node node) {
 119                 ((Camera) node).doUpdatePeer();
 120             }
 121 
 122             @Override
















 123             public Point2D project(Camera camera, Point3D p) {
 124                 return camera.project(p);
 125             }
 126 
 127             @Override
 128             public Point2D pickNodeXYPlane(Camera camera, Node node, double x, double y) {
 129                 return camera.pickNodeXYPlane(node, x, y);
 130             }
 131 
 132             @Override
 133             public Point3D pickProjectPlane(Camera camera, double x, double y) {
 134                 return camera.pickProjectPlane(x, y);
 135             }
 136         });
 137     }
 138 
 139     private Affine3D localToSceneTx = new Affine3D();
 140 
 141     {
 142         // To initialize the class helper at the begining each constructor of this class


 479      * Computes pick ray for the content rendered by this camera.
 480      * @param x horizontal coordinate of the pick ray in the projected
 481      *               view, usually mouse cursor position
 482      * @param y vertical coordinate of the pick ray in the projected
 483      *               view, usually mouse cursor position
 484      * @param pickRay pick ray to be reused. New instance is created in case
 485      *                of null.
 486      * @return The PickRay instance computed based on this camera and the given
 487      *         arguments.
 488      */
 489     abstract PickRay computePickRay(double x, double y, PickRay pickRay);
 490 
 491     /**
 492      * Computes local position of the camera in the scene.
 493      * @param position Position to be reused. New instance is created in case
 494      *                 of null.
 495      * @return The position of the camera in the scene in camera local coords
 496      */
 497     abstract Vec3d computePosition(Vec3d position);
 498 
 499     /**
 500      * @treatAsPrivate implementation detail
 501      * @deprecated This is an internal API that is not intended for use and will be removed in the next version
 502      */
 503     @Deprecated
 504     @Override
 505     public BaseBounds impl_computeGeomBounds(BaseBounds bounds, BaseTransform tx) {
 506         return new BoxBounds(0, 0, 0, 0, 0, 0);
 507     }
 508 
 509     /**
 510      * @treatAsPrivate implementation detail
 511      * @deprecated This is an internal API that is not intended for use and will be removed in the next version
 512      */
 513     @Deprecated
 514     @Override
 515     protected boolean impl_computeContains(double localX, double localY) {
 516         return false;
 517     }
 518 
 519     /**
 520      * @treatAsPrivate implementation detail
 521      * @deprecated This is an internal API that is not intended for use and will be removed in the next version
 522      */
 523     @Deprecated
 524     @Override
 525     public Object impl_processMXNode(MXNodeAlgorithm alg, MXNodeAlgorithmContext ctx) {
 526         throw new UnsupportedOperationException("Not supported yet.");
 527     }
 528 
 529 }


 103  * </p>
 104  *
 105  * @since JavaFX 2.0
 106  */
 107 public abstract class Camera extends Node {
 108     static {
 109          // This is used by classes in different packages to get access to
 110          // private and package private methods.
 111         CameraHelper.setCameraAccessor(new CameraHelper.CameraAccessor() {
 112             @Override
 113             public void doMarkDirty(Node node, DirtyBits dirtyBit) {
 114                 ((Camera) node).doMarkDirty(dirtyBit);
 115             }
 116 
 117             @Override
 118             public void doUpdatePeer(Node node) {
 119                 ((Camera) node).doUpdatePeer();
 120             }
 121 
 122             @Override
 123             public BaseBounds doComputeGeomBounds(Node node,
 124             BaseBounds bounds, BaseTransform tx) {
 125                 return ((Camera) node).doComputeGeomBounds(bounds, tx);
 126             }
 127 
 128             @Override
 129             public boolean doComputeContains(Node node, double localX, double localY) {
 130                 return ((Camera) node).doComputeContains(localX, localY);
 131             }
 132 
 133             @Override
 134             public Object doProcessMXNode(Node node, MXNodeAlgorithm alg, MXNodeAlgorithmContext ctx) {
 135                 return ((Camera) node).doProcessMXNode(alg, ctx);
 136             }
 137 
 138             @Override
 139             public Point2D project(Camera camera, Point3D p) {
 140                 return camera.project(p);
 141             }
 142 
 143             @Override
 144             public Point2D pickNodeXYPlane(Camera camera, Node node, double x, double y) {
 145                 return camera.pickNodeXYPlane(node, x, y);
 146             }
 147 
 148             @Override
 149             public Point3D pickProjectPlane(Camera camera, double x, double y) {
 150                 return camera.pickProjectPlane(x, y);
 151             }
 152         });
 153     }
 154 
 155     private Affine3D localToSceneTx = new Affine3D();
 156 
 157     {
 158         // To initialize the class helper at the begining each constructor of this class


 495      * Computes pick ray for the content rendered by this camera.
 496      * @param x horizontal coordinate of the pick ray in the projected
 497      *               view, usually mouse cursor position
 498      * @param y vertical coordinate of the pick ray in the projected
 499      *               view, usually mouse cursor position
 500      * @param pickRay pick ray to be reused. New instance is created in case
 501      *                of null.
 502      * @return The PickRay instance computed based on this camera and the given
 503      *         arguments.
 504      */
 505     abstract PickRay computePickRay(double x, double y, PickRay pickRay);
 506 
 507     /**
 508      * Computes local position of the camera in the scene.
 509      * @param position Position to be reused. New instance is created in case
 510      *                 of null.
 511      * @return The position of the camera in the scene in camera local coords
 512      */
 513     abstract Vec3d computePosition(Vec3d position);
 514 
 515     /*
 516      * Note: This method MUST only be called via its accessor method.

 517      */
 518     private BaseBounds doComputeGeomBounds(BaseBounds bounds, BaseTransform tx) {


 519         return new BoxBounds(0, 0, 0, 0, 0, 0);
 520     }
 521 
 522     /*
 523      * Note: This method MUST only be called via its accessor method.

 524      */
 525     private boolean doComputeContains(double localX, double localY) {


 526         return false;
 527     }
 528 
 529     /*
 530      * Note: This method MUST only be called via its accessor method.

 531      */
 532     private Object doProcessMXNode(MXNodeAlgorithm alg, MXNodeAlgorithmContext ctx) {


 533         throw new UnsupportedOperationException("Not supported yet.");
 534     }
 535 
 536 }
< prev index next >