Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
CameraSlide Class Reference
Inheritance diagram for CameraSlide:
Slide ClickHandlerSlide SkRefCnt Slide SkRefCntBase SkRefCnt SkRefCntBase

Public Member Functions

SkM44 get44 (const SkRect &r) const
 
bool onChar (SkUnichar uni) override
 
- Public Member Functions inherited from Slide
virtual SkISize getDimensions () const
 
virtual void gpuTeardown ()
 
virtual void draw (SkCanvas *canvas)=0
 
virtual bool animate (double nanos)
 
virtual void load (SkScalar winWidth, SkScalar winHeight)
 
virtual void resize (SkScalar winWidth, SkScalar winHeight)
 
virtual void unload ()
 
virtual bool onChar (SkUnichar c)
 
virtual bool onMouse (SkScalar x, SkScalar y, skui::InputState state, skui::ModifierKey modifiers)
 
virtual bool onGetControls (SkMetaData *)
 
virtual void onSetControls (const SkMetaData &)
 
const SkStringgetName ()
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 
- Public Member Functions inherited from ClickHandlerSlide
bool onMouse (SkScalar x, SkScalar y, skui::InputState clickState, skui::ModifierKey modifierKeys) final
 

Additional Inherited Members

- Protected Member Functions inherited from ClickHandlerSlide
virtual ClickonFindClickHandler (SkScalar x, SkScalar y, skui::ModifierKey modi)=0
 
virtual bool onClick (Click *)=0
 
- Protected Attributes inherited from Slide
SkString fName
 

Detailed Description

Definition at line 437 of file ClipSlide.cpp.

Member Function Documentation

◆ get44()

SkM44 CameraSlide::get44 ( const SkRect r) const
inline

Definition at line 462 of file ClipSlide.cpp.

462 {
463 SkScalar w = r.width();
464 SkScalar h = r.height();
465
466 SkM44 camera = SkM44::LookAt(fEye, fCOA, fUp),
467 perspective = SkM44::Perspective(fNear, fFar, fAngle),
468 translate = SkM44::Translate(fTrans.x, fTrans.y, fTrans.z),
469 viewport = SkM44::Translate(r.centerX(), r.centerY(), 0) *
470 SkM44::Scale(w*0.5f, h*0.5f, 1);
471
472 return viewport * perspective * camera * translate * fRot * inv(viewport);
473 }
static SkM44 inv(const SkM44 &m)
Definition: ClipSlide.cpp:427
Definition: SkM44.h:150
static SkM44 LookAt(const SkV3 &eye, const SkV3 &center, const SkV3 &up)
Definition: SkM44.cpp:331
static SkM44 Translate(SkScalar x, SkScalar y, SkScalar z=0)
Definition: SkM44.h:225
static SkM44 Perspective(float near, float far, float angle)
Definition: SkM44.cpp:343
static SkM44 Scale(SkScalar x, SkScalar y, SkScalar z=1)
Definition: SkM44.h:232
float SkScalar
Definition: extension.cpp:12
SkScalar w
SkScalar h
constexpr float centerX() const
Definition: SkRect.h:776
constexpr float height() const
Definition: SkRect.h:769
constexpr float centerY() const
Definition: SkRect.h:785
constexpr float width() const
Definition: SkRect.h:762
float y
Definition: SkM44.h:57
float z
Definition: SkM44.h:57
float x
Definition: SkM44.h:57

◆ onChar()

bool CameraSlide::onChar ( SkUnichar  uni)
inlineoverridevirtual

Reimplemented from Slide.

Definition at line 475 of file ClipSlide.cpp.

475 {
476 float delta = SK_ScalarPI / 30;
477 switch (uni) {
478 case '8': this->rotate( delta, 0, 0); return true;
479 case '2': this->rotate(-delta, 0, 0); return true;
480 case '4': this->rotate(0, delta, 0); return true;
481 case '6': this->rotate(0, -delta, 0); return true;
482 case '-': this->rotate(0, 0, delta); return true;
483 case '+': this->rotate(0, 0, -delta); return true;
484
485 case 'i': fTrans.z += 0.1f; SkDebugf("z %g\n", fTrans.z); return true;
486 case 'k': fTrans.z -= 0.1f; SkDebugf("z %g\n", fTrans.z); return true;
487
488 case 'n': fNear += 0.1f; SkDebugf("near %g\n", fNear); return true;
489 case 'N': fNear -= 0.1f; SkDebugf("near %g\n", fNear); return true;
490 case 'f': fFar += 0.1f; SkDebugf("far %g\n", fFar); return true;
491 case 'F': fFar -= 0.1f; SkDebugf("far %g\n", fFar); return true;
492 default: break;
493 }
494 return false;
495 }
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static bool rotate(const SkDCubic &cubic, int zero, int index, SkDCubic &rotPath)
#define SK_ScalarPI
Definition: SkScalar.h:21

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