You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
817 B
TypeScript
27 lines
817 B
TypeScript
3 months ago
|
import * as THREE from "three";
|
||
|
import type Viewer from "../Viewer";
|
||
|
|
||
|
export default class Floors {
|
||
|
protected viewer: Viewer;
|
||
|
public planeWidth = 1000;
|
||
|
public planeHeight = 1000;
|
||
|
|
||
|
constructor(viewer: Viewer) {
|
||
|
this.viewer = viewer;
|
||
|
this.initFlooer();
|
||
|
}
|
||
|
|
||
|
private initFlooer() {
|
||
|
const ground = new THREE.Mesh(new THREE.PlaneGeometry(this.planeWidth, this.planeHeight), new THREE.MeshPhongMaterial({ color: 0xbbbbbb, depthWrite: false }));
|
||
|
ground.rotation.x = -Math.PI / 2;
|
||
|
ground.receiveShadow = true;
|
||
|
this.viewer.scene.add(ground);
|
||
|
}
|
||
|
|
||
|
/**网格辅助线 */
|
||
|
public addGird(size = 1000, divisions = 20, colorCenterLine = 0x888888, colorGrid = 0x888888) {
|
||
|
const grid = new THREE.GridHelper(size, divisions, colorCenterLine, colorGrid);
|
||
|
this.viewer.scene.add(grid);
|
||
|
}
|
||
|
}
|