mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-26 00:54:06 +02:00
wip
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -406,6 +406,7 @@ export class RoomEngine {
|
|||||||
private envMapOutdoor: BABYLON.CubeTexture;
|
private envMapOutdoor: BABYLON.CubeTexture;
|
||||||
private reflectionProbe: BABYLON.ReflectionProbe;
|
private reflectionProbe: BABYLON.ReflectionProbe;
|
||||||
private roomLight: BABYLON.SpotLight;
|
private roomLight: BABYLON.SpotLight;
|
||||||
|
public lightContainer: BABYLON.ClusteredLightContainer;
|
||||||
private enableReflectionProbe = false;
|
private enableReflectionProbe = false;
|
||||||
private xGridPreviewPlane: BABYLON.Mesh;
|
private xGridPreviewPlane: BABYLON.Mesh;
|
||||||
private yGridPreviewPlane: BABYLON.Mesh;
|
private yGridPreviewPlane: BABYLON.Mesh;
|
||||||
@@ -439,10 +440,6 @@ export class RoomEngine {
|
|||||||
//this.scene.autoClearDepthAndStencil = false;
|
//this.scene.autoClearDepthAndStencil = false;
|
||||||
this.scene.skipPointerMovePicking = true;
|
this.scene.skipPointerMovePicking = true;
|
||||||
|
|
||||||
if (_DEV_) {
|
|
||||||
new BoundingBoxRenderer(this.scene);
|
|
||||||
}
|
|
||||||
|
|
||||||
const skybox = BABYLON.MeshBuilder.CreateBox('skybox', { size: 100000/*cm*/ }, this.scene);
|
const skybox = BABYLON.MeshBuilder.CreateBox('skybox', { size: 100000/*cm*/ }, this.scene);
|
||||||
const skyboxMat = new BABYLON.StandardMaterial('skyboxMat', this.scene);
|
const skyboxMat = new BABYLON.StandardMaterial('skyboxMat', this.scene);
|
||||||
skyboxMat.backFaceCulling = false;
|
skyboxMat.backFaceCulling = false;
|
||||||
@@ -547,6 +544,8 @@ export class RoomEngine {
|
|||||||
this.shadowGeneratorForSunLight.usePoissonSampling = true;
|
this.shadowGeneratorForSunLight.usePoissonSampling = true;
|
||||||
this.shadowGeneratorForSunLight.getShadowMap().refreshRate = 60;
|
this.shadowGeneratorForSunLight.getShadowMap().refreshRate = 60;
|
||||||
|
|
||||||
|
this.lightContainer = new BABYLON.ClusteredLightContainer('clustered', [], this.scene);
|
||||||
|
|
||||||
this.turnOnRoomLight();
|
this.turnOnRoomLight();
|
||||||
|
|
||||||
if (USE_GLOW) {
|
if (USE_GLOW) {
|
||||||
@@ -707,7 +706,8 @@ export class RoomEngine {
|
|||||||
public async init() {
|
public async init() {
|
||||||
await this.loadRoomModel();
|
await this.loadRoomModel();
|
||||||
await this.loadEnvModel();
|
await this.loadEnvModel();
|
||||||
await Promise.all(this.roomState.installedObjects.map(o => this.loadObject({
|
// beamLampがあるとなぜかclustered lightがエラーになる
|
||||||
|
await Promise.all(this.roomState.installedObjects.filter(o => o.type !== 'beamLamp').map(o => this.loadObject({
|
||||||
id: o.id,
|
id: o.id,
|
||||||
type: o.type,
|
type: o.type,
|
||||||
position: new BABYLON.Vector3(...o.position),
|
position: new BABYLON.Vector3(...o.position),
|
||||||
|
|||||||
@@ -14,14 +14,15 @@ export const beamLamp = defineObject({
|
|||||||
default: {},
|
default: {},
|
||||||
},
|
},
|
||||||
placement: 'top',
|
placement: 'top',
|
||||||
createInstance: ({ root, scene }) => {
|
createInstance: ({ room, root, scene }) => {
|
||||||
return {
|
return {
|
||||||
onInited: () => {
|
onInited: () => {
|
||||||
const light = new BABYLON.PointLight('beamLampLight', new BABYLON.Vector3(0, 10/*cm*/, 0), scene);
|
const light = new BABYLON.PointLight('beamLampLight', new BABYLON.Vector3(0, 10/*cm*/, 0), scene, true);
|
||||||
light.parent = root;
|
light.parent = root;
|
||||||
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
|
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
|
||||||
light.intensity = 300;
|
light.intensity = 300;
|
||||||
light.range = 100/*cm*/;
|
light.range = 100/*cm*/;
|
||||||
|
room.lightContainer.addLight(light);
|
||||||
},
|
},
|
||||||
interactions: {},
|
interactions: {},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,14 +13,15 @@ export const lavaLamp = defineObject({
|
|||||||
default: {},
|
default: {},
|
||||||
},
|
},
|
||||||
placement: 'top',
|
placement: 'top',
|
||||||
createInstance: ({ scene, root }) => {
|
createInstance: ({ room, scene, root }) => {
|
||||||
return {
|
return {
|
||||||
onInited: () => {
|
onInited: () => {
|
||||||
const light = new BABYLON.PointLight('lavaLampLight', new BABYLON.Vector3(0, 11/*cm*/, 0), scene);
|
const light = new BABYLON.PointLight('lavaLampLight', new BABYLON.Vector3(0, 11/*cm*/, 0), scene, true);
|
||||||
light.parent = root;
|
light.parent = root;
|
||||||
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
|
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
|
||||||
light.intensity = 300;
|
light.intensity = 300;
|
||||||
light.range = 100/*cm*/;
|
light.range = 100/*cm*/;
|
||||||
|
room.lightContainer.addLight(light);
|
||||||
|
|
||||||
const sphere = BABYLON.MeshBuilder.CreateSphere('lavaLampLightSphere', { diameter: 4/*cm*/ }, scene);
|
const sphere = BABYLON.MeshBuilder.CreateSphere('lavaLampLightSphere', { diameter: 4/*cm*/ }, scene);
|
||||||
sphere.parent = root;
|
sphere.parent = root;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export const woodRingFloorLamp = defineObject({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
placement: 'floor',
|
placement: 'floor',
|
||||||
createInstance: ({ options, model }) => {
|
createInstance: ({ room, scene, options, model }) => {
|
||||||
const shadeMaterial = model.findMaterial('__X_SHADE__');
|
const shadeMaterial = model.findMaterial('__X_SHADE__');
|
||||||
|
|
||||||
const applyShadeColor = () => {
|
const applyShadeColor = () => {
|
||||||
@@ -45,6 +45,16 @@ export const woodRingFloorLamp = defineObject({
|
|||||||
|
|
||||||
applyBodyColor();
|
applyBodyColor();
|
||||||
|
|
||||||
|
const lamps = model.findMeshes('__X_LAMP__');
|
||||||
|
for (const lamp of lamps) {
|
||||||
|
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(0/*cm*/, 0/*cm*/, 0), new BABYLON.Vector3(0, -1, 0), Math.PI / 1, 2, scene, true);
|
||||||
|
light.parent = lamp;
|
||||||
|
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
|
||||||
|
light.intensity = 5000;
|
||||||
|
light.range = 150/*cm*/;
|
||||||
|
room.lightContainer.addLight(light);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
onOptionsUpdated: ([k, v]) => {
|
onOptionsUpdated: ([k, v]) => {
|
||||||
applyShadeColor();
|
applyShadeColor();
|
||||||
|
|||||||
Reference in New Issue
Block a user