use linear mapping just for icons

This commit is contained in:
oy 2018-11-22 20:06:28 +01:00
parent 4ee4dab678
commit a6e8bb7a06
6 changed files with 24 additions and 16 deletions

View file

@ -17,10 +17,11 @@ class SoundSet(Struct):
self.sounds.Add(Sound(name)) self.sounds.Add(Sound(name))
class Image(Struct): class Image(Struct):
def __init__(self, name="", filename=""): def __init__(self, name="", filename="", linear_mapping=0):
Struct.__init__(self, "CDataImage") Struct.__init__(self, "CDataImage")
self.name = String(name) self.name = String(name)
self.filename = String(filename) self.filename = String(filename)
self.flag = Int(linear_mapping)
self.id = TextureHandle() self.id = TextureHandle()
class SpriteSet(Struct): class SpriteSet(Struct):
@ -233,20 +234,20 @@ container.sounds.Add(SoundSet("menu", ["audio/music_menu.wv"]))
image_null = Image("null", "") image_null = Image("null", "")
image_particles = Image("particles", "particles.png") image_particles = Image("particles", "particles.png")
image_game = Image("game", "game.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_emoticons = Image("emoticons", "emoticons.png")
image_demobuttons = Image("demobuttons", "ui/demo_buttons.png") image_demobuttons = Image("demobuttons", "ui/demo_buttons.png", 1)
image_fileicons = Image("fileicons", "ui/file_icons.png") image_fileicons = Image("fileicons", "ui/file_icons.png", 1)
image_guibuttons = Image("guibuttons", "ui/gui_buttons.png") image_guibuttons = Image("guibuttons", "ui/gui_buttons.png", 1)
image_guiicons = Image("guiicons", "ui/gui_icons.png") image_guiicons = Image("guiicons", "ui/gui_icons.png", 1)
image_menuicons = Image("menuicons", "ui/icons/menu.png") image_menuicons = Image("menuicons", "ui/icons/menu.png", 1)
image_toolicons = Image("toolicons", "ui/icons/tools.png") image_toolicons = Image("toolicons", "ui/icons/tools.png", 1)
image_arrowicons = Image("arrowicons", "ui/icons/arrows.png") image_arrowicons = Image("arrowicons", "ui/icons/arrows.png", 1)
image_friendicons = Image("friendicons", "ui/icons/friend.png") image_friendicons = Image("friendicons", "ui/icons/friend.png", 1)
image_infoicons = Image("infoicons", "ui/icons/info.png") image_infoicons = Image("infoicons", "ui/icons/info.png", 1)
image_levelicons = Image("levelicons", "ui/icons/level.png") image_levelicons = Image("levelicons", "ui/icons/level.png", 1)
image_sidebaricons = Image("sidebaricons", "ui/icons/sidebar.png") image_sidebaricons = Image("sidebaricons", "ui/icons/sidebar.png", 1)
image_chatwhisper = Image("chatwhisper", "ui/icons/chat_whisper.png") image_chatwhisper = Image("chatwhisper", "ui/icons/chat_whisper.png", 1)
container.images.Add(image_null) container.images.Add(image_null)
container.images.Add(image_game) container.images.Add(image_game)

View file

@ -362,7 +362,10 @@ void CCommandProcessorFragment_OpenGL::Cmd_Texture_Create(const CCommandBuffer::
else else
{ {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 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); gluBuild2DMipmaps(GL_TEXTURE_2D, StoreOglformat, Width, Height, Oglformat, GL_UNSIGNED_BYTE, pTexData);
} }

View file

@ -360,6 +360,8 @@ IGraphics::CTextureHandle CGraphics_Threaded::LoadTextureRaw(int Width, int Heig
} }
if(Flags&IGraphics::TEXLOAD_MULTI_DIMENSION) if(Flags&IGraphics::TEXLOAD_MULTI_DIMENSION)
Cmd.m_Flags |= CCommandBuffer::TEXFLAG_TEXTURE3D; Cmd.m_Flags |= CCommandBuffer::TEXFLAG_TEXTURE3D;
if(Flags&IGraphics::TEXLOAD_NOMIPMAPS)
Cmd.m_Flags |= CCommandBuffer::TEXTFLAG_LINEARMIPMAPS;
// copy texture data // copy texture data

View file

@ -100,6 +100,7 @@ public:
TEXFLAG_QUALITY = 4, TEXFLAG_QUALITY = 4,
TEXFLAG_TEXTURE3D = 8, TEXFLAG_TEXTURE3D = 8,
TEXFLAG_TEXTURE2D = 16, TEXFLAG_TEXTURE2D = 16,
TEXTFLAG_LINEARMIPMAPS = 32,
}; };
enum enum

View file

@ -69,6 +69,7 @@ public:
TEXLOAD_NOMIPMAPS = 2, TEXLOAD_NOMIPMAPS = 2,
TEXLOAD_ARRAY_256 = 4, TEXLOAD_ARRAY_256 = 4,
TEXLOAD_MULTI_DIMENSION = 8, TEXLOAD_MULTI_DIMENSION = 8,
TEXLOAD_LINEARMIPMAPS = 16,
}; };
/* Constants: Wrap Modes */ /* Constants: Wrap Modes */

View file

@ -283,7 +283,7 @@ void CGameClient::OnInit()
// setup load amount// load textures // setup load amount// load textures
for(int i = 0; i < g_pData->m_NumImages; i++) 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(); m_pMenus->RenderLoading();
} }