11#include "flutter/fml/logging.h"
21 const std::vector<std::shared_ptr<Node>>& scene_nodes) {
22 if (!skin.joints() || !skin.inverse_bind_matrices() ||
23 skin.joints()->size() != skin.inverse_bind_matrices()->size()) {
30 result.joints_.reserve(skin.joints()->size());
31 for (
auto joint : *skin.joints()) {
32 if (joint < 0 ||
static_cast<size_t>(joint) > scene_nodes.size()) {
34 result.joints_.push_back(
nullptr);
37 if (scene_nodes[joint]) {
38 scene_nodes[joint]->SetIsJoint(
true);
40 result.joints_.push_back(scene_nodes[joint]);
43 result.inverse_bind_matrices_.reserve(skin.inverse_bind_matrices()->size());
44 for (
size_t matrix_i = 0; matrix_i < skin.inverse_bind_matrices()->
size();
46 const auto* ip_matrix = skin.inverse_bind_matrices()->Get(matrix_i);
51 result.joints_[matrix_i]->SetGlobalTransform(
matrix.Invert());
54 return std::make_unique<Skin>(std::move(
result));
57Skin::Skin() =
default;
61Skin::Skin(
Skin&&) =
default;
68 auto required_pixels = joints_.size() * 4;
76 texture_descriptor.
size = {dimension_size, dimension_size};
80 result->SetLabel(
"Joints Texture");
86 std::vector<Matrix> joints;
89 for (
size_t joint_i = 0; joint_i < joints_.size(); joint_i++) {
90 const Node* joint = joints_[joint_i].get();
98 while (joint && joint->
IsJoint()) {
110 joints[joint_i] = joints[joint_i] * inverse_bind_matrices_[joint_i];
113 if (!
result->SetContents(
reinterpret_cast<uint8_t*
>(joints.data()),
114 joints.size() *
sizeof(
Matrix))) {
115 FML_LOG(
ERROR) <<
"Could not set contents of joint texture.";
static uint32_t NextPowerOfTwoSize(uint32_t x)
An object that allocates device memory.
std::shared_ptr< Texture > CreateTexture(const TextureDescriptor &desc)
Matrix GetLocalTransform() const
std::shared_ptr< Texture > GetJointsTexture(Allocator &allocator)
static std::unique_ptr< Skin > MakeFromFlatbuffer(const fb::Skin &skin, const std::vector< std::shared_ptr< Node > > &scene_nodes)
Skin & operator=(Skin &&)
#define FML_LOG(severity)
#define FML_DCHECK(condition)
static float max(float r, float g, float b)
unsigned useCenter Optional< SkMatrix > matrix
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
Matrix ToMatrix(const std::vector< double > &m)
SK_API sk_sp< PrecompileColorFilter > Matrix()
SIN Vec< N, float > sqrt(const Vec< N, float > &x)
SIN Vec< N, float > ceil(const Vec< N, float > &x)
A 4x4 matrix using column-major storage.
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...