| OLD | NEW |
| 1 | |
| 2 /* | 1 /* |
| 3 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 4 * | 3 * |
| 5 * 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 |
| 6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 7 */ | 6 */ |
| 8 | 7 |
| 9 | |
| 10 #ifndef SkLightingShader_DEFINED | 8 #ifndef SkLightingShader_DEFINED |
| 11 #define SkLightingShader_DEFINED | 9 #define SkLightingShader_DEFINED |
| 12 | 10 |
| 13 #include "SkFlattenable.h" | 11 #include "SkFlattenable.h" |
| 14 #include "SkLight.h" | 12 #include "SkLight.h" |
| 15 #include "SkShader.h" | 13 #include "SkShader.h" |
| 16 #include "SkTDArray.h" | 14 #include "SkTDArray.h" |
| 17 | 15 |
| 18 class SkBitmap; | 16 class SkBitmap; |
| 19 class SkMatrix; | 17 class SkMatrix; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 81 |
| 84 The normal map is currently assumed to be an 8888 image where the normal
at a texel | 82 The normal map is currently assumed to be an 8888 image where the normal
at a texel |
| 85 is retrieved by: | 83 is retrieved by: |
| 86 N.x = R-127; | 84 N.x = R-127; |
| 87 N.y = G-127; | 85 N.y = G-127; |
| 88 N.z = B-127; | 86 N.z = B-127; |
| 89 N.normalize(); | 87 N.normalize(); |
| 90 The +Z axis is thus encoded in RGB as (127, 127, 255) while the -Z axis
is | 88 The +Z axis is thus encoded in RGB as (127, 127, 255) while the -Z axis
is |
| 91 (127, 127, 0). | 89 (127, 127, 0). |
| 92 */ | 90 */ |
| 93 static SkShader* Create(const SkBitmap& diffuse, const SkBitmap& normal, | 91 static sk_sp<SkShader> Make(const SkBitmap& diffuse, const SkBitmap& normal, |
| 94 const Lights* lights, const SkVector& invNormRotatio
n, | 92 const Lights* lights, const SkVector& invNormRot
ation, |
| 95 const SkMatrix* diffLocalMatrix, const SkMatrix* nor
mLocalMatrix); | 93 const SkMatrix* diffLocalMatrix, const SkMatrix*
normLocalMatrix); |
| 96 | 94 |
| 97 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 95 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
| 98 }; | 96 }; |
| 99 | 97 |
| 100 #endif | 98 #endif |
| OLD | NEW |