map3drendering/LandblockExtraction/LandBlockExtractor/Utilities/BlockStruct.cs
2024-02-28 17:07:45 +01:00

30 lines
1.1 KiB
C#

namespace LandblockExtraction.LandBlockExtractor {
public class BlockStruct {
public readonly static int BlockSize = 17;
public VerticesStruct verticesStruct;
public int[] indices;
public BlockStruct() {
verticesStruct = new VerticesStruct(BlockSize);
indices = new int[(BlockSize - 1) * (BlockSize - 1) * 6];
}
public void GenerateIndices() {
int index = 0;
for (int y = 0; y < BlockSize - 1; y++) {
for (int x = 0; x < BlockSize - 1; x++) {
// Indices des sommets du premier triangle
indices[index++] = y * BlockSize + x;
indices[index++] = (y + 1) * BlockSize + x;
indices[index++] = y * BlockSize + x + 1;
// Indices des sommets du deuxième triangle
indices[index++] = y * BlockSize + x + 1;
indices[index++] = (y + 1) * BlockSize + x;
indices[index++] = (y + 1) * BlockSize + x + 1;
}
}
}
}
}