Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
skottie::internal::CameraAdaper Class Referencefinal

#include <Camera.h>

Inheritance diagram for skottie::internal::CameraAdaper:
skottie::internal::TransformAdapter3D skottie::internal::DiscardableAdapterBase< TransformAdapter3D, sksg::Matrix< SkM44 > > skottie::internal::AnimatablePropertyContainer skottie::internal::Animator SkRefCnt SkRefCntBase

Public Member Functions

 CameraAdaper (const skjson::ObjectValue &jlayer, const skjson::ObjectValue &jtransform, const AnimationBuilder &abuilder, const SkSize &viewport_size)
 
 ~CameraAdaper () override
 
SkM44 totalMatrix () const override
 
- Public Member Functions inherited from skottie::internal::TransformAdapter3D
 TransformAdapter3D (const skjson::ObjectValue &, const AnimationBuilder &)
 
 ~TransformAdapter3D () override
 
virtual SkM44 totalMatrix () const
 
- Public Member Functions inherited from skottie::internal::DiscardableAdapterBase< TransformAdapter3D, sksg::Matrix< SkM44 > >
const sk_sp< sksg::Matrix< SkM44 > > & node () const
 
- Public Member Functions inherited from skottie::internal::AnimatablePropertyContainer
template<typename T >
bool bind (const AnimationBuilder &, const skjson::ObjectValue *, T *)
 
template<typename T >
bool bind (const AnimationBuilder &abuilder, const skjson::ObjectValue *jobject, T &v)
 
bool bindAutoOrientable (const AnimationBuilder &abuilder, const skjson::ObjectValue *jobject, SkV2 *v, float *orientation)
 
bool isStatic () const
 
template<>
bool bind (const AnimationBuilder &abuilder, const skjson::ObjectValue *jprop, ScalarValue *v)
 
template<>
bool bind (const AnimationBuilder &abuilder, const skjson::ObjectValue *jprop, ShapeValue *v)
 
template<>
bool bind (const AnimationBuilder &abuilder, const skjson::ObjectValue *jprop, TextValue *v)
 
template<>
bool bind (const AnimationBuilder &abuilder, const skjson::ObjectValue *jprop, Vec2Value *v)
 
template<>
bool bind (const AnimationBuilder &abuilder, const skjson::ObjectValue *jprop, VectorValue *v)
 
template<>
bool bind (const AnimationBuilder &abuilder, const skjson::ObjectValue *jprop, ColorValue *v)
 
- Public Member Functions inherited from skottie::internal::Animator
StateChanged seek (float t)
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Static Public Member Functions

static sk_sp< sksg::TransformDefaultCameraTransform (const SkSize &viewport_size)
 
- Static Public Member Functions inherited from skottie::internal::DiscardableAdapterBase< TransformAdapter3D, sksg::Matrix< SkM44 > >
static sk_sp< TransformAdapter3DMake (Args &&... args)
 

Additional Inherited Members

- Public Types inherited from skottie::internal::Animator
using StateChanged = bool
 
- Protected Member Functions inherited from skottie::internal::TransformAdapter3D
SkV3 anchor_point () const
 
SkV3 position () const
 
SkV3 rotation () const
 
- Protected Member Functions inherited from skottie::internal::DiscardableAdapterBase< TransformAdapter3D, sksg::Matrix< SkM44 > >
 DiscardableAdapterBase ()
 
 DiscardableAdapterBase (sk_sp< sksg::Matrix< SkM44 > > node)
 
- Protected Member Functions inherited from skottie::internal::AnimatablePropertyContainer
virtual void onSync ()=0
 
void shrink_to_fit ()
 
void attachDiscardableAdapter (sk_sp< AnimatablePropertyContainer >)
 
- Protected Member Functions inherited from skottie::internal::Animator
 Animator ()=default
 
virtual StateChanged onSeek (float t)=0
 

Detailed Description

Definition at line 28 of file Camera.h.

Constructor & Destructor Documentation

◆ CameraAdaper()

skottie::internal::CameraAdaper::CameraAdaper ( const skjson::ObjectValue jlayer,
const skjson::ObjectValue jtransform,
const AnimationBuilder abuilder,
const SkSize viewport_size 
)

Definition at line 60 of file Camera.cpp.

64 : INHERITED(jtransform, abuilder)
65 , fViewportSize(viewport_size)
66 // The presence of an anchor point property ('a') differentiates
67 // one-node vs. two-node cameras.
68 , fType(jtransform["a"].is<skjson::NullValue>() ? CameraType::kOneNode
69 : CameraType::kTwoNode) {
70 // 'pe' (perspective?) corresponds to AE's "zoom" camera property.
71 this->bind(abuilder, jlayer["pe"], fZoom);
72}
bool bind(const AnimationBuilder &, const skjson::ObjectValue *, T *)

◆ ~CameraAdaper()

skottie::internal::CameraAdaper::~CameraAdaper ( )
overridedefault

Member Function Documentation

◆ DefaultCameraTransform()

sk_sp< sksg::Transform > skottie::internal::CameraAdaper::DefaultCameraTransform ( const SkSize viewport_size)
static

Definition at line 110 of file Camera.cpp.

110 {
111 const auto center = SkVector::Make(viewport_size.width() * 0.5f,
112 viewport_size.height() * 0.5f);
113
114 static constexpr float kDefaultAEZoom = 879.13f;
115
116 const SkV3 pos = { center.fX, center.fY, -kDefaultAEZoom },
117 poi = { pos.x, pos.y, -pos.z - 1 },
118 rot = { 0, 0, 0 };
119
121 ComputeCameraMatrix(pos, poi, rot, viewport_size, kDefaultAEZoom));
122}
SkPoint pos
static sk_sp< Matrix > Make(const T &m)
Definition: SkSGTransform.h:70
static constexpr SkPoint Make(float x, float y)
Definition: SkPoint_impl.h:173
constexpr float y() const
Definition: SkPoint_impl.h:187
constexpr float x() const
Definition: SkPoint_impl.h:181
SkScalar width() const
Definition: SkSize.h:76
SkScalar height() const
Definition: SkSize.h:77
Definition: SkM44.h:56

◆ totalMatrix()

SkM44 skottie::internal::CameraAdaper::totalMatrix ( ) const
overridevirtual

Reimplemented from skottie::internal::TransformAdapter3D.

Definition at line 76 of file Camera.cpp.

76 {
77 // Camera parameters:
78 //
79 // * location -> position attribute
80 // * point of interest -> anchor point attribute (two-node camera only)
81 // * orientation -> rotation attribute
82 //
83 const auto position = this->position();
84
85 return ComputeCameraMatrix(position,
86 this->poi(position),
87 this->rotation(),
88 fViewportSize,
89 fZoom);
90}

The documentation for this class was generated from the following files: