blob: ea05ccae89d63cb718a9c4a5912bb3ed85b833b3 [file] [log] [blame]
vjiaoblack53da5ba2016-08-01 10:02:31 -07001/*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8
9#ifndef SkShadowShader_DEFINED
10#define SkShadowShader_DEFINED
11
12#ifdef SK_EXPERIMENTAL_SHADOWING
13
14class SkLights;
15class SkShader;
16
17class SK_API SkShadowShader {
18public:
19 /** This shader combines the diffuse color in 'diffuseShader' with the shadows
20 * determined by the 'povDepthShader' and the shadow maps stored in each of the
21 * lights in 'lights'
vjiaoblackbb106062016-08-31 11:15:21 -070022 *
23 * Please note that the shadow shader is required to be in Stage0, otherwise
24 * the texture coords will be wrong within the shader.
vjiaoblack53da5ba2016-08-01 10:02:31 -070025 */
26 static sk_sp<SkShader> Make(sk_sp<SkShader> povDepthShader,
27 sk_sp<SkShader> diffuseShader,
28 sk_sp<SkLights> lights,
vjiaoblacke6f5d562016-08-25 06:30:23 -070029 int diffuseWidth, int diffuseHeight,
30 const SkShadowParams& params);
vjiaoblack53da5ba2016-08-01 10:02:31 -070031
vjiaoblack955e8792016-08-05 07:55:01 -070032 // The shadow shader supports any number of ambient lights, but only
33 // 4 non-ambient lights (currently just refers to directional lights).
34 static constexpr int kMaxNonAmbientLights = 4;
35
vjiaoblack53da5ba2016-08-01 10:02:31 -070036 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
37};
38
39#endif
40#endif