This commit is contained in:
syuilo
2026-03-05 11:54:25 +09:00
parent 354504b534
commit bdc34305be
12 changed files with 44 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -61,6 +61,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkButton :primary="engine.isEditMode.value" @click="toggleEditMode">Edit mode: {{ engine.isEditMode.value ? 'on' : 'off' }}</MkButton>
<MkButton @click="addObject">addObject</MkButton>
<MkButton primary @click="save">save</MkButton>
<MkButton @click="showBoundingBox">showBoundingBox</MkButton>
</div>
</template>
</div>
@@ -578,6 +579,11 @@ function removeSelectedObject() {
canvas.value!.focus();
}
function showBoundingBox() {
engine.value?.showBoundingBox();
canvas.value!.focus();
}
function getHex(c: [number, number, number]) {
return `#${c.map(x => Math.round(x * 255).toString(16).padStart(2, '0')).join('')}`;
}

View File

@@ -48,8 +48,35 @@ type RoomStateObject<Options = any> = {
sticky?: string | null;
};
type SimpleHeyaWallBase = {
material: null | 'wood' | 'concrete';
color: [number, number, number];
};
type Heya = {
type: 'simple';
options: {
size: [number, number];
window: 'none' | 'kosidakamado' | 'demado' | 'hakidasimado';
wallN: SimpleHeyaWallBase;
wallE: SimpleHeyaWallBase;
wallS: SimpleHeyaWallBase;
wallW: SimpleHeyaWallBase;
flooring: {
material: null | 'wood' | 'concrete';
color: [number, number, number];
};
ceiling: {
material: null | 'wood' | 'concrete';
color: [number, number, number];
};
};
} | {
type: 'japanese';
};
type RoomState = {
roomType: 'default';
heya: Heya;
installedObjects: RoomStateObject<any>[];
};
@@ -865,7 +892,6 @@ export class RoomEngine {
// シェイプキー(morph)を考慮してbounding boxを更新するために必要
mesh.refreshBoundingInfo({ applyMorph: true });
//mesh.showBoundingBox = _DEV_;
mesh.metadata = metadata;
mesh.checkCollisions = !hasCollisionMesh;
@@ -1289,6 +1315,14 @@ export class RoomEngine {
}
}
public showBoundingBox() {
for (const mesh of this.objectMeshs.values()) {
for (const m of mesh.getChildMeshes()) {
m.showBoundingBox = true;
}
}
}
public resize() {
this.engine.resize();
}

View File

@@ -125,6 +125,7 @@ export const pictureFrame = defineObject({
matMesh.morphTargetManager!.getTargetByName('MatV')!.influence = options.matVThickness * options.height;
pictureMesh.morphTargetManager!.getTargetByName('Width')!.influence = options.width * (1 - options.matHThickness);
pictureMesh.morphTargetManager!.getTargetByName('Height')!.influence = options.height * (1 - options.matVThickness);
matMesh.isVisible = options.matHThickness > 0 || options.matVThickness > 0;
meshUpdated();
applyFit();

View File

@@ -130,6 +130,7 @@ export const tabletopPictureFrame = defineObject({
pictureMesh.morphTargetManager!.getTargetByName('Height')!.influence = options.height * (1 - options.matVThickness);
pictureMesh.morphTargetManager!.getTargetByName('MatH')!.influence = options.matHThickness * options.width;
pictureMesh.morphTargetManager!.getTargetByName('MatV')!.influence = options.matVThickness * options.height;
matMesh.isVisible = options.matHThickness > 0 || options.matVThickness > 0;
meshUpdated();
applyFit();