allow directly creating an entity and setting transform
This commit is contained in:
@@ -10,6 +10,7 @@ import 'package:thermion_dart/src/filament/src/implementation/ffi_scene.dart';
|
||||
import 'package:thermion_dart/src/filament/src/implementation/ffi_swapchain.dart';
|
||||
import 'package:thermion_dart/src/filament/src/implementation/ffi_texture.dart';
|
||||
import 'package:thermion_dart/src/filament/src/implementation/ffi_view.dart';
|
||||
import 'package:thermion_dart/src/utils/src/matrix.dart';
|
||||
import 'package:thermion_dart/thermion_dart.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'resource_loader.dart';
|
||||
@@ -1092,4 +1093,23 @@ class FFIFilamentApp extends FilamentApp<Pointer> {
|
||||
void onDestroy(Future Function() callback) {
|
||||
_onDestroy.add(callback);
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
Future<ThermionEntity> createEntity(
|
||||
{bool createTransformComponent = true}) async {
|
||||
final entity = EntityManager_createEntity(Engine_getEntityManager(engine));
|
||||
if (createTransformComponent) {
|
||||
TransformManager_createComponent(transformManager, entity);
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
Future setTransform(ThermionEntity entity, Matrix4 transform) async {
|
||||
TransformManager_setTransform(transformManager, entity, matrix4ToDouble4x4(transform));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,4 +320,14 @@ abstract class FilamentApp<T> {
|
||||
///
|
||||
///
|
||||
void onDestroy(Future Function() callback);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
Future<ThermionEntity> createEntity({bool createTransformComponent = true});
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
Future setTransform(ThermionEntity entity, Matrix4 transform);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user