aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkLightingShader.cpp
diff options
context:
space:
mode:
authorGravatar vjiaoblack <vjiaoblack@google.com>2016-07-21 09:10:23 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-21 09:10:23 -0700
commit0ae097d116f4332be02a135ffc99c162473dee6a (patch)
treec70d5f33b9753ec7db643eeb4de6cabb927e7ed8 /src/core/SkLightingShader.cpp
parentd2b6d6486ed9d00df779f6b337d756c9a818006f (diff)
Creating framework for drawShadowedPicture
Diffstat (limited to 'src/core/SkLightingShader.cpp')
-rw-r--r--src/core/SkLightingShader.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/SkLightingShader.cpp b/src/core/SkLightingShader.cpp
index 92f41ad8c8..b6b54967d5 100644
--- a/src/core/SkLightingShader.cpp
+++ b/src/core/SkLightingShader.cpp
@@ -45,7 +45,7 @@ public:
*/
SkLightingShaderImpl(sk_sp<SkShader> diffuseShader,
sk_sp<SkNormalSource> normalSource,
- const sk_sp<SkLights> lights)
+ sk_sp<SkLights> lights)
: fDiffuseShader(std::move(diffuseShader))
, fNormalSource(std::move(normalSource))
, fLights(std::move(lights)) {}
@@ -134,6 +134,7 @@ public:
// TODO: handle more than one of these
fLightColor = lights->light(i).color();
fLightDir = lights->light(i).dir();
+ // TODO get the handle to the shadow map if there is one
}
}
@@ -176,6 +177,9 @@ public:
this->emitChild(0, nullptr, &dstNormalName, args);
fragBuilder->codeAppendf("vec3 normal = %s.xyz;", dstNormalName.c_str());
+
+ // TODO: make this a loop and modulate the contribution from each light
+ // based on the shadow map
fragBuilder->codeAppendf("float NdotL = clamp(dot(normal, %s), 0.0, 1.0);",
lightDirUniName);
// diffuse light