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

Side by Side Diff: gm/lightingshaderbevel.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 | « gm/lightingshader2.cpp ('k') | gm/shadowmaps.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 "gm.h" 8 #include "gm.h"
9 #include "SkLightingShader.h" 9 #include "SkLightingShader.h"
10 #include "SkNormalSource.h" 10 #include "SkNormalSource.h"
(...skipping 18 matching lines...) Expand all
29 29
30 SkISize onISize() override { 30 SkISize onISize() override {
31 return SkISize::Make(SkScalarCeilToInt(GRID_NUM_COLUMNS * GRID_CELL_WIDT H), 31 return SkISize::Make(SkScalarCeilToInt(GRID_NUM_COLUMNS * GRID_CELL_WIDT H),
32 SkScalarCeilToInt(GRID_NUM_ROWS * GRID_CELL_WIDT H)); 32 SkScalarCeilToInt(GRID_NUM_ROWS * GRID_CELL_WIDT H));
33 } 33 }
34 34
35 void onOnceBeforeDraw() override { 35 void onOnceBeforeDraw() override {
36 SkLights::Builder builder; 36 SkLights::Builder builder;
37 const SkVector3 kLightFromUpperRight = SkVector3::Make(0.788f, 0.394f, 0 .473f); 37 const SkVector3 kLightFromUpperRight = SkVector3::Make(0.788f, 0.394f, 0 .473f);
38 38
39 builder.add(SkLights::Light(SkColor3f::Make(1.0f, 1.0f, 1.0f), 39 builder.add(SkLights::Light::MakeDirectional(SkColor3f::Make(1.0f, 1.0f, 1.0f),
40 kLightFromUpperRight)); 40 kLightFromUpperRight));
41 builder.add(SkLights::Light(SkColor3f::Make(0.2f, 0.2f, 0.2f))); 41 builder.add(SkLights::Light::MakeAmbient(SkColor3f::Make(0.2f, 0.2f, 0.2 f)));
42 fLights = builder.finish(); 42 fLights = builder.finish();
43 43
44 // fRect is assumed to be square throughout this file 44 // fRect is assumed to be square throughout this file
45 fRect = SkRect::MakeIWH(kTexSize, kTexSize); 45 fRect = SkRect::MakeIWH(kTexSize, kTexSize);
46 SkMatrix matrix; 46 SkMatrix matrix;
47 SkRect bitmapBounds = SkRect::MakeIWH(kTexSize, kTexSize); 47 SkRect bitmapBounds = SkRect::MakeIWH(kTexSize, kTexSize);
48 matrix.setRectToRect(bitmapBounds, fRect, SkMatrix::kFill_ScaleToFit); 48 matrix.setRectToRect(bitmapBounds, fRect, SkMatrix::kFill_ScaleToFit);
49 49
50 SkBitmap diffuseMap = sk_tool_utils::create_checkerboard_bitmap( 50 SkBitmap diffuseMap = sk_tool_utils::create_checkerboard_bitmap(
51 kTexSize, kTexSize, 51 kTexSize, kTexSize,
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 SkPath fConcavePath; 258 SkPath fConcavePath;
259 sk_sp<SkLights> fLights; 259 sk_sp<SkLights> fLights;
260 260
261 typedef GM INHERITED; 261 typedef GM INHERITED;
262 }; 262 };
263 263
264 ////////////////////////////////////////////////////////////////////////////// 264 //////////////////////////////////////////////////////////////////////////////
265 265
266 DEF_GM(return new LightingShaderBevelGM;) 266 DEF_GM(return new LightingShaderBevelGM;)
267 } 267 }
OLDNEW
« no previous file with comments | « gm/lightingshader2.cpp ('k') | gm/shadowmaps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698