Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Functions | Variables
3DSlide.cpp File Reference
#include "include/core/SkCanvas.h"
#include "include/core/SkM44.h"
#include "include/core/SkPaint.h"
#include "include/core/SkRRect.h"
#include "include/core/SkStream.h"
#include "include/core/SkVertices.h"
#include "src/base/SkRandom.h"
#include "tools/DecodeUtils.h"
#include "tools/Resources.h"
#include "tools/viewer/ClickHandlerSlide.h"
#include "include/effects/SkRuntimeEffect.h"
#include "src/base/SkTime.h"
#include "modules/skottie/include/Skottie.h"

Go to the source code of this file.

Classes

struct  VSphere
 
struct  VSphere::RotateInfo
 
class  ThreeDSlide
 
struct  Face
 
struct  LightOnSphere
 
class  RotateAnimator
 
class  CubeBaseSlide
 
class  Bump3DSlide
 
class  SkottieCubeSlide
 

Functions

static SkM44 inv (const SkM44 &m)
 
static SkM44 normals (SkM44 m)
 
static bool isFrontFacing (const SkM44 &m)
 

Variables

const Face faces []
 

Function Documentation

◆ inv()

static SkM44 inv ( const SkM44 m)
static

Definition at line 71 of file 3DSlide.cpp.

71 {
72 SkM44 inverse;
73 SkAssertResult(m.invert(&inverse));
74 return inverse;
75}
#define SkAssertResult(cond)
Definition SkAssert.h:123
Definition SkM44.h:150

◆ isFrontFacing()

static bool isFrontFacing ( const SkM44 m)
static

Definition at line 123 of file 3DSlide.cpp.

123 {
125 if (!m.invert(&m2)) {
126 m2.setIdentity();
127 }
128 /*
129 * Classically we want to dot the transpose(inverse(ctm)) with our surface normal.
130 * In this case, the normal is known to be {0, 0, 1}, so we only actually need to look
131 * at the z-scale of the inverse (the transpose doesn't change the main diagonal, so
132 * no need to actually transpose).
133 */
134 return m2.rc(2,2) > 0;
135}
@ kUninitialized_Constructor
Definition SkM44.h:167

◆ normals()

static SkM44 normals ( SkM44  m)
static

Definition at line 78 of file 3DSlide.cpp.

78 {
79 m.setRow(3, {0, 0, 0, 1});
80 m.setCol(3, {0, 0, 0, 1});
81 SkAssertResult(m.invert(&m));
82 return m.transpose();
83}

Variable Documentation

◆ faces

const Face faces[]
Initial value:
= {
{ 0, 0, SK_ColorRED },
}
constexpr SkColor SK_ColorYELLOW
Definition SkColor.h:139
constexpr SkColor SK_ColorMAGENTA
Definition SkColor.h:147
constexpr SkColor SK_ColorCYAN
Definition SkColor.h:143
constexpr SkColor SK_ColorBLUE
Definition SkColor.h:135
constexpr SkColor SK_ColorRED
Definition SkColor.h:126
constexpr SkColor SK_ColorGREEN
Definition SkColor.h:131
#define SK_ScalarPI
Definition SkScalar.h:21

Definition at line 137 of file 3DSlide.cpp.

137 {
138 { 0, 0, SK_ColorRED }, // front
139 { 0, SK_ScalarPI, SK_ColorGREEN }, // back
140
141 { SK_ScalarPI/2, 0, SK_ColorBLUE }, // top
142 {-SK_ScalarPI/2, 0, SK_ColorCYAN }, // bottom
143
144 { 0, SK_ScalarPI/2, SK_ColorMAGENTA }, // left
145 { 0,-SK_ScalarPI/2, SK_ColorYELLOW }, // right
146};