1 /*************************************************************************/ 2 /* rasterizer_dummy.h */ 3 /*************************************************************************/ 4 /* This file is part of: */ 5 /* GODOT ENGINE */ 6 /* https://godotengine.org */ 7 /*************************************************************************/ 8 /* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ 9 /* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ 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_DUMMY_H 32 #define RASTERIZER_DUMMY_H 33 34 #include "core/math/camera_matrix.h" 35 #include "core/self_list.h" 36 #include "scene/resources/mesh.h" 37 #include "servers/visual/rasterizer.h" 38 #include "servers/visual_server.h" 39 40 class RasterizerSceneDummy : public RasterizerScene { 41 public: 42 /* SHADOW ATLAS API */ 43 shadow_atlas_create()44 RID shadow_atlas_create() { return RID(); } shadow_atlas_set_size(RID p_atlas,int p_size)45 void shadow_atlas_set_size(RID p_atlas, int p_size) {} shadow_atlas_set_quadrant_subdivision(RID p_atlas,int p_quadrant,int p_subdivision)46 void shadow_atlas_set_quadrant_subdivision(RID p_atlas, int p_quadrant, int p_subdivision) {} shadow_atlas_update_light(RID p_atlas,RID p_light_intance,float p_coverage,uint64_t p_light_version)47 bool shadow_atlas_update_light(RID p_atlas, RID p_light_intance, float p_coverage, uint64_t p_light_version) { return false; } 48 get_directional_light_shadow_size(RID p_light_intance)49 int get_directional_light_shadow_size(RID p_light_intance) { return 0; } set_directional_shadow_count(int p_count)50 void set_directional_shadow_count(int p_count) {} 51 52 /* ENVIRONMENT API */ 53 environment_create()54 RID environment_create() { return RID(); } 55 environment_set_background(RID p_env,VS::EnvironmentBG p_bg)56 void environment_set_background(RID p_env, VS::EnvironmentBG p_bg) {} environment_set_sky(RID p_env,RID p_sky)57 void environment_set_sky(RID p_env, RID p_sky) {} environment_set_sky_custom_fov(RID p_env,float p_scale)58 void environment_set_sky_custom_fov(RID p_env, float p_scale) {} environment_set_sky_orientation(RID p_env,const Basis & p_orientation)59 void environment_set_sky_orientation(RID p_env, const Basis &p_orientation) {} environment_set_bg_color(RID p_env,const Color & p_color)60 void environment_set_bg_color(RID p_env, const Color &p_color) {} environment_set_bg_energy(RID p_env,float p_energy)61 void environment_set_bg_energy(RID p_env, float p_energy) {} environment_set_canvas_max_layer(RID p_env,int p_max_layer)62 void environment_set_canvas_max_layer(RID p_env, int p_max_layer) {} 63 void environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy = 1.0, float p_sky_contribution = 0.0) {} environment_set_camera_feed_id(RID p_env,int p_camera_feed_id)64 void environment_set_camera_feed_id(RID p_env, int p_camera_feed_id){}; 65 environment_set_dof_blur_near(RID p_env,bool p_enable,float p_distance,float p_transition,float p_far_amount,VS::EnvironmentDOFBlurQuality p_quality)66 void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, VS::EnvironmentDOFBlurQuality p_quality) {} environment_set_dof_blur_far(RID p_env,bool p_enable,float p_distance,float p_transition,float p_far_amount,VS::EnvironmentDOFBlurQuality p_quality)67 void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, VS::EnvironmentDOFBlurQuality p_quality) {} environment_set_glow(RID p_env,bool p_enable,int p_level_flags,float p_intensity,float p_strength,float p_bloom_threshold,VS::EnvironmentGlowBlendMode p_blend_mode,float p_hdr_bleed_threshold,float p_hdr_bleed_scale,float p_hdr_luminance_cap,bool p_bicubic_upscale)68 void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, VS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale) {} 69 environment_set_fog(RID p_env,bool p_enable,float p_begin,float p_end,RID p_gradient_texture)70 void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture) {} 71 environment_set_ssr(RID p_env,bool p_enable,int p_max_steps,float p_fade_int,float p_fade_out,float p_depth_tolerance,bool p_roughness)72 void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_int, float p_fade_out, float p_depth_tolerance, bool p_roughness) {} environment_set_ssao(RID p_env,bool p_enable,float p_radius,float p_intensity,float p_radius2,float p_intensity2,float p_bias,float p_light_affect,float p_ao_channel_affect,const Color & p_color,VS::EnvironmentSSAOQuality p_quality,VS::EnvironmentSSAOBlur p_blur,float p_bilateral_sharpness)73 void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) {} 74 environment_set_tonemap(RID p_env,VS::EnvironmentToneMapper p_tone_mapper,float p_exposure,float p_white,bool p_auto_exposure,float p_min_luminance,float p_max_luminance,float p_auto_exp_speed,float p_auto_exp_scale)75 void environment_set_tonemap(RID p_env, VS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) {} 76 environment_set_adjustment(RID p_env,bool p_enable,float p_brightness,float p_contrast,float p_saturation,RID p_ramp)77 void environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, RID p_ramp) {} 78 environment_set_fog(RID p_env,bool p_enable,const Color & p_color,const Color & p_sun_color,float p_sun_amount)79 void environment_set_fog(RID p_env, bool p_enable, const Color &p_color, const Color &p_sun_color, float p_sun_amount) {} environment_set_fog_depth(RID p_env,bool p_enable,float p_depth_begin,float p_depth_end,float p_depth_curve,bool p_transmit,float p_transmit_curve)80 void environment_set_fog_depth(RID p_env, bool p_enable, float p_depth_begin, float p_depth_end, float p_depth_curve, bool p_transmit, float p_transmit_curve) {} environment_set_fog_height(RID p_env,bool p_enable,float p_min_height,float p_max_height,float p_height_curve)81 void environment_set_fog_height(RID p_env, bool p_enable, float p_min_height, float p_max_height, float p_height_curve) {} 82 is_environment(RID p_env)83 bool is_environment(RID p_env) { return false; } environment_get_background(RID p_env)84 VS::EnvironmentBG environment_get_background(RID p_env) { return VS::ENV_BG_KEEP; } environment_get_canvas_max_layer(RID p_env)85 int environment_get_canvas_max_layer(RID p_env) { return 0; } 86 light_instance_create(RID p_light)87 RID light_instance_create(RID p_light) { return RID(); } light_instance_set_transform(RID p_light_instance,const Transform & p_transform)88 void light_instance_set_transform(RID p_light_instance, const Transform &p_transform) {} 89 void light_instance_set_shadow_transform(RID p_light_instance, const CameraMatrix &p_projection, const Transform &p_transform, float p_far, float p_split, int p_pass, float p_bias_scale = 1.0) {} light_instance_mark_visible(RID p_light_instance)90 void light_instance_mark_visible(RID p_light_instance) {} 91 reflection_atlas_create()92 RID reflection_atlas_create() { return RID(); } reflection_atlas_set_size(RID p_ref_atlas,int p_size)93 void reflection_atlas_set_size(RID p_ref_atlas, int p_size) {} reflection_atlas_set_subdivision(RID p_ref_atlas,int p_subdiv)94 void reflection_atlas_set_subdivision(RID p_ref_atlas, int p_subdiv) {} 95 reflection_probe_instance_create(RID p_probe)96 RID reflection_probe_instance_create(RID p_probe) { return RID(); } reflection_probe_instance_set_transform(RID p_instance,const Transform & p_transform)97 void reflection_probe_instance_set_transform(RID p_instance, const Transform &p_transform) {} reflection_probe_release_atlas_index(RID p_instance)98 void reflection_probe_release_atlas_index(RID p_instance) {} reflection_probe_instance_needs_redraw(RID p_instance)99 bool reflection_probe_instance_needs_redraw(RID p_instance) { return false; } reflection_probe_instance_has_reflection(RID p_instance)100 bool reflection_probe_instance_has_reflection(RID p_instance) { return false; } reflection_probe_instance_begin_render(RID p_instance,RID p_reflection_atlas)101 bool reflection_probe_instance_begin_render(RID p_instance, RID p_reflection_atlas) { return false; } reflection_probe_instance_postprocess_step(RID p_instance)102 bool reflection_probe_instance_postprocess_step(RID p_instance) { return true; } 103 gi_probe_instance_create()104 RID gi_probe_instance_create() { return RID(); } gi_probe_instance_set_light_data(RID p_probe,RID p_base,RID p_data)105 void gi_probe_instance_set_light_data(RID p_probe, RID p_base, RID p_data) {} gi_probe_instance_set_transform_to_data(RID p_probe,const Transform & p_xform)106 void gi_probe_instance_set_transform_to_data(RID p_probe, const Transform &p_xform) {} gi_probe_instance_set_bounds(RID p_probe,const Vector3 & p_bounds)107 void gi_probe_instance_set_bounds(RID p_probe, const Vector3 &p_bounds) {} 108 render_scene(const Transform & p_cam_transform,const CameraMatrix & p_cam_projection,bool p_cam_ortogonal,InstanceBase ** p_cull_result,int p_cull_count,RID * p_light_cull_result,int p_light_cull_count,RID * p_reflection_probe_cull_result,int p_reflection_probe_cull_count,RID p_environment,RID p_shadow_atlas,RID p_reflection_atlas,RID p_reflection_probe,int p_reflection_probe_pass)109 void render_scene(const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, InstanceBase **p_cull_result, int p_cull_count, RID *p_light_cull_result, int p_light_cull_count, RID *p_reflection_probe_cull_result, int p_reflection_probe_cull_count, RID p_environment, RID p_shadow_atlas, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass) {} render_shadow(RID p_light,RID p_shadow_atlas,int p_pass,InstanceBase ** p_cull_result,int p_cull_count)110 void render_shadow(RID p_light, RID p_shadow_atlas, int p_pass, InstanceBase **p_cull_result, int p_cull_count) {} 111 set_scene_pass(uint64_t p_pass)112 void set_scene_pass(uint64_t p_pass) {} set_debug_draw_mode(VS::ViewportDebugDraw p_debug_draw)113 void set_debug_draw_mode(VS::ViewportDebugDraw p_debug_draw) {} 114 free(RID p_rid)115 bool free(RID p_rid) { return true; } 116 RasterizerSceneDummy()117 RasterizerSceneDummy() {} ~RasterizerSceneDummy()118 ~RasterizerSceneDummy() {} 119 }; 120 121 class RasterizerStorageDummy : public RasterizerStorage { 122 public: 123 /* TEXTURE API */ 124 struct DummyTexture : public RID_Data { 125 int width; 126 int height; 127 uint32_t flags; 128 Image::Format format; 129 Ref<Image> image; 130 String path; 131 }; 132 133 struct DummySurface { 134 uint32_t format; 135 VS::PrimitiveType primitive; 136 PoolVector<uint8_t> array; 137 int vertex_count; 138 PoolVector<uint8_t> index_array; 139 int index_count; 140 AABB aabb; 141 Vector<PoolVector<uint8_t> > blend_shapes; 142 Vector<AABB> bone_aabbs; 143 }; 144 145 struct DummyMesh : public RID_Data { 146 Vector<DummySurface> surfaces; 147 int blend_shape_count; 148 VS::BlendShapeMode blend_shape_mode; 149 }; 150 151 mutable RID_Owner<DummyTexture> texture_owner; 152 mutable RID_Owner<DummyMesh> mesh_owner; 153 texture_create()154 RID texture_create() { 155 156 DummyTexture *texture = memnew(DummyTexture); 157 ERR_FAIL_COND_V(!texture, RID()); 158 return texture_owner.make_rid(texture); 159 } 160 161 void texture_allocate(RID p_texture, int p_width, int p_height, int p_depth_3d, Image::Format p_format, VisualServer::TextureType p_type = VS::TEXTURE_TYPE_2D, uint32_t p_flags = VS::TEXTURE_FLAGS_DEFAULT) { 162 DummyTexture *t = texture_owner.getornull(p_texture); 163 ERR_FAIL_COND(!t); 164 t->width = p_width; 165 t->height = p_height; 166 t->flags = p_flags; 167 t->format = p_format; 168 t->image = Ref<Image>(memnew(Image)); 169 t->image->create(p_width, p_height, false, p_format); 170 } texture_set_data(RID p_texture,const Ref<Image> & p_image,int p_level)171 void texture_set_data(RID p_texture, const Ref<Image> &p_image, int p_level) { 172 DummyTexture *t = texture_owner.getornull(p_texture); 173 ERR_FAIL_COND(!t); 174 t->width = p_image->get_width(); 175 t->height = p_image->get_height(); 176 t->format = p_image->get_format(); 177 t->image->create(t->width, t->height, false, t->format, p_image->get_data()); 178 } 179 texture_set_data_partial(RID p_texture,const Ref<Image> & p_image,int src_x,int src_y,int src_w,int src_h,int dst_x,int dst_y,int p_dst_mip,int p_level)180 void texture_set_data_partial(RID p_texture, const Ref<Image> &p_image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int p_dst_mip, int p_level) { 181 DummyTexture *t = texture_owner.get(p_texture); 182 183 ERR_FAIL_COND(!t); 184 ERR_FAIL_COND_MSG(p_image.is_null(), "It's not a reference to a valid Image object."); 185 ERR_FAIL_COND(t->format != p_image->get_format()); 186 ERR_FAIL_COND(src_w <= 0 || src_h <= 0); 187 ERR_FAIL_COND(src_x < 0 || src_y < 0 || src_x + src_w > p_image->get_width() || src_y + src_h > p_image->get_height()); 188 ERR_FAIL_COND(dst_x < 0 || dst_y < 0 || dst_x + src_w > t->width || dst_y + src_h > t->height); 189 190 t->image->blit_rect(p_image, Rect2(src_x, src_y, src_w, src_h), Vector2(dst_x, dst_y)); 191 } 192 texture_get_data(RID p_texture,int p_level)193 Ref<Image> texture_get_data(RID p_texture, int p_level) const { 194 DummyTexture *t = texture_owner.getornull(p_texture); 195 ERR_FAIL_COND_V(!t, Ref<Image>()); 196 return t->image; 197 } texture_set_flags(RID p_texture,uint32_t p_flags)198 void texture_set_flags(RID p_texture, uint32_t p_flags) { 199 DummyTexture *t = texture_owner.getornull(p_texture); 200 ERR_FAIL_COND(!t); 201 t->flags = p_flags; 202 } texture_get_flags(RID p_texture)203 uint32_t texture_get_flags(RID p_texture) const { 204 DummyTexture *t = texture_owner.getornull(p_texture); 205 ERR_FAIL_COND_V(!t, 0); 206 return t->flags; 207 } texture_get_format(RID p_texture)208 Image::Format texture_get_format(RID p_texture) const { 209 DummyTexture *t = texture_owner.getornull(p_texture); 210 ERR_FAIL_COND_V(!t, Image::FORMAT_RGB8); 211 return t->format; 212 } 213 texture_get_type(RID p_texture)214 VisualServer::TextureType texture_get_type(RID p_texture) const { return VS::TEXTURE_TYPE_2D; } texture_get_texid(RID p_texture)215 uint32_t texture_get_texid(RID p_texture) const { return 0; } texture_get_width(RID p_texture)216 uint32_t texture_get_width(RID p_texture) const { return 0; } texture_get_height(RID p_texture)217 uint32_t texture_get_height(RID p_texture) const { return 0; } texture_get_depth(RID p_texture)218 uint32_t texture_get_depth(RID p_texture) const { return 0; } texture_set_size_override(RID p_texture,int p_width,int p_height,int p_depth_3d)219 void texture_set_size_override(RID p_texture, int p_width, int p_height, int p_depth_3d) {} texture_bind(RID p_texture,uint32_t p_texture_no)220 void texture_bind(RID p_texture, uint32_t p_texture_no) {} 221 texture_set_path(RID p_texture,const String & p_path)222 void texture_set_path(RID p_texture, const String &p_path) { 223 DummyTexture *t = texture_owner.getornull(p_texture); 224 ERR_FAIL_COND(!t); 225 t->path = p_path; 226 } texture_get_path(RID p_texture)227 String texture_get_path(RID p_texture) const { 228 DummyTexture *t = texture_owner.getornull(p_texture); 229 ERR_FAIL_COND_V(!t, String()); 230 return t->path; 231 } 232 texture_set_shrink_all_x2_on_set_data(bool p_enable)233 void texture_set_shrink_all_x2_on_set_data(bool p_enable) {} 234 texture_debug_usage(List<VS::TextureInfo> * r_info)235 void texture_debug_usage(List<VS::TextureInfo> *r_info) {} 236 237 RID texture_create_radiance_cubemap(RID p_source, int p_resolution = -1) const { return RID(); } 238 texture_set_detect_3d_callback(RID p_texture,VisualServer::TextureDetectCallback p_callback,void * p_userdata)239 void texture_set_detect_3d_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata) {} texture_set_detect_srgb_callback(RID p_texture,VisualServer::TextureDetectCallback p_callback,void * p_userdata)240 void texture_set_detect_srgb_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata) {} texture_set_detect_normal_callback(RID p_texture,VisualServer::TextureDetectCallback p_callback,void * p_userdata)241 void texture_set_detect_normal_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata) {} 242 textures_keep_original(bool p_enable)243 void textures_keep_original(bool p_enable) {} 244 texture_set_proxy(RID p_proxy,RID p_base)245 void texture_set_proxy(RID p_proxy, RID p_base) {} texture_size_with_proxy(RID p_texture)246 virtual Size2 texture_size_with_proxy(RID p_texture) const { return Size2(); } texture_set_force_redraw_if_visible(RID p_texture,bool p_enable)247 void texture_set_force_redraw_if_visible(RID p_texture, bool p_enable) {} 248 249 /* SKY API */ 250 sky_create()251 RID sky_create() { return RID(); } sky_set_texture(RID p_sky,RID p_cube_map,int p_radiance_size)252 void sky_set_texture(RID p_sky, RID p_cube_map, int p_radiance_size) {} 253 254 /* SHADER API */ 255 shader_create()256 RID shader_create() { return RID(); } 257 shader_set_code(RID p_shader,const String & p_code)258 void shader_set_code(RID p_shader, const String &p_code) {} shader_get_code(RID p_shader)259 String shader_get_code(RID p_shader) const { return ""; } shader_get_param_list(RID p_shader,List<PropertyInfo> * p_param_list)260 void shader_get_param_list(RID p_shader, List<PropertyInfo> *p_param_list) const {} 261 shader_set_default_texture_param(RID p_shader,const StringName & p_name,RID p_texture)262 void shader_set_default_texture_param(RID p_shader, const StringName &p_name, RID p_texture) {} shader_get_default_texture_param(RID p_shader,const StringName & p_name)263 RID shader_get_default_texture_param(RID p_shader, const StringName &p_name) const { return RID(); } 264 shader_add_custom_define(RID p_shader,const String & p_define)265 void shader_add_custom_define(RID p_shader, const String &p_define) {} shader_get_custom_defines(RID p_shader,Vector<String> * p_defines)266 void shader_get_custom_defines(RID p_shader, Vector<String> *p_defines) const {} shader_remove_custom_define(RID p_shader,const String & p_define)267 void shader_remove_custom_define(RID p_shader, const String &p_define) {} 268 269 /* COMMON MATERIAL API */ 270 material_create()271 RID material_create() { return RID(); } 272 material_set_render_priority(RID p_material,int priority)273 void material_set_render_priority(RID p_material, int priority) {} material_set_shader(RID p_shader_material,RID p_shader)274 void material_set_shader(RID p_shader_material, RID p_shader) {} material_get_shader(RID p_shader_material)275 RID material_get_shader(RID p_shader_material) const { return RID(); } 276 material_set_param(RID p_material,const StringName & p_param,const Variant & p_value)277 void material_set_param(RID p_material, const StringName &p_param, const Variant &p_value) {} material_get_param(RID p_material,const StringName & p_param)278 Variant material_get_param(RID p_material, const StringName &p_param) const { return Variant(); } material_get_param_default(RID p_material,const StringName & p_param)279 Variant material_get_param_default(RID p_material, const StringName &p_param) const { return Variant(); } 280 material_set_line_width(RID p_material,float p_width)281 void material_set_line_width(RID p_material, float p_width) {} 282 material_set_next_pass(RID p_material,RID p_next_material)283 void material_set_next_pass(RID p_material, RID p_next_material) {} 284 material_is_animated(RID p_material)285 bool material_is_animated(RID p_material) { return false; } material_casts_shadows(RID p_material)286 bool material_casts_shadows(RID p_material) { return false; } 287 material_add_instance_owner(RID p_material,RasterizerScene::InstanceBase * p_instance)288 void material_add_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance) {} material_remove_instance_owner(RID p_material,RasterizerScene::InstanceBase * p_instance)289 void material_remove_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance) {} 290 291 /* MESH API */ 292 mesh_create()293 RID mesh_create() { 294 DummyMesh *mesh = memnew(DummyMesh); 295 ERR_FAIL_COND_V(!mesh, RID()); 296 mesh->blend_shape_count = 0; 297 mesh->blend_shape_mode = VS::BLEND_SHAPE_MODE_NORMALIZED; 298 return mesh_owner.make_rid(mesh); 299 } 300 301 void mesh_add_surface(RID p_mesh, uint32_t p_format, VS::PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes = Vector<PoolVector<uint8_t> >(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>()) { 302 DummyMesh *m = mesh_owner.getornull(p_mesh); 303 ERR_FAIL_COND(!m); 304 305 m->surfaces.push_back(DummySurface()); 306 DummySurface *s = &m->surfaces.write[m->surfaces.size() - 1]; 307 s->format = p_format; 308 s->primitive = p_primitive; 309 s->array = p_array; 310 s->vertex_count = p_vertex_count; 311 s->index_array = p_index_array; 312 s->index_count = p_index_count; 313 s->aabb = p_aabb; 314 s->blend_shapes = p_blend_shapes; 315 s->bone_aabbs = p_bone_aabbs; 316 } 317 mesh_set_blend_shape_count(RID p_mesh,int p_amount)318 void mesh_set_blend_shape_count(RID p_mesh, int p_amount) { 319 DummyMesh *m = mesh_owner.getornull(p_mesh); 320 ERR_FAIL_COND(!m); 321 m->blend_shape_count = p_amount; 322 } mesh_get_blend_shape_count(RID p_mesh)323 int mesh_get_blend_shape_count(RID p_mesh) const { 324 DummyMesh *m = mesh_owner.getornull(p_mesh); 325 ERR_FAIL_COND_V(!m, 0); 326 return m->blend_shape_count; 327 } 328 mesh_set_blend_shape_mode(RID p_mesh,VS::BlendShapeMode p_mode)329 void mesh_set_blend_shape_mode(RID p_mesh, VS::BlendShapeMode p_mode) { 330 DummyMesh *m = mesh_owner.getornull(p_mesh); 331 ERR_FAIL_COND(!m); 332 m->blend_shape_mode = p_mode; 333 } mesh_get_blend_shape_mode(RID p_mesh)334 VS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const { 335 DummyMesh *m = mesh_owner.getornull(p_mesh); 336 ERR_FAIL_COND_V(!m, VS::BLEND_SHAPE_MODE_NORMALIZED); 337 return m->blend_shape_mode; 338 } 339 mesh_surface_update_region(RID p_mesh,int p_surface,int p_offset,const PoolVector<uint8_t> & p_data)340 void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) {} 341 mesh_surface_set_material(RID p_mesh,int p_surface,RID p_material)342 void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) {} mesh_surface_get_material(RID p_mesh,int p_surface)343 RID mesh_surface_get_material(RID p_mesh, int p_surface) const { return RID(); } 344 mesh_surface_get_array_len(RID p_mesh,int p_surface)345 int mesh_surface_get_array_len(RID p_mesh, int p_surface) const { 346 DummyMesh *m = mesh_owner.getornull(p_mesh); 347 ERR_FAIL_COND_V(!m, 0); 348 349 return m->surfaces[p_surface].vertex_count; 350 } mesh_surface_get_array_index_len(RID p_mesh,int p_surface)351 int mesh_surface_get_array_index_len(RID p_mesh, int p_surface) const { 352 DummyMesh *m = mesh_owner.getornull(p_mesh); 353 ERR_FAIL_COND_V(!m, 0); 354 355 return m->surfaces[p_surface].index_count; 356 } 357 mesh_surface_get_array(RID p_mesh,int p_surface)358 PoolVector<uint8_t> mesh_surface_get_array(RID p_mesh, int p_surface) const { 359 DummyMesh *m = mesh_owner.getornull(p_mesh); 360 ERR_FAIL_COND_V(!m, PoolVector<uint8_t>()); 361 362 return m->surfaces[p_surface].array; 363 } mesh_surface_get_index_array(RID p_mesh,int p_surface)364 PoolVector<uint8_t> mesh_surface_get_index_array(RID p_mesh, int p_surface) const { 365 DummyMesh *m = mesh_owner.getornull(p_mesh); 366 ERR_FAIL_COND_V(!m, PoolVector<uint8_t>()); 367 368 return m->surfaces[p_surface].index_array; 369 } 370 mesh_surface_get_format(RID p_mesh,int p_surface)371 uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const { 372 DummyMesh *m = mesh_owner.getornull(p_mesh); 373 ERR_FAIL_COND_V(!m, 0); 374 375 return m->surfaces[p_surface].format; 376 } mesh_surface_get_primitive_type(RID p_mesh,int p_surface)377 VS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const { 378 DummyMesh *m = mesh_owner.getornull(p_mesh); 379 ERR_FAIL_COND_V(!m, VS::PRIMITIVE_POINTS); 380 381 return m->surfaces[p_surface].primitive; 382 } 383 mesh_surface_get_aabb(RID p_mesh,int p_surface)384 AABB mesh_surface_get_aabb(RID p_mesh, int p_surface) const { 385 DummyMesh *m = mesh_owner.getornull(p_mesh); 386 ERR_FAIL_COND_V(!m, AABB()); 387 388 return m->surfaces[p_surface].aabb; 389 } mesh_surface_get_blend_shapes(RID p_mesh,int p_surface)390 Vector<PoolVector<uint8_t> > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const { 391 DummyMesh *m = mesh_owner.getornull(p_mesh); 392 ERR_FAIL_COND_V(!m, Vector<PoolVector<uint8_t> >()); 393 394 return m->surfaces[p_surface].blend_shapes; 395 } mesh_surface_get_skeleton_aabb(RID p_mesh,int p_surface)396 Vector<AABB> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const { 397 DummyMesh *m = mesh_owner.getornull(p_mesh); 398 ERR_FAIL_COND_V(!m, Vector<AABB>()); 399 400 return m->surfaces[p_surface].bone_aabbs; 401 } 402 mesh_remove_surface(RID p_mesh,int p_index)403 void mesh_remove_surface(RID p_mesh, int p_index) { 404 DummyMesh *m = mesh_owner.getornull(p_mesh); 405 ERR_FAIL_COND(!m); 406 ERR_FAIL_COND(p_index >= m->surfaces.size()); 407 408 m->surfaces.remove(p_index); 409 } mesh_get_surface_count(RID p_mesh)410 int mesh_get_surface_count(RID p_mesh) const { 411 DummyMesh *m = mesh_owner.getornull(p_mesh); 412 ERR_FAIL_COND_V(!m, 0); 413 return m->surfaces.size(); 414 } 415 mesh_set_custom_aabb(RID p_mesh,const AABB & p_aabb)416 void mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb) {} mesh_get_custom_aabb(RID p_mesh)417 AABB mesh_get_custom_aabb(RID p_mesh) const { return AABB(); } 418 mesh_get_aabb(RID p_mesh,RID p_skeleton)419 AABB mesh_get_aabb(RID p_mesh, RID p_skeleton) const { return AABB(); } mesh_clear(RID p_mesh)420 void mesh_clear(RID p_mesh) {} 421 422 /* MULTIMESH API */ 423 multimesh_create()424 virtual RID multimesh_create() { return RID(); } 425 426 void multimesh_allocate(RID p_multimesh, int p_instances, VS::MultimeshTransformFormat p_transform_format, VS::MultimeshColorFormat p_color_format, VS::MultimeshCustomDataFormat p_data = VS::MULTIMESH_CUSTOM_DATA_NONE) {} multimesh_get_instance_count(RID p_multimesh)427 int multimesh_get_instance_count(RID p_multimesh) const { return 0; } 428 multimesh_set_mesh(RID p_multimesh,RID p_mesh)429 void multimesh_set_mesh(RID p_multimesh, RID p_mesh) {} multimesh_instance_set_transform(RID p_multimesh,int p_index,const Transform & p_transform)430 void multimesh_instance_set_transform(RID p_multimesh, int p_index, const Transform &p_transform) {} multimesh_instance_set_transform_2d(RID p_multimesh,int p_index,const Transform2D & p_transform)431 void multimesh_instance_set_transform_2d(RID p_multimesh, int p_index, const Transform2D &p_transform) {} multimesh_instance_set_color(RID p_multimesh,int p_index,const Color & p_color)432 void multimesh_instance_set_color(RID p_multimesh, int p_index, const Color &p_color) {} multimesh_instance_set_custom_data(RID p_multimesh,int p_index,const Color & p_color)433 void multimesh_instance_set_custom_data(RID p_multimesh, int p_index, const Color &p_color) {} 434 multimesh_get_mesh(RID p_multimesh)435 RID multimesh_get_mesh(RID p_multimesh) const { return RID(); } 436 multimesh_instance_get_transform(RID p_multimesh,int p_index)437 Transform multimesh_instance_get_transform(RID p_multimesh, int p_index) const { return Transform(); } multimesh_instance_get_transform_2d(RID p_multimesh,int p_index)438 Transform2D multimesh_instance_get_transform_2d(RID p_multimesh, int p_index) const { return Transform2D(); } multimesh_instance_get_color(RID p_multimesh,int p_index)439 Color multimesh_instance_get_color(RID p_multimesh, int p_index) const { return Color(); } multimesh_instance_get_custom_data(RID p_multimesh,int p_index)440 Color multimesh_instance_get_custom_data(RID p_multimesh, int p_index) const { return Color(); } 441 multimesh_set_as_bulk_array(RID p_multimesh,const PoolVector<float> & p_array)442 void multimesh_set_as_bulk_array(RID p_multimesh, const PoolVector<float> &p_array) {} 443 multimesh_set_visible_instances(RID p_multimesh,int p_visible)444 void multimesh_set_visible_instances(RID p_multimesh, int p_visible) {} multimesh_get_visible_instances(RID p_multimesh)445 int multimesh_get_visible_instances(RID p_multimesh) const { return 0; } 446 multimesh_get_aabb(RID p_multimesh)447 AABB multimesh_get_aabb(RID p_multimesh) const { return AABB(); } 448 449 /* IMMEDIATE API */ 450 immediate_create()451 RID immediate_create() { return RID(); } 452 void immediate_begin(RID p_immediate, VS::PrimitiveType p_rimitive, RID p_texture = RID()) {} immediate_vertex(RID p_immediate,const Vector3 & p_vertex)453 void immediate_vertex(RID p_immediate, const Vector3 &p_vertex) {} immediate_normal(RID p_immediate,const Vector3 & p_normal)454 void immediate_normal(RID p_immediate, const Vector3 &p_normal) {} immediate_tangent(RID p_immediate,const Plane & p_tangent)455 void immediate_tangent(RID p_immediate, const Plane &p_tangent) {} immediate_color(RID p_immediate,const Color & p_color)456 void immediate_color(RID p_immediate, const Color &p_color) {} immediate_uv(RID p_immediate,const Vector2 & tex_uv)457 void immediate_uv(RID p_immediate, const Vector2 &tex_uv) {} immediate_uv2(RID p_immediate,const Vector2 & tex_uv)458 void immediate_uv2(RID p_immediate, const Vector2 &tex_uv) {} immediate_end(RID p_immediate)459 void immediate_end(RID p_immediate) {} immediate_clear(RID p_immediate)460 void immediate_clear(RID p_immediate) {} immediate_set_material(RID p_immediate,RID p_material)461 void immediate_set_material(RID p_immediate, RID p_material) {} immediate_get_material(RID p_immediate)462 RID immediate_get_material(RID p_immediate) const { return RID(); } immediate_get_aabb(RID p_immediate)463 AABB immediate_get_aabb(RID p_immediate) const { return AABB(); } 464 465 /* SKELETON API */ 466 skeleton_create()467 RID skeleton_create() { return RID(); } 468 void skeleton_allocate(RID p_skeleton, int p_bones, bool p_2d_skeleton = false) {} skeleton_set_base_transform_2d(RID p_skeleton,const Transform2D & p_base_transform)469 void skeleton_set_base_transform_2d(RID p_skeleton, const Transform2D &p_base_transform) {} skeleton_set_world_transform(RID p_skeleton,bool p_enable,const Transform & p_world_transform)470 void skeleton_set_world_transform(RID p_skeleton, bool p_enable, const Transform &p_world_transform) {} skeleton_get_bone_count(RID p_skeleton)471 int skeleton_get_bone_count(RID p_skeleton) const { return 0; } skeleton_bone_set_transform(RID p_skeleton,int p_bone,const Transform & p_transform)472 void skeleton_bone_set_transform(RID p_skeleton, int p_bone, const Transform &p_transform) {} skeleton_bone_get_transform(RID p_skeleton,int p_bone)473 Transform skeleton_bone_get_transform(RID p_skeleton, int p_bone) const { return Transform(); } skeleton_bone_set_transform_2d(RID p_skeleton,int p_bone,const Transform2D & p_transform)474 void skeleton_bone_set_transform_2d(RID p_skeleton, int p_bone, const Transform2D &p_transform) {} skeleton_bone_get_transform_2d(RID p_skeleton,int p_bone)475 Transform2D skeleton_bone_get_transform_2d(RID p_skeleton, int p_bone) const { return Transform2D(); } 476 477 /* Light API */ 478 light_create(VS::LightType p_type)479 RID light_create(VS::LightType p_type) { return RID(); } 480 directional_light_create()481 RID directional_light_create() { return light_create(VS::LIGHT_DIRECTIONAL); } omni_light_create()482 RID omni_light_create() { return light_create(VS::LIGHT_OMNI); } spot_light_create()483 RID spot_light_create() { return light_create(VS::LIGHT_SPOT); } 484 light_set_color(RID p_light,const Color & p_color)485 void light_set_color(RID p_light, const Color &p_color) {} light_set_param(RID p_light,VS::LightParam p_param,float p_value)486 void light_set_param(RID p_light, VS::LightParam p_param, float p_value) {} light_set_shadow(RID p_light,bool p_enabled)487 void light_set_shadow(RID p_light, bool p_enabled) {} light_set_shadow_color(RID p_light,const Color & p_color)488 void light_set_shadow_color(RID p_light, const Color &p_color) {} light_set_projector(RID p_light,RID p_texture)489 void light_set_projector(RID p_light, RID p_texture) {} light_set_negative(RID p_light,bool p_enable)490 void light_set_negative(RID p_light, bool p_enable) {} light_set_cull_mask(RID p_light,uint32_t p_mask)491 void light_set_cull_mask(RID p_light, uint32_t p_mask) {} light_set_reverse_cull_face_mode(RID p_light,bool p_enabled)492 void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) {} light_set_use_gi(RID p_light,bool p_enabled)493 void light_set_use_gi(RID p_light, bool p_enabled) {} 494 light_omni_set_shadow_mode(RID p_light,VS::LightOmniShadowMode p_mode)495 void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) {} light_omni_set_shadow_detail(RID p_light,VS::LightOmniShadowDetail p_detail)496 void light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail) {} 497 light_directional_set_shadow_mode(RID p_light,VS::LightDirectionalShadowMode p_mode)498 void light_directional_set_shadow_mode(RID p_light, VS::LightDirectionalShadowMode p_mode) {} light_directional_set_blend_splits(RID p_light,bool p_enable)499 void light_directional_set_blend_splits(RID p_light, bool p_enable) {} light_directional_get_blend_splits(RID p_light)500 bool light_directional_get_blend_splits(RID p_light) const { return false; } light_directional_set_shadow_depth_range_mode(RID p_light,VS::LightDirectionalShadowDepthRangeMode p_range_mode)501 void light_directional_set_shadow_depth_range_mode(RID p_light, VS::LightDirectionalShadowDepthRangeMode p_range_mode) {} light_directional_get_shadow_depth_range_mode(RID p_light)502 VS::LightDirectionalShadowDepthRangeMode light_directional_get_shadow_depth_range_mode(RID p_light) const { return VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE; } 503 light_directional_get_shadow_mode(RID p_light)504 VS::LightDirectionalShadowMode light_directional_get_shadow_mode(RID p_light) { return VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL; } light_omni_get_shadow_mode(RID p_light)505 VS::LightOmniShadowMode light_omni_get_shadow_mode(RID p_light) { return VS::LIGHT_OMNI_SHADOW_DUAL_PARABOLOID; } 506 light_has_shadow(RID p_light)507 bool light_has_shadow(RID p_light) const { return false; } 508 light_get_type(RID p_light)509 VS::LightType light_get_type(RID p_light) const { return VS::LIGHT_OMNI; } light_get_aabb(RID p_light)510 AABB light_get_aabb(RID p_light) const { return AABB(); } light_get_param(RID p_light,VS::LightParam p_param)511 float light_get_param(RID p_light, VS::LightParam p_param) { return 0.0; } light_get_color(RID p_light)512 Color light_get_color(RID p_light) { return Color(); } light_get_use_gi(RID p_light)513 bool light_get_use_gi(RID p_light) { return false; } light_get_version(RID p_light)514 uint64_t light_get_version(RID p_light) const { return 0; } 515 516 /* PROBE API */ 517 reflection_probe_create()518 RID reflection_probe_create() { return RID(); } 519 reflection_probe_set_update_mode(RID p_probe,VS::ReflectionProbeUpdateMode p_mode)520 void reflection_probe_set_update_mode(RID p_probe, VS::ReflectionProbeUpdateMode p_mode) {} reflection_probe_set_intensity(RID p_probe,float p_intensity)521 void reflection_probe_set_intensity(RID p_probe, float p_intensity) {} reflection_probe_set_interior_ambient(RID p_probe,const Color & p_ambient)522 void reflection_probe_set_interior_ambient(RID p_probe, const Color &p_ambient) {} reflection_probe_set_interior_ambient_energy(RID p_probe,float p_energy)523 void reflection_probe_set_interior_ambient_energy(RID p_probe, float p_energy) {} reflection_probe_set_interior_ambient_probe_contribution(RID p_probe,float p_contrib)524 void reflection_probe_set_interior_ambient_probe_contribution(RID p_probe, float p_contrib) {} reflection_probe_set_max_distance(RID p_probe,float p_distance)525 void reflection_probe_set_max_distance(RID p_probe, float p_distance) {} reflection_probe_set_extents(RID p_probe,const Vector3 & p_extents)526 void reflection_probe_set_extents(RID p_probe, const Vector3 &p_extents) {} reflection_probe_set_origin_offset(RID p_probe,const Vector3 & p_offset)527 void reflection_probe_set_origin_offset(RID p_probe, const Vector3 &p_offset) {} reflection_probe_set_as_interior(RID p_probe,bool p_enable)528 void reflection_probe_set_as_interior(RID p_probe, bool p_enable) {} reflection_probe_set_enable_box_projection(RID p_probe,bool p_enable)529 void reflection_probe_set_enable_box_projection(RID p_probe, bool p_enable) {} reflection_probe_set_enable_shadows(RID p_probe,bool p_enable)530 void reflection_probe_set_enable_shadows(RID p_probe, bool p_enable) {} reflection_probe_set_cull_mask(RID p_probe,uint32_t p_layers)531 void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers) {} reflection_probe_set_resolution(RID p_probe,int p_resolution)532 void reflection_probe_set_resolution(RID p_probe, int p_resolution) {} 533 reflection_probe_get_aabb(RID p_probe)534 AABB reflection_probe_get_aabb(RID p_probe) const { return AABB(); } reflection_probe_get_update_mode(RID p_probe)535 VS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const { return VisualServer::REFLECTION_PROBE_UPDATE_ONCE; } reflection_probe_get_cull_mask(RID p_probe)536 uint32_t reflection_probe_get_cull_mask(RID p_probe) const { return 0; } reflection_probe_get_extents(RID p_probe)537 Vector3 reflection_probe_get_extents(RID p_probe) const { return Vector3(); } reflection_probe_get_origin_offset(RID p_probe)538 Vector3 reflection_probe_get_origin_offset(RID p_probe) const { return Vector3(); } reflection_probe_get_origin_max_distance(RID p_probe)539 float reflection_probe_get_origin_max_distance(RID p_probe) const { return 0.0; } reflection_probe_renders_shadows(RID p_probe)540 bool reflection_probe_renders_shadows(RID p_probe) const { return false; } 541 instance_add_skeleton(RID p_skeleton,RasterizerScene::InstanceBase * p_instance)542 void instance_add_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance) {} instance_remove_skeleton(RID p_skeleton,RasterizerScene::InstanceBase * p_instance)543 void instance_remove_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance) {} 544 instance_add_dependency(RID p_base,RasterizerScene::InstanceBase * p_instance)545 void instance_add_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance) {} instance_remove_dependency(RID p_base,RasterizerScene::InstanceBase * p_instance)546 void instance_remove_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance) {} 547 548 /* GI PROBE API */ 549 gi_probe_create()550 RID gi_probe_create() { return RID(); } 551 gi_probe_set_bounds(RID p_probe,const AABB & p_bounds)552 void gi_probe_set_bounds(RID p_probe, const AABB &p_bounds) {} gi_probe_get_bounds(RID p_probe)553 AABB gi_probe_get_bounds(RID p_probe) const { return AABB(); } 554 gi_probe_set_cell_size(RID p_probe,float p_range)555 void gi_probe_set_cell_size(RID p_probe, float p_range) {} gi_probe_get_cell_size(RID p_probe)556 float gi_probe_get_cell_size(RID p_probe) const { return 0.0; } 557 gi_probe_set_to_cell_xform(RID p_probe,const Transform & p_xform)558 void gi_probe_set_to_cell_xform(RID p_probe, const Transform &p_xform) {} gi_probe_get_to_cell_xform(RID p_probe)559 Transform gi_probe_get_to_cell_xform(RID p_probe) const { return Transform(); } 560 gi_probe_set_dynamic_data(RID p_probe,const PoolVector<int> & p_data)561 void gi_probe_set_dynamic_data(RID p_probe, const PoolVector<int> &p_data) {} gi_probe_get_dynamic_data(RID p_probe)562 PoolVector<int> gi_probe_get_dynamic_data(RID p_probe) const { 563 PoolVector<int> p; 564 return p; 565 } 566 gi_probe_set_dynamic_range(RID p_probe,int p_range)567 void gi_probe_set_dynamic_range(RID p_probe, int p_range) {} gi_probe_get_dynamic_range(RID p_probe)568 int gi_probe_get_dynamic_range(RID p_probe) const { return 0; } 569 gi_probe_set_energy(RID p_probe,float p_range)570 void gi_probe_set_energy(RID p_probe, float p_range) {} gi_probe_get_energy(RID p_probe)571 float gi_probe_get_energy(RID p_probe) const { return 0.0; } 572 gi_probe_set_bias(RID p_probe,float p_range)573 void gi_probe_set_bias(RID p_probe, float p_range) {} gi_probe_get_bias(RID p_probe)574 float gi_probe_get_bias(RID p_probe) const { return 0.0; } 575 gi_probe_set_normal_bias(RID p_probe,float p_range)576 void gi_probe_set_normal_bias(RID p_probe, float p_range) {} gi_probe_get_normal_bias(RID p_probe)577 float gi_probe_get_normal_bias(RID p_probe) const { return 0.0; } 578 gi_probe_set_propagation(RID p_probe,float p_range)579 void gi_probe_set_propagation(RID p_probe, float p_range) {} gi_probe_get_propagation(RID p_probe)580 float gi_probe_get_propagation(RID p_probe) const { return 0.0; } 581 gi_probe_set_interior(RID p_probe,bool p_enable)582 void gi_probe_set_interior(RID p_probe, bool p_enable) {} gi_probe_is_interior(RID p_probe)583 bool gi_probe_is_interior(RID p_probe) const { return false; } 584 gi_probe_set_compress(RID p_probe,bool p_enable)585 void gi_probe_set_compress(RID p_probe, bool p_enable) {} gi_probe_is_compressed(RID p_probe)586 bool gi_probe_is_compressed(RID p_probe) const { return false; } 587 gi_probe_get_version(RID p_probe)588 uint32_t gi_probe_get_version(RID p_probe) { return 0; } 589 gi_probe_get_dynamic_data_get_preferred_compression()590 GIProbeCompression gi_probe_get_dynamic_data_get_preferred_compression() const { return GI_PROBE_UNCOMPRESSED; } gi_probe_dynamic_data_create(int p_width,int p_height,int p_depth,GIProbeCompression p_compression)591 RID gi_probe_dynamic_data_create(int p_width, int p_height, int p_depth, GIProbeCompression p_compression) { return RID(); } gi_probe_dynamic_data_update(RID p_gi_probe_data,int p_depth_slice,int p_slice_count,int p_mipmap,const void * p_data)592 void gi_probe_dynamic_data_update(RID p_gi_probe_data, int p_depth_slice, int p_slice_count, int p_mipmap, const void *p_data) {} 593 594 /* LIGHTMAP CAPTURE */ 595 struct Instantiable : public RID_Data { 596 597 SelfList<RasterizerScene::InstanceBase>::List instance_list; 598 599 _FORCE_INLINE_ void instance_change_notify(bool p_aabb = true, bool p_materials = true) { 600 601 SelfList<RasterizerScene::InstanceBase> *instances = instance_list.first(); 602 while (instances) { 603 604 instances->self()->base_changed(p_aabb, p_materials); 605 instances = instances->next(); 606 } 607 } 608 instance_remove_depsInstantiable609 _FORCE_INLINE_ void instance_remove_deps() { 610 SelfList<RasterizerScene::InstanceBase> *instances = instance_list.first(); 611 while (instances) { 612 613 SelfList<RasterizerScene::InstanceBase> *next = instances->next(); 614 instances->self()->base_removed(); 615 instances = next; 616 } 617 } 618 InstantiableInstantiable619 Instantiable() {} ~InstantiableInstantiable620 virtual ~Instantiable() { 621 } 622 }; 623 624 struct LightmapCapture : public Instantiable { 625 626 PoolVector<LightmapCaptureOctree> octree; 627 AABB bounds; 628 Transform cell_xform; 629 int cell_subdiv; 630 float energy; LightmapCaptureLightmapCapture631 LightmapCapture() { 632 energy = 1.0; 633 cell_subdiv = 1; 634 } 635 }; 636 637 mutable RID_Owner<LightmapCapture> lightmap_capture_data_owner; lightmap_capture_set_bounds(RID p_capture,const AABB & p_bounds)638 void lightmap_capture_set_bounds(RID p_capture, const AABB &p_bounds) {} lightmap_capture_get_bounds(RID p_capture)639 AABB lightmap_capture_get_bounds(RID p_capture) const { return AABB(); } lightmap_capture_set_octree(RID p_capture,const PoolVector<uint8_t> & p_octree)640 void lightmap_capture_set_octree(RID p_capture, const PoolVector<uint8_t> &p_octree) {} lightmap_capture_create()641 RID lightmap_capture_create() { 642 LightmapCapture *capture = memnew(LightmapCapture); 643 return lightmap_capture_data_owner.make_rid(capture); 644 } lightmap_capture_get_octree(RID p_capture)645 PoolVector<uint8_t> lightmap_capture_get_octree(RID p_capture) const { 646 const LightmapCapture *capture = lightmap_capture_data_owner.getornull(p_capture); 647 ERR_FAIL_COND_V(!capture, PoolVector<uint8_t>()); 648 return PoolVector<uint8_t>(); 649 } lightmap_capture_set_octree_cell_transform(RID p_capture,const Transform & p_xform)650 void lightmap_capture_set_octree_cell_transform(RID p_capture, const Transform &p_xform) {} lightmap_capture_get_octree_cell_transform(RID p_capture)651 Transform lightmap_capture_get_octree_cell_transform(RID p_capture) const { return Transform(); } lightmap_capture_set_octree_cell_subdiv(RID p_capture,int p_subdiv)652 void lightmap_capture_set_octree_cell_subdiv(RID p_capture, int p_subdiv) {} lightmap_capture_get_octree_cell_subdiv(RID p_capture)653 int lightmap_capture_get_octree_cell_subdiv(RID p_capture) const { return 0; } lightmap_capture_set_energy(RID p_capture,float p_energy)654 void lightmap_capture_set_energy(RID p_capture, float p_energy) {} lightmap_capture_get_energy(RID p_capture)655 float lightmap_capture_get_energy(RID p_capture) const { return 0.0; } lightmap_capture_get_octree_ptr(RID p_capture)656 const PoolVector<LightmapCaptureOctree> *lightmap_capture_get_octree_ptr(RID p_capture) const { 657 const LightmapCapture *capture = lightmap_capture_data_owner.getornull(p_capture); 658 ERR_FAIL_COND_V(!capture, NULL); 659 return &capture->octree; 660 } 661 662 /* PARTICLES */ 663 particles_create()664 RID particles_create() { return RID(); } 665 particles_set_emitting(RID p_particles,bool p_emitting)666 void particles_set_emitting(RID p_particles, bool p_emitting) {} particles_set_amount(RID p_particles,int p_amount)667 void particles_set_amount(RID p_particles, int p_amount) {} particles_set_lifetime(RID p_particles,float p_lifetime)668 void particles_set_lifetime(RID p_particles, float p_lifetime) {} particles_set_one_shot(RID p_particles,bool p_one_shot)669 void particles_set_one_shot(RID p_particles, bool p_one_shot) {} particles_set_pre_process_time(RID p_particles,float p_time)670 void particles_set_pre_process_time(RID p_particles, float p_time) {} particles_set_explosiveness_ratio(RID p_particles,float p_ratio)671 void particles_set_explosiveness_ratio(RID p_particles, float p_ratio) {} particles_set_randomness_ratio(RID p_particles,float p_ratio)672 void particles_set_randomness_ratio(RID p_particles, float p_ratio) {} particles_set_custom_aabb(RID p_particles,const AABB & p_aabb)673 void particles_set_custom_aabb(RID p_particles, const AABB &p_aabb) {} particles_set_speed_scale(RID p_particles,float p_scale)674 void particles_set_speed_scale(RID p_particles, float p_scale) {} particles_set_use_local_coordinates(RID p_particles,bool p_enable)675 void particles_set_use_local_coordinates(RID p_particles, bool p_enable) {} particles_set_process_material(RID p_particles,RID p_material)676 void particles_set_process_material(RID p_particles, RID p_material) {} particles_set_fixed_fps(RID p_particles,int p_fps)677 void particles_set_fixed_fps(RID p_particles, int p_fps) {} particles_set_fractional_delta(RID p_particles,bool p_enable)678 void particles_set_fractional_delta(RID p_particles, bool p_enable) {} particles_restart(RID p_particles)679 void particles_restart(RID p_particles) {} 680 particles_set_draw_order(RID p_particles,VS::ParticlesDrawOrder p_order)681 void particles_set_draw_order(RID p_particles, VS::ParticlesDrawOrder p_order) {} 682 particles_set_draw_passes(RID p_particles,int p_count)683 void particles_set_draw_passes(RID p_particles, int p_count) {} particles_set_draw_pass_mesh(RID p_particles,int p_pass,RID p_mesh)684 void particles_set_draw_pass_mesh(RID p_particles, int p_pass, RID p_mesh) {} 685 particles_request_process(RID p_particles)686 void particles_request_process(RID p_particles) {} particles_get_current_aabb(RID p_particles)687 AABB particles_get_current_aabb(RID p_particles) { return AABB(); } particles_get_aabb(RID p_particles)688 AABB particles_get_aabb(RID p_particles) const { return AABB(); } 689 particles_set_emission_transform(RID p_particles,const Transform & p_transform)690 void particles_set_emission_transform(RID p_particles, const Transform &p_transform) {} 691 particles_get_emitting(RID p_particles)692 bool particles_get_emitting(RID p_particles) { return false; } particles_get_draw_passes(RID p_particles)693 int particles_get_draw_passes(RID p_particles) const { return 0; } particles_get_draw_pass_mesh(RID p_particles,int p_pass)694 RID particles_get_draw_pass_mesh(RID p_particles, int p_pass) const { return RID(); } 695 particles_is_inactive(RID p_particles)696 virtual bool particles_is_inactive(RID p_particles) const { return false; } 697 698 /* RENDER TARGET */ 699 render_target_create()700 RID render_target_create() { return RID(); } render_target_set_position(RID p_render_target,int p_x,int p_y)701 void render_target_set_position(RID p_render_target, int p_x, int p_y) {} render_target_set_size(RID p_render_target,int p_width,int p_height)702 void render_target_set_size(RID p_render_target, int p_width, int p_height) {} render_target_get_texture(RID p_render_target)703 RID render_target_get_texture(RID p_render_target) const { return RID(); } render_target_set_external_texture(RID p_render_target,unsigned int p_texture_id)704 void render_target_set_external_texture(RID p_render_target, unsigned int p_texture_id) {} render_target_set_flag(RID p_render_target,RenderTargetFlags p_flag,bool p_value)705 void render_target_set_flag(RID p_render_target, RenderTargetFlags p_flag, bool p_value) {} render_target_was_used(RID p_render_target)706 bool render_target_was_used(RID p_render_target) { return false; } render_target_clear_used(RID p_render_target)707 void render_target_clear_used(RID p_render_target) {} render_target_set_msaa(RID p_render_target,VS::ViewportMSAA p_msaa)708 void render_target_set_msaa(RID p_render_target, VS::ViewportMSAA p_msaa) {} 709 710 /* CANVAS SHADOW */ 711 canvas_light_shadow_buffer_create(int p_width)712 RID canvas_light_shadow_buffer_create(int p_width) { return RID(); } 713 714 /* LIGHT SHADOW MAPPING */ 715 canvas_light_occluder_create()716 RID canvas_light_occluder_create() { return RID(); } canvas_light_occluder_set_polylines(RID p_occluder,const PoolVector<Vector2> & p_lines)717 void canvas_light_occluder_set_polylines(RID p_occluder, const PoolVector<Vector2> &p_lines) {} 718 get_base_type(RID p_rid)719 VS::InstanceType get_base_type(RID p_rid) const { 720 if (mesh_owner.owns(p_rid)) { 721 return VS::INSTANCE_MESH; 722 } else if (lightmap_capture_data_owner.owns(p_rid)) { 723 return VS::INSTANCE_LIGHTMAP_CAPTURE; 724 } 725 726 return VS::INSTANCE_NONE; 727 } 728 free(RID p_rid)729 bool free(RID p_rid) { 730 if (texture_owner.owns(p_rid)) { 731 // delete the texture 732 DummyTexture *texture = texture_owner.get(p_rid); 733 texture_owner.free(p_rid); 734 memdelete(texture); 735 } else if (mesh_owner.owns(p_rid)) { 736 // delete the mesh 737 DummyMesh *mesh = mesh_owner.getornull(p_rid); 738 mesh_owner.free(p_rid); 739 memdelete(mesh); 740 } else if (lightmap_capture_data_owner.owns(p_rid)) { 741 // delete the lightmap 742 LightmapCapture *lightmap_capture = lightmap_capture_data_owner.getornull(p_rid); 743 lightmap_capture_data_owner.free(p_rid); 744 memdelete(lightmap_capture); 745 } else { 746 return false; 747 } 748 749 return true; 750 } 751 has_os_feature(const String & p_feature)752 bool has_os_feature(const String &p_feature) const { return false; } 753 update_dirty_resources()754 void update_dirty_resources() {} 755 set_debug_generate_wireframes(bool p_generate)756 void set_debug_generate_wireframes(bool p_generate) {} 757 render_info_begin_capture()758 void render_info_begin_capture() {} render_info_end_capture()759 void render_info_end_capture() {} get_captured_render_info(VS::RenderInfo p_info)760 int get_captured_render_info(VS::RenderInfo p_info) { return 0; } 761 get_render_info(VS::RenderInfo p_info)762 int get_render_info(VS::RenderInfo p_info) { return 0; } get_video_adapter_name()763 String get_video_adapter_name() const { return String(); } get_video_adapter_vendor()764 String get_video_adapter_vendor() const { return String(); } 765 766 static RasterizerStorage *base_singleton; 767 RasterizerStorageDummy()768 RasterizerStorageDummy(){}; ~RasterizerStorageDummy()769 ~RasterizerStorageDummy() {} 770 }; 771 772 class RasterizerCanvasDummy : public RasterizerCanvas { 773 public: light_internal_create()774 RID light_internal_create() { return RID(); } light_internal_update(RID p_rid,Light * p_light)775 void light_internal_update(RID p_rid, Light *p_light) {} light_internal_free(RID p_rid)776 void light_internal_free(RID p_rid) {} 777 canvas_begin()778 void canvas_begin(){}; canvas_end()779 void canvas_end(){}; 780 canvas_render_items(Item * p_item_list,int p_z,const Color & p_modulate,Light * p_light,const Transform2D & p_transform)781 void canvas_render_items(Item *p_item_list, int p_z, const Color &p_modulate, Light *p_light, const Transform2D &p_transform){}; canvas_debug_viewport_shadows(Light * p_lights_with_shadow)782 void canvas_debug_viewport_shadows(Light *p_lights_with_shadow){}; 783 canvas_light_shadow_buffer_update(RID p_buffer,const Transform2D & p_light_xform,int p_light_mask,float p_near,float p_far,LightOccluderInstance * p_occluders,CameraMatrix * p_xform_cache)784 void canvas_light_shadow_buffer_update(RID p_buffer, const Transform2D &p_light_xform, int p_light_mask, float p_near, float p_far, LightOccluderInstance *p_occluders, CameraMatrix *p_xform_cache) {} 785 reset_canvas()786 void reset_canvas() {} 787 draw_window_margins(int * p_margins,RID * p_margin_textures)788 void draw_window_margins(int *p_margins, RID *p_margin_textures) {} 789 RasterizerCanvasDummy()790 RasterizerCanvasDummy() {} ~RasterizerCanvasDummy()791 ~RasterizerCanvasDummy() {} 792 }; 793 794 class RasterizerDummy : public Rasterizer { 795 protected: 796 RasterizerCanvasDummy canvas; 797 RasterizerStorageDummy storage; 798 RasterizerSceneDummy scene; 799 800 public: get_storage()801 RasterizerStorage *get_storage() { return &storage; } get_canvas()802 RasterizerCanvas *get_canvas() { return &canvas; } get_scene()803 RasterizerScene *get_scene() { return &scene; } 804 805 void set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter = true) {} set_shader_time_scale(float p_scale)806 void set_shader_time_scale(float p_scale) {} 807 initialize()808 void initialize() {} begin_frame(double frame_step)809 void begin_frame(double frame_step) {} set_current_render_target(RID p_render_target)810 void set_current_render_target(RID p_render_target) {} restore_render_target(bool p_3d_was_drawn)811 void restore_render_target(bool p_3d_was_drawn) {} clear_render_target(const Color & p_color)812 void clear_render_target(const Color &p_color) {} 813 void blit_render_target_to_screen(RID p_render_target, const Rect2 &p_screen_rect, int p_screen = 0) {} output_lens_distorted_to_screen(RID p_render_target,const Rect2 & p_screen_rect,float p_k1,float p_k2,const Vector2 & p_eye_center,float p_oversample)814 void output_lens_distorted_to_screen(RID p_render_target, const Rect2 &p_screen_rect, float p_k1, float p_k2, const Vector2 &p_eye_center, float p_oversample) {} end_frame(bool p_swap_buffers)815 void end_frame(bool p_swap_buffers) {} finalize()816 void finalize() {} 817 is_viable()818 static Error is_viable() { 819 return OK; 820 } 821 _create_current()822 static Rasterizer *_create_current() { 823 return memnew(RasterizerDummy); 824 } 825 make_current()826 static void make_current() { 827 _create_func = _create_current; 828 } 829 is_low_end()830 virtual bool is_low_end() const { return true; } 831 RasterizerDummy()832 RasterizerDummy() {} ~RasterizerDummy()833 ~RasterizerDummy() {} 834 }; 835 836 #endif // RASTERIZER_DUMMY_H 837