Skip to content

Commit cb96727

Browse files
committed
fix(Terrain): fix terrain subdivision when a terrain tile only has values that should be clamped
1 parent c862ca7 commit cb96727

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Parser/XbilParser.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,16 @@ export function computeMinMaxElevation(texture, pitch, options) {
6464
}
6565
}
6666
}
67-
if (options.zmin > min) { min = options.zmin; }
68-
if (options.zmax < max) { max = options.zmax; }
67+
// Clamp values to zmin and zmax values configured in ElevationLayer
68+
if (options.zmin != null) {
69+
if (min < options.zmin) { min = options.zmin; }
70+
if (max < options.zmin) { max = options.zmin; }
71+
}
72+
73+
if (options.zmax != null) {
74+
if (min > options.zmax) { min = options.zmax; }
75+
if (max > options.zmax) { max = options.zmax; }
76+
}
6977
}
7078

7179
if (max === -Infinity || min === Infinity) {

0 commit comments

Comments
 (0)