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

Side by Side Diff: samplecode/SampleLitAtlas.cpp

Issue 2287553002: Moved ambient lights out of SkLight's light array (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: added ambient light calculations to Raster renderer of LightingShader Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « samplecode/SampleLighting.cpp ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkAnimTimer.h" 9 #include "SkAnimTimer.h"
10 #include "SkBitmapProcShader.h" 10 #include "SkBitmapProcShader.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 kLast_ObjType = kShip_ObjType 177 kLast_ObjType = kShip_ObjType
178 }; 178 };
179 179
180 static const int kObjTypeCount = kLast_ObjType + 1; 180 static const int kObjTypeCount = kLast_ObjType + 1;
181 181
182 void updateLights() { 182 void updateLights() {
183 SkLights::Builder builder; 183 SkLights::Builder builder;
184 184
185 builder.add(SkLights::Light::MakeDirectional( 185 builder.add(SkLights::Light::MakeDirectional(
186 SkColor3f::Make(1.0f, 1.0f, 1.0f), fLightDir)); 186 SkColor3f::Make(1.0f, 1.0f, 1.0f), fLightDir));
187 builder.add(SkLights::Light::MakeAmbient(SkColor3f::Make(0.2f, 0.2f, 0.2 f))); 187 builder.setAmbientLightColor(SkColor3f::Make(0.2f, 0.2f, 0.2f));
188 188
189 fLights = builder.finish(); 189 fLights = builder.finish();
190 } 190 }
191 191
192 #ifdef SK_DEBUG 192 #ifdef SK_DEBUG
193 // Draw a vector to the light 193 // Draw a vector to the light
194 void drawLightDir(SkCanvas* canvas, SkScalar centerX, SkScalar centerY) { 194 void drawLightDir(SkCanvas* canvas, SkScalar centerX, SkScalar centerY) {
195 static const int kBgLen = 30; 195 static const int kBgLen = 30;
196 static const int kSmLen = 5; 196 static const int kSmLen = 5;
197 197
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 private: 508 private:
509 SkAutoTUnref<DrawLitAtlasDrawable> fDrawable; 509 SkAutoTUnref<DrawLitAtlasDrawable> fDrawable;
510 510
511 typedef SampleView INHERITED; 511 typedef SampleView INHERITED;
512 }; 512 };
513 513
514 ////////////////////////////////////////////////////////////////////////////// 514 //////////////////////////////////////////////////////////////////////////////
515 515
516 static SkView* MyFactory() { return new DrawLitAtlasView; } 516 static SkView* MyFactory() { return new DrawLitAtlasView; }
517 static SkViewRegister reg(MyFactory); 517 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleLighting.cpp ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698