mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-22 19:54:03 +02:00
tabletopIronFrameStand
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -73,6 +73,7 @@ import { tabletopCalendar } from './objects/tabletopCalendar.js';
|
|||||||
import { tabletopDigitalClock } from './objects/tabletopDigitalClock.js';
|
import { tabletopDigitalClock } from './objects/tabletopDigitalClock.js';
|
||||||
import { tabletopFlag } from './objects/tabletopFlag.js';
|
import { tabletopFlag } from './objects/tabletopFlag.js';
|
||||||
import { tabletopGlassPictureFrame } from './objects/tabletopGlassPictureFrame.js';
|
import { tabletopGlassPictureFrame } from './objects/tabletopGlassPictureFrame.js';
|
||||||
|
import { tabletopIronFrameStand } from './objects/tabletopIronFrameStand.js';
|
||||||
import { tabletopPictureFrame } from './objects/tabletopPictureFrame.js';
|
import { tabletopPictureFrame } from './objects/tabletopPictureFrame.js';
|
||||||
import { tapestry } from './objects/tapestry.js';
|
import { tapestry } from './objects/tapestry.js';
|
||||||
import { tetrapod } from './objects/tetrapod.js';
|
import { tetrapod } from './objects/tetrapod.js';
|
||||||
@@ -160,6 +161,7 @@ export const OBJECT_DEFS = [
|
|||||||
tabletopDigitalClock,
|
tabletopDigitalClock,
|
||||||
tabletopFlag,
|
tabletopFlag,
|
||||||
tabletopGlassPictureFrame,
|
tabletopGlassPictureFrame,
|
||||||
|
tabletopIronFrameStand,
|
||||||
tabletopPictureFrame,
|
tabletopPictureFrame,
|
||||||
tapestry,
|
tapestry,
|
||||||
tetrapod,
|
tetrapod,
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ export const desk = defineObject({
|
|||||||
case 'frameColor': applyFrameColor(); break;
|
case 'frameColor': applyFrameColor(); break;
|
||||||
case 'boardColor': applyBoardColor(); break;
|
case 'boardColor': applyBoardColor(); break;
|
||||||
case 'width': applySize(); break;
|
case 'width': applySize(); break;
|
||||||
|
case 'depth': applySize(); break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
interactions: {},
|
interactions: {},
|
||||||
|
|||||||
@@ -0,0 +1,101 @@
|
|||||||
|
/*
|
||||||
|
* 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 tabletopIronFrameStand = defineObject({
|
||||||
|
id: 'tabletopIronFrameStand',
|
||||||
|
name: 'tabletopIronFrameStand',
|
||||||
|
options: {
|
||||||
|
schema: {
|
||||||
|
frameColor: {
|
||||||
|
type: 'color',
|
||||||
|
label: 'Frame color',
|
||||||
|
},
|
||||||
|
boardColor: {
|
||||||
|
type: 'color',
|
||||||
|
label: 'Board color',
|
||||||
|
},
|
||||||
|
width: {
|
||||||
|
type: 'range',
|
||||||
|
label: 'Width',
|
||||||
|
min: 0,
|
||||||
|
max: 1,
|
||||||
|
step: 0.01,
|
||||||
|
},
|
||||||
|
depth: {
|
||||||
|
type: 'range',
|
||||||
|
label: 'Depth',
|
||||||
|
min: 0,
|
||||||
|
max: 1,
|
||||||
|
step: 0.01,
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: 'range',
|
||||||
|
label: 'Height',
|
||||||
|
min: 0,
|
||||||
|
max: 1,
|
||||||
|
step: 0.01,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: {
|
||||||
|
frameColor: [0.8, 0.8, 0.8],
|
||||||
|
boardColor: [0.8, 0.4, 0.1],
|
||||||
|
width: 0.2,
|
||||||
|
depth: 0.1,
|
||||||
|
height: 0.1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
placement: 'top',
|
||||||
|
createInstance: ({ options, model }) => {
|
||||||
|
const frameMaterial = model.findMaterial('__X_FRAME__');
|
||||||
|
const boardMaterial = model.findMaterial('__X_BOARD__');
|
||||||
|
|
||||||
|
const applyFrameColor = () => {
|
||||||
|
const [r, g, b] = options.frameColor;
|
||||||
|
frameMaterial.albedoColor = new BABYLON.Color3(r, g, b);
|
||||||
|
};
|
||||||
|
|
||||||
|
applyFrameColor();
|
||||||
|
|
||||||
|
const applyBoardColor = () => {
|
||||||
|
const [r, g, b] = options.boardColor;
|
||||||
|
boardMaterial.albedoColor = new BABYLON.Color3(r, g, b);
|
||||||
|
};
|
||||||
|
|
||||||
|
applyBoardColor();
|
||||||
|
|
||||||
|
const applySize = () => {
|
||||||
|
for (const mesh of model.root.getChildMeshes()) {
|
||||||
|
if (mesh.morphTargetManager != null && mesh.morphTargetManager.getTargetByName('W') != null) {
|
||||||
|
mesh.morphTargetManager.getTargetByName('W').influence = options.width;
|
||||||
|
}
|
||||||
|
if (mesh.morphTargetManager != null && mesh.morphTargetManager.getTargetByName('D') != null) {
|
||||||
|
mesh.morphTargetManager.getTargetByName('D').influence = options.depth;
|
||||||
|
}
|
||||||
|
if (mesh.morphTargetManager != null && mesh.morphTargetManager.getTargetByName('H') != null) {
|
||||||
|
mesh.morphTargetManager.getTargetByName('H').influence = options.height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
model.updated();
|
||||||
|
};
|
||||||
|
|
||||||
|
applySize();
|
||||||
|
|
||||||
|
return {
|
||||||
|
onOptionsUpdated: ([k, v]) => {
|
||||||
|
switch (k) {
|
||||||
|
case 'frameColor': applyFrameColor(); break;
|
||||||
|
case 'boardColor': applyBoardColor(); break;
|
||||||
|
case 'width': applySize(); break;
|
||||||
|
case 'depth': applySize(); break;
|
||||||
|
case 'height': applySize(); break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
interactions: {},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user