mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-23 14:34:19 +02:00
wip
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import * as BABYLON from '@babylonjs/core';
|
import * as BABYLON from '@babylonjs/core';
|
||||||
import { defineObject } from '../engine.js';
|
import { defineObject, WORLD_SCALE } from '../engine.js';
|
||||||
import { createPlaneUvMapper } from '../utility.js';
|
import { createPlaneUvMapper } from '../utility.js';
|
||||||
|
|
||||||
export const allInOnePc = defineObject({
|
export const allInOnePc = defineObject({
|
||||||
@@ -46,7 +46,13 @@ export const allInOnePc = defineObject({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
placement: 'top',
|
placement: 'top',
|
||||||
createInstance: async ({ scene, options, model }) => {
|
createInstance: async ({ room, scene, options, model }) => {
|
||||||
|
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(0/*cm*/, 30/*cm*/ / WORLD_SCALE, 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 = 999/*cm*/;
|
||||||
|
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
||||||
|
|
||||||
const screenMesh = model.findMesh('__X_SCREEN__');
|
const screenMesh = model.findMesh('__X_SCREEN__');
|
||||||
|
|
||||||
const bodyMaterial = model.findMaterial('__X_BODY__');
|
const bodyMaterial = model.findMaterial('__X_BODY__');
|
||||||
@@ -96,6 +102,7 @@ export const allInOnePc = defineObject({
|
|||||||
const applyScreenBrightness = () => {
|
const applyScreenBrightness = () => {
|
||||||
const b = options.screenBrightness;
|
const b = options.screenBrightness;
|
||||||
screenMaterial.emissiveColor = new BABYLON.Color3(b, b, b);
|
screenMaterial.emissiveColor = new BABYLON.Color3(b, b, b);
|
||||||
|
light.intensity = 50000 * b;
|
||||||
};
|
};
|
||||||
|
|
||||||
applyScreenBrightness();
|
applyScreenBrightness();
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export const beamLamp = defineObject({
|
|||||||
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 = 999/*cm*/;
|
||||||
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
||||||
},
|
},
|
||||||
interactions: {},
|
interactions: {},
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import * as BABYLON from '@babylonjs/core';
|
import * as BABYLON from '@babylonjs/core';
|
||||||
import { defineObject } from '../engine.js';
|
import { defineObject, WORLD_SCALE } from '../engine.js';
|
||||||
import { createPlaneUvMapper } from '../utility.js';
|
import { createPlaneUvMapper } from '../utility.js';
|
||||||
|
|
||||||
export const laptopPc = defineObject({
|
export const laptopPc = defineObject({
|
||||||
@@ -54,10 +54,16 @@ export const laptopPc = defineObject({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
placement: 'top',
|
placement: 'top',
|
||||||
createInstance: async ({ scene, options, model }) => {
|
createInstance: async ({ room, scene, options, model }) => {
|
||||||
const screenMesh = model.findMesh('__X_SCREEN__');
|
const screenMesh = model.findMesh('__X_SCREEN__');
|
||||||
const hutaNode = model.findTransformNode('__X_HUTA__');
|
const hutaNode = model.findTransformNode('__X_HUTA__');
|
||||||
|
|
||||||
|
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(0/*cm*/, 10/*cm*/ / WORLD_SCALE, 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 = 999/*cm*/;
|
||||||
|
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
||||||
|
|
||||||
const bodyMaterial = model.findMaterial('__X_BODY__');
|
const bodyMaterial = model.findMaterial('__X_BODY__');
|
||||||
const bezelMaterial = model.findMaterial('__X_BEZEL__');
|
const bezelMaterial = model.findMaterial('__X_BEZEL__');
|
||||||
const screenMaterial = model.findMaterial('__X_SCREEN__');
|
const screenMaterial = model.findMaterial('__X_SCREEN__');
|
||||||
@@ -105,6 +111,7 @@ export const laptopPc = defineObject({
|
|||||||
const applyScreenBrightness = () => {
|
const applyScreenBrightness = () => {
|
||||||
const b = options.screenBrightness;
|
const b = options.screenBrightness;
|
||||||
screenMaterial.emissiveColor = new BABYLON.Color3(b, b, b);
|
screenMaterial.emissiveColor = new BABYLON.Color3(b, b, b);
|
||||||
|
light.intensity = 20000 * b;
|
||||||
};
|
};
|
||||||
|
|
||||||
applyScreenBrightness();
|
applyScreenBrightness();
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export const lavaLamp = defineObject({
|
|||||||
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 = 999/*cm*/;
|
||||||
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
||||||
|
|
||||||
const sphere = BABYLON.MeshBuilder.CreateSphere('lavaLampLightSphere', { diameter: 4/*cm*/ }, scene);
|
const sphere = BABYLON.MeshBuilder.CreateSphere('lavaLampLightSphere', { diameter: 4/*cm*/ }, scene);
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export const woodRingFloorLamp = defineObject({
|
|||||||
light.parent = lamp;
|
light.parent = lamp;
|
||||||
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
|
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
|
||||||
light.intensity = 5000;
|
light.intensity = 5000;
|
||||||
light.range = 150/*cm*/;
|
light.range = 999/*cm*/;
|
||||||
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user