-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #218 from vircadia/feature/light-handling
Upgrade lightmap / light handling.
- Loading branch information
Showing
6 changed files
with
201 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* eslint-disable @typescript-eslint/no-non-null-assertion */ | ||
// | ||
// LightManager.ts | ||
// | ||
// Created by Kalila on 08 Feb 2024. | ||
// Copyright 2024 Vircadia contributors. | ||
// Copyright 2024 DigiSomni LLC. | ||
// | ||
// Distributed under the Apache License, Version 2.0. | ||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html | ||
// | ||
|
||
import { | ||
type AbstractMesh, | ||
type Scene, | ||
} from "@babylonjs/core"; | ||
import Log from "../debugging/log"; | ||
|
||
export class LightManager { | ||
private static handleKeyPress = (event: KeyboardEvent) => { | ||
if (event.key === "u") { | ||
const scene = LightManager.currentScene; // Ensure you have a reference to the current scene | ||
const lights = scene.lights; | ||
lights.forEach((light) => { | ||
light.lightmapMode = (light.lightmapMode + 1) % 3; | ||
Log.debug(Log.types.ENTITIES, `Lightmap mode for ${light.name}: ${light.lightmapMode}`); | ||
}); | ||
} | ||
}; | ||
|
||
private static currentScene: Scene; | ||
|
||
public static applyLightProperties(meshes: AbstractMesh[], scene: Scene): void { | ||
Check warning on line 33 in src/modules/scene/LightManager.ts GitHub Actions / 🎉 Deploy
|
||
// this.currentScene = scene; // Store the current scene reference | ||
|
||
// // Find all the lights in the meshes as they are imported. | ||
// const lights = meshes.filter((mesh) => mesh instanceof AbstractMesh && mesh.name.startsWith("Light_")); | ||
// console.info("##### LIGHTS", lights); | ||
|
||
// // Ensure we don't add the same event listener more than once | ||
// window.removeEventListener("keyup", this.handleKeyPress); | ||
// window.addEventListener("keyup", this.handleKeyPress); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.