• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Graphics.VertexPositionColor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Draw

        public static void Draw(VertexPositionColor[] Points, Texture2D Texture)
        {
            //PUT IN DRAW CODE FOR PARTICLES HERE
            mGraphics.Peek.Device().RenderState.PointSpriteEnable = true;
            mGraphics.Peek.ToggleAlphaBlending(true);
            mGraphics.Peek.Device().RenderState.DepthBufferWriteEnable = false;
            mGraphics.Peek.Device().VertexDeclaration = mGraphics.Peek.vdPositionColor;
            mEffect.Peek.PointEffect().Parameters["WVPMatrix"].SetValue(Matrix.Identity * mCamera.Peek.ReturnCamera().View * mCamera.Peek.ReturnCamera().Projection);
            mEffect.Peek.PointEffect().Parameters["SpriteTexture"].SetValue(Texture);
            mEffect.Peek.PointEffect().Parameters["ViewportHeight"].SetValue(mGraphics.Peek.Device().Viewport.Height);
            mEffect.Peek.PointEffect().Parameters["ViewportHeight"].SetValue(25.0f);

            mEffect.Peek.PointEffect().Begin();
            for (int i = 0; i < mEffect.Peek.PointEffect().CurrentTechnique.Passes.Count; i++)
            {
                mEffect.Peek.PointEffect().CurrentTechnique.Passes[i].Begin();
                mGraphics.Peek.Device().DrawUserPrimitives<VertexPositionColor>(PrimitiveType.PointList, Points, 0, Points.Length);
                mEffect.Peek.PointEffect().CurrentTechnique.Passes[i].End();
            }
            mEffect.Peek.PointEffect().End();

            mGraphics.Peek.Device().RenderState.PointSpriteEnable = false;
            mGraphics.Peek.Device().RenderState.DepthBufferWriteEnable = true;
            mGraphics.Peek.ToggleAlphaBlending(false);
        }
开发者ID:apolaskey,项目名称:Inkwell,代码行数:25,代码来源:Particle.cs


示例2: RenderVertexPositionColorList

        public static void RenderVertexPositionColorList(GraphicsDevice gd, 
            BasicEffect effect, Matrix world, Matrix view, Matrix proj,
            VertexPositionColor[] vertices, VertexDeclaration vertexDeclaration,
            VertexBuffer vertex_buffer)
        {
            // gd.VertexDeclaration = vertexDeclaration;

              effect.World = world;
              effect.View = view;
              effect.Projection = proj;
              effect.VertexColorEnabled = true;

              if (vertex_buffer == null)
              {
            vertex_buffer = new VertexBuffer(gd, typeof(VertexPositionColor), vertices.Length, BufferUsage.WriteOnly);
            vertex_buffer.SetData<VertexPositionColor>(vertices);
              }

              foreach (EffectPass pass in effect.CurrentTechnique.Passes)
              {
              pass.Apply();
            gd.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.LineList, vertices, 0, vertices.Length / 3);

              }
        }
开发者ID:DigitalLibrarian,项目名称:xna-forever,代码行数:25,代码来源:Renderer.cs


示例3: AABBTree

        public static AABBTree AABBTree(Model model, AABBNodeInfo tree_info)
        {
            List<TriangleVertexIndices> indices = new List<TriangleVertexIndices>();
              List<Vector3> points = new List<Vector3>();
              AABBFactory.ExtractData(model, points, indices, true);

              VertexPositionColor[] vertices = new VertexPositionColor[indices.Count * 3];

              List<float[]> triangles = new List<float[]>();

              int i = 0;
              foreach (TriangleVertexIndices index in indices)
              {
            vertices[i++] = new VertexPositionColor(points[index.I0], Color.White);
            vertices[i++] = new VertexPositionColor(points[index.I1], Color.White);
            vertices[i++] = new VertexPositionColor(points[index.I2], Color.White);

            float[] tri = new float[3];
            tri[0] = points[index.I0].X;
            tri[1] = points[index.I1].Y;
            tri[2] = points[index.I2].Z;
            triangles.Add(tri);
              }
              return new AABBTree(triangles, tree_info);
        }
开发者ID:DigitalLibrarian,项目名称:xna-forever,代码行数:25,代码来源:AABBFactory.cs


示例4: ReferenceAxis

        private ReferenceAxis()
        {
            vertices = new VertexPositionColor[3][];
            for (int x = 0; x < 3; x++)
            {
                vertices[x] = new VertexPositionColor[2];
                for (int y = 0; y < 2; y++)
                    vertices[x][y] = new VertexPositionColor();
            }

            vertices[0][0].Color = Color.Red;
            vertices[0][1].Color = Color.Red;
            vertices[1][0].Color = Color.Green;
            vertices[1][1].Color = Color.Green;
            vertices[2][0].Color = Color.Blue;
            vertices[2][1].Color = Color.Blue;

            // the first vertex is at the origin
            vertices[0][0].Position = Vector3.Zero;
            vertices[1][0].Position = Vector3.Zero;
            vertices[2][0].Position = Vector3.Zero;

            Size = 10;
            CreateLines();
        }
开发者ID:tuannsofta,项目名称:kinect4bag,代码行数:25,代码来源:ReferenceAxis.cs


示例5: InitializeGraphics

        public static void InitializeGraphics(GraphicsDevice graphicsDevice,
                                              Triangle[] triangles,
                                              Guid id)
        {
            var basicEffect = new BasicEffect(graphicsDevice)
                                  {
                                      LightingEnabled = false,
                                      VertexColorEnabled = false
                                  };

            var index = 0;
            var vertices = new VertexPositionColor[triangles.SelectMany(i => i.Points).Count()];

            foreach (var point in triangles.SelectMany(triangle => triangle.Points))
                vertices[index++] = new VertexPositionColor(new Vector3(point.X,
                                                                        point.Y,
                                                                        point.Z),
                                                            Color.White);

            var vertexBuffer = new VertexBuffer(graphicsDevice,
                                                typeof (VertexPositionColor),
                                                vertices.Length,
                                                BufferUsage.None);
            vertexBuffer.SetData(vertices);

            Subscriptions.Add(id, new RendererHelperData
                                       {
                                           BasicEffect = basicEffect,
                                           VertexBuffer = vertexBuffer
                                       });
        }
开发者ID:naighes,项目名称:AsteroidChallenge,代码行数:31,代码来源:TrianglesRenderer.cs


示例6: CollisionElement

 public CollisionElement(GraphicsDevice device)
 {
     _texture = new Texture2D(device, 1, 1);
     _texture.SetData(new Color[]{ Color.White });
     BoxCoords = new Rectangle();
     TriangleCoords = new VertexPositionColor[3];
 }
开发者ID:Grinderofl,项目名称:FlackoGame,代码行数:7,代码来源:CollisionElement.cs


示例7: InitVertices

        private void InitVertices()
        {
            vertices = new VertexPositionColor[30];

            vertices[0] = new VertexPositionColor(new Vector3(0, 0, 0), Color.White);
            vertices[1] = new VertexPositionColor(Vector3.Right * 5, Color.White);
            vertices[2] = new VertexPositionColor(new Vector3(5, 0, 0), Color.White);
            vertices[3] = new VertexPositionColor(new Vector3(4.5f, 0.5f, 0), Color.White);
            vertices[4] = new VertexPositionColor(new Vector3(5, 0, 0), Color.White);
            vertices[5] = new VertexPositionColor(new Vector3(4.5f, -0.5f, 0), Color.White);

            vertices[6] = new VertexPositionColor(new Vector3(0, 0, 0), Color.White);
            vertices[7] = new VertexPositionColor(Vector3.Up * 5, Color.White);
            vertices[8] = new VertexPositionColor(new Vector3(0, 5, 0), Color.White);
            vertices[9] = new VertexPositionColor(new Vector3(0.5f, 4.5f, 0), Color.White);
            vertices[10] = new VertexPositionColor(new Vector3(0, 5, 0), Color.White);
            vertices[11] = new VertexPositionColor(new Vector3(-0.5f, 4.5f, 0), Color.White);

            vertices[12] = new VertexPositionColor(new Vector3(0, 0, 0), Color.White);
            vertices[13] = new VertexPositionColor(-Vector3.Forward * 5, Color.White);
            vertices[14] = new VertexPositionColor(new Vector3(0, 0, 5), Color.White);
            vertices[15] = new VertexPositionColor(new Vector3(0, 0.5f, 4.5f), Color.White);
            vertices[16] = new VertexPositionColor(new Vector3(0, 0, 5), Color.White);
            vertices[17] = new VertexPositionColor(new Vector3(0, -0.5f, 4.5f), Color.White);
        }
开发者ID:kamilk,项目名称:asteroids,代码行数:25,代码来源:CoordCross.cs


示例8: Initialize

 public override void Initialize()
 {
    Sommets1 = new VertexPositionColor[NB_SOMMETS];
    Sommets2 = new VertexPositionColor[NB_SOMMETS];
    PositionsSommets = new Vector3[NB_POSITIONS_SOMMETS];
    base.Initialize();
 }
开发者ID:karmoka,项目名称:ProjetFinalIntegrationSIM,代码行数:7,代码来源:CubeColoré.cs


示例9: Draw

        public static void Draw(this Fixture fixture, GraphicsDevice graphics, Color color, Matrix? matrix = null)
        {
            VertexPositionColor[] vertices;

            switch (fixture.ShapeType)
            {
                case ShapeType.Polygon:
                    {
                        vertices = ((PolygonShape)fixture.Shape).ToVertices(color, matrix);
                    }
                    break;
                case ShapeType.Circle:
                    {
                        CircleShape circle = ((CircleShape)fixture.Shape);

                        vertices = new VertexPositionColor[]
                    {
                        new VertexPositionColor(new Vector3(Vector2.Transform(Vector2.Zero, matrix ?? Matrix.Identity), 0.0f), color),
                        new VertexPositionColor(new Vector3(Vector2.Transform(new Vector2(circle.Radius), matrix ?? Matrix.Identity), 0.0f), color)
                    };
                    }
                    break;
                default: throw new InvalidOperationException(String.Format("Unable to render ShapeType {0}", fixture.ShapeType));
            }

            graphics.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.LineStrip, vertices, 0, vertices.Length - 1);
        }
开发者ID:simon-engledew,项目名称:square-battle,代码行数:27,代码来源:FixtureExtensions.cs


示例10: DrawSphereSpikes

        public static void DrawSphereSpikes(BoundingSphere sphere, GraphicsDevice device, BasicEffect basicEffect, Matrix worldMatrix, Matrix viewMatrix, Matrix projectionMatrix)
        {
            Vector3 up = sphere.Center + sphere.Radius * Vector3.Up;
            Vector3 down = sphere.Center + sphere.Radius * Vector3.Down;
            Vector3 right = sphere.Center + sphere.Radius * Vector3.Right;
            Vector3 left = sphere.Center + sphere.Radius * Vector3.Left;
            Vector3 forward = sphere.Center + sphere.Radius * Vector3.Forward;
            Vector3 back = sphere.Center + sphere.Radius * Vector3.Backward;

            VertexPositionColor[] sphereLineVertices = new VertexPositionColor[6];
            sphereLineVertices[0] = new VertexPositionColor(up, Color.White);
            sphereLineVertices[1] = new VertexPositionColor(down, Color.White);
            sphereLineVertices[2] = new VertexPositionColor(left, Color.White);
            sphereLineVertices[3] = new VertexPositionColor(right, Color.White);
            sphereLineVertices[4] = new VertexPositionColor(forward, Color.White);
            sphereLineVertices[5] = new VertexPositionColor(back, Color.White);

            basicEffect.World = worldMatrix;
            basicEffect.View = viewMatrix;
            basicEffect.Projection = projectionMatrix;
            basicEffect.VertexColorEnabled = true;
            foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)
            {
                pass.Apply();
               // device.VertexDeclaration = new VertexDeclaration(device, VertexPositionColor.VertexElements);
                device.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.LineList, sphereLineVertices, 0, 3);
            }
        }
开发者ID:vvolkgang,项目名称:WarZ,代码行数:28,代码来源:XNAUtils.cs


示例11: ChangeColour

 /// <summary>
 /// Change the colour of an existing list of type VertexPositionColor
 /// </summary>
 /// <param name="pointList">Array of points</param>
 /// <param name="colour">The colour e.g. Color.White or Color.Red</param>
 public void ChangeColour(ref VertexPositionColor[] pointList, Color colour)
 {
     for (int i = 0; i < pointList.Length; i++)
     {
         pointList[i].Color = colour;
     }
 }
开发者ID:dargonesti,项目名称:AsteroidsGame,代码行数:12,代码来源:Shapes.cs


示例12: 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


示例13: StartDrawing

 private unsafe void StartDrawing(VertexFragment vertexFragment, out VertexPositionColor* vertices, out VertexPositionNormalTexture* textures, out short* indices, out short baseIndex)
 {
     textures = null;
     if (vertexFragment.PrimitiveType == PrimitiveType.LineList)
     {
         if ((this.SortMode == DrawingSortMode.Order) && (this._triangleVertexCount > 0))
         {
             Flush();
             StartLineDrawing(vertexFragment, out vertices, out indices, out baseIndex);
         }
         else
         {
             StartLineDrawing(vertexFragment, out vertices, out indices, out baseIndex);
         }
     }
     else if (vertexFragment.PrimitiveType == PrimitiveType.TriangleList)
     {
         if ((this.SortMode == DrawingSortMode.Order) && (this._lineVertexCount > 0))
         {
             Flush();
             StartTriangleDrawing(vertexFragment, out vertices, out textures, out indices, out baseIndex);
         }
         else
         {
             StartTriangleDrawing(vertexFragment, out vertices, out textures, out indices, out baseIndex);
         }
     }
     else
     {
         throw new NotSupportedException(string.Format("PrimitiveType: {0} is not supported.", vertexFragment.PrimitiveType));
     }
 }
开发者ID:mind0n,项目名称:hive,代码行数:32,代码来源:DrawingBatch.cs


示例14: DebugDrawPolyline

 public static void DebugDrawPolyline(DebugDrawContext context, params Vector2[] vertices)
 {
     var vertexData = new VertexPositionColor[vertices.Length];
     for (int i = 0; i < vertices.Length; i++)
         vertexData[i] = new VertexPositionColor(new Vector3(vertices[i], DEBUG_DRAW_Z), context.Color);
     DebugDraw(context, vertexData, PrimitiveType.LineStrip);
 }
开发者ID:vvnurmi,项目名称:assaultwing,代码行数:7,代码来源:Graphics3D.cs


示例15: Draw

        public void Draw(GameTime gameTime, BoundingFrustum VisibleArea)
        {
            if (units.Count > 0)
            {
                VertexPositionColor[] display = new VertexPositionColor[units.Count * 2];
                int[] pointIndex = new int[units.Count];
                for (int i = 0; i < units.Count; i++)
                {
                    display[i * 2] = new VertexPositionColor(units[i].Position, DisplayColor);
                    pointIndex[i] = i * 2;
                    if (units[i].Target != null)
                    {
                        display[i * 2 + 1] = new VertexPositionColor(units[i].Target.Position, DisplayColor);
                    }
                    else
                    {
                        display[i * 2 + 1] = display[i * 2];
                    }
                }

                Manager.ResetFor3D();
                MyGame.graphics.GraphicsDevice.VertexDeclaration = UnitDeclaration;
                MyGame.graphics.GraphicsDevice.RenderState.PointSize = 5.0f;
                Manager.OrdinaryEffect.CurrentTechnique = Manager.OrdinaryEffect.Techniques["Ordinary"];
                Manager.OrdinaryEffect.Parameters["World"].SetValue(Matrix.Identity);
                Manager.OrdinaryEffect.Begin();
                Manager.OrdinaryEffect.CurrentTechnique.Passes.First<EffectPass>().Begin();
                MyGame.graphics.GraphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.LineList, display, 0, display.Length / 2);
                MyGame.graphics.GraphicsDevice.DrawUserIndexedPrimitives<VertexPositionColor>(PrimitiveType.PointList, display, 0, display.Length
                    , pointIndex, 0, pointIndex.Length);
                Manager.OrdinaryEffect.CurrentTechnique.Passes.First<EffectPass>().End();
                Manager.OrdinaryEffect.End();
            }
        }
开发者ID:kaysoky,项目名称:RealTimeStrategyEngine,代码行数:34,代码来源:Controller.cs


示例16: ConcavePolygonOutline

            public ConcavePolygonOutline(Vector3 position, Vector3[] points, Color[] pointColors)
            {
                throw new NotImplementedException();

                VertexPositionColor[] vertices = new VertexPositionColor[points.Length];
                for (int index = 0; index < points.Length; index++) {
                    vertices[index] = new VertexPositionColor(points[index], pointColors[index]);
                }

                List<VertexPositionColor> concavePoints = new List<VertexPositionColor>();
                bool isConcave = ConcavePolygonGeometry.Process(vertices, ref concavePoints);

                if (!isConcave) {
                    IComplex convex = new ConvexPolygonOutline(position, points, pointColors);
                    this.primitives = convex.Primitives;
                    this.primitivesCount = convex.PrimitivesCount;
                    //? throw new InvalidOperationException("Given polygon isn't concave!");
                }
                else {
                    this.primitives = new IPrimitive[concavePoints.Count];
                    this.primitivesCount = this.primitives.Length;

                    for (int index = 0; index < this.primitivesCount - 1; index++) {
                        this.primitives[index] = new Line(concavePoints[index].Position + position, concavePoints[index + 1].Position + position, concavePoints[index].Color, concavePoints[index + 1].Color);
                    }
                    this.primitives[this.primitivesCount - 1] = new Line(concavePoints[0].Position + position, concavePoints[this.primitivesCount - 1].Position + position, concavePoints[0].Color, concavePoints[this.primitivesCount - 1].Color);
                }
            }
开发者ID:AleksandarDev,项目名称:LD26,代码行数:28,代码来源:ConcavePolygonOutline.cs


示例17: VariableVertexes

        public VariableVertexes(Vector3 position, float size, int nLados)
        {
            this.nLados = nLados;
            vertexes = new VertexPositionColor[10];

            float graus = 0;
            float step = MathHelper.ToRadians(360 / nLados);

            Vector3 topo = new Vector3(0, 1, 0);

            Vector3 v0 = new Vector3(1, 0, 0);
            Vector3 v1 = topo;
            Vector3 v2 = new Vector3(0, 0, -1);
            Vector3 v3 = topo;
            Vector3 v4 = new Vector3(-1, 0, 0);
            Vector3 v5 = topo;
            Vector3 v6 = new Vector3(0, 0, 1);
            Vector3 v7 = topo;
            Vector3 v8 = v0;
            Vector3 v9 = topo;

            vertexes[0] = new VertexPositionColor(v0, Color.Red);
            vertexes[1] = new VertexPositionColor(v1, Color.Red);
            vertexes[2] = new VertexPositionColor(v2, Color.Red);
            vertexes[3] = new VertexPositionColor(v3, Color.Green);
            vertexes[4] = new VertexPositionColor(v4, Color.Green);
            vertexes[5] = new VertexPositionColor(v5, Color.Green);
            vertexes[6] = new VertexPositionColor(v6, Color.Blue);
            vertexes[7] = new VertexPositionColor(v7, Color.Blue);
            vertexes[8] = new VertexPositionColor(v8, Color.Blue);
            vertexes[9] = new VertexPositionColor(v9, Color.Blue);
        }
开发者ID:pedroabgmarques,项目名称:IP3D,代码行数:32,代码来源:VariableVertexes.cs


示例18: WorldAxes

        public WorldAxes()
        {
            // load our vertices and there color
            vertices = new VertexPositionColor[3][];
            for (int x = 0; x < 3; x++)
            {
                vertices[x] = new VertexPositionColor[2];
                for (int y = 0; y < 2; y++)
                    vertices[x][y] = new VertexPositionColor();
            }

            vertices[0][0].Color = Color.Red;
            vertices[0][1].Color = Color.Red;
            vertices[1][0].Color = Color.Green;
            vertices[1][1].Color = Color.Green;
            vertices[2][0].Color = Color.Blue;
            vertices[2][1].Color = Color.Blue;

            // the first vertex is at the origin
            vertices[0][0].Position = Vector3.Zero;
            vertices[1][0].Position = Vector3.Zero;
            vertices[2][0].Position = Vector3.Zero;

            Size = 5;
            CreateLines();
        }
开发者ID:tuannsofta,项目名称:kinect4bag,代码行数:26,代码来源:WorldAxes.cs


示例19: Draw

        public void Draw(GraphicsDevice device, Matrix view, Matrix projection, SpriteBatch batch, SpriteFont font)
        {
            vertices[0] = new VertexPositionColor(from, color);
            vertices[1] = new VertexPositionColor(to,   color);

            Vector3 delt = Vector3.Multiply(Vector3.Subtract(to, from), 0.1f);

            Vector3 perp = Vector3.Cross(Vector3.Forward, delt);
            Vector3 arrowBase = Vector3.Subtract(to, delt);

            vertices[2] = new VertexPositionColor(Vector3.Add(arrowBase, perp), color);
            vertices[3] = new VertexPositionColor(to, color);
            vertices[4] = new VertexPositionColor(Vector3.Subtract(arrowBase, perp), color);
            vertices[5] = new VertexPositionColor(to, color);

            effect.World = Matrix.Identity;
            effect.View = view;
            effect.Projection = projection;
            effect.VertexColorEnabled = true;
            effect.LightingEnabled = false;

            for (int i = 0; i < effect.CurrentTechnique.Passes.Count; ++i)
            {
                effect.CurrentTechnique.Passes[i].Apply();
                device.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.LineList, vertices, 0, 3);
            }

            Vector3 txtPos = device.Viewport.Project(Vector3.Lerp(from, to, 0.5f), projection, view, Matrix.Identity);
            Console.WriteLine(txtPos.ToString());
            batch.DrawString(font, text, new Vector2(txtPos.X + 20, txtPos.Y - 10), color);
        }
开发者ID:omanamos,项目名称:kinect-nao,代码行数:31,代码来源:LabelledVector.cs


示例20: DrawBBox

        public static void DrawBBox(List<BoundingBox> boundingBoxes, Matrix Projection, Matrix View,Matrix localWorld)
        {
            // Use inside a drawing loop
            foreach (BoundingBox box in boundingBoxes)
            {
                Vector3[] corners = box.GetCorners();
                VertexPositionColor[] primitiveList = new VertexPositionColor[corners.Length];

                // Assign the 8 box vertices
                for (int i = 0; i < corners.Length; i++)
                {
                    primitiveList[i] = new VertexPositionColor(corners[i], Color.White);
                }

                /* Set your own effect parameters here */

                boxEffect.World = localWorld;
                boxEffect.View = View;
                boxEffect.Projection = Projection;
                boxEffect.TextureEnabled = false;

                // Draw the box with a LineList
                foreach (EffectPass pass in boxEffect.CurrentTechnique.Passes)
                {
                    pass.Apply();
                    device.DrawUserIndexedPrimitives(
                        PrimitiveType.LineList, primitiveList, 0, 8,
                        bBoxIndices, 0, 12);
                }
            }
        }
开发者ID:MenosGrandes,项目名称:mrowisko-pbl,代码行数:31,代码来源:BBoxRender.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Graphics.VertexPositionColorTexture类代码示例发布时间:2022-05-26
下一篇:
C# Graphics.VertexElement类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap