refactor
This commit is contained in:
@@ -2,16 +2,13 @@ import 'dart:typed_data';
|
||||
|
||||
import 'package:vector_math/vector_math.dart';
|
||||
|
||||
class BoneAnimation {
|
||||
final List<String> boneNames;
|
||||
final List<String> meshNames;
|
||||
class DartBoneAnimation {
|
||||
final String boneName;
|
||||
final String meshName;
|
||||
final Float32List frameData;
|
||||
|
||||
BoneAnimation(this.boneNames, this.meshNames, this.frameData);
|
||||
|
||||
List<List> toList() {
|
||||
return [boneNames, meshNames, frameData];
|
||||
}
|
||||
double frameLengthInMs;
|
||||
DartBoneAnimation(
|
||||
this.boneName, this.meshName, this.frameData, this.frameLengthInMs);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -24,25 +21,18 @@ class MorphAnimation {
|
||||
final String meshName;
|
||||
final List<String> morphNames;
|
||||
|
||||
late final Float32List morphData;
|
||||
final Float32List data;
|
||||
|
||||
MorphAnimation(
|
||||
this.meshName, this.morphData, this.morphNames, this.frameLengthInMs);
|
||||
this.meshName, this.data, this.morphNames, this.frameLengthInMs);
|
||||
|
||||
int get numMorphWeights => morphNames.length;
|
||||
|
||||
int get numFrames => morphData.length ~/ numMorphWeights;
|
||||
int get numFrames => data.length ~/ numMorphWeights;
|
||||
|
||||
final double frameLengthInMs;
|
||||
}
|
||||
|
||||
class Animation {
|
||||
final MorphAnimation? morphAnimation;
|
||||
final List<BoneAnimation>? boneAnimations;
|
||||
|
||||
Animation({this.morphAnimation, this.boneAnimations});
|
||||
}
|
||||
|
||||
class BoneTransformFrameData {
|
||||
final List<Vector3> translations;
|
||||
final List<Quaternion> quaternions;
|
||||
@@ -67,18 +57,3 @@ class BoneTransformFrameData {
|
||||
yield quaternions[frame].w;
|
||||
}
|
||||
}
|
||||
|
||||
// Animation.from(
|
||||
// {required this.meshName,
|
||||
// required List<List<double>> morphData,
|
||||
// required this.numMorphWeights,
|
||||
// this.boneAnimations,
|
||||
// required this.numFrames,
|
||||
// required this.frameLengthInMs}) {
|
||||
// if (morphData.length != numFrames) {
|
||||
// throw Exception("Mismatched animation data with frame length");
|
||||
// }
|
||||
// }
|
||||
|
||||
// not directly used, the list of morph targets animated by this [Animation], and may be a subset of the actual morph targets in the asset (and may also be ordered differently).
|
||||
// // When passed to a [FilamentController], these will be re-mapped appropriately (and any morph targets not provided will be set to zero at each frame).
|
||||
Reference in New Issue
Block a user