Skip to content
Snippets Groups Projects
Commit 6a81b06a authored by Andrew Wilson's avatar Andrew Wilson :elephant:
Browse files

Merge branch 'CDDebugObjectClearRate' into 'master'

REFAC: Clear rates CDDebugObject

See merge request iMSTK/iMSTK!669
parents aa4eafca 51711505
No related branches found
No related tags found
No related merge requests found
......@@ -181,7 +181,11 @@ CollisionDataDebugObject::debugUpdate()
}
// Clear the debug object geometry
clear();
if (m_frameCounter >= m_clearRate)
{
clear();
m_frameCounter = 0;
}
std::shared_ptr<PointSet> pointSetA = std::dynamic_pointer_cast<PointSet>(m_cdData->geomA);
for (int i = 0; i < static_cast<int>(m_cdData->elementsA.size()); i++)
......@@ -205,5 +209,17 @@ CollisionDataDebugObject::debugUpdate()
printContactInfo(elem);
}
}
if (m_countEmptyFrames)
{
m_frameCounter++;
}
else
{
if ((m_cdData->elementsA.size() > 0 || m_cdData->elementsB.size() > 0))
{
m_frameCounter++;
}
}
}
}
\ No newline at end of file
......@@ -56,13 +56,44 @@ public:
///
void debugUpdate();
///
/// \brief Set/Get the input collision data for which geometry is generated for
///
///@{
void setInputCD(std::shared_ptr<CollisionData> cdData) { m_cdData = cdData; }
std::shared_ptr<CollisionData> getInputCD() const { return m_cdData; }
///@}
///
/// \brief Print collision contact data to stdout
///
///@{
void setPrintContacts(const bool printContacts) { m_printContacts = printContacts; }
bool getPrintContacts() const { return m_printContacts; }
///@}
///
/// \brief Set the amount of simulation frames to cache data for, this is useful if you have
/// numerous simulation frames per render and data doesn't persist from one to the next
///
///@{
void setClearRate(const int clearRate) { m_clearRate = clearRate; }
int getClearRate() const { return m_clearRate; }
///@}
///
/// \brief If on, frames without collision data won't be counted for clear rate
///
///@{
void setCountEmptyFrames(const bool countEmptyFrames) { m_countEmptyFrames = countEmptyFrames; }
int getCountEmptyFrames() const { return m_countEmptyFrames; }
///@}
protected:
std::shared_ptr<CollisionData> m_cdData = nullptr;
bool m_printContacts = false;
bool m_printContacts = false;
int m_clearRate = 1;
int m_frameCounter = 0;
bool m_countEmptyFrames = true;
};
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment