Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(510)

Unified Diff: samplecode/SampleShadowing.cpp

Issue 2287553002: Moved ambient lights out of SkLight's light array (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: made req changes Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: samplecode/SampleShadowing.cpp
diff --git a/samplecode/SampleShadowing.cpp b/samplecode/SampleShadowing.cpp
index 4892f9c27df5c97eb27bd38175a2f59ac5082aac..d3434f3fee200a994c7b0a1771331ca10fdd8efd 100644
--- a/samplecode/SampleShadowing.cpp
+++ b/samplecode/SampleShadowing.cpp
@@ -160,19 +160,21 @@ protected:
}
void updateLights(int x, int y) {
robertphillips 2016/08/26 19:45:00 I'm okay with this change but don't you want to ke
vjiaoblack 2016/08/28 20:11:56 Mmmm..... I was going to do another pass and fix i
+ float recipX = 1.0f / kWidth;
+ float recipY = 1.0f / kHeight;
+
SkLights::Builder builder;
- builder.add(SkLights::Light::MakePoint(SkColor3f::Make(0.2f, 0.4f, 0.6f),
- SkVector3::Make(x - 50,
- 350 - y,
- fLightDepth),
- 1024));
- builder.add(SkLights::Light::MakePoint(SkColor3f::Make(0.6f, 0.4f, 0.2f),
- SkVector3::Make(x + 50,
- 450 - y,
- fLightDepth),
- 1024));
- builder.add(SkLights::Light::MakeDirectional(SkColor3f::Make(0.2f, 0.2f, 0.2f),
- SkVector3::Make(0.2f, 0.2f, 1.0f)));
+ builder.add(SkLights::Light::MakeDirectional(
+ SkColor3f::Make(0.2f, 0.3f, 0.4f),
+ SkVector3::Make(0.2f + (200.0f - x) * recipX,
+ 0.05f + (200.0f - y) * recipY,
+ 1.0f)));
+ builder.add(SkLights::Light::MakeDirectional(
+ SkColor3f::Make(0.4f, 0.3f, 0.2f),
+ SkVector3::Make(0.05f + (200.0f - x) * recipX,
+ 0.2f + (200.0f - y) * recipY,
+ 1.0f)));
+ builder.setAmbientLightColor(SkColor3f::Make(0.4f, 0.4f, 0.4f));
fLights = builder.finish();
}

Powered by Google App Engine
This is Rietveld 408576698