OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkBitmapProcState.h" | 9 #include "SkBitmapProcState.h" |
10 #include "SkColor.h" | 10 #include "SkColor.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 161 |
162 this->initClassID<LightingFP>(); | 162 this->initClassID<LightingFP>(); |
163 } | 163 } |
164 | 164 |
165 class LightingGLFP : public GrGLFragmentProcessor { | 165 class LightingGLFP : public GrGLFragmentProcessor { |
166 public: | 166 public: |
167 LightingGLFP() { | 167 LightingGLFP() { |
168 fLightDir.fX = 10000.0f; | 168 fLightDir.fX = 10000.0f; |
169 fLightColor.fX = 0.0f; | 169 fLightColor.fX = 0.0f; |
170 fAmbientColor.fX = 0.0f; | 170 fAmbientColor.fX = 0.0f; |
171 fInvNormRotation.fX = 0.0f; | 171 fInvNormRotation.set(0.0f, 0.0f); |
172 } | 172 } |
173 | 173 |
174 void emitCode(EmitArgs& args) override { | 174 void emitCode(EmitArgs& args) override { |
175 | 175 |
176 GrGLFragmentBuilder* fpb = args.fBuilder->getFragmentShaderBuilder()
; | 176 GrGLFragmentBuilder* fpb = args.fBuilder->getFragmentShaderBuilder()
; |
177 | 177 |
178 // add uniforms | 178 // add uniforms |
179 const char* lightDirUniName = NULL; | 179 const char* lightDirUniName = NULL; |
180 fLightDirUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragme
nt_Visibility, | 180 fLightDirUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragme
nt_Visibility, |
181 kVec3f_GrSLType, kDefault_G
rSLPrecision, | 181 kVec3f_GrSLType, kDefault_G
rSLPrecision, |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 invNormRotation, diffLocalM, normLo
calM)); | 729 invNormRotation, diffLocalM, normLo
calM)); |
730 } | 730 } |
731 | 731 |
732 /////////////////////////////////////////////////////////////////////////////// | 732 /////////////////////////////////////////////////////////////////////////////// |
733 | 733 |
734 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader) | 734 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader) |
735 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl) | 735 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl) |
736 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 736 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
737 | 737 |
738 /////////////////////////////////////////////////////////////////////////////// | 738 /////////////////////////////////////////////////////////////////////////////// |
OLD | NEW |