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

Side by Side Diff: src/core/SkRadialShadowMapShader.cpp

Issue 2323383002: made point lights linear attenuation; also fixed point light depth bug (Closed)
Patch Set: 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
OLDNEW
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 "SkLights.h" 8 #include "SkLights.h"
9 #include "SkPoint3.h" 9 #include "SkPoint3.h"
10 #include "SkRadialShadowMapShader.h" 10 #include "SkRadialShadowMapShader.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 kInt_GrSLType, 135 kInt_GrSLType,
136 kDefault_GrSLPrecision, 136 kDefault_GrSLPrecision,
137 "height", &heightUniName); 137 "height", &heightUniName);
138 138
139 139
140 SkString occluder("occluder"); 140 SkString occluder("occluder");
141 this->emitChild(0, nullptr, &occluder, args); 141 this->emitChild(0, nullptr, &occluder, args);
142 142
143 // Modify the input texture coordinates to index into our 1D output 143 // Modify the input texture coordinates to index into our 1D output
144 fragBuilder->codeAppend("float distHere;"); 144 fragBuilder->codeAppend("float distHere;");
145 fragBuilder->codeAppend("float closestDistHere = 0;"); 145 fragBuilder->codeAppend("float closestDistHere = 2;");
jvanverth1 2016/09/09 18:18:33 Why 2?
vjiaoblack 2016/09/09 18:24:36 Done.
146 fragBuilder->codeAppend("vec2 coords = vMatrixCoord_0_0_Stage0;"); 146 fragBuilder->codeAppend("vec2 coords = vMatrixCoord_0_0_Stage0;");
147 fragBuilder->codeAppend("coords.y = 0;"); 147 fragBuilder->codeAppend("coords.y = 0;");
148 fragBuilder->codeAppend("vec2 destCoords = vec2(0,0);"); 148 fragBuilder->codeAppend("vec2 destCoords = vec2(0,0);");
149 fragBuilder->codeAppendf("float step = 1.0 / %s;", heightUniName); 149 fragBuilder->codeAppendf("float step = 1.0 / %s;", heightUniName);
150 150
151 // assume that we are at 0, 0 light pos 151 // assume that we are at 0, 0 light pos
152 // TODO use correct light positions 152 // TODO use correct light positions
153 153
154 // this goes through each depth value in the final output buffer, 154 // this goes through each depth value in the final output buffer,
155 // basically raycasting outwards, and finding the first collision. 155 // basically raycasting outwards, and finding the first collision.
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 420
421 /////////////////////////////////////////////////////////////////////////////// 421 ///////////////////////////////////////////////////////////////////////////////
422 422
423 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkRadialShadowMapShader) 423 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkRadialShadowMapShader)
424 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkRadialShadowMapShaderImpl) 424 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkRadialShadowMapShaderImpl)
425 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 425 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
426 426
427 /////////////////////////////////////////////////////////////////////////////// 427 ///////////////////////////////////////////////////////////////////////////////
428 428
429 #endif 429 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698