demotool/odbg.hh

86 lines
1.5 KiB
C++

#pragma once
#include "texture.hh"
#include "shaders.hh"
enum class E_ODbgMode {
LDR ,
LDR_ALPHA ,
HDR ,
DEPTH ,
__COUNT__
};
struct T_OutputDebugger
{
friend struct T_Texture;
T_OutputDebugger( );
NO_COPY( T_OutputDebugger );
NO_MOVE( T_OutputDebugger );
~T_OutputDebugger( );
void registerTexture(
T_Texture& texture ,
const E_ODbgMode mode ,
T_String const& name );
bool& uiEnabled( )
{ return enabled_; }
void makeUI( );
bool isActive( ) const
{ return selected_ != -1; }
void debugOutput( );
private:
struct T_Texture_
{
GLuint id;
uint32_t levels;
E_ODbgMode mode;
T_String name;
//
int submode;
int lod;
};
using F_SubmodeSetup = std::function< void( GLuint ) >;
struct T_Submode_
{
T_String name;
T_ShaderPipeline pipeline;
F_SubmodeSetup setup;
};
bool enabled_ = false;
uint32_t nRegistered_ = 0;
T_Array< T_Texture_ > outputs_;
T_Array< T_Submode_ > submodes_[ int( E_ODbgMode::__COUNT__ ) ];
char* smCombo_[ int( E_ODbgMode::__COUNT__ ) ];
ebcl::T_StringBuilder imguiStrings;
int32_t selected_ = -1;
char* selectorItems_;
T_Array< int32_t > selectorMapping_;
void registerSubmode(
const E_ODbgMode mode ,
T_String const& name ,
T_String const& shader ,
F_SubmodeSetup setup = F_SubmodeSetup( ) );
void initSubmodeCombo( );
int32_t registerTexture(
const GLuint id ,
const uint32_t levels ,
const E_ODbgMode mode ,
T_String const& name );
void unregisterTexture(
const uint32_t index );
void makeSelectorItems( );
void clearSelectorItems( );
};