UIRenderer.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // The MIT License(MIT)
  2. //
  3. // Copyright(c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
  4. //
  5. // Permission is hereby granted, free of charge, to any person obtaining a copy of
  6. // this software and associated documentation files(the "Software"), to deal in
  7. // the Software without restriction, including without limitation the rights to
  8. // use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of
  9. // the Software, and to permit persons to whom the Software is furnished to do so,
  10. // subject to the following conditions :
  11. //
  12. // The above copyright notice and this permission notice shall be included in all
  13. // copies or substantial portions of the Software.
  14. //
  15. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  17. // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR
  18. // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  19. // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  20. // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21. #pragma once
  22. #include <iomanip>
  23. #include <iostream>
  24. #include <filesystem>
  25. #include <sstream>
  26. #include <string>
  27. #include <vector>
  28. #include <imgui.h>
  29. #include <imgui_impl_win32.h>
  30. #include <imgui_impl_dx11.h>
  31. #include "DeviceResources.h"
  32. #include "Utilities.h"
  33. enum class OutputSizeMode : uint32_t
  34. {
  35. VARIABLE,
  36. P1080,
  37. P1440,
  38. P2160
  39. };
  40. struct UIData
  41. {
  42. std::vector<std::filesystem::path> Files;
  43. std::filesystem::path FilePath;
  44. std::string FileName;
  45. float Scale = 75.f;
  46. bool EnableNVScaler = true;
  47. int FilterMode = 0;
  48. float Sharpness = 50.f;
  49. bool EnableVsync = false;
  50. OutputSizeMode OutputMode;
  51. uint32_t InputWidth;
  52. uint32_t InputHeight;
  53. uint32_t OutputWidth;
  54. uint32_t OutputHeight;
  55. double FilterTime;
  56. bool ShowSettings = true;
  57. int32_t UnitMicroseconds = true;
  58. };
  59. class UIRenderer
  60. {
  61. public:
  62. UIRenderer(HWND hwnd, DeviceResources& deviceResources, UIData& ui);
  63. void cleanUp();
  64. void update(double fps);
  65. void render();
  66. private:
  67. UIData& m_ui;
  68. DeviceResources& m_deviceResources;
  69. ElapsedTimer m_elapsedTimer;
  70. };