add getter for Aabb3 directly (getBoundingBox) on ThermionAsset

This commit is contained in:
Nick Fisher
2025-04-21 15:51:50 +08:00
parent afd8bff58e
commit 63e2dcd0ca
3 changed files with 26 additions and 10 deletions

View File

@@ -64,6 +64,13 @@ abstract class ThermionAsset {
/// ///
Future removeStencilHighlight(); Future removeStencilHighlight();
///
/// The dimensions of the bounding box for this asset.
/// This is independent of the boundingBoxAsset (which is used to visualize
/// the bounding box in the scene); you do not need to call
/// [createBoundingBoxAsset] before this method.
Future<Aabb3> getBoundingBox();
/// ///
/// The bounding box for this asset, as an actual renderable asset. /// The bounding box for this asset, as an actual renderable asset.
/// Null by default; call [createBoundingBoxAsset] first to create. /// Null by default; call [createBoundingBoxAsset] first to create.

View File

@@ -1,5 +1,5 @@
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:vector_math/vector_math_64.dart' as v64;
import 'package:animation_tools_dart/src/bone_animation_data.dart'; import 'package:animation_tools_dart/src/bone_animation_data.dart';
import 'package:animation_tools_dart/src/morph_animation_data.dart'; import 'package:animation_tools_dart/src/morph_animation_data.dart';
import 'package:thermion_dart/src/filament/src/layers.dart'; import 'package:thermion_dart/src/filament/src/layers.dart';
@@ -338,8 +338,8 @@ class BackgroundImage extends ThermionAsset {
} }
@override @override
Future<MaterialInstance> getMaterialInstanceAt({ThermionEntity? entity, int index = 0}) { Future<MaterialInstance> getMaterialInstanceAt(
// TODO: implement getMaterialInstanceAt {ThermionEntity? entity, int index = 0}) {
throw UnimplementedError(); throw UnimplementedError();
} }
@@ -347,7 +347,10 @@ class BackgroundImage extends ThermionAsset {
@override @override
Future<ThermionAsset> createBoundingBoxAsset() { Future<ThermionAsset> createBoundingBoxAsset() {
// TODO: implement getBoundingBoxAsset throw UnimplementedError();
}
Future<v64.Aabb3> getBoundingBox() {
throw UnimplementedError(); throw UnimplementedError();
} }
} }

View File

@@ -246,8 +246,14 @@ class FFIAsset extends ThermionAsset {
throw UnimplementedError(); throw UnimplementedError();
} }
///
///
///
ThermionAsset? boundingBoxAsset; ThermionAsset? boundingBoxAsset;
///
///
///
Future<v64.Aabb3> getBoundingBox() async { Future<v64.Aabb3> getBoundingBox() async {
final entities = <ThermionEntity>[]; final entities = <ThermionEntity>[];
if (RenderableManager_isRenderable(app.renderableManager, entity)) { if (RenderableManager_isRenderable(app.renderableManager, entity)) {