mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-03-21 03:30:42 +00:00
wip
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -3,19 +3,55 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../engine.js';
|
||||
|
||||
export const chair = defineObject({
|
||||
id: 'chair',
|
||||
name: 'Chair',
|
||||
options: {
|
||||
schema: {},
|
||||
default: {},
|
||||
schema: {
|
||||
primaryColor: {
|
||||
type: 'color',
|
||||
label: 'Primay Color',
|
||||
},
|
||||
secondaryColor: {
|
||||
type: 'color',
|
||||
label: 'Secondary Color',
|
||||
},
|
||||
},
|
||||
default: {
|
||||
primaryColor: [0.44, 0.6, 0],
|
||||
secondaryColor: [0, 0, 0],
|
||||
},
|
||||
},
|
||||
placement: 'floor',
|
||||
isChair: true,
|
||||
createInstance: () => {
|
||||
createInstance: ({ root, options }) => {
|
||||
const primaryMesh = root.getChildMeshes().find(m => m.name.includes('__X_PRIMARY__')) as BABYLON.Mesh;
|
||||
const primaryMaterial = primaryMesh.material as BABYLON.PBRMaterial;
|
||||
|
||||
const secondaryMesh = root.getChildMeshes().find(m => m.name.includes('__X_SECONDARY__')) as BABYLON.Mesh;
|
||||
const secondaryMaterial = secondaryMesh.material as BABYLON.PBRMaterial;
|
||||
|
||||
const applyPrimaryColor = () => {
|
||||
const [r, g, b] = options.primaryColor;
|
||||
primaryMaterial.albedoColor = new BABYLON.Color3(r, g, b);
|
||||
};
|
||||
|
||||
const applySecondaryColor = () => {
|
||||
const [r, g, b] = options.secondaryColor;
|
||||
secondaryMaterial.albedoColor = new BABYLON.Color3(r, g, b);
|
||||
};
|
||||
|
||||
applyPrimaryColor();
|
||||
applySecondaryColor();
|
||||
|
||||
return {
|
||||
onOptionsUpdated: ([k, v]) => {
|
||||
applyPrimaryColor();
|
||||
applySecondaryColor();
|
||||
},
|
||||
interactions: {},
|
||||
};
|
||||
},
|
||||
|
||||
@@ -67,10 +67,10 @@ export const tabletopDigitalClock = defineObject({
|
||||
|
||||
const colonMeshes = root.getChildMeshes().filter(m => m.name.includes('__TIME_7SEG_COLON__'));
|
||||
|
||||
const applyBodyColor = () => {
|
||||
const bodyMesh = root.getChildMeshes().find(m => m.name.includes('__X_BODY__')) as BABYLON.Mesh;
|
||||
const bodyMaterial = bodyMesh.material as BABYLON.PBRMaterial;
|
||||
const bodyMesh = root.getChildMeshes().find(m => m.name.includes('__X_BODY__')) as BABYLON.Mesh;
|
||||
const bodyMaterial = bodyMesh.material as BABYLON.PBRMaterial;
|
||||
|
||||
const applyBodyColor = () => {
|
||||
if (options.bodyStyle === 'color') {
|
||||
const [r, g, b] = options.bodyColor;
|
||||
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
|
||||
|
||||
Reference in New Issue
Block a user