mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-20 23:25:28 +02:00
wip
This commit is contained in:
65
packages/frontend/src/utility/room/objects/allInOnePc.ts
Normal file
65
packages/frontend/src/utility/room/objects/allInOnePc.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../engine.js';
|
||||
|
||||
export const allInOnePc = defineObject({
|
||||
id: 'allInOnePc',
|
||||
name: 'All-in-One PC',
|
||||
options: {
|
||||
schema: {
|
||||
bodyColor: {
|
||||
type: 'color',
|
||||
label: 'Body color',
|
||||
},
|
||||
bezelColor: {
|
||||
type: 'color',
|
||||
label: 'Bezel color',
|
||||
},
|
||||
},
|
||||
default: {
|
||||
bodyColor: [1, 1, 1],
|
||||
bezelColor: [0, 0, 0],
|
||||
},
|
||||
},
|
||||
placement: 'top',
|
||||
createInstance: ({ room, options, findMaterial }) => {
|
||||
const bodyMaterial = findMaterial('__X_BODY__');
|
||||
const bezelMaterial = findMaterial('__X_BEZEL__');
|
||||
const screenMaterial = findMaterial('__X_SCREEN__');
|
||||
|
||||
const tex = new BABYLON.Texture('http://syu-win.local:3000/files/b6cefaba-3093-4c57-a7f8-993dee62c6f7', room.scene, false, false);
|
||||
|
||||
screenMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0);
|
||||
screenMaterial.ambientColor = new BABYLON.Color3(0, 0, 0);
|
||||
screenMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
|
||||
screenMaterial.albedoColor = new BABYLON.Color3(0, 0, 0);
|
||||
screenMaterial.emissiveTexture = tex;
|
||||
screenMaterial.emissiveColor = new BABYLON.Color3(0.4, 0.4, 0.4);
|
||||
screenMaterial.emissiveTexture.level = 0.5;
|
||||
|
||||
const applyBodyColor = () => {
|
||||
const [r, g, b] = options.bodyColor;
|
||||
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
|
||||
};
|
||||
|
||||
const applyBezelColor = () => {
|
||||
const [r, g, b] = options.bezelColor;
|
||||
bezelMaterial.albedoColor = new BABYLON.Color3(r, g, b);
|
||||
};
|
||||
|
||||
applyBodyColor();
|
||||
applyBezelColor();
|
||||
|
||||
return {
|
||||
onOptionsUpdated: ([k, v]) => {
|
||||
applyBodyColor();
|
||||
applyBezelColor();
|
||||
},
|
||||
interactions: {},
|
||||
};
|
||||
},
|
||||
});
|
||||
@@ -3,18 +3,38 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../engine.js';
|
||||
|
||||
export const desk = defineObject({
|
||||
id: 'desk',
|
||||
name: 'Desk',
|
||||
options: {
|
||||
schema: {},
|
||||
default: {},
|
||||
schema: {
|
||||
topColor: {
|
||||
type: 'color',
|
||||
label: 'Top color',
|
||||
},
|
||||
},
|
||||
default: {
|
||||
topColor: [0, 0, 0],
|
||||
},
|
||||
},
|
||||
placement: 'floor',
|
||||
createInstance: () => {
|
||||
createInstance: ({ options, findMaterial }) => {
|
||||
const topMaterial = findMaterial('__X_BODY__');
|
||||
|
||||
const applyTopColor = () => {
|
||||
const [r, g, b] = options.topColor;
|
||||
topMaterial.albedoColor = new BABYLON.Color3(r, g, b);
|
||||
};
|
||||
|
||||
applyTopColor();
|
||||
|
||||
return {
|
||||
onOptionsUpdated: ([k, v]) => {
|
||||
applyTopColor();
|
||||
},
|
||||
interactions: {},
|
||||
};
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user