1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +00:00

Refactor fog shader to reuse Irrlicht values

This commit is contained in:
sfan5 2024-02-21 21:15:50 +01:00
parent dce166dc93
commit d85c842ce9
3 changed files with 76 additions and 47 deletions

View file

@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <string>
#include "irrlichttypes_extrabloated.h"
#include "debug.h"
#include "client/shader.h"
#include "client/render/core.h"
// include the shadow mapper classes too
#include "client/shadows/dynamicshadowsrender.h"
@ -46,6 +47,8 @@ class RenderingCore;
// Instead of a mechanism to disable fog we just set it to be really far away
#define FOG_RANGE_ALL (100000 * BS)
/* Helpers */
struct FpsControl {
FpsControl() : last_time(0), busy_time(0), sleep_time(0) {}
@ -59,6 +62,16 @@ struct FpsControl {
u64 last_time, busy_time, sleep_time;
};
// Populates fogColor, fogDistance, fogShadingParameter with values from Irrlicht
class FogShaderConstantSetterFactory : public IShaderConstantSetterFactory
{
public:
FogShaderConstantSetterFactory() {};
virtual IShaderConstantSetter *create();
};
/* Rendering engine class */
class RenderingEngine
{
public: