#pragma once

#include "WOGUI.h"
#include <optional>

namespace Aftr
{
class Tex;

class WOGUITextureViewer : public WOGUI
{
public:
   /// This class does *NOT* own the in passed texture and will not delete it!
   //If the texture to be visualized is a gl depth map texture, the texture is passed in as normal, and
   //the user must also pass in a std::make_tuple(near,far), which is a pair of floats specifying the near
   //and far planes, in meters, specifying the depth map.
   static WOGUITextureViewer* New( WOGUI* parentWOGUI, float width, Tex const& texToView, std::optional<std::tuple<float, float>> near_far_plane_distances_m = std::nullopt );
   virtual ~WOGUITextureViewer();

   virtual void onResizeWindow( int newWidthInPixels, int newHeightInPixels );

   enum class Vert_Layout_on_Resize { TOP, BOTTOM, CENTER, FLOATING };
   void setVerticalLayout_onResize( const Vert_Layout_on_Resize& layout );

   ///This method *only* has an effect if the WOGUITextureViewer was instantiated as a Depth Texture Viewer,
   ///otherwise this method is ignored.
   ///If this instance was instantiated as an OpenGL Depth Texture, this method updates the near and far plane
   ///distances passed into the shader which draws the depth map as a grayscale texture...
   void setNear_and_Far_Planes_ForDepthTexture( float near, float far ) noexcept;

protected:
   WOGUITextureViewer( WOGUI* parentWOGUI );
   virtual void onCreate( WOGUI* parentWOGUI, float width, Tex const& texToView, std::optional<std::tuple<float, float>> near_far_plane_distances_m );

   Vert_Layout_on_Resize vertLayout = Vert_Layout_on_Resize::FLOATING;
   struct DepthTexParams { float nearPlane = 1.0f; float farPlane = 1000.0f; };
   std::optional< DepthTexParams > isDepthTex = std::nullopt;

};

} //namespace Aftr

