Flutter Engine
The Flutter Engine
Classes | Public Member Functions | List of all members
Sk3DView Class Reference

#include <SkCamera.h>

Inheritance diagram for Sk3DView:
SkNoncopyable

Public Member Functions

 Sk3DView ()
 
 ~Sk3DView ()
 
void save ()
 
void restore ()
 
void translate (SkScalar x, SkScalar y, SkScalar z)
 
void rotateX (SkScalar deg)
 
void rotateY (SkScalar deg)
 
void rotateZ (SkScalar deg)
 
void getMatrix (SkMatrix *) const
 
void applyToCanvas (SkCanvas *) const
 
SkScalar dotWithNormal (SkScalar dx, SkScalar dy, SkScalar dz) const
 

Detailed Description

Definition at line 74 of file SkCamera.h.

Constructor & Destructor Documentation

◆ Sk3DView()

Sk3DView::Sk3DView ( )

Definition at line 152 of file SkCamera.cpp.

152 {
153 fRec = &fInitialRec;
154}

◆ ~Sk3DView()

Sk3DView::~Sk3DView ( )

Definition at line 156 of file SkCamera.cpp.

156 {
157 Rec* rec = fRec;
158 while (rec != &fInitialRec) {
159 Rec* next = rec->fNext;
160 delete rec;
161 rec = next;
162 }
163}
static float next(float f)

Member Function Documentation

◆ applyToCanvas()

void Sk3DView::applyToCanvas ( SkCanvas canvas) const

Definition at line 234 of file SkCamera.cpp.

234 {
236
237 this->getMatrix(&matrix);
238 canvas->concat(matrix);
239}
void getMatrix(SkMatrix *) const
Definition: SkCamera.cpp:224
void concat(const SkMatrix &matrix)
Definition: SkCanvas.cpp:1318
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258

◆ dotWithNormal()

SkScalar Sk3DView::dotWithNormal ( SkScalar  dx,
SkScalar  dy,
SkScalar  dz 
) const

Definition at line 218 of file SkCamera.cpp.

218 {
219 SkPatch3D patch;
220 patch.transform(fRec->fMatrix);
221 return patch.dotWith(x, y, z);
222}
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
double y
double x

◆ getMatrix()

void Sk3DView::getMatrix ( SkMatrix matrix) const

Definition at line 224 of file SkCamera.cpp.

224 {
225 if (matrix != nullptr) {
226 SkPatch3D patch;
227 patch.transform(fRec->fMatrix);
228 fCamera.patchToMatrix(patch, matrix);
229 }
230}
void patchToMatrix(const SkPatch3D &, SkMatrix *matrix) const
Definition: SkCamera.cpp:113

◆ restore()

void Sk3DView::restore ( )

Definition at line 172 of file SkCamera.cpp.

172 {
173 SkASSERT(fRec != &fInitialRec);
174 Rec* next = fRec->fNext;
175 delete fRec;
176 fRec = next;
177}
#define SkASSERT(cond)
Definition: SkAssert.h:116

◆ rotateX()

void Sk3DView::rotateX ( SkScalar  deg)

Definition at line 206 of file SkCamera.cpp.

206 {
207 fRec->fMatrix.preConcat(SkM44::Rotate({1, 0, 0}, deg * SK_ScalarPI / 180));
208}
#define SK_ScalarPI
Definition: SkScalar.h:21
static SkM44 Rotate(SkV3 axis, SkScalar radians)
Definition: SkM44.h:239

◆ rotateY()

void Sk3DView::rotateY ( SkScalar  deg)

Definition at line 210 of file SkCamera.cpp.

210 {
211 fRec->fMatrix.preConcat(SkM44::Rotate({0,-1, 0}, deg * SK_ScalarPI / 180));
212}

◆ rotateZ()

void Sk3DView::rotateZ ( SkScalar  deg)

Definition at line 214 of file SkCamera.cpp.

214 {
215 fRec->fMatrix.preConcat(SkM44::Rotate({0, 0, 1}, deg * SK_ScalarPI / 180));
216}

◆ save()

void Sk3DView::save ( )

Definition at line 165 of file SkCamera.cpp.

165 {
166 Rec* rec = new Rec;
167 rec->fNext = fRec;
168 rec->fMatrix = fRec->fMatrix;
169 fRec = rec;
170}

◆ translate()

void Sk3DView::translate ( SkScalar  x,
SkScalar  y,
SkScalar  z 
)

Definition at line 202 of file SkCamera.cpp.

202 {
203 fRec->fMatrix.preTranslate(x, y, z);
204}

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