当前位置: 首页>>代码示例>>C#>>正文


C# BoundingFrustum.Contains方法代码示例

本文整理汇总了C#中BoundingFrustum.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# BoundingFrustum.Contains方法的具体用法?C# BoundingFrustum.Contains怎么用?C# BoundingFrustum.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BoundingFrustum的用法示例。


在下文中一共展示了BoundingFrustum.Contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CullMeshes

        public void CullMeshes(ref ChunkCoordinate current, ref BoundingFrustum frustum)
        {
            BoundingBox box;
            if (!current.Equals(ref _previous))
            {
                _solidMeshes.Sort((x, y) => x.Position.LengthSquared().CompareTo(y.Position.LengthSquared()));
                _transparentMeshes.Sort((x, y) => -x.Position.LengthSquared().CompareTo(y.Position.LengthSquared()));
            }

            for (int i = 0; i < _solidMeshes.Count; i++)
            {
                _solidMeshes[i].GetBoundingBox(out box);
                if (frustum.Contains(box) != ContainmentType.Disjoint)
                {
                    _solidMeshRenderQueue.Enqueue(_solidMeshes[i]);
                }
            }

            for (int i = 0; i < _transparentMeshes.Count; i++)
            {
               _transparentMeshes[i].GetBoundingBox(out box);
               if (frustum.Contains(box) != ContainmentType.Disjoint)
               {
                   _transparentMeshRenderQueue.Enqueue(_transparentMeshes[i]);
               }
            }
        }
开发者ID:lancelot2112,项目名称:CubeEngine,代码行数:27,代码来源:ChunkMeshRenderer.cs

示例2: BoundingFrustumToBoundingBoxTests

        public void BoundingFrustumToBoundingBoxTests()
        {
            var view = Matrix.CreateLookAt(new Vector3(0, 0, 5), Vector3.Zero, Vector3.Up);
            var projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, 1, 1, 100);
            var testFrustum = new BoundingFrustum(view * projection);

            var bbox1 = new BoundingBox(new Vector3(0, 0, 0), new Vector3(1, 1, 1));
            Assert.That(testFrustum.Contains(bbox1), Is.EqualTo(ContainmentType.Contains));
            Assert.That(testFrustum.Intersects(bbox1), Is.True);

            var bbox2 = new BoundingBox(new Vector3(-1000, -1000, -1000), new Vector3(1000, 1000, 1000));
            Assert.That(testFrustum.Contains(bbox2), Is.EqualTo(ContainmentType.Intersects));
            Assert.That(testFrustum.Intersects(bbox2), Is.True);

            var bbox3 = new BoundingBox(new Vector3(-1000, -1000, -1000), new Vector3(0, 0, 0));
            Assert.That(testFrustum.Contains(bbox3), Is.EqualTo(ContainmentType.Intersects));
            Assert.That(testFrustum.Intersects(bbox3), Is.True);

            var bbox4 = new BoundingBox(new Vector3(-1000, -1000, -1000), new Vector3(-500, -500, -500));
            Assert.That(testFrustum.Contains(bbox4), Is.EqualTo(ContainmentType.Disjoint));
            Assert.That(testFrustum.Intersects(bbox4), Is.False);
        }
开发者ID:BrainSlugs83,项目名称:MonoGame,代码行数:22,代码来源:Bounding.cs

示例3: StartFrame

        public override void StartFrame(ref Matrix view, ref Matrix projection, BoundingFrustum frustrum)
        {
            forward.Clear();
            deferred.Clear();
            
            foreach (var item in world.Objects)
            {
                if (item.Material.MaterialType == MaterialType.DEFERRED)
                {
                    if ( (item.PhysicObject.PhysicObjectTypes == PhysicObjectTypes.GHOST && item.PhysicObject.BoundingBox.HasValue == false ) || item.PhysicObject.PhysicObjectTypes == PhysicObjectTypes.NONE)
                    {
                        deferred.Add(item);
                        continue;
                    }

                    if (frustrum.Contains(item.PhysicObject.BoundingBox.Value) != Microsoft.Xna.Framework.ContainmentType.Disjoint)
                    {
                        deferred.Add(item);
                    }
                }
                else
                {
                    if ( (item.PhysicObject.PhysicObjectTypes == PhysicObjectTypes.GHOST && item.PhysicObject.BoundingBox.HasValue == false ) || item.PhysicObject.PhysicObjectTypes == PhysicObjectTypes.NONE)
                    {
                        forward.Add(item);
                        continue;
                    }

                    if (frustrum.Contains(item.PhysicObject.BoundingBox.Value) != Microsoft.Xna.Framework.ContainmentType.Disjoint)
                    {
                        forward.Add(item);
                    }    
                }
            }
            num = forward.Count + deferred.Count;
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:36,代码来源:SimpleCuller.cs

示例4: Draw

 public void Draw(Effect GBuffer, BoundingFrustum cameraFrustrum)
 {
     BoundingBox transformedBox = XNAUtils.TransformBoundingBox(nodeBoundingBox, Matrix.Identity);
     ContainmentType cameraNodeContainment = cameraFrustrum.Contains(transformedBox);
     if (cameraNodeContainment != ContainmentType.Disjoint)
     {
         if (isEndNode)
         {
             DrawCurrentNode(Matrix.Identity, Camera.viewMatrix, Camera.projectionMatrix, GBuffer);
         }
         else
         {
             nodeUL.Draw(GBuffer, cameraFrustrum);
             nodeUR.Draw(GBuffer, cameraFrustrum);
             nodeLL.Draw(GBuffer, cameraFrustrum);
             nodeLR.Draw(GBuffer, cameraFrustrum);
         }
     }
 }
开发者ID:patrykos91,项目名称:Laikos,代码行数:19,代码来源:QTNode.cs

示例5: Process

 public List<SimpleModel> Process(BoundingFrustum frustum)
 {
     List<SimpleModel> drawnObjects = new List<SimpleModel>();
     if (frustum.Contains(BoundingBox) != ContainmentType.Disjoint)
     {
         drawnObjects.AddRange(Objects);
         foreach (var node in childNodes)
         {
             drawnObjects.AddRange(node.Process(frustum));
         }
     }
     return drawnObjects;
 }
开发者ID:reubencummins,项目名称:3dgraphicsengine,代码行数:13,代码来源:QuadTree.cs

示例6: Render

        public void Render(BoundingFrustum frustum)
        {
            int vertices = 0;
            uint cx = x;
            uint cy = y; //cache = anti-earthquake
            uint cz = z;
            Matrix world = Matrix.Identity;
            Vector3 middle = new Vector3(8, 8, 8);
            foreach (var node in vertexBuffers.AsEnumerable)
            {
                if (node.Value == null)
                    continue;
                world.Translation = new Vector3((int)(node.Key.X - cx), (int)(node.Key.Y - cy), (int)(node.Key.Z - cz));
                bs.Center = middle + world.Translation;

                if (ContainmentType.Disjoint == frustum.Contains(bs))
                    continue;
                effect.WMatrix = world;

                effect.BeginPass3D();
                device.Indices = Static.Indices;
                device.Vertices[0].SetSource(node.Value.VertexBuffer, 0, VertexAwesome.SizeInBytes);
                Action<int> draw =
                    i =>
                    {
                        if (node.Value.Count[i] != 0)
                        {
                            device.DrawIndexedPrimitives(PrimitiveType.TriangleList, node.Value.Offset[i], 0, node.Value.Count[i], 0, node.Value.Count[i] / 2);
                            vertices += node.Value.Count[i];
                        }
                    };
                if (node.Key.Z - cz - 1 > 0x80000000) draw(0);
                if (node.Key.Z - cz + 16 < 0x80000000) draw(1);
                if (node.Key.X - cx - 1 > 0x80000000) draw(2);
                if (node.Key.X - cx + 16 < 0x80000000) draw(3);
                if (node.Key.Y - cy - 1 > 0x80000000) draw(4);
                if (node.Key.Y - cy + 16 < 0x80000000) draw(5);
                if (node.Value.Count[6] != 0)
                {
                    device.DrawPrimitives(PrimitiveType.TriangleList, node.Value.Offset[6], node.Value.Count[6] / 3);
                    vertices += node.Value.Count[6];
                }
                effect.EndPass3D();
            }
            this.Vertices = vertices;
        }
开发者ID:olydis,项目名称:FineCraft,代码行数:46,代码来源:DynamicRangeChunkVolume.cs

示例7: PartiallySortBodies

 /// <summary>
 /// Randomly calculates a few Bodies' distances to the Focus
 /// Then sorts the resulting list
 /// Then calculates the screen size of the closest items
 /// In the Process, a list of active Bodies and their containers is made
 /// </summary>
 /// <param name="Focus">Unprojection of the middle of the screen into a ray</param>
 /// <param name="Bodies">Will be rearranged</param>
 /// <param name="VisibleBodies">Should be cleared before input from Manager</param>
 /// <param name="ContainingBodies">Should be cleared before input from Manager</param>
 public static void PartiallySortBodies(Ray Focus, BoundingFrustum VisibleArea, ref List<Body> Bodies
     , ref List<Body> VisibleBodies, ref List<Body> ContainingBodies)
 {
     List<Body> CalculatorBodies = new List<Body>();
     int calculators = (int)Math.Sqrt(Bodies.Count);
     for (int i = 0; i < calculators && Bodies.Count > 0; i++)
     {
         int index = MyGame.random.Next(Bodies.Count);
         CalculatorBodies.Add(Bodies[index]);
         Bodies.RemoveAt(index);
         Vector3 FocusToBody = CalculatorBodies[i].Transforms.Position - Focus.Position;
         CalculatorBodies[i].DistanceToCenter = (FocusToBody
             - Focus.Direction * Vector3.Dot(FocusToBody, Focus.Direction)).Length();
     }
     Bodies.AddRange(CalculatorBodies);
     CalculatorBodies.Clear();
     //Merge Sort with two lists
     List<List<Body>> MergeBodies = new List<List<Body>>();
     for (int i = 0; i < Bodies.Count; i++)
     {
         MergeBodies.Add(new List<Body>());
         MergeBodies[i].Add(Bodies[i]);
     }
     while (MergeBodies.Count > 1)
     {
         for (int i = 0; i < MergeBodies.Count - 1; i++)
         {
             for (int a = 0; a < MergeBodies[i].Count; a++)
             {
                 for (int b = 0; b < MergeBodies[i + 1].Count; b++)
                 {
                     if (MergeBodies[i + 1][b].DistanceToCenter < MergeBodies[i][a].DistanceToCenter)
                     {
                         MergeBodies[i].Insert(a++, MergeBodies[i + 1][b]);
                         MergeBodies[i + 1].RemoveAt(b--);
                     }
                 }
             }
             MergeBodies[i].AddRange(MergeBodies[i + 1]);
             MergeBodies.RemoveAt(i + 1);
         }
     }
     Bodies = MergeBodies[0];
     //Screen size calculation
     for (int i = 0; i < Bodies.Count; i++)
     {
         Bodies[i].ScreenPosition = Cursor.Project(VisibleArea
             , Bodies[i].Bounds.Center);
         Bodies[i].ScreenScale =
             (float)Math.Atan2(
                 Bodies[i].Bounds.Radius
                 , (Bodies[i].Bounds.Center - Manager.CameraFocus - Manager.CameraLocation).Length())
             * Manager.GameWindow.Width / 2.0f;
         if (VisibleArea.Contains(Bodies[i].Bounds) != ContainmentType.Disjoint)
         {
             if (Bodies[i].ScreenScale / 10 > 1.0f)
             {
                 Bodies[i].InitializeNestedBodies();
             }
             else
             {
                 Bodies[i].DisposeNextedBodies();
             }
             if (Bodies[i].ScreenScale > Manager.GameWindow.Width / 10.0f)
             {
                 if (Bodies[i].NestedBodies.Count > 0)
                 {
                     PartiallySortBodies(Focus, VisibleArea, ref Bodies[i].NestedBodies, ref VisibleBodies, ref ContainingBodies);
                     float DisplayOpacity = Bodies[i].ScreenScale / Manager.GameWindow.Width * 10.0f - 1.0f;
                     if (DisplayOpacity > 1.0f)
                     {
                         DisplayOpacity = 1.0f;
                     }
                     for (int j = 0; j < Bodies[i].NestedBodies.Count; j++)
                     {
                         Bodies[i].NestedBodies[j].DisplayOpacity = DisplayOpacity;
                     }
                     Bodies[i].DisplayOpacity = 1.0f - DisplayOpacity;
                     ContainingBodies.Add(Bodies[i]);
                 }
                 else
                 {
                     VisibleBodies.Add(Bodies[i]);
                 }
             }
             else
             {
                 VisibleBodies.Add(Bodies[i]);
             }
         }
//.........这里部分代码省略.........
开发者ID:kaysoky,项目名称:AstronomicalSimulator,代码行数:101,代码来源:Body.cs

示例8: Draw

        /// <summary>
        /// Draws every mesh within the model using ScalePositionRotation properties
        /// Draws all Nested Bodies with an Offset of Position
        /// </summary>
        public virtual void Draw(BoundingFrustum VisibleArea, Vector3 Position)
        {
            if (VisibleArea.Contains(Bounds) != ContainmentType.Disjoint)
            {
                if (ModelVertices != null)
                {
                    Matrix transform = transforms.Rotation
                        * Matrix.CreateScale(transforms.Scale)
                        * Matrix.CreateTranslation(transforms.Position + Position);
                    effect.Parameters["World"].SetValue(transform);
                    MyGame.graphics.GraphicsDevice.VertexDeclaration = DefaultDeclaration;

                    effect.Begin();
                    effect.CurrentTechnique.Passes.First<EffectPass>().Begin();
                    MyGame.graphics.GraphicsDevice.DrawUserIndexedPrimitives<VertexPositionTexture>(
                        PrimitiveType.TriangleList
                        , ModelVertices
                        , 0
                        , ModelVertices.Length
                        , ModelIndices
                        , 0
                        , ModelIndices.Length / 3);
                    effect.CurrentTechnique.Passes.First<EffectPass>().End();
                    effect.End();
                }
                for (int i = 0; i < NestedBodies.Count; i++)
                {
                    NestedBodies[i].Draw(VisibleArea, transforms.Position + Position);
                }
            }
        }
开发者ID:kaysoky,项目名称:AstronomicalSimulator,代码行数:35,代码来源:Body.cs

示例9: GetEntitiesInView

 internal IEnumerable<Entity> GetEntitiesInView(BoundingFrustum bf)
 {
     return entities.Where(x => bf.Contains(x.Box) == ContainmentType.Contains).Except(new[]{player});
 }
开发者ID:Frib,项目名称:LD24,代码行数:4,代码来源:Island.cs

示例10: Render

        public void Render(BoundingFrustum frustum)
        {
            int vertices = 0;
            BoundingSphere bs = new BoundingSphere();
            uint cx = x;
            uint cy = y; //cache = anti-earthquake
            uint cz = z;
            foreach (var node in vertexBuffers.AsEnumerable)
            {
                if (node.Value == null)
                    continue;
                var world = Matrix.CreateTranslation((int)(node.Key.X - cx), (int)(node.Key.Y - cy), (int)(node.Key.Z - cz));
                bs.Radius = 16;
                bs.Center = Vector3.Transform(new Vector3(8, 8, 8), world);

                if (ContainmentType.Disjoint == frustum.Contains(bs))
                    continue;
                effect.WMatrix = world;

                effect.BeginPass3D();
                if (node.Value[0] != null && node.Key.Z - cz - 1 > 0x80000000)
                {
                    device.Vertices[0].SetSource(node.Value[0], 0, VertexAwesome.SizeInBytes);
                    device.DrawPrimitives(PrimitiveType.TriangleList, 0, node.Value[0].SizeInBytes / VertexAwesome.SizeInBytes / 3);
                    vertices += node.Value[0].SizeInBytes / VertexAwesome.SizeInBytes;
                }
                if (node.Value[1] != null && node.Key.Z - cz + 16 < 0x80000000)
                {
                    device.Vertices[0].SetSource(node.Value[1], 0, VertexAwesome.SizeInBytes);
                    device.DrawPrimitives(PrimitiveType.TriangleList, 0, node.Value[1].SizeInBytes / VertexAwesome.SizeInBytes / 3);
                    vertices += node.Value[1].SizeInBytes / VertexAwesome.SizeInBytes;
                }
                if (node.Value[2] != null && node.Key.X - cx - 1 > 0x80000000)
                {
                    device.Vertices[0].SetSource(node.Value[2], 0, VertexAwesome.SizeInBytes);
                    device.DrawPrimitives(PrimitiveType.TriangleList, 0, node.Value[2].SizeInBytes / VertexAwesome.SizeInBytes / 3);
                    vertices += node.Value[2].SizeInBytes / VertexAwesome.SizeInBytes;
                }
                if (node.Value[3] != null && node.Key.X - cx + 16 < 0x80000000)
                {
                    device.Vertices[0].SetSource(node.Value[3], 0, VertexAwesome.SizeInBytes);
                    device.DrawPrimitives(PrimitiveType.TriangleList, 0, node.Value[3].SizeInBytes / VertexAwesome.SizeInBytes / 3);
                    vertices += node.Value[3].SizeInBytes / VertexAwesome.SizeInBytes;
                }
                if (node.Value[4] != null && node.Key.Y - cy - 1 > 0x80000000)
                {
                    device.Vertices[0].SetSource(node.Value[4], 0, VertexAwesome.SizeInBytes);
                    device.DrawPrimitives(PrimitiveType.TriangleList, 0, node.Value[4].SizeInBytes / VertexAwesome.SizeInBytes / 3);
                    vertices += node.Value[4].SizeInBytes / VertexAwesome.SizeInBytes;
                }
                if (node.Value[5] != null && node.Key.Y - cy + 16 < 0x80000000)
                {
                    device.Vertices[0].SetSource(node.Value[5], 0, VertexAwesome.SizeInBytes);
                    device.DrawPrimitives(PrimitiveType.TriangleList, 0, node.Value[5].SizeInBytes / VertexAwesome.SizeInBytes / 3);
                    vertices += node.Value[5].SizeInBytes / VertexAwesome.SizeInBytes;
                }
                if (node.Value[6] != null)
                {
                    device.Vertices[0].SetSource(node.Value[6], 0, VertexAwesome.SizeInBytes);
                    device.DrawPrimitives(PrimitiveType.TriangleList, 0, node.Value[6].SizeInBytes / VertexAwesome.SizeInBytes / 3);
                    vertices += node.Value[6].SizeInBytes / VertexAwesome.SizeInBytes;
                }
                effect.EndPass3D();
            }
            this.Vertices = vertices;
        }
开发者ID:olydis,项目名称:FineCraft,代码行数:66,代码来源:DynamicRangeChunkVolume.cs

示例11: DrawText

        public void DrawText(Matrix viewMatrix, Matrix projectionMatrix, Vector3 drawPosition, string hoverText, Color color)
        {
            // Don't draw text if it's not within our frustum.
            BoundingSphere regionBounds = new BoundingSphere(drawPosition, 0.1f);
            BoundingFrustum boundingFrustum = new BoundingFrustum(viewMatrix * projectionMatrix);
            if (boundingFrustum.Contains(regionBounds) == ContainmentType.Disjoint)
                return;

            // Draw our text over the player.
            SpriteBatch spriteBatch = new SpriteBatch(graphicsDevice);
            spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.SaveState);
            Vector3 screenSpace = graphicsDevice.Viewport.Project(Vector3.Zero,
                                                                  projectionMatrix,
                                                                  viewMatrix,
                                                                  Matrix.CreateTranslation(drawPosition + new Vector3(0, 1.7f, 0)));
            Vector2 textPosition = new Vector2(screenSpace.X, screenSpace.Y) - nameFont.MeasureString(hoverText) * 0.5f;
            textPosition.X = (int)textPosition.X;
            textPosition.Y = (int)textPosition.Y;
            spriteBatch.DrawString(nameFont, hoverText, textPosition, Color.Black);
            textPosition.X -= 2;
            textPosition.Y -= 2;
            spriteBatch.DrawString(nameFont, hoverText, textPosition, color);//Color.White);
            spriteBatch.End();
        }
开发者ID:GlennSandoval,项目名称:Infiniminer,代码行数:24,代码来源:SpriteModel.cs

示例12: DrawObjects

        public void DrawObjects()
        {
            try
            {
                lock (gameObjects)
                {

                    ObjectsDrawn = 0;
                    foreach (Gobject go in gameObjects.Values)
                    {
                        BoundingFrustum frustum = new BoundingFrustum(view * proj);
                        if (frustum.Contains(go.Skin.WorldBoundingBox) != ContainmentType.Disjoint)
                        {
                            ObjectsDrawn++;
                            if (DrawingEnabled)
                            {
                                if (go is Terrain)
                                {
                                    (go as Terrain).Draw(GraphicsDevice, view, proj);
                                }
                                else if (go is Planet)
                                {
                                    (go as Planet).Draw(GraphicsDevice, view, proj);
                                }
                                else
                                    go.Draw(ref view, ref proj);
                            }
                            if (game.DebugPhysics)
                                go.DrawWireframe(GraphicsDevice, view, proj);
                        }
                    }
                }
            }
            catch (Exception E)
            {
                System.Diagnostics.Debug.WriteLine(E.StackTrace);
            }
        }
开发者ID:colbybhearn,项目名称:3DPhysics,代码行数:38,代码来源:XnaPanel.cs

示例13: ArrangeOverride

        /// <summary>
        /// Provides the behavior for the Arrange pass of Silverlight layout.
        /// </summary>
        /// <param name="finalSize">The final area within the parent that this
        /// object should use to arrange itself and its children.</param>
        /// <returns>
        /// The actual size that is used after the element is arranged in layout.
        /// </returns>
        protected override Size ArrangeOverride(Size finalSize)
        {
            if (ActualWidth > 0 && ActualHeight > 0 && (motion != null && motion.IsDataValid || IsDesignMode))
            {
                this.FirsVectorInView = null;

                BoundingFrustum viewFrustum = new BoundingFrustum(Attitude * view * CameraProjection);
                foreach (var child in Children)
                {
                    object posObj = child.GetValue(DirectionProperty);
                    if (posObj is Point && !double.IsNaN(((Point)posObj).X))
                    {
                        Point p = (Point)posObj;
                        Vector3 direction = PolarToVector(p.X, p.Y, 10);
                        var size = child.DesiredSize;
                        //Create a bounding sphere around the element for hittesting against the current frustum
                        //This size is not entirely right... size we have is screen size but we use the world size.
                        //*.008 seems to roughly fit as conversion factor for now
                        var box = new BoundingSphere(direction, (float)Math.Max(size.Width, size.Height) * .008f);
                        if (viewFrustum.Contains(box) != ContainmentType.Disjoint) //partially or fully inside camera frustum
                        {
                            Vector3 projected = Project(direction);

                            if (this.FirsVectorInView == null)
                            {
                                this.FirsVectorInView = projected;
                            }

                            if (!float.IsNaN(projected.X) && !float.IsNaN(projected.Y))
                            {
                                //Arrange element centered on projected coordinate
                                double x = projected.X - size.Width * .5;
                                double y = projected.Y - size.Height * .5;
                                child.Arrange(new Rect(x, y, size.Width, size.Height));
                                continue;
                            }
                        }
                    }
                    //if we fall through to here, it's because the element is outside the view,
                    //or placement can't be calculated
                    child.Arrange(new Rect(0, 0, 0, 0));
                }
                return finalSize;
            }
            else
                return base.ArrangeOverride(finalSize);
        }
开发者ID:TKonov,项目名称:NasaChallenge,代码行数:55,代码来源:ARPanel.cs

示例14: IsInView

        public bool IsInView(Point directionPoint)
        {
            BoundingFrustum viewFrustum = new BoundingFrustum(Attitude * view * CameraProjection);
            object posObj = directionPoint;
            if (posObj is Point && !double.IsNaN(((Point)posObj).X))
            {
                Point p = (Point)posObj;
                Vector3 direction = PolarToVector(p.X, p.Y, 10);
                //Create a bounding sphere around the element for hittesting against the current frustum
                //This size is not entirely right... size we have is screen size but we use the world size.
                //*.008 seems to roughly fit as conversion factor for now
                var box = new BoundingSphere(direction, 10 * .008f);
                if (viewFrustum.Contains(box) != ContainmentType.Disjoint) //partially or fully inside camera frustum
                {
                    return true;
                }
            }

            return false;
        }
开发者ID:TKonov,项目名称:NasaChallenge,代码行数:20,代码来源:ARPanel.cs

示例15: Intersects

        public static void Intersects(ref Ray ray, ref BoundingFrustum boundingFrustum, out float? result)
        {
            // TODO: Make test case of this
            if (boundingFrustum.Contains(ray.Position) == ContainmentType.Contains)
            {
                // the ray is inside the frustum
                result = 0.0f;
            }
            else
            {
                result = null;

                var corners = boundingFrustum.GetCorners();
                for (int i = 0; i < (BoundingFrustum.PlaneCount * 2); i++)
                {
                    var v1 = corners[Geometry.TriangleIndices[i + 0]];
                    var v2 = corners[Geometry.TriangleIndices[i + 1]];
                    var v3 = corners[Geometry.TriangleIndices[i + 2]];

                    Intersects(ref ray, ref v1, ref v2, ref v3, out result);

                    if (result.HasValue)
                        break;
                }
            }
        }
开发者ID:mrG7,项目名称:Nine.Geometry,代码行数:26,代码来源:Intersection.cs


注:本文中的BoundingFrustum.Contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。