예제 #1
0
        public Particle(int w, int h)
        {
            W = w;
            H = h;
            Mesh3D mesh = new Mesh3D(12, 4);

            Vector3 p1 = new Vector3(-w / 2, -h / 2, 0);
            Vector3 p2 = new Vector3(w / 2, -h / 2, 0);
            Vector3 p3 = new Vector3(w / 2, h / 2, 0);
            Vector3 p4 = new Vector3(-w / 2, h / 2, 0);

            Vector2 uv1 = new Vector2(0, 0);
            Vector2 uv2 = new Vector2(1, 0);
            Vector2 uv3 = new Vector2(1, 1);
            Vector2 uv4 = new Vector2(0, 1);

            Vector3 z = Vector3.Zero;

            mesh.SetVertex(0, p1, z, z, z, uv1);
            mesh.SetVertex(1, p2, z, z, z, uv2);
            mesh.SetVertex(2, p3, z, z, z, uv3);
            mesh.SetVertex(3, p4, z, z, z, uv4);

            mesh.SetIndex(0, 0);
            mesh.SetIndex(1, 1);
            mesh.SetIndex(2, 2);
            mesh.SetIndex(3, 2);
            mesh.SetIndex(4, 3);
            mesh.SetIndex(5, 0);

            mesh.SetIndex(6, 2);
            mesh.SetIndex(7, 1);
            mesh.SetIndex(8, 0);
            mesh.SetIndex(9, 0);
            mesh.SetIndex(10, 3);
            mesh.SetIndex(11, 2);

            mesh.Final();

            Meshes.Add(mesh);
        }