summaryrefslogtreecommitdiff
path: root/src/render/pass/TexPassElement.hpp
blob: 413f98753fd0e2c907d49fe2df9814ad727ec412 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#pragma once
#include "PassElement.hpp"
#include <optional>

class CWLSurfaceResource;
namespace Render {
    class ITexture;
}
class CSyncTimeline;

enum eDiscardMode : uint8_t {
    DISCARD_OPAQUE = 1,
    DISCARD_ALPHA  = 1 << 1
};

class CTexPassElement : public IPassElement {
  public:
    struct SRenderData {
        SP<Render::ITexture>   tex;
        CBox                   box;
        float                  a        = 1.F;
        float                  blurA    = 1.F;
        float                  overallA = 1.F;
        CRegion                damage;
        int                    round               = 0;
        float                  roundingPower       = 2.0f;
        bool                   flipEndFrame        = false;
        bool                   useMirrorProjection = false;
        CBox                   clipBox;
        bool                   blur = false;
        std::optional<float>   ignoreAlpha;
        std::optional<bool>    blockBlurOptimization;
        bool                   cmBackToSRGB = false;

        bool                   discardActive = false;
        bool                   allowCustomUV = false;
        SP<CWLSurfaceResource> surface       = nullptr;

        uint32_t               discardMode    = DISCARD_OPAQUE;
        float                  discardOpacity = 0.f;

        CRegion                clipRegion;
        PHLLSREF               currentLS;

        SP<Render::ITexture>   blurredBG;
    };

    CTexPassElement(const SRenderData& data);
    CTexPassElement(SRenderData&& data);
    virtual ~CTexPassElement() = default;

    virtual bool                needsLiveBlur();
    virtual bool                needsPrecomputeBlur();
    virtual std::optional<CBox> boundingBox();
    virtual CRegion             opaqueRegion();
    virtual void                discard();

    virtual const char*         passName() {
        return "CTexPassElement";
    }

    virtual ePassElementType type() {
        return EK_TEXTURE;
    };

    SRenderData m_data;
};