Fix normalfast render mode not disabling fog anymore

This commit is contained in:
UnknownShadow200 2020-06-11 22:59:10 +10:00
parent 8987e6b3e5
commit 18fce97418
4 changed files with 10 additions and 10 deletions

View File

@ -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;

View File

@ -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();
}

View File

@ -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);

View File

@ -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);