mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-21 02:55:25 +02:00
wip
This commit is contained in:
@@ -10,7 +10,7 @@ export const aquarium = defineObject({
|
||||
id: 'aquarium',
|
||||
defaultOptions: {},
|
||||
placement: 'top',
|
||||
createInstance: ({ room, o, root }) => {
|
||||
createInstance: ({ room, root }) => {
|
||||
return {
|
||||
onInited: () => {
|
||||
const noiseTexture = new BABYLON.NoiseProceduralTexture('perlin', 256, room.scene);
|
||||
|
||||
@@ -14,9 +14,9 @@ export const blind = defineObject({
|
||||
open: 1,
|
||||
},
|
||||
placement: 'bottom',
|
||||
createInstance: ({ room, o, loaderResult, meshUpdated }) => {
|
||||
createInstance: ({ options, loaderResult, meshUpdated }) => {
|
||||
const blade = loaderResult.meshes[0].getChildMeshes().find(m => m.name === 'Blade') as BABYLON.Mesh;
|
||||
blade.rotation = new BABYLON.Vector3(o.options.angle, 0, 0);
|
||||
blade.rotation = new BABYLON.Vector3(options.angle, 0, 0);
|
||||
|
||||
let blades = [] as BABYLON.Mesh[];
|
||||
|
||||
@@ -26,12 +26,12 @@ export const blind = defineObject({
|
||||
}
|
||||
blades = [];
|
||||
|
||||
for (let i = 0; i < o.options.blades; i++) {
|
||||
for (let i = 0; i < options.blades; i++) {
|
||||
const b = blade.clone();
|
||||
if (i / o.options.blades < o.options.open) {
|
||||
if (i / options.blades < options.open) {
|
||||
b.position.y -= (i * 4/*cm*/) / WORLD_SCALE;
|
||||
} else {
|
||||
b.position.y -= (((o.options.blades - 1) * o.options.open * 4/*cm*/) + (i * 0.3/*cm*/)) / WORLD_SCALE;
|
||||
b.position.y -= (((options.blades - 1) * options.open * 4/*cm*/) + (i * 0.3/*cm*/)) / WORLD_SCALE;
|
||||
}
|
||||
blades.push(b);
|
||||
}
|
||||
@@ -41,7 +41,7 @@ export const blind = defineObject({
|
||||
|
||||
const applyAngle = () => {
|
||||
for (const b of [blade, ...blades]) {
|
||||
b.rotation.x = o.options.angle;
|
||||
b.rotation.x = options.angle;
|
||||
b.rotation.x += Math.random() * 0.3 - 0.15;
|
||||
}
|
||||
};
|
||||
@@ -57,16 +57,16 @@ export const blind = defineObject({
|
||||
adjustBladeRotation: {
|
||||
label: 'Adjust blade rotation',
|
||||
fn: () => {
|
||||
o.options.angle += Math.PI / 8;
|
||||
if (o.options.angle >= Math.PI / 2) o.options.angle = -Math.PI / 2;
|
||||
options.angle += Math.PI / 8;
|
||||
if (options.angle >= Math.PI / 2) options.angle = -Math.PI / 2;
|
||||
applyAngle();
|
||||
},
|
||||
},
|
||||
openClose: {
|
||||
label: 'Open/close',
|
||||
fn: () => {
|
||||
o.options.open -= 0.25;
|
||||
if (o.options.open < 0) o.options.open = 1;
|
||||
options.open -= 0.25;
|
||||
if (options.open < 0) options.open = 1;
|
||||
applyOpeningState();
|
||||
},
|
||||
},
|
||||
|
||||
@@ -11,12 +11,12 @@ export const book = defineObject({
|
||||
variation: null as number | null,
|
||||
},
|
||||
placement: 'top',
|
||||
createInstance: ({ room, o, root }) => {
|
||||
createInstance: ({ options, root }) => {
|
||||
return {
|
||||
onInited: () => {
|
||||
const mesh = root.getChildMeshes()[1] as BABYLON.Mesh;
|
||||
mesh.markVerticesDataAsUpdatable(BABYLON.VertexBuffer.UVKind, true);
|
||||
const index = o.options.variation ?? 0;
|
||||
const index = options.variation ?? 0;
|
||||
const x = index % 8;
|
||||
const y = Math.floor(index / 8);
|
||||
|
||||
|
||||
@@ -12,15 +12,15 @@ export const cardboardBox = defineObject({
|
||||
variation: null as string | null,
|
||||
},
|
||||
placement: 'top',
|
||||
createInstance: ({ room, o, root }) => {
|
||||
createInstance: ({ room, options, root }) => {
|
||||
return {
|
||||
onInited: () => {
|
||||
const boxMesh = root.getChildMeshes().find(m => m.name === 'Box') as BABYLON.Mesh;
|
||||
if (o.options.variation === 'mikan') {
|
||||
if (options.variation === 'mikan') {
|
||||
const tex = new BABYLON.Texture('/client-assets/room/objects/cardboard-box/textures/mikan.png', room.scene, false, false);
|
||||
(boxMesh.material as BABYLON.PBRMaterial).albedoTexture = tex;
|
||||
(boxMesh.material as BABYLON.PBRMaterial).albedoColor = new BABYLON.Color3(1, 1, 1);
|
||||
} else if (o.options.variation === 'aizon') {
|
||||
} else if (options.variation === 'aizon') {
|
||||
const tex = new BABYLON.Texture('/client-assets/room/objects/cardboard-box/textures/aizon.png', room.scene, false, false);
|
||||
(boxMesh.material as BABYLON.PBRMaterial).albedoTexture = tex;
|
||||
(boxMesh.material as BABYLON.PBRMaterial).albedoColor = new BABYLON.Color3(1, 1, 1);
|
||||
|
||||
@@ -10,7 +10,7 @@ export const ceilingFanLight = defineObject({
|
||||
id: 'ceilingFanLight',
|
||||
defaultOptions: {},
|
||||
placement: 'ceiling',
|
||||
createInstance: ({ room, o, root }) => {
|
||||
createInstance: ({ room, root }) => {
|
||||
return {
|
||||
onInited: () => {
|
||||
const rotor = root.getChildMeshes().find(m => m.name === 'Rotor') as BABYLON.Mesh;
|
||||
|
||||
@@ -9,7 +9,7 @@ export const lavaLamp = defineObject({
|
||||
id: 'lavaLamp',
|
||||
defaultOptions: {},
|
||||
placement: 'top',
|
||||
createInstance: ({ room, o, root }) => {
|
||||
createInstance: ({ room, root }) => {
|
||||
return {
|
||||
onInited: () => {
|
||||
const light = new BABYLON.PointLight('lavaLampLight', new BABYLON.Vector3(0, 11/*cm*/, 0), room.scene);
|
||||
|
||||
@@ -10,7 +10,7 @@ export const wallClock = defineObject({
|
||||
id: 'wallClock',
|
||||
defaultOptions: {},
|
||||
placement: 'side',
|
||||
createInstance: ({ room, o, root }) => {
|
||||
createInstance: ({ room, root }) => {
|
||||
return {
|
||||
onInited: () => {
|
||||
const hourHand = root.getChildMeshes().find(m => m.name === 'HandH') as BABYLON.Mesh;
|
||||
|
||||
Reference in New Issue
Block a user