From fefcf95b383c215e7d428ebc00ef285c428341ac Mon Sep 17 00:00:00 2001 From: TheBrokenRail <17478432+TheBrokenRail@users.noreply.github.com> Date: Fri, 19 Apr 2024 08:58:49 -0400 Subject: [PATCH] Generate Missing Texture Texture (#116) * Generate Missing Texture Texture * Only Generate Missing Texture For Required Textures --- source/client/renderer/Textures.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/source/client/renderer/Textures.cpp b/source/client/renderer/Textures.cpp index f282ddba..beb88c72 100644 --- a/source/client/renderer/Textures.cpp +++ b/source/client/renderer/Textures.cpp @@ -19,11 +19,23 @@ 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 && bIsRequired) { + 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; + } - return result; + if (t.m_pixels) { + return assignTexture(name, t); + } else { + return -1; + } } int Textures::assignTexture(const std::string& name, Texture& texture)