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

Side by Side Diff: samplecode/SampleLighting.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/SampleBevel.cpp ('k') | samplecode/SampleLitAtlas.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 2015 Google Inc. 2 * Copyright 2015 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 "DecodeFile.h" 8 #include "DecodeFile.h"
9 #include "SampleCode.h" 9 #include "SampleCode.h"
10 #include "Resources.h" 10 #include "Resources.h"
11 #include "SkCanvas.h" 11 #include "SkCanvas.h"
12 #include "SkLightingShader.h" 12 #include "SkLightingShader.h"
13 #include "SkNormalSource.h" 13 #include "SkNormalSource.h"
14 #include "SkPoint3.h" 14 #include "SkPoint3.h"
15 15
16 static sk_sp<SkLights> create_lights(SkScalar angle, SkScalar blue) { 16 static sk_sp<SkLights> create_lights(SkScalar angle, SkScalar blue) {
17 17
18 const SkVector3 dir = SkVector3::Make(SkScalarSin(angle)*SkScalarSin(SK_Scal arPI*0.25f), 18 const SkVector3 dir = SkVector3::Make(SkScalarSin(angle)*SkScalarSin(SK_Scal arPI*0.25f),
19 SkScalarCos(angle)*SkScalarSin(SK_Scal arPI*0.25f), 19 SkScalarCos(angle)*SkScalarSin(SK_Scal arPI*0.25f),
20 SkScalarCos(SK_ScalarPI*0.25f)); 20 SkScalarCos(SK_ScalarPI*0.25f));
21 21
22 SkLights::Builder builder; 22 SkLights::Builder builder;
23 23
24 builder.add(SkLights::Light::MakeDirectional(SkColor3f::Make(1.0f, 1.0f, blu e), dir)); 24 builder.add(SkLights::Light::MakeDirectional(SkColor3f::Make(1.0f, 1.0f, blu e), dir));
25 builder.add(SkLights::Light::MakeAmbient(SkColor3f::Make(0.1f, 0.1f, 0.1f))) ; 25 builder.setAmbientLightColor(SkColor3f::Make(0.1f, 0.1f, 0.1f));
26 26
27 return builder.finish(); 27 return builder.finish();
28 } 28 }
29 29
30 //////////////////////////////////////////////////////////////////////////// 30 ////////////////////////////////////////////////////////////////////////////
31 31
32 class LightingView : public SampleView { 32 class LightingView : public SampleView {
33 public: 33 public:
34 SkBitmap fDiffuseBitmap; 34 SkBitmap fDiffuseBitmap;
35 SkBitmap fNormalBitmap; 35 SkBitmap fNormalBitmap;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 89 }
90 90
91 private: 91 private:
92 typedef SampleView INHERITED; 92 typedef SampleView INHERITED;
93 }; 93 };
94 94
95 ////////////////////////////////////////////////////////////////////////////// 95 //////////////////////////////////////////////////////////////////////////////
96 96
97 static SkView* MyFactory() { return new LightingView; } 97 static SkView* MyFactory() { return new LightingView; }
98 static SkViewRegister reg(MyFactory); 98 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleBevel.cpp ('k') | samplecode/SampleLitAtlas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698