Skip to content

Commit

Permalink
fix: 统一地形高度
Browse files Browse the repository at this point in the history
  • Loading branch information
lvisei committed Jun 5, 2024
1 parent c5a1897 commit b3c51c4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions examples/demos/geometry/terrain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export const terrain: TestCase = async (options) => {
terrainTexture:
'https://gw.alipayobjects.com/mdn/rms_23a451/afts/img/A*eYFaRYlnnOUAAAAAAAAAAAAAARQnAQ',
rgb2height: (r, g, b) => {
let h = -10000.0 + (r * 255.0 * 256.0 * 256.0 + g * 255.0 * 256.0 + b * 255.0) * 0.1;
h = h / 20 - 127600;
let h = (r * 255.0 * 256.0 * 256.0 + g * 255.0 * 256.0 + b * 255.0) * 0.1;
h = h / 200 - 12750;
h = Math.max(0, h);
return h;
},
Expand Down
2 changes: 1 addition & 1 deletion packages/layers/src/geometry/models/plane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default class PlaneModel extends BaseModel {

for (let ix = 0; ix < gridX1; ix++) {
const x = ix * segmentWidth - widthHalf;
positions.push(x + lng, -y + lat, 10);
positions.push(x + lng, -y + lat, 0);
positions.push(ix / gridX);
positions.push(1 - iy / gridY);
}
Expand Down
2 changes: 1 addition & 1 deletion site/examples/geometry/geometry/demo/rain.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ scene.on('loaded', () => {
center: [120, 30],
spriteCount: 120,
spriteRadius: 10,
spriteTop: 300,
spriteTop: 400,
spriteUpdate: 10,
spriteScale: 0.8,
});
Expand Down
4 changes: 2 additions & 2 deletions site/examples/geometry/geometry/demo/terrain.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ scene.on('loaded', () => {
terrainTexture:
'https://gw.alipayobjects.com/mdn/rms_23a451/afts/img/A*eYFaRYlnnOUAAAAAAAAAAAAAARQnAQ',
rgb2height: (r, g, b) => {
let h = -10000.0 + (r * 255.0 * 256.0 * 256.0 + g * 255.0 * 256.0 + b * 255.0) * 0.1;
h = h / 20 - 127600;
let h = (r * 255.0 * 256.0 * 256.0 + g * 255.0 * 256.0 + b * 255.0) * 0.1;
h = h / 200 - 12750;
h = Math.max(0, h);
return h;
},
Expand Down

0 comments on commit b3c51c4

Please sign in to comment.