Flutter Engine
The Flutter Engine
Public Member Functions | Protected Attributes | List of all members
ThreeDSlide Class Reference
Inheritance diagram for ThreeDSlide:
ClickHandlerSlide Slide SkRefCnt SkRefCntBase CubeBaseSlide Bump3DSlide SkottieCubeSlide

Public Member Functions

void concatCamera (SkCanvas *canvas, const SkRect &area, SkScalar zscale)
 
- Public Member Functions inherited from ClickHandlerSlide
bool onMouse (SkScalar x, SkScalar y, skui::InputState clickState, skui::ModifierKey modifierKeys) final
 
- 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
 

Protected Attributes

float fNear = 0.05f
 
float fFar = 4
 
float fAngle = SK_ScalarPI / 12
 
SkV3 fEye { 0, 0, 1.0f/std::tan(fAngle/2) - 1 }
 
SkV3 fCOA { 0, 0, 0 }
 
SkV3 fUp { 0, 1, 0 }
 
- Protected Attributes inherited from Slide
SkString fName
 

Additional Inherited Members

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

Detailed Description

Definition at line 85 of file 3DSlide.cpp.

Member Function Documentation

◆ concatCamera()

void ThreeDSlide::concatCamera ( SkCanvas canvas,
const SkRect area,
SkScalar  zscale 
)
inline

Definition at line 96 of file 3DSlide.cpp.

96 {
97 SkM44 camera = SkM44::LookAt(fEye, fCOA, fUp),
98 perspective = SkM44::Perspective(fNear, fFar, fAngle),
99 viewport = SkM44::Translate(area.centerX(), area.centerY(), 0) *
100 SkM44::Scale(area.width()*0.5f, area.height()*0.5f, zscale);
101
102 canvas->concat(viewport * perspective * camera * inv(viewport));
103 }
static SkM44 inv(const SkM44 &m)
Definition: 3DSlide.cpp:71
void concat(const SkMatrix &matrix)
Definition: SkCanvas.cpp:1318
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 fNear
Definition: 3DSlide.cpp:87
float fFar
Definition: 3DSlide.cpp:88
SkV3 fUp
Definition: 3DSlide.cpp:93
SkV3 fEye
Definition: 3DSlide.cpp:91
SkV3 fCOA
Definition: 3DSlide.cpp:92
float fAngle
Definition: 3DSlide.cpp:89
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

Member Data Documentation

◆ fAngle

float ThreeDSlide::fAngle = SK_ScalarPI / 12
protected

Definition at line 89 of file 3DSlide.cpp.

◆ fCOA

SkV3 ThreeDSlide::fCOA { 0, 0, 0 }
protected

Definition at line 92 of file 3DSlide.cpp.

◆ fEye

SkV3 ThreeDSlide::fEye { 0, 0, 1.0f/std::tan(fAngle/2) - 1 }
protected

Definition at line 91 of file 3DSlide.cpp.

◆ fFar

float ThreeDSlide::fFar = 4
protected

Definition at line 88 of file 3DSlide.cpp.

◆ fNear

float ThreeDSlide::fNear = 0.05f
protected

Definition at line 87 of file 3DSlide.cpp.

◆ fUp

SkV3 ThreeDSlide::fUp { 0, 1, 0 }
protected

Definition at line 93 of file 3DSlide.cpp.


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