mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-06-06 21:34:15 +02:00
平積み
This commit is contained in:
@@ -28,6 +28,10 @@ export const randomBooks = defineObject({
|
|||||||
max: 30,
|
max: 30,
|
||||||
step: 1,
|
step: 1,
|
||||||
},
|
},
|
||||||
|
stackVertically: {
|
||||||
|
type: 'boolean',
|
||||||
|
label: 'Stack vertically',
|
||||||
|
},
|
||||||
seed: {
|
seed: {
|
||||||
type: 'range',
|
type: 'range',
|
||||||
label: 'Seed',
|
label: 'Seed',
|
||||||
@@ -39,6 +43,7 @@ export const randomBooks = defineObject({
|
|||||||
default: {
|
default: {
|
||||||
plainCover: false,
|
plainCover: false,
|
||||||
count: 10,
|
count: 10,
|
||||||
|
stackVertically: false,
|
||||||
seed: 0,
|
seed: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -96,9 +101,18 @@ export const randomBooks = defineObject({
|
|||||||
mesh.morphTargetManager!.getTargetByName('Thickness')!.influence = thickness;
|
mesh.morphTargetManager!.getTargetByName('Thickness')!.influence = thickness;
|
||||||
const thicknessCm = cm(2) + remap(thickness, 0, 1, 0, cm(100));
|
const thicknessCm = cm(2) + remap(thickness, 0, 1, 0, cm(100));
|
||||||
const widthCm = cm(2) + remap(width, 0, 1, 0, cm(100));
|
const widthCm = cm(2) + remap(width, 0, 1, 0, cm(100));
|
||||||
const gap = cm(0.25);
|
const heightCm = cm(4) + remap(height, 0, 1, 0, cm(50));
|
||||||
|
const gap = options.stackVertically ? 0 : cm(0.25);
|
||||||
|
if (options.stackVertically) {
|
||||||
|
mesh.rotationQuaternion = null;
|
||||||
|
mesh.rotation = new BABYLON.Vector3(0, randomRange(-0.15, 0.15), Math.PI / 2);
|
||||||
|
mesh.position.x = (heightCm / 2) / WORLD_SCALE;
|
||||||
|
mesh.position.y = (accumulatedPos + (thicknessCm / 2)) / WORLD_SCALE;
|
||||||
|
mesh.position.z = widthCm / 2 / WORLD_SCALE;
|
||||||
|
} else {
|
||||||
mesh.position.x = (accumulatedPos + (thicknessCm / 2)) / WORLD_SCALE;
|
mesh.position.x = (accumulatedPos + (thicknessCm / 2)) / WORLD_SCALE;
|
||||||
mesh.position.z = widthCm / 2 / WORLD_SCALE;
|
mesh.position.z = widthCm / 2 / WORLD_SCALE;
|
||||||
|
}
|
||||||
mesh.refreshBoundingInfo();
|
mesh.refreshBoundingInfo();
|
||||||
mesh.computeWorldMatrix(true);
|
mesh.computeWorldMatrix(true);
|
||||||
accumulatedPos += thicknessCm + gap;
|
accumulatedPos += thicknessCm + gap;
|
||||||
@@ -106,9 +120,11 @@ export const randomBooks = defineObject({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// centering
|
// centering
|
||||||
|
if (!options.stackVertically) {
|
||||||
for (let i = 0; i < options.count; i++) {
|
for (let i = 0; i < options.count; i++) {
|
||||||
bookMeshes[i].position.x -= accumulatedPos / 2 / WORLD_SCALE;
|
bookMeshes[i].position.x -= accumulatedPos / 2 / WORLD_SCALE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bodyMesh.isVisible = false;
|
bodyMesh.isVisible = false;
|
||||||
|
|
||||||
@@ -125,6 +141,7 @@ export const randomBooks = defineObject({
|
|||||||
switch (k) {
|
switch (k) {
|
||||||
case 'seed': gen(); break;
|
case 'seed': gen(); break;
|
||||||
case 'count': gen(); break;
|
case 'count': gen(); break;
|
||||||
|
case 'stackVertically': gen(); break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
interactions: {},
|
interactions: {},
|
||||||
|
|||||||
Reference in New Issue
Block a user