Skip to content

Commit fd4c29a

Browse files
committed
Merge pull request #98683 from clayjohn/wireframe
Ensure shadow material and mesh are not used with wireframe mode
2 parents cf541f0 + 90b4b48 commit fd4c29a

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

doc/classes/RenderingServer.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3321,7 +3321,8 @@
33213321
<return type="void" />
33223322
<param index="0" name="generate" type="bool" />
33233323
<description>
3324-
This method is currently unimplemented and does nothing if called with [param generate] set to [code]true[/code].
3324+
If [param generate] is [code]true[/code], generates debug wireframes for all meshes that are loaded when using the Compatibility renderer. By default, the engine does not generate debug wireframes at runtime, since they slow down loading of assets and take up VRAM.
3325+
[b]Note:[/b] You must call this method before loading any meshes when using the Compatibility renderer, otherwise wireframes will not be used.
33253326
</description>
33263327
</method>
33273328
<method name="set_default_clear_color">
@@ -5054,6 +5055,7 @@
50545055
</constant>
50555056
<constant name="VIEWPORT_DEBUG_DRAW_WIREFRAME" value="4" enum="ViewportDebugDraw">
50565057
Debug draw draws objects in wireframe.
5058+
[b]Note:[/b] [method set_debug_generate_wireframes] must be called before loading any meshes for wireframes to be visible when using the Compatibility renderer.
50575059
</constant>
50585060
<constant name="VIEWPORT_DEBUG_DRAW_NORMAL_BUFFER" value="5" enum="ViewportDebugDraw">
50595061
Normal buffer is drawn instead of regular scene so you can see the per-pixel normals that will be used by post-processing effects.

doc/classes/Viewport.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,7 @@
555555
</constant>
556556
<constant name="DEBUG_DRAW_WIREFRAME" value="4" enum="DebugDraw">
557557
Objects are displayed as wireframe models.
558+
[b]Note:[/b] [method RenderingServer.set_debug_generate_wireframes] must be called before loading any meshes for wireframes to be visible when using the Compatibility renderer.
558559
</constant>
559560
<constant name="DEBUG_DRAW_NORMAL_BUFFER" value="5" enum="DebugDraw">
560561
Objects are displayed without lighting information and their textures replaced by normal mapping.

drivers/gles3/rasterizer_scene_gles3.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ void RasterizerSceneGLES3::_geometry_instance_add_surface_with_material(Geometry
238238

239239
GLES3::SceneMaterialData *material_shadow = nullptr;
240240
void *surface_shadow = nullptr;
241-
if (!p_material->shader_data->uses_particle_trails && !p_material->shader_data->writes_modelview_or_projection && !p_material->shader_data->uses_vertex && !p_material->shader_data->uses_discard && !p_material->shader_data->uses_depth_prepass_alpha && !p_material->shader_data->uses_alpha_clip && !p_material->shader_data->uses_world_coordinates) {
241+
if (!p_material->shader_data->uses_particle_trails && !p_material->shader_data->writes_modelview_or_projection && !p_material->shader_data->uses_vertex && !p_material->shader_data->uses_discard && !p_material->shader_data->uses_depth_prepass_alpha && !p_material->shader_data->uses_alpha_clip && !p_material->shader_data->uses_world_coordinates && !p_material->shader_data->wireframe) {
242242
flags |= GeometryInstanceSurface::FLAG_USES_SHARED_SHADOW_MATERIAL;
243243
material_shadow = static_cast<GLES3::SceneMaterialData *>(GLES3::MaterialStorage::get_singleton()->material_get_data(scene_globals.default_material, RS::SHADER_SPATIAL));
244244

@@ -3157,7 +3157,7 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params,
31573157
}
31583158

31593159
bool use_wireframe = false;
3160-
if (p_params->force_wireframe) {
3160+
if (p_params->force_wireframe || shader->wireframe) {
31613161
GLuint wireframe_index_array_gl = mesh_storage->mesh_surface_get_index_buffer_wireframe(mesh_surface);
31623162
if (wireframe_index_array_gl) {
31633163
index_array_gl = wireframe_index_array_gl;

servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ class SceneShaderForwardClustered {
273273

274274
_FORCE_INLINE_ bool uses_shared_shadow_material() const {
275275
bool backface_culling = cull_mode == CULL_BACK;
276-
return !uses_particle_trails && !writes_modelview_or_projection && !uses_vertex && !uses_position && !uses_discard && !uses_depth_prepass_alpha && !uses_alpha_clip && !uses_alpha_antialiasing && backface_culling && !uses_point_size && !uses_world_coordinates;
276+
return !uses_particle_trails && !writes_modelview_or_projection && !uses_vertex && !uses_position && !uses_discard && !uses_depth_prepass_alpha && !uses_alpha_clip && !uses_alpha_antialiasing && backface_culling && !uses_point_size && !uses_world_coordinates && !wireframe;
277277
}
278278

279279
virtual void set_code(const String &p_Code);

servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ class SceneShaderForwardMobile {
243243
}
244244

245245
_FORCE_INLINE_ bool uses_shared_shadow_material() const {
246-
return !uses_particle_trails && !writes_modelview_or_projection && !uses_vertex && !uses_discard && !uses_depth_prepass_alpha && !uses_alpha_clip && !uses_alpha_antialiasing && !uses_world_coordinates;
246+
return !uses_particle_trails && !writes_modelview_or_projection && !uses_vertex && !uses_discard && !uses_depth_prepass_alpha && !uses_alpha_clip && !uses_alpha_antialiasing && !uses_world_coordinates && !wireframe;
247247
}
248248

249249
virtual void set_code(const String &p_Code);

0 commit comments

Comments
 (0)