Add 50% transparency to minimap.

This commit is contained in:
vlj 2014-06-26 00:46:55 +02:00
parent 9ed57bdd46
commit 79838bffe3
6 changed files with 15 additions and 8 deletions

View File

@ -12,5 +12,5 @@ varying vec2 uv;
void main()
{
vec4 res = texture(tex, uv);
FragColor = vec4(res.xyz * color.xyz / 255., res.a);
FragColor = res * color / 255.;
}

View File

@ -779,7 +779,7 @@ void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect
void draw2DImageFromRTT(GLuint texture, size_t texture_w, size_t texture_h,
const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect,
bool useAlphaChannelOfTexture)
const video::SColor &colors, bool useAlphaChannelOfTexture)
{
if (useAlphaChannelOfTexture)
{
@ -794,9 +794,16 @@ void draw2DImageFromRTT(GLuint texture, size_t texture_w, size_t texture_h,
getSize(texture_w, texture_h, true,
destRect, sourceRect, width, height, center_pos_x, center_pos_y,
tex_width, tex_height, tex_center_pos_x, tex_center_pos_y);
drawTexQuad(texture, width, height, center_pos_x, center_pos_y,
tex_center_pos_x, tex_center_pos_y, tex_width, tex_height);
glUseProgram(UIShader::UniformColoredTextureRectShader::Program);
glBindVertexArray(UIShader::UniformColoredTextureRectShader::vao);
setTexture(0, texture, GL_LINEAR, GL_LINEAR);
UIShader::UniformColoredTextureRectShader::setUniforms(center_pos_x, center_pos_y, width, height, tex_center_pos_x, tex_center_pos_y, tex_width, tex_height, colors, 0);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,

View File

@ -224,7 +224,7 @@ void draw3DLine(const core::vector3df& start,
void draw2DImageFromRTT(GLuint texture, size_t texture_w, size_t texture_h,
const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect,
bool useAlphaChannelOfTexture);
const video::SColor &colors, bool useAlphaChannelOfTexture);
void draw2DImage(const irr::video::ITexture* texture, const irr::core::rect<s32>& destRect,
const irr::core::rect<s32>& sourceRect, const irr::core::rect<s32>* clipRect,

View File

@ -1922,7 +1922,7 @@ void Skin::process3DPane(IGUIElement *element, const core::recti &rect,
if (fb != NULL && fb->getRTT().size() > 0)
{
draw2DImageFromRTT(fb->getRTT()[0], 512, 512,
rect, core::rect<s32>(0, 0, 512, 512), NULL, true);
rect, core::rect<s32>(0, 0, 512, 512), NULL, SColor(255, 255, 255, 255), true);
}
}
else if (type == WTYPE_ICON_BUTTON || type == WTYPE_MODEL_VIEW)

View File

@ -363,7 +363,7 @@ void RaceGUI::drawGlobalMiniMap()
core::rect<s32> source(0, 0, new_rtt_mini_map->getWidth(), new_rtt_mini_map->getHeight());
draw2DImageFromRTT(new_rtt_mini_map->getRTT()[0],
new_rtt_mini_map->getWidth(), new_rtt_mini_map->getHeight(),
dest, source, NULL, true);
dest, source, NULL, video::SColor(127, 255, 255, 255), true);
}
for(unsigned int i=0; i<world->getNumKarts(); i++)

View File

@ -340,7 +340,7 @@ void RaceGUIOverworld::drawGlobalMiniMap()
core::rect<s32> source(0, 0, new_rtt_mini_map->getWidth(), new_rtt_mini_map->getHeight());
draw2DImageFromRTT(new_rtt_mini_map->getRTT()[0],
new_rtt_mini_map->getWidth(), new_rtt_mini_map->getHeight(),
dest, source, NULL, true);
dest, source, NULL, video::SColor(127, 255, 255, 255), true);
}
Vec3 kart_xyz;