feat: add rotation gizmo
This commit is contained in:
@@ -1388,17 +1388,35 @@ external void remove_skybox_render_thread(
|
||||
ffi.Pointer<TSceneManager>,
|
||||
ffi.Pointer<TView>,
|
||||
ffi.Pointer<TScene>,
|
||||
ffi.UnsignedInt,
|
||||
ffi.Pointer<
|
||||
ffi.NativeFunction<ffi.Void Function(ffi.Pointer<TGizmo>)>>)>(
|
||||
isLeaf: true)
|
||||
external ffi.Pointer<TGizmo> SceneManager_createGizmoRenderThread(
|
||||
symbol: "SceneManager_createGizmoRenderThread", isLeaf: true)
|
||||
external ffi.Pointer<TGizmo> _SceneManager_createGizmoRenderThread(
|
||||
ffi.Pointer<TSceneManager> tSceneManager,
|
||||
ffi.Pointer<TView> tView,
|
||||
ffi.Pointer<TScene> tScene,
|
||||
int tGizmoType,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<TGizmo>)>>
|
||||
onComplete,
|
||||
);
|
||||
|
||||
ffi.Pointer<TGizmo> SceneManager_createGizmoRenderThread(
|
||||
ffi.Pointer<TSceneManager> tSceneManager,
|
||||
ffi.Pointer<TView> tView,
|
||||
ffi.Pointer<TScene> tScene,
|
||||
TGizmoType tGizmoType,
|
||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<TGizmo>)>>
|
||||
onComplete,
|
||||
) =>
|
||||
_SceneManager_createGizmoRenderThread(
|
||||
tSceneManager,
|
||||
tView,
|
||||
tScene,
|
||||
tGizmoType.value,
|
||||
onComplete,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<TSceneManager>,
|
||||
@@ -1688,14 +1706,31 @@ external void unproject_texture_render_thread(
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Pointer<TGizmo> Function(ffi.Pointer<TSceneManager>, ffi.Pointer<TView>,
|
||||
ffi.Pointer<TScene>)>(isLeaf: true)
|
||||
external ffi.Pointer<TGizmo> SceneManager_createGizmo(
|
||||
ffi.Pointer<TGizmo> Function(
|
||||
ffi.Pointer<TSceneManager>,
|
||||
ffi.Pointer<TView>,
|
||||
ffi.Pointer<TScene>,
|
||||
ffi.UnsignedInt)>(symbol: "SceneManager_createGizmo", isLeaf: true)
|
||||
external ffi.Pointer<TGizmo> _SceneManager_createGizmo(
|
||||
ffi.Pointer<TSceneManager> tSceneManager,
|
||||
ffi.Pointer<TView> tView,
|
||||
ffi.Pointer<TScene> tScene,
|
||||
int tGizmoType,
|
||||
);
|
||||
|
||||
ffi.Pointer<TGizmo> SceneManager_createGizmo(
|
||||
ffi.Pointer<TSceneManager> tSceneManager,
|
||||
ffi.Pointer<TView> tView,
|
||||
ffi.Pointer<TScene> tScene,
|
||||
TGizmoType tGizmoType,
|
||||
) =>
|
||||
_SceneManager_createGizmo(
|
||||
tSceneManager,
|
||||
tView,
|
||||
tScene,
|
||||
tGizmoType.value,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Pointer<TSceneAsset> Function(
|
||||
ffi.Pointer<TSceneManager>,
|
||||
@@ -2487,6 +2522,20 @@ final class Aabb3 extends ffi.Struct {
|
||||
external double halfExtentZ;
|
||||
}
|
||||
|
||||
enum TGizmoType {
|
||||
TRANSLATION(0),
|
||||
ROTATION(1);
|
||||
|
||||
final int value;
|
||||
const TGizmoType(this.value);
|
||||
|
||||
static TGizmoType fromValue(int value) => switch (value) {
|
||||
0 => TRANSLATION,
|
||||
1 => ROTATION,
|
||||
_ => throw ArgumentError("Unknown value for TGizmoType: $value"),
|
||||
};
|
||||
}
|
||||
|
||||
enum TSamplerCompareFunc {
|
||||
/// !< Less or equal
|
||||
LE(0),
|
||||
|
||||
@@ -2066,7 +2066,7 @@ class ThermionViewerFFI extends ThermionViewer {
|
||||
var scene = View_getScene(view.view);
|
||||
final gizmo = await withPointerCallback<TGizmo>((cb) {
|
||||
SceneManager_createGizmoRenderThread(
|
||||
_sceneManager!, view.view, scene, cb);
|
||||
_sceneManager!, view.view, scene, TGizmoType.values[gizmoType.index], cb);
|
||||
});
|
||||
if (gizmo == nullptr) {
|
||||
throw Exception("Failed to create gizmo");
|
||||
|
||||
Reference in New Issue
Block a user