| 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/templates/rid_owner.h" |
| 34 |
#include "servers/rendering/rendering_server.h" |
| 35 |
|
| 36 |
class RendererCompositorStorage { |
| 37 |
private: |
| 38 |
static RendererCompositorStorage *singleton; |
| 39 |
int num_compositor_effects_with_motion_vectors = 0; |
| 40 |
|
| 41 |
|
| 42 |
struct CompositorEffect { |
| 43 |
bool is_enabled = true; |
| 44 |
RS::CompositorEffectCallbackType callback_type; |
| 45 |
Callable callback; |
| 46 |
|
| 47 |
BitField<RS::CompositorEffectFlags> flags = {}; |
| 48 |
}; |
| 49 |
|
| 50 |
mutable RID_Owner<CompositorEffect, true> compositor_effects_owner; |
| 51 |
|
| 52 |
|
| 53 |
struct Compositor { |
| 54 |
|
| 55 |
Vector<RID> compositor_effects; |
| 56 |
}; |
| 57 |
|
| 58 |
mutable RID_Owner<Compositor, true> compositor_owner; |
| 59 |
|
| 60 |
public: |
| 61 |
static RendererCompositorStorage *get_singleton() { return singleton; } |
| 62 |
int get_num_compositor_effects_with_motion_vectors() const { return num_compositor_effects_with_motion_vectors; } |
| 63 |
|
| 64 |
RendererCompositorStorage(); |
| 65 |
virtual ~RendererCompositorStorage(); |
| 66 |
|
| 67 |
|
| 68 |
RID compositor_effect_allocate(); |
| 69 |
void compositor_effect_initialize(RID p_rid); |
| 70 |
void compositor_effect_free(RID p_rid); |
| 71 |
|
| 72 |
bool is_compositor_effect(RID p_effect) const { |
| 73 |
return compositor_effects_owner.owns(p_effect); |
| 74 |
} |
| 75 |
|
| 76 |
void compositor_effect_set_enabled(RID p_effect, bool p_enabled); |
| 77 |
bool compositor_effect_get_enabled(RID p_effect) const; |
| 78 |
|
| 79 |
void compositor_effect_set_callback(RID p_effect, RS::CompositorEffectCallbackType p_callback_type, const Callable &p_callback); |
| 80 |
RS::CompositorEffectCallbackType compositor_effect_get_callback_type(RID p_effect) const; |
| 81 |
Callable compositor_effect_get_callback(RID p_effect) const; |
| 82 |
|
| 83 |
void compositor_effect_set_flag(RID p_effect, RS::CompositorEffectFlags p_flag, bool p_set); |
| 84 |
bool compositor_effect_get_flag(RID p_effect, RS::CompositorEffectFlags p_flag) const; |
| 85 |
|
| 86 |
|
| 87 |
RID compositor_allocate(); |
| 88 |
void compositor_initialize(RID p_rid); |
| 89 |
void compositor_free(RID p_rid); |
| 90 |
|
| 91 |
bool is_compositor(RID p_compositor) const { |
| 92 |
return compositor_owner.owns(p_compositor); |
| 93 |
} |
| 94 |
|
| 95 |
void compositor_set_compositor_effects(RID p_compositor, const Vector<RID> &p_effects); |
| 96 |
Vector<RID> compositor_get_compositor_effects(RID p_compositor, RS::CompositorEffectCallbackType p_callback_type = RS::COMPOSITOR_EFFECT_CALLBACK_TYPE_ANY, bool p_enabled_only = true) const; |
| 97 |
}; |