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

Side by Side Diff: samplecode/SampleLitAtlas.cpp

Issue 2237493002: Added PointLights to SkLights::Light (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: fixed serialization bug 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 unified diff | Download patch
« no previous file with comments | « samplecode/SampleLighting.cpp ('k') | samplecode/SampleShadowing.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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 kShip_ObjType, 175 kShip_ObjType,
176 176
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(SkColor3f::Make(1.0f, 1.0f, 1.0f), fLightDir )); 185 builder.add(SkLights::Light::MakeDirectional(
186 builder.add(SkLights::Light(SkColor3f::Make(0.2f, 0.2f, 0.2f))); 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 188
188 fLights = builder.finish(); 189 fLights = builder.finish();
189 } 190 }
190 191
191 #ifdef SK_DEBUG 192 #ifdef SK_DEBUG
192 // Draw a vector to the light 193 // Draw a vector to the light
193 void drawLightDir(SkCanvas* canvas, SkScalar centerX, SkScalar centerY) { 194 void drawLightDir(SkCanvas* canvas, SkScalar centerX, SkScalar centerY) {
194 static const int kBgLen = 30; 195 static const int kBgLen = 30;
195 static const int kSmLen = 5; 196 static const int kSmLen = 5;
196 197
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 private: 508 private:
508 SkAutoTUnref<DrawLitAtlasDrawable> fDrawable; 509 SkAutoTUnref<DrawLitAtlasDrawable> fDrawable;
509 510
510 typedef SampleView INHERITED; 511 typedef SampleView INHERITED;
511 }; 512 };
512 513
513 ////////////////////////////////////////////////////////////////////////////// 514 //////////////////////////////////////////////////////////////////////////////
514 515
515 static SkView* MyFactory() { return new DrawLitAtlasView; } 516 static SkView* MyFactory() { return new DrawLitAtlasView; }
516 static SkViewRegister reg(MyFactory); 517 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleLighting.cpp ('k') | samplecode/SampleShadowing.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698