rasterizer_scene_dummy.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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. #ifndef RASTERIZER_SCENE_DUMMY_H
  31. #define RASTERIZER_SCENE_DUMMY_H
  32. #include "core/templates/paged_allocator.h"
  33. #include "servers/rendering/renderer_scene_render.h"
  34. #include "storage/utilities.h"
  35. class RasterizerSceneDummy : public RendererSceneRender {
  36. public:
  37. class GeometryInstanceDummy : public RenderGeometryInstance {
  38. public:
  39. GeometryInstanceDummy() {}
  40. virtual void _mark_dirty() override {}
  41. virtual void set_skeleton(RID p_skeleton) override {}
  42. virtual void set_material_override(RID p_override) override {}
  43. virtual void set_material_overlay(RID p_overlay) override {}
  44. virtual void set_surface_materials(const Vector<RID> &p_materials) override {}
  45. virtual void set_mesh_instance(RID p_mesh_instance) override {}
  46. virtual void set_transform(const Transform3D &p_transform, const AABB &p_aabb, const AABB &p_transformed_aabb) override {}
  47. virtual void set_pivot_data(float p_sorting_offset, bool p_use_aabb_center) override {}
  48. virtual void set_lod_bias(float p_lod_bias) override {}
  49. virtual void set_layer_mask(uint32_t p_layer_mask) override {}
  50. 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 {}
  51. virtual void set_parent_fade_alpha(float p_alpha) override {}
  52. virtual void set_transparency(float p_transparency) override {}
  53. virtual void set_use_baked_light(bool p_enable) override {}
  54. virtual void set_use_dynamic_gi(bool p_enable) override {}
  55. virtual void set_use_lightmap(RID p_lightmap_instance, const Rect2 &p_lightmap_uv_scale, int p_lightmap_slice_index) override {}
  56. virtual void set_lightmap_capture(const Color *p_sh9) override {}
  57. virtual void set_instance_shader_uniforms_offset(int32_t p_offset) override {}
  58. virtual void set_cast_double_sided_shadows(bool p_enable) override {}
  59. virtual Transform3D get_transform() override { return Transform3D(); }
  60. virtual AABB get_aabb() override { return AABB(); }
  61. virtual void pair_light_instances(const RID *p_light_instances, uint32_t p_light_instance_count) override {}
  62. virtual void pair_reflection_probe_instances(const RID *p_reflection_probe_instances, uint32_t p_reflection_probe_instance_count) override {}
  63. virtual void pair_decal_instances(const RID *p_decal_instances, uint32_t p_decal_instance_count) override {}
  64. virtual void pair_voxel_gi_instances(const RID *p_voxel_gi_instances, uint32_t p_voxel_gi_instance_count) override {}
  65. virtual void set_softshadow_projector_pairing(bool p_softshadow, bool p_projector) override {}
  66. };
  67. PagedAllocator<GeometryInstanceDummy> geometry_instance_alloc;
  68. public:
  69. RenderGeometryInstance *geometry_instance_create(RID p_base) override {
  70. RS::InstanceType type = RendererDummy::Utilities::get_singleton()->get_base_type(p_base);
  71. ERR_FAIL_COND_V(!((1 << type) & RS::INSTANCE_GEOMETRY_MASK), nullptr);
  72. GeometryInstanceDummy *ginstance = geometry_instance_alloc.alloc();
  73. return ginstance;
  74. }
  75. void geometry_instance_free(RenderGeometryInstance *p_geometry_instance) override {
  76. GeometryInstanceDummy *ginstance = static_cast<GeometryInstanceDummy *>(p_geometry_instance);
  77. ERR_FAIL_COND(!ginstance);
  78. geometry_instance_alloc.free(ginstance);
  79. }
  80. uint32_t geometry_instance_get_pair_mask() override { return 0; }
  81. /* SDFGI UPDATE */
  82. void sdfgi_update(const Ref<RenderSceneBuffers> &p_render_buffers, RID p_environment, const Vector3 &p_world_position) override {}
  83. int sdfgi_get_pending_region_count(const Ref<RenderSceneBuffers> &p_render_buffers) const override { return 0; }
  84. AABB sdfgi_get_pending_region_bounds(const Ref<RenderSceneBuffers> &p_render_buffers, int p_region) const override { return AABB(); }
  85. uint32_t sdfgi_get_pending_region_cascade(const Ref<RenderSceneBuffers> &p_render_buffers, int p_region) const override { return 0; }
  86. /* SKY API */
  87. RID sky_allocate() override { return RID(); }
  88. void sky_initialize(RID p_rid) override {}
  89. void sky_set_radiance_size(RID p_sky, int p_radiance_size) override {}
  90. void sky_set_mode(RID p_sky, RS::SkyMode p_samples) override {}
  91. void sky_set_material(RID p_sky, RID p_material) override {}
  92. Ref<Image> sky_bake_panorama(RID p_sky, float p_energy, bool p_bake_irradiance, const Size2i &p_size) override { return Ref<Image>(); }
  93. /* ENVIRONMENT API */
  94. void environment_glow_set_use_bicubic_upscale(bool p_enable) override {}
  95. void environment_set_ssr_roughness_quality(RS::EnvironmentSSRRoughnessQuality p_quality) override {}
  96. 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 {}
  97. 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 {}
  98. void environment_set_sdfgi_ray_count(RS::EnvironmentSDFGIRayCount p_ray_count) override {}
  99. void environment_set_sdfgi_frames_to_converge(RS::EnvironmentSDFGIFramesToConverge p_frames) override {}
  100. void environment_set_sdfgi_frames_to_update_light(RS::EnvironmentSDFGIFramesToUpdateLight p_update) override {}
  101. void environment_set_volumetric_fog_volume_size(int p_size, int p_depth) override {}
  102. void environment_set_volumetric_fog_filter_active(bool p_enable) override {}
  103. Ref<Image> environment_bake_panorama(RID p_env, bool p_bake_irradiance, const Size2i &p_size) override { return Ref<Image>(); }
  104. void positional_soft_shadow_filter_set_quality(RS::ShadowQuality p_quality) override {}
  105. void directional_soft_shadow_filter_set_quality(RS::ShadowQuality p_quality) override {}
  106. RID fog_volume_instance_create(RID p_fog_volume) override { return RID(); }
  107. void fog_volume_instance_set_transform(RID p_fog_volume_instance, const Transform3D &p_transform) override {}
  108. void fog_volume_instance_set_active(RID p_fog_volume_instance, bool p_active) override {}
  109. RID fog_volume_instance_get_volume(RID p_fog_volume_instance) const override { return RID(); }
  110. Vector3 fog_volume_instance_get_position(RID p_fog_volume_instance) const override { return Vector3(); }
  111. RID voxel_gi_instance_create(RID p_voxel_gi) override { return RID(); }
  112. void voxel_gi_instance_set_transform_to_data(RID p_probe, const Transform3D &p_xform) override {}
  113. bool voxel_gi_needs_update(RID p_probe) const override { return false; }
  114. 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 {}
  115. void voxel_gi_set_quality(RS::VoxelGIQuality) override {}
  116. 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 {}
  117. 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 {}
  118. void render_particle_collider_heightfield(RID p_collider, const Transform3D &p_transform, const PagedArray<RenderGeometryInstance *> &p_instances) override {}
  119. void set_scene_pass(uint64_t p_pass) override {}
  120. void set_time(double p_time, double p_step) override {}
  121. void set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw) override {}
  122. Ref<RenderSceneBuffers> render_buffers_create() override { return Ref<RenderSceneBuffers>(); }
  123. void gi_set_use_half_resolution(bool p_enable) override {}
  124. void screen_space_roughness_limiter_set_active(bool p_enable, float p_amount, float p_curve) override {}
  125. bool screen_space_roughness_limiter_is_active() const override { return false; }
  126. void sub_surface_scattering_set_quality(RS::SubSurfaceScatteringQuality p_quality) override {}
  127. void sub_surface_scattering_set_scale(float p_scale, float p_depth_scale) override {}
  128. TypedArray<Image> bake_render_uv2(RID p_base, const TypedArray<RID> &p_material_overrides, const Size2i &p_image_size) override { return TypedArray<Image>(); }
  129. bool free(RID p_rid) override {
  130. if (is_environment(p_rid)) {
  131. environment_free(p_rid);
  132. return true;
  133. } else if (RSG::camera_attributes->owns_camera_attributes(p_rid)) {
  134. RSG::camera_attributes->camera_attributes_free(p_rid);
  135. return true;
  136. } else {
  137. return false;
  138. }
  139. }
  140. void update() override {}
  141. void sdfgi_set_debug_probe_select(const Vector3 &p_position, const Vector3 &p_dir) override {}
  142. virtual void decals_set_filter(RS::DecalFilter p_filter) override {}
  143. virtual void light_projectors_set_filter(RS::LightProjectorFilter p_filter) override {}
  144. RasterizerSceneDummy() {}
  145. ~RasterizerSceneDummy() {}
  146. };
  147. #endif // RASTERIZER_SCENE_DUMMY_H