Bounds getBounds(int childIndex) { if (boundsAutoCompute) { ArrayList glist = (ArrayList) geometryInfo.get(childIndex); if (glist != null) { BoundingBox bbox = new BoundingBox((Bounds) null); for (int i = 0; i < glist.size(); i++) { Geometry g = (Geometry) glist.get(i); if (g != null) { GeometryRetained geometry = (GeometryRetained) g.retained; if (geometry.geoType != GeometryRetained.GEO_TYPE_NONE) { geometry.computeBoundingBox(); synchronized (geometry.geoBounds) { bbox.combine(geometry.geoBounds); } } } } return (Bounds) bbox; } else { return null; } } else { return super.getBounds(); } }
/** * This method is called when the SceneGraph becomes live. All characters used by this.string are * tesselated in this method, to avoid wait during traversal and rendering. */ @Override void setLive(boolean inBackgroundGroup, int refCount) { // Tesselate all character data and update character transforms updateCharacterData(); super.doSetLive(inBackgroundGroup, refCount); super.markAsLive(); }
@Override boolean intersect(Transform3D thisToOtherVworld, GeometryRetained geom) { int i = 0; int j, count = 0; Point3d[] pnts = new Point3d[2]; int scount; pnts[0] = new Point3d(); pnts[1] = new Point3d(); while (i < stripIndexCounts.length) { getVertexData(indexCoord[count++], pnts[0]); thisToOtherVworld.transform(pnts[0]); scount = stripIndexCounts[i++]; for (j = 1; j < scount; j++) { getVertexData(indexCoord[count++], pnts[1]); thisToOtherVworld.transform(pnts[1]); if (geom.intersect(pnts)) { return true; } pnts[0].set(pnts[1]); } } return false; }
@Override boolean intersect(Transform3D thisToOtherVworld, GeometryRetained geom) { Point3d[] points = new Point3d[4]; int i = ((vertexFormat & GeometryArray.BY_REFERENCE) == 0 ? initialVertexIndex : initialCoordIndex); points[0] = new Point3d(); points[1] = new Point3d(); points[2] = new Point3d(); points[3] = new Point3d(); while (i < validVertexCount) { getVertexData(i++, points[0]); getVertexData(i++, points[1]); getVertexData(i++, points[2]); getVertexData(i++, points[3]); thisToOtherVworld.transform(points[0]); thisToOtherVworld.transform(points[1]); thisToOtherVworld.transform(points[2]); thisToOtherVworld.transform(points[3]); if (geom.intersect(points)) { return true; } } // for each quad return false; }
@Override void setLive(boolean inBackgroundGroup, int refCount) { super.doSetLive(inBackgroundGroup, refCount); if (texture != null) { texture.setLive(inBackgroundGroup, refCount); } if (depthComponent != null) { depthComponent.setLive(inBackgroundGroup, refCount); } isEditable = source.getCapability(Raster.ALLOW_OFFSET_WRITE) || source.getCapability(Raster.ALLOW_POSITION_WRITE) || ((type & Raster.RASTER_COLOR) != 0 && source.getCapability(Raster.ALLOW_IMAGE_WRITE)) || ((type & Raster.RASTER_DEPTH) != 0 && source.getCapability(Raster.ALLOW_DEPTH_COMPONENT_WRITE)) || source.getCapability(Raster.ALLOW_SIZE_WRITE); super.markAsLive(); }
@Override boolean intersect(Transform3D thisToOtherVworld, GeometryRetained geom) { Point3d[] pnts = new Point3d[2]; // NVaidya // Bug 447: correction for loop indices int i = initialIndexIndex; int loopStopIndex = initialIndexIndex + validIndexCount; pnts[0] = new Point3d(); pnts[1] = new Point3d(); while (i < loopStopIndex) { getVertexData(indexCoord[i++], pnts[0]); getVertexData(indexCoord[i++], pnts[1]); thisToOtherVworld.transform(pnts[0]); thisToOtherVworld.transform(pnts[1]); if (geom.intersect(pnts)) { return true; } } return false; }
@Override void clearLive(int refCount) { super.clearLive(refCount); if (texture != null) texture.clearLive(refCount); if (depthComponent != null) depthComponent.clearLive(refCount); }
boolean intersect(PickInfo pickInfo, PickShape pickShape, int flags, ArrayList geometryList) { Transform3D localToVworld = pickInfo.getLocalToVWorldRef(); Transform3D t3d = new Transform3D(); t3d.invert(localToVworld); PickShape newPS = pickShape.transform(t3d); int geomListSize = geometryList.size(); GeometryRetained geometry; if (((flags & PickInfo.CLOSEST_INTERSECTION_POINT) == 0) && ((flags & PickInfo.CLOSEST_DISTANCE) == 0) && ((flags & PickInfo.CLOSEST_GEOM_INFO) == 0) && ((flags & PickInfo.ALL_GEOM_INFO) == 0)) { for (int i = 0; i < geomListSize; i++) { geometry = (GeometryRetained) geometryList.get(i); if (geometry != null) { if (geometry.mirrorGeometry != null) { geometry = geometry.mirrorGeometry; } // Need to modify this method // if (geometry.intersect(newPS, null, null)) { if (geometry.intersect(newPS, null, 0, null, null, 0)) { return true; } } } } else { double distance; double minDist = Double.POSITIVE_INFINITY; Point3d closestIPnt = new Point3d(); Point3d iPnt = new Point3d(); Point3d iPntVW = new Point3d(); for (int i = 0; i < geomListSize; i++) { geometry = (GeometryRetained) geometryList.get(i); if (geometry != null) { if (geometry.mirrorGeometry != null) { geometry = geometry.mirrorGeometry; } if (geometry.intersect(newPS, pickInfo, flags, iPnt, geometry, i)) { iPntVW.set(iPnt); localToVworld.transform(iPntVW); distance = pickShape.distance(iPntVW); if (minDist > distance) { minDist = distance; closestIPnt.set(iPnt); } } } } if (minDist < Double.POSITIVE_INFINITY) { if ((flags & PickInfo.CLOSEST_DISTANCE) != 0) { pickInfo.setClosestDistance(minDist); } if ((flags & PickInfo.CLOSEST_INTERSECTION_POINT) != 0) { pickInfo.setClosestIntersectionPoint(closestIPnt); } return true; } } return false; }