@@ -221,6 +221,17 @@ void Ticker::TickDraw() | |||||
/* Tick objects for the draw loop */ | /* Tick objects for the draw loop */ | ||||
for (int i = Entity::DRAWGROUP_BEGIN; i < Entity::DRAWGROUP_END; i++) | for (int i = Entity::DRAWGROUP_BEGIN; i < Entity::DRAWGROUP_END; i++) | ||||
{ | |||||
switch (i) | |||||
{ | |||||
case Entity::DRAWGROUP_HUD: | |||||
Video::SetDepth(false); | |||||
break; | |||||
default: | |||||
Video::SetDepth(true); | |||||
break; | |||||
} | |||||
for (Entity *e = data->list[i]; e; e = e->drawnext) | for (Entity *e = data->list[i]; e; e = e->drawnext) | ||||
if (!e->destroy) | if (!e->destroy) | ||||
{ | { | ||||
@@ -236,6 +247,7 @@ void Ticker::TickDraw() | |||||
e->state = Entity::STATE_IDLE; | e->state = Entity::STATE_IDLE; | ||||
#endif | #endif | ||||
} | } | ||||
} | |||||
Profiler::Stop(Profiler::STAT_TICK_DRAW); | Profiler::Stop(Profiler::STAT_TICK_DRAW); | ||||
Profiler::Start(Profiler::STAT_TICK_BLIT); | Profiler::Start(Profiler::STAT_TICK_BLIT); | ||||
@@ -36,13 +36,6 @@ void Video::Setup(int width, int height) | |||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); | glClearColor(0.0f, 0.0f, 0.0f, 0.0f); | ||||
glClearDepth(1.0); | glClearDepth(1.0); | ||||
glEnable(GL_DEPTH_TEST); | |||||
glDepthFunc(GL_LEQUAL); | |||||
glEnable(GL_ALPHA_TEST); | |||||
glAlphaFunc(GL_GEQUAL, 0.01f); | |||||
glEnable(GL_BLEND); | |||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | |||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); | glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); | ||||
} | } | ||||
@@ -89,8 +82,23 @@ void Video::SetFov(float theta) | |||||
glLoadIdentity(); | glLoadIdentity(); | ||||
} | } | ||||
void Video::SetDepth(bool set) | |||||
{ | |||||
if (set) | |||||
glEnable(GL_DEPTH_TEST); | |||||
else | |||||
glDisable(GL_DEPTH_TEST); | |||||
} | |||||
void Video::Clear() | void Video::Clear() | ||||
{ | { | ||||
glEnable(GL_DEPTH_TEST); | |||||
glDepthFunc(GL_LEQUAL); | |||||
glEnable(GL_ALPHA_TEST); | |||||
glAlphaFunc(GL_GEQUAL, 0.01f); | |||||
glEnable(GL_BLEND); | |||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | |||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | ||||
SetFov(0.0f); | SetFov(0.0f); | ||||
@@ -19,6 +19,7 @@ class Video | |||||
public: | public: | ||||
static void Setup(int width, int height); | static void Setup(int width, int height); | ||||
static void SetFov(float theta); | static void SetFov(float theta); | ||||
static void SetDepth(bool set); | |||||
static void Clear(); | static void Clear(); | ||||
static void Capture(uint32_t *buffer); | static void Capture(uint32_t *buffer); | ||||
static int GetWidth(); | static int GetWidth(); | ||||