Added sky lights multiplier track bar
This commit is contained in:
parent
eb18269416
commit
d2c87f4ba5
@ -26,4 +26,4 @@ ContentGfxCache::ContentGfxCache(const Content* content, Assets* assets) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,6 +123,16 @@ HudRenderer::HudRenderer(Engine* engine, Level* level, const ContentGfxCache* ca
|
||||
sub->add(box);
|
||||
panel->add(sub);
|
||||
}
|
||||
{
|
||||
TrackBar* bar = new TrackBar(0.0f, 1.0f, 1.0f, 0.02f, 2);
|
||||
bar->supplier([=]() {
|
||||
return level->skyLightMutliplier;
|
||||
});
|
||||
bar->consumer([=](double val) {
|
||||
level->skyLightMutliplier = val;
|
||||
});
|
||||
panel->add(bar);
|
||||
}
|
||||
panel->refresh();
|
||||
menu->reset();
|
||||
|
||||
|
||||
@ -109,6 +109,8 @@ void WorldRenderer::draw(const GfxContext& pctx, Camera* camera, bool occlusion)
|
||||
const Viewport& viewport = pctx.getViewport();
|
||||
int displayWidth = viewport.getWidth();
|
||||
int displayHeight = viewport.getHeight();
|
||||
|
||||
float skyLightMutliplier = level->skyLightMutliplier;
|
||||
{
|
||||
GfxContext ctx = pctx.sub();
|
||||
ctx.depthTest(true);
|
||||
@ -117,6 +119,7 @@ void WorldRenderer::draw(const GfxContext& pctx, Camera* camera, bool occlusion)
|
||||
EngineSettings& settings = engine->getSettings();
|
||||
|
||||
vec3 skyColor(0.7f, 0.81f, 1.0f);
|
||||
skyColor *= skyLightMutliplier;
|
||||
|
||||
Window::setBgColor(skyColor);
|
||||
Window::clear();
|
||||
@ -128,7 +131,7 @@ void WorldRenderer::draw(const GfxContext& pctx, Camera* camera, bool occlusion)
|
||||
shader->uniformMatrix("u_proj", camera->getProjection());
|
||||
shader->uniformMatrix("u_view", camera->getView());
|
||||
shader->uniform1f("u_gamma", 1.6f);
|
||||
shader->uniform3f("u_skyLightColor", 1.1f,1.1f,1.1f);
|
||||
shader->uniform3f("u_skyLightColor", vec3(1.1f) * skyLightMutliplier);
|
||||
shader->uniform3f("u_fogColor", skyColor);
|
||||
shader->uniform1f("u_fogFactor", fogFactor);
|
||||
shader->uniform1f("u_fogCurve", settings.graphics.fogCurve);
|
||||
|
||||
@ -32,7 +32,6 @@ class WorldRenderer {
|
||||
bool drawChunk(size_t index, Camera* camera, Shader* shader, bool occlusion);
|
||||
void drawChunks(Chunks* chunks, Camera* camera, Shader* shader, bool occlusion);
|
||||
public:
|
||||
|
||||
WorldRenderer(Engine* engine, Level* level, const ContentGfxCache* cache);
|
||||
~WorldRenderer();
|
||||
|
||||
|
||||
@ -68,7 +68,8 @@ void ImageData::flipY() {
|
||||
for (uint x = 0; x < width; x++) {
|
||||
for (uint c = 0; c < size; c++) {
|
||||
ubyte temp = pixels[(y * width + x) * size + c];
|
||||
pixels[(y * width + x) * size + c] = pixels[((height-y-1) * width + x) * size + c];
|
||||
pixels[(y * width + x) * size + c] =
|
||||
pixels[((height-y-1) * width + x) * size + c];
|
||||
pixels[((height-y-1) * width + x) * size + c] = temp;
|
||||
}
|
||||
}
|
||||
@ -209,8 +210,8 @@ void ImageData::fixAlphaColor() {
|
||||
ubyte* pixels = static_cast<ubyte*>(data);
|
||||
|
||||
// Fixing black transparent pixels for Mip-Mapping
|
||||
for (int ly = 0; ly < height-1; ly++) {
|
||||
for (int lx = 0; lx < width-1; lx++) {
|
||||
for (uint ly = 0; ly < height-1; ly++) {
|
||||
for (uint lx = 0; lx < width-1; lx++) {
|
||||
if (pixels[((ly) * width + lx) * 4 + 3]) {
|
||||
for (int c = 0; c < 3; c++) {
|
||||
int val = pixels[((ly) + + lx) * 4 + c];
|
||||
|
||||
@ -31,6 +31,8 @@ public:
|
||||
LevelEvents* events;
|
||||
const EngineSettings& settings;
|
||||
|
||||
float skyLightMutliplier = 1.0f; // will be replaced with day-night cycle
|
||||
|
||||
Level(World* world,
|
||||
const Content* content,
|
||||
Player* player,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user