Flutter Engine
The Flutter Engine
Camera.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkottieCamera_DEFINED
9#define SkottieCamera_DEFINED
10
11#include "include/core/SkM44.h"
13#include "include/core/SkSize.h"
16
17namespace skjson {
18class ObjectValue;
19}
20namespace sksg {
21class Transform;
22}
23
24namespace skottie {
25namespace internal {
26class AnimationBuilder;
27
28class CameraAdaper final : public TransformAdapter3D {
29public:
31 const skjson::ObjectValue& jtransform,
32 const AnimationBuilder& abuilder,
33 const SkSize& viewport_size);
34 ~CameraAdaper() override;
35
36 // Used in the absence of an explicit camera layer.
37 static sk_sp<sksg::Transform> DefaultCameraTransform(const SkSize& viewport_size);
38
39 SkM44 totalMatrix() const override;
40
41private:
42 enum class CameraType {
43 kOneNode, // implicitly facing forward (decreasing z), does not auto-orient
44 kTwoNode, // explicitly facing a POI (the anchor point), auto-orients
45 };
46
47 SkV3 poi(const SkV3& pos) const;
48
49 const SkSize fViewportSize;
50 const CameraType fType;
51
52 ScalarValue fZoom = 0;
53
54 using INHERITED = TransformAdapter3D;
55};
56
57} // namespace internal
58} // namespace skottie
59
60#endif // SkottieCamera_DEFINED
SkPoint pos
Definition: SkM44.h:150
CameraAdaper(const skjson::ObjectValue &jlayer, const skjson::ObjectValue &jtransform, const AnimationBuilder &abuilder, const SkSize &viewport_size)
Definition: Camera.cpp:60
SkM44 totalMatrix() const override
Definition: Camera.cpp:76
static sk_sp< sksg::Transform > DefaultCameraTransform(const SkSize &viewport_size)
Definition: Camera.cpp:110
TransformAdapter3D(const skjson::ObjectValue &, const AnimationBuilder &)
Definition: Transform.cpp:148
SkScalar ScalarValue
Definition: SkottieValue.h:22
Definition: Skottie.h:32
skgpu::graphite::Transform Transform
Definition: SkSize.h:52
Definition: SkM44.h:56