MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / render

Method render

Source/Falcor/Utils/UI/SpectrumUI.cpp:574–720  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

572// debugging purposes & algorithm development.
573template<typename T>
574bool SpectrumUI<T>::render(Gui::Widgets& w, const std::string name, std::vector<SampledSpectrum<T>*> spectra, const bool renderOnlySpectrum)
575{
576 if (spectra.size() == 0)
577 {
578 return false;
579 }
580 const uint32_t numComponents = getNumComponents();
581 Gui::Group mainGroup = w.group(name, true);
582 if (!mainGroup.open())
583 {
584 return false;
585 }
586
587 bool changed = false;
588 // Note: cannot combine this if-case with the next, since we do not want group() to be called if renderOnlySpectrum == true.
589 if (!renderOnlySpectrum)
590
591 {
592 Gui::Group guiGroup = mainGroup.group(makeUnique("UI").c_str(), true);
593 if (guiGroup.open())
594 {
595 uint32_t idx = uint32_t(mInterpolationType);
596 guiGroup.dropdown(makeUnique("Interpolation").c_str(), kInterpolationDropdownList, idx);
597 changed |= (idx != uint32_t(mInterpolationType));
598 mInterpolationType = SpectrumInterpolation(idx);
599
600 changed |= guiGroup.checkbox(makeUnique("Draw spectrum bar").c_str(), mDrawSpectrumBar, false);
601 if (mDrawSpectrumBar)
602 {
603 changed |= guiGroup.checkbox(makeUnique("Multiply with spectral intensity").c_str(), mMultiplyWithSpectralIntensity, true);
604 }
605 changed |= guiGroup.var(makeUnique("Height").c_str(), mDrawAreaHeight, 64u, 2048u, 1u, false);
606 if (spectra.size() * numComponents > 1)
607 {
608 changed |= guiGroup.var(
609 makeUnique("Index to editable curve").c_str(),
610 mEditSpectrumIndex,
611 0u,
612 uint32_t(spectra.size() * numComponents - 1),
613 1u,
614 true
615 );
616 }
617 changed |= guiGroup.checkbox(makeUnique("Vertical grid").c_str(), mDrawGridX, false);
618 changed |= guiGroup.checkbox(makeUnique("Horizontal grid").c_str(), mDrawGridY, true);
619 changed |= guiGroup.checkbox(makeUnique("Color matching functions").c_str(), mDrawColorMatchingFunctions, true);
620 changed |= guiGroup.var(makeUnique("Min wavelength").c_str(), mWavelengthRange.x, 0.0f, 800.0f, 5.0f);
621 changed |= guiGroup.var(makeUnique("Max wavelength").c_str(), mWavelengthRange.y, 0.0f, 800.0f, 5.0f, true);
622 if (mWavelengthRange.x > mWavelengthRange.y)
623 {
624 mWavelengthRange.y = mWavelengthRange.x + 5.0f;
625 }
626 changed |= guiGroup.var(makeUnique("Max spectral intensity").c_str(), mSpectralIntensityRange.y, 1.0f, 20.0f, 0.5f);
627
628 guiGroup.release();
629 }
630 }
631

Callers

nothing calls this directly

Calls 10

ImVec2Class · 0.85
groupMethod · 0.80
dropdownMethod · 0.80
checkboxMethod · 0.80
varMethod · 0.80
clampFunction · 0.50
sizeMethod · 0.45
openMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected