This commit is contained in:
syuilo
2026-05-19 20:26:33 +09:00
parent 75dfcf48b6
commit 43cb18b3e9
6 changed files with 18 additions and 9 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

@@ -17,9 +17,10 @@ export const randomBooks = defineObject({
name: '雑多な本',
options: {
schema: {
plainCover: {
type: 'boolean',
label: 'Plain cover',
variation: {
type: 'enum',
label: 'Variation',
enum: ['mix', 'mix-plain'],
},
count: {
type: 'range',
@@ -38,7 +39,7 @@ export const randomBooks = defineObject({
},
},
default: {
plainCover: false,
variation: 'mix',
count: 10,
stackVertically: false,
seed: 0,
@@ -50,13 +51,20 @@ export const randomBooks = defineObject({
canPreMeshesMerging: false,
createInstance: ({ options, model, scene }) => {
const bodyMesh = model.findMesh('__X_BODY__');
const tex = new BABYLON.Texture('/client-assets/room/objects/random-books/texture.png', scene, {
invertY: false,
samplingMode: BABYLON.Texture.NEAREST_SAMPLINGMODE,
});
bodyMesh.material.albedoTexture = tex;
bodyMesh.isVisible = false;
const applyVariation = () => {
if (options.variation === 'mix') {
const tex = new BABYLON.Texture('/client-assets/room/objects/random-books/textures/mix.png', scene, false, false);
bodyMesh.material.albedoTexture = tex;
} else if (options.variation === 'mix-plain') {
const tex = new BABYLON.Texture('/client-assets/room/objects/random-books/textures/mix-plain.png', scene, false, false);
bodyMesh.material.albedoTexture = tex;
}
};
applyVariation();
const TEXTURE_DIVISION = 8;
let bookMeshes: BABYLON.Mesh[] = [];
@@ -137,6 +145,7 @@ export const randomBooks = defineObject({
},
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'variation': applyVariation(); break;
case 'seed': gen(); break;
case 'count': gen(); break;
case 'stackVertically': gen(); break;