[skottie] Fix single-node camera orientation relative to z=0 plane
One-node cameras start off by pointing forward, where "forward" is decreasing z (as opposed to always facing z==0, as they currently do). Change-Id: I2ccd5a7cf7d8f0aeeebde1537d44e188aabccd04 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255117 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
This commit is contained in:
parent
1fbdfcd853
commit
684929ceb1
@ -142,14 +142,15 @@ sk_sp<CameraAdapter> CameraAdapter::MakeDefault(const SkSize &viewport_size) {
|
||||
SkPoint3 CameraAdapter::poi() const {
|
||||
// AE supports two camera types:
|
||||
//
|
||||
// - one-node camera: does not auto-orient, and starts off perpendicular to the z = 0 plane.
|
||||
// - one-node camera: does not auto-orient, and starts off perpendicular to the z = 0 plane,
|
||||
// facing "forward" (decreasing z).
|
||||
//
|
||||
// - two-node camera: has a point of interest (encoded as the anchor point), and auto-orients
|
||||
// to point in its direction.
|
||||
return fType == Type::kOneNode
|
||||
? SkPoint3{ this->getPosition().fX,
|
||||
this->getPosition().fY,
|
||||
0 }
|
||||
-this->getPosition().fZ - 1 }
|
||||
: SkPoint3{ this->getAnchorPoint().fX,
|
||||
this->getAnchorPoint().fY,
|
||||
-this->getAnchorPoint().fZ};
|
||||
|
@ -173,7 +173,7 @@ private:
|
||||
class CameraAdapter final : public TransformAdapter3D {
|
||||
public:
|
||||
enum class Type {
|
||||
kOneNode, // implicitly facing the z == 0 plane, does not auto-orient
|
||||
kOneNode, // implicitly facing forward (decreasing z), does not auto-orient
|
||||
kTwoNode, // explicitly facing a POI (the anchor point), auto-orients
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user