1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Isolate irrlicht references and use a singleton (#6041)

* Add Device3D class which will contain IrrlichtDevice interface

move getSupportedVideoDrivers to Device3D

Add Device3D singleton & use it in various places

Rename Device3D to Rendering engine & add helper functions to various device pointers

More singleton work

RenderingEngine owns draw_load_screen

move draw functions to RenderingEngine

Reduce IrrlichtDevice exposure and guienvironment

RenderingEngine: Expose get_timer_time() to remove device from guiEngine

Make irrlichtdevice & scene manager less exposed

* Code style fixes

* Move porting::getVideoDriverName, getVideoDriverFriendlyName, getDisplayDensity, getDisplaySize to RenderingEngine

Fix XORG_USED macro -> RenderingEngine + create_engine_device from RenderingEngine constructor directly

* enum paralax => enum parallax
This commit is contained in:
Loïc Blot 2017-06-26 20:11:17 +02:00 committed by GitHub
parent a8650e785d
commit b3a36f7378
50 changed files with 1568 additions and 1567 deletions

View file

@ -17,6 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "client/renderingengine.h"
#include "clouds.h"
#include "noise.h"
#include "constants.h"
@ -36,14 +37,12 @@ static void cloud_3d_setting_changed(const std::string &settingname, void *data)
((Clouds *)data)->readSettings();
}
Clouds::Clouds(
scene::ISceneNode* parent,
scene::ISceneManager* mgr,
Clouds::Clouds(scene::ISceneManager* mgr,
s32 id,
u32 seed,
s16 cloudheight
):
scene::ISceneNode(parent, mgr, id),
scene::ISceneNode(mgr->getRootSceneNode(), mgr, id),
m_seed(seed)
{
m_material.setFlag(video::EMF_LIGHTING, false);
@ -101,22 +100,22 @@ void Clouds::render()
return;
ScopeProfiler sp(g_profiler, "Rendering of clouds, avg", SPT_AVG);
int num_faces_to_draw = m_enable_3d ? 6 : 1;
m_material.setFlag(video::EMF_BACK_FACE_CULLING, m_enable_3d);
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
driver->setMaterial(m_material);
/*
Clouds move from Z+ towards Z-
*/
static const float cloud_size = BS * 64.0f;
const float cloud_full_radius = cloud_size * m_cloud_radius_i;
// Position of cloud noise origin from the camera
v2f cloud_origin_from_camera_f = m_origin - m_camera_pos;
// The center point of drawing in the noise
@ -164,7 +163,7 @@ void Clouds::render()
bool fog_rangefog = false;
driver->getFog(fog_color, fog_type, fog_start, fog_end, fog_density,
fog_pixelfog, fog_rangefog);
// Set our own fog
driver->setFog(fog_color, fog_type, cloud_full_radius * 0.5,
cloud_full_radius*1.2, fog_density, fog_pixelfog, fog_rangefog);
@ -340,7 +339,7 @@ void Clouds::render()
}
delete[] grid;
// Restore fog settings
driver->setFog(fog_color, fog_type, fog_start, fog_end, fog_density,
fog_pixelfog, fog_rangefog);