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


C# CustomVertex.PositionColored类代码示例

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


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

示例1: Init

 public void Init(Device device)
 {
     this.device = device;
     ray = new CustomVertex.PositionColored[2];
     ray[0] = new CustomVertex.PositionColored(start, Color.Red.ToArgb());
     ray[1] = new CustomVertex.PositionColored(end, Color.Red.ToArgb());
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:7,代码来源:Axis3D.cs

示例2: init

        public override void init()
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;

            //Crear vertexBuffer
            vertexBuffer = new VertexBuffer(typeof(CustomVertex.PositionColored), 3, d3dDevice, Usage.Dynamic | Usage.WriteOnly, CustomVertex.PositionColored.Format, Pool.Default);

            //Cargar informacion de vertices: (X,Y,Z) + Color
            CustomVertex.PositionColored[] data = new CustomVertex.PositionColored[3];
            data[0] = new CustomVertex.PositionColored(-1, 0, 0, Color.Red.ToArgb());
            data[1] = new CustomVertex.PositionColored(1, 0, 0, Color.Green.ToArgb());
            data[2] = new CustomVertex.PositionColored(0, 1, 0, Color.Blue.ToArgb());

            //Almacenar información en VertexBuffer
            vertexBuffer.SetData(data, 0, LockFlags.None);


            //Configurar camara en rotacion
            GuiController.Instance.RotCamera.setCamera(new Vector3(0, 0.5f, 0), 3f);

            //User Vars
            GuiController.Instance.UserVars.addVar("Vertices");
            GuiController.Instance.UserVars.setValue("Vertices", data.Length);

            
        }
开发者ID:aniPerezG,项目名称:barbalpha,代码行数:26,代码来源:TrianguloVertexBuffer.cs

示例3: CreateVertexArray

        /// <summary> Create the Vertex Array. </summary>
        /// <remarks>Where our Vertice Points are initially stored with each of
        ///  their positions in 3D space in X, Y, and Z coordinates.
        ///  Also any color or texture information.</remarks>
        public void CreateVertexArray(object sender, EventArgs e)
        {
            CustomVertex.PositionColored[] VerticeArray = // Declare a new Array called VerticeArray
             new CustomVertex.PositionColored[NumberOfVertices]; // Type of Vertices and number of Points

            // Draw TriangleFan from Vertice Points in a clockwise direction
            VerticeArray[0].Position = new Vector3(0.0f, 0.32f, 0.0f); // Top Center
            VerticeArray[0].Color = System.Drawing.Color.Yellow.ToArgb();

            VerticeArray[1].Position = new Vector3(-0.32f, -0.32f, 0.32f); // Left Bottom Rear
            VerticeArray[1].Color = System.Drawing.Color.Yellow.ToArgb();

            VerticeArray[2].Position = new Vector3(0.32f, -0.32f, 0.32f); // Right Bottom Rear
            VerticeArray[2].Color = System.Drawing.Color.Orange.ToArgb();

            VerticeArray[3].Position = new Vector3(0.32f, -0.32f, -0.32f); // Right Bottom Front
            VerticeArray[3].Color = System.Drawing.Color.Red.ToArgb();

            VerticeArray[4].Position = new Vector3(-0.32f, -0.32f, -0.32f); // Bottom Front Left
            VerticeArray[4].Color = System.Drawing.Color.Orange.ToArgb();

            VerticeArray[5].Position = new Vector3(-0.32f, -0.32f, 0.32f); // Left Bottom Rear
            VerticeArray[5].Color = System.Drawing.Color.Yellow.ToArgb();

            vertexBuffer.SetData(VerticeArray, 0, LockFlags.None);
        }
开发者ID:JeremiahZhang,项目名称:AKA,代码行数:30,代码来源:Pyramid.cs

示例4: init

        public override void init()
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;

            //Crear VertexBuffer
            vertexBuffer = new VertexBuffer(typeof(CustomVertex.PositionColored), 3, d3dDevice, Usage.Dynamic | Usage.WriteOnly, CustomVertex.PositionColored.Format, Pool.Default);

            //Cargar informacion de vertices: (X,Y,Z) + Color
            data = new CustomVertex.PositionColored[3];
            data[0] = new CustomVertex.PositionColored(-1, 0, 0, Color.Red.ToArgb());
            data[1] = new CustomVertex.PositionColored(1, 0, 0, Color.Green.ToArgb());
            data[2] = new CustomVertex.PositionColored(0, 1, 0, Color.Blue.ToArgb());

            //FPS Camara
            GuiController.Instance.FpsCamera.Enable = false;
            GuiController.Instance.FpsCamera.setCamera(new Vector3(0.5f, 0,-3), new Vector3(0, 0, 0));

            //User Vars
            GuiController.Instance.UserVars.addVar("Vertices", 0);
            GuiController.Instance.UserVars.addVar("Triangles", 0);

            GuiController.Instance.Modifiers.addFloat("translateX", -5, 5f, 0f);
            GuiController.Instance.Modifiers.addFloat("rotationZ", 0, (float)(2.0f * Math.PI), 0f);
            GuiController.Instance.Modifiers.addFloat("ScaleXYZ", 0, 3, 1f);
        }
开发者ID:aniPerezG,项目名称:barbalpha,代码行数:25,代码来源:Transformations.cs

示例5: Poke

        public void Poke( DateTime timestamp, Device world )
        {
            var vb = new VertexBuffer( typeof( CustomVertex.PositionColored ), 6, world, Usage.Dynamic | Usage.WriteOnly, CustomVertex.PositionColored.Format, Pool.Default );

            var vertices = new CustomVertex.PositionColored[6];

            int i = 0;
            vertices[i].Color = System.Drawing.Color.Gray.ToArgb();
            vertices[i++].Position = new Vector3( 100, 200, 1 );

            vertices[i].Color = System.Drawing.Color.Gray.ToArgb();
            vertices[i++].Position = new Vector3( 0, 100, 1 );

            vertices[i].Color = System.Drawing.Color.Gray.ToArgb();
            vertices[i++].Position = new Vector3( 200, 100, 1 );

            vertices[i].Color = System.Drawing.Color.Gray.ToArgb();
            vertices[i++].Position = new Vector3( 200, 300, 1 );

            vertices[i].Color = System.Drawing.Color.Gray.ToArgb();
            vertices[i++].Position = new Vector3( 0, 300, 1 );

            vertices[i].Color = System.Drawing.Color.Gray.ToArgb();
            vertices[i++].Position = new Vector3( 0, 100, 1 );

            vb.SetData( vertices, 0, LockFlags.None );
            world.SetStreamSource( 1, vb, 0 );
            world.DrawPrimitives( PrimitiveType.TriangleFan, 0, 6 );
        }
开发者ID:Zazcallabah,项目名称:jsdemos,代码行数:29,代码来源:PortedActor.cs

示例6: DrawColoredRectangle

 public static void DrawColoredRectangle(Device dev,RectangleF rect,Color color)
 {
     VertexBuffer vb=null;
     IndexBuffer ib=null;
     try{
         int colorArgb=color.ToArgb();
         CustomVertex.PositionColored[] quadVerts=new CustomVertex.PositionColored[] {
                 new CustomVertex.PositionColored(rect.Left,rect.Bottom,0,colorArgb),
                 new CustomVertex.PositionColored(rect.Left,rect.Top,0,colorArgb),
                 new CustomVertex.PositionColored(rect.Right,rect.Top,0,colorArgb),
                 new CustomVertex.PositionColored(rect.Right,rect.Bottom,0,colorArgb),
             };
         vb=new VertexBuffer(typeof(CustomVertex.PositionColored),
             CustomVertex.PositionColored.StrideSize*quadVerts.Length,
             dev,Usage.WriteOnly,CustomVertex.PositionColored.Format,Pool.Managed);
         vb.SetData(quadVerts,0,LockFlags.None);
         int[] indicies=new int[] { 0,1,2,0,2,3 };
         ib=new IndexBuffer(typeof(int),indicies.Length,dev,Usage.None,Pool.Managed);
         ib.SetData(indicies,0,LockFlags.None);
         dev.VertexFormat=CustomVertex.PositionColored.Format;
         dev.SetStreamSource(0,vb,0);
         dev.Indices=ib;
         dev.DrawIndexedPrimitives(PrimitiveType.TriangleList,0,0,quadVerts.Length,0,indicies.Length/3);
     }finally{
         if(vb!=null){
             vb.Dispose();
             vb=null;
         }
         if(ib!=null){
             ib.Dispose();
             ib=null;
         }
     }
 }
开发者ID:nampn,项目名称:ODental,代码行数:34,代码来源:ToothChartDirectX.cs

示例7: setCollisionBox

        // Default 값
        public void setCollisionBox()
        {
            if (null != m_CollisionBox)
            {
                m_CollisionBox.Dispose();
            }

            m_CollisionBox = new VertexBuffer(typeof(CustomVertex.PositionColored), 8,
                m_device, 0, CustomVertex.PositionColored.Format, Pool.Default);

            CustomVertex.PositionColored[] posColoredVerts = new CustomVertex.PositionColored[8];

            for (int i = 0; i < posColoredVerts.Length; ++i )
            {
                posColoredVerts[i].Position = new Vector3(0, 0, 0);
                posColoredVerts[i].Color = System.Drawing.Color.Black.ToArgb();
            }

            GraphicsStream gstm = m_CollisionBox.Lock(0, 0, LockFlags.None);
            gstm.Write(posColoredVerts);
            m_CollisionBox.Unlock();

            // indexedBuffer
            m_IndexBuffer = new IndexBuffer(m_device, 12 * 2 * 2, Usage.WriteOnly, Pool.Managed, true);

            GraphicsStream idstm = m_IndexBuffer.Lock(0, 0, LockFlags.None);
            idstm.Write(m_IndexedBufferOrder);
            m_IndexBuffer.Unlock();
        }
开发者ID:NHNNEXT,项目名称:2014-01-HUDIGAME-skyLab,代码行数:30,代码来源:GameObject.cs

示例8: init

        public override void init()
        {
            Microsoft.DirectX.Direct3D.Device d3dDevice = GuiController.Instance.D3dDevice;

            //Cuerpo principal que se controla con el teclado
            box = TgcBox.fromSize(new Vector3(0, 10, 0), new Vector3(10, 10, 10), Color.Blue);

            //triangulo
            triangle = new CustomVertex.PositionColored[3];
            triangle[0] = new CustomVertex.PositionColored(-100, 0, 0, Color.Red.ToArgb());
            triangle[1] = new CustomVertex.PositionColored(0, 0, 50, Color.Green.ToArgb());
            triangle[2] = new CustomVertex.PositionColored(0, 100, 0, Color.Blue.ToArgb());
            triagleAABB = TgcBoundingBox.computeFromPoints(new Vector3[] { triangle[0].Position, triangle[1].Position, triangle[2].Position });

            //box2
            box2 = TgcBox.fromSize(new Vector3(-50, 10, -20), new Vector3(15, 15, 15), Color.Violet);

            //sphere
            sphere = new TgcBoundingSphere(new Vector3(30, 20, -20), 15);

            //OBB: computar OBB a partir del AABB del mesh.
            TgcSceneLoader loader = new TgcSceneLoader();
            TgcMesh meshObb = loader.loadSceneFromFile(GuiController.Instance.ExamplesMediaDir + "MeshCreator\\Meshes\\Vehiculos\\StarWars-ATST\\StarWars-ATST-TgcScene.xml").Meshes[0];
            obb = TgcObb.computeFromAABB(meshObb.BoundingBox);
            meshObb.dispose();
            obb.move(new Vector3(100, 0, 30));
            obb.setRotation(new Vector3(0, FastMath.PI / 4, 0));

            //Configurar camara en Tercer Persona
            GuiController.Instance.ThirdPersonCamera.Enable = true;
            GuiController.Instance.ThirdPersonCamera.setCamera(box.Position, 30, -75);
        }
开发者ID:JesusHerrera,项目名称:tgc-viewer,代码行数:32,代码来源:EjemploBoundingBoxTests.cs

示例9: Grid

        public Grid(MeshCreatorControl control)
        {
            this.control = control;

            //El bounding box del piso es bien grande para hacer colisiones
            boundingBox = new TgcBoundingBox(new Vector3(-BIG_VAL, -SMALL_VAL, -BIG_VAL), new Vector3(BIG_VAL, 0, BIG_VAL));

            //Planos para colision de picking
            pickingXZAabb = new TgcBoundingBox(new Vector3(-BIG_VAL, -SMALL_VAL, -BIG_VAL), new Vector3(BIG_VAL, 0, BIG_VAL));
            pickingXYAabb = new TgcBoundingBox(new Vector3(-BIG_VAL, -BIG_VAL, -SMALL_VAL), new Vector3(BIG_VAL, BIG_VAL, 0));
            pickingYZAabb = new TgcBoundingBox(new Vector3(-SMALL_VAL, -BIG_VAL, -BIG_VAL), new Vector3(0, BIG_VAL, BIG_VAL));

            vertices = new CustomVertex.PositionColored[12 * 2 * 2];
            int color = Color.FromArgb(76, 76, 76).ToArgb();

            //10 lineas horizontales en X
            for (int i = 0; i < 11; i++)
            {
                vertices[i * 2] = new CustomVertex.PositionColored(-GRID_RADIUS, 0, -GRID_RADIUS + LINE_SEPARATION * i, color);
                vertices[i * 2 + 1] = new CustomVertex.PositionColored(GRID_RADIUS, 0, -GRID_RADIUS + LINE_SEPARATION * i, color);
            }

            //10 lineas horizontales en Z
            for (int i = 11; i < 22; i++)
            {
                vertices[i * 2] = new CustomVertex.PositionColored(-GRID_RADIUS * 3 + LINE_SEPARATION * i - LINE_SEPARATION, 0, -GRID_RADIUS, color);
                vertices[i * 2 + 1] = new CustomVertex.PositionColored(-GRID_RADIUS * 3 + LINE_SEPARATION * i - LINE_SEPARATION, 0, GRID_RADIUS, color);
            }
        }
开发者ID:JesusHerrera,项目名称:tgc-viewer,代码行数:29,代码来源:Grid.cs

示例10: VertexContainer

        public void VertexContainer( object sender, EventArgs e )
        {
            Device dev = (Device)sender ;
            // Set culling so we're not rendering the back of our triangle
            dev.RenderState.CullMode = Cull.CounterClockwise ;

            // Turn off D3D lighting, since we are providing our own vertex colors
            dev.RenderState.Lighting = false ;

            // Create an instance of ready-made DirectX VertexBuffer
            vertexBuffer = new VertexBuffer(typeof(CustomVertex.PositionColored),
                3, dev, 0, CustomVertex.PositionColored.Format, Pool.Default);

            // Lock our buffer so nothing gets changed while we are reading the data
            GraphicsStream GraphixStream = vertexBuffer.Lock( 0, 0, 0 );
            CustomVertex.PositionColored[] VerticeArray = new CustomVertex.PositionColored[3];

            VerticeArray[0].Position = new Vector3( -0.5f, 0.5f, 0 ); // top right Vertice
            VerticeArray[0].Color = System.Drawing.Color.Yellow.ToArgb();

            VerticeArray[1].Position = new Vector3( 0.5f, -0.5f, 0 ); // bottom right
            VerticeArray[1].Color = System.Drawing.Color.Orange.ToArgb();

            VerticeArray[2].Position = new Vector3( -0.5f, -0.5f, 0 ); // bottom left
            VerticeArray[2].Color = System.Drawing.Color.Red.ToArgb();

            GraphixStream.Write(VerticeArray);
            vertexBuffer.Unlock();
        }
开发者ID:JeremiahZhang,项目名称:AKA,代码行数:29,代码来源:Form1.cs

示例11: CreateCoordLines

 public static void CreateCoordLines()
 {
     lines = new CustomVertex.PositionColored[6];
     lines[1] = lines[3] = lines[5] = new CustomVertex.PositionColored(new Vector3(0, 0, 0), 0);
     lines[0] = new CustomVertex.PositionColored(new Vector3(1, 0, 0), 0);
     lines[2] = new CustomVertex.PositionColored(new Vector3(0, 1, 0), 0);
     lines[4] = new CustomVertex.PositionColored(new Vector3(0, 0, 1), 0);
 }
开发者ID:CreeperLava,项目名称:ME3Explorer,代码行数:8,代码来源:Renderer.cs

示例12: BuildRingOnZ

 private static void BuildRingOnZ(CustomVertex.PositionColored[] verts, int index, int clr, Vector2[] points)
 {
     int pIdx = 0;
     for (int i = index; i < index + points.Length; i++)
     {
         verts[i] = new CustomVertex.PositionColored(points[pIdx].X, points[pIdx].Y, 0, clr);
         pIdx++;
     }
     verts[index + points.Length] = new CustomVertex.PositionColored(points[0].X, points[0].Y, 0, clr);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:10,代码来源:RotationAxis3DHelper.cs

示例13: BuildGeometry

        private void BuildGeometry()
        {
            geom = GpuDemGeometry.CreateGeometry(rDb, gDevice, out maxDataValue, reader);

            clipBottomSideQuad = new CustomVertex.PositionColored[4];
            int clr = Color.DarkGray.ToArgb();
            clipBottomSideQuad[1] = new CustomVertex.PositionColored(0, -0.5f, 0, clr);
            clipBottomSideQuad[0] = new CustomVertex.PositionColored(0, -0.5f, 5, clr);
            clipBottomSideQuad[3] = new CustomVertex.PositionColored(5, -0.5f, 0, clr);
            clipBottomSideQuad[2] = new CustomVertex.PositionColored(5, -0.5f, 5, clr);
        }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:11,代码来源:DigitalElevationMap.cs

示例14: Line

        public Line(float x1, float y1, float x2, float y2)
        {
            Vertices = new CustomVertex.PositionColored[4];

            Vertices[0] = new CustomVertex.PositionColored(
                new Vector3(x1, y2, 0.0f), Color.White.ToArgb());
            Vertices[1] = new CustomVertex.PositionColored(
                new Vector3(x1, y1, 0.0f), Color.White.ToArgb());
            Vertices[2] = new CustomVertex.PositionColored(
                new Vector3(x2, y2, 0.0f), Color.White.ToArgb());
            Vertices[3] = new CustomVertex.PositionColored(
                new Vector3(x2, y1, 0.0f), Color.White.ToArgb());
        }
开发者ID:DJSymBiotiX,项目名称:MX-Engine,代码行数:13,代码来源:Primitives.cs

示例15: init

        public override void init()
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;

            //Definir array de vertices para el triangulo, del tipo Coordendas (X,Y,Z) + Color
            data = new CustomVertex.PositionColored[3];

            //Cargar información de vertices. Nesitamos 3 vertices para crear un triángulo
            data[0] = new CustomVertex.PositionColored(-1, 0, 0, Color.Red.ToArgb());
            data[1] = new CustomVertex.PositionColored(1, 0, 0, Color.Green.ToArgb());
            data[2] = new CustomVertex.PositionColored(0, 1, 0, Color.Blue.ToArgb());

            //Configurar camara en rotacion
            GuiController.Instance.RotCamera.setCamera(new Vector3(0, 0.5f, 0), 3f);

            //Cargar variables de usuario con alguna informacion util para ver en pantalla
            GuiController.Instance.UserVars.addVar("Cantida de Vertices", data.Length);
        }
开发者ID:JesusHerrera,项目名称:tgc-viewer,代码行数:18,代码来源:TrianguloBasico.cs


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