mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Stuff for volumetric clouds
This commit is contained in:
parent
415f6b6bdb
commit
a1b4e66c4c
5 changed files with 22 additions and 0 deletions
|
@ -37,6 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "gameparams.h"
|
||||
#include "clientdynamicinfo.h"
|
||||
#include "util/numeric.h"
|
||||
#include "clouds.h"
|
||||
|
||||
#ifdef SERVER
|
||||
#error Do not include in server builds
|
||||
|
@ -373,6 +374,9 @@ public:
|
|||
Camera* getCamera () { return m_camera; }
|
||||
scene::ISceneManager *getSceneManager();
|
||||
|
||||
Clouds* getClouds() { return m_clouds; }
|
||||
void setClouds(Clouds* clouds) { m_clouds = clouds; }
|
||||
|
||||
// IGameDef interface
|
||||
IItemDefManager* getItemDefManager() override;
|
||||
const NodeDefManager* getNodeDefManager() override;
|
||||
|
@ -498,6 +502,7 @@ private:
|
|||
ELoginRegister m_allow_login_or_register = ELoginRegister::Any;
|
||||
Camera *m_camera = nullptr;
|
||||
Minimap *m_minimap = nullptr;
|
||||
Clouds *m_clouds = nullptr;
|
||||
|
||||
// Server serialization version
|
||||
u8 m_server_ser_ver;
|
||||
|
|
|
@ -396,6 +396,13 @@ void Clouds::render()
|
|||
fog_pixelfog, fog_rangefog);
|
||||
}
|
||||
|
||||
void Clouds::renderVolumetrics() {
|
||||
video::IVideoDriver* driver = SceneManager->getVideoDriver();
|
||||
v2u32 ss = driver->getScreenSize();
|
||||
core::rect<s32> rect(0, 0, ss.X, ss.Y);
|
||||
driver->draw2DRectangle(video::SColor(255, 255, 255, 255), rect);
|
||||
}
|
||||
|
||||
void Clouds::step(float dtime)
|
||||
{
|
||||
m_origin = m_origin + dtime * BS * m_params.speed;
|
||||
|
|
|
@ -52,6 +52,8 @@ public:
|
|||
|
||||
virtual void render();
|
||||
|
||||
void renderVolumetrics();
|
||||
|
||||
virtual const aabb3f &getBoundingBox() const
|
||||
{
|
||||
return m_box;
|
||||
|
@ -145,6 +147,8 @@ private:
|
|||
|
||||
bool gridFilled(int x, int y) const;
|
||||
|
||||
video::SMaterial m_volume_material;
|
||||
|
||||
video::SMaterial m_material;
|
||||
irr_ptr<scene::SMeshBuffer> m_meshbuffer;
|
||||
// Value of m_origin at the time the mesh was last updated
|
||||
|
|
|
@ -1516,6 +1516,7 @@ bool Game::createClient(const GameStartData &start_data)
|
|||
*/
|
||||
if (m_cache_enable_clouds)
|
||||
clouds = new Clouds(smgr, shader_src, -1, rand());
|
||||
client->setClouds(clouds);
|
||||
|
||||
/* Skybox
|
||||
*/
|
||||
|
|
|
@ -66,6 +66,11 @@ void DrawHUD::run(PipelineContext &context)
|
|||
context.client->getCamera()->drawNametags();
|
||||
}
|
||||
context.device->getGUIEnvironment()->drawAll();
|
||||
|
||||
// TODO: proper settings
|
||||
if (true && context.client->getClouds()) {
|
||||
context.client->getClouds()->renderVolumetrics();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue