1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-18 03:45:31 +02:00
This commit is contained in:
syuilo
2026-04-07 15:43:06 +09:00
parent d51d1191c5
commit afd731797e
7 changed files with 181 additions and 12 deletions

View File

@@ -4,7 +4,7 @@
*/
import * as BABYLON from '@babylonjs/core';
import { defineObject, WORLD_SCALE } from '../engine.js';
import { defineObject } from '../engine.js';
import { createPlaneUvMapper } from '../utility.js';
export const allInOnePc = defineObject({
@@ -47,7 +47,11 @@ export const allInOnePc = defineObject({
},
placement: 'top',
createInstance: async ({ room, scene, options, model }) => {
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(0/*cm*/, 30/*cm*/ / WORLD_SCALE, 0), new BABYLON.Vector3(0, 0, 1), Math.PI / 1, 2, scene, room?.lightContainer != null);
const matrix = model.root.getWorldMatrix(true);
const scale = new BABYLON.Vector3();
matrix.decompose(scale);
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(0/*cm*/, 30/*cm*/ / Math.abs(scale.y), 0), new BABYLON.Vector3(0, 0, 1), Math.PI / 1, 2, scene, room?.lightContainer != null);
light.parent = model.root;
light.diffuse = new BABYLON.Color3(1.0, 1.0, 1.0);
light.range = 100/*cm*/;

View File

@@ -4,7 +4,7 @@
*/
import * as BABYLON from '@babylonjs/core';
import { defineObject, WORLD_SCALE } from '../engine.js';
import { defineObject } from '../engine.js';
import { createOverridedStates } from '../utility.js';
export const blind = defineObject({
@@ -57,12 +57,16 @@ export const blind = defineObject({
}
blades = [];
const matrix = blade.parent.getWorldMatrix(true);
const scale = new BABYLON.Vector3();
matrix.decompose(scale);
for (let i = 0; i < options.blades; i++) {
const b = blade.clone('blade_' + i); // createInstanceを使いたいが、削除するときになぜかエラーになる
if (i / options.blades < temp.open) {
b.position.y -= (i * 4/*cm*/) / WORLD_SCALE;
b.position.y -= (i * 4/*cm*/) / Math.abs(scale.y);
} else {
b.position.y -= (((options.blades - 1) * temp.open * 4/*cm*/) + (i * 0.3/*cm*/)) / WORLD_SCALE;
b.position.y -= (((options.blades - 1) * temp.open * 4/*cm*/) + (i * 0.3/*cm*/)) / Math.abs(scale.y);
}
blades.push(b);
}

View File

@@ -4,7 +4,7 @@
*/
import * as BABYLON from '@babylonjs/core';
import { defineObject, WORLD_SCALE } from '../engine.js';
import { defineObject } from '../engine.js';
import { createPlaneUvMapper } from '../utility.js';
export const laptopPc = defineObject({
@@ -55,10 +55,14 @@ export const laptopPc = defineObject({
},
placement: 'top',
createInstance: async ({ room, scene, options, model }) => {
const matrix = model.root.getWorldMatrix(true);
const scale = new BABYLON.Vector3();
matrix.decompose(scale);
const screenMesh = model.findMesh('__X_SCREEN__');
const hutaNode = model.findTransformNode('__X_HUTA__');
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(0/*cm*/, 10/*cm*/ / WORLD_SCALE, 0), new BABYLON.Vector3(0, 0, 1), Math.PI / 1, 2, scene, room?.lightContainer != null);
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(0/*cm*/, 10/*cm*/ / Math.abs(scale.y), 0), new BABYLON.Vector3(0, 0, 1), Math.PI / 1, 2, scene, room?.lightContainer != null);
light.parent = hutaNode;
light.diffuse = new BABYLON.Color3(1.0, 1.0, 1.0);
light.range = 100/*cm*/;