add moveCameraToAsset
This commit is contained in:
@@ -3,6 +3,7 @@ import 'dart:ui' as ui;
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:polyvox_filament/animations/bone_animation_data.dart';
|
||||
import 'package:polyvox_filament/animations/morph_animation_data.dart';
|
||||
import 'package:polyvox_filament/generated_bindings_web.dart';
|
||||
|
||||
typedef AssetManager = int;
|
||||
typedef FilamentEntity = int;
|
||||
@@ -519,6 +520,13 @@ class FilamentController {
|
||||
await _channel.invokeMethod("setCameraPosition", [x, y, z]);
|
||||
}
|
||||
|
||||
Future moveCameraToAsset(FilamentEntity asset) async {
|
||||
if (_viewer == null || _resizing) {
|
||||
throw Exception("No viewer available, ignoring");
|
||||
}
|
||||
await _channel.invokeMethod("moveCameraToAsset", asset);
|
||||
}
|
||||
|
||||
Future setCameraExposure(
|
||||
double aperture, double shutterSpeed, double sensitivity) async {
|
||||
if (_viewer == null || _resizing) {
|
||||
|
||||
@@ -104,8 +104,11 @@ class _FilamentGestureDetectorState extends State<FilamentGestureDetector> {
|
||||
? null
|
||||
: (d) async {
|
||||
if (d.buttons == kTertiaryButton || _rotating) {
|
||||
widget.controller
|
||||
.rotateStart(d.localPosition.dx, d.localPosition.dy);
|
||||
print("Starting at ${d.position}");
|
||||
widget.controller.rotateStart(
|
||||
d.position.dx * 2.0,
|
||||
d.position.dy *
|
||||
2.0); // multiply by 2.0 to account for pixel density, TODO don't hardcode
|
||||
} else {
|
||||
widget.controller
|
||||
.panStart(d.localPosition.dx, d.localPosition.dy);
|
||||
@@ -115,8 +118,9 @@ class _FilamentGestureDetectorState extends State<FilamentGestureDetector> {
|
||||
? null
|
||||
: (PointerMoveEvent d) async {
|
||||
if (d.buttons == kTertiaryButton || _rotating) {
|
||||
print("Updating at ${d.position}");
|
||||
widget.controller
|
||||
.rotateUpdate(d.localPosition.dx, d.localPosition.dy);
|
||||
.rotateUpdate(d.position.dx * 2.0, d.position.dy * 2.0);
|
||||
} else {
|
||||
widget.controller
|
||||
.panUpdate(d.localPosition.dx, d.localPosition.dy);
|
||||
|
||||
@@ -143,7 +143,6 @@ class _FilamentWidgetState extends State<FilamentWidget> {
|
||||
if (_textureId == null) {
|
||||
return Container(color: Colors.transparent);
|
||||
}
|
||||
|
||||
var texture = Texture(
|
||||
key: ObjectKey("texture_$_textureId"),
|
||||
textureId: _textureId!,
|
||||
|
||||
Reference in New Issue
Block a user