OLD | NEW |
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 Loading... |
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 Loading... |
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); |
OLD | NEW |