| 1990 | } |
| 1991 | |
| 1992 | void SampleUI::buildDeltaTreeViz() |
| 1993 | { |
| 1994 | #if ENABLE_DEBUG_DELTA_TREE_VIZUALISATION |
| 1995 | // make tiny scaling |
| 1996 | int localScaleIndex = FindBestScaleFontIndex(m_currentScale*0.75f); |
| 1997 | float localScale = m_scaledFonts[localScaleIndex].second; |
| 1998 | ImGui::PushFont(m_scaledFonts[localScaleIndex].first); |
| 1999 | ImGuiStyle& style = ImGui::GetStyle(); |
| 2000 | style = m_defaultStyle; |
| 2001 | style.ScaleAllSizes(localScale); |
| 2002 | |
| 2003 | // fixed a lot of stability issues so this no longer needed - probably, leaving in just for a bit longer |
| 2004 | // // Unfortunately, the ImNodes are unstable when changed every frame. At some point they can be dropped and all drawing done ourselves, since we do the layout anyway and only use it for drawing connections which we can do. |
| 2005 | // // Until that's done, we have to cache and only update once every few frames. |
| 2006 | // static DeltaTreeVizHeader cachedHeader = DeltaTreeVizHeader::make(); |
| 2007 | // static DeltaTreeVizPathVertex cachedVertices[cDeltaTreeVizMaxVertices]; |
| 2008 | // { |
| 2009 | // static int frameCounter = 0; frameCounter++; |
| 2010 | // static int lastUpdated = -10; |
| 2011 | // if ((frameCounter - lastUpdated) > 0) |
| 2012 | // { |
| 2013 | // lastUpdated = frameCounter; |
| 2014 | // cachedHeader = m_app.GetFeedbackData().deltaPathTree; |
| 2015 | // memcpy( cachedVertices, m_app.GetDebugDeltaPathTree(), sizeof(DeltaTreeVizPathVertex)*cDeltaTreeVizMaxVertices ); |
| 2016 | // } |
| 2017 | // } |
| 2018 | const DeltaTreeVizHeader& DeltaTreeVizHeader = m_app.GetFeedbackData().deltaPathTree; // cachedHeader; |
| 2019 | const DeltaTreeVizPathVertex* deltaPathTreeVertices = m_app.GetDebugDeltaPathTree(); // cachedVertices; |
| 2020 | const int nodeCount = DeltaTreeVizHeader.nodeCount; |
| 2021 | |
| 2022 | ImGui::NewLine(); ImGui::NewLine(); ImGui::NewLine(); ImGui::NewLine(); ImGui::NewLine(); ImGui::NewLine(); ImGui::NewLine(); ImGui::NewLine(); ImGui::NewLine(); ImGui::NewLine(); |
| 2023 | ImGui::Text( "Stable planes branch IDs:" ); |
| 2024 | for (int i = 0; i < cStablePlaneCount; i++) |
| 2025 | { |
| 2026 | ImGui::Text( " %d: 0x%08x (%d dec)", i, DeltaTreeVizHeader.stableBranchIDs[i], DeltaTreeVizHeader.stableBranchIDs[i] ); |
| 2027 | if (i == DeltaTreeVizHeader.dominantStablePlaneIndex) |
| 2028 | { |
| 2029 | ImGui::SameLine(); |
| 2030 | ImGui::Text( " <DOMINANT>"); |
| 2031 | } |
| 2032 | } |
| 2033 | |
| 2034 | ImNodes::Ez::BeginCanvas(); |
| 2035 | |
| 2036 | ImVec2 topLeft = { ImGui::GetStyle().ItemSpacing.x * 8.0f, ImGui::GetStyle().ItemSpacing.y * 12.0f }; |
| 2037 | ImVec2 nodeSize = {}; |
| 2038 | const int nodeWidthInChars = 28; |
| 2039 | const int nodeHeightInLines = 40; |
| 2040 | nodeSize.x = ImGui::CalcTextSize(std::string(' ', (size_t)nodeWidthInChars).c_str()).x; |
| 2041 | nodeSize.y = ImGui::GetStyle().ItemSpacing.y * nodeHeightInLines; |
| 2042 | ImVec2 nodePadding = ImVec2(nodeSize.x * 0.5f, nodeSize.y * 0.1f); |
| 2043 | |
| 2044 | struct UITreeNode |
| 2045 | { |
| 2046 | ImVec2 pos; |
| 2047 | bool selected; |
| 2048 | std::string title; |
| 2049 | DeltaTreeVizPathVertex deltaVertex; |
nothing calls this directly
no test coverage detected