mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 03:09:18 +02:00
reflection update interval fix
This commit is contained in:
@@ -410,10 +410,7 @@ global_settings::ConfigParse(cParser &Parser) {
|
||||
else if( token == "gfx.reflections.framerate" ) {
|
||||
|
||||
auto const updatespersecond { std::abs( Parser.getToken<double>() ) };
|
||||
ReflectionUpdatesPerSecond = (
|
||||
updatespersecond > 0 ?
|
||||
1000 / std::min( 30.0, updatespersecond ) :
|
||||
0 );
|
||||
ReflectionUpdateInterval = 1.0 / updatespersecond;
|
||||
}
|
||||
else if (token == "timespeed")
|
||||
{
|
||||
|
||||
@@ -121,7 +121,7 @@ struct global_settings {
|
||||
float depth{ 250.f };
|
||||
float distance{ 500.f }; // no longer used
|
||||
} shadowtune;
|
||||
int ReflectionUpdatesPerSecond{ static_cast<int>( 1000 / ( 1.0 / 300.0 ) ) };
|
||||
double ReflectionUpdateInterval{300.0};
|
||||
float AnisotropicFiltering{ 8.f }; // requested level of anisotropic filtering. TODO: move it to renderer object
|
||||
float FieldOfView{ 45.f }; // vertical field of view for the camera. TODO: move it to the renderer
|
||||
GLint iMaxTextureSize{ 4096 }; // maksymalny rozmiar tekstury
|
||||
|
||||
@@ -1027,13 +1027,12 @@ void opengl_renderer::Render_pass(viewport_config &vp, rendermode const Mode)
|
||||
// creates dynamic environment cubemap
|
||||
bool opengl_renderer::Render_reflections(viewport_config &vp)
|
||||
{
|
||||
if (Global.ReflectionUpdatesPerSecond == 0)
|
||||
if (Global.ReflectionUpdateInterval == 0.0)
|
||||
return false;
|
||||
|
||||
auto const &time = simulation::Time.data();
|
||||
auto const timestamp = time.wMilliseconds + time.wSecond * 1000 + time.wMinute * 1000 * 60 + time.wHour * 1000 * 60 * 60;
|
||||
auto const timestamp = Timer::GetTime();
|
||||
|
||||
if ((timestamp - m_environmentupdatetime < Global.ReflectionUpdatesPerSecond)
|
||||
if ((timestamp - m_environmentupdatetime < Global.ReflectionUpdateInterval)
|
||||
&& (glm::length(m_renderpass.pass_camera.position() - m_environmentupdatelocation) < 1000.0))
|
||||
{
|
||||
// run update every 5+ mins of simulation time, or at least 1km from the last location
|
||||
|
||||
@@ -372,7 +372,7 @@ class opengl_renderer
|
||||
glm::mat4 m_cabshadowtexturematrix; // conversion from cab-centric world space to light-centric clip space
|
||||
|
||||
int m_environmentcubetextureface{0}; // helper, currently processed cube map face
|
||||
int m_environmentupdatetime{0}; // time of the most recent environment map update
|
||||
double m_environmentupdatetime{0}; // time of the most recent environment map update
|
||||
glm::dvec3 m_environmentupdatelocation; // coordinates of most recent environment map update
|
||||
opengl_particles m_particlerenderer; // particle visualization subsystem
|
||||
|
||||
|
||||
Reference in New Issue
Block a user