Remove some GL code in race gui
This commit is contained in:
parent
c58de0a91f
commit
b6d58f55c4
@ -29,6 +29,7 @@ using namespace irr;
|
|||||||
#include "config/user_config.hpp"
|
#include "config/user_config.hpp"
|
||||||
#include "font/font_drawer.hpp"
|
#include "font/font_drawer.hpp"
|
||||||
#include "graphics/camera.hpp"
|
#include "graphics/camera.hpp"
|
||||||
|
#include "graphics/central_settings.hpp"
|
||||||
#include "graphics/2dutils.hpp"
|
#include "graphics/2dutils.hpp"
|
||||||
#ifndef SERVER_ONLY
|
#ifndef SERVER_ONLY
|
||||||
#include "graphics/glwrap.hpp"
|
#include "graphics/glwrap.hpp"
|
||||||
@ -61,6 +62,8 @@ using namespace irr;
|
|||||||
#include "utils/string_utils.hpp"
|
#include "utils/string_utils.hpp"
|
||||||
#include "utils/translation.hpp"
|
#include "utils/translation.hpp"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
/** The constructor is called before anything is attached to the scene node.
|
/** The constructor is called before anything is attached to the scene node.
|
||||||
* So rendering to a texture can be done here. But world is not yet fully
|
* So rendering to a texture can be done here. But world is not yet fully
|
||||||
* created, so only the race manager can be accessed safely.
|
* created, so only the race manager can be accessed safely.
|
||||||
@ -856,9 +859,9 @@ void RaceGUI::drawEnergyMeter(int x, int y, const AbstractKart *kart,
|
|||||||
state, gauge_width, gauge_height, offset);
|
state, gauge_width, gauge_height, offset);
|
||||||
|
|
||||||
if(kart->getControls().getNitro() || kart->isOnMinNitroTime())
|
if(kart->getControls().getNitro() || kart->isOnMinNitroTime())
|
||||||
drawMeterTexture(m_gauge_full_bright, vertices, count);
|
drawMeterTexture(m_gauge_full_bright, vertices, count, true);
|
||||||
else
|
else
|
||||||
drawMeterTexture(m_gauge_full, vertices, count);
|
drawMeterTexture(m_gauge_full, vertices, count, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Target
|
// Target
|
||||||
@ -873,7 +876,7 @@ void RaceGUI::drawEnergyMeter(int x, int y, const AbstractKart *kart,
|
|||||||
unsigned int count = computeVerticesForMeter(position, threshold, vertices, vertices_count,
|
unsigned int count = computeVerticesForMeter(position, threshold, vertices, vertices_count,
|
||||||
coin_target, gauge_width, gauge_height, offset);
|
coin_target, gauge_width, gauge_height, offset);
|
||||||
|
|
||||||
drawMeterTexture(m_gauge_goal, vertices, count);
|
drawMeterTexture(m_gauge_goal, vertices, count, true);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} // drawEnergyMeter
|
} // drawEnergyMeter
|
||||||
@ -1097,7 +1100,7 @@ void RaceGUI::drawSpeedEnergyRank(const AbstractKart* kart,
|
|||||||
#endif
|
#endif
|
||||||
} // drawSpeedEnergyRank
|
} // drawSpeedEnergyRank
|
||||||
|
|
||||||
void RaceGUI::drawMeterTexture(video::ITexture *meter_texture, video::S3DVertex vertices[], unsigned int count)
|
void RaceGUI::drawMeterTexture(video::ITexture *meter_texture, video::S3DVertex vertices[], unsigned int count, bool reverse)
|
||||||
{
|
{
|
||||||
#ifndef SERVER_ONLY
|
#ifndef SERVER_ONLY
|
||||||
//Should be greater or equal than the greatest vertices_count used by the meter functions
|
//Should be greater or equal than the greatest vertices_count used by the meter functions
|
||||||
@ -1110,19 +1113,24 @@ void RaceGUI::drawMeterTexture(video::ITexture *meter_texture, video::S3DVertex
|
|||||||
vertices[i].Color = video::SColor(255, 255, 255, 255);
|
vertices[i].Color = video::SColor(255, 255, 255, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (reverse)
|
||||||
|
std::reverse(vertices + 1, vertices + count);
|
||||||
|
|
||||||
video::SMaterial m;
|
video::SMaterial m;
|
||||||
m.setTexture(0, meter_texture);
|
m.setTexture(0, meter_texture);
|
||||||
m.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
m.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||||
irr_driver->getVideoDriver()->setMaterial(m);
|
irr_driver->getVideoDriver()->setMaterial(m);
|
||||||
glEnable(GL_BLEND);
|
|
||||||
glDisable(GL_CULL_FACE);
|
|
||||||
|
|
||||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
if (CVS->isGLSL())
|
||||||
|
{
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
}
|
||||||
draw2DVertexPrimitiveList(m.getTexture(0), vertices, count,
|
draw2DVertexPrimitiveList(m.getTexture(0), vertices, count,
|
||||||
index, count-2, video::EVT_STANDARD, scene::EPT_TRIANGLE_FAN);
|
index, count-2, video::EVT_STANDARD, scene::EPT_TRIANGLE_FAN);
|
||||||
glDisable(GL_BLEND);
|
|
||||||
glEnable(GL_CULL_FACE);
|
|
||||||
|
|
||||||
|
if (CVS->isGLSL())
|
||||||
|
glDisable(GL_BLEND);
|
||||||
#endif
|
#endif
|
||||||
} // drawMeterTexture
|
} // drawMeterTexture
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ private:
|
|||||||
|
|
||||||
/* Helper functions for drawing meters */
|
/* Helper functions for drawing meters */
|
||||||
|
|
||||||
void drawMeterTexture(video::ITexture *meter_texture, video::S3DVertex vertices[], unsigned int count);
|
void drawMeterTexture(video::ITexture *meter_texture, video::S3DVertex vertices[], unsigned int count, bool reverse = false);
|
||||||
|
|
||||||
unsigned int computeVerticesForMeter(core::vector2df position[], float threshold[], video::S3DVertex vertices[],
|
unsigned int computeVerticesForMeter(core::vector2df position[], float threshold[], video::S3DVertex vertices[],
|
||||||
unsigned int vertices_count, float measure, int gauge_width,
|
unsigned int vertices_count, float measure, int gauge_width,
|
||||||
|
Loading…
Reference in New Issue
Block a user