1 | /**************************************************************************/ |
2 | /* rasterizer_scene_dummy.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 | #ifndef RASTERIZER_SCENE_DUMMY_H |
32 | #define RASTERIZER_SCENE_DUMMY_H |
33 | |
34 | #include "core/templates/paged_allocator.h" |
35 | #include "servers/rendering/renderer_scene_render.h" |
36 | #include "storage/utilities.h" |
37 | |
38 | class RasterizerSceneDummy : public RendererSceneRender { |
39 | public: |
40 | class GeometryInstanceDummy : public RenderGeometryInstance { |
41 | public: |
42 | GeometryInstanceDummy() {} |
43 | |
44 | virtual void _mark_dirty() override {} |
45 | |
46 | virtual void set_skeleton(RID p_skeleton) override {} |
47 | virtual void set_material_override(RID p_override) override {} |
48 | virtual void set_material_overlay(RID p_overlay) override {} |
49 | virtual void set_surface_materials(const Vector<RID> &p_materials) override {} |
50 | virtual void set_mesh_instance(RID p_mesh_instance) override {} |
51 | virtual void set_transform(const Transform3D &p_transform, const AABB &p_aabb, const AABB &p_transformed_aabb) override {} |
52 | virtual void set_pivot_data(float p_sorting_offset, bool p_use_aabb_center) override {} |
53 | virtual void set_lod_bias(float p_lod_bias) override {} |
54 | virtual void set_layer_mask(uint32_t p_layer_mask) override {} |
55 | virtual void set_fade_range(bool p_enable_near, float p_near_begin, float p_near_end, bool p_enable_far, float p_far_begin, float p_far_end) override {} |
56 | virtual void set_parent_fade_alpha(float p_alpha) override {} |
57 | virtual void set_transparency(float p_transparency) override {} |
58 | virtual void set_use_baked_light(bool p_enable) override {} |
59 | virtual void set_use_dynamic_gi(bool p_enable) override {} |
60 | virtual void set_use_lightmap(RID p_lightmap_instance, const Rect2 &p_lightmap_uv_scale, int p_lightmap_slice_index) override {} |
61 | virtual void set_lightmap_capture(const Color *p_sh9) override {} |
62 | virtual void set_instance_shader_uniforms_offset(int32_t p_offset) override {} |
63 | virtual void set_cast_double_sided_shadows(bool p_enable) override {} |
64 | |
65 | virtual Transform3D get_transform() override { return Transform3D(); } |
66 | virtual AABB get_aabb() override { return AABB(); } |
67 | |
68 | virtual void pair_light_instances(const RID *p_light_instances, uint32_t p_light_instance_count) override {} |
69 | virtual void pair_reflection_probe_instances(const RID *p_reflection_probe_instances, uint32_t p_reflection_probe_instance_count) override {} |
70 | virtual void pair_decal_instances(const RID *p_decal_instances, uint32_t p_decal_instance_count) override {} |
71 | virtual void pair_voxel_gi_instances(const RID *p_voxel_gi_instances, uint32_t p_voxel_gi_instance_count) override {} |
72 | |
73 | virtual void set_softshadow_projector_pairing(bool p_softshadow, bool p_projector) override {} |
74 | }; |
75 | |
76 | PagedAllocator<GeometryInstanceDummy> geometry_instance_alloc; |
77 | |
78 | public: |
79 | RenderGeometryInstance *geometry_instance_create(RID p_base) override { |
80 | RS::InstanceType type = RendererDummy::Utilities::get_singleton()->get_base_type(p_base); |
81 | ERR_FAIL_COND_V(!((1 << type) & RS::INSTANCE_GEOMETRY_MASK), nullptr); |
82 | |
83 | GeometryInstanceDummy *ginstance = geometry_instance_alloc.alloc(); |
84 | |
85 | return ginstance; |
86 | } |
87 | |
88 | void geometry_instance_free(RenderGeometryInstance *p_geometry_instance) override { |
89 | GeometryInstanceDummy *ginstance = static_cast<GeometryInstanceDummy *>(p_geometry_instance); |
90 | ERR_FAIL_COND(!ginstance); |
91 | |
92 | geometry_instance_alloc.free(ginstance); |
93 | } |
94 | |
95 | uint32_t geometry_instance_get_pair_mask() override { return 0; } |
96 | |
97 | /* SDFGI UPDATE */ |
98 | |
99 | void sdfgi_update(const Ref<RenderSceneBuffers> &p_render_buffers, RID p_environment, const Vector3 &p_world_position) override {} |
100 | int sdfgi_get_pending_region_count(const Ref<RenderSceneBuffers> &p_render_buffers) const override { return 0; } |
101 | AABB sdfgi_get_pending_region_bounds(const Ref<RenderSceneBuffers> &p_render_buffers, int p_region) const override { return AABB(); } |
102 | uint32_t sdfgi_get_pending_region_cascade(const Ref<RenderSceneBuffers> &p_render_buffers, int p_region) const override { return 0; } |
103 | |
104 | /* SKY API */ |
105 | |
106 | RID sky_allocate() override { return RID(); } |
107 | void sky_initialize(RID p_rid) override {} |
108 | void sky_set_radiance_size(RID p_sky, int p_radiance_size) override {} |
109 | void sky_set_mode(RID p_sky, RS::SkyMode p_samples) override {} |
110 | void sky_set_material(RID p_sky, RID p_material) override {} |
111 | Ref<Image> sky_bake_panorama(RID p_sky, float p_energy, bool p_bake_irradiance, const Size2i &p_size) override { return Ref<Image>(); } |
112 | |
113 | /* ENVIRONMENT API */ |
114 | |
115 | void environment_glow_set_use_bicubic_upscale(bool p_enable) override {} |
116 | |
117 | void environment_set_ssr_roughness_quality(RS::EnvironmentSSRRoughnessQuality p_quality) override {} |
118 | |
119 | void environment_set_ssao_quality(RS::EnvironmentSSAOQuality p_quality, bool p_half_size, float p_adaptive_target, int p_blur_passes, float p_fadeout_from, float p_fadeout_to) override {} |
120 | |
121 | void environment_set_ssil_quality(RS::EnvironmentSSILQuality p_quality, bool p_half_size, float p_adaptive_target, int p_blur_passes, float p_fadeout_from, float p_fadeout_to) override {} |
122 | |
123 | void environment_set_sdfgi_ray_count(RS::EnvironmentSDFGIRayCount p_ray_count) override {} |
124 | void environment_set_sdfgi_frames_to_converge(RS::EnvironmentSDFGIFramesToConverge p_frames) override {} |
125 | void environment_set_sdfgi_frames_to_update_light(RS::EnvironmentSDFGIFramesToUpdateLight p_update) override {} |
126 | |
127 | void environment_set_volumetric_fog_volume_size(int p_size, int p_depth) override {} |
128 | void environment_set_volumetric_fog_filter_active(bool p_enable) override {} |
129 | |
130 | Ref<Image> environment_bake_panorama(RID p_env, bool p_bake_irradiance, const Size2i &p_size) override { return Ref<Image>(); } |
131 | |
132 | void positional_soft_shadow_filter_set_quality(RS::ShadowQuality p_quality) override {} |
133 | void directional_soft_shadow_filter_set_quality(RS::ShadowQuality p_quality) override {} |
134 | |
135 | RID fog_volume_instance_create(RID p_fog_volume) override { return RID(); } |
136 | void fog_volume_instance_set_transform(RID p_fog_volume_instance, const Transform3D &p_transform) override {} |
137 | void fog_volume_instance_set_active(RID p_fog_volume_instance, bool p_active) override {} |
138 | RID fog_volume_instance_get_volume(RID p_fog_volume_instance) const override { return RID(); } |
139 | Vector3 fog_volume_instance_get_position(RID p_fog_volume_instance) const override { return Vector3(); } |
140 | |
141 | RID voxel_gi_instance_create(RID p_voxel_gi) override { return RID(); } |
142 | void voxel_gi_instance_set_transform_to_data(RID p_probe, const Transform3D &p_xform) override {} |
143 | bool voxel_gi_needs_update(RID p_probe) const override { return false; } |
144 | void voxel_gi_update(RID p_probe, bool p_update_light_instances, const Vector<RID> &p_light_instances, const PagedArray<RenderGeometryInstance *> &p_dynamic_objects) override {} |
145 | |
146 | void voxel_gi_set_quality(RS::VoxelGIQuality) override {} |
147 | |
148 | void render_scene(const Ref<RenderSceneBuffers> &p_render_buffers, const CameraData *p_camera_data, const CameraData *p_prev_camera_data, const PagedArray<RenderGeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, const PagedArray<RID> &p_fog_volumes, RID p_environment, RID p_camera_attributes, RID p_shadow_atlas, RID p_occluder_debug_tex, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_mesh_lod_threshold, const RenderShadowData *p_render_shadows, int p_render_shadow_count, const RenderSDFGIData *p_render_sdfgi_regions, int p_render_sdfgi_region_count, const RenderSDFGIUpdateData *p_sdfgi_update_data = nullptr, RenderingMethod::RenderInfo *r_info = nullptr) override {} |
149 | void render_material(const Transform3D &p_cam_transform, const Projection &p_cam_projection, bool p_cam_orthogonal, const PagedArray<RenderGeometryInstance *> &p_instances, RID p_framebuffer, const Rect2i &p_region) override {} |
150 | void render_particle_collider_heightfield(RID p_collider, const Transform3D &p_transform, const PagedArray<RenderGeometryInstance *> &p_instances) override {} |
151 | |
152 | void set_scene_pass(uint64_t p_pass) override {} |
153 | void set_time(double p_time, double p_step) override {} |
154 | void set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw) override {} |
155 | |
156 | Ref<RenderSceneBuffers> render_buffers_create() override { return Ref<RenderSceneBuffers>(); } |
157 | void gi_set_use_half_resolution(bool p_enable) override {} |
158 | |
159 | void screen_space_roughness_limiter_set_active(bool p_enable, float p_amount, float p_curve) override {} |
160 | bool screen_space_roughness_limiter_is_active() const override { return false; } |
161 | |
162 | void sub_surface_scattering_set_quality(RS::SubSurfaceScatteringQuality p_quality) override {} |
163 | void sub_surface_scattering_set_scale(float p_scale, float p_depth_scale) override {} |
164 | |
165 | TypedArray<Image> bake_render_uv2(RID p_base, const TypedArray<RID> &p_material_overrides, const Size2i &p_image_size) override { return TypedArray<Image>(); } |
166 | |
167 | bool free(RID p_rid) override { |
168 | if (is_environment(p_rid)) { |
169 | environment_free(p_rid); |
170 | return true; |
171 | } else if (RSG::camera_attributes->owns_camera_attributes(p_rid)) { |
172 | RSG::camera_attributes->camera_attributes_free(p_rid); |
173 | return true; |
174 | } else { |
175 | return false; |
176 | } |
177 | } |
178 | void update() override {} |
179 | void sdfgi_set_debug_probe_select(const Vector3 &p_position, const Vector3 &p_dir) override {} |
180 | |
181 | virtual void decals_set_filter(RS::DecalFilter p_filter) override {} |
182 | virtual void light_projectors_set_filter(RS::LightProjectorFilter p_filter) override {} |
183 | |
184 | RasterizerSceneDummy() {} |
185 | ~RasterizerSceneDummy() {} |
186 | }; |
187 | |
188 | #endif // RASTERIZER_SCENE_DUMMY_H |
189 | |