OLD | NEW |
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 "gm.h" | 8 #include "gm.h" |
9 #include "SkLightingShader.h" | 9 #include "SkLightingShader.h" |
10 #include "SkNormalSource.h" | 10 #include "SkNormalSource.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 public: | 45 public: |
46 LightingShaderGM() { | 46 LightingShaderGM() { |
47 this->setBGColor(sk_tool_utils::color_to_565(0xFFCCCCCC)); | 47 this->setBGColor(sk_tool_utils::color_to_565(0xFFCCCCCC)); |
48 | 48 |
49 SkLights::Builder builder; | 49 SkLights::Builder builder; |
50 | 50 |
51 builder.add(SkLights::Light::MakeDirectional(SkColor3f::Make(1.0f, 1.0f,
1.0f), | 51 builder.add(SkLights::Light::MakeDirectional(SkColor3f::Make(1.0f, 1.0f,
1.0f), |
52 SkVector3::Make(SK_ScalarRo
ot2Over2, | 52 SkVector3::Make(SK_ScalarRo
ot2Over2, |
53 0.0f, | 53 0.0f, |
54 SK_ScalarRo
ot2Over2))); | 54 SK_ScalarRo
ot2Over2))); |
55 builder.add(SkLights::Light::MakeAmbient(SkColor3f::Make(0.2f, 0.2f, 0.2
f))); | 55 builder.setAmbientLightColor(SkColor3f::Make(0.2f, 0.2f, 0.2f)); |
56 | 56 |
57 fLights = builder.finish(); | 57 fLights = builder.finish(); |
58 } | 58 } |
59 | 59 |
60 protected: | 60 protected: |
61 enum NormalMap { | 61 enum NormalMap { |
62 kHemi_NormalMap, | 62 kHemi_NormalMap, |
63 kFrustum_NormalMap, | 63 kFrustum_NormalMap, |
64 kTetra_NormalMap, | 64 kTetra_NormalMap, |
65 | 65 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 sk_sp<SkLights> fLights; | 173 sk_sp<SkLights> fLights; |
174 | 174 |
175 typedef GM INHERITED; | 175 typedef GM INHERITED; |
176 }; | 176 }; |
177 | 177 |
178 ////////////////////////////////////////////////////////////////////////////// | 178 ////////////////////////////////////////////////////////////////////////////// |
179 | 179 |
180 DEF_GM(return new LightingShaderGM;) | 180 DEF_GM(return new LightingShaderGM;) |
181 } | 181 } |
OLD | NEW |