25SkM44 ComputeCameraMatrix(
const SkV3& position,
28 const SkSize& viewport_size,
36 { poi.
x, poi.
y, poi.
z },
49 const auto persp_t =
SkM44::Scale(view_size * 0.5f, view_size * 0.5f, 1)
53 viewport_size.
height() * 0.5f,
63 const SkSize& viewport_size)
65 , fViewportSize(viewport_size)
69 : CameraType::kTwoNode) {
71 this->
bind(abuilder, jlayer[
"pe"], fZoom);
101 if (fType == CameraType::kOneNode) {
107 return { ap.x, ap.y, -ap.z };
112 viewport_size.
height() * 0.5f);
114 static constexpr float kDefaultAEZoom = 879.13f;
116 const SkV3 pos = { center.fX, center.fY, -kDefaultAEZoom },
121 ComputeCameraMatrix(
pos, poi, rot, viewport_size, kDefaultAEZoom));
127 const SkSize& viewport_size)
const {
128 auto adapter = sk_make_sp<CameraAdaper>(jlayer, jtransform, *
this, viewport_size);
130 if (adapter->isStatic()) {
133 fCurrentAnimatorScope->push_back(adapter);
static constexpr float sk_ieee_float_divide(float numer, float denom)
#define SkDegreesToRadians(degrees)
static SkM44 LookAt(const SkV3 &eye, const SkV3 ¢er, const SkV3 &up)
static SkM44 Rotate(SkV3 axis, SkScalar radians)
static SkM44 Translate(SkScalar x, SkScalar y, SkScalar z=0)
static SkM44 Perspective(float near, float far, float angle)
static SkM44 Scale(SkScalar x, SkScalar y, SkScalar z=1)
bool bind(const AnimationBuilder &, const skjson::ObjectValue *, T *)
sk_sp< sksg::Transform > attachCamera(const skjson::ObjectValue &jlayer, const skjson::ObjectValue &jtransform, sk_sp< sksg::Transform >, const SkSize &) const
CameraAdaper(const skjson::ObjectValue &jlayer, const skjson::ObjectValue &jtransform, const AnimationBuilder &abuilder, const SkSize &viewport_size)
SkM44 totalMatrix() const override
static sk_sp< sksg::Transform > DefaultCameraTransform(const SkSize &viewport_size)
static sk_sp< Matrix > Make(const T &m)
static float max(float r, float g, float b)
static constexpr SkPoint Make(float x, float y)
constexpr float y() const
constexpr float x() const