Flutter Engine
The Flutter Engine
SkCamera.h
Go to the documentation of this file.
1/*
2 * Copyright 2006 The Android Open Source Project
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// Inspired by Rob Johnson's most excellent QuickDraw GX sample code
9
10#ifndef SkCamera_DEFINED
11#define SkCamera_DEFINED
12
13#include "include/core/SkM44.h"
18
19// NOTE -- This entire header / impl is deprecated, and will be removed from Skia soon.
20//
21// Skia now has support for a 4x matrix (SkM44) in SkCanvas.
22//
23
24class SkCanvas;
25
26// DEPRECATED
27class SkPatch3D {
28public:
29 SkPatch3D();
30
31 void reset();
32 void transform(const SkM44&, SkPatch3D* dst = nullptr) const;
33
34 // dot a unit vector with the patch's normal
36 SkScalar dotWith(const SkV3& v) const {
37 return this->dotWith(v.x, v.y, v.z);
38 }
39
40 // deprecated, but still here for animator (for now)
41 void rotate(SkScalar /*x*/, SkScalar /*y*/, SkScalar /*z*/) {}
42 void rotateDegrees(SkScalar /*x*/, SkScalar /*y*/, SkScalar /*z*/) {}
43
44private:
45public: // make public for SkDraw3D for now
48
49 friend class SkCamera3D;
50};
51
52// DEPRECATED
54public:
55 SkCamera3D();
56
57 void reset();
58 void update();
59 void patchToMatrix(const SkPatch3D&, SkMatrix* matrix) const;
60
61 SkV3 fLocation; // origin of the camera's space
62 SkV3 fAxis; // view direction
63 SkV3 fZenith; // up direction
64 SkV3 fObserver; // eye position (may not be the same as the origin)
65
66private:
67 mutable SkMatrix fOrientation;
68 mutable bool fNeedToUpdate;
69
70 void doUpdate() const;
71};
72
73// DEPRECATED
75public:
76 Sk3DView();
77 ~Sk3DView();
78
79 void save();
80 void restore();
81
82 void translate(SkScalar x, SkScalar y, SkScalar z);
83 void rotateX(SkScalar deg);
84 void rotateY(SkScalar deg);
85 void rotateZ(SkScalar deg);
86
87#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
88 void setCameraLocation(SkScalar x, SkScalar y, SkScalar z);
89 SkScalar getCameraLocationX() const;
90 SkScalar getCameraLocationY() const;
91 SkScalar getCameraLocationZ() const;
92#endif
93
94 void getMatrix(SkMatrix*) const;
95 void applyToCanvas(SkCanvas*) const;
96
97 SkScalar dotWithNormal(SkScalar dx, SkScalar dy, SkScalar dz) const;
98
99private:
100 struct Rec {
101 Rec* fNext;
103 };
104 Rec* fRec;
105 Rec fInitialRec;
106 SkCamera3D fCamera;
107};
108
109#endif
Instance * fNext
SkMatrix fMatrix
Definition: FillRRectOp.cpp:74
#define SK_API
Definition: SkAPI.h:35
void reset()
Definition: SkCamera.cpp:58
void patchToMatrix(const SkPatch3D &, SkMatrix *matrix) const
Definition: SkCamera.cpp:113
SkV3 fZenith
Definition: SkCamera.h:63
void update()
Definition: SkCamera.cpp:68
SkV3 fLocation
Definition: SkCamera.h:61
SkV3 fObserver
Definition: SkCamera.h:64
SkV3 fAxis
Definition: SkCamera.h:62
Definition: SkM44.h:150
SkV3 fOrigin
Definition: SkCamera.h:47
SkV3 fV
Definition: SkCamera.h:46
void reset()
Definition: SkCamera.cpp:28
void rotate(SkScalar, SkScalar, SkScalar)
Definition: SkCamera.h:41
SkScalar dotWith(SkScalar dx, SkScalar dy, SkScalar dz) const
Definition: SkCamera.cpp:44
void transform(const SkM44 &, SkPatch3D *dst=nullptr) const
Definition: SkCamera.cpp:34
SkV3 fU
Definition: SkCamera.h:46
void rotateDegrees(SkScalar, SkScalar, SkScalar)
Definition: SkCamera.h:42
SkScalar dotWith(const SkV3 &v) const
Definition: SkCamera.h:36
float SkScalar
Definition: extension.cpp:12
double y
double x
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
Definition: SkRecords.h:208
dst
Definition: cp.py:12
Definition: SkM44.h:56
float y
Definition: SkM44.h:57
float z
Definition: SkM44.h:57
float x
Definition: SkM44.h:57