demotool/odbg.hh

85 lines
1.6 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(
__rw__ T_Texture& texture ,
__rd__ const E_ODbgMode mode ,
__rd__ std::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;
std::string name;
//
int submode;
int lod;
};
using F_SubmodeSetup = std::function< void( GLuint ) >;
struct T_Submode_
{
std::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__ ) ];
int32_t selected_ = -1;
char* selectorItems_;
T_Array< int32_t > selectorMapping_;
void registerSubmode(
__rd__ const E_ODbgMode mode ,
__rd__ std::string const& name ,
__rd__ std::string const& shader ,
__rd__ F_SubmodeSetup setup = F_SubmodeSetup( ) );
void initSubmodeCombo( );
int32_t registerTexture(
__rd__ const GLuint id ,
__rd__ const uint32_t levels ,
__rd__ const E_ODbgMode mode ,
__rd__ std::string const& name );
void unregisterTexture(
__rd__ const uint32_t index );
void makeSelectorItems( );
void clearSelectorItems( );
};