1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-22 04:35:31 +02:00
This commit is contained in:
syuilo
2026-03-26 20:26:27 +09:00
parent 4965429069
commit 7f5858a66f
20 changed files with 153 additions and 54 deletions

View File

@@ -46,7 +46,7 @@ export const allInOnePc = defineObject({
},
},
placement: 'top',
createInstance: ({ room, options, findMesh, findMaterial }) => {
createInstance: ({ scene, options, findMesh, findMaterial }) => {
const screenMesh = findMesh('__X_SCREEN__');
const bodyMaterial = findMaterial('__X_BODY__');
@@ -72,7 +72,7 @@ export const allInOnePc = defineObject({
const applyCustomPicture = () => {
if (options.customPicture != null) {
const tex = new BABYLON.Texture(options.customPicture, room.scene, false, false);
const tex = new BABYLON.Texture(options.customPicture, scene, false, false);
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
tex.level = 0.5;

View File

@@ -14,19 +14,19 @@ export const aquarium = defineObject({
default: {},
},
placement: 'top',
createInstance: ({ room, root }) => {
createInstance: ({ scene, root }) => {
return {
onInited: () => {
const noiseTexture = new BABYLON.NoiseProceduralTexture('perlin', 256, room.scene);
const noiseTexture = new BABYLON.NoiseProceduralTexture('perlin', 256, scene);
noiseTexture.animationSpeedFactor = 70;
noiseTexture.persistence = 10;
noiseTexture.brightness = 0.5;
noiseTexture.octaves = 5;
const emitter = new BABYLON.TransformNode('emitter', room.scene);
const emitter = new BABYLON.TransformNode('emitter', scene);
emitter.parent = root;
emitter.position = new BABYLON.Vector3(17/*cm*/, 7/*cm*/, -9/*cm*/);
const ps = new BABYLON.ParticleSystem('', 128, room.scene);
const ps = new BABYLON.ParticleSystem('', 128, scene);
ps.particleTexture = new BABYLON.Texture('/client-assets/room/objects/lava-lamp/bubble.png');
ps.emitter = emitter;
ps.isLocal = true;

View File

@@ -14,10 +14,10 @@ export const beamLamp = defineObject({
default: {},
},
placement: 'top',
createInstance: ({ root, room }) => {
createInstance: ({ root, scene }) => {
return {
onInited: () => {
const light = new BABYLON.PointLight('beamLampLight', new BABYLON.Vector3(0, 10/*cm*/, 0), room.scene);
const light = new BABYLON.PointLight('beamLampLight', new BABYLON.Vector3(0, 10/*cm*/, 0), scene);
light.parent = root;
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
light.intensity = 300;

View File

@@ -102,6 +102,14 @@ export const blind = defineObject({
},
},
},
onOptionsUpdated: ([k, v]) => {
temp.$reset();
switch (k) {
case 'angle': applyAngle(); break;
case 'open': applyOpeningState(); break;
case 'blades': applyOpeningState(); break;
}
},
resetTemporaryState: () => {
temp.$reset();
applyAngle();

View File

@@ -23,16 +23,16 @@ export const books = defineObject({
},
placement: 'top',
mergeMeshes: ['__X_BOOK_1__', '__X_BOOK_2__', '__X_BOOK_3__', '__X_BOOK_4__', '__X_BOOK_5__', '__X_BOOK_6__', '__X_BOOK_7__', '__X_BOOK_8__', '__X_BOOK_9__', '__X_BOOK_10__'],
createInstance: ({ room, options, findMesh, findMaterial }) => {
createInstance: ({ scene, options, findMesh, findMaterial }) => {
const coverMaterial = findMaterial('__X_COVER__');
const applyVariation = () => {
const coverTexture =
options.variation === 'A' ? new BABYLON.Texture('/client-assets/room/objects/books/textures/a.png', room.scene, false, false) :
options.variation === 'B' ? new BABYLON.Texture('/client-assets/room/objects/books/textures/b.png', room.scene, false, false) :
options.variation === 'C' ? new BABYLON.Texture('/client-assets/room/objects/books/textures/c.png', room.scene, false, false) :
options.variation === 'D' ? new BABYLON.Texture('/client-assets/room/objects/books/textures/d.png', room.scene, false, false) :
new BABYLON.Texture('/client-assets/room/objects/books/textures/e.png', room.scene, false, false);
options.variation === 'A' ? new BABYLON.Texture('/client-assets/room/objects/books/textures/a.png', scene, false, false) :
options.variation === 'B' ? new BABYLON.Texture('/client-assets/room/objects/books/textures/b.png', scene, false, false) :
options.variation === 'C' ? new BABYLON.Texture('/client-assets/room/objects/books/textures/c.png', scene, false, false) :
options.variation === 'D' ? new BABYLON.Texture('/client-assets/room/objects/books/textures/d.png', scene, false, false) :
new BABYLON.Texture('/client-assets/room/objects/books/textures/e.png', scene, false, false);
coverMaterial.albedoTexture = coverTexture;
};

View File

@@ -22,16 +22,16 @@ export const cardboardBox = defineObject({
},
},
placement: 'top',
createInstance: ({ room, options, root }) => {
createInstance: ({ scene, options, root }) => {
return {
onInited: () => {
const boxMesh = root.getChildMeshes().find(m => m.name === 'Box') as BABYLON.Mesh;
if (options.variation === 'mikan') {
const tex = new BABYLON.Texture('/client-assets/room/objects/cardboard-box/textures/mikan.png', room.scene, false, false);
const tex = new BABYLON.Texture('/client-assets/room/objects/cardboard-box/textures/mikan.png', scene, false, false);
(boxMesh.material as BABYLON.PBRMaterial).albedoTexture = tex;
(boxMesh.material as BABYLON.PBRMaterial).albedoColor = new BABYLON.Color3(1, 1, 1);
} else if (options.variation === 'aizon') {
const tex = new BABYLON.Texture('/client-assets/room/objects/cardboard-box/textures/aizon.png', room.scene, false, false);
const tex = new BABYLON.Texture('/client-assets/room/objects/cardboard-box/textures/aizon.png', scene, false, false);
(boxMesh.material as BABYLON.PBRMaterial).albedoTexture = tex;
(boxMesh.material as BABYLON.PBRMaterial).albedoColor = new BABYLON.Color3(1, 1, 1);
}

View File

@@ -14,7 +14,7 @@ export const ceilingFanLight = defineObject({
default: {},
},
placement: 'ceiling',
createInstance: ({ room, root }) => {
createInstance: ({ scene, root }) => {
return {
onInited: () => {
const rotor = root.getChildMeshes().find(m => m.name === 'Rotor') as BABYLON.Mesh;
@@ -25,7 +25,7 @@ export const ceilingFanLight = defineObject({
{ frame: 100, value: Math.PI * 2 },
]);
rotor.animations = [anim];
room.scene.beginAnimation(rotor, 0, 100, true);
scene.beginAnimation(rotor, 0, 100, true);
},
interactions: {},
};

View File

@@ -15,10 +15,10 @@ export const cupNoodle = defineObject({
default: {},
},
placement: 'top',
createInstance: ({ room, root }) => {
createInstance: ({ scene, root }) => {
return {
onInited: () => {
yuge(room, root, new BABYLON.Vector3(0, 10/*cm*/, 0));
yuge(scene, root, new BABYLON.Vector3(0, 10/*cm*/, 0));
},
interactions: {},
};

View File

@@ -54,7 +54,7 @@ export const laptopPc = defineObject({
},
},
placement: 'top',
createInstance: ({ room, options, findMesh, findMaterial, findTransformNode }) => {
createInstance: ({ scene, options, findMesh, findMaterial, findTransformNode }) => {
const screenMesh = findMesh('__X_SCREEN__');
const hutaNode = findTransformNode('__X_HUTA__');
@@ -81,7 +81,7 @@ export const laptopPc = defineObject({
const applyCustomPicture = () => {
if (options.customPicture != null) {
const tex = new BABYLON.Texture(options.customPicture, room.scene, false, false);
const tex = new BABYLON.Texture(options.customPicture, scene, false, false);
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
tex.level = 0.5;

View File

@@ -13,19 +13,19 @@ export const lavaLamp = defineObject({
default: {},
},
placement: 'top',
createInstance: ({ room, root }) => {
createInstance: ({ scene, root }) => {
return {
onInited: () => {
const light = new BABYLON.PointLight('lavaLampLight', new BABYLON.Vector3(0, 11/*cm*/, 0), room.scene);
const light = new BABYLON.PointLight('lavaLampLight', new BABYLON.Vector3(0, 11/*cm*/, 0), scene);
light.parent = root;
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
light.intensity = 300;
light.range = 100/*cm*/;
const sphere = BABYLON.MeshBuilder.CreateSphere('lavaLampLightSphere', { diameter: 4/*cm*/ }, room.scene);
const sphere = BABYLON.MeshBuilder.CreateSphere('lavaLampLightSphere', { diameter: 4/*cm*/ }, scene);
sphere.parent = root;
sphere.position = new BABYLON.Vector3(0, 15/*cm*/, 0);
const mat = new BABYLON.StandardMaterial('lavaLampLightMat', room.scene);
const mat = new BABYLON.StandardMaterial('lavaLampLightMat', scene);
mat.emissiveColor = new BABYLON.Color3(1.0, 0.5, 0.2);
mat.alpha = 0.5;
@@ -38,12 +38,12 @@ export const lavaLamp = defineObject({
{ frame: 500, value: 38/*cm*/ },
]);
sphere.animations = [anim];
room.scene.beginAnimation(sphere, 0, 500, true);
scene.beginAnimation(sphere, 0, 500, true);
const emitter = new BABYLON.TransformNode('emitter', room.scene);
const emitter = new BABYLON.TransformNode('emitter', scene);
emitter.parent = root;
emitter.position = new BABYLON.Vector3(0, 10/*cm*/, 0);
const ps = new BABYLON.ParticleSystem('', 32, room.scene);
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;

View File

@@ -15,10 +15,10 @@ export const mug = defineObject({
default: {},
},
placement: 'top',
createInstance: ({ room, root }) => {
createInstance: ({ scene, root }) => {
return {
onInited: () => {
yuge(room, root, new BABYLON.Vector3(0, 5/*cm*/, 0));
yuge(scene, root, new BABYLON.Vector3(0, 5/*cm*/, 0));
},
interactions: {},
};

View File

@@ -83,7 +83,7 @@ export const pictureFrame = defineObject({
},
},
placement: 'side',
createInstance: ({ room, root, options, findMaterial, findMesh, meshUpdated }) => {
createInstance: ({ scene, options, findMaterial, findMesh, meshUpdated }) => {
const frameMesh = findMesh('__X_FRAME__');
frameMesh.rotationQuaternion = null;
const matMesh = findMesh('__X_MAT__');
@@ -158,7 +158,7 @@ export const pictureFrame = defineObject({
const applyCustomPicture = () => {
if (options.customPicture != null) {
const tex = new BABYLON.Texture(options.customPicture, room.scene, false, false);
const tex = new BABYLON.Texture(options.customPicture, scene, false, false);
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;

View File

@@ -44,7 +44,7 @@ export const poster = defineObject({
},
},
placement: 'side',
createInstance: ({ room, root, options, findMaterial, findMesh, findMeshes, meshUpdated }) => {
createInstance: ({ scene, options, findMaterial, findMesh, findMeshes, meshUpdated }) => {
const pictureMesh = findMesh('__X_PICTURE__');
pictureMesh.rotationQuaternion = null;
@@ -86,7 +86,7 @@ export const poster = defineObject({
const applyCustomPicture = () => {
if (options.customPicture != null) {
const tex = new BABYLON.Texture(options.customPicture, room.scene, false, false);
const tex = new BABYLON.Texture(options.customPicture, scene, false, false);
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;

View File

@@ -83,7 +83,7 @@ export const tabletopPictureFrame = defineObject({
},
},
placement: 'top',
createInstance: ({ room, root, options, findMaterial, findMesh, meshUpdated }) => {
createInstance: ({ scene, options, findMaterial, findMesh, meshUpdated }) => {
const frameMesh = findMesh('__X_FRAME__');
frameMesh.rotationQuaternion = null;
const matMesh = findMesh('__X_MAT__');
@@ -163,7 +163,7 @@ export const tabletopPictureFrame = defineObject({
const applyCustomPicture = () => {
if (options.customPicture != null) {
const tex = new BABYLON.Texture(options.customPicture, room.scene, false, false);
const tex = new BABYLON.Texture(options.customPicture, scene, false, false);
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;

View File

@@ -44,7 +44,7 @@ export const tapestry = defineObject({
},
},
placement: 'side',
createInstance: ({ room, root, options, findMaterial, findMesh, findMeshes, meshUpdated }) => {
createInstance: ({ scene, options, findMaterial, findMesh, findMeshes, meshUpdated }) => {
const pictureMesh = findMesh('__X_PICTURE__');
pictureMesh.rotationQuaternion = null;
@@ -90,7 +90,7 @@ export const tapestry = defineObject({
const applyCustomPicture = () => {
if (options.customPicture != null) {
const tex = new BABYLON.Texture(options.customPicture, room.scene, false, false);
const tex = new BABYLON.Texture(options.customPicture, scene, false, false);
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;

View File

@@ -15,11 +15,11 @@ export const tv = defineObject({
default: {},
},
placement: 'top',
createInstance: ({ room, root }) => {
createInstance: ({ scene, root }) => {
const screenMesh = root.getChildMeshes().find(m => m.name.includes('__TV_SCREEN__')) as BABYLON.Mesh;
screenMesh.markVerticesDataAsUpdatable(BABYLON.VertexBuffer.UVKind, true);
initTv(room, screenMesh);
initTv(scene, screenMesh);
return {
interactions: {},