mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-14 04:05:34 +02:00
wip
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -17,10 +17,10 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@analytics/google-analytics": "1.1.0",
|
||||
"@babylonjs/core": "9.5.0",
|
||||
"@babylonjs/inspector": "9.5.0",
|
||||
"@babylonjs/loaders": "9.5.0",
|
||||
"@babylonjs/materials": "9.5.0",
|
||||
"@babylonjs/core": "9.5.1",
|
||||
"@babylonjs/inspector": "9.5.1",
|
||||
"@babylonjs/loaders": "9.5.1",
|
||||
"@babylonjs/materials": "9.5.1",
|
||||
"@discordapp/twemoji": "16.0.1",
|
||||
"@github/webauthn-json": "2.1.1",
|
||||
"@mcaptcha/core-glue": "0.1.0-alpha-5",
|
||||
|
||||
@@ -83,6 +83,7 @@ import { speaker } from './objects/speaker.js';
|
||||
import { speakerStand } from './objects/speakerStand.js';
|
||||
import { spotLight } from './objects/spotLight.js';
|
||||
import { sprayer } from './objects/sprayer.js';
|
||||
import { stanchionPole } from './objects/stanchionPole.js';
|
||||
import { steelRack } from './objects/steelRack.js';
|
||||
import { stormGlass } from './objects/stormGlass.js';
|
||||
import { tableSalt } from './objects/tableSalt.js';
|
||||
@@ -213,6 +214,7 @@ export const OBJECT_DEFS = [
|
||||
spotLight,
|
||||
lowPartitionBar,
|
||||
descriptionPlate,
|
||||
stanchionPole,
|
||||
];
|
||||
|
||||
export function getObjectDef(type: string): typeof OBJECT_DEFS[number] {
|
||||
|
||||
@@ -98,48 +98,52 @@ export const lavaLamp = defineObject({
|
||||
|
||||
let animationObserver: BABYLON.Observer<BABYLON.Scene>;
|
||||
|
||||
const anim = new BABYLON.Animation('lavaLampLightAnim', 'position.y', 60, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
|
||||
anim.setKeys([
|
||||
{ frame: 0, value: cm(11) },
|
||||
{ frame: 800, value: cm(38) },
|
||||
]);
|
||||
sphere.animations = [anim];
|
||||
scene.beginAnimation(sphere, 0, 800, true);
|
||||
sphere2.animations = [anim];
|
||||
scene.beginAnimation(sphere2, 0, 800, true, 0.65);
|
||||
sphere3.animations = [anim];
|
||||
scene.beginAnimation(sphere3, 0, 800, true, 0.6);
|
||||
|
||||
animationObserver = scene.onAfterAnimationsObservable.add(() => {
|
||||
room?.sr.updateMesh([sphere, sphere2, sphere3], false);
|
||||
});
|
||||
|
||||
const emitter = new BABYLON.TransformNode('emitter', scene);
|
||||
emitter.parent = root;
|
||||
emitter.position = new BABYLON.Vector3(0, cm(10), 0);
|
||||
const ps = new BABYLON.ParticleSystem('', 32, scene);
|
||||
ps.particleTexture = new BABYLON.Texture('/client-assets/room/objects/lava-lamp/bubble.png');
|
||||
ps.emitter = emitter;
|
||||
ps.isLocal = true;
|
||||
ps.minEmitBox = new BABYLON.Vector3(cm(-1), 0, cm(-1));
|
||||
ps.maxEmitBox = new BABYLON.Vector3(cm(1), 0, cm(1));
|
||||
ps.minEmitPower = cm(1);
|
||||
ps.maxEmitPower = cm(2.5);
|
||||
ps.minLifeTime = 12;
|
||||
ps.maxLifeTime = 12;
|
||||
ps.minSize = cm(0.25);
|
||||
ps.maxSize = cm(1.25);
|
||||
ps.direction1 = new BABYLON.Vector3(0, 1, 0);
|
||||
ps.direction2 = new BABYLON.Vector3(0, 1, 0);
|
||||
ps.emitRate = 1;
|
||||
ps.blendMode = BABYLON.ParticleSystem.BLENDMODE_ADD;
|
||||
ps.color1 = new BABYLON.Color4(1, 1, 1, 1);
|
||||
ps.color2 = new BABYLON.Color4(1, 1, 1, 0.75);
|
||||
ps.colorDead = new BABYLON.Color4(1, 1, 1, 0);
|
||||
ps.preWarmCycles = 100;
|
||||
ps.start();
|
||||
|
||||
room?.sr.fixParticleSystem(ps);
|
||||
|
||||
return {
|
||||
onInited: () => {
|
||||
const anim = new BABYLON.Animation('lavaLampLightAnim', 'position.y', 60, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
|
||||
anim.setKeys([
|
||||
{ frame: 0, value: cm(11) },
|
||||
{ frame: 800, value: cm(38) },
|
||||
]);
|
||||
sphere.animations = [anim];
|
||||
scene.beginAnimation(sphere, 0, 800, true);
|
||||
sphere2.animations = [anim];
|
||||
scene.beginAnimation(sphere2, 0, 800, true, 0.65);
|
||||
sphere3.animations = [anim];
|
||||
scene.beginAnimation(sphere3, 0, 800, true, 0.6);
|
||||
|
||||
animationObserver = scene.onAfterAnimationsObservable.add(() => {
|
||||
room?.sr.updateMesh([sphere, sphere2, sphere3], false);
|
||||
});
|
||||
|
||||
const emitter = new BABYLON.TransformNode('emitter', scene);
|
||||
emitter.parent = root;
|
||||
emitter.position = new BABYLON.Vector3(0, cm(10), 0);
|
||||
const ps = new BABYLON.ParticleSystem('', 32, scene);
|
||||
ps.particleTexture = new BABYLON.Texture('/client-assets/room/objects/lava-lamp/bubble.png');
|
||||
ps.emitter = emitter;
|
||||
ps.isLocal = true;
|
||||
ps.minEmitBox = new BABYLON.Vector3(cm(-1), 0, cm(-1));
|
||||
ps.maxEmitBox = new BABYLON.Vector3(cm(1), 0, cm(1));
|
||||
ps.minEmitPower = cm(1);
|
||||
ps.maxEmitPower = cm(2.5);
|
||||
ps.minLifeTime = 12;
|
||||
ps.maxLifeTime = 12;
|
||||
ps.minSize = cm(0.25);
|
||||
ps.maxSize = cm(1.25);
|
||||
ps.direction1 = new BABYLON.Vector3(0, 1, 0);
|
||||
ps.direction2 = new BABYLON.Vector3(0, 1, 0);
|
||||
ps.emitRate = 1;
|
||||
ps.blendMode = BABYLON.ParticleSystem.BLENDMODE_ADD;
|
||||
ps.color1 = new BABYLON.Color4(1, 1, 1, 1);
|
||||
ps.color2 = new BABYLON.Color4(1, 1, 1, 0.75);
|
||||
ps.colorDead = new BABYLON.Color4(1, 1, 1, 0);
|
||||
ps.preWarmCycles = 100;
|
||||
ps.start();
|
||||
},
|
||||
interactions: {},
|
||||
onOptionsUpdated: ([k, v]) => {
|
||||
|
||||
@@ -60,6 +60,10 @@ export const pictureFrame = defineObject({
|
||||
max: 1,
|
||||
step: 0.01,
|
||||
},
|
||||
withCover: {
|
||||
type: 'boolean',
|
||||
label: 'With cover',
|
||||
},
|
||||
customPicture: {
|
||||
type: 'image',
|
||||
label: 'Custom picture',
|
||||
@@ -78,6 +82,7 @@ export const pictureFrame = defineObject({
|
||||
depth: 0,
|
||||
matHThickness: 0.35,
|
||||
matVThickness: 0.35,
|
||||
withCover: true,
|
||||
customPicture: null,
|
||||
fit: 'cover',
|
||||
},
|
||||
@@ -160,6 +165,13 @@ export const pictureFrame = defineObject({
|
||||
|
||||
applyDepth();
|
||||
|
||||
const applyWithCover = () => {
|
||||
coverMesh.isVisible = options.withCover;
|
||||
model.updated();
|
||||
};
|
||||
|
||||
applyWithCover();
|
||||
|
||||
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
||||
if (options.customPicture != null) {
|
||||
pictureMaterial.unfreeze();
|
||||
@@ -199,26 +211,17 @@ export const pictureFrame = defineObject({
|
||||
|
||||
},
|
||||
onOptionsUpdated: ([k, v]) => {
|
||||
if (k === 'frameColor') {
|
||||
applyFrameColor();
|
||||
}
|
||||
if (k === 'width' || k === 'height') {
|
||||
applySize();
|
||||
}
|
||||
if (k === 'frameThickness') {
|
||||
applyFrameThickness();
|
||||
}
|
||||
if (k === 'depth') {
|
||||
applyDepth();
|
||||
}
|
||||
if (k === 'matHThickness' || k === 'matVThickness') {
|
||||
applyMatThickness();
|
||||
}
|
||||
if (k === 'customPicture') {
|
||||
applyCustomPicture();
|
||||
}
|
||||
if (k === 'fit') {
|
||||
applyFit();
|
||||
switch (k) {
|
||||
case 'frameColor': applyFrameColor(); break;
|
||||
case 'width':
|
||||
case 'height': applySize(); break;
|
||||
case 'frameThickness': applyFrameThickness(); break;
|
||||
case 'matHThickness':
|
||||
case 'matVThickness': applyMatThickness(); break;
|
||||
case 'depth': applyDepth(); break;
|
||||
case 'withCover': applyWithCover(); break;
|
||||
case 'customPicture':
|
||||
case 'fit': applyCustomPicture(); break;
|
||||
}
|
||||
},
|
||||
interactions: {},
|
||||
|
||||
60
packages/frontend/src/world/room/objects/stanchionPole.ts
Normal file
60
packages/frontend/src/world/room/objects/stanchionPole.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../object.js';
|
||||
|
||||
export const stanchionPole = defineObject({
|
||||
id: 'stanchionPole',
|
||||
name: 'stanchionPole',
|
||||
options: {
|
||||
schema: {
|
||||
bodyColor: {
|
||||
type: 'color',
|
||||
label: 'Body color',
|
||||
},
|
||||
ropeColor: {
|
||||
type: 'color',
|
||||
label: 'Rope color',
|
||||
},
|
||||
},
|
||||
default: {
|
||||
bodyColor: [0.8, 0.39, 0.1],
|
||||
ropeColor: [0.21, 0.0, 0.0],
|
||||
},
|
||||
},
|
||||
placement: 'floor',
|
||||
hasCollisions: false,
|
||||
hasTexture: false,
|
||||
createInstance: ({ options, model }) => {
|
||||
const bodyMaterial = model.findMaterial('__X_BODY__');
|
||||
|
||||
const applyBodyColor = () => {
|
||||
const [r, g, b] = options.bodyColor;
|
||||
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
|
||||
};
|
||||
|
||||
applyBodyColor();
|
||||
|
||||
const ropeMaterial = model.findMaterial('__X_ROPE__');
|
||||
|
||||
const applyRopeColor = () => {
|
||||
const [r, g, b] = options.ropeColor;
|
||||
ropeMaterial.albedoColor = new BABYLON.Color3(r, g, b);
|
||||
};
|
||||
|
||||
applyRopeColor();
|
||||
|
||||
return {
|
||||
onOptionsUpdated: ([k, v]) => {
|
||||
switch (k) {
|
||||
case 'bodyColor': applyBodyColor(); break;
|
||||
case 'ropeColor': applyRopeColor(); break;
|
||||
}
|
||||
},
|
||||
interactions: {},
|
||||
};
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user