add various bone methods to JS interop
This commit is contained in:
@@ -11,6 +11,8 @@ import 'package:dart_filament/dart_filament/entities/filament_entity.dart';
|
|||||||
import 'package:dart_filament/dart_filament/compatibility/web/interop/dart_filament_js_extension_type.dart';
|
import 'package:dart_filament/dart_filament/compatibility/web/interop/dart_filament_js_extension_type.dart';
|
||||||
import 'dart:js_interop_unsafe';
|
import 'dart:js_interop_unsafe';
|
||||||
|
|
||||||
|
import 'package:vector_math/vector_math_64.dart';
|
||||||
|
|
||||||
@JSExport()
|
@JSExport()
|
||||||
class DartFilamentJSExportViewer {
|
class DartFilamentJSExportViewer {
|
||||||
final AbstractFilamentViewer viewer;
|
final AbstractFilamentViewer viewer;
|
||||||
@@ -256,31 +258,35 @@ class DartFilamentJSExportViewer {
|
|||||||
JSPromise addBoneAnimation(
|
JSPromise addBoneAnimation(
|
||||||
FilamentEntity entity,
|
FilamentEntity entity,
|
||||||
JSArray<JSString> bones,
|
JSArray<JSString> bones,
|
||||||
JSArray<JSString> meshNames,
|
|
||||||
JSArray<JSArray<JSArray<JSNumber>>> frameData,
|
JSArray<JSArray<JSArray<JSNumber>>> frameData,
|
||||||
JSNumber frameLengthInMs,
|
JSNumber frameLengthInMs,
|
||||||
JSBoolean isModelSpace) {
|
JSNumber spaceEnum,
|
||||||
|
JSNumber skinIndex) {
|
||||||
var frameDataDart = frameData.toDart
|
var frameDataDart = frameData.toDart
|
||||||
.map((frame) => frame.toDart.map((v) {
|
.map((frame) => frame.toDart
|
||||||
|
.map((v) {
|
||||||
var values = v.toDart;
|
var values = v.toDart;
|
||||||
var trans = v64.Vector3(values[0].toDartDouble, values[1].toDartDouble,
|
var trans = v64.Vector3(values[0].toDartDouble,
|
||||||
values[2].toDartDouble);
|
values[1].toDartDouble, values[2].toDartDouble);
|
||||||
var rot = v64.Quaternion(
|
var rot = v64.Quaternion(
|
||||||
values[3].toDartDouble,
|
values[3].toDartDouble,
|
||||||
values[4].toDartDouble,
|
values[4].toDartDouble,
|
||||||
values[5].toDartDouble,
|
values[5].toDartDouble,
|
||||||
values[6].toDartDouble);
|
values[6].toDartDouble);
|
||||||
return (rotation:rot, translation:trans);
|
return (rotation: rot, translation: trans);
|
||||||
}).cast<BoneAnimationFrame>().toList())
|
})
|
||||||
|
.cast<BoneAnimationFrame>()
|
||||||
|
.toList())
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
var data = BoneAnimationData(
|
var data = BoneAnimationData(
|
||||||
bones.toDart.map((n) => n.toDart).toList(),
|
bones.toDart.map((n) => n.toDart).toList(), frameDataDart,
|
||||||
meshNames.toDart.map((n) => n.toDart).toList(),
|
frameLengthInMs: frameLengthInMs.toDartDouble,
|
||||||
frameDataDart,
|
space: Space.values[spaceEnum.toDartInt]);
|
||||||
frameLengthInMs.toDartDouble);
|
|
||||||
|
|
||||||
return viewer.addBoneAnimation(entity, data).toJS;
|
return viewer
|
||||||
|
.addBoneAnimation(entity, data, skinIndex: skinIndex.toDartInt)
|
||||||
|
.toJS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@JSExport()
|
@JSExport()
|
||||||
@@ -607,15 +613,68 @@ class DartFilamentJSExportViewer {
|
|||||||
)
|
)
|
||||||
.then((v) => v.map((s) => s.toJS).toList().toJS)
|
.then((v) => v.map((s) => s.toJS).toList().toJS)
|
||||||
.toJS;
|
.toJS;
|
||||||
|
|
||||||
@JSExport()
|
@JSExport()
|
||||||
JSPromise setRecording(bool recording) => viewer.setRecording(recording).toJS;
|
JSPromise setRecording(bool recording) => viewer.setRecording(recording).toJS;
|
||||||
|
|
||||||
@JSExport()
|
@JSExport()
|
||||||
JSPromise setRecordingOutputDirectory(String outputDirectory) =>
|
JSPromise setRecordingOutputDirectory(String outputDirectory) =>
|
||||||
viewer.setRecordingOutputDirectory(outputDirectory).toJS;
|
viewer.setRecordingOutputDirectory(outputDirectory).toJS;
|
||||||
|
|
||||||
@JSExport()
|
@JSExport()
|
||||||
JSPromise addAnimationComponent(FilamentEntity entity) =>
|
JSPromise addAnimationComponent(FilamentEntity entity) =>
|
||||||
viewer.addAnimationComponent(entity).toJS;
|
viewer.addAnimationComponent(entity).toJS;
|
||||||
|
|
||||||
|
@JSExport()
|
||||||
|
JSPromise removeAnimationComponent(FilamentEntity entity) =>
|
||||||
|
viewer.removeAnimationComponent(entity).toJS;
|
||||||
|
|
||||||
|
@JSExport()
|
||||||
|
JSPromise getParent(FilamentEntity entity) =>
|
||||||
|
viewer.removeAnimationComponent(entity).toJS;
|
||||||
|
|
||||||
|
@JSExport()
|
||||||
|
JSPromise getBone(FilamentEntity entity, int boneIndex, int skinIndex) =>
|
||||||
|
viewer.getBone(entity, boneIndex, skinIndex: skinIndex).toJS;
|
||||||
|
|
||||||
|
@JSExport()
|
||||||
|
JSPromise<JSArray<JSNumber>> getLocalTransform(FilamentEntity entity) {
|
||||||
|
return viewer
|
||||||
|
.getLocalTransform(entity)
|
||||||
|
.then((t) => t.storage.map((v) => v.toJS).toList().toJS)
|
||||||
|
.toJS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JSExport()
|
||||||
|
JSPromise<JSArray<JSNumber>> getWorldTransform(FilamentEntity entity) {
|
||||||
|
return viewer
|
||||||
|
.getWorldTransform(entity)
|
||||||
|
.then((t) => t.storage.map((v) => v.toJS).toList().toJS)
|
||||||
|
.toJS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JSExport()
|
||||||
|
JSPromise setTransform(FilamentEntity entity, JSArray<JSNumber> transform) {
|
||||||
|
return viewer
|
||||||
|
.setTransform(
|
||||||
|
entity,
|
||||||
|
Matrix4.fromList(
|
||||||
|
transform.toDart.map((v) => v.toDartDouble).toList()))
|
||||||
|
.toJS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JSExport()
|
||||||
|
JSPromise updateBoneMatrices(FilamentEntity entity) {
|
||||||
|
return viewer.updateBoneMatrices(entity).toJS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
|
||||||
@JSExport()
|
@JSExport()
|
||||||
JSPromise addCollisionComponent(FilamentEntity entity,
|
JSPromise addCollisionComponent(FilamentEntity entity,
|
||||||
{JSFunction? callback, bool affectsTransform = false}) {
|
{JSFunction? callback, bool affectsTransform = false}) {
|
||||||
|
|||||||
@@ -146,10 +146,10 @@ extension type DartFilamentJSShim(JSObject _) implements JSObject {
|
|||||||
external JSPromise addBoneAnimation(
|
external JSPromise addBoneAnimation(
|
||||||
FilamentEntity entity,
|
FilamentEntity entity,
|
||||||
JSArray<JSString> bones,
|
JSArray<JSString> bones,
|
||||||
JSArray<JSString> meshNames,
|
|
||||||
JSArray<JSArray<JSArray<JSNumber>>> frameData,
|
JSArray<JSArray<JSArray<JSNumber>>> frameData,
|
||||||
JSNumber frameLengthInMs,
|
JSNumber frameLengthInMs,
|
||||||
JSBoolean isModelSpace);
|
JSNumber spaceEnum,
|
||||||
|
JSNumber skinIndex);
|
||||||
|
|
||||||
@JS('removeEntity')
|
@JS('removeEntity')
|
||||||
external JSPromise removeEntity(FilamentEntity entity);
|
external JSPromise removeEntity(FilamentEntity entity);
|
||||||
@@ -249,56 +249,78 @@ extension type DartFilamentJSShim(JSObject _) implements JSObject {
|
|||||||
|
|
||||||
@JS('setCameraPosition')
|
@JS('setCameraPosition')
|
||||||
external JSPromise setCameraPosition(double x, double y, double z);
|
external JSPromise setCameraPosition(double x, double y, double z);
|
||||||
|
|
||||||
@JS('getCameraRotation')
|
@JS('getCameraRotation')
|
||||||
external JSPromise<JSArray<JSNumber>> getCameraRotation();
|
external JSPromise<JSArray<JSNumber>> getCameraRotation();
|
||||||
|
|
||||||
@JS('moveCameraToAsset')
|
@JS('moveCameraToAsset')
|
||||||
external JSPromise moveCameraToAsset(FilamentEntity entity);
|
external JSPromise moveCameraToAsset(FilamentEntity entity);
|
||||||
|
|
||||||
@JS('setViewFrustumCulling')
|
@JS('setViewFrustumCulling')
|
||||||
external JSPromise setViewFrustumCulling(JSBoolean enabled);
|
external JSPromise setViewFrustumCulling(JSBoolean enabled);
|
||||||
|
|
||||||
@JS('setCameraExposure')
|
@JS('setCameraExposure')
|
||||||
external JSPromise setCameraExposure(
|
external JSPromise setCameraExposure(
|
||||||
double aperture, double shutterSpeed, double sensitivity);
|
double aperture, double shutterSpeed, double sensitivity);
|
||||||
|
|
||||||
@JS('setCameraRotation')
|
@JS('setCameraRotation')
|
||||||
external JSPromise setCameraRotation(JSArray<JSNumber> quaternion);
|
external JSPromise setCameraRotation(JSArray<JSNumber> quaternion);
|
||||||
|
|
||||||
@JS('setCameraModelMatrix')
|
@JS('setCameraModelMatrix')
|
||||||
external JSPromise setCameraModelMatrix(JSArray<JSNumber> matrix);
|
external JSPromise setCameraModelMatrix(JSArray<JSNumber> matrix);
|
||||||
|
|
||||||
@JS('setMaterialColor')
|
@JS('setMaterialColor')
|
||||||
external JSPromise setMaterialColor(FilamentEntity entity, String meshName,
|
external JSPromise setMaterialColor(FilamentEntity entity, String meshName,
|
||||||
int materialIndex, double r, double g, double b, double a);
|
int materialIndex, double r, double g, double b, double a);
|
||||||
|
|
||||||
@JS('transformToUnitCube')
|
@JS('transformToUnitCube')
|
||||||
external JSPromise transformToUnitCube(FilamentEntity entity);
|
external JSPromise transformToUnitCube(FilamentEntity entity);
|
||||||
|
|
||||||
@JS('setPosition')
|
@JS('setPosition')
|
||||||
external JSPromise setPosition(
|
external JSPromise setPosition(
|
||||||
FilamentEntity entity, double x, double y, double z);
|
FilamentEntity entity, double x, double y, double z);
|
||||||
|
|
||||||
@JS('setScale')
|
@JS('setScale')
|
||||||
external JSPromise setScale(FilamentEntity entity, double scale);
|
external JSPromise setScale(FilamentEntity entity, double scale);
|
||||||
|
|
||||||
@JS('setRotation')
|
@JS('setRotation')
|
||||||
external JSPromise setRotation(
|
external JSPromise setRotation(
|
||||||
FilamentEntity entity, double rads, double x, double y, double z);
|
FilamentEntity entity, double rads, double x, double y, double z);
|
||||||
|
|
||||||
@JS('queuePositionUpdate')
|
@JS('queuePositionUpdate')
|
||||||
external JSPromise queuePositionUpdate(
|
external JSPromise queuePositionUpdate(
|
||||||
FilamentEntity entity, double x, double y, double z, bool relative);
|
FilamentEntity entity, double x, double y, double z, bool relative);
|
||||||
|
|
||||||
@JS('queueRotationUpdate')
|
@JS('queueRotationUpdate')
|
||||||
external JSPromise queueRotationUpdate(FilamentEntity entity, double rads,
|
external JSPromise queueRotationUpdate(FilamentEntity entity, double rads,
|
||||||
double x, double y, double z, bool relative);
|
double x, double y, double z, bool relative);
|
||||||
|
|
||||||
@JS('queueRotationUpdateQuat')
|
@JS('queueRotationUpdateQuat')
|
||||||
external JSPromise queueRotationUpdateQuat(
|
external JSPromise queueRotationUpdateQuat(
|
||||||
FilamentEntity entity, JSArray<JSNumber> quat, bool relative);
|
FilamentEntity entity, JSArray<JSNumber> quat, bool relative);
|
||||||
|
|
||||||
@JS('setPostProcessing')
|
@JS('setPostProcessing')
|
||||||
external JSPromise setPostProcessing(bool enabled);
|
external JSPromise setPostProcessing(bool enabled);
|
||||||
|
|
||||||
@JS('setAntiAliasing')
|
@JS('setAntiAliasing')
|
||||||
external JSPromise setAntiAliasing(bool msaa, bool fxaa, bool taa);
|
external JSPromise setAntiAliasing(bool msaa, bool fxaa, bool taa);
|
||||||
|
|
||||||
@JS('setRotationQuat')
|
@JS('setRotationQuat')
|
||||||
external JSPromise setRotationQuat(
|
external JSPromise setRotationQuat(
|
||||||
FilamentEntity entity, JSArray<JSNumber> rotation);
|
FilamentEntity entity, JSArray<JSNumber> rotation);
|
||||||
|
|
||||||
@JS('reveal')
|
@JS('reveal')
|
||||||
external JSPromise reveal(FilamentEntity entity, String? meshName);
|
external JSPromise reveal(FilamentEntity entity, String? meshName);
|
||||||
|
|
||||||
@JS('hide')
|
@JS('hide')
|
||||||
external JSPromise hide(FilamentEntity entity, String? meshName);
|
external JSPromise hide(FilamentEntity entity, String? meshName);
|
||||||
|
|
||||||
@JS('pick')
|
@JS('pick')
|
||||||
external void pick(int x, int y);
|
external void pick(int x, int y);
|
||||||
|
|
||||||
@JS('getNameForEntity')
|
@JS('getNameForEntity')
|
||||||
external String? getNameForEntity(FilamentEntity entity);
|
external String? getNameForEntity(FilamentEntity entity);
|
||||||
|
|
||||||
@JS('setCameraManipulatorOptions')
|
@JS('setCameraManipulatorOptions')
|
||||||
external JSPromise setCameraManipulatorOptions(
|
external JSPromise setCameraManipulatorOptions(
|
||||||
int mode,
|
int mode,
|
||||||
@@ -306,32 +328,73 @@ extension type DartFilamentJSShim(JSObject _) implements JSObject {
|
|||||||
double orbitSpeedY,
|
double orbitSpeedY,
|
||||||
double zoomSpeed,
|
double zoomSpeed,
|
||||||
);
|
);
|
||||||
|
|
||||||
@JS('getChildEntities')
|
@JS('getChildEntities')
|
||||||
external JSPromise<JSArray<JSNumber>> getChildEntities(
|
external JSPromise<JSArray<JSNumber>> getChildEntities(
|
||||||
FilamentEntity parent, bool renderableOnly);
|
FilamentEntity parent, bool renderableOnly);
|
||||||
|
|
||||||
@JS('getChildEntity')
|
@JS('getChildEntity')
|
||||||
external JSPromise<JSNumber> getChildEntity(
|
external JSPromise<JSNumber> getChildEntity(
|
||||||
FilamentEntity parent, String childName);
|
FilamentEntity parent, String childName);
|
||||||
|
|
||||||
@JS('getChildEntityNames')
|
@JS('getChildEntityNames')
|
||||||
external JSPromise<JSArray<JSString>> getChildEntityNames(
|
external JSPromise<JSArray<JSString>> getChildEntityNames(
|
||||||
FilamentEntity entity, bool renderableOnly);
|
FilamentEntity entity, bool renderableOnly);
|
||||||
|
|
||||||
@JS('setRecording')
|
@JS('setRecording')
|
||||||
external JSPromise setRecording(JSBoolean recording);
|
external JSPromise setRecording(JSBoolean recording);
|
||||||
|
|
||||||
@JS('setRecordingOutputDirectory')
|
@JS('setRecordingOutputDirectory')
|
||||||
external JSPromise setRecordingOutputDirectory(String outputDirectory);
|
external JSPromise setRecordingOutputDirectory(String outputDirectory);
|
||||||
|
|
||||||
@JS('addAnimationComponent')
|
@JS('addAnimationComponent')
|
||||||
external JSPromise addAnimationComponent(FilamentEntity entity);
|
external JSPromise addAnimationComponent(FilamentEntity entity);
|
||||||
|
|
||||||
|
@JS('removeAnimationComponent')
|
||||||
|
external JSPromise removeAnimationComponent(FilamentEntity entity);
|
||||||
|
|
||||||
@JS('addCollisionComponent')
|
@JS('addCollisionComponent')
|
||||||
external JSPromise addCollisionComponent(FilamentEntity entity);
|
external JSPromise addCollisionComponent(FilamentEntity entity);
|
||||||
|
|
||||||
@JS('removeCollisionComponent')
|
@JS('removeCollisionComponent')
|
||||||
external JSPromise removeCollisionComponent(FilamentEntity entity);
|
external JSPromise removeCollisionComponent(FilamentEntity entity);
|
||||||
|
|
||||||
@JS('createGeometry')
|
@JS('createGeometry')
|
||||||
external JSPromise<JSNumber> createGeometry(JSArray<JSNumber> vertices,
|
external JSPromise<JSNumber> createGeometry(JSArray<JSNumber> vertices,
|
||||||
JSArray<JSNumber> indices, String? materialPath, int primitiveType);
|
JSArray<JSNumber> indices, String? materialPath, int primitiveType);
|
||||||
|
|
||||||
@JS('setParent')
|
@JS('setParent')
|
||||||
external JSPromise setParent(FilamentEntity child, FilamentEntity parent);
|
external JSPromise setParent(FilamentEntity child, FilamentEntity parent);
|
||||||
|
|
||||||
|
@JS('getParent')
|
||||||
|
external JSPromise<JSNumber> getParent(FilamentEntity child);
|
||||||
|
|
||||||
|
@JS('getParent')
|
||||||
|
external JSPromise<JSNumber> getBone(
|
||||||
|
FilamentEntity child, int boneIndex, int skinIndex);
|
||||||
|
|
||||||
@JS('testCollisions')
|
@JS('testCollisions')
|
||||||
external JSPromise testCollisions(FilamentEntity entity);
|
external JSPromise testCollisions(FilamentEntity entity);
|
||||||
|
|
||||||
@JS('setPriority')
|
@JS('setPriority')
|
||||||
external JSPromise setPriority(FilamentEntity entityId, int priority);
|
external JSPromise setPriority(FilamentEntity entityId, int priority);
|
||||||
|
|
||||||
|
@JS('getLocalTransform')
|
||||||
|
external JSPromise<JSArray<JSNumber>> getLocalTransform(
|
||||||
|
FilamentEntity entity);
|
||||||
|
|
||||||
|
@JS('getWorldTransform')
|
||||||
|
external JSPromise<JSArray<JSNumber>> getWorldTransform(
|
||||||
|
FilamentEntity entity);
|
||||||
|
|
||||||
|
@JS('updateBoneMatrices')
|
||||||
|
external JSPromise updateBoneMatrices(FilamentEntity entity);
|
||||||
|
|
||||||
|
@JS('setTransform')
|
||||||
|
external JSPromise setTransform(
|
||||||
|
FilamentEntity entity, JSArray<JSNumber> transform);
|
||||||
|
|
||||||
|
@JS('setBoneTransform')
|
||||||
|
external JSPromise setBoneTransform(
|
||||||
|
FilamentEntity entity, int boneIndex, JSArray<JSNumber> transform, int skinIndex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -286,18 +286,34 @@ class JsInteropFilamentViewer implements AbstractFilamentViewer {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> addBoneAnimation(
|
Future<void> addBoneAnimation(
|
||||||
FilamentEntity entity, BoneAnimationData animation) async {
|
FilamentEntity entity, BoneAnimationData animation,
|
||||||
|
{int skinIndex = 0}) async {
|
||||||
var boneNames = animation.bones.map((n) => n.toJS).toList().toJS;
|
var boneNames = animation.bones.map((n) => n.toJS).toList().toJS;
|
||||||
var meshNames = animation.meshNames.map((n) => n.toJS).toList().toJS;
|
|
||||||
var frameData = animation.frameData
|
var frameData = animation.frameData
|
||||||
.map((frame) => frame
|
.map((frame) => frame
|
||||||
.map((q) => [q.translation[0].toJS, q.translation[1].toJS, q.translation[2].toJS, q.rotation.w.toJS, q.rotation.x.toJS, q.rotation.y.toJS, q.rotation.z.toJS].toJS)
|
.map((q) => [
|
||||||
|
q.translation[0].toJS,
|
||||||
|
q.translation[1].toJS,
|
||||||
|
q.translation[2].toJS,
|
||||||
|
q.rotation.w.toJS,
|
||||||
|
q.rotation.x.toJS,
|
||||||
|
q.rotation.y.toJS,
|
||||||
|
q.rotation.z.toJS
|
||||||
|
].toJS)
|
||||||
.toList()
|
.toList()
|
||||||
.toJS)
|
.toJS)
|
||||||
.toList()
|
.toList()
|
||||||
.toJS;
|
.toJS;
|
||||||
|
|
||||||
await _jsObject.addBoneAnimation(entity, boneNames, meshNames, frameData, animation.frameLengthInMs.toJS, animation.isModelSpace.toJS).toDart;
|
await _jsObject
|
||||||
|
.addBoneAnimation(
|
||||||
|
entity,
|
||||||
|
boneNames,
|
||||||
|
frameData,
|
||||||
|
animation.frameLengthInMs.toJS,
|
||||||
|
animation.space.index.toJS,
|
||||||
|
skinIndex.toJS)
|
||||||
|
.toDart;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -725,4 +741,63 @@ class JsInteropFilamentViewer implements AbstractFilamentViewer {
|
|||||||
var result = await _jsObject.getBoneNames(entity, skinIndex).toDart;
|
var result = await _jsObject.getBoneNames(entity, skinIndex).toDart;
|
||||||
return result.toDart.map((n) => n.toDart).toList();
|
return result.toDart.map((n) => n.toDart).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<FilamentEntity> getBone(FilamentEntity entity, int boneIndex,
|
||||||
|
{int skinIndex = 0}) async {
|
||||||
|
var result = await _jsObject.getBone(entity, boneIndex, skinIndex).toDart;
|
||||||
|
return result.toDartInt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<Matrix4> getInverseBindMatrix(FilamentEntity parent, int boneIndex,
|
||||||
|
{int skinIndex = 0}) {
|
||||||
|
// TODO: implement getInverseBindMatrix
|
||||||
|
throw UnimplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<Matrix4> getLocalTransform(FilamentEntity entity) async {
|
||||||
|
var result = await _jsObject.getLocalTransform(entity).toDart;
|
||||||
|
return Matrix4.fromList(result.toDart.map((v) => v.toDartDouble).toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<FilamentEntity?> getParent(FilamentEntity child) async {
|
||||||
|
var result = await _jsObject.getParent(child).toDart;
|
||||||
|
return result.toDartInt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<Matrix4> getWorldTransform(FilamentEntity entity) async {
|
||||||
|
var result = await _jsObject.getLocalTransform(entity).toDart;
|
||||||
|
return Matrix4.fromList(result.toDart.map((v) => v.toDartDouble).toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future removeAnimationComponent(FilamentEntity entity) {
|
||||||
|
return _jsObject.removeAnimationComponent(entity).toDart;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future setBoneTransform(
|
||||||
|
FilamentEntity entity, int boneIndex, Matrix4 transform, { int skinIndex =0}) {
|
||||||
|
return _jsObject
|
||||||
|
.setBoneTransform(entity, boneIndex,
|
||||||
|
transform.storage.map((v) => v.toJS).toList().toJS)
|
||||||
|
.toDart;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future setTransform(FilamentEntity entity, Matrix4 transform) {
|
||||||
|
return _jsObject
|
||||||
|
.setTransform(
|
||||||
|
entity, transform.storage.map((v) => v.toJS).toList().toJS)
|
||||||
|
.toDart;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future updateBoneMatrices(FilamentEntity entity) {
|
||||||
|
return _jsObject.updateBoneMatrices(entity).toDart;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user