change setBoundingBoxVisibility to getBoundingBoxAsset

This commit is contained in:
Nick Fisher
2025-04-17 13:31:59 +08:00
parent 6b008bd433
commit 81a28a2f2e

View File

@@ -273,7 +273,7 @@ class FFIAsset extends ThermionAsset {
/// ///
/// ///
@override @override
Future<void> setBoundingBoxVisibility(bool visible) async { Future<ThermionAsset> getBoundingBoxAsset() async {
if (boundingBoxAsset == null) { if (boundingBoxAsset == null) {
final boundingBox = await SceneAsset_getBoundingBox(asset); final boundingBox = await SceneAsset_getBoundingBox(asset);
@@ -349,13 +349,12 @@ class FFIAsset extends ThermionAsset {
primitiveType: PrimitiveType.LINES, primitiveType: PrimitiveType.LINES,
); );
throw UnimplementedError(); boundingBoxAsset = await FilamentApp.instance!.createGeometry(
geometry,
// boundingBoxAsset = await viewer.createGeometry( animationManager,
// geometry, materialInstances: [material],
// materialInstances: [material], keepData: false,
// keepData: false, ) as FFIAsset;
// ) as FFIAsset;
await boundingBoxAsset!.setCastShadows(false); await boundingBoxAsset!.setCastShadows(false);
await boundingBoxAsset!.setReceiveShadows(false); await boundingBoxAsset!.setReceiveShadows(false);
@@ -363,11 +362,7 @@ class FFIAsset extends ThermionAsset {
TransformManager_setParent(Engine_getTransformManager(app.engine), TransformManager_setParent(Engine_getTransformManager(app.engine),
boundingBoxAsset!.entity, entity, false); boundingBoxAsset!.entity, entity, false);
} }
// if (visible) { return boundingBoxAsset!;
// await boundingBoxAsset!.addToScene();
// } else {
// await boundingBoxAsset!.removeFromScene();
// }
} }
Future<MaterialInstance> getMaterialInstanceAt( Future<MaterialInstance> getMaterialInstanceAt(