MCPcopy Create free account
hub / github.com/NVIDIA-RTX/RTXNTC / BuildControlDialog

Method BuildControlDialog

tools/explorer/FlatImageView.cpp:343–535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

341}
342
343void FlatImageView::BuildControlDialog()
344{
345 ImGuiIO const& io = ImGui::GetIO();
346 float const fontSize = ImGui::GetFontSize();
347
348 ImGui::SetNextWindowPos(ImVec2(
349 m_viewOrigin.x + m_viewSize.x * 0.5f,
350 m_viewOrigin.y + m_viewSize.y - fontSize * 0.6f),
351 ImGuiCond_Always, ImVec2(0.5f, 1.0f));
352
353 ImGui::Begin("Flat Image View", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar |
354 ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize);
355
356 // Mip Level slider
357 if (m_numMips > 1)
358 {
359 ImGui::PushItemWidth(fontSize * 5.f);
360 ImGui::SliderInt("##MipLevel", &m_mipLevel, 0, m_numMips - 1, "Mip %d");
361 ImGui::PopItemWidth();
362 }
363 else
364 {
365 ImGui::AlignTextToFramePadding();
366 ImGui::TextUnformatted("(No Mips)");
367 }
368
369 // Channel toggle buttons
370 uint32_t availableChannelMask = (1 << m_textureChannels) - 1;
371 uint32_t effectiveChannelMask = m_channelMask & availableChannelMask;
372
373 ImGui::SameLine(fontSize * 6.25f);
374 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(6.f, 3.f));
375 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(1.f, 0.1f, 0.1f, 1.f));
376 ImGui::ToggleButtonFlags("R", &effectiveChannelMask, 1);
377 ImGui::PopStyleColor();
378 ImGui::SameLine();
379 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.1f, 1.f, 0.1f, 1.f));
380 ImGui::BeginDisabled(m_textureChannels < 2);
381 ImGui::ToggleButtonFlags("G", &effectiveChannelMask, 2, ImVec2(0.f, 0.f));
382 ImGui::EndDisabled();
383 ImGui::PopStyleColor();
384 ImGui::SameLine();
385 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.1f, 0.1f, 1.f, 1.f));
386 ImGui::BeginDisabled(m_textureChannels < 2);
387 ImGui::ToggleButtonFlags("B", &effectiveChannelMask, 4, ImVec2(0.f, 0.f));
388 ImGui::EndDisabled();
389 ImGui::PopStyleColor();
390 ImGui::SameLine();
391 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.4f, 0.4f, 0.4f, 1.f));
392 ImGui::BeginDisabled(m_textureChannels < 2);
393 ImGui::ToggleButtonFlags("A", &effectiveChannelMask, 8, ImVec2(0.f, 0.f));
394 ImGui::EndDisabled();
395 ImGui::PopStyleColor();
396 ImGui::PopStyleVar();
397
398 m_channelMask = (m_channelMask & ~availableChannelMask) | (effectiveChannelMask & availableChannelMask);
399
400 // Color scale slider and button

Callers

nothing calls this directly

Calls 2

ToggleButtonFlagsFunction · 0.85
ToggleButtonFunction · 0.85

Tested by

no test coverage detected