mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
Call gamma post process after ui.render #611
This commit is contained in:
parent
48028145dc
commit
98aeff310b
|
|
@ -27,6 +27,7 @@
|
|||
#include "Leaderboards\DurangoLeaderboardManager.h"
|
||||
#include "..\..\Minecraft.Client\Tesselator.h"
|
||||
#include "..\..\Minecraft.Client\Options.h"
|
||||
#include "..\GameRenderer.h"
|
||||
#include "Sentient\SentientManager.h"
|
||||
#include "..\..\Minecraft.World\IntCache.h"
|
||||
#include "..\Textures.h"
|
||||
|
|
@ -832,6 +833,9 @@ void oldWinMainTick()
|
|||
#endif
|
||||
ui.tick();
|
||||
ui.render();
|
||||
|
||||
pMinecraft->gameRenderer->ApplyGammaPostProcess();
|
||||
|
||||
#if 0
|
||||
app.HandleButtonPresses();
|
||||
|
||||
|
|
|
|||
|
|
@ -1049,20 +1049,36 @@ void GameRenderer::ApplyGammaPostProcess() const
|
|||
D3D11_VIEWPORT vps[NUM_LIGHT_TEXTURES];
|
||||
float gammas[NUM_LIGHT_TEXTURES];
|
||||
const UINT n = BuildPlayerViewports(vps, gammas, NUM_LIGHT_TEXTURES);
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
bool anyEffect = false;
|
||||
for (UINT i = 0; i < n; ++i)
|
||||
float gamma = 1.0f;
|
||||
bool hasPlayers = n > 0;
|
||||
|
||||
if (hasPlayers)
|
||||
{
|
||||
if (gammas[i] < 0.99f || gammas[i] > 1.01f)
|
||||
bool anyEffect = false;
|
||||
for (UINT i = 0; i < n; ++i)
|
||||
{
|
||||
anyEffect = true;
|
||||
break;
|
||||
if (gammas[i] < 0.99f || gammas[i] > 1.01f)
|
||||
{
|
||||
anyEffect = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!anyEffect)
|
||||
return;
|
||||
}
|
||||
if (!anyEffect)
|
||||
else
|
||||
{
|
||||
const float slider = app.GetGameSettings(0, eGameSetting_Gamma);
|
||||
gamma = ComputeGammaFromSlider(slider);
|
||||
if (gamma < 0.99f || gamma > 1.01f)
|
||||
{
|
||||
PostProcesser::GetInstance().SetGamma(gamma);
|
||||
PostProcesser::GetInstance().Apply();
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (n == 1)
|
||||
{
|
||||
|
|
@ -1167,35 +1183,33 @@ void GameRenderer::render(float a, bool bFirst)
|
|||
renderLevel(a, lastNsTime + 1000000000 / maxFps);
|
||||
}
|
||||
|
||||
lastNsTime = System::nanoTime();
|
||||
lastNsTime = System::nanoTime();
|
||||
|
||||
if (!mc->options->hideGui || mc->screen != NULL)
|
||||
{
|
||||
mc->gui->render(a, mc->screen != NULL, xMouse, yMouse);
|
||||
if (!mc->options->hideGui || mc->screen != NULL)
|
||||
{
|
||||
mc->gui->render(a, mc->screen != NULL, xMouse, yMouse);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
glViewport(0, 0, mc->width, mc->height);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
setupGuiScreen();
|
||||
else
|
||||
{
|
||||
glViewport(0, 0, mc->width, mc->height);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
setupGuiScreen();
|
||||
|
||||
lastNsTime = System::nanoTime();
|
||||
}
|
||||
lastNsTime = System::nanoTime();
|
||||
}
|
||||
|
||||
|
||||
if (mc->screen != NULL)
|
||||
{
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
mc->screen->render(xMouse, yMouse, a);
|
||||
if (mc->screen != NULL && mc->screen->particles != NULL) mc->screen->particles->render(a);
|
||||
}
|
||||
|
||||
ApplyGammaPostProcess();
|
||||
}
|
||||
if (mc->screen != NULL)
|
||||
{
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
mc->screen->render(xMouse, yMouse, a);
|
||||
if (mc->screen != NULL && mc->screen->particles != NULL) mc->screen->particles->render(a);
|
||||
}
|
||||
}
|
||||
|
||||
void GameRenderer::renderLevel(float a)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -81,7 +81,9 @@ private:
|
|||
float m_cachedGammaPerPlayer[NUM_LIGHT_TEXTURES];
|
||||
static float ComputeGammaFromSlider(float slider0to100);
|
||||
void CachePlayerGammas();
|
||||
public:
|
||||
void ApplyGammaPostProcess() const;
|
||||
private:
|
||||
bool ComputeViewportForPlayer(int j, D3D11_VIEWPORT& outViewport) const;
|
||||
uint32_t BuildPlayerViewports(D3D11_VIEWPORT* outViewports, float* outGammas, UINT maxCount) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
//#include "NetworkManager.h"
|
||||
#include "..\..\Minecraft.Client\Tesselator.h"
|
||||
#include "..\..\Minecraft.Client\Options.h"
|
||||
#include "..\GameRenderer.h"
|
||||
#include "Sentient\SentientManager.h"
|
||||
#include "..\..\Minecraft.World\IntCache.h"
|
||||
#include "..\Textures.h"
|
||||
|
|
@ -1302,6 +1303,9 @@ int main(int argc, const char *argv[] )
|
|||
#endif
|
||||
ui.tick();
|
||||
ui.render();
|
||||
|
||||
pMinecraft->gameRenderer->ApplyGammaPostProcess();
|
||||
|
||||
#if 0
|
||||
app.HandleButtonPresses();
|
||||
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ char secureFileId[CELL_SAVEDATA_SECUREFILEID_SIZE] =
|
|||
#include "..\..\Minecraft.Client\Tesselator.h"
|
||||
#include "..\Common\Console_Awards_enum.h"
|
||||
#include "..\..\Minecraft.Client\Options.h"
|
||||
#include "..\GameRenderer.h"
|
||||
#include "Sentient\SentientManager.h"
|
||||
#include "..\..\Minecraft.World\IntCache.h"
|
||||
#include "..\Textures.h"
|
||||
|
|
@ -1245,6 +1246,8 @@ int main()
|
|||
ui.tick();
|
||||
ui.render();
|
||||
|
||||
pMinecraft->gameRenderer->ApplyGammaPostProcess();
|
||||
|
||||
// Present the frame.
|
||||
PIXBeginNamedEvent(0,"Frame present");
|
||||
RenderManager.Present();
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@
|
|||
#include "..\..\Minecraft.Client\Tesselator.h"
|
||||
#include "..\Common\Console_Awards_enum.h"
|
||||
#include "..\..\Minecraft.Client\Options.h"
|
||||
#include "..\GameRenderer.h"
|
||||
#include "Sentient\SentientManager.h"
|
||||
#include "..\..\Minecraft.World\IntCache.h"
|
||||
#include "..\Textures.h"
|
||||
|
|
@ -904,6 +905,9 @@ int main()
|
|||
#endif
|
||||
ui.tick();
|
||||
ui.render();
|
||||
|
||||
pMinecraft->gameRenderer->ApplyGammaPostProcess();
|
||||
|
||||
#if 0
|
||||
app.HandleButtonPresses();
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include "..\..\Minecraft.World\compression.h"
|
||||
#include "..\..\Minecraft.World\OldChunkStorage.h"
|
||||
#include "Common/PostProcesser.h"
|
||||
#include "..\GameRenderer.h"
|
||||
#include "Network\WinsockNetLayer.h"
|
||||
#include "Windows64_Xuid.h"
|
||||
|
||||
|
|
@ -1515,6 +1516,9 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||
#endif
|
||||
ui.tick();
|
||||
ui.render();
|
||||
|
||||
pMinecraft->gameRenderer->ApplyGammaPostProcess();
|
||||
|
||||
#if 0
|
||||
app.HandleButtonPresses();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue