aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/share/javax
diff options
context:
space:
mode:
authorChien Yang <[email protected]>2006-10-05 04:51:12 +0000
committerChien Yang <[email protected]>2006-10-05 04:51:12 +0000
commitc71e697cf3cf62c93e4b889e7de1ad20b147e7d0 (patch)
tree19f79cc45c9e1da014e00ef1db7488f7912ae3f0 /src/classes/share/javax
parent12427076a5b420b2afba3a34c6ed0f260f6fa2f4 (diff)
Fix to Issue 356 : Exception in RenderBin when removing a Shape3D with no geometry
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@710 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src/classes/share/javax')
-rw-r--r--src/classes/share/javax/media/j3d/RenderBin.java143
1 files changed, 72 insertions, 71 deletions
diff --git a/src/classes/share/javax/media/j3d/RenderBin.java b/src/classes/share/javax/media/j3d/RenderBin.java
index 81cc46a..138d458 100644
--- a/src/classes/share/javax/media/j3d/RenderBin.java
+++ b/src/classes/share/javax/media/j3d/RenderBin.java
@@ -6808,81 +6808,82 @@ System.out.println("......tb.soleUser= " +
void removeNodes(J3dMessage m) {
- Object[] nodes;
- ArrayList viewScopedNodes = (ArrayList)m.args[3];
- ArrayList scopedNodesViewList = (ArrayList)m.args[4];
- int i, j;
- nodes = (Object[])m.args[0];
- for (int n = 0; n < nodes.length; n++) {
- if (nodes[n] instanceof GeometryAtom) {
- visGAIsDirty = true;
- visQuery = true;
- RenderAtom ra =
- ((GeometryAtom)nodes[n]).getRenderAtom(view);
- if (ra != null && ra.inRenderBin()) {
- renderAtoms.remove(renderAtoms.indexOf(ra));
- removeARenderAtom(ra);
- }
-
+ Object[] nodes;
+ ArrayList viewScopedNodes = (ArrayList)m.args[3];
+ ArrayList scopedNodesViewList = (ArrayList)m.args[4];
+ int i, j;
+ nodes = (Object[])m.args[0];
+ for (int n = 0; n < nodes.length; n++) {
+ if (nodes[n] instanceof GeometryAtom) {
+ visGAIsDirty = true;
+ visQuery = true;
+ RenderAtom ra =
+ ((GeometryAtom)nodes[n]).getRenderAtom(view);
+ if (ra != null && ra.inRenderBin()) {
+ renderAtoms.remove(renderAtoms.indexOf(ra));
+ removeARenderAtom(ra);
+ }
+
// This code segment is to handle the texture resource cleanup
// for Raster object.
GeometryAtom geomAtom = (GeometryAtom) nodes[n];
- GeometryRetained geomRetained = geomAtom.geometryArray[0];
- if ((geomRetained != null) &&
- (geomRetained instanceof RasterRetained )) {
- addTextureResourceFreeList(((RasterRetained)geomRetained).texture);
- }
- }
- else if (nodes[n] instanceof AlternateAppearanceRetained) {
- altAppearanceDirty = true;
- }
- else if (nodes[n] instanceof BackgroundRetained) {
- reEvaluateBg = true;
- }
- else if (nodes[n] instanceof ClipRetained) {
- reEvaluateClip = true;
- } else if (nodes[n] instanceof ModelClipRetained) {
- envDirty |= REEVALUATE_MCLIP;
- } else if (nodes[n] instanceof FogRetained) {
- envDirty |= REEVALUATE_FOG;
- }
- if (nodes[n] instanceof LightRetained) {
- envDirty |= REEVALUATE_LIGHTS;
- }
- }
- // Handle ViewScoped Nodes
- if (viewScopedNodes != null) {
- int size = viewScopedNodes.size();
- int vlsize;
- Object node;
- for (i = 0; i < size; i++) {
- node = (NodeRetained)viewScopedNodes.get(i);
- ArrayList vl = (ArrayList) scopedNodesViewList.get(i);
- // If the node object is scoped to this view, then ..
- if (vl.contains(view)) {
- if (node instanceof LightRetained) {
- envDirty |= REEVALUATE_LIGHTS;
- } else if (node instanceof FogRetained) {
- envDirty |= REEVALUATE_FOG;
- } else if (node instanceof BackgroundRetained) {
- // If a new background is inserted, then
- // re_evaluate to determine if this backgrouns
- // should be used
- reEvaluateBg = true;
- } else if (node instanceof ClipRetained) {
- reEvaluateClip = true;
- } else if (node instanceof ModelClipRetained) {
- envDirty |= REEVALUATE_MCLIP;
+ if(geomAtom.geometryArray != null) {
+ for(int ii=0; ii<geomAtom.geometryArray.length; ii++) {
+ GeometryRetained geomRetained = geomAtom.geometryArray[ii];
+ if ((geomRetained != null) &&
+ (geomRetained instanceof RasterRetained )) {
+ addTextureResourceFreeList(((RasterRetained)geomRetained).texture);
+ }
+ }
+ }
+ } else if (nodes[n] instanceof AlternateAppearanceRetained) {
+ altAppearanceDirty = true;
+ } else if (nodes[n] instanceof BackgroundRetained) {
+ reEvaluateBg = true;
+ } else if (nodes[n] instanceof ClipRetained) {
+ reEvaluateClip = true;
+ } else if (nodes[n] instanceof ModelClipRetained) {
+ envDirty |= REEVALUATE_MCLIP;
+ } else if (nodes[n] instanceof FogRetained) {
+ envDirty |= REEVALUATE_FOG;
+ }
+ if (nodes[n] instanceof LightRetained) {
+ envDirty |= REEVALUATE_LIGHTS;
+ }
+ }
+ // Handle ViewScoped Nodes
+ if (viewScopedNodes != null) {
+ int size = viewScopedNodes.size();
+ int vlsize;
+ Object node;
+ for (i = 0; i < size; i++) {
+ node = (NodeRetained)viewScopedNodes.get(i);
+ ArrayList vl = (ArrayList) scopedNodesViewList.get(i);
+ // If the node object is scoped to this view, then ..
+ if (vl.contains(view)) {
+ if (node instanceof LightRetained) {
+ envDirty |= REEVALUATE_LIGHTS;
+ } else if (node instanceof FogRetained) {
+ envDirty |= REEVALUATE_FOG;
+ } else if (node instanceof BackgroundRetained) {
+ // If a new background is inserted, then
+ // re_evaluate to determine if this backgrouns
+ // should be used
+ reEvaluateBg = true;
+ } else if (node instanceof ClipRetained) {
+ reEvaluateClip = true;
+ } else if (node instanceof ModelClipRetained) {
+ envDirty |= REEVALUATE_MCLIP;
+
+ } else if (node instanceof AlternateAppearanceRetained) {
+ altAppearanceDirty = true;
+ }
+ // Note: geometryAtom is not part of viewScopedNodes
+ // Its a part of orginal nodes even if scoped
+ }
- } else if (node instanceof AlternateAppearanceRetained) {
- altAppearanceDirty = true;
- }
- // Note: geometryAtom is not part of viewScopedNodes
- // Its a part of orginal nodes even if scoped
- }
-
- }
- }
+ }
+ }
}
void cleanup() {