From add1c71a52b0f89f23e0836e3782de8c6e28e099 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Tue, 23 Jan 2024 22:18:36 -0500 Subject: [PATCH 1/2] Generate Missing Texture Texture --- source/client/renderer/Textures.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/source/client/renderer/Textures.cpp b/source/client/renderer/Textures.cpp index f282ddba..a7872340 100644 --- a/source/client/renderer/Textures.cpp +++ b/source/client/renderer/Textures.cpp @@ -19,9 +19,19 @@ int Textures::loadTexture(const std::string& name, bool bIsRequired) Texture t = m_pPlatform->loadTexture(name, bIsRequired); - int result = -1; - if (t.m_pixels) - result = assignTexture(name, t); + if (!t.m_pixels) { + t.field_C = 1; + t.field_D = 0; + t.m_width = 2; + t.m_height = 2; + t.m_pixels = new uint32_t[4]; + t.m_pixels[0] = 0xfff800f8; + t.m_pixels[1] = 0xff000000; + t.m_pixels[3] = 0xfff800f8; + t.m_pixels[2] = 0xff000000; + } + + int result = assignTexture(name, t); return result; } From 0fee62756dc071db7757bc6e66237d2bb9fca355 Mon Sep 17 00:00:00 2001 From: TheBrokenRail <17478432+TheBrokenRail@users.noreply.github.com> Date: Wed, 17 Apr 2024 01:24:39 -0400 Subject: [PATCH 2/2] Only Generate Missing Texture For Required Textures --- source/client/renderer/Textures.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/client/renderer/Textures.cpp b/source/client/renderer/Textures.cpp index a7872340..beb88c72 100644 --- a/source/client/renderer/Textures.cpp +++ b/source/client/renderer/Textures.cpp @@ -19,7 +19,7 @@ int Textures::loadTexture(const std::string& name, bool bIsRequired) Texture t = m_pPlatform->loadTexture(name, bIsRequired); - if (!t.m_pixels) { + if (!t.m_pixels && bIsRequired) { t.field_C = 1; t.field_D = 0; t.m_width = 2; @@ -31,9 +31,11 @@ int Textures::loadTexture(const std::string& name, bool bIsRequired) t.m_pixels[2] = 0xff000000; } - int result = assignTexture(name, t); - - return result; + if (t.m_pixels) { + return assignTexture(name, t); + } else { + return -1; + } } int Textures::assignTexture(const std::string& name, Texture& texture)