aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkShadowShader.h
blob: ea05ccae89d63cb718a9c4a5912bb3ed85b833b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */


#ifndef SkShadowShader_DEFINED
#define SkShadowShader_DEFINED

#ifdef SK_EXPERIMENTAL_SHADOWING

class SkLights;
class SkShader;

class SK_API SkShadowShader {
public:
    /** This shader combines the diffuse color in 'diffuseShader' with the shadows
     *  determined by the 'povDepthShader' and the shadow maps stored in each of the
     *  lights in 'lights'
     *
     *  Please note that the shadow shader is required to be in Stage0, otherwise
     *  the texture coords will be wrong within the shader.
     */
    static sk_sp<SkShader> Make(sk_sp<SkShader> povDepthShader,
                                sk_sp<SkShader> diffuseShader,
                                sk_sp<SkLights> lights,
                                int diffuseWidth, int diffuseHeight,
                                const SkShadowParams& params);

    // The shadow shader supports any number of ambient lights, but only
    // 4 non-ambient lights (currently just refers to directional lights).
    static constexpr int kMaxNonAmbientLights = 4;

    SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
};

#endif
#endif