예제 #1
0
        public Mesh()
        {
            Vertices    = new Vertex[4];
            Vertices[0] = new Vertex(new Vector3(-0.5f, +0.5f, 0.0f), new Color(1.0f, 0.0f, 0.0f, 1.0f));
            Vertices[1] = new Vertex(new Vector3(+0.5f, +0.5f, 0.0f), new Color(0.0f, 1.0f, 0.0f, 1.0f));
            Vertices[2] = new Vertex(new Vector3(-0.5f, -0.5f, 0.0f), new Color(0.0f, 0.0f, 1.0f, 1.0f));
            Vertices[3] = new Vertex(new Vector3(+0.5f, -0.5f, 0.0f), new Color(1.0f, 1.0f, 1.0f, 1.0f));


            Indices = new int[]
            {
                0, 1, 2,
                2, 1, 3,

                //0, 3, 2,
                //0, 1, 3,
            };



            VertexCount = Vertices.Count();

            IndexCount = Indices.Count();

            Size = Utilities.SizeOf <Vertex>();

            SizeInBytes = Utilities.SizeOf <Vertex>() * Vertices.Count();

            IndexSize = Utilities.SizeOf <int>();

            IndexSizeInBytes = Utilities.SizeOf <int>() * Indices.Count();
        }
예제 #2
0
        public Mesh()
        {
            Vertices    = new Vertex[3];
            Vertices[0] = new Vertex(new Vector3(+0.0f, +0.5f, +0.0F));
            Vertices[1] = new Vertex(new Vector3(+0.5f, -0.5f, +0.0f));
            Vertices[2] = new Vertex(new Vector3(-0.5f, -0.5f, +0.0f));



            Size = Utilities.SizeOf <Vertex>();

            SizeInBytes = Utilities.SizeOf <Vertex>() * Vertices.Count();

            VertexCount = Vertices.Count();
        }
예제 #3
0
        public Mesh()
        {
            Vertices    = new Vertex[8];
            Vertices[0] = new Vertex(new Vector3(-0.5f, +0.5f, 0.0f), new Color(1.0f, 0.0f, 0.0f, 1.0f));
            Vertices[1] = new Vertex(new Vector3(+0.5f, +0.5f, 0.0f), new Color(0.0f, 1.0f, 0.0f, 1.0f));
            Vertices[2] = new Vertex(new Vector3(-0.5f, -0.5f, 0.0f), new Color(0.0f, 0.0f, 1.0f, 1.0f));
            Vertices[3] = new Vertex(new Vector3(+0.5f, -0.5f, 0.0f), new Color(1.0f, 1.0f, 1.0f, 1.0f));

            Vertices[4] = new Vertex(new Vector3(-0.75f, +0.75f, +0.9f), new Color(0.35f, 0.35f, 0.7f, 1.0f));
            Vertices[5] = new Vertex(new Vector3(+0.0f, +0.0f, +0.9f), new Color(0.35f, 0.35f, 0.7f, 1.0f));
            Vertices[6] = new Vertex(new Vector3(-0.75f, +0.0f, +0.9f), new Color(0.35f, 0.35f, 0.7f, 1.0f));
            Vertices[7] = new Vertex(new Vector3(+0.0f, +0.75f, +0.9f), new Color(0.35f, 0.35f, 0.7f, 1.0f));


            Indices = new int[]
            {
                0, 1, 2,
                2, 1, 3,

                4, 5, 6, // first triangle
                4, 7, 5, // second triangle
            };



            VertexCount = Vertices.Count();

            IndexCount = Indices.Count();

            Size = Utilities.SizeOf <Vertex>();

            SizeInBytes = Utilities.SizeOf <Vertex>() * Vertices.Count();

            IndexSize = Utilities.SizeOf <int>();

            IndexSizeInBytes = Utilities.SizeOf <int>() * Indices.Count();
        }
예제 #4
0
        public Mesh()
        {
            Vertices    = new Vertex[24];
            Vertices[0] = new Vertex(new Vector3(-0.5f, 0.5f, -0.5f), new Color(1.0f, 0.0f, 0.0f, 1.0f));
            Vertices[1] = new Vertex(new Vector3(0.5f, -0.5f, -0.5f), new Color(1.0f, 1.0f, 1.0f, 1.0f));
            Vertices[2] = new Vertex(new Vector3(-0.5f, -0.5f, -0.5f), new Color(0.0f, 0.0f, 1.0f, 1.0f));
            Vertices[3] = new Vertex(new Vector3(0.5f, 0.5f, -0.5f), new Color(0.0f, 1.0f, 0.0f, 1.0f));

            Vertices[4] = new Vertex(new Vector3(0.5f, -0.5f, -0.5f), new Color(1.0f, 0.0f, 0.0f, 1.0f));
            Vertices[5] = new Vertex(new Vector3(0.5f, 0.5f, 0.5f), new Color(1.0f, 1.0f, 1.0f, 1.0f));
            Vertices[6] = new Vertex(new Vector3(0.5f, -0.5f, 0.5f), new Color(0.0f, 0.0f, 1.0f, 1.0f));
            Vertices[7] = new Vertex(new Vector3(0.5f, 0.5f, -0.5f), new Color(0.0f, 1.0f, 0.0f, 1.0f));

            Vertices[8]  = new Vertex(new Vector3(-0.5f, 0.5f, 0.5f), new Color(1.0f, 0.0f, 0.0f, 1.0f));
            Vertices[9]  = new Vertex(new Vector3(-0.5f, -0.5f, -0.5f), new Color(1.0f, 1.0f, 1.0f, 1.0f));
            Vertices[10] = new Vertex(new Vector3(-0.5f, -0.5f, 0.5f), new Color(0.0f, 0.0f, 1.0f, 1.0f));
            Vertices[11] = new Vertex(new Vector3(-0.5f, 0.5f, -0.5f), new Color(0.0f, 1.0f, 0.0f, 1.0f));

            Vertices[12] = new Vertex(new Vector3(0.5f, 0.5f, 0.5f), new Color(1.0f, 0.0f, 0.0f, 1.0f));
            Vertices[13] = new Vertex(new Vector3(-0.5f, -0.5f, 0.5f), new Color(1.0f, 1.0f, 1.0f, 1.0f));
            Vertices[14] = new Vertex(new Vector3(0.5f, -0.5f, 0.5f), new Color(0.0f, 0.0f, 1.0f, 1.0f));
            Vertices[15] = new Vertex(new Vector3(-0.5f, 0.5f, 0.5f), new Color(0.0f, 1.0f, 0.0f, 1.0f));

            Vertices[16] = new Vertex(new Vector3(-0.5f, 0.5f, -0.5f), new Color(1.0f, 0.0f, 0.0f, 1.0f));
            Vertices[17] = new Vertex(new Vector3(0.5f, 0.5f, 0.5f), new Color(1.0f, 1.0f, 1.0f, 1.0f));
            Vertices[18] = new Vertex(new Vector3(0.5f, 0.5f, -0.5f), new Color(0.0f, 0.0f, 1.0f, 1.0f));
            Vertices[19] = new Vertex(new Vector3(-0.5f, 0.5f, 0.5f), new Color(0.0f, 1.0f, 0.0f, 1.0f));

            Vertices[20] = new Vertex(new Vector3(0.5f, -0.5f, 0.5f), new Color(1.0f, 0.0f, 0.0f, 1.0f));
            Vertices[21] = new Vertex(new Vector3(-0.5f, -0.5f, -0.5f), new Color(1.0f, 1.0f, 1.0f, 1.0f));
            Vertices[22] = new Vertex(new Vector3(0.5f, -0.5f, -0.5f), new Color(0.0f, 0.0f, 1.0f, 1.0f));
            Vertices[23] = new Vertex(new Vector3(-0.5f, -0.5f, 0.5f), new Color(0.0f, 1.0f, 0.0f, 1.0f));


            Indices = new int[]
            {
                // front face
                0, 1, 2, // first triangle
                0, 3, 1, // second triangle

                // left face
                4, 5, 6, // first triangle
                4, 7, 5, // second triangle

                // right face
                8, 9, 10, // first triangle
                8, 11, 9, // second triangle

                // back face
                12, 13, 14, // first triangle
                12, 15, 13, // second triangle

                // top face
                16, 17, 18, // first triangle
                16, 19, 17, // second triangle

                // bottom face
                20, 21, 22, // first triangle
                20, 23, 21, // second triangle
            };



            VertexCount = Vertices.Count();

            IndexCount = Indices.Count();

            Size = Utilities.SizeOf <Vertex>();

            SizeInBytes = Utilities.SizeOf <Vertex>() * Vertices.Count();

            IndexSize = Utilities.SizeOf <int>();

            IndexSizeInBytes = Utilities.SizeOf <int>() * Indices.Count();
        }