mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-25 08:34:13 +02:00
wip
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -10,14 +10,30 @@ export const ceilingFanLight = defineObject({
|
|||||||
id: 'ceilingFanLight',
|
id: 'ceilingFanLight',
|
||||||
name: 'Ceiling Fan Light',
|
name: 'Ceiling Fan Light',
|
||||||
options: {
|
options: {
|
||||||
schema: {},
|
schema: {
|
||||||
default: {},
|
shadeColor: {
|
||||||
|
type: 'color',
|
||||||
|
label: 'Shade color',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: {
|
||||||
|
shadeColor: [0.8, 0.19, 0],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
placement: 'ceiling',
|
placement: 'ceiling',
|
||||||
hasCollisions: false,
|
hasCollisions: false,
|
||||||
receiveShadows: false,
|
receiveShadows: false,
|
||||||
castShadows: false,
|
castShadows: false,
|
||||||
createInstance: ({ room, scene, model }) => {
|
createInstance: ({ options, room, scene, model }) => {
|
||||||
|
const shadeMaterial = model.findMaterial('__X_SHADE__');
|
||||||
|
|
||||||
|
const applyShadeColor = () => {
|
||||||
|
const [r, g, b] = options.shadeColor;
|
||||||
|
shadeMaterial.albedoColor = new BABYLON.Color3(r, g, b);
|
||||||
|
};
|
||||||
|
|
||||||
|
applyShadeColor();
|
||||||
|
|
||||||
const rotor = model.findMesh('Rotor');
|
const rotor = model.findMesh('Rotor');
|
||||||
model.bakeExcludeMeshes = [rotor, ...rotor.getChildMeshes()];
|
model.bakeExcludeMeshes = [rotor, ...rotor.getChildMeshes()];
|
||||||
|
|
||||||
@@ -37,6 +53,11 @@ export const ceilingFanLight = defineObject({
|
|||||||
});
|
});
|
||||||
scene.beginAnimation(rotor, 0, 100, true);
|
scene.beginAnimation(rotor, 0, 100, true);
|
||||||
},
|
},
|
||||||
|
onOptionsUpdated: ([k, v]) => {
|
||||||
|
switch (k) {
|
||||||
|
case 'shadeColor': applyShadeColor(); break;
|
||||||
|
}
|
||||||
|
},
|
||||||
interactions: {},
|
interactions: {},
|
||||||
dispose: () => {
|
dispose: () => {
|
||||||
if (animationObserver != null) {
|
if (animationObserver != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user