UI - Refactoring progress

(see previous log message)
This commit is contained in:
Emmanuel BENOîT 2017-11-23 23:31:24 +01:00
parent 8fc496b15a
commit 05472b1c3a
35 changed files with 120 additions and 115 deletions

View file

@ -17,43 +17,43 @@ IMGUI = imgui.cpp imgui_draw.cpp
COMMON = \ COMMON = \
common.cc \ common.cc \
c-filewatcher.cc \ c-filewatcher.cc \
c-utilities.cc \
\
c-ops.cc \
c-opast.cc \
c-opparser.cc \
c-opcomp.cc \
c-opmgr.cc \
\ \
utilities.cc \
texture.cc \
rendertarget.cc \
camera.cc \ camera.cc \
\ \
profiling.cc \
shaders.cc \
odbg.cc \
undo.cc \ undo.cc \
\ \
sync.cc \ sync.cc \
syncedit.cc \ syncedit.cc \
syncoverrides.cc \ syncoverrides.cc \
\ \
ops.cc \
opast.cc \
opparser.cc \
opcomp.cc \
opmgr.cc \
\
ui.cc \ ui.cc \
ui-actions.cc \ ui-actions.cc \
ui-app.cc \
ui-colorgrading.cc \ ui-colorgrading.cc \
ui-dialogs.cc \ ui-dialogs.cc \
ui-imgui-sdl.cc \ ui-imgui-sdl.cc \
ui-odbg.cc \
ui-overrides.cc \ ui-overrides.cc \
ui-profiling.cc \
ui-rendertarget.cc \
ui-sequencer.cc \ ui-sequencer.cc \
ui-shaders.cc \
ui-sync.cc \ ui-sync.cc \
ui-texture.cc \
ui-utilities.cc \ ui-utilities.cc \
ui-app.cc \
# END COMMON # END COMMON
DEMO = \ DEMO = \
demo.cc \ demo.cc \
main.cc \ main.cc \
opemu.cc \ ui-opemu.cc \
# END DEMO # END DEMO
PARSERCHECK = \ PARSERCHECK = \

View file

@ -1,6 +1,5 @@
#include "externals.hh" #include "externals.hh"
#include "c-filewatcher.hh" #include "c-filewatcher.hh"
#include "utilities.hh"
/*= T_FilesWatcher ===========================================================*/ /*= T_FilesWatcher ===========================================================*/

View file

@ -1,5 +1,5 @@
#include "externals.hh" #include "externals.hh"
#include "opast.hh" #include "c-opast.hh"
#include "sync.hh" #include "sync.hh"
#include <ebcl/Algorithms.hh> #include <ebcl/Algorithms.hh>

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
#include "odbg.hh" #include "c-renderdefs.hh"
#include <ebcl/SRDData.hh> #include <ebcl/SRDData.hh>
#include <ebcl/Sets.hh>
struct T_SyncOverrideSection; struct T_SyncOverrideSection;

View file

@ -1,6 +1,6 @@
#include "externals.hh" #include "externals.hh"
#include "ops.hh" #include "c-ops.hh"
#include "opcomp.hh" #include "c-opcomp.hh"
#include <ebcl/Algorithms.hh> #include <ebcl/Algorithms.hh>
#define INVASIVE_TRACES #define INVASIVE_TRACES

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "c-filewatcher.hh" #include "c-filewatcher.hh"
#include "opast.hh" #include "c-opast.hh"
#include <ebcl/SRDData.hh> #include <ebcl/SRDData.hh>

View file

@ -1,7 +1,7 @@
#include "externals.hh" #include "externals.hh"
#include "common.hh" #include "common.hh"
#include "opcomp.hh" #include "c-opcomp.hh"
#include "ops.hh" #include "c-ops.hh"
#include <ebcl/Files.hh> #include <ebcl/Files.hh>
#include <ebcl/SRDIO.hh> #include <ebcl/SRDIO.hh>

View file

@ -1,7 +1,7 @@
#include "externals.hh" #include "externals.hh"
#include "opast.hh" #include "c-opast.hh"
#include "ops.hh" #include "c-ops.hh"
#include "opcomp.hh" #include "c-opcomp.hh"
#include "syncoverrides.hh" #include "syncoverrides.hh"
#include <ebcl/Algorithms.hh> #include <ebcl/Algorithms.hh>
#include <ebcl/SRDParser.hh> #include <ebcl/SRDParser.hh>

View file

@ -1,5 +1,5 @@
#include "externals.hh" #include "externals.hh"
#include "ops.hh" #include "c-ops.hh"
using namespace ops; using namespace ops;
using namespace ebcl; using namespace ebcl;

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "sync.hh" #include "sync.hh"
#include "opast.hh" #include "c-opast.hh"
struct T_Rendertarget; struct T_Rendertarget;

35
c-renderdefs.hh Normal file
View file

@ -0,0 +1,35 @@
#pragma once
#ifndef REAL_BUILD
# include "externals.hh"
#endif
enum class E_TexType {
RGBA8 ,
RGBA16F ,
RGB8 ,
RGB16F ,
R8 ,
R16F ,
};
enum class E_TexSampling {
NEAREST ,
LINEAR ,
};
enum class E_TexWrap {
REPEAT ,
CLAMP_EDGE ,
CLAMP_BORDER
};
/*----------------------------------------------------------------------------*/
enum class E_ODbgMode {
LDR ,
LDR_ALPHA ,
HDR ,
DEPTH ,
__COUNT__
};

View file

@ -1,5 +1,5 @@
#include "externals.hh" #include "externals.hh"
#include "utilities.hh" #include "c-utilities.hh"
void updateAngle( void updateAngle(

View file

@ -1,6 +1,6 @@
#include "externals.hh" #include "externals.hh"
#include "camera.hh" #include "camera.hh"
#include "utilities.hh" #include "c-utilities.hh"
#include <glm/gtc/matrix_access.hpp> #include <glm/gtc/matrix_access.hpp>

View file

@ -2,9 +2,8 @@
#include "common.hh" #include "common.hh"
#include "c-filewatcher.hh" #include "c-filewatcher.hh"
#include "opcomp.hh" #include "c-opcomp.hh"
#include "ops.hh" #include "c-ops.hh"
#include "profiling.hh"
#include "sync.hh" #include "sync.hh"
#include "undo.hh" #include "undo.hh"
@ -14,7 +13,6 @@ namespace {
struct CommonData_ struct CommonData_
{ {
T_FilesWatcher watcher; T_FilesWatcher watcher;
T_Profiler profiler;
T_SyncManager sync; T_SyncManager sync;
T_ScriptManager ops; T_ScriptManager ops;
T_UndoManager undo; T_UndoManager undo;
@ -43,9 +41,6 @@ void Common::Shutdown( ) noexcept
T_FilesWatcher& Common::Watcher( ) noexcept T_FilesWatcher& Common::Watcher( ) noexcept
{ return M_GET_( watcher ); } { return M_GET_( watcher ); }
T_Profiler& Common::Profiler( ) noexcept
{ return M_GET_( profiler ); }
T_SyncManager& Common::Sync( ) noexcept T_SyncManager& Common::Sync( ) noexcept
{ return M_GET_( sync ); } { return M_GET_( sync ); }

View file

@ -5,7 +5,6 @@
struct T_FilesWatcher; struct T_FilesWatcher;
struct T_Profiler;
struct T_SyncManager; struct T_SyncManager;
struct T_ScriptManager; struct T_ScriptManager;
class T_UndoManager; class T_UndoManager;
@ -17,7 +16,6 @@ struct Common
static void Shutdown( ) noexcept; static void Shutdown( ) noexcept;
static T_FilesWatcher& Watcher( ) noexcept; static T_FilesWatcher& Watcher( ) noexcept;
static T_Profiler& Profiler( ) noexcept;
static T_SyncManager& Sync( ) noexcept; static T_SyncManager& Sync( ) noexcept;
static T_ScriptManager& Ops( ) noexcept; static T_ScriptManager& Ops( ) noexcept;
static T_UndoManager& Undo( ) noexcept; static T_UndoManager& Undo( ) noexcept;

View file

@ -1,10 +1,10 @@
#include "externals.hh" #include "externals.hh"
#include "demo.hh" #include "demo.hh"
#include "sync.hh" #include "sync.hh"
#include "rendertarget.hh"
#include "common.hh" #include "common.hh"
#include "opemu.hh" #include "c-opcomp.hh"
#include "opcomp.hh" #include "ui-opemu.hh"
#include "ui-rendertarget.hh"
#include <ebcl/Files.hh> #include <ebcl/Files.hh>
#include <ebcl/SRDText.hh> #include <ebcl/SRDText.hh>

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "opcomp.hh" #include "c-opcomp.hh"
namespace ops { class T_OpContext; } namespace ops { class T_OpContext; }

22
main.cc
View file

@ -2,15 +2,15 @@
#include "ui-imgui-sdl.hh" #include "ui-imgui-sdl.hh"
#include "demo.hh" #include "demo.hh"
#include "common.hh" #include "common.hh"
#include "profiling.hh"
#include "shaders.hh"
#include "odbg.hh"
#include "opemu.hh"
#include "rendertarget.hh"
#include "sync.hh" #include "sync.hh"
#include "ui.hh" #include "ui.hh"
#include "ui-app.hh" #include "ui-app.hh"
#include "ui-odbg.hh"
#include "ui-opemu.hh"
#include "ui-profiling.hh"
#include "ui-rendertarget.hh"
#include "ui-sequencer.hh" #include "ui-sequencer.hh"
#include "ui-shaders.hh"
#include "ui-sync.hh" #include "ui-sync.hh"
#include "ui-utilities.hh" #include "ui-utilities.hh"
#include "undo.hh" #include "undo.hh"
@ -58,7 +58,7 @@ T_Main::T_Main( )
void T_Main::mainLoop( ) void T_Main::mainLoop( )
{ {
auto& p( Common::Profiler( ) ); auto& p( UI::Profiler( ) );
while ( !done ) { while ( !done ) {
auto const& dspSize( ImGui::GetIO( ).DisplaySize ); auto const& dspSize( ImGui::GetIO( ).DisplaySize );
if ( prevSize.x != dspSize.x || prevSize.y != dspSize.y ) { if ( prevSize.x != dspSize.x || prevSize.y != dspSize.y ) {
@ -124,7 +124,7 @@ void T_Main::initDemo( )
printf( "init w/ dspsize %dx%d\n" , int( dspSize.x ) , int( dspSize.y ) ); printf( "init w/ dspsize %dx%d\n" , int( dspSize.x ) , int( dspSize.y ) );
if ( demo->initialise( (uint32_t) dspSize.x , (uint32_t) dspSize.y ) ) { if ( demo->initialise( (uint32_t) dspSize.x , (uint32_t) dspSize.y ) ) {
Common::Profiler( ).clear( ); UI::Profiler( ).clear( );
} }
} }
@ -233,7 +233,7 @@ void T_Main::makeUI( )
MenuItemCheckbox( "Output debugger" , MenuItemCheckbox( "Output debugger" ,
&UI::ODbg( ).uiEnabled( ) ); &UI::ODbg( ).uiEnabled( ) );
MenuItemCheckbox( "Profiler" , MenuItemCheckbox( "Profiler" ,
&Common::Profiler( ).uiEnabled( ) ); &UI::Profiler( ).uiEnabled( ) );
MenuItemCheckbox( "Sequencer" , &eSequencer ); MenuItemCheckbox( "Sequencer" , &eSequencer );
MenuItemCheckbox( "Shaders" , MenuItemCheckbox( "Shaders" ,
&UI::Shaders( ).uiEnabled( ) ); &UI::Shaders( ).uiEnabled( ) );
@ -248,7 +248,7 @@ void T_Main::makeUI( )
sequencer.clear( ); sequencer.clear( );
} }
Common::Profiler( ).makeUI( ); UI::Profiler( ).makeUI( );
UI::ODbg( ).makeUI( ); UI::ODbg( ).makeUI( );
UI::Shaders( ).makeUI( ); UI::Shaders( ).makeUI( );
UI::Sync( ).makeOverridesWindow( ); UI::Sync( ).makeOverridesWindow( );
@ -262,12 +262,12 @@ void T_Main::render( )
if ( demo ) { if ( demo ) {
demo->render( ); demo->render( );
Common::Profiler( ).start( "Debug" ); UI::Profiler( ).start( "Debug" );
T_Rendertarget::MainOutput( ); T_Rendertarget::MainOutput( );
if ( UI::ODbg( ).isActive( ) ) { if ( UI::ODbg( ).isActive( ) ) {
UI::ODbg( ).debugOutput( ); UI::ODbg( ).debugOutput( );
} }
glFinish( ); Common::Profiler( ).end( "Debug" ); glFinish( ); UI::Profiler( ).end( "Debug" );
} else { } else {
T_Rendertarget::MainOutput( ); T_Rendertarget::MainOutput( );

View file

@ -1,7 +1,7 @@
#include "externals.hh" #include "externals.hh"
#include "opast.hh" #include "c-opast.hh"
#include "ops.hh" #include "c-ops.hh"
#include "opcomp.hh" #include "c-opcomp.hh"
#include <ebcl/Files.hh> #include <ebcl/Files.hh>
#include <ebcl/SRDText.hh> #include <ebcl/SRDText.hh>
#include <ebcl/Algorithms.hh> #include <ebcl/Algorithms.hh>

View file

@ -1,6 +1,5 @@
#pragma once #pragma once
#include "c-filewatcher.hh" #include "c-filewatcher.hh"
#include "utilities.hh"
#include <ebcl/SRDParserConfig.hh> #include <ebcl/SRDParserConfig.hh>
#include <ebcl/Sets.hh> #include <ebcl/Sets.hh>

View file

@ -1,6 +1,6 @@
#include "externals.hh" #include "externals.hh"
#include "odbg.hh"
#include "ui.hh" #include "ui.hh"
#include "ui-odbg.hh"
namespace { namespace {

View file

@ -1,15 +1,6 @@
#pragma once #pragma once
#include "texture.hh" #include "ui-texture.hh"
#include "shaders.hh" #include "ui-shaders.hh"
enum class E_ODbgMode {
LDR ,
LDR_ALPHA ,
HDR ,
DEPTH ,
__COUNT__
};
struct T_OutputDebugger struct T_OutputDebugger

View file

@ -1,9 +1,10 @@
#include "externals.hh" #include "externals.hh"
#include "opemu.hh"
#include "common.hh" #include "common.hh"
#include "ui.hh" #include "ui.hh"
#include "profiling.hh" #include "ui-odbg.hh"
#include "rendertarget.hh" #include "ui-opemu.hh"
#include "ui-profiling.hh"
#include "ui-rendertarget.hh"
#include "sync.hh" #include "sync.hh"
using namespace ops; using namespace ops;
@ -64,7 +65,7 @@ struct T_RunGuard
~T_RunGuard( ) ~T_RunGuard( )
{ {
while ( !context.profiling.empty( ) ) { while ( !context.profiling.empty( ) ) {
Common::Profiler( ).end( context.profiling.last( ) ); UI::Profiler( ).end( context.profiling.last( ) );
context.profiling.removeLast( ); context.profiling.removeLast( );
} }
glUseProgram( 0 ); glUseProgram( 0 );
@ -681,14 +682,14 @@ void T_OpContext::run(
case OP_UI_PENTER: case OP_UI_PENTER:
{ {
T_String const& section( program.uiStrings[ instr.args[ 0 ] ] ); T_String const& section( program.uiStrings[ instr.args[ 0 ] ] );
Common::Profiler( ).start( section ); UI::Profiler( ).start( section );
profiling.add( section ); profiling.add( section );
break; break;
} }
case OP_UI_PEXIT: case OP_UI_PEXIT:
glFinish( ); glFinish( );
Common::Profiler( ).end( profiling.last( ) ); UI::Profiler( ).end( profiling.last( ) );
profiling.removeLast( ); profiling.removeLast( );
break; break;

View file

@ -1,5 +1,7 @@
#pragma once #pragma once
#include "ops.hh" #include "c-ops.hh"
#include "ui-shaders.hh"
#include "ui-texture.hh"
namespace ops { namespace ops {

View file

@ -1,5 +1,5 @@
#include "externals.hh" #include "externals.hh"
#include "profiling.hh" #include "ui-profiling.hh"
#include <sys/time.h> #include <sys/time.h>
#include <time.h> #include <time.h>

View file

@ -1,5 +1,7 @@
#pragma once #pragma once
#include "utilities.hh" #ifndef REAL_BUILD
# include "externals.hh"
#endif
struct T_ProfilerSamples struct T_ProfilerSamples

View file

@ -1,5 +1,6 @@
#include "externals.hh" #include "externals.hh"
#include "rendertarget.hh" #include "ui-rendertarget.hh"
#include "ui-texture.hh"
T_RendertargetSetup::T_RendertargetSetup( ) T_RendertargetSetup::T_RendertargetSetup( )

View file

@ -4,9 +4,9 @@
#endif #endif
#include <ebcl/Arrays.hh> #include <ebcl/Arrays.hh>
#include "texture.hh"
struct T_Texture;
struct T_Rendertarget; struct T_Rendertarget;

View file

@ -1,7 +1,7 @@
#include "externals.hh" #include "externals.hh"
#include "shaders.hh"
#include "common.hh" #include "common.hh"
#include "ui.hh" #include "ui.hh"
#include "ui-shaders.hh"
#include "ui-utilities.hh" #include "ui-utilities.hh"
#include <ebcl/Sets.hh> #include <ebcl/Sets.hh>

View file

@ -1,6 +1,5 @@
#pragma once #pragma once
#include "c-filewatcher.hh" #include "c-filewatcher.hh"
#include "utilities.hh"
/*= INPUT FILES ==============================================================*/ /*= INPUT FILES ==============================================================*/

View file

@ -1,7 +1,7 @@
#include "externals.hh" #include "externals.hh"
#include "texture.hh"
#include "ui.hh" #include "ui.hh"
#include "odbg.hh" #include "ui-odbg.hh"
#include "ui-texture.hh"
#include "ui-utilities.hh" #include "ui-utilities.hh"

View file

@ -1,32 +1,9 @@
#pragma once #pragma once
#ifndef REAL_BUILD #include "c-renderdefs.hh"
# include "externals.hh"
#endif
struct T_OutputDebugger; struct T_OutputDebugger;
enum class E_TexType {
RGBA8 ,
RGBA16F ,
RGB8 ,
RGB16F ,
R8 ,
R16F ,
};
enum class E_TexSampling {
NEAREST ,
LINEAR ,
};
enum class E_TexWrap {
REPEAT ,
CLAMP_EDGE ,
CLAMP_BORDER
};
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
struct T_Texture struct T_Texture

11
ui.cc
View file

@ -1,10 +1,11 @@
#include "externals.hh" #include "externals.hh"
#include "odbg.hh"
#include "shaders.hh"
#include "texture.hh"
#include "ui.hh" #include "ui.hh"
#include "ui-app.hh" #include "ui-app.hh"
#include "ui-odbg.hh"
#include "ui-profiling.hh"
#include "ui-shaders.hh"
#include "ui-sync.hh" #include "ui-sync.hh"
#include "ui-texture.hh"
namespace { namespace {
@ -12,6 +13,7 @@ namespace {
struct UIData_ struct UIData_
{ {
T_UIApp window; T_UIApp window;
T_Profiler profiler;
T_TextureManager textures; T_TextureManager textures;
T_ShaderManager shaders; T_ShaderManager shaders;
T_OutputDebugger odbg; T_OutputDebugger odbg;
@ -41,6 +43,9 @@ void UI::Shutdown( ) noexcept
T_UIApp& UI::Main( ) noexcept T_UIApp& UI::Main( ) noexcept
{ return M_GET_( window ); } { return M_GET_( window ); }
T_Profiler& UI::Profiler( ) noexcept
{ return M_GET_( profiler ); }
T_TextureManager& UI::Textures( ) noexcept T_TextureManager& UI::Textures( ) noexcept
{ return M_GET_( textures ); } { return M_GET_( textures ); }

8
ui.hh
View file

@ -3,10 +3,11 @@
# include "externals.hh" # include "externals.hh"
#endif #endif
struct T_UIApp;
struct T_TextureManager;
struct T_ShaderManager;
struct T_OutputDebugger; struct T_OutputDebugger;
struct T_Profiler;
struct T_ShaderManager;
struct T_TextureManager;
struct T_UIApp;
struct T_UISync; struct T_UISync;
@ -17,6 +18,7 @@ struct UI
static void Shutdown( ) noexcept; static void Shutdown( ) noexcept;
static T_UIApp& Main( ) noexcept; static T_UIApp& Main( ) noexcept;
static T_Profiler& Profiler( ) noexcept;
static T_TextureManager& Textures( ) noexcept; static T_TextureManager& Textures( ) noexcept;
static T_ShaderManager& Shaders( ) noexcept; static T_ShaderManager& Shaders( ) noexcept;
static T_OutputDebugger& ODbg( ) noexcept; static T_OutputDebugger& ODbg( ) noexcept;