更换新的植被生成系统
This commit is contained in:
@@ -20,6 +20,7 @@ export class OceanScene {
|
||||
this.sun = new THREE.Vector3();
|
||||
this.terrain = null;
|
||||
this.vegetation = null;
|
||||
this.vegetationSystem = null;
|
||||
this.pmremGenerator = null;
|
||||
this.renderTarget = null;
|
||||
this.sunLight = null;
|
||||
@@ -304,13 +305,15 @@ export class OceanScene {
|
||||
|
||||
async initVegetation() {
|
||||
const vegSystem = new VegetationSystem(this.terrainGenerator, {
|
||||
grassCount: 30000,
|
||||
treeCount: 300,
|
||||
terrainSize: 1200,
|
||||
waterLevel: 1
|
||||
grassCount: 140000, // 草簇数量,越大地表覆盖越密
|
||||
shrubCount: 12, // 灌木和低矮植物数量
|
||||
treeCount: 9, // 树木数量
|
||||
terrainSize: 1200, // 植被允许分布的地形范围
|
||||
waterLevel: 1 // 植被生成时参考的水位,避免贴近海边
|
||||
});
|
||||
|
||||
this.vegetation = vegSystem.generate();
|
||||
this.vegetationSystem = vegSystem;
|
||||
vegSystem.addToScene(this.scene);
|
||||
}
|
||||
|
||||
@@ -480,6 +483,10 @@ export class OceanScene {
|
||||
layer.texture.offset.y = time * layer.speedY;
|
||||
});
|
||||
}
|
||||
|
||||
if (this.vegetationSystem) {
|
||||
this.vegetationSystem.update(time);
|
||||
}
|
||||
|
||||
this.controls.update();
|
||||
if (this.composer) {
|
||||
|
||||
Reference in New Issue
Block a user