public Intersects ( |
||
bounds | The bounds to test for intersection. | |
Résultat | bool |
/// <summary> /// Traverse from the bottom right of the scene graph (top visible node) /// up the tree determining which parent nodes are occluded by their children /// nodes. /// </summary> /// <param name="n">The node to find occlusions for.</param> /// <param name="pickPath"> /// A pick path representing the bounds of <c>n</c> in parent coordinates. /// </param> /// <remarks> /// Note that this is only detecting a subset of occlusions (parent, child), /// others such as overlapping siblings or cousins are not detected. /// </remarks> public void DetectOcclusions(PNode n, PPickPath pickPath) { if (n.FullIntersects(pickPath.PickBounds)) { pickPath.PushMatrix(n.MatrixReference); int count = n.ChildrenCount; for (int i = count - 1; i >= 0; i--) { PNode each = n[i]; if (n.Occluded) { // if n has been occluded by a previous decendent then // this child must also be occluded each.Occluded = true; } else { // see if child each occludes n DetectOcclusions(each, pickPath); } } // see if n occludes it's parents if (!n.Occluded) { if (n.Intersects(pickPath.PickBounds)) { if (n.IsOpaque(pickPath.PickBounds)) { PNode p = n.Parent; while (p != null && !p.Occluded) { p.Occluded = true; } } } } pickPath.PopMatrix(n.MatrixReference); } }
/// <summary> /// Returns true if the node's bounds intersects the bounds specified by the /// BoundsFilter. /// </summary> /// <remarks> /// For a node to be accepted, it must also satisfy the following conditions: /// it must be pickable, it must not be the marquee node, it must not be a /// selectable parent, and the it must not be a layer that is viewed by a camera /// that is a selectable parent /// </remarks> /// <param name="node">The node to test.</param> /// <returns>True if the node is accepted; otherwise, false.</returns> public virtual bool Accept(PNode node) { localBounds = bounds; localBounds = node.GlobalToLocal(localBounds); bool boundsIntersects = node.Intersects(localBounds); bool isMarquee = (node == selectionHandler.marquee); return (node.Pickable && boundsIntersects && !isMarquee && !selectionHandler.selectableParents.Contains(node) && !IsCameraLayer(node)); }