mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-19 03:05:28 +02:00
cm
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../engine.js';
|
||||
import { createPlaneUvMapper } from '../utility.js';
|
||||
import { cm, createPlaneUvMapper } from '../utility.js';
|
||||
|
||||
export const allInOnePc = defineObject({
|
||||
id: 'allInOnePc',
|
||||
@@ -51,10 +51,10 @@ export const allInOnePc = defineObject({
|
||||
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);
|
||||
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(cm(0), cm(30) / 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*/;
|
||||
light.range = cm(100);
|
||||
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
||||
|
||||
const screenMesh = model.findMesh('__X_SCREEN__');
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../engine.js';
|
||||
import { cm } from '../utility.js';
|
||||
|
||||
export const aquarium = defineObject({
|
||||
id: 'aquarium',
|
||||
@@ -26,19 +27,19 @@ export const aquarium = defineObject({
|
||||
|
||||
const emitter = new BABYLON.TransformNode('emitter', scene);
|
||||
emitter.parent = root;
|
||||
emitter.position = new BABYLON.Vector3(17/*cm*/, 7/*cm*/, -9/*cm*/);
|
||||
emitter.position = new BABYLON.Vector3(cm(17), cm(7), cm(-9));
|
||||
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;
|
||||
ps.minEmitBox = new BABYLON.Vector3(-2/*cm*/, 0, -2/*cm*/);
|
||||
ps.maxEmitBox = new BABYLON.Vector3(2/*cm*/, 0, 2/*cm*/);
|
||||
ps.minEmitBox = new BABYLON.Vector3(cm(-2), 0, cm(-2));
|
||||
ps.maxEmitBox = new BABYLON.Vector3(cm(2), 0, cm(2));
|
||||
ps.minEmitPower = 40;
|
||||
ps.maxEmitPower = 60;
|
||||
ps.minLifeTime = 0.5;
|
||||
ps.maxLifeTime = 0.5;
|
||||
ps.minSize = 0.1/*cm*/;
|
||||
ps.maxSize = 1/*cm*/;
|
||||
ps.minSize = cm(0.1);
|
||||
ps.maxSize = cm(1);
|
||||
ps.direction1 = new BABYLON.Vector3(0, 1, 0);
|
||||
ps.direction2 = new BABYLON.Vector3(0, 1, 0);
|
||||
ps.noiseTexture = noiseTexture;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../engine.js';
|
||||
import { cm } from '../utility.js';
|
||||
|
||||
export const beamLamp = defineObject({
|
||||
id: 'beamLamp',
|
||||
@@ -18,11 +19,11 @@ export const beamLamp = defineObject({
|
||||
createInstance: ({ room, root, scene }) => {
|
||||
return {
|
||||
onInited: () => {
|
||||
const light = new BABYLON.PointLight('beamLampLight', new BABYLON.Vector3(0, 10/*cm*/, 0), scene, room?.lightContainer != null);
|
||||
const light = new BABYLON.PointLight('beamLampLight', new BABYLON.Vector3(0, cm(10), 0), scene, room?.lightContainer != null);
|
||||
light.parent = root;
|
||||
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
|
||||
light.intensity = 300;
|
||||
light.range = 100/*cm*/;
|
||||
light.range = cm(100);
|
||||
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
||||
},
|
||||
interactions: {},
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../engine.js';
|
||||
import { createOverridedStates } from '../utility.js';
|
||||
import { cm, createOverridedStates } from '../utility.js';
|
||||
|
||||
export const blind = defineObject({
|
||||
id: 'blind',
|
||||
@@ -65,9 +65,9 @@ export const blind = defineObject({
|
||||
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*/) / Math.abs(scale.y);
|
||||
b.position.y -= (i * cm(4)) / Math.abs(scale.y);
|
||||
} else {
|
||||
b.position.y -= (((options.blades - 1) * temp.open * 4/*cm*/) + (i * 0.3/*cm*/)) / Math.abs(scale.y);
|
||||
b.position.y -= (((options.blades - 1) * temp.open * cm(4)) + (i * cm(0.3))) / Math.abs(scale.y);
|
||||
}
|
||||
blades.push(b);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../engine.js';
|
||||
import { cm } from '../utility.js';
|
||||
|
||||
export const books = defineObject({
|
||||
id: 'books',
|
||||
@@ -52,8 +53,8 @@ export const books = defineObject({
|
||||
];
|
||||
|
||||
for (const meshes of bookMeshes) {
|
||||
const z = Math.random() * 0.005/*cm*/;
|
||||
const y = Math.random() * 0.0025/*cm*/;
|
||||
const z = Math.random() * cm(0.005);
|
||||
const y = Math.random() * cm(0.0025);
|
||||
for (const mesh of meshes) {
|
||||
mesh.position.z -= z;
|
||||
mesh.position.y += y;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../engine.js';
|
||||
import { yuge } from '../utility.js';
|
||||
import { cm, yuge } from '../utility.js';
|
||||
|
||||
export const cupNoodle = defineObject({
|
||||
id: 'cupNoodle',
|
||||
@@ -21,7 +21,7 @@ export const cupNoodle = defineObject({
|
||||
|
||||
return {
|
||||
onInited: () => {
|
||||
yugeDispose = yuge(scene, root, new BABYLON.Vector3(0, 10/*cm*/, 0));
|
||||
yugeDispose = yuge(scene, root, new BABYLON.Vector3(0, cm(10), 0));
|
||||
},
|
||||
interactions: {},
|
||||
dispose: () => {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../engine.js';
|
||||
import { cm } from '../utility.js';
|
||||
|
||||
export const desktopPc = defineObject({
|
||||
id: 'desktopPc',
|
||||
@@ -47,16 +48,16 @@ export const desktopPc = defineObject({
|
||||
},
|
||||
placement: 'top',
|
||||
createInstance: ({ options, model, root, scene, room }) => {
|
||||
const light1 = new BABYLON.SpotLight('', new BABYLON.Vector3(0, 10/*cm*/, 22/*cm*/), new BABYLON.Vector3(0, 0, 1), Math.PI / 1, 2, scene, room?.lightContainer != null);
|
||||
const light1 = new BABYLON.SpotLight('', new BABYLON.Vector3(0, cm(10), cm(22)), new BABYLON.Vector3(0, 0, 1), Math.PI / 1, 2, scene, room?.lightContainer != null);
|
||||
light1.parent = root;
|
||||
light1.intensity = 500;
|
||||
light1.range = 30/*cm*/;
|
||||
light1.range = cm(30);
|
||||
if (room?.lightContainer != null) room.lightContainer.addLight(light1);
|
||||
|
||||
const light2 = new BABYLON.SpotLight('', new BABYLON.Vector3(-5/*cm*/, 33/*cm*/, -9/*cm*/), new BABYLON.Vector3(1, 0, 0), Math.PI / 1, 2, scene, room?.lightContainer != null);
|
||||
const light2 = new BABYLON.SpotLight('', new BABYLON.Vector3(cm(-5), cm(33), cm(-9)), new BABYLON.Vector3(1, 0, 0), Math.PI / 1, 2, scene, room?.lightContainer != null);
|
||||
light2.parent = root;
|
||||
light2.intensity = 500;
|
||||
light2.range = 30/*cm*/;
|
||||
light2.range = cm(30);
|
||||
if (room?.lightContainer != null) room.lightContainer.addLight(light2);
|
||||
|
||||
const bodyMaterial = model.findMaterial('__X_BODY__');
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../engine.js';
|
||||
import { createPlaneUvMapper } from '../utility.js';
|
||||
import { cm, createPlaneUvMapper } from '../utility.js';
|
||||
|
||||
export const laptopPc = defineObject({
|
||||
id: 'laptopPc',
|
||||
@@ -63,10 +63,10 @@ export const laptopPc = defineObject({
|
||||
const screenMesh = model.findMesh('__X_SCREEN__');
|
||||
const hutaNode = model.findTransformNode('__X_HUTA__');
|
||||
|
||||
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);
|
||||
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(cm(0), cm(10) / 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*/;
|
||||
light.range = cm(100);
|
||||
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
||||
|
||||
const bodyMaterial = model.findMaterial('__X_BODY__');
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../engine.js';
|
||||
import { cm } from '../utility.js';
|
||||
|
||||
export const lavaLamp = defineObject({
|
||||
id: 'lavaLamp',
|
||||
@@ -17,16 +18,16 @@ export const lavaLamp = defineObject({
|
||||
createInstance: ({ room, scene, root }) => {
|
||||
return {
|
||||
onInited: () => {
|
||||
const light = new BABYLON.PointLight('lavaLampLight', new BABYLON.Vector3(0, 11/*cm*/, 0), scene, room?.lightContainer != null);
|
||||
const light = new BABYLON.PointLight('lavaLampLight', new BABYLON.Vector3(0, cm(11), 0), scene, room?.lightContainer != null);
|
||||
light.parent = root;
|
||||
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
|
||||
light.intensity = 300;
|
||||
light.range = 100/*cm*/;
|
||||
light.range = cm(100);
|
||||
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
||||
|
||||
const sphere = BABYLON.MeshBuilder.CreateSphere('lavaLampLightSphere', { diameter: 4/*cm*/ }, scene);
|
||||
const sphere = BABYLON.MeshBuilder.CreateSphere('lavaLampLightSphere', { diameter: cm(4) }, scene);
|
||||
sphere.parent = root;
|
||||
sphere.position = new BABYLON.Vector3(0, 15/*cm*/, 0);
|
||||
sphere.position = new BABYLON.Vector3(0, cm(15), 0);
|
||||
const mat = new BABYLON.StandardMaterial('lavaLampLightMat', scene);
|
||||
mat.emissiveColor = new BABYLON.Color3(1.0, 0.5, 0.2);
|
||||
|
||||
@@ -36,27 +37,27 @@ export const lavaLamp = defineObject({
|
||||
|
||||
const anim = new BABYLON.Animation('lavaLampLightAnim', 'position.y', 60, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
|
||||
anim.setKeys([
|
||||
{ frame: 0, value: 11/*cm*/ },
|
||||
{ frame: 500, value: 38/*cm*/ },
|
||||
{ frame: 0, value: cm(11) },
|
||||
{ frame: 500, value: cm(38) },
|
||||
]);
|
||||
sphere.animations = [anim];
|
||||
scene.beginAnimation(sphere, 0, 500, true);
|
||||
|
||||
const emitter = new BABYLON.TransformNode('emitter', scene);
|
||||
emitter.parent = root;
|
||||
emitter.position = new BABYLON.Vector3(0, 10/*cm*/, 0);
|
||||
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(-1/*cm*/, 0, -1/*cm*/);
|
||||
ps.maxEmitBox = new BABYLON.Vector3(1/*cm*/, 0, 1/*cm*/);
|
||||
ps.minEmitBox = new BABYLON.Vector3(cm(-1), 0, cm(-1));
|
||||
ps.maxEmitBox = new BABYLON.Vector3(cm(1), 0, cm(1));
|
||||
ps.minEmitPower = 2;
|
||||
ps.maxEmitPower = 3;
|
||||
ps.minLifeTime = 9;
|
||||
ps.maxLifeTime = 9;
|
||||
ps.minSize = 0.5/*cm*/;
|
||||
ps.maxSize = 1/*cm*/;
|
||||
ps.minSize = cm(0.5);
|
||||
ps.maxSize = cm(1);
|
||||
ps.direction1 = new BABYLON.Vector3(0, 1, 0);
|
||||
ps.direction2 = new BABYLON.Vector3(0, 1, 0);
|
||||
ps.emitRate = 1;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../engine.js';
|
||||
import { yuge } from '../utility.js';
|
||||
import { cm, yuge } from '../utility.js';
|
||||
|
||||
export const mug = defineObject({
|
||||
id: 'mug',
|
||||
@@ -21,7 +21,7 @@ export const mug = defineObject({
|
||||
|
||||
return {
|
||||
onInited: () => {
|
||||
yugeDispose = yuge(scene, root, new BABYLON.Vector3(0, 5/*cm*/, 0));
|
||||
yugeDispose = yuge(scene, root, new BABYLON.Vector3(0, cm(5), 0));
|
||||
},
|
||||
interactions: {},
|
||||
dispose: () => {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../engine.js';
|
||||
import { get7segMeshesOfCurrentTime } from '../utility.js';
|
||||
import { cm, get7segMeshesOfCurrentTime } from '../utility.js';
|
||||
|
||||
export const tabletopDigitalClock = defineObject({
|
||||
id: 'tabletopDigitalClock',
|
||||
@@ -35,10 +35,10 @@ export const tabletopDigitalClock = defineObject({
|
||||
placement: 'top',
|
||||
noCollisions: true,
|
||||
createInstance: ({ root, room, options, model, scene }) => {
|
||||
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(0, 3/*cm*/, 1/*cm*/), new BABYLON.Vector3(0, 0, 1), Math.PI / 1, 2, scene, room?.lightContainer != null);
|
||||
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(0, cm(3), cm(1)), new BABYLON.Vector3(0, 0, 1), Math.PI / 1, 2, scene, room?.lightContainer != null);
|
||||
light.parent = root;
|
||||
light.intensity = 100;
|
||||
light.range = 30/*cm*/;
|
||||
light.range = cm(30);
|
||||
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
||||
|
||||
const segmentMeshes = {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../engine.js';
|
||||
import { createPlaneUvMapper, initTv } from '../utility.js';
|
||||
import { cm, createPlaneUvMapper, initTv } from '../utility.js';
|
||||
|
||||
export const tv = defineObject({
|
||||
id: 'tv',
|
||||
@@ -35,10 +35,10 @@ export const tv = defineObject({
|
||||
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);
|
||||
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(cm(0), cm(30) / 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 = 150/*cm*/;
|
||||
light.range = cm(150);
|
||||
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
||||
|
||||
const screenMesh = model.findMesh('__TV_SCREEN__');
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../engine.js';
|
||||
import { cm } from '../utility.js';
|
||||
|
||||
export const woodRingFloorLamp = defineObject({
|
||||
id: 'woodRingFloorLamp',
|
||||
@@ -61,7 +62,7 @@ export const woodRingFloorLamp = defineObject({
|
||||
const lamps = model.findMeshes('__X_LAMP__');
|
||||
const lights: BABYLON.SpotLight[] = [];
|
||||
for (const lamp of lamps) {
|
||||
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(0/*cm*/, 0/*cm*/, 0), new BABYLON.Vector3(0, -1, 0), Math.PI / 1, 2, scene, room?.lightContainer != null);
|
||||
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(cm(0), cm(0), 0), new BABYLON.Vector3(0, -1, 0), Math.PI / 1, 2, scene, room?.lightContainer != null);
|
||||
light.parent = lamp;
|
||||
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
||||
lights.push(light);
|
||||
@@ -83,7 +84,7 @@ export const woodRingFloorLamp = defineObject({
|
||||
const applyLightBrightness = () => {
|
||||
for (const light of lights) {
|
||||
light.intensity = 10000 * options.lightBrightness;
|
||||
light.range = 200/*cm*/ * options.lightBrightness;
|
||||
light.range = cm(200) * options.lightBrightness;
|
||||
}
|
||||
for (const lamp of lamps) {
|
||||
const emissive = lamp.material as BABYLON.PBRMaterial;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject, WORLD_SCALE } from '../engine.js';
|
||||
import { cm } from '../utility.js';
|
||||
|
||||
const remap = (value: number, fromMin: number, fromMax: number, toMin: number, toMax: number) => {
|
||||
return toMin + ((value - fromMin) / (fromMax - fromMin)) * (toMax - toMin);
|
||||
@@ -87,7 +88,7 @@ export const woodRingsPendantLight = defineObject({
|
||||
|
||||
const applyLightBrightness = () => {
|
||||
light.intensity = 10000 * options.lightBrightness;
|
||||
light.range = 200/*cm*/ * options.lightBrightness;
|
||||
light.range = cm(200) * options.lightBrightness;
|
||||
const emissive = lamp.material as BABYLON.PBRMaterial;
|
||||
emissive.emissiveIntensity = options.lightBrightness * 10;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user