Debian Codegraph @

servers/rendering/storage/render_scene_buffers.h

raw symbols SCIP
1 /**************************************************************************/
2 /* render_scene_buffers.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/object/ref_counted.h"
34 #include "servers/rendering/rendering_server.h"
35
36 class RenderSceneBuffersConfiguration : public RefCounted {
37 GDCLASS(RenderSceneBuffersConfiguration, RefCounted);
38
39 private:
40 RID render_target;
41
42 Size2i internal_size;
43 Size2i target_size;
44 uint32_t view_count = 1;
45
46 RS::ViewportScaling3DMode scaling_3d_mode = RS::VIEWPORT_SCALING_3D_MODE_OFF;
47 RS::ViewportMSAA msaa_3d = RS::VIEWPORT_MSAA_DISABLED;
48 RS::ViewportScreenSpaceAA screen_space_aa = RS::VIEWPORT_SCREEN_SPACE_AA_DISABLED;
49 RS::ViewportAnisotropicFiltering anisotropic_filtering_level = RS::VIEWPORT_ANISOTROPY_4X;
50
51 float fsr_sharpness = 0.0;
52 float texture_mipmap_bias = 0.0;
53 bool use_taa = false;
54 bool use_debanding = false;
55
56 protected:
57 static void _bind_methods();
58
59 public:
60 RID get_render_target() const { return render_target; }
61 void set_render_target(RID p_render_target) { render_target = p_render_target; }
62
63 Size2i get_internal_size() const { return internal_size; }
64 void set_internal_size(Size2i p_internal_size) { internal_size = p_internal_size; }
65
66 Size2i get_target_size() const { return target_size; }
67 void set_target_size(Size2i p_target_size) { target_size = p_target_size; }
68
69 uint32_t get_view_count() const { return view_count; }
70 void set_view_count(uint32_t p_view_count) { view_count = p_view_count; }
71
72 RS::ViewportScaling3DMode get_scaling_3d_mode() const { return scaling_3d_mode; }
73 void set_scaling_3d_mode(RS::ViewportScaling3DMode p_scaling_3d_mode) { scaling_3d_mode = p_scaling_3d_mode; }
74
75 RS::ViewportMSAA get_msaa_3d() const { return msaa_3d; }
76 void set_msaa_3d(RS::ViewportMSAA p_msaa_3d) { msaa_3d = p_msaa_3d; }
77
78 RS::ViewportScreenSpaceAA get_screen_space_aa() const { return screen_space_aa; }
79 void set_screen_space_aa(RS::ViewportScreenSpaceAA p_screen_space_aa) { screen_space_aa = p_screen_space_aa; }
80
81 float get_fsr_sharpness() const { return fsr_sharpness; }
82 void set_fsr_sharpness(float p_fsr_sharpness) { fsr_sharpness = p_fsr_sharpness; }
83
84 float get_texture_mipmap_bias() const { return texture_mipmap_bias; }
85 void set_texture_mipmap_bias(float p_texture_mipmap_bias) { texture_mipmap_bias = p_texture_mipmap_bias; }
86
87 RS::ViewportAnisotropicFiltering get_anisotropic_filtering_level() const { return anisotropic_filtering_level; }
88 void set_anisotropic_filtering_level(RS::ViewportAnisotropicFiltering p_anisotropic_filtering_level) { anisotropic_filtering_level = p_anisotropic_filtering_level; }
89
90 bool get_use_taa() const { return use_taa; }
91 void set_use_taa(bool p_use_taa) { use_taa = p_use_taa; }
92
93 bool get_use_debanding() const { return use_debanding; }
94 void set_use_debanding(bool p_use_debanding) { use_debanding = p_use_debanding; }
95
96 RenderSceneBuffersConfiguration() {}
97 virtual ~RenderSceneBuffersConfiguration() {}
98 };
99
100 class RenderSceneBuffers : public RefCounted {
101 GDCLASS(RenderSceneBuffers, RefCounted);
102
103 protected:
104 static void _bind_methods();
105
106 public:
107 RenderSceneBuffers() {}
108 virtual ~RenderSceneBuffers() {}
109
110 virtual void configure(const RenderSceneBuffersConfiguration *p_config) = 0;
111
112 // for those settings that are unlikely to require buffers to be recreated, we'll add setters
113 virtual void set_fsr_sharpness(float p_fsr_sharpness) = 0;
114 virtual void set_texture_mipmap_bias(float p_texture_mipmap_bias) = 0;
115 virtual void set_anisotropic_filtering_level(RS::ViewportAnisotropicFiltering p_anisotropic_filtering_level) = 0;
116 virtual void set_use_debanding(bool p_use_debanding) = 0;
117 };
118
119 class RenderSceneBuffersExtension : public RenderSceneBuffers {
120 GDCLASS(RenderSceneBuffersExtension, RenderSceneBuffers);
121
122 protected:
123 static void _bind_methods();
124
125 GDVIRTUAL1(_configure, const RenderSceneBuffersConfiguration *)
126 GDVIRTUAL1(_set_fsr_sharpness, float)
127 GDVIRTUAL1(_set_texture_mipmap_bias, float)
128 GDVIRTUAL1(_set_anisotropic_filtering_level, int)
129 GDVIRTUAL1(_set_use_debanding, bool)
130
131 public:
132 virtual ~RenderSceneBuffersExtension() {}
133
134 virtual void configure(const RenderSceneBuffersConfiguration *p_config) override;
135
136 virtual void set_fsr_sharpness(float p_fsr_sharpness) override;
137 virtual void set_texture_mipmap_bias(float p_texture_mipmap_bias) override;
138 virtual void set_anisotropic_filtering_level(RS::ViewportAnisotropicFiltering p_anisotropic_filtering_level) override;
139 virtual void set_use_debanding(bool p_use_debanding) override;
140 };