X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2Fviewport.cpp;h=875da78d83c6ecb1913f5cfa61a45ebcc0cabbcb;hb=8ab4ea13545cccbacbd1ed610968d3f481c1b3c8;hp=48bd5ee32ce017751f436a25a8228a51f5703059;hpb=be3a81656b8493010d2329fa00da617e24293438;p=blank.git diff --git a/src/graphics/viewport.cpp b/src/graphics/viewport.cpp index 48bd5ee..875da78 100644 --- a/src/graphics/viewport.cpp +++ b/src/graphics/viewport.cpp @@ -79,6 +79,7 @@ Viewport::Viewport() , cursor(1.0f) , chunk_prog() , entity_prog() +, sky_prog() , sprite_prog() , active_prog(NONE) { glClearColor(0.0, 0.0, 0.0, 1.0); @@ -95,6 +96,11 @@ void Viewport::EnableDepthTest() noexcept { glDepthFunc(GL_LESS); } +void Viewport::EqualDepthTest() noexcept { + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_LEQUAL); +} + void Viewport::DisableDepthTest() noexcept { glDisable(GL_DEPTH_TEST); } @@ -218,6 +224,16 @@ PlainColor &Viewport::HUDOutlineProgram() noexcept { return outline_prog; } +SkyBoxShader &Viewport::SkyBoxProgram() noexcept { + if (active_prog != SKY_BOX) { + sky_prog.Activate(); + DisableBlending(); + EqualDepthTest(); + active_prog = SKY_BOX; + } + return sky_prog; +} + BlendedSprite &Viewport::SpriteProgram() noexcept { if (active_prog != SPRITE) { sprite_prog.Activate();