Full support for smoothing scaled icons in the GUI (will only work if you use a patched irrlicht)
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8433 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
0438696ac6
commit
c1f992231e
@ -224,6 +224,7 @@ void IrrDriver::initDevice()
|
||||
m_scene_manager->getParameters()
|
||||
->setAttribute(scene::B3D_LOADER_IGNORE_MIPMAP_FLAG, true);
|
||||
m_device->getVideoDriver()->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS,true);
|
||||
m_device->getVideoDriver()->setTextureCreationFlag(video::ETCF_OPTIMIZED_FOR_QUALITY,true);
|
||||
m_gui_env = m_device->getGUIEnvironment();
|
||||
m_video_driver = m_device->getVideoDriver();
|
||||
|
||||
@ -231,12 +232,14 @@ void IrrDriver::initDevice()
|
||||
material2D.setFlag(video::EMF_ANTI_ALIASING, true);
|
||||
for (unsigned int n=0; n<MATERIAL_MAX_TEXTURES; n++)
|
||||
{
|
||||
material2D.TextureLayer[n].BilinearFilter = false;
|
||||
material2D.TextureLayer[n].TrilinearFilter = true;
|
||||
//material2D.TextureLayer[n].TextureWrap = ETC_CLAMP_TO_EDGE;
|
||||
material2D.TextureLayer[n].TextureWrapU = ETC_CLAMP_TO_EDGE;
|
||||
material2D.TextureLayer[n].TextureWrapV = ETC_CLAMP_TO_EDGE;
|
||||
|
||||
//material2D.TextureLayer[n].LODBias = 8;
|
||||
//material2D.TextureLayer[n].LODBias = 16;
|
||||
material2D.UseMipMaps = true;
|
||||
}
|
||||
material2D.AntiAliasing=video::EAAM_FULL_BASIC;
|
||||
//m_video_driver->enableMaterial2D();
|
||||
|
@ -1155,6 +1155,13 @@ void Skin::drawIconButton(const core::rect< s32 > &rect, Widget* widget, const b
|
||||
|
||||
IconButtonWidget* icon_widget = (IconButtonWidget*) widget;
|
||||
|
||||
if (widget->m_type == WTYPE_MODEL_VIEW)
|
||||
{
|
||||
// Model view widgets don't generate mipmaps so disable material 2D
|
||||
irr_driver->getVideoDriver()->enableMaterial2D(false);
|
||||
}
|
||||
|
||||
|
||||
if (widget->m_deactivated || ID_DEBUG)
|
||||
{
|
||||
SColor colors[] = { SColor(100,255,255,255),
|
||||
@ -1172,6 +1179,10 @@ void Skin::drawIconButton(const core::rect< s32 > &rect, Widget* widget, const b
|
||||
0 /* no clipping */, 0, true /* alpha */);
|
||||
}
|
||||
|
||||
if (widget->m_type == WTYPE_MODEL_VIEW)
|
||||
{
|
||||
irr_driver->getVideoDriver()->enableMaterial2D();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -174,8 +174,14 @@ void RaceGUI::renderGlobal(float dt)
|
||||
drawGlobalMusicDescription();
|
||||
}
|
||||
|
||||
// minimap has no mipmaps so disable material2D
|
||||
irr_driver->getVideoDriver()->enableMaterial2D(false);
|
||||
drawGlobalMiniMap();
|
||||
irr_driver->getVideoDriver()->enableMaterial2D();
|
||||
|
||||
KartIconDisplayInfo* info = world->getKartsDisplayInfo();
|
||||
|
||||
irr_driver->getVideoDriver()->enableMaterial2D(); // seems like we need to remind irrlicht from time to time to use the Material2D
|
||||
drawGlobalPlayerIcons(info);
|
||||
} // renderGlobal
|
||||
|
||||
@ -229,8 +235,11 @@ void RaceGUI::renderPlayerView(const Kart *kart)
|
||||
|
||||
RaceGUI::KartIconDisplayInfo* info = World::getWorld()->getKartsDisplayInfo();
|
||||
|
||||
irr_driver->getVideoDriver()->enableMaterial2D(); // not sure why I need to call it again but with this, it works
|
||||
drawPowerupIcons (kart, viewport, scaling);
|
||||
irr_driver->getVideoDriver()->enableMaterial2D();
|
||||
drawSpeedAndEnergy (kart, viewport, scaling);
|
||||
irr_driver->getVideoDriver()->enableMaterial2D();
|
||||
drawRankLap (info, kart, viewport);
|
||||
|
||||
RaceGUIBase::renderPlayerView(kart);
|
||||
|
@ -226,6 +226,8 @@ void RaceGUIBase::drawAllMessages(const Kart* kart,
|
||||
font_height = m_small_font_max_height;
|
||||
}
|
||||
|
||||
irr_driver->getVideoDriver()->enableMaterial2D(); // seems like we need to remind irrlicht from time to time to use the Material2D
|
||||
|
||||
// The message are displayed in reverse order, so that a multi-line
|
||||
// message (addMessage("1", ...); addMessage("2",...) is displayed
|
||||
// in the right order: "1" on top of "2"
|
||||
@ -234,7 +236,7 @@ void RaceGUIBase::drawAllMessages(const Kart* kart,
|
||||
{
|
||||
TimedMessage const &msg = *i;
|
||||
|
||||
// less important messages were already displayed
|
||||
// less important messages were already displayed
|
||||
if (!msg.m_important) continue;
|
||||
|
||||
// Display only messages for all karts, or messages for this kart
|
||||
|
Loading…
Reference in New Issue
Block a user