From a6e8bb7a06e71ab17799de92b98073c46a13095d Mon Sep 17 00:00:00 2001 From: oy Date: Thu, 22 Nov 2018 20:06:28 +0100 Subject: [PATCH] use linear mapping just for icons --- datasrc/content.py | 29 +++++++++++++------------ src/engine/client/backend_sdl.cpp | 5 ++++- src/engine/client/graphics_threaded.cpp | 2 ++ src/engine/client/graphics_threaded.h | 1 + src/engine/graphics.h | 1 + src/game/client/gameclient.cpp | 2 +- 6 files changed, 24 insertions(+), 16 deletions(-) diff --git a/datasrc/content.py b/datasrc/content.py index 78aefc135..0ebaad982 100644 --- a/datasrc/content.py +++ b/datasrc/content.py @@ -17,10 +17,11 @@ class SoundSet(Struct): self.sounds.Add(Sound(name)) class Image(Struct): - def __init__(self, name="", filename=""): + def __init__(self, name="", filename="", linear_mapping=0): Struct.__init__(self, "CDataImage") self.name = String(name) self.filename = String(filename) + self.flag = Int(linear_mapping) self.id = TextureHandle() class SpriteSet(Struct): @@ -233,20 +234,20 @@ container.sounds.Add(SoundSet("menu", ["audio/music_menu.wv"])) image_null = Image("null", "") image_particles = Image("particles", "particles.png") image_game = Image("game", "game.png") -image_browseicons = Image("browseicons", "ui/icons/browse.png") +image_browseicons = Image("browseicons", "ui/icons/browse.png", 1) image_emoticons = Image("emoticons", "emoticons.png") -image_demobuttons = Image("demobuttons", "ui/demo_buttons.png") -image_fileicons = Image("fileicons", "ui/file_icons.png") -image_guibuttons = Image("guibuttons", "ui/gui_buttons.png") -image_guiicons = Image("guiicons", "ui/gui_icons.png") -image_menuicons = Image("menuicons", "ui/icons/menu.png") -image_toolicons = Image("toolicons", "ui/icons/tools.png") -image_arrowicons = Image("arrowicons", "ui/icons/arrows.png") -image_friendicons = Image("friendicons", "ui/icons/friend.png") -image_infoicons = Image("infoicons", "ui/icons/info.png") -image_levelicons = Image("levelicons", "ui/icons/level.png") -image_sidebaricons = Image("sidebaricons", "ui/icons/sidebar.png") -image_chatwhisper = Image("chatwhisper", "ui/icons/chat_whisper.png") +image_demobuttons = Image("demobuttons", "ui/demo_buttons.png", 1) +image_fileicons = Image("fileicons", "ui/file_icons.png", 1) +image_guibuttons = Image("guibuttons", "ui/gui_buttons.png", 1) +image_guiicons = Image("guiicons", "ui/gui_icons.png", 1) +image_menuicons = Image("menuicons", "ui/icons/menu.png", 1) +image_toolicons = Image("toolicons", "ui/icons/tools.png", 1) +image_arrowicons = Image("arrowicons", "ui/icons/arrows.png", 1) +image_friendicons = Image("friendicons", "ui/icons/friend.png", 1) +image_infoicons = Image("infoicons", "ui/icons/info.png", 1) +image_levelicons = Image("levelicons", "ui/icons/level.png", 1) +image_sidebaricons = Image("sidebaricons", "ui/icons/sidebar.png", 1) +image_chatwhisper = Image("chatwhisper", "ui/icons/chat_whisper.png", 1) container.images.Add(image_null) container.images.Add(image_game) diff --git a/src/engine/client/backend_sdl.cpp b/src/engine/client/backend_sdl.cpp index 53fdd188a..00826c1bd 100644 --- a/src/engine/client/backend_sdl.cpp +++ b/src/engine/client/backend_sdl.cpp @@ -362,7 +362,10 @@ void CCommandProcessorFragment_OpenGL::Cmd_Texture_Create(const CCommandBuffer:: else { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + if(pCommand->m_Flags&CCommandBuffer::TEXTFLAG_LINEARMIPMAPS) + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + else + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); gluBuild2DMipmaps(GL_TEXTURE_2D, StoreOglformat, Width, Height, Oglformat, GL_UNSIGNED_BYTE, pTexData); } diff --git a/src/engine/client/graphics_threaded.cpp b/src/engine/client/graphics_threaded.cpp index d46db6d43..13438812c 100644 --- a/src/engine/client/graphics_threaded.cpp +++ b/src/engine/client/graphics_threaded.cpp @@ -360,6 +360,8 @@ IGraphics::CTextureHandle CGraphics_Threaded::LoadTextureRaw(int Width, int Heig } if(Flags&IGraphics::TEXLOAD_MULTI_DIMENSION) Cmd.m_Flags |= CCommandBuffer::TEXFLAG_TEXTURE3D; + if(Flags&IGraphics::TEXLOAD_NOMIPMAPS) + Cmd.m_Flags |= CCommandBuffer::TEXTFLAG_LINEARMIPMAPS; // copy texture data diff --git a/src/engine/client/graphics_threaded.h b/src/engine/client/graphics_threaded.h index 39947b48c..1a9cf975b 100644 --- a/src/engine/client/graphics_threaded.h +++ b/src/engine/client/graphics_threaded.h @@ -100,6 +100,7 @@ public: TEXFLAG_QUALITY = 4, TEXFLAG_TEXTURE3D = 8, TEXFLAG_TEXTURE2D = 16, + TEXTFLAG_LINEARMIPMAPS = 32, }; enum diff --git a/src/engine/graphics.h b/src/engine/graphics.h index 0ad14faa7..5d899156d 100644 --- a/src/engine/graphics.h +++ b/src/engine/graphics.h @@ -69,6 +69,7 @@ public: TEXLOAD_NOMIPMAPS = 2, TEXLOAD_ARRAY_256 = 4, TEXLOAD_MULTI_DIMENSION = 8, + TEXLOAD_LINEARMIPMAPS = 16, }; /* Constants: Wrap Modes */ diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index bf7ce451a..366de9531 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -283,7 +283,7 @@ void CGameClient::OnInit() // setup load amount// load textures for(int i = 0; i < g_pData->m_NumImages; i++) { - g_pData->m_aImages[i].m_Id = Graphics()->LoadTexture(g_pData->m_aImages[i].m_pFilename, IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0); + g_pData->m_aImages[i].m_Id = Graphics()->LoadTexture(g_pData->m_aImages[i].m_pFilename, IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, g_pData->m_aImages[i].m_Flag ? IGraphics::TEXLOAD_NOMIPMAPS : 0); m_pMenus->RenderLoading(); }