mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-24 08:04:08 +02:00
wip
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user