mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
Cache enable_3d_clouds flag
Small improvement on clouds rendering performance
This commit is contained in:
parent
9345ba7b6a
commit
4b0f5fcbf5
@ -57,6 +57,8 @@ Clouds::Clouds(
|
||||
|
||||
m_cloud_radius_i = g_settings->getU16("cloud_radius");
|
||||
|
||||
m_enable_3d = g_settings->getBool("enable_3d_clouds");
|
||||
|
||||
m_box = core::aabbox3d<f32>(-BS*1000000,m_cloud_y-BS,-BS*1000000,
|
||||
BS*1000000,m_cloud_y+BS,BS*1000000);
|
||||
|
||||
@ -89,10 +91,9 @@ void Clouds::render()
|
||||
|
||||
ScopeProfiler sp(g_profiler, "Rendering of clouds, avg", SPT_AVG);
|
||||
|
||||
bool enable_3d = g_settings->getBool("enable_3d_clouds");
|
||||
int num_faces_to_draw = enable_3d ? 6 : 1;
|
||||
int num_faces_to_draw = m_enable_3d ? 6 : 1;
|
||||
|
||||
m_material.setFlag(video::EMF_BACK_FACE_CULLING, enable_3d);
|
||||
m_material.setFlag(video::EMF_BACK_FACE_CULLING, m_enable_3d);
|
||||
|
||||
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
|
||||
driver->setMaterial(m_material);
|
||||
|
@ -88,6 +88,7 @@ private:
|
||||
core::aabbox3d<f32> m_box;
|
||||
float m_cloud_y;
|
||||
u16 m_cloud_radius_i;
|
||||
bool m_enable_3d;
|
||||
video::SColorf m_color;
|
||||
u32 m_seed;
|
||||
v2f m_camera_pos;
|
||||
|
Loading…
Reference in New Issue
Block a user