mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 19:41:51 +00:00
move weather back to gfx & add world:client/environment.json file
This commit is contained in:
parent
7a86cbdd60
commit
db620010a3
11 changed files with 68 additions and 37 deletions
|
|
@ -111,7 +111,6 @@ void WorldRenderer::setupWorldShader(
|
|||
const EngineSettings& settings,
|
||||
float fogFactor
|
||||
) {
|
||||
const auto& weather = level.getWorld()->getInfo().weather;
|
||||
shader.use();
|
||||
shader.uniformMatrix("u_model", glm::mat4(1.0f));
|
||||
shader.uniformMatrix("u_proj", camera.getProjection());
|
||||
|
|
@ -153,8 +152,6 @@ void WorldRenderer::renderLevel(
|
|||
bool pause,
|
||||
bool hudVisible
|
||||
) {
|
||||
const auto& weather = level.getWorld()->getInfo().weather;
|
||||
|
||||
texts->render(ctx, camera, settings, hudVisible, false);
|
||||
|
||||
bool culling = engine.getSettings().graphics.frustumCulling.get();
|
||||
|
|
@ -332,12 +329,15 @@ void WorldRenderer::draw(
|
|||
Camera& camera,
|
||||
bool hudVisible,
|
||||
bool pause,
|
||||
float delta,
|
||||
PostProcessing* postProcessing
|
||||
float uiDelta,
|
||||
PostProcessing& postProcessing
|
||||
) {
|
||||
timer += delta * !pause;
|
||||
float delta = uiDelta * !pause;
|
||||
timer += delta;
|
||||
weather.update(delta);
|
||||
|
||||
auto world = level.getWorld();
|
||||
const auto& weather = world->getInfo().weather;
|
||||
|
||||
const Viewport& vp = pctx.getViewport();
|
||||
camera.aspect = vp.getWidth() / static_cast<float>(vp.getHeight());
|
||||
|
||||
|
|
@ -357,7 +357,7 @@ void WorldRenderer::draw(
|
|||
|
||||
/* World render scope with diegetic HUD included */ {
|
||||
DrawContext wctx = pctx.sub();
|
||||
postProcessing->use(wctx);
|
||||
postProcessing.use(wctx);
|
||||
|
||||
Window::clearDepth();
|
||||
|
||||
|
|
@ -368,7 +368,7 @@ void WorldRenderer::draw(
|
|||
DrawContext ctx = wctx.sub();
|
||||
ctx.setDepthTest(true);
|
||||
ctx.setCullFace(true);
|
||||
renderLevel(ctx, camera, settings, delta, pause, hudVisible);
|
||||
renderLevel(ctx, camera, settings, uiDelta, pause, hudVisible);
|
||||
// Debug lines
|
||||
if (hudVisible) {
|
||||
if (debug) {
|
||||
|
|
@ -377,7 +377,7 @@ void WorldRenderer::draw(
|
|||
);
|
||||
}
|
||||
if (player.currentCamera == player.fpCamera) {
|
||||
renderHands(camera, delta * !pause);
|
||||
renderHands(camera, delta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -393,7 +393,7 @@ void WorldRenderer::draw(
|
|||
screenShader->use();
|
||||
screenShader->uniform1f("u_timer", timer);
|
||||
screenShader->uniform1f("u_dayTime", worldInfo.daytime);
|
||||
postProcessing->render(pctx, screenShader);
|
||||
postProcessing.render(pctx, screenShader);
|
||||
}
|
||||
|
||||
void WorldRenderer::renderBlockOverlay(const DrawContext& wctx) {
|
||||
|
|
@ -447,3 +447,7 @@ void WorldRenderer::clear() {
|
|||
void WorldRenderer::setDebug(bool flag) {
|
||||
debug = flag;
|
||||
}
|
||||
|
||||
Weather& WorldRenderer::getWeather() {
|
||||
return weather;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ class WorldRenderer {
|
|||
std::unique_ptr<GuidesRenderer> guides;
|
||||
std::unique_ptr<Skybox> skybox;
|
||||
std::unique_ptr<ModelBatch> modelBatch;
|
||||
Weather weather {};
|
||||
|
||||
float timer = 0.0f;
|
||||
bool debug = false;
|
||||
|
|
@ -89,7 +90,7 @@ public:
|
|||
bool hudVisible,
|
||||
bool pause,
|
||||
float delta,
|
||||
PostProcessing* postProcessing
|
||||
PostProcessing& postProcessing
|
||||
);
|
||||
|
||||
/// @brief Render level without diegetic interface
|
||||
|
|
@ -108,4 +109,6 @@ public:
|
|||
void clear();
|
||||
|
||||
void setDebug(bool flag);
|
||||
|
||||
Weather& getWeather();
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue