diff --git a/src/Deflate.h b/src/Deflate.h index 1f36ae7af..a57aadf42 100644 --- a/src/Deflate.h +++ b/src/Deflate.h @@ -7,6 +7,7 @@ http://commandlinefanatic.com/cgi-bin/showarticle.cgi?article=art001 https://www.ietf.org/rfc/rfc1951.txt https://github.com/nothings/stb/blob/master/stb_image.h + https://www.hanshq.net/zip.html Copyright 2014-2019 ClassiCube | Licensed under BSD-3 */ struct Stream; diff --git a/src/Game.c b/src/Game.c index b555e200b..bfea614bc 100644 --- a/src/Game.c +++ b/src/Game.c @@ -605,7 +605,8 @@ static void Game_RenderFrame(double delta) { Gfx_Clear(); Camera.CurrentPos = Camera.Active->GetPosition(t); UpdateViewMatrix(); - Gfx_Mode3D(); + Gfx_LoadMatrix(MATRIX_PROJECTION, &Gfx.Projection); + Gfx_LoadMatrix(MATRIX_VIEW, &Gfx.View); if (!Gui_GetBlocksWorld()) { Game_Render3D(delta, t); @@ -613,8 +614,10 @@ static void Game_RenderFrame(double delta) { RayTracer_SetInvalid(&Game_SelectedPos); } - Gfx_Mode2D(Game.Width, Game.Height); + Gfx_Begin2D(Game.Width, Game.Height); Gui_RenderGui(delta); + Gfx_End2D(); + if (Game_ScreenshotRequested) Game_TakeScreenshot(); Gfx_EndFrame(); } diff --git a/src/Graphics.c b/src/Graphics.c index 4968ea705..3f748aa45 100644 --- a/src/Graphics.c +++ b/src/Graphics.c @@ -174,10 +174,9 @@ void Gfx_Make2DQuad(const struct Texture* tex, PackedCol col, struct VertexTextu } static cc_bool gfx_hadFog; -void Gfx_Mode2D(int width, int height) { +void Gfx_Begin2D(int width, int height) { struct Matrix ortho; Gfx_CalcOrthoMatrix((float)width, (float)height, &ortho); - Gfx_LoadMatrix(MATRIX_PROJECTION, &ortho); Gfx_LoadIdentityMatrix(MATRIX_VIEW); @@ -187,10 +186,7 @@ void Gfx_Mode2D(int width, int height) { if (gfx_hadFog) Gfx_SetFog(false); } -void Gfx_Mode3D(void) { - Gfx_LoadMatrix(MATRIX_PROJECTION, &Gfx.Projection); - Gfx_LoadMatrix(MATRIX_VIEW, &Gfx.View); - +void Gfx_End2D(void) { Gfx_SetDepthTest(true); Gfx_SetAlphaBlending(false); if (gfx_hadFog) Gfx_SetFog(true); diff --git a/src/Graphics.h b/src/Graphics.h index a15aca313..6620cf05b 100644 --- a/src/Graphics.h +++ b/src/Graphics.h @@ -212,10 +212,10 @@ void Gfx_Make2DQuad(const struct Texture* tex, PackedCol col, struct VertexTextu /* Switches state to be suitable for drawing 2D graphics. */ /* NOTE: This means turning off fog/depth test, changing matrices, etc.*/ -void Gfx_Mode2D(int width, int height); +void Gfx_Begin2D(int width, int height); /* Switches state to be suitable for drawing 3D graphics. */ /* NOTE: This means restoring fog/depth test, restoring matrices, etc. */ -void Gfx_Mode3D(void); +void Gfx_End2D(void); /* Sets appropriate alpha test/blending for given block draw type. */ void Gfx_SetupAlphaState(cc_uint8 draw);