Debian Codegraph @

scene/resources/compositor.h

raw symbols SCIP
1 /**************************************************************************/
2 /* compositor.h */
3 /**************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* https://godotengine.org */
7 /**************************************************************************/
8 /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9 /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10 /* */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the */
13 /* "Software"), to deal in the Software without restriction, including */
14 /* without limitation the rights to use, copy, modify, merge, publish, */
15 /* distribute, sublicense, and/or sell copies of the Software, and to */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions: */
18 /* */
19 /* The above copyright notice and this permission notice shall be */
20 /* included in all copies or substantial portions of the Software. */
21 /* */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29 /**************************************************************************/
30
31 #pragma once
32
33 #include "core/io/resource.h"
34 #include "core/object/gdvirtual.gen.inc"
35 #include "servers/rendering/storage/render_data.h"
36
37 /* Compositor Effect */
38
39 class CompositorEffect : public Resource {
40 GDCLASS(CompositorEffect, Resource);
41
42 public:
43 enum EffectCallbackType {
44 EFFECT_CALLBACK_TYPE_PRE_OPAQUE,
45 EFFECT_CALLBACK_TYPE_POST_OPAQUE,
46 EFFECT_CALLBACK_TYPE_POST_SKY,
47 EFFECT_CALLBACK_TYPE_PRE_TRANSPARENT,
48 EFFECT_CALLBACK_TYPE_POST_TRANSPARENT,
49 EFFECT_CALLBACK_TYPE_MAX
50 };
51
52 private:
53 RID rid;
54 bool enabled = true;
55 EffectCallbackType effect_callback_type = EFFECT_CALLBACK_TYPE_POST_TRANSPARENT;
56
57 bool access_resolved_color = false;
58 bool access_resolved_depth = false;
59 bool needs_motion_vectors = false;
60 bool needs_normal_roughness = false;
61 bool needs_separate_specular = false;
62
63 protected:
64 static void _bind_methods();
65 void _validate_property(PropertyInfo &p_property) const;
66
67 void _call_render_callback(int p_effect_callback_type, const RenderData *p_render_data);
68
69 GDVIRTUAL2(_render_callback, int, const RenderData *)
70
71 public:
72 virtual RID get_rid() const override { return rid; }
73
74 void set_enabled(bool p_enabled);
75 bool get_enabled() const;
76
77 void set_effect_callback_type(EffectCallbackType p_callback_type);
78 EffectCallbackType get_effect_callback_type() const;
79
80 void set_access_resolved_color(bool p_enabled);
81 bool get_access_resolved_color() const;
82
83 void set_access_resolved_depth(bool p_enabled);
84 bool get_access_resolved_depth() const;
85
86 void set_needs_motion_vectors(bool p_enabled);
87 bool get_needs_motion_vectors() const;
88
89 void set_needs_normal_roughness(bool p_enabled);
90 bool get_needs_normal_roughness() const;
91
92 void set_needs_separate_specular(bool p_enabled);
93 bool get_needs_separate_specular() const;
94
95 CompositorEffect();
96 ~CompositorEffect();
97 };
98
99 VARIANT_ENUM_CAST(CompositorEffect::EffectCallbackType)
100
101 /* Compositor */
102
103 class Compositor : public Resource {
104 GDCLASS(Compositor, Resource);
105
106 private:
107 RID compositor;
108
109 // Compositor effects
110 LocalVector<Ref<CompositorEffect>> effects;
111
112 protected:
113 static void _bind_methods();
114
115 public:
116 virtual RID get_rid() const override { return compositor; }
117
118 Compositor();
119 ~Compositor();
120
121 // Compositor effects
122 void set_compositor_effects(const TypedArray<CompositorEffect> &p_compositor_effects);
123 TypedArray<CompositorEffect> get_compositor_effects() const;
124 };