13#include "impeller/scene/importer/scene_flatbuffers.h"
20 const fb::Animation& animation,
21 const std::vector<std::shared_ptr<Node>>& scene_nodes) {
24 result->name_ = animation.name()->str();
25 for (
auto channel : *animation.channels()) {
26 if (channel->node() < 0 ||
27 static_cast<size_t>(channel->node()) >= scene_nodes.size() ||
28 !channel->timeline()) {
35 auto*
times = channel->timeline();
36 std::vector<Scalar> out_times;
37 out_times.resize(channel->timeline()->size());
43 switch (channel->keyframes_type()) {
44 case fb::Keyframes::TranslationKeyframes: {
46 auto* keyframes = channel->keyframes_as_TranslationKeyframes();
47 if (!keyframes->values()) {
50 std::vector<Vector3> out_values;
51 out_values.resize(keyframes->values()->size());
52 for (
size_t value_i = 0; value_i < keyframes->values()->
size();
54 auto val = (*keyframes->values())[value_i];
55 out_values[value_i] =
Vector3(val->x(), val->y(), val->z());
58 std::move(out_times), std::move(out_values));
61 case fb::Keyframes::RotationKeyframes: {
63 auto* keyframes = channel->keyframes_as_RotationKeyframes();
64 if (!keyframes->values()) {
67 std::vector<Quaternion> out_values;
68 out_values.resize(keyframes->values()->size());
69 for (
size_t value_i = 0; value_i < keyframes->values()->
size();
71 auto val = (*keyframes->values())[value_i];
73 Quaternion(val->x(), val->y(), val->z(), val->w());
76 std::move(out_times), std::move(out_values));
79 case fb::Keyframes::ScaleKeyframes: {
81 auto* keyframes = channel->keyframes_as_ScaleKeyframes();
82 if (!keyframes->values()) {
85 std::vector<Vector3> out_values;
86 out_values.resize(keyframes->values()->size());
87 for (
size_t value_i = 0; value_i < keyframes->values()->
size();
89 auto val = (*keyframes->values())[value_i];
90 out_values[value_i] =
Vector3(val->x(), val->y(), val->z());
93 std::move(out_times), std::move(out_values));
96 case fb::Keyframes::NONE:
102 result->channels_.push_back(std::move(out_channel));
108Animation::Animation() =
default;
static SkISize times(const SkISize &size, float factor)
static void copy(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
SecondsF GetEndTime() const
const std::vector< Channel > & GetChannels() const
static std::shared_ptr< Animation > MakeFromFlatbuffer(const fb::Animation &animation, const std::vector< std::shared_ptr< Node > > &scene_nodes)
const std::string & GetName() const
static std::unique_ptr< RotationTimelineResolver > MakeRotationTimeline(std::vector< Scalar > times, std::vector< Quaternion > values)
static std::unique_ptr< ScaleTimelineResolver > MakeScaleTimeline(std::vector< Scalar > times, std::vector< Vector3 > values)
static std::unique_ptr< TranslationTimelineResolver > MakeTranslationTimeline(std::vector< Scalar > times, std::vector< Vector3 > values)
static float max(float r, float g, float b)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
std::chrono::duration< float > SecondsF
std::unique_ptr< PropertyResolver > resolver