1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-24 08:04:08 +02:00
This commit is contained in:
syuilo
2026-02-26 14:24:58 +09:00
parent a8456a45ab
commit 4d37ada54d
9 changed files with 100 additions and 4 deletions

View File

@@ -111,6 +111,7 @@ type ObjectDef<OpSc extends OptionsSchema = OptionsSchema> = {
loaderResult: BABYLON.ISceneLoaderAsyncResult;
meshUpdated: () => void;
findMesh: (keyword: string) => BABYLON.Mesh;
findMaterial: (keyword: string) => BABYLON.PBRMaterial;
}) => RoomObjectInstance<GetOptionsSchemaValues<OpSc>>;
};
@@ -869,6 +870,14 @@ export class RoomEngine {
}
return mesh as BABYLON.Mesh;
},
findMaterial: (keyword) => {
for (const m of root.getChildMeshes()) {
if (m.material != null && m.material.name.includes(keyword)) {
return m.material as BABYLON.PBRMaterial;
}
}
throw new Error(`Material with keyword "${keyword}" not found for object ${args.type} (${args.id})`);
},
});
this.objectInstances.set(args.id, objectInstance);