mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-06-05 21:04:07 +02:00
wip
This commit is contained in:
@@ -324,6 +324,7 @@ type ObjectDef<OpSc extends OptionsSchema = OptionsSchema> = {
|
|||||||
options: Readonly<GetOptionsSchemaValues<OpSc>>;
|
options: Readonly<GetOptionsSchemaValues<OpSc>>;
|
||||||
model: ModelManager;
|
model: ModelManager;
|
||||||
id: string;
|
id: string;
|
||||||
|
stickyMarkerMeshUpdated?: (mesh: BABYLON.Mesh) => void;
|
||||||
}) => RoomObjectInstance<GetOptionsSchemaValues<OpSc>> | Promise<RoomObjectInstance<GetOptionsSchemaValues<OpSc>>>; // TODO: createInstanceをasyncにするのではなく、別にreadyみたいなものを返させる
|
}) => RoomObjectInstance<GetOptionsSchemaValues<OpSc>> | Promise<RoomObjectInstance<GetOptionsSchemaValues<OpSc>>>; // TODO: createInstanceをasyncにするのではなく、別にreadyみたいなものを返させる
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1227,9 +1228,7 @@ export class RoomEngine {
|
|||||||
this.highlightMeshes(meshes);
|
this.highlightMeshes(meshes);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const m of meshes) {
|
for (const mesh of meshes) {
|
||||||
const mesh = m;
|
|
||||||
|
|
||||||
// シェイプキー(morph)を考慮してbounding boxを更新するために必要
|
// シェイプキー(morph)を考慮してbounding boxを更新するために必要
|
||||||
mesh.refreshBoundingInfo({ applyMorph: true });
|
mesh.refreshBoundingInfo({ applyMorph: true });
|
||||||
|
|
||||||
@@ -1278,6 +1277,28 @@ export class RoomEngine {
|
|||||||
options: args.options,
|
options: args.options,
|
||||||
model,
|
model,
|
||||||
id: args.id,
|
id: args.id,
|
||||||
|
stickyMarkerMeshUpdated: (mesh: BABYLON.Mesh) => {
|
||||||
|
// TODO
|
||||||
|
//// stickyな子の位置を更新
|
||||||
|
//if (mesh.name.includes('__TOP__')) {
|
||||||
|
// mesh.unfreezeWorldMatrix();
|
||||||
|
// mesh.computeWorldMatrix(true);
|
||||||
|
// const updateChildStickyObjectPosition = (objectId: string) => {
|
||||||
|
// const stickyObjectIds = Array.from(this.roomState.installedObjects.filter(o => o.sticky === objectId)).map(o => o.id);
|
||||||
|
// for (const soid of stickyObjectIds) {
|
||||||
|
// const soMesh = this.objectEntities.get(soid)!.rootMesh;
|
||||||
|
// soMesh.unfreezeWorldMatrix();
|
||||||
|
// for (const m of soMesh.getChildMeshes()) {
|
||||||
|
// m.unfreezeWorldMatrix();
|
||||||
|
// }
|
||||||
|
// console.log(mesh.getAbsolutePosition().y);
|
||||||
|
// soMesh.position.y = mesh.getAbsolutePosition().y;
|
||||||
|
// updateChildStickyObjectPosition(soid);
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// updateChildStickyObjectPosition(args.id);
|
||||||
|
//}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
objectInstance.onInited?.();
|
objectInstance.onInited?.();
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export const ironFrameTable = defineObject({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
placement: 'top',
|
placement: 'top',
|
||||||
createInstance: ({ options, model }) => {
|
createInstance: ({ options, model, stickyMarkerMeshUpdated }) => {
|
||||||
const frameMaterial = model.findMaterial('__X_FRAME__');
|
const frameMaterial = model.findMaterial('__X_FRAME__');
|
||||||
const boardMaterial = model.findMaterial('__X_BOARD__');
|
const boardMaterial = model.findMaterial('__X_BOARD__');
|
||||||
|
|
||||||
@@ -68,6 +68,8 @@ export const ironFrameTable = defineObject({
|
|||||||
|
|
||||||
applyBoardColor();
|
applyBoardColor();
|
||||||
|
|
||||||
|
const topMesh = model.findMesh('__TOP__');
|
||||||
|
|
||||||
const applySize = () => {
|
const applySize = () => {
|
||||||
for (const mesh of model.root.getChildMeshes()) {
|
for (const mesh of model.root.getChildMeshes()) {
|
||||||
if (mesh.morphTargetManager != null && mesh.morphTargetManager.getTargetByName('W') != null) {
|
if (mesh.morphTargetManager != null && mesh.morphTargetManager.getTargetByName('W') != null) {
|
||||||
@@ -90,9 +92,9 @@ export const ironFrameTable = defineObject({
|
|||||||
switch (k) {
|
switch (k) {
|
||||||
case 'frameColor': applyFrameColor(); break;
|
case 'frameColor': applyFrameColor(); break;
|
||||||
case 'boardColor': applyBoardColor(); break;
|
case 'boardColor': applyBoardColor(); break;
|
||||||
case 'width': applySize(); break;
|
case 'width': applySize(); stickyMarkerMeshUpdated?.(topMesh); break;
|
||||||
case 'depth': applySize(); break;
|
case 'depth': applySize(); stickyMarkerMeshUpdated?.(topMesh); break;
|
||||||
case 'height': applySize(); break;
|
case 'height': applySize(); stickyMarkerMeshUpdated?.(topMesh); break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
interactions: {},
|
interactions: {},
|
||||||
|
|||||||
Reference in New Issue
Block a user