Browse Source

光照参数

master
修宁 5 months ago
parent
commit
b8d3295bdc
  1. 27
      src/core/engine/SceneHelp.ts
  2. 5
      src/types/Types.d.ts

27
src/core/engine/SceneHelp.ts

@ -65,11 +65,7 @@ export default class SceneHelp {
this.scene.add(gridHelper2)
// 光照
// const ambientLight = new THREE.AmbientLight(0xffffff, 0.8)
// this.scene.add(ambientLight)
// 光照
const ambientLight = new THREE.AmbientLight(0xffffff, 1.5)
const ambientLight = new THREE.AmbientLight(0xffffff, 2.5)
this.scene.add(ambientLight)
const directionalLight = new THREE.DirectionalLight(0xffffff, 1.5)
@ -82,36 +78,19 @@ export default class SceneHelp {
// 完全不透明的地板
const geometry = new THREE.PlaneGeometry(gridOption.gridSize, gridOption.gridSize)
const material = new THREE.MeshBasicMaterial({
const material = new THREE.MeshToonMaterial({
color: '#ffffff',
side: THREE.BackSide
})
material.color.convertSRGBToLinear();
const ground = new THREE.Mesh(geometry, material)
ground.rotation.x = Math.PI / 2
ground.position.y = -0.01
this.scene.add(ground)
// const directionalLight = new THREE.DirectionalLight(0xffffff, 1.5)
// directionalLight.position.set(5, 5, 5).multiplyScalar(3)
// directionalLight.castShadow = true
// this.scene.add(directionalLight)
//
// const hemisphereLight = new THREE.HemisphereLight(0xffffff, 0x444444, 1)
// this.scene.add(hemisphereLight)
window['scene'] = this.scene
}
// /**
// * 加载指定楼层的实体并添加到场景
// * @param floorId 楼层 ID
// */
// async loadFloorEntities(floorId: string): Promise<void> {
// const items = await this.worldModel.loadFloor(floorId)
// items.forEach((item) => {
// this.entityManager.createOrUpdateEntity(item)
// })
// }
remove(...objects: THREE.Object3D[]) {
_.forEach(objects, (object) => {
if (object?.parent) {

5
src/types/Types.d.ts

@ -95,6 +95,11 @@ interface IGridHelper {
axesWidth: number;
/**
*
*/
groundColor: number;
/**
*
*/
gridEnabled: boolean;

Loading…
Cancel
Save