/** * Pushes the transform matrix onto the specified cull context. * @param cc the cull context. */ protected void cullBegin(CullContext cc) { super.cullBegin(cc); cc.pushLocalToWorld(_transform); }
/** * Pops the transform matrix from the specified cull context. * @param cc the cull context. */ protected void cullEnd(CullContext cc) { cc.popLocalToWorld(); super.cullEnd(cc); }
/** * Removes the specified child node from this group's list of children. If * the node is not a child of this group, then this method does nothing. * @param child the child node. */ public void removeChild(Node child) { if (child.removeParent(this)) { _childList.remove(child); dirtyBoundingSphere(); dirtyDraw(); World worldGroup = getWorld(); if (worldGroup!=null) worldGroup.updateSelectedSet(child); } }
private void buildTree(Group parent, BoundingBoxTree.Node bbtNode, int[] ijkl, float[] xyz, float[] uvw, float[] rgb) { if (bbtNode.isLeaf()) { QuadNode qn = new QuadNode(bbtNode,ijkl,xyz,uvw,rgb); parent.addChild(qn); } else { Group group = new Group(); parent.addChild(group); buildTree(group,bbtNode.getLeft(),ijkl,xyz,uvw,rgb); buildTree(group,bbtNode.getRight(),ijkl,xyz,uvw,rgb); } }
/** * Pops the view-dependent transform from the specified draw context. * @param dc the draw context. */ protected void drawEnd(DrawContext dc) { dc.popLocalToWorld(); glPopMatrix(); super.drawEnd(dc); }
/** * Computes the bounding sphere for this handle. * @param finite true, to force bounding sphere to be finite. * @return the bounding sphere. */ protected BoundingSphere computeBoundingSphere(boolean finite) { _boundingSphereChildren = super.computeBoundingSphere(true); return (finite)?BoundingSphere.empty():BoundingSphere.infinite(); }
/** * Pushes the transform matrix onto the specified draw context. * @param dc the draw context. */ protected void drawBegin(DrawContext dc) { super.drawBegin(dc); dc.pushLocalToWorld(_transform); glPushMatrix(); glMultMatrixd(_transform.m,0); }
/** * Marks dirty the bounding sphere of this world. */ public void dirtyBoundingSphere() { super.dirtyBoundingSphere(); }
/** * Marks dirty the drawing of this node. Calling this method causes * a repaint of all view canvases in which this node may be rendered. */ public void dirtyDraw() { for (Group parent : _parentList) parent.dirtyDraw(); }
public void addChild(Node node) { super.addChild(node); if (node instanceof AxisAlignedPanel) { AxisAlignedPanel panel = (AxisAlignedPanel)node; Check.state(panel.getFrame()==null,"frame of panel equals null"); panel.setFrame(this); } }
/** * Computes the bounding sphere for this group, including its children. * @param finite true, to force bounding sphere to be finite. * @return the computed bounding sphere. */ protected BoundingSphere computeBoundingSphere(boolean finite) { if (countChildren()==1) { return _childList.get(0).getBoundingSphere(finite); } else { BoundingBox bb = new BoundingBox(); for (Node child : _childList) bb.expandBy(child.getBoundingSphere(finite)); if (bb.isEmpty()) return BoundingSphere.empty(); if (bb.isInfinite()) // should not happen if finite == true return BoundingSphere.infinite(); BoundingSphere bs = new BoundingSphere(bb.getCenter(),0.0); for (Node child : _childList) bs.expandRadiusBy(child.getBoundingSphere(finite)); return bs; } }
private void buildTree(Group parent, BoundingBoxTree.Node bbtNode, int[] ijk, float[] xyz, float[] uvw, float[] rgb) { if (bbtNode.isLeaf()) { TriangleNode tn = new TriangleNode(bbtNode,ijk,xyz,uvw,rgb); parent.addChild(tn); } else { Group group = new Group(); parent.addChild(group); buildTree(group,bbtNode.getLeft(),ijk,xyz,uvw,rgb); buildTree(group,bbtNode.getRight(),ijk,xyz,uvw,rgb); } }
/** * Pops the transform matrix from the specified draw context. * @param dc the draw context. */ protected void drawEnd(DrawContext dc) { dc.popLocalToWorld(); glPopMatrix(); super.drawEnd(dc); }
BoundingSphere bs = super.computeBoundingSphere(finite); if (!bs.isEmpty() && !bs.isInfinite()) { double r = bs.getRadius();
/** * Pushes the view-dependent transform onto the specified draw context. * @param dc the draw context. */ protected void drawBegin(DrawContext dc) { super.drawBegin(dc); Matrix44 transform = computeTransform(dc); dc.pushLocalToWorld(transform); glPushMatrix(); glMultMatrixd(transform.m,0); }
/** * Marks dirty the bounding sphere of this node (and any parent nodes). * If dirty when the method {@link #getBoundingSphere(boolean)} * is next called, this node's bounding sphere will be recomputed. */ public void dirtyBoundingSphere() { if (_boundingSphere!=null) { _boundingSphere = null; for (Group parent : _parentList) parent.dirtyBoundingSphere(); } }
/** * Adds the specified child node to this group's list of children. If the * node is already a child of this group, then this method does nothing. * <p> * The child must not be a world (root) node, because a world has no * parents. Also, if this group is in a world, the child must not already * be in a different world. A node cannot be in more than one world at a * time; it must be removed from one world before it can be added to another. * @param child the child node. */ public void addChild(Node child) { Check.argument(!(child instanceof World),"child is not a world"); World worldChild = child.getWorld(); World worldGroup = getWorld(); Check.argument( worldChild==null || worldGroup==null || worldChild==worldGroup, "child is not already in a different world"); if (child.addParent(this)) { _childList.add(child); dirtyBoundingSphere(); dirtyDraw(); if (worldGroup!=null) worldGroup.updateSelectedSet(child); } }
private void buildTree( Group parent, BoundingBoxTree.Node bbtNode, float[] xyz, float[] rgb) { if (bbtNode.isLeaf()) { PointNode pn; if (_size>0.0f) { pn = new PointNode(bbtNode,_size,xyz,rgb); } else { pn = new PointNode(bbtNode,xyz,rgb); } parent.addChild(pn); } else { Group group = new Group(); parent.addChild(group); buildTree(group,bbtNode.getLeft(),xyz,rgb); buildTree(group,bbtNode.getRight(),xyz,rgb); } }
/** * Pops the view-dependent transform from the specified cull context. * @param cc the cull context. */ protected void cullEnd(CullContext cc) { cc.popLocalToWorld(); super.cullEnd(cc); }
/** * Pushes the view-dependent transform onto the specified cull context. * @param cc the cull context. */ protected void cullBegin(CullContext cc) { super.cullBegin(cc); Matrix44 transform = computeTransform(cc); cc.pushLocalToWorld(transform); }