Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DebugX.Log("Interpolating unset height cells");
- for (int x = 0; x < heightmapSize; ++x)
- {
- for (int y = 0; y < heightmapSize; ++y)
- {
- if (!(setHeights[x, y]))
- {
- float totalWeight = 0;
- float totalHeight = 0;
- foreach (float[] knownHeight in knownHeights)
- {
- float kx = knownHeight[0];
- float ky = knownHeight[1];
- float kz = knownHeight[2];
- float xDiff = (x-kx);
- float zDiff = (z-kz);
- float distSq = xDiff*xDiff + zDiff*zDiff;
- float weight = 1;
- if (distSq > 0)
- {
- weight = 1/distSq;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment