aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar vjiaoblack <vjiaoblack@google.com>2016-08-29 08:38:04 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-29 08:38:04 -0700
commit84cddf6fa7a2ee4a8163f99c9238d5fba6b49566 (patch)
treee14502025540f7fdcf2c3678bde5cdd6ea2de588 /include
parentb398ecc2a41684bd33138a920b446e987b2b30d0 (diff)
Revert of Moved ambient lights out of SkLight's light array (patchset #7 id:120001 of https://codereview.chromium.org/2287553002/ )
Reason for revert: Made Deigo's GM miss their ambient lights Original issue's description: > Moved ambient lights out of SkLight's light array > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2287553002 > > Committed: https://skia.googlesource.com/skia/+/8f98f0aa2d3f7571a890b916c7c4b5ee831e9686 TBR=robertphillips@google.com,djsollen@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review-Url: https://codereview.chromium.org/2291663002
Diffstat (limited to 'include')
-rw-r--r--include/core/SkLights.h26
1 files changed, 9 insertions, 17 deletions
diff --git a/include/core/SkLights.h b/include/core/SkLights.h
index 1371e441d4..d8ec87d532 100644
--- a/include/core/SkLights.h
+++ b/include/core/SkLights.h
@@ -22,6 +22,7 @@ public:
class Light {
public:
enum LightType {
+ kAmbient_LightType, // only 'fColor' is used
kDirectional_LightType,
kPoint_LightType
};
@@ -42,6 +43,10 @@ public:
, 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) {
Light light(kDirectional_LightType, color, dir);
if (!light.fDirOrPos.normalize()) {
@@ -118,17 +123,17 @@ public:
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) {
@@ -142,12 +147,6 @@ public:
}
}
- void setAmbientLightColor(const SkColor3f& color) {
- if (fLights) {
- fLights->fAmbientLightColor = color;
- }
- }
-
sk_sp<SkLights> finish() {
return std::move(fLights);
}
@@ -168,20 +167,13 @@ public:
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;
};