Синтаксис:
Используется csharp
BinaryReader b = new BinaryReader(File.Open(heighmap, FileMode.Open));
int length = (int)b.BaseStream.Length;
float[,] data1 = new float[resolution, resolution];
int pos = 0;
int index = 0;
ushort[] bytes = new ushort[length];
//float[] bytes = new float[length];
while (pos < length)
{
pos += sizeof(ushort);
//bytes[index++] = b.ReadUInt16();
bytes[index++] = b.ReadByte();
}
int i = 0, j = 0;
for (i = 0; i < resolution; i++)
for (j = 0; j < resolution; j++)
{
data1[i, j] = bytes[i * resolution + j] / divide;
}
}
newTerrainData1.SetHeights(0, 0, data1);
Terrain.CreateTerrainGameObject(newTerrainData1);
Terrain.activeTerrain.name = name;
Но он читает данные как из 8 битного файла , как сделать правильно? подскажите пожалуйста