27
28 import com.sun.javafx.css.StyleManager;
29 import com.sun.javafx.scene.traversal.Direction;
30 import com.sun.javafx.scene.traversal.SubSceneTraversalEngine;
31 import com.sun.javafx.scene.traversal.TopMostTraversalEngine;
32 import javafx.application.ConditionalFeature;
33 import javafx.application.Platform;
34 import javafx.beans.NamedArg;
35 import javafx.beans.property.*;
36 import javafx.geometry.NodeOrientation;
37 import javafx.geometry.Point3D;
38 import javafx.scene.input.PickResult;
39 import javafx.scene.paint.Paint;
40
41 import java.util.ArrayList;
42 import java.util.List;
43
44 import com.sun.javafx.geom.BaseBounds;
45 import com.sun.javafx.geom.PickRay;
46 import com.sun.javafx.geom.transform.BaseTransform;
47 import com.sun.javafx.jmx.MXNodeAlgorithm;
48 import com.sun.javafx.jmx.MXNodeAlgorithmContext;
49 import com.sun.javafx.scene.CssFlags;
50 import com.sun.javafx.scene.DirtyBits;
51 import com.sun.javafx.scene.NodeHelper;
52 import com.sun.javafx.scene.SubSceneHelper;
53 import com.sun.javafx.scene.input.PickResultChooser;
54 import com.sun.javafx.sg.prism.NGCamera;
55 import com.sun.javafx.sg.prism.NGLightBase;
56 import com.sun.javafx.sg.prism.NGNode;
57 import com.sun.javafx.sg.prism.NGSubScene;
58 import com.sun.javafx.tk.Toolkit;
59
60 import sun.util.logging.PlatformLogger;
61
62 /**
63 * The {@code SubScene} class is the container for content in a scene graph.
64 * {@code SubScene} provides separation of different parts of a scene, each
65 * of which can be rendered with a different camera, depth buffer, or scene
66 * anti-aliasing. A {@code SubScene} is embedded into the main scene or another
67 * sub-scene.
68 * <p>
114 ((SubScene) node).doUpdatePeer();
115 }
116
117 @Override
118 public BaseBounds doComputeGeomBounds(Node node,
119 BaseBounds bounds, BaseTransform tx) {
120 return ((SubScene) node).doComputeGeomBounds(bounds, tx);
121 }
122
123 @Override
124 public boolean doComputeContains(Node node, double localX, double localY) {
125 return ((SubScene) node).doComputeContains(localX, localY);
126 }
127
128 @Override
129 public void doProcessCSS(Node node) {
130 ((SubScene) node).doProcessCSS();
131 }
132
133 @Override
134 public Object doProcessMXNode(Node node, MXNodeAlgorithm alg, MXNodeAlgorithmContext ctx) {
135 return ((SubScene) node).doProcessMXNode(alg, ctx);
136 }
137
138 @Override
139 public void doPickNodeLocal(Node node, PickRay localPickRay,
140 PickResultChooser result) {
141 ((SubScene) node).doPickNodeLocal(localPickRay, result);
142 }
143
144 @Override
145 public boolean isDepthBuffer(SubScene subScene) {
146 return subScene.isDepthBufferInternal();
147 };
148
149 @Override
150 public Camera getEffectiveCamera(SubScene subScene) {
151 return subScene.getEffectiveCamera();
152 }
153
154 });
155 }
156
157 {
158 // To initialize the class helper at the begining each constructor of this class
858 *
859 * Returns the picked node, null if no such node was found.
860 *
861 * Note: This method MUST only be called via its accessor method.
862 */
863 private void doPickNodeLocal(PickRay localPickRay, PickResultChooser result) {
864 final double boundsDistance = intersectsBounds(localPickRay);
865 if (!Double.isNaN(boundsDistance) && result.isCloser(boundsDistance)) {
866 final Point3D intersectPt = PickResultChooser.computePoint(
867 localPickRay, boundsDistance);
868 final PickResult subSceneResult =
869 pickRootSG(intersectPt.getX(), intersectPt.getY());
870 if (subSceneResult != null) {
871 result.offerSubScenePickResult(this, subSceneResult, boundsDistance);
872 } else if (isPickOnBounds() ||
873 subSceneComputeContains(intersectPt.getX(), intersectPt.getY())) {
874 result.offer(this, boundsDistance, intersectPt);
875 }
876 }
877 }
878
879 /*
880 * Note: This method MUST only be called via its accessor method.
881 */
882 private Object doProcessMXNode(MXNodeAlgorithm alg, MXNodeAlgorithmContext ctx) {
883 throw new UnsupportedOperationException("Not supported yet.");
884 }
885
886
887 private List<LightBase> lights = new ArrayList<>();
888
889 // @param light must not be null
890 final void addLight(LightBase light) {
891 if (!lights.contains(light)) {
892 markDirty(SubSceneDirtyBits.LIGHTS_DIRTY);
893 lights.add(light);
894 }
895 }
896
897 final void removeLight(LightBase light) {
898 if (lights.remove(light)) {
899 markDirty(SubSceneDirtyBits.LIGHTS_DIRTY);
900 }
901 }
902
903 /**
904 * PG Light synchronizer.
905 */
|
27
28 import com.sun.javafx.css.StyleManager;
29 import com.sun.javafx.scene.traversal.Direction;
30 import com.sun.javafx.scene.traversal.SubSceneTraversalEngine;
31 import com.sun.javafx.scene.traversal.TopMostTraversalEngine;
32 import javafx.application.ConditionalFeature;
33 import javafx.application.Platform;
34 import javafx.beans.NamedArg;
35 import javafx.beans.property.*;
36 import javafx.geometry.NodeOrientation;
37 import javafx.geometry.Point3D;
38 import javafx.scene.input.PickResult;
39 import javafx.scene.paint.Paint;
40
41 import java.util.ArrayList;
42 import java.util.List;
43
44 import com.sun.javafx.geom.BaseBounds;
45 import com.sun.javafx.geom.PickRay;
46 import com.sun.javafx.geom.transform.BaseTransform;
47 import com.sun.javafx.scene.CssFlags;
48 import com.sun.javafx.scene.DirtyBits;
49 import com.sun.javafx.scene.NodeHelper;
50 import com.sun.javafx.scene.SubSceneHelper;
51 import com.sun.javafx.scene.input.PickResultChooser;
52 import com.sun.javafx.sg.prism.NGCamera;
53 import com.sun.javafx.sg.prism.NGLightBase;
54 import com.sun.javafx.sg.prism.NGNode;
55 import com.sun.javafx.sg.prism.NGSubScene;
56 import com.sun.javafx.tk.Toolkit;
57
58 import sun.util.logging.PlatformLogger;
59
60 /**
61 * The {@code SubScene} class is the container for content in a scene graph.
62 * {@code SubScene} provides separation of different parts of a scene, each
63 * of which can be rendered with a different camera, depth buffer, or scene
64 * anti-aliasing. A {@code SubScene} is embedded into the main scene or another
65 * sub-scene.
66 * <p>
112 ((SubScene) node).doUpdatePeer();
113 }
114
115 @Override
116 public BaseBounds doComputeGeomBounds(Node node,
117 BaseBounds bounds, BaseTransform tx) {
118 return ((SubScene) node).doComputeGeomBounds(bounds, tx);
119 }
120
121 @Override
122 public boolean doComputeContains(Node node, double localX, double localY) {
123 return ((SubScene) node).doComputeContains(localX, localY);
124 }
125
126 @Override
127 public void doProcessCSS(Node node) {
128 ((SubScene) node).doProcessCSS();
129 }
130
131 @Override
132 public void doPickNodeLocal(Node node, PickRay localPickRay,
133 PickResultChooser result) {
134 ((SubScene) node).doPickNodeLocal(localPickRay, result);
135 }
136
137 @Override
138 public boolean isDepthBuffer(SubScene subScene) {
139 return subScene.isDepthBufferInternal();
140 };
141
142 @Override
143 public Camera getEffectiveCamera(SubScene subScene) {
144 return subScene.getEffectiveCamera();
145 }
146
147 });
148 }
149
150 {
151 // To initialize the class helper at the begining each constructor of this class
851 *
852 * Returns the picked node, null if no such node was found.
853 *
854 * Note: This method MUST only be called via its accessor method.
855 */
856 private void doPickNodeLocal(PickRay localPickRay, PickResultChooser result) {
857 final double boundsDistance = intersectsBounds(localPickRay);
858 if (!Double.isNaN(boundsDistance) && result.isCloser(boundsDistance)) {
859 final Point3D intersectPt = PickResultChooser.computePoint(
860 localPickRay, boundsDistance);
861 final PickResult subSceneResult =
862 pickRootSG(intersectPt.getX(), intersectPt.getY());
863 if (subSceneResult != null) {
864 result.offerSubScenePickResult(this, subSceneResult, boundsDistance);
865 } else if (isPickOnBounds() ||
866 subSceneComputeContains(intersectPt.getX(), intersectPt.getY())) {
867 result.offer(this, boundsDistance, intersectPt);
868 }
869 }
870 }
871
872 private List<LightBase> lights = new ArrayList<>();
873
874 // @param light must not be null
875 final void addLight(LightBase light) {
876 if (!lights.contains(light)) {
877 markDirty(SubSceneDirtyBits.LIGHTS_DIRTY);
878 lights.add(light);
879 }
880 }
881
882 final void removeLight(LightBase light) {
883 if (lights.remove(light)) {
884 markDirty(SubSceneDirtyBits.LIGHTS_DIRTY);
885 }
886 }
887
888 /**
889 * PG Light synchronizer.
890 */
|