public CHUNK_DATA(string _name, FLOAT3 _pos, float[,] _heights, int _biome, List <string> neigh) { name = _name; pos = _pos; heights = _heights; biome = _biome; neighBors = neigh; }
/// <summary> Transforms local position to cell index </summary> public bool LocalPointToIndex2d(FLOAT3 localPoint, float spacing, out int2 result) { int x = (int)((localPoint.x + (float)Width * 0.5f * spacing) / spacing); int z = (int)((localPoint.z + (float)Height * 0.5f * spacing) / spacing); if (IsIndex2dValid(x, z)) { result = new int2 { x = x, y = z }; return(true); } else { result = new int2 { x = -1, y = -1 }; return(false); } }
public static float DotProduct(FLOAT3 a, FLOAT3 b) { return(a.X * b.X + a.Y * b.Y + a.Z * b.Z); }