1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-13 18:45:35 +02:00
This commit is contained in:
syuilo
2026-04-11 11:19:22 +09:00
parent d775fa6360
commit d808d20f8e
5 changed files with 7 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 940 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 KiB

After

Width:  |  Height:  |  Size: 435 KiB

View File

@@ -13,7 +13,7 @@ const remap = (value: number, fromMin: number, fromMax: number, toMin: number, t
export const randomBooks = defineObject({
id: 'randomBooks',
name: 'randomBooks',
name: '雑多な本',
options: {
schema: {
plainCover: {
@@ -31,6 +31,7 @@ export const randomBooks = defineObject({
const tex = new BABYLON.Texture('/client-assets/room/objects/random-books/texture.png', scene, false, false);
bodyMesh.material.albedoTexture = tex;
const TEXTURE_DIVISION = 8;
const count = 10;
let accumulatedPos = 0;
@@ -41,16 +42,16 @@ export const randomBooks = defineObject({
mesh.morphTargetManager = bodyMesh.morphTargetManager.clone();
mesh.markVerticesDataAsUpdatable(BABYLON.VertexBuffer.UVKind, true);
const index = Math.floor(Math.random() * 15);
const x = index % 8;
const y = Math.floor(index / 8);
const index = Math.floor(Math.random() * 27);
const x = index % TEXTURE_DIVISION;
const y = Math.floor(index / TEXTURE_DIVISION);
const uvs = mesh.getVerticesData(BABYLON.VertexBuffer.UVKind)!;
for (let uvi = 0; uvi < uvs.length; uvi += 2) {
const u = uvs[uvi];
const v = uvs[uvi + 1];
uvs[uvi] = (u / 8) + (x / 8);
uvs[uvi + 1] = (v / 8) + (y / 8);
uvs[uvi] = (u / TEXTURE_DIVISION) + (x / TEXTURE_DIVISION);
uvs[uvi + 1] = (v / TEXTURE_DIVISION) + (y / TEXTURE_DIVISION);
}
mesh.updateVerticesData(BABYLON.VertexBuffer.UVKind, uvs);