1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-06-11 12:24:11 +02:00
This commit is contained in:
syuilo
2026-02-22 18:23:32 +09:00
parent cdb8d86fbf
commit ec82773ff7
12 changed files with 74 additions and 15 deletions

View File

@@ -6,9 +6,9 @@
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../engine.js';
export const aromaReadDiffuser = defineObject({
id: 'aromaReadDiffuser',
name: 'Aroma Read Diffuser',
export const aromaReedDiffuser = defineObject({
id: 'aromaReedDiffuser',
name: 'Aroma Reed Diffuser',
options: {
schema: {
bottleColor: {

View File

@@ -0,0 +1,42 @@
/*
* 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 monitorSpeaker = defineObject({
id: 'monitorSpeaker',
name: 'Monitor Speaker',
options: {
schema: {
color: {
type: 'color',
label: 'Color',
},
},
default: {
color: [0, 0, 0],
},
},
placement: 'top',
createInstance: ({ options, root }) => {
const bodyMesh = root.getChildMeshes().find(m => m.name.includes('__X_BODY__')) as BABYLON.Mesh;
const bodyMaterial = bodyMesh.material as BABYLON.PBRMaterial;
const applyColor = () => {
const [r, g, b] = options.color;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
};
applyColor();
return {
onOptionsUpdated: ([k, v]) => {
applyColor();
},
interactions: {},
};
},
});

View File

@@ -11,30 +11,45 @@ export const speaker = defineObject({
name: 'Speaker',
options: {
schema: {
color: {
outerColor: {
type: 'color',
label: 'Color',
label: 'Outer Color',
},
innerColor: {
type: 'color',
label: 'Inner Color',
},
},
default: {
color: [0, 0, 0],
outerColor: [0.45, 0.8, 0],
innerColor: [0, 0, 0],
},
},
placement: 'top',
createInstance: ({ options, root }) => {
const bodyMesh = root.getChildMeshes().find(m => m.name.includes('__X_BODY__')) as BABYLON.Mesh;
const bodyMaterial = bodyMesh.material as BABYLON.PBRMaterial;
const outerMesh = root.getChildMeshes().find(m => m.name.includes('__X_COVER__')) as BABYLON.Mesh;
const outerMaterial = outerMesh.material as BABYLON.PBRMaterial;
const applyColor = () => {
const [r, g, b] = options.color;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const innerMesh = root.getChildMeshes().find(m => m.name.includes('__X_BODY__')) as BABYLON.Mesh;
const innerMaterial = innerMesh.material as BABYLON.PBRMaterial;
const applyOuterColor = () => {
const [r, g, b] = options.outerColor;
outerMaterial.albedoColor = new BABYLON.Color3(r, g, b);
};
applyColor();
const applyInnerColor = () => {
const [r, g, b] = options.innerColor;
innerMaterial.albedoColor = new BABYLON.Color3(r, g, b);
};
applyOuterColor();
applyInnerColor();
return {
onOptionsUpdated: ([k, v]) => {
applyColor();
applyOuterColor();
applyInnerColor();
},
interactions: {},
};