Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
scene_node.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_LIB_UI_PAINTING_SCENE_SCENE_NODE_H_
6#define FLUTTER_LIB_UI_PAINTING_SCENE_SCENE_NODE_H_
7
8#include <memory>
9#include <string>
10#include <vector>
11
12#include "flutter/fml/memory/ref_ptr.h"
13#include "flutter/lib/ui/dart_wrapper.h"
14#include "flutter/lib/ui/painting/shader.h"
15
17
18namespace flutter {
19
20class SceneShader;
21
22/// @brief A scene node, which may be a deserialized ipscene asset. This node
23/// can be safely added as a child to multiple scene nodes, whether
24/// they're in the same scene or a different scene. The deserialized
25/// node itself is treated as immutable on the IO thread.
26///
27/// Internally, nodes may have an animation player, which is controlled
28/// via the mutation log in the `DlSceneColorSource`, which is built by
29/// `SceneShader`.
30class SceneNode : public RefCountedDartWrappable<SceneNode> {
31 DEFINE_WRAPPERTYPEINFO();
33
34 public:
36 ~SceneNode() override;
37
38 static void Create(Dart_Handle wrapper);
39
40 std::string initFromAsset(const std::string& asset_name,
41 Dart_Handle completion_callback_handle);
42
43 void initFromTransform(const tonic::Float64List& matrix4);
44
45 void AddChild(Dart_Handle scene_node_handle);
46
47 void SetTransform(const tonic::Float64List& matrix4);
48
49 void SetAnimationState(const std::string& animation_name,
50 bool playing,
51 bool loop,
52 double weight,
53 double time_scale);
54
55 void SeekAnimation(const std::string& animation_name, double time);
56
58
59 private:
60 std::shared_ptr<impeller::scene::Node> node_;
61 std::vector<fml::RefPtr<SceneNode>> children_;
62
63 friend SceneShader;
64};
65
66} // namespace flutter
67
68#endif // FLUTTER_LIB_UI_PAINTING_SCENE_SCENE_NODE_H_
static sk_sp< Effect > Create()
A scene node, which may be a deserialized ipscene asset. This node can be safely added as a child to ...
Definition scene_node.h:30
void SetTransform(const tonic::Float64List &matrix4)
void AddChild(Dart_Handle scene_node_handle)
void initFromTransform(const tonic::Float64List &matrix4)
~SceneNode() override
void SeekAnimation(const std::string &animation_name, double time)
void SetAnimationState(const std::string &animation_name, bool playing, bool loop, double weight, double time_scale)
fml::RefPtr< SceneNode > node(Dart_Handle shader)
std::string initFromAsset(const std::string &asset_name, Dart_Handle completion_callback_handle)
Definition scene_node.cc:35
struct _Dart_Handle * Dart_Handle
Definition dart_api.h:258
#define FML_FRIEND_MAKE_REF_COUNTED(T)