mirror of
https://github.com/gwm17/Specter.git
synced 2024-11-22 10:18:50 -05:00
Fix timestep for Graph updating to separate from rendering time. Needs further testing to confirm
This commit is contained in:
parent
c12bcd9f0e
commit
0884268c5e
|
@ -254,6 +254,12 @@ namespace Specter {
|
|||
void SpectrumManager::UpdateGraphs(const Timestep& step)
|
||||
{
|
||||
std::scoped_lock<std::mutex> guard(m_managerMutex);
|
||||
|
||||
m_graphTimeEllapsed += step;
|
||||
//Don't update unless enough time has passed
|
||||
if (m_graphTimeEllapsed < s_graphUpdateTime)
|
||||
return;
|
||||
|
||||
uint64_t scalerVal;
|
||||
for (auto& graph : m_graphMap)
|
||||
{
|
||||
|
@ -261,9 +267,11 @@ namespace Specter {
|
|||
if (scalerIter != m_scalerMap.end())
|
||||
{
|
||||
scalerVal = scalerIter->second->value;
|
||||
graph.second->UpdatePoints(step, scalerVal);
|
||||
graph.second->UpdatePoints(m_graphTimeEllapsed, scalerVal);
|
||||
}
|
||||
}
|
||||
|
||||
m_graphTimeEllapsed = 0.0; //Reset ellapsed time since last update
|
||||
}
|
||||
|
||||
void SpectrumManager::ClearGraphs()
|
||||
|
|
|
@ -122,6 +122,10 @@ namespace Specter {
|
|||
GraphArgs m_nullGraphResult; //For handling bad query
|
||||
|
||||
std::mutex m_managerMutex; //synchronization
|
||||
|
||||
//Some scaler time stuff
|
||||
double m_graphTimeEllapsed = 0.0;
|
||||
static constexpr double s_graphUpdateTime = 60.0; //Fixed timestep for scaler graphs (seconds), TODO: make this user inputed
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user