From fb8df1a20454a00c7b0c266699735d6d5bac218a Mon Sep 17 00:00:00 2001 From: codeimp Date: Wed, 25 Feb 2009 16:13:06 +0000 Subject: [PATCH] Fixed missing textures bug on floors when View mode is set to Brightness levels --- Source/Rendering/Renderer2D.cs | 41 ++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/Source/Rendering/Renderer2D.cs b/Source/Rendering/Renderer2D.cs index a89b8501..f099a0bc 100644 --- a/Source/Rendering/Renderer2D.cs +++ b/Source/Rendering/Renderer2D.cs @@ -1198,31 +1198,38 @@ namespace CodeImp.DoomBuilder.Rendering if((buffer != null) && (s.FlatVertices != null) && (s.FlatVertices.Length > 0)) { - ImageData img = General.Map.Data.GetFlatImage(longimagename); - if(img != null) + if(longimagename == 0) { - // Texture unknown? - if(img is UnknownImage) + t = whitetexture.Texture; + } + else + { + ImageData img = General.Map.Data.GetFlatImage(longimagename); + if(img != null) { - General.Map.Data.UnknownTexture3D.CreateTexture(); - t = General.Map.Data.UnknownTexture3D.Texture; - } - // Is the texture loaded? - else if(img.IsImageLoaded && !img.LoadFailed) - { - if(img.Texture == null) img.CreateTexture(); - t = img.Texture; + // Texture unknown? + if(img is UnknownImage) + { + General.Map.Data.UnknownTexture3D.CreateTexture(); + t = General.Map.Data.UnknownTexture3D.Texture; + } + // Is the texture loaded? + else if(img.IsImageLoaded && !img.LoadFailed) + { + if(img.Texture == null) img.CreateTexture(); + t = img.Texture; + } + else + { + t = whitetexture.Texture; + } } else { t = whitetexture.Texture; } } - else - { - t = whitetexture.Texture; - } - + // Set renderstates for rendering graphics.Shaders.Display2D.Texture1 = t; graphics.Device.SetTexture(0, t);