Chromium Code Reviews| Index: include/core/SkLights.h |
| diff --git a/include/core/SkLights.h b/include/core/SkLights.h |
| index c5c54276a39597909ff53a0465a6e97fee5a8743..36d2244bba9838138941549d2b0d5a7be16821a0 100644 |
| --- a/include/core/SkLights.h |
| +++ b/include/core/SkLights.h |
| @@ -12,6 +12,7 @@ |
| #include "SkPoint3.h" |
| #include "SkRefCnt.h" |
| #include "../private/SkTDArray.h" |
| +#include "SkImage.h" |
| class SK_API SkLights : public SkRefCnt { |
| public: |
| @@ -24,14 +25,16 @@ public: |
| Light(const SkColor3f& color) |
| : fType(kAmbient_LightType) |
| - , fColor(color) { |
| + , fColor(color) |
| + , fShadowMap(nullptr) { |
| fDirection.set(0.0f, 0.0f, 1.0f); |
| } |
| Light(const SkColor3f& color, const SkVector3& dir) |
| : fType(kDirectional_LightType) |
| , fColor(color) |
| - , fDirection(dir) { |
| + , fDirection(dir) |
| + , fShadowMap(nullptr) { |
| if (!fDirection.normalize()) { |
| fDirection.set(0.0f, 0.0f, 1.0f); |
| } |
| @@ -44,11 +47,16 @@ public: |
| return fDirection; |
| } |
| + void setShadowMap(sk_sp<SkImage> shadowMap) { |
| + fShadowMap = shadowMap.get(); |
| + } |
| + |
| private: |
| LightType fType; |
| SkColor3f fColor; // linear (unpremul) color. Range is 0..1 in each channel. |
| SkVector3 fDirection; // direction towards the light (+Z is out of the screen). |
| // If degenerate, it will be replaced with (0, 0, 1). |
| + SkImage* fShadowMap; // if we use an sk_sp, this freaking breaks because it's init to nullptr |
| }; |
| class Builder { |
| @@ -77,6 +85,10 @@ public: |
| return fLights[index]; |
| } |
| + Light& editLight(int index) { |
|
jvanverth1
2016/07/18 15:02:26
You can just call this light() like the const vers
vjiaoblack
2016/07/18 16:51:06
Done.
|
| + return fLights[index]; |
| + } |
| + |
| private: |
| SkLights() {} |