1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-13 15:15:45 +02:00
This commit is contained in:
syuilo
2026-04-05 13:07:30 +09:00
parent ca49618fdb
commit 93f62f6054
4 changed files with 87 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ import { colorBox } from './objects/colorBox.js';
import { cupNoodle } from './objects/cupNoodle.js';
import { debugHipoly } from './objects/debugHipoly.js';
import { desk } from './objects/desk.js';
import { desktopPc } from './objects/desktopPc.js';
import { ductTape } from './objects/ductTape.js';
import { emptyBento } from './objects/emptyBento.js';
import { energyDrink } from './objects/energyDrink.js';
@@ -83,6 +84,7 @@ export const OBJECT_DEFS = [
colorBox,
cupNoodle,
desk,
desktopPc,
ductTape,
emptyBento,
energyDrink,

View File

@@ -0,0 +1,85 @@
/*
* 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 desktopPc = defineObject({
id: 'desktopPc',
name: 'Desktop PC',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'Body color',
},
coverColor: {
type: 'color',
label: 'Cover color',
},
innerColor: {
type: 'color',
label: 'Inner color',
},
ledColor: {
type: 'color',
label: 'LED color',
},
},
default: {
bodyColor: [0.05, 0.05, 0.05],
coverColor: [0.5, 0.9, 0],
innerColor: [1, 1, 1],
ledColor: [0.5, 0.9, 0],
},
},
placement: 'top',
createInstance: ({ options, model }) => {
const bodyMaterial = model.findMaterial('__X_BODY__');
const coverMaterial = model.findMaterial('__X_COVER__');
const innerMaterial = model.findMaterial('__X_INNER__');
const ledMaterial = model.findMaterial('__X_LED__');
ledMaterial.emissiveIntensity = 10;
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
};
applyBodyColor();
const applyCoverColor = () => {
const [r, g, b] = options.coverColor;
coverMaterial.albedoColor = new BABYLON.Color3(r, g, b);
};
applyCoverColor();
const applyInnerColor = () => {
const [r, g, b] = options.innerColor;
innerMaterial.albedoColor = new BABYLON.Color3(r, g, b);
};
applyInnerColor();
const applyLedColor = () => {
const [r, g, b] = options.ledColor;
ledMaterial.emissiveColor = new BABYLON.Color3(r, g, b);
};
applyLedColor();
return {
onOptionsUpdated: ([k, v]) => {
applyBodyColor();
applyCoverColor();
applyInnerColor();
applyLedColor();
},
interactions: {},
};
},
});