This commit is contained in:
syuilo
2026-03-04 11:52:19 +09:00
parent 0a4b81b0cc
commit 9070159db7
3 changed files with 27 additions and 12 deletions

View File

@@ -39,6 +39,13 @@ export const pictureFrame = defineObject({
max: 1, max: 1,
step: 0.01, step: 0.01,
}, },
depth: {
type: 'range',
label: 'Depth',
min: 0,
max: 1,
step: 0.01,
},
matHThickness: { matHThickness: {
type: 'range', type: 'range',
label: 'Mat horizontal thickness', label: 'Mat horizontal thickness',
@@ -68,6 +75,7 @@ export const pictureFrame = defineObject({
width: 0.15, width: 0.15,
height: 0.15, height: 0.15,
frameThickness: 0.3, frameThickness: 0.3,
depth: 0,
matHThickness: 0.35, matHThickness: 0.35,
matVThickness: 0.35, matVThickness: 0.35,
customPicture: null, customPicture: null,
@@ -106,7 +114,7 @@ export const pictureFrame = defineObject({
applyFit(); applyFit();
const applyFrameThickness = () => { const applyFrameThickness = () => {
frameMesh.morphTargetManager!.getTargetByName('FrameThickness')!.influence = options.frameThickness; frameMesh.morphTargetManager!.getTargetByName('Thickness')!.influence = options.frameThickness;
meshUpdated(); meshUpdated();
}; };
@@ -115,8 +123,8 @@ export const pictureFrame = defineObject({
const applyMatThickness = () => { const applyMatThickness = () => {
matMesh.morphTargetManager!.getTargetByName('MatH')!.influence = options.matHThickness * options.width; matMesh.morphTargetManager!.getTargetByName('MatH')!.influence = options.matHThickness * options.width;
matMesh.morphTargetManager!.getTargetByName('MatV')!.influence = options.matVThickness * options.height; matMesh.morphTargetManager!.getTargetByName('MatV')!.influence = options.matVThickness * options.height;
pictureMesh.morphTargetManager!.getTargetByName('PictureWidth')!.influence = options.width * (1 - options.matHThickness); pictureMesh.morphTargetManager!.getTargetByName('Width')!.influence = options.width * (1 - options.matHThickness);
pictureMesh.morphTargetManager!.getTargetByName('PictureHeight')!.influence = options.height * (1 - options.matVThickness); pictureMesh.morphTargetManager!.getTargetByName('Height')!.influence = options.height * (1 - options.matVThickness);
meshUpdated(); meshUpdated();
applyFit(); applyFit();
@@ -125,12 +133,12 @@ export const pictureFrame = defineObject({
applyMatThickness(); applyMatThickness();
const applySize = () => { const applySize = () => {
frameMesh.morphTargetManager!.getTargetByName('FrameWidth')!.influence = options.width; frameMesh.morphTargetManager!.getTargetByName('Width')!.influence = options.width;
frameMesh.morphTargetManager!.getTargetByName('FrameHeight')!.influence = options.height; frameMesh.morphTargetManager!.getTargetByName('Height')!.influence = options.height;
matMesh.morphTargetManager!.getTargetByName('MatWidth')!.influence = options.width; matMesh.morphTargetManager!.getTargetByName('Width')!.influence = options.width;
matMesh.morphTargetManager!.getTargetByName('MatHeight')!.influence = options.height; matMesh.morphTargetManager!.getTargetByName('Height')!.influence = options.height;
coverMesh.morphTargetManager!.getTargetByName('CoverWidth')!.influence = options.width; coverMesh.morphTargetManager!.getTargetByName('Width')!.influence = options.width;
coverMesh.morphTargetManager!.getTargetByName('CoverHeight')!.influence = options.height; coverMesh.morphTargetManager!.getTargetByName('Height')!.influence = options.height;
meshUpdated(); meshUpdated();
applyMatThickness(); applyMatThickness();
@@ -138,6 +146,13 @@ export const pictureFrame = defineObject({
applySize(); applySize();
const applyDepth = () => {
frameMesh.morphTargetManager!.getTargetByName('Depth')!.influence = options.depth;
meshUpdated();
};
applyDepth();
const applyCustomPicture = () => { const applyCustomPicture = () => {
if (options.customPicture != null) { if (options.customPicture != null) {
const tex = new BABYLON.Texture(options.customPicture, room.scene, false, false); const tex = new BABYLON.Texture(options.customPicture, room.scene, false, false);
@@ -177,15 +192,15 @@ export const pictureFrame = defineObject({
if (k === 'frameColor') { if (k === 'frameColor') {
applyFrameColor(); applyFrameColor();
} }
if (k === 'direction') {
applyDirection();
}
if (k === 'width' || k === 'height') { if (k === 'width' || k === 'height') {
applySize(); applySize();
} }
if (k === 'frameThickness') { if (k === 'frameThickness') {
applyFrameThickness(); applyFrameThickness();
} }
if (k === 'depth') {
applyDepth();
}
if (k === 'matHThickness' || k === 'matVThickness') { if (k === 'matHThickness' || k === 'matVThickness') {
applyMatThickness(); applyMatThickness();
} }