mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-23 19:14:19 +02:00
wip
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../object.js';
|
||||
import { cm, WORLD_SCALE, createPlaneUvMapper } from '../../utility.js';
|
||||
import { getLightRangeFactorByGraphicsQuality } from '../utility.js';
|
||||
|
||||
export const allInOnePc = defineObject({
|
||||
id: 'allInOnePc',
|
||||
@@ -47,7 +48,7 @@ export const allInOnePc = defineObject({
|
||||
},
|
||||
placement: 'top',
|
||||
hasTexture: true,
|
||||
createInstance: async ({ room, scene, options, model }) => {
|
||||
createInstance: async ({ room, scene, options, model, graphicsQuality }) => {
|
||||
const matrix = model.root.getWorldMatrix(true);
|
||||
const scale = new BABYLON.Vector3();
|
||||
matrix.decompose(scale);
|
||||
@@ -55,7 +56,7 @@ export const allInOnePc = defineObject({
|
||||
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(cm(0), cm(30) / Math.abs(scale.y), 0), new BABYLON.Vector3(0, 0, 1), Math.PI / 1, 2, scene, room?.lightContainer != null);
|
||||
light.parent = model.root;
|
||||
light.diffuse = new BABYLON.Color3(1.0, 1.0, 1.0);
|
||||
light.range = cm(100);
|
||||
light.range = cm(100) * getLightRangeFactorByGraphicsQuality(graphicsQuality);
|
||||
light.radius = cm(20);
|
||||
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../object.js';
|
||||
import { cm, WORLD_SCALE } from '../../utility.js';
|
||||
import { getLightRangeFactorByGraphicsQuality } from '../utility.js';
|
||||
|
||||
export const beamLamp = defineObject({
|
||||
id: 'beamLamp',
|
||||
@@ -17,14 +18,14 @@ export const beamLamp = defineObject({
|
||||
placement: 'top',
|
||||
hasCollisions: false,
|
||||
canPreMeshesMerging: true,
|
||||
createInstance: ({ room, root, scene }) => {
|
||||
createInstance: ({ room, root, scene, graphicsQuality }) => {
|
||||
return {
|
||||
onInited: () => {
|
||||
const light = new BABYLON.PointLight('beamLampLight', new BABYLON.Vector3(0, cm(10), 0), scene, room?.lightContainer != null);
|
||||
light.parent = root;
|
||||
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
|
||||
light.intensity = 0.03 * WORLD_SCALE * WORLD_SCALE;
|
||||
light.range = cm(100);
|
||||
light.range = cm(100) * getLightRangeFactorByGraphicsQuality(graphicsQuality);
|
||||
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
||||
},
|
||||
interactions: {},
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../object.js';
|
||||
import { cm, WORLD_SCALE } from '../../utility.js';
|
||||
import { getLightRangeFactorByGraphicsQuality } from '../utility.js';
|
||||
|
||||
export const desktopPc = defineObject({
|
||||
id: 'desktopPc',
|
||||
@@ -49,17 +50,17 @@ export const desktopPc = defineObject({
|
||||
placement: 'top',
|
||||
hasCollisions: true,
|
||||
canPreMeshesMerging: true,
|
||||
createInstance: ({ options, model, root, scene, room }) => {
|
||||
createInstance: ({ options, model, root, scene, room, graphicsQuality }) => {
|
||||
const light1 = new BABYLON.SpotLight('', new BABYLON.Vector3(0, cm(10), cm(22)), new BABYLON.Vector3(0, 0, 1), Math.PI / 1, 2, scene, room?.lightContainer != null);
|
||||
light1.parent = root;
|
||||
light1.intensity = 0.05 * WORLD_SCALE * WORLD_SCALE;
|
||||
light1.range = cm(30);
|
||||
light1.range = cm(30) * getLightRangeFactorByGraphicsQuality(graphicsQuality);
|
||||
if (room?.lightContainer != null) room.lightContainer.addLight(light1);
|
||||
|
||||
const light2 = new BABYLON.SpotLight('', new BABYLON.Vector3(cm(-5), cm(33), cm(-9)), new BABYLON.Vector3(1, 0, 0), Math.PI / 1, 2, scene, room?.lightContainer != null);
|
||||
light2.parent = root;
|
||||
light2.intensity = 0.05 * WORLD_SCALE * WORLD_SCALE;
|
||||
light2.range = cm(30);
|
||||
light2.range = cm(30) * getLightRangeFactorByGraphicsQuality(graphicsQuality);
|
||||
if (room?.lightContainer != null) room.lightContainer.addLight(light2);
|
||||
|
||||
const bodyMaterial = model.findMaterial('__X_BODY__');
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../object.js';
|
||||
import { getLightRangeFactorByGraphicsQuality } from '../utility.js';
|
||||
import { cm, remap, WORLD_SCALE } from '@/world/utility.js';
|
||||
|
||||
export const ductRailSpotLights = defineObject({
|
||||
@@ -52,7 +53,7 @@ export const ductRailSpotLights = defineObject({
|
||||
},
|
||||
placement: 'ceiling',
|
||||
hasCollisions: false,
|
||||
createInstance: ({ room, scene, options, model }) => {
|
||||
createInstance: ({ room, scene, options, model, graphicsQuality }) => {
|
||||
const bodyMaterial = model.findMaterial('__X_BODY__');
|
||||
|
||||
const applyBodyColor = () => {
|
||||
@@ -88,7 +89,7 @@ export const ductRailSpotLights = defineObject({
|
||||
const applyLightBrightness = () => {
|
||||
for (const light of lights) {
|
||||
light.intensity = 2 * options.lightBrightness * WORLD_SCALE * WORLD_SCALE;
|
||||
light.range = cm(300);
|
||||
light.range = cm(300) * getLightRangeFactorByGraphicsQuality(graphicsQuality);
|
||||
}
|
||||
for (const lamp of lamps) {
|
||||
const emissive = lamp.material as BABYLON.PBRMaterial;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../object.js';
|
||||
import { cm, WORLD_SCALE, createPlaneUvMapper } from '../../utility.js';
|
||||
import { getLightRangeFactorByGraphicsQuality } from '../utility.js';
|
||||
|
||||
export const laptopPc = defineObject({
|
||||
id: 'laptopPc',
|
||||
@@ -56,7 +57,7 @@ export const laptopPc = defineObject({
|
||||
placement: 'top',
|
||||
hasCollisions: false,
|
||||
hasTexture: true,
|
||||
createInstance: async ({ room, scene, options, model }) => {
|
||||
createInstance: async ({ room, scene, options, model, graphicsQuality }) => {
|
||||
const matrix = model.root.getWorldMatrix(true);
|
||||
const scale = new BABYLON.Vector3();
|
||||
matrix.decompose(scale);
|
||||
@@ -67,7 +68,7 @@ export const laptopPc = defineObject({
|
||||
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(cm(0), cm(10) / Math.abs(scale.y), 0), new BABYLON.Vector3(0, 0, 1), Math.PI / 1, 2, scene, room?.lightContainer != null);
|
||||
light.parent = hutaNode;
|
||||
light.diffuse = new BABYLON.Color3(1.0, 1.0, 1.0);
|
||||
light.range = cm(100);
|
||||
light.range = cm(100) * getLightRangeFactorByGraphicsQuality(graphicsQuality);
|
||||
light.radius = cm(15);
|
||||
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../object.js';
|
||||
import { cm, WORLD_SCALE } from '../../utility.js';
|
||||
import { getLightRangeFactorByGraphicsQuality } from '../utility.js';
|
||||
|
||||
export const lavaLamp = defineObject({
|
||||
id: 'lavaLamp',
|
||||
@@ -38,7 +39,7 @@ export const lavaLamp = defineObject({
|
||||
placement: 'top',
|
||||
hasCollisions: false,
|
||||
canPreMeshesMerging: true,
|
||||
createInstance: ({ options, room, scene, root, model }) => {
|
||||
createInstance: ({ options, room, scene, root, model, graphicsQuality }) => {
|
||||
const bodyMaterial = model.findMaterial('__X_BODY__');
|
||||
const glassMaterial = model.findMaterial('__X_GLASS__');
|
||||
const lightMaterial = model.findMaterial('__X_LIGHT__');
|
||||
@@ -60,7 +61,8 @@ export const lavaLamp = defineObject({
|
||||
const light = new BABYLON.PointLight('lavaLampLight', new BABYLON.Vector3(0, cm(11), 0), scene, room?.lightContainer != null);
|
||||
light.parent = root;
|
||||
light.intensity = 0.03 * WORLD_SCALE * WORLD_SCALE;
|
||||
light.range = cm(50);
|
||||
light.range = cm(50) * getLightRangeFactorByGraphicsQuality(graphicsQuality);
|
||||
light.radius = cm(5);
|
||||
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
||||
|
||||
const applyLightColor = () => {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../object.js';
|
||||
import { cm, WORLD_SCALE, createPlaneUvMapper, normalizeUvToSquare } from '../../utility.js';
|
||||
import { getLightRangeFactorByGraphicsQuality } from '../utility.js';
|
||||
|
||||
export const monitor = defineObject({
|
||||
id: 'monitor',
|
||||
@@ -42,7 +43,7 @@ export const monitor = defineObject({
|
||||
},
|
||||
placement: 'top',
|
||||
hasTexture: true,
|
||||
createInstance: async ({ room, scene, options, model }) => {
|
||||
createInstance: async ({ room, scene, options, model, graphicsQuality }) => {
|
||||
const matrix = model.root.getWorldMatrix(true);
|
||||
const scale = new BABYLON.Vector3();
|
||||
matrix.decompose(scale);
|
||||
@@ -50,7 +51,7 @@ export const monitor = defineObject({
|
||||
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(cm(0), cm(20) / Math.abs(scale.y), 0), new BABYLON.Vector3(0, 0, 1), Math.PI / 1, 2, scene, room?.lightContainer != null);
|
||||
light.parent = model.root;
|
||||
light.diffuse = new BABYLON.Color3(1.0, 1.0, 1.0);
|
||||
light.range = cm(100);
|
||||
light.range = cm(100) * getLightRangeFactorByGraphicsQuality(graphicsQuality);
|
||||
light.radius = cm(20);
|
||||
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../object.js';
|
||||
import { initTv } from '../utility.js';
|
||||
import { getLightRangeFactorByGraphicsQuality, initTv } from '../utility.js';
|
||||
import { cm, WORLD_SCALE } from '@/world/utility.js';
|
||||
|
||||
export const tv = defineObject({
|
||||
@@ -33,7 +33,7 @@ export const tv = defineObject({
|
||||
placement: 'top',
|
||||
hasCollisions: true,
|
||||
hasTexture: true,
|
||||
createInstance: ({ options, room, model, scene, timer }) => {
|
||||
createInstance: ({ options, room, model, scene, timer, graphicsQuality }) => {
|
||||
const matrix = model.root.getWorldMatrix(true);
|
||||
const scale = new BABYLON.Vector3();
|
||||
matrix.decompose(scale);
|
||||
@@ -41,7 +41,7 @@ export const tv = defineObject({
|
||||
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(cm(0), cm(30) / Math.abs(scale.y), 0), new BABYLON.Vector3(0, 0, 1), Math.PI / 1, 2, scene, room?.lightContainer != null);
|
||||
light.parent = model.root;
|
||||
light.diffuse = new BABYLON.Color3(1.0, 1.0, 1.0);
|
||||
light.range = cm(200);
|
||||
light.range = cm(200) * getLightRangeFactorByGraphicsQuality(graphicsQuality);
|
||||
light.radius = cm(40);
|
||||
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../object.js';
|
||||
import { getLightRangeFactorByGraphicsQuality } from '../utility.js';
|
||||
import { cm, WORLD_SCALE } from '@/world/utility.js';
|
||||
|
||||
export const wallMountSpotLight = defineObject({
|
||||
@@ -54,7 +55,7 @@ export const wallMountSpotLight = defineObject({
|
||||
hasCollisions: false,
|
||||
canPreMeshesMerging: false,
|
||||
hasTexture: false,
|
||||
createInstance: ({ room, scene, options, model }) => {
|
||||
createInstance: ({ room, scene, options, model, graphicsQuality }) => {
|
||||
const bodyMesh = model.findMesh('__X_BODY__');
|
||||
const bodyMaterial = model.findMaterial('__X_BODY__');
|
||||
|
||||
@@ -82,7 +83,7 @@ export const wallMountSpotLight = defineObject({
|
||||
|
||||
const applyLightBrightness = () => {
|
||||
light.intensity = 1 * options.lightBrightness * WORLD_SCALE * WORLD_SCALE;
|
||||
light.range = cm(200);
|
||||
light.range = cm(200) * getLightRangeFactorByGraphicsQuality(graphicsQuality);
|
||||
const emissive = lamp.material as BABYLON.PBRMaterial;
|
||||
emissive.emissiveIntensity = options.lightBrightness * 20;
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../object.js';
|
||||
import { getLightRangeFactorByGraphicsQuality } from '../utility.js';
|
||||
import { cm, WORLD_SCALE } from '@/world/utility.js';
|
||||
|
||||
export const woodRingFloorLamp = defineObject({
|
||||
@@ -41,7 +42,7 @@ export const woodRingFloorLamp = defineObject({
|
||||
},
|
||||
placement: 'floor',
|
||||
hasCollisions: true,
|
||||
createInstance: ({ room, scene, options, model }) => {
|
||||
createInstance: ({ room, scene, options, model, graphicsQuality }) => {
|
||||
const shadeMaterial = model.findMaterial('__X_SHADE__');
|
||||
|
||||
const applyShadeColor = () => {
|
||||
@@ -86,7 +87,7 @@ export const woodRingFloorLamp = defineObject({
|
||||
const applyLightBrightness = () => {
|
||||
for (const light of lights) {
|
||||
light.intensity = 1 * options.lightBrightness * WORLD_SCALE * WORLD_SCALE;
|
||||
light.range = cm(200);
|
||||
light.range = cm(200) * getLightRangeFactorByGraphicsQuality(graphicsQuality);
|
||||
}
|
||||
for (const lamp of lamps) {
|
||||
const emissive = lamp.material as BABYLON.PBRMaterial;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../object.js';
|
||||
import { getLightRangeFactorByGraphicsQuality } from '../utility.js';
|
||||
import { cm, WORLD_SCALE } from '@/world/utility.js';
|
||||
|
||||
const remap = (value: number, fromMin: number, fromMax: number, toMin: number, toMax: number) => {
|
||||
@@ -53,7 +54,7 @@ export const woodRingsPendantLight = defineObject({
|
||||
},
|
||||
placement: 'ceiling',
|
||||
hasCollisions: false,
|
||||
createInstance: ({ room, scene, options, model }) => {
|
||||
createInstance: ({ room, scene, options, model, graphicsQuality }) => {
|
||||
const shadeMaterial = model.findMaterial('__X_SHADE__');
|
||||
|
||||
const applyShadeColor = () => {
|
||||
@@ -96,7 +97,7 @@ export const woodRingsPendantLight = defineObject({
|
||||
|
||||
const applyLightBrightness = () => {
|
||||
light.intensity = 1 * options.lightBrightness * WORLD_SCALE * WORLD_SCALE;
|
||||
light.range = cm(200) * options.lightBrightness;
|
||||
light.range = cm(200) * getLightRangeFactorByGraphicsQuality(graphicsQuality);
|
||||
const emissive = lamp.material as BABYLON.PBRMaterial;
|
||||
emissive.emissiveIntensity = options.lightBrightness * 10;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user