/// <summary> /// Traverses the specified graph path</summary> /// <param name="graphPath">The graph path</param> /// <param name="action">The render action</param> /// <param name="camera">The camera</param> /// <param name="list">The list</param> /// <returns></returns> public override TraverseState Traverse(Stack<SceneNode> graphPath, IRenderAction action, Camera camera, ICollection<TraverseNode> list) { // Get the "top matrix" before we push a new matrix on to it, just in case we need // it for the bounding box test. Matrix4F parentToWorld = action.TopMatrix; // Push matrix onto the matrix stack even if we're not visible because this class // implements the marker interface ISetsLocalTransform. action.PushMatrix(m_node.Transform, true); // If node is invisible then cull if (!m_node.Visible) return TraverseState.Cull; TraverseState dResult = action.TraverseState; if (dResult == TraverseState.None) { // Test if bounding sphere is contained in frustum if (s_enableVFCull) { // Construct bounding box Box box = new Box(); box.Extend(m_node.BoundingBox); // Transform the bounding box into view space Matrix4F localToView = Matrix4F.Multiply(parentToWorld, camera.ViewMatrix); box.Transform(localToView); if (!camera.Frustum.Contains(box)) dResult = TraverseState.Cull; } } return dResult; }
/// <summary> /// Calculates the bounding box for the instance</summary> /// <returns>Bounding box</returns> public Box CalculateBoundingBox() { Box box = new Box(); foreach (IBoundable boundable in DomNode.Children.AsIEnumerable<IBoundable>()) box.Extend(boundable.BoundingBox); return box; }
/// <summary> /// Calculates the bounding box for the instance</summary> /// <returns>Bounding box</returns> public Box CalculateBoundingBox() { Box box = new Box(); foreach (IBoundable boundable in DomNode.Children.AsIEnumerable<IBoundable>()) box.Extend(boundable.BoundingBox); //m_box.Transform(Transform); //Look at the schema -- "lodgroupType" does not have a transformation return box; }
/// <summary> /// Calculates bounding box of node's children</summary> /// <returns>Bounding box of children</returns> public Box CalculateBoundingBox() { var box = new Box(); foreach (IBoundable boundable in DomNode.Children.AsIEnumerable<IBoundable>()) box.Extend(boundable.BoundingBox); box.Transform(Transform); DomNodeUtil.SetBox(DomNode, Schema.nodeType.boundingBoxAttribute, box); return box; }
/// <summary> /// Calculates the geometry's bounding box</summary> /// <returns>Bounding box for geometry</returns> public Box CalculateBoundingBox() { Box box = new Box(); foreach (DataSet dataSet in DataSets) { if (dataSet.Name == "position") { box.Extend(dataSet.Data); break; } } DomNodeUtil.SetBox(DomNode, Schema.meshType.boundingBoxAttribute, box); return box; }
private Box CalculateBoundingBox() { // compute box. var box = new Box(); foreach (InstanceGeometry instGeom in GetChildList<InstanceGeometry>(Schema.node.instance_geometryChild)) { box.Extend(instGeom.Geometry.BoundingBox); } foreach (InstanceController instCtrl in GetChildList<InstanceController>(Schema.node.instance_controllerChild)) { box.Extend(instCtrl.Geometry.BoundingBox); } foreach (Node nd in GetChildList<Node>(Schema.node.nodeChild)) { box.Extend(nd.BoundingBox); } box.Transform(Transform); return box; }
private Box CalculateBoundingBox() { var box = new Box(); foreach (PrimInput input in m_inputs) { if (input.Semantic == "POSITION") { box.Extend(input.Data); break; } } return box; }