9 #ifndef SkLights_DEFINED
10 #define SkLights_DEFINED
12 #include "../private/SkTArray.h"
26 kDirectional_LightType,
32 , fColor(other.fColor)
33 , fDirection(other.fDirection)
34 , fShadowMap(other.fShadowMap) {
39 , fColor(other.fColor)
40 , fDirection(other.fDirection)
41 , fShadowMap(std::move(other.fShadowMap)) {
45 return Light(kAmbient_LightType, color, SkVector3::Make(0.0f, 0.0f, 1.0f));
49 Light light(kDirectional_LightType, color, dir);
51 light.fDirection.set(0.0f, 0.0f, 1.0f);
57 return Light(kPoint_LightType, color, pos);
60 LightType type()
const {
return fType; }
61 const SkColor3f& color()
const {
return fColor; }
63 SkASSERT(kDirectional_LightType == fType);
67 SkASSERT(kPoint_LightType == fType);
72 fShadowMap = std::move(shadowMap);
76 return fShadowMap.get();
86 fDirection = b.fDirection;
87 fShadowMap = b.fShadowMap;
91 bool operator== (
const Light& b) {
96 return (fColor == b.fColor) &&
98 (fDirection == b.fDirection) &&
99 (fShadowMap == b.fShadowMap);
102 bool operator!= (
const Light& b) {
return !(this->operator==(b)); }
124 void add(
const Light& light) {
126 fLights->fLights.push_back(light);
130 void add(
Light&& light) {
132 fLights->fLights.push_back(std::move(light));
137 return std::move(fLights);
144 int numLights()
const {
145 return fLights.count();
148 const Light& light(
int index)
const {
149 return fLights[index];
152 Light& light(
int index) {
153 return fLights[index];
162 SkTArray<Light> fLights;
Definition: SkPoint3.h:13
Definition: SkRefCnt.h:135
Definition: SkLights.h:20
Definition: SkLights.h:120
Definition: SkLights.h:22
bool normalize()
Set the point (vector) to be unit-length in the same direction as it already points.
Definition: SkWriteBuffer.h:26
SkImage is an abstraction for drawing a rectagle of pixels, though the particular type of image could...
Definition: SkImage.h:45