From c71e697cf3cf62c93e4b889e7de1ad20b147e7d0 Mon Sep 17 00:00:00 2001 From: Chien Yang Date: Thu, 5 Oct 2006 04:51:12 +0000 Subject: 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 --- src/classes/share/javax/media/j3d/RenderBin.java | 143 ++++++++++++----------- 1 file changed, 72 insertions(+), 71 deletions(-) (limited to 'src/classes') 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