| 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 |
#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 |
|
| 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 |
|
| 102 |
|
| 103 |
class Compositor : public Resource { |
| 104 |
GDCLASS(Compositor, Resource); |
| 105 |
|
| 106 |
private: |
| 107 |
RID compositor; |
| 108 |
|
| 109 |
|
| 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 |
|
| 122 |
void set_compositor_effects(const TypedArray<CompositorEffect> &p_compositor_effects); |
| 123 |
TypedArray<CompositorEffect> get_compositor_effects() const; |
| 124 |
}; |