add fade in/out arguments to JS export types
This commit is contained in:
@@ -74,8 +74,11 @@ class DartFilamentJSExportViewer {
|
||||
viewer.loadIbl(lightingPath, intensity: intensity).toJS;
|
||||
|
||||
@JSExport()
|
||||
JSPromise rotateIbl(JSArray<JSNumber> rotation) => throw UnimplementedError();
|
||||
// viewer.rotateIbl(rotation.toDartMatrix3()).toJS;
|
||||
JSPromise rotateIbl(JSArray<JSNumber> rotation) {
|
||||
var matrix =
|
||||
Matrix3.fromList(rotation.toDart.map((v) => v.toDartDouble).toList());
|
||||
return viewer.rotateIbl(matrix).toJS;
|
||||
}
|
||||
|
||||
@JSExport()
|
||||
JSPromise removeIbl() => viewer.removeIbl().toJS;
|
||||
@@ -261,7 +264,9 @@ class DartFilamentJSExportViewer {
|
||||
JSArray<JSArray<JSArray<JSNumber>>> frameData,
|
||||
JSNumber frameLengthInMs,
|
||||
JSNumber spaceEnum,
|
||||
JSNumber skinIndex) {
|
||||
JSNumber skinIndex,
|
||||
JSNumber fadeInInSecs,
|
||||
JSNumber fadeOutInSecs) {
|
||||
var frameDataDart = frameData.toDart
|
||||
.map((frame) => frame.toDart
|
||||
.map((v) {
|
||||
@@ -285,7 +290,10 @@ class DartFilamentJSExportViewer {
|
||||
space: Space.values[spaceEnum.toDartInt]);
|
||||
|
||||
return viewer
|
||||
.addBoneAnimation(entity, data, skinIndex: skinIndex.toDartInt)
|
||||
.addBoneAnimation(entity, data,
|
||||
skinIndex: skinIndex.toDartInt,
|
||||
fadeInInSecs: fadeInInSecs.toDartDouble,
|
||||
fadeOutInSecs: fadeOutInSecs.toDartDouble)
|
||||
.toJS;
|
||||
}
|
||||
|
||||
@@ -455,18 +463,23 @@ class DartFilamentJSExportViewer {
|
||||
JSPromise moveCameraToAsset(FilamentEntity entity) =>
|
||||
throw UnimplementedError();
|
||||
// viewer.moveCameraToAsset(entity)).toJS;
|
||||
|
||||
@JSExport()
|
||||
JSPromise setViewFrustumCulling(JSBoolean enabled) =>
|
||||
throw UnimplementedError();
|
||||
// viewer.setViewFrustumCulling(enabled).toJS;
|
||||
|
||||
@JSExport()
|
||||
JSPromise setCameraExposure(
|
||||
double aperture, double shutterSpeed, double sensitivity) =>
|
||||
viewer.setCameraExposure(aperture, shutterSpeed, sensitivity).toJS;
|
||||
|
||||
@JSExport()
|
||||
JSPromise setCameraRotation(JSArray<JSNumber> quaternion) =>
|
||||
throw UnimplementedError();
|
||||
// viewer.setCameraRotation(quaternion.toDartQuaternion()).toJS;
|
||||
JSPromise setCameraRotation(JSArray<JSNumber> quaternion) {
|
||||
var dartVals = quaternion.toDart;
|
||||
return viewer.setCameraRotation(v64.Quaternion(dartVals[0].toDartDouble, dartVals[1].toDartDouble, dartVals[2].toDartDouble, dartVals[3].toDartDouble)).toJS;
|
||||
}
|
||||
|
||||
@JSExport()
|
||||
JSPromise setCameraModelMatrix(JSArray<JSNumber> matrix) {
|
||||
throw UnimplementedError();
|
||||
@@ -669,10 +682,16 @@ class DartFilamentJSExportViewer {
|
||||
}
|
||||
|
||||
@JSExport()
|
||||
JSPromise setBoneTransform(FilamentEntity entity,
|
||||
int boneIndex, JSArray<JSNumber> transform, int skinIndex) {
|
||||
return viewer.setBoneTransform(entity, boneIndex, Matrix4.fromList(transform.toDart.map((v) => v.toDartDouble).toList()),
|
||||
skinIndex: skinIndex).toJS;
|
||||
JSPromise setBoneTransform(FilamentEntity entity, int boneIndex,
|
||||
JSArray<JSNumber> transform, int skinIndex) {
|
||||
return viewer
|
||||
.setBoneTransform(
|
||||
entity,
|
||||
boneIndex,
|
||||
Matrix4.fromList(
|
||||
transform.toDart.map((v) => v.toDartDouble).toList()),
|
||||
skinIndex: skinIndex)
|
||||
.toJS;
|
||||
}
|
||||
|
||||
@JSExport()
|
||||
|
||||
@@ -149,7 +149,9 @@ extension type DartFilamentJSShim(JSObject _) implements JSObject {
|
||||
JSArray<JSArray<JSArray<JSNumber>>> frameData,
|
||||
JSNumber frameLengthInMs,
|
||||
JSNumber spaceEnum,
|
||||
JSNumber skinIndex);
|
||||
JSNumber skinIndex,
|
||||
JSNumber fadeInInSecs,
|
||||
JSNumber fadeOutInSecs);
|
||||
|
||||
@JS('removeEntity')
|
||||
external JSPromise removeEntity(FilamentEntity entity);
|
||||
|
||||
@@ -92,9 +92,9 @@ class JsInteropFilamentViewer implements AbstractFilamentViewer {
|
||||
|
||||
@override
|
||||
Future<void> rotateIbl(Matrix3 rotation) async {
|
||||
throw UnimplementedError();
|
||||
// final JSMatrix3 jsRotation = rotation.storage;
|
||||
// await _jsObject.rotateIbl(jsRotation).toDart;
|
||||
await _jsObject
|
||||
.rotateIbl(rotation.storage.map((v) => v.toJS).toList().toJS)
|
||||
.toDart;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -287,7 +287,9 @@ class JsInteropFilamentViewer implements AbstractFilamentViewer {
|
||||
@override
|
||||
Future<void> addBoneAnimation(
|
||||
FilamentEntity entity, BoneAnimationData animation,
|
||||
{int skinIndex = 0}) async {
|
||||
{int skinIndex = 0,
|
||||
double fadeInInSecs = 0.0,
|
||||
double fadeOutInSecs = 0.0}) async {
|
||||
var boneNames = animation.bones.map((n) => n.toJS).toList().toJS;
|
||||
var frameData = animation.frameData
|
||||
.map((frame) => frame
|
||||
@@ -312,7 +314,9 @@ class JsInteropFilamentViewer implements AbstractFilamentViewer {
|
||||
frameData,
|
||||
animation.frameLengthInMs.toJS,
|
||||
animation.space.index.toJS,
|
||||
skinIndex.toJS)
|
||||
skinIndex.toJS,
|
||||
fadeInInSecs.toJS,
|
||||
fadeOutInSecs.toJS)
|
||||
.toDart;
|
||||
}
|
||||
|
||||
@@ -515,9 +519,13 @@ class JsInteropFilamentViewer implements AbstractFilamentViewer {
|
||||
|
||||
@override
|
||||
Future<void> setCameraRotation(Quaternion quaternion) async {
|
||||
throw UnimplementedError();
|
||||
// final JSQuaternion jsQuaternion = quaternion.toJSQuaternion().toDart;
|
||||
// await _jsObject.setCameraRotation(jsQuaternion).toDart;
|
||||
final values = <JSNumber>[
|
||||
quaternion.x.toJS,
|
||||
quaternion.y.toJS,
|
||||
quaternion.z.toJS,
|
||||
quaternion.w.toJS
|
||||
];
|
||||
await _jsObject.setCameraRotation(values.toJS).toDart;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -781,10 +789,11 @@ class JsInteropFilamentViewer implements AbstractFilamentViewer {
|
||||
|
||||
@override
|
||||
Future setBoneTransform(
|
||||
FilamentEntity entity, int boneIndex, Matrix4 transform, { int skinIndex =0}) {
|
||||
FilamentEntity entity, int boneIndex, Matrix4 transform,
|
||||
{int skinIndex = 0}) {
|
||||
return _jsObject
|
||||
.setBoneTransform(entity, boneIndex,
|
||||
transform.storage.map((v) => v.toJS).toList().toJS)
|
||||
transform.storage.map((v) => v.toJS).toList().toJS, skinIndex)
|
||||
.toDart;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user