/** Selects all the nodes that intersect the PickShape. @return An array of <code>PickInfo</code> objects which will contain information about the picked instances. <code>null</code> if nothing was picked. */ public PickInfo[] pickAll () { PickInfo[] pickInfos = null; if (pickRootBG != null) { pickInfos = pickRootBG.pickAll(mode, flags, pickShape); } else if (pickRootL != null) { pickInfos = pickRootL.pickAll(mode, flags, pickShape); } return pickInfos; }
/** * Returns an array referencing all the items that are pickable below the * <code>BranchGroup</code> (specified in the PickObject constructor) that * intersect with a ray that starts at the * viewer position and points into the scene in the direction of (xpos, ypos) * specified in window space. The resultant array is unordered. * * @param xpos The value along the x-axis. * @param ypos The value along the y-axis. * @return The array of SceneGraphPath objects that contain Objects that * were picked * If no pickable object is found <code>null</code> is returned.. * * @see SceneGraphPath */ public SceneGraphPath[] pickAll(int xpos, int ypos) { pickRay = (PickRay) generatePickRay(xpos, ypos); sceneGraphPathArr = pickRoot.pickAll(pickRay); return sceneGraphPathArr; }
private PickResult[] pickAll (PickShape pickShape) { PickResult[] pr = null; SceneGraphPath[] sgp = null; if (pickRootBG != null) { sgp = pickRootBG.pickAll (pickShape); } else if (pickRootL != null) { sgp = pickRootL.pickAll (pickShape); } if (sgp == null) return null; // no match // Create PickResult array pr = new PickResult [sgp.length]; for (int i=0;i<sgp.length;i++) { pr[i] = new PickResult (sgp[i], pickShape); } return pr; }
private PickResult[] pickGeomAllIntersect(PickShape pickShape) { SceneGraphPath[] sgp = null; Node obj[] = null; int i, cnt=0; // First pass if (pickRootBG != null) { sgp = pickRootBG.pickAll(pickShape); } else if (pickRootL != null) { sgp = pickRootL.pickAll(pickShape); } if (sgp == null) return null; // no match // Second pass, check to see if geometries intersected boolean found[] = new boolean [sgp.length]; PickResult[] pr = new PickResult[sgp.length]; for (i=0; i<sgp.length; i++) { pr[i] = new PickResult (sgp[i], pickShape); if (pr[i].numIntersections() > 0) { found[i] = true; cnt++; } } if (cnt == 0) return null; // no match PickResult[] newpr = new PickResult[cnt]; cnt = 0; // reset for reuse. for(i=0; i<sgp.length; i++) { if(found[i] == true) pr[cnt++] = pr[i]; } return pr; }
private SceneGraphPath pickGeomAny(int xpos, int ypos) { Node obj; int i; pickRay = (PickRay) generatePickRay(xpos, ypos); sceneGraphPathArr = pickRoot.pickAll(pickRay); for(i=0; i<sceneGraphPathArr.length; i++) { obj = sceneGraphPathArr[i].getObject(); if(obj instanceof Shape3D) { if(((Shape3D) obj).intersect(sceneGraphPathArr[i],(PickShape) pickRay)) return sceneGraphPathArr[i]; } else if(obj instanceof Morph) { if(((Morph) obj).intersect(sceneGraphPathArr[i],(PickShape) pickRay)) return sceneGraphPathArr[i]; } } return null; }
private PickResult pickGeomAnyIntersect(PickShape pickShape) { Node obj = null; int i; SceneGraphPath[] sgpa = null; if (pickRootBG != null) { sgpa = pickRootBG.pickAll(pickShape); } else if (pickRootL != null) { sgpa = pickRootL.pickAll(pickShape); } if (sgpa == null) return null; // no match for(i=0; i<sgpa.length; i++) { PickResult pr = new PickResult(sgpa[i], pickShape); pr.setFirstIntersectOnly(true); if (pr.numIntersections() > 0) { return pr; } } return null; }
sceneGraphPathArr = pickRoot.pickAll(pickRay);
private PickResult pickGeomAny (PickShape pickShape) { Node obj = null; int i; SceneGraphPath[] sgpa = null; if (pickRootBG != null) { sgpa = pickRootBG.pickAll(pickShape); } else if (pickRootL != null) { sgpa = pickRootL.pickAll(pickShape); } if (sgpa == null) return null; // no match for(i=0; i<sgpa.length; i++) { obj = sgpa[i].getObject(); PickResult pr = new PickResult(sgpa[i], pickShape); if(obj instanceof Shape3D) { if(((Shape3D) obj).intersect(sgpa[i], pickShape)) { return pr; } } else if (obj instanceof Morph) { if(((Morph) obj).intersect(sgpa[i], pickShape)){ return pr; } } } return null; }
sgp = pickRootBG.pickAll(pickShape); } else if (pickRootL != null) { sgp = pickRootL.pickAll(pickShape);
sceneGraphPathArr = pickRoot.pickAll(pickRay);
sgp = pickRootBG.pickAll(pickShape); } else if (pickRootL != null) { sgp = pickRootL.pickAll(pickShape);
sgp = pickRootBG.pickAll(pickShape); } else if (pickRootL != null) { sgp = pickRootL.pickAll(pickShape);