mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-28 21:44:29 +02:00
wip
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -20,6 +20,20 @@ export const pictureFrame = defineObject({
|
|||||||
label: 'Direction',
|
label: 'Direction',
|
||||||
enum: ['vertical', 'horizontal'],
|
enum: ['vertical', 'horizontal'],
|
||||||
},
|
},
|
||||||
|
width: {
|
||||||
|
type: 'range',
|
||||||
|
label: 'Width',
|
||||||
|
min: 0,
|
||||||
|
max: 1,
|
||||||
|
step: 0.01,
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: 'range',
|
||||||
|
label: 'Height',
|
||||||
|
min: 0,
|
||||||
|
max: 1,
|
||||||
|
step: 0.01,
|
||||||
|
},
|
||||||
frameThickness: {
|
frameThickness: {
|
||||||
type: 'range',
|
type: 'range',
|
||||||
label: 'Frame thickness',
|
label: 'Frame thickness',
|
||||||
@@ -49,10 +63,12 @@ export const pictureFrame = defineObject({
|
|||||||
default: {
|
default: {
|
||||||
frameColor: [0.71, 0.58, 0.39],
|
frameColor: [0.71, 0.58, 0.39],
|
||||||
direction: 'vertical',
|
direction: 'vertical',
|
||||||
|
width: 0.5,
|
||||||
|
height: 0.5,
|
||||||
frameThickness: 0.5,
|
frameThickness: 0.5,
|
||||||
matHThickness: 0.125,
|
matHThickness: 0.125,
|
||||||
matVThickness: 0.15,
|
matVThickness: 0.15,
|
||||||
customPicture: null,
|
customPicture: 'http://syu-win.local:3000/files/b6cefaba-3093-4c57-a7f8-993dee62c6f7',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
placement: 'side',
|
placement: 'side',
|
||||||
@@ -111,7 +127,7 @@ export const pictureFrame = defineObject({
|
|||||||
pictureMesh.updateVerticesData(BABYLON.VertexBuffer.UVKind, uvs);
|
pictureMesh.updateVerticesData(BABYLON.VertexBuffer.UVKind, uvs);
|
||||||
};
|
};
|
||||||
|
|
||||||
applyDirection();
|
//applyDirection();
|
||||||
|
|
||||||
const applyFrameThickness = () => {
|
const applyFrameThickness = () => {
|
||||||
frameMesh.morphTargetManager!.getTargetByName('FrameThickness')!.influence = options.frameThickness;
|
frameMesh.morphTargetManager!.getTargetByName('FrameThickness')!.influence = options.frameThickness;
|
||||||
@@ -120,14 +136,26 @@ export const pictureFrame = defineObject({
|
|||||||
applyFrameThickness();
|
applyFrameThickness();
|
||||||
|
|
||||||
const applyMatThickness = () => {
|
const applyMatThickness = () => {
|
||||||
matMesh.morphTargetManager!.getTargetByName('MatH')!.influence = options.matHThickness;
|
const factor = 0.49; // 0.5を超えるとなんかメッシュのレンダリングがグリッチするため
|
||||||
matMesh.morphTargetManager!.getTargetByName('MatV')!.influence = options.matVThickness;
|
matMesh.morphTargetManager!.getTargetByName('MatH')!.influence = options.matHThickness * factor * options.width;
|
||||||
pictureMesh.morphTargetManager!.getTargetByName('PictureH')!.influence = options.matHThickness;
|
matMesh.morphTargetManager!.getTargetByName('MatV')!.influence = options.matVThickness * factor * options.height;
|
||||||
pictureMesh.morphTargetManager!.getTargetByName('PictureV')!.influence = options.matVThickness;
|
pictureMesh.morphTargetManager!.getTargetByName('PictureWidth')!.influence = options.width * (1 - (options.matHThickness * factor));
|
||||||
|
pictureMesh.morphTargetManager!.getTargetByName('PictureHeight')!.influence = options.height * (1 - (options.matVThickness * factor));
|
||||||
};
|
};
|
||||||
|
|
||||||
applyMatThickness();
|
applyMatThickness();
|
||||||
|
|
||||||
|
const applySize = () => {
|
||||||
|
frameMesh.morphTargetManager!.getTargetByName('FrameWidth')!.influence = options.width;
|
||||||
|
frameMesh.morphTargetManager!.getTargetByName('FrameHeight')!.influence = options.height;
|
||||||
|
matMesh.morphTargetManager!.getTargetByName('MatWidth')!.influence = options.width;
|
||||||
|
matMesh.morphTargetManager!.getTargetByName('MatHeight')!.influence = options.height;
|
||||||
|
|
||||||
|
applyMatThickness();
|
||||||
|
};
|
||||||
|
|
||||||
|
applySize();
|
||||||
|
|
||||||
const pictureMaterial = findMaterial('__X_PICTURE__');
|
const pictureMaterial = findMaterial('__X_PICTURE__');
|
||||||
|
|
||||||
const applyCustomPicture = () => {
|
const applyCustomPicture = () => {
|
||||||
@@ -164,6 +192,9 @@ export const pictureFrame = defineObject({
|
|||||||
if (k === 'direction') {
|
if (k === 'direction') {
|
||||||
applyDirection();
|
applyDirection();
|
||||||
}
|
}
|
||||||
|
if (k === 'width' || k === 'height') {
|
||||||
|
applySize();
|
||||||
|
}
|
||||||
if (k === 'frameThickness') {
|
if (k === 'frameThickness') {
|
||||||
applyFrameThickness();
|
applyFrameThickness();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user