using System.Numerics;

namespace LandblockExtraction.LandBlockExtractor {
    public class VerticesStruct {
        public Vector3[] position { get; set; }
        public Vector4[] color { get; set; }
        public Vector4[] farcolor { get; set; }

        public VerticesStruct(int blockSize) {
            position = new Vector3[blockSize * blockSize];
            color = new Vector4[blockSize * blockSize];
            farcolor = new Vector4[blockSize * blockSize];
        }

        public float[] Vertices() {
            int length = position.Length;
            float[] vertices = new float[length * 11]; // 3 pour position, 4 pour color, et 4 pour farcolor
            for (int i = 0, vi = 0; i < length; i++, vi += 11) {
                vertices[vi] = position[i].X;
                vertices[vi + 1] = position[i].Y;
                vertices[vi + 2] = position[i].Z;
                vertices[vi + 3] = color[i].X;
                vertices[vi + 4] = color[i].Y;
                vertices[vi + 5] = color[i].Z;
                vertices[vi + 6] = color[i].W;
                vertices[vi + 7] = farcolor[i].X;
                vertices[vi + 8] = farcolor[i].Y;
                vertices[vi + 9] = farcolor[i].Z;
                vertices[vi + 10] = farcolor[i].W;
            }
            return vertices;
        }
    }
}
