add implementations to JS bridge/shim classes
This commit is contained in:
@@ -404,8 +404,16 @@ class ThermionViewerJSDartBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@JSExport()
|
@JSExport()
|
||||||
JSPromise setCameraFov(double degrees, double width, double height) =>
|
JSPromise setParent(
|
||||||
viewer.setCameraFov(degrees, width, height).toJS;
|
ThermionEntity child, ThermionEntity parent, bool preserveScaling) {
|
||||||
|
return viewer
|
||||||
|
.setParent(child, parent, preserveScaling: preserveScaling)
|
||||||
|
.toJS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JSExport()
|
||||||
|
JSPromise setCameraFov(double degrees, bool horizontal) =>
|
||||||
|
viewer.setCameraFov(degrees, horizontal: horizontal).toJS;
|
||||||
|
|
||||||
@JSExport()
|
@JSExport()
|
||||||
JSPromise setToneMapping(int mapper) =>
|
JSPromise setToneMapping(int mapper) =>
|
||||||
@@ -527,9 +535,11 @@ class ThermionViewerJSDartBridge {
|
|||||||
// b,
|
// b,
|
||||||
// a,
|
// a,
|
||||||
// ).toJS;
|
// ).toJS;
|
||||||
|
|
||||||
@JSExport()
|
@JSExport()
|
||||||
JSPromise transformToUnitCube(ThermionEntity entity) =>
|
JSPromise transformToUnitCube(ThermionEntity entity) =>
|
||||||
viewer.transformToUnitCube(entity).toJS;
|
viewer.transformToUnitCube(entity).toJS;
|
||||||
|
|
||||||
@JSExport()
|
@JSExport()
|
||||||
JSPromise setPosition(ThermionEntity entity, double x, double y, double z) =>
|
JSPromise setPosition(ThermionEntity entity, double x, double y, double z) =>
|
||||||
viewer.setPosition(entity, x, y, z).toJS;
|
viewer.setPosition(entity, x, y, z).toJS;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import 'dart:typed_data';
|
|||||||
|
|
||||||
import 'package:animation_tools_dart/animation_tools_dart.dart';
|
import 'package:animation_tools_dart/animation_tools_dart.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
|
import 'package:thermion_dart/thermion_dart/entities/abstract_gizmo.dart';
|
||||||
import 'package:thermion_dart/thermion_dart/scene.dart';
|
import 'package:thermion_dart/thermion_dart/scene.dart';
|
||||||
import 'package:thermion_dart/thermion_dart/thermion_viewer.dart';
|
import 'package:thermion_dart/thermion_dart/thermion_viewer.dart';
|
||||||
|
|
||||||
@@ -423,8 +424,8 @@ class ThermionViewerJS implements ThermionViewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> setCameraFov(double degrees, double width, double height) async {
|
Future<void> setCameraFov(double degrees, {bool horizontal = true}) async {
|
||||||
await _shim.setCameraFov(degrees, width, height).toDart;
|
await _shim.setCameraFov(degrees, horizontal).toDart;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -737,8 +738,9 @@ class ThermionViewerJS implements ThermionViewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> setParent(ThermionEntity child, ThermionEntity parent) async {
|
Future<void> setParent(ThermionEntity child, ThermionEntity parent,
|
||||||
await _shim.setParent(child, parent).toDart;
|
{bool preserveScaling = false}) async {
|
||||||
|
await _shim.setParent(child, parent, preserveScaling).toDart;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -857,4 +859,26 @@ class ThermionViewerJS implements ThermionViewer {
|
|||||||
final captured = await _shim.capture().toDart;
|
final captured = await _shim.capture().toDart;
|
||||||
return captured.toDart;
|
return captured.toDart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
late (double, double) viewportDimensions;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<Aabb2> getBoundingBox(ThermionEntity entity) {
|
||||||
|
// return _shim.getBoundingBox(entity);
|
||||||
|
throw UnimplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<double> getCameraFov(bool horizontal) {
|
||||||
|
// TODO: implement getCameraFov
|
||||||
|
throw UnimplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future queueRelativePositionUpdateWorldAxis(ThermionEntity entity,
|
||||||
|
double viewportX, double viewportY, double x, double y, double z) {
|
||||||
|
// TODO: implement queueRelativePositionUpdateWorldAxis
|
||||||
|
throw UnimplementedError();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ extension type ThermionViewerJSShim(JSObject _) implements JSObject {
|
|||||||
external JSPromise<JSNumber> getMainCamera();
|
external JSPromise<JSNumber> getMainCamera();
|
||||||
|
|
||||||
@JS('setCameraFov')
|
@JS('setCameraFov')
|
||||||
external JSPromise setCameraFov(double degrees, double width, double height);
|
external JSPromise setCameraFov(double degrees, bool horizontal);
|
||||||
|
|
||||||
@JS('setToneMapping')
|
@JS('setToneMapping')
|
||||||
external JSPromise setToneMapping(int mapper);
|
external JSPromise setToneMapping(int mapper);
|
||||||
@@ -378,7 +378,7 @@ extension type ThermionViewerJSShim(JSObject _) implements JSObject {
|
|||||||
JSArray<JSNumber> indices, String? materialPath, int primitiveType);
|
JSArray<JSNumber> indices, String? materialPath, int primitiveType);
|
||||||
|
|
||||||
@JS('setParent')
|
@JS('setParent')
|
||||||
external JSPromise setParent(ThermionEntity child, ThermionEntity parent);
|
external JSPromise setParent(ThermionEntity child, ThermionEntity parent, bool preserveScaling);
|
||||||
|
|
||||||
@JS('getParent')
|
@JS('getParent')
|
||||||
external JSPromise<JSNumber> getParent(ThermionEntity child);
|
external JSPromise<JSNumber> getParent(ThermionEntity child);
|
||||||
|
|||||||
Reference in New Issue
Block a user