| Index: include/core/SkLights.h
|
| diff --git a/include/core/SkLights.h b/include/core/SkLights.h
|
| index 1371e441d4894a9d1060012e54fab0aa236f117c..d8ec87d53271ed26a15f4d0c9e06ac60405e7759 100644
|
| --- a/include/core/SkLights.h
|
| +++ b/include/core/SkLights.h
|
| @@ -22,6 +22,7 @@
|
| class Light {
|
| public:
|
| enum LightType {
|
| + kAmbient_LightType, // only 'fColor' is used
|
| kDirectional_LightType,
|
| kPoint_LightType
|
| };
|
| @@ -40,6 +41,10 @@
|
| , fDirOrPos(other.fDirOrPos)
|
| , fIntensity(other.fIntensity)
|
| , fShadowMap(std::move(other.fShadowMap)) {
|
| + }
|
| +
|
| + static Light MakeAmbient(const SkColor3f& color) {
|
| + return Light(kAmbient_LightType, color, SkVector3::Make(0.0f, 0.0f, 1.0f));
|
| }
|
|
|
| static Light MakeDirectional(const SkColor3f& color, const SkVector3& dir) {
|
| @@ -118,17 +123,17 @@
|
| sk_sp<SkImage> fShadowMap;
|
|
|
| Light(LightType type, const SkColor3f& color,
|
| - const SkVector3& dirOrPos, SkScalar intensity = 0.0f) {
|
| + const SkVector3& dir, SkScalar intensity = 0.0f) {
|
| fType = type;
|
| fColor = color;
|
| - fDirOrPos = dirOrPos;
|
| + fDirOrPos = dir;
|
| fIntensity = intensity;
|
| }
|
| };
|
|
|
| class Builder {
|
| public:
|
| - Builder() : fLights(new SkLights) {}
|
| + Builder() : fLights(new SkLights) { }
|
|
|
| void add(const Light& light) {
|
| if (fLights) {
|
| @@ -139,12 +144,6 @@
|
| void add(Light&& light) {
|
| if (fLights) {
|
| fLights->fLights.push_back(std::move(light));
|
| - }
|
| - }
|
| -
|
| - void setAmbientLightColor(const SkColor3f& color) {
|
| - if (fLights) {
|
| - fLights->fAmbientLightColor = color;
|
| }
|
| }
|
|
|
| @@ -168,20 +167,13 @@
|
| return fLights[index];
|
| }
|
|
|
| - const SkColor3f& ambientLightColor() const {
|
| - return fAmbientLightColor;
|
| - }
|
| -
|
| static sk_sp<SkLights> MakeFromBuffer(SkReadBuffer& buf);
|
|
|
| void flatten(SkWriteBuffer& buf) const;
|
|
|
| private:
|
| - SkLights() {
|
| - fAmbientLightColor.set(0.0f, 0.0f, 0.0f);
|
| - }
|
| + SkLights() {}
|
| SkTArray<Light> fLights;
|
| - SkColor3f fAmbientLightColor;
|
| typedef SkRefCnt INHERITED;
|
| };
|
|
|
|
|