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


C# Framework.BoundingBox类代码示例

本文整理汇总了C#中Microsoft.Xna.Framework.BoundingBox的典型用法代码示例。如果您正苦于以下问题:C# BoundingBox类的具体用法?C# BoundingBox怎么用?C# BoundingBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: PhysxGhostObject

 /// <summary>
 /// Initializes a new instance of the GhostObject class.
 /// DEfault Object in 0,0,0 identity rotation and 1,1,1 scale
 /// </summary>
 /// <param name="bb">The bb.</param>
 public PhysxGhostObject(BoundingBox? bb = null)         
 {
     this.pos = Vector3.Zero;
     this.ori = Matrix.Identity;
     this.scale = Vector3.One;
     this.bb = bb;
 }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:12,代码来源:PhysxGhostObject.cs

示例2: Convert

        public bool Convert(string s, out object value)
        {
            BoundingBox v = new BoundingBox();
            value = v;
            object corner;
            string[] splits = s.Split(VALUE_DELIMITERS, StringSplitOptions.RemoveEmptyEntries);
            if(splits.Length < 2) return false;
            int vi = 0;
            foreach(var sv in splits) {
                if(vi == 2) break;
                if(string.IsNullOrWhiteSpace(sv))
                    continue;
                if(vec3Conv.Convert(sv, out corner)) {
                    switch(vi) {
                        case 0: v.Min = (Vector3)corner; break;
                        case 1: v.Max = (Vector3)corner; break;
                    }
                    vi++;
                }
            }
            if(vi < 2) return false;

            value = v;
            return true;
        }
开发者ID:RegrowthStudios,项目名称:VoxelRTS,代码行数:25,代码来源:ZXPCExt.cs

示例3: DrawBoundingBox

        public void DrawBoundingBox(BoundingBox box)
        {
            IGraphicsDeviceService graphicsService =
                    (IGraphicsDeviceService)base.Game.Services.GetService(
                                                    typeof(IGraphicsDeviceService));

            GraphicsDevice device = graphicsService.GraphicsDevice;

            vertices[0].Position = new Vector3(box.Min.X, box.Min.Y, box.Min.Z);
            vertices[1].Position = new Vector3(box.Max.X, box.Min.Y, box.Min.Z);
            vertices[2].Position = new Vector3(box.Max.X, box.Min.Y, box.Max.Z);
            vertices[3].Position = new Vector3(box.Min.X, box.Min.Y, box.Max.Z);

            vertices[4].Position = new Vector3(box.Min.X, box.Max.Y, box.Min.Z);
            vertices[5].Position = new Vector3(box.Max.X, box.Max.Y, box.Min.Z);
            vertices[6].Position = new Vector3(box.Max.X, box.Max.Y, box.Max.Z);
            vertices[7].Position = new Vector3(box.Min.X, box.Max.Y, box.Max.Z);

            Predraw(0);
            device.DrawUserIndexedPrimitives<VertexPositionColor>(
                PrimitiveType.LineList, vertices,
                0,
                8,
                indices,
                0,
                12);
            Postdraw();
        }
开发者ID:jhauberg-archived,项目名称:LD10,代码行数:28,代码来源:VectorRenderer.cs

示例4: RedHead

        public RedHead(Game game, Vector3 pos, Level l)
            : base(game, pos, l)
        {
            //Parameters for this specific enemy
            life = 5;
            textures = new Texture2D[life];
            Damage = 5;
            this.level = l;
            this.position = pos;
            RotationSpeed = 0.1f;
            ForwardSpeed = 6f;
            boxMin = new Vector3(-0.235f, 0, -0.235f);
            boxMax = new Vector3(0.235f, 0.8f, 0.235f);
            boundingBox = new BoundingBox(position + boxMin, position + boxMax);
            //Different textures for each life count
            textures[4] = ContentPreImporter.GetTexture("RedHead");
            textures[3] = ContentPreImporter.GetTexture("RedHead4");
            textures[2] = ContentPreImporter.GetTexture("RedHead3");
            textures[1] = ContentPreImporter.GetTexture("RedHead2");
            textures[0] = ContentPreImporter.GetTexture("RedHead1");
            hurtSound = ContentPreImporter.GetSound("enemyHurt");

            billboard = new Billboard(game, textures[life - 1], Vector2.One / 2);
            billboard.Move(position + new Vector3(0, 0.25f, 0));
            billboard.ForceUpdate();
            target = pos;
            //Set new values for the fog if required
            billboard.OverrideFog(GlobalSettings.FogEnabled, GlobalSettings.FogColor, GlobalSettings.FogStart, GlobalSettings.FogEnd * 2.1f);
        }
开发者ID:RichyHBM,项目名称:WrenchGame,代码行数:29,代码来源:RedHead.cs

示例5: GetBoundingBox

        /// <summary>
        /// Model 全体を包む BoundingBox を取得します。
        /// </summary>
        /// <param name="model">Model。</param>
        /// <param name="result">Model 全体を包む BoundingBox。</param>
        public static void GetBoundingBox(this Model model, out BoundingBox result)
        {
            var boneTransforms = new Matrix[model.Bones.Count];
            model.CopyAbsoluteBoneTransformsTo(boneTransforms);

            var points = new List<Vector3>();
            foreach (var mesh in model.Meshes)
            {
                foreach (var part in mesh.MeshParts)
                {
                    var vertexBuffer = part.VertexBuffer;
                    var data = new float[vertexBuffer.VertexCount * vertexBuffer.VertexDeclaration.VertexStride / sizeof(float)];
                    vertexBuffer.GetData<float>(data);
                    var boneTransform = boneTransforms[mesh.ParentBone.Index];
                    var increment = vertexBuffer.VertexDeclaration.VertexStride / sizeof(float);
                    for (int i = 0; i < data.Length; i += increment)
                    {
                        Vector3 point;
                        point.X = data[i];
                        point.Y = data[i + 1];
                        point.Z = data[i + 2];

                        point = Vector3.Transform(point, boneTransform);

                        points.Add(point);
                    }
                }
            }
            result = BoundingBox.CreateFromPoints(points);
        }
开发者ID:willcraftia,项目名称:WindowsGame,代码行数:35,代码来源:ModelExtension.cs

示例6: Contains

        public ContainmentType Contains(ref BoundingBox boundingBox)
        {
            ContainmentType result;
            _boundingSphere.Contains(ref boundingBox, out result);

            return result;
        }
开发者ID:jwvdiermen,项目名称:LD28,代码行数:7,代码来源:CircleBrush.cs

示例7: QuadNode

        public QuadNode(NodeType nodeType, int nodeSize, int nodeDepth, QuadNode parent, QuadTree parentTree, int positionIndex)
        {
            NodeType = nodeType;
            _nodeSize = nodeSize;
            _nodeDepth = nodeDepth;
            _positionIndex = positionIndex;

            _parent = parent;
            _parentTree = parentTree;

            //Add the 9 vertices
            AddVertices();

            Bounds = new BoundingBox(_parentTree.Vertices[VertexTopLeft.Index].Position,
                        _parentTree.Vertices[VertexBottomRight.Index].Position);

            if (nodeSize >= 4)
                AddChildren();

            //Make call to UpdateNeighbors from the parent node.
            //This will update all neighbors recursively for the
            //children as well.  This ensures all nodes are created
            //prior to updating neighbors.
            if (_nodeDepth == 1)
            {
                AddNeighbors();

                VertexTopLeft.Activated = true;
                VertexTopRight.Activated = true;
                VertexCenter.Activated = true;
                VertexBottomLeft.Activated = true;
                VertexBottomRight.Activated = true;

            }
        }
开发者ID:MenosGrandes,项目名称:mrowisko-pbl,代码行数:35,代码来源:QuadNode.cs

示例8: SplitBaseArena

        /// <summary>
        /// Constructs the arena. Also constructs several platforms and physics elements
        /// which need to get added to the EntityManager and PhysicsSimulator.
        /// </summary>
        /// <param name="entityManager"></param>
        /// <param name="physicsSimulator"></param>
        public SplitBaseArena(EntityManager entityManager, PhysicsSimulator physicsSimulator)
        {
            // Create the platforms.
            float focus = 15.0f;
            Platform leftGround = new Platform(new Vector3(-focus, 0, 0), 22.0f, 2.0f, 5.0f);
            Platform rightGround = new Platform(new Vector3(focus, 0, 0), 22.0f, 2.0f, 5.0f);

            Platforms.Add(leftGround);
            entityManager.AddEntity(leftGround);
            physicsSimulator.AddPhysicsEntity(leftGround.GetBox());

            Platforms.Add(rightGround);
            entityManager.AddEntity(rightGround);
            physicsSimulator.AddPhysicsEntity(rightGround.GetBox());

            // Create the Spawn Positions
            spawnPositions = new List<Vector3>();
            spawnPositions.Add(new Vector3(-15, 10, 0));
            spawnPositions.Add(new Vector3(-5, 15, 0));
            spawnPositions.Add(new Vector3(5, 15, 0));
            spawnPositions.Add(new Vector3(15, 10, 0));

            // Create the Bounding box.
            boundingBox = new BoundingBox(new Vector3(-70, -20, -20), new Vector3(70, 60, 20));
        }
开发者ID:regenvanwalbeek,项目名称:BattleFury,代码行数:31,代码来源:SplitBaseArena.cs

示例9: DrawBoundingBox

        public static void DrawBoundingBox(BoundingBox bBox, GraphicsDevice device, BasicEffect basicEffect, Matrix worldMatrix, Matrix viewMatrix, Matrix projectionMatrix)
        {
            Vector3 v1 = bBox.Min;
            Vector3 v2 = bBox.Max;

            VertexPositionColor[] cubeLineVertices = new VertexPositionColor[8];
            cubeLineVertices[0] = new VertexPositionColor(v1, Color.White);
            cubeLineVertices[1] = new VertexPositionColor(new Vector3(v2.X, v1.Y, v1.Z), Color.Red);
            cubeLineVertices[2] = new VertexPositionColor(new Vector3(v2.X, v1.Y, v2.Z), Color.Green);
            cubeLineVertices[3] = new VertexPositionColor(new Vector3(v1.X, v1.Y, v2.Z), Color.Blue);

            cubeLineVertices[4] = new VertexPositionColor(new Vector3(v1.X, v2.Y, v1.Z), Color.White);
            cubeLineVertices[5] = new VertexPositionColor(new Vector3(v2.X, v2.Y, v1.Z), Color.Red);
            cubeLineVertices[6] = new VertexPositionColor(v2, Color.Green);
            cubeLineVertices[7] = new VertexPositionColor(new Vector3(v1.X, v2.Y, v2.Z), Color.Blue);

            short[] cubeLineIndices = { 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 };

            basicEffect.World = worldMatrix;
            basicEffect.View = viewMatrix;
            basicEffect.Projection = projectionMatrix;
            basicEffect.VertexColorEnabled = true;

            device.RasterizerState = _solidRasterizer;
            foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)
            {
                pass.Apply();
                device.DrawUserIndexedPrimitives<VertexPositionColor>(PrimitiveType.LineList, cubeLineVertices, 0, 8, cubeLineIndices, 0, 12);
            }
        }
开发者ID:vvolkgang,项目名称:WarZ,代码行数:30,代码来源:XNAUtils.cs

示例10: Collision

 public BoundingBox Collision()
 {
     Vector3 Middle= new Vector3(Position.X+100,Position.Y+100,Position.Z-75);
     Vector3 abc = new Vector3(80);
     BoundingBox bb= new BoundingBox(Middle - new Vector3(40), Middle + new Vector3(40));
     return bb;
 }
开发者ID:TorgeirH90,项目名称:Programming,代码行数:7,代码来源:EnemyCube.cs

示例11: BSP

 private BSP(Node root, BoundingBox? bounds, object[] description, bool createDescription = true)
 {
     _root = root;
     Bounds = bounds;
     _description = description;
     _createDescription = createDescription;
 }
开发者ID:martindevans,项目名称:csg.js,代码行数:7,代码来源:BSP.cs

示例12: Transform

        public static BoundingBox Transform(BoundingBox bounds, Matrix matrix)
        {
            BoundingBox t;

            t.Min = matrix.Translation;
            t.Max = matrix.Translation;

            t.Min.X += (matrix.M11 < 0) ? bounds.Max.X * matrix.M11 : bounds.Min.X * matrix.M11;
            t.Min.X += (matrix.M21 < 0) ? bounds.Max.Y * matrix.M21 : bounds.Min.Y * matrix.M21;
            t.Min.X += (matrix.M31 < 0) ? bounds.Max.Z * matrix.M31 : bounds.Min.Z * matrix.M31;
            t.Max.X += (matrix.M11 > 0) ? bounds.Max.X * matrix.M11 : bounds.Min.X * matrix.M11;
            t.Max.X += (matrix.M21 > 0) ? bounds.Max.Y * matrix.M21 : bounds.Min.Y * matrix.M21;
            t.Max.X += (matrix.M31 > 0) ? bounds.Max.Z * matrix.M31 : bounds.Min.Z * matrix.M31;

            t.Min.Y += (matrix.M12 < 0) ? bounds.Max.X * matrix.M12 : bounds.Min.X * matrix.M12;
            t.Min.Y += (matrix.M22 < 0) ? bounds.Max.Y * matrix.M22 : bounds.Min.Y * matrix.M22;
            t.Min.Y += (matrix.M32 < 0) ? bounds.Max.Z * matrix.M32 : bounds.Min.Z * matrix.M32;
            t.Max.Y += (matrix.M12 > 0) ? bounds.Max.X * matrix.M12 : bounds.Min.X * matrix.M12;
            t.Max.Y += (matrix.M22 > 0) ? bounds.Max.Y * matrix.M22 : bounds.Min.Y * matrix.M22;
            t.Max.Y += (matrix.M32 > 0) ? bounds.Max.Z * matrix.M32 : bounds.Min.Z * matrix.M32;

            t.Min.Z += (matrix.M13 < 0) ? bounds.Max.X * matrix.M13 : bounds.Min.X * matrix.M13;
            t.Min.Z += (matrix.M23 < 0) ? bounds.Max.Y * matrix.M23 : bounds.Min.Y * matrix.M23;
            t.Min.Z += (matrix.M33 < 0) ? bounds.Max.Z * matrix.M33 : bounds.Min.Z * matrix.M33;
            t.Max.Z += (matrix.M13 > 0) ? bounds.Max.X * matrix.M13 : bounds.Min.X * matrix.M13;
            t.Max.Z += (matrix.M23 > 0) ? bounds.Max.Y * matrix.M23 : bounds.Min.Y * matrix.M23;
            t.Max.Z += (matrix.M33 > 0) ? bounds.Max.Z * matrix.M33 : bounds.Min.Z * matrix.M33;

            return t;
        }
开发者ID:djmacgames,项目名称:MonoCollisionFramework,代码行数:30,代码来源:BoundingBoxHelper.cs

示例13: Update

 public override void Update(GameTime gametime)
 {
     min = MIN + currentPosition;
     max = MAX + currentPosition;
     tankBox = new BoundingBox(min, max);
     turretRorationValue = (float)Math.Sin(gametime.TotalGameTime.TotalSeconds);
 }
开发者ID:HeatherXi,项目名称:game-programming,代码行数:7,代码来源:pursuit.cs

示例14: AbstractBonus

 /// <summary>
 /// konstruktor
 /// </summary>
 /// <param name="game">instance hry</param>
 /// <param name="x">poloha v hernim poli na ose x</param>
 /// <param name="y">poloha v hernim poli na ose y</param>
 public AbstractBonus(Game game, AbstractWall wall)
     : base(game)
 {
     base.modelPosition = new Vector3(wall.ModelPosition.X, 0, wall.ModelPosition.Z);
     boundingBox = new BoundingBox(new Vector3(modelPosition.X - 10, modelPosition.Y, modelPosition.Z - 10),
         new Vector3(modelPosition.X + 10, modelPosition.Y + 20, modelPosition.Z + 10));
 }
开发者ID:CTU-FEE-Y39PHA-43-2010,项目名称:BombermanAdventure,代码行数:13,代码来源:AbstractBonus.cs

示例15: GhostObject

    /// <summary>
    /// Initializes a new instance of the <see cref="GhostObject"/> class.
    /// </summary>
    /// <param name="position">The position.</param>
    /// <param name="orientation">The orientation.</param>
    /// <param name="scale">The scale.</param>
 public GhostObject(Vector3 position, Matrix orientation, Vector3 scale, BoundingBox? bb = null) : base(MaterialDescription.DefaultBepuMaterial(), 0)
 {
     this.pos = position;
     this.ori = orientation;
     this.scale = scale;
     this.bb = bb;
 }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:13,代码来源:GhostObject.cs


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