From 7d85a8748876d699c59f9b364b409224e3091ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Sat, 18 Nov 2017 16:13:07 +0100 Subject: [PATCH] Overrides - Various bugs fixed, new overrides in script --- demo.cc | 2 ++ demo.srd | 51 ++++++++++++++++++++++++++++++----- shaders/bloom-highpass.f.glsl | 2 +- sync.cc | 18 +++---------- sync.hh | 4 +-- syncoverrides.cc | 6 +++++ syncoverrides.hh | 4 +-- 7 files changed, 60 insertions(+), 27 deletions(-) diff --git a/demo.cc b/demo.cc index 4c4c691..c872920 100644 --- a/demo.cc +++ b/demo.cc @@ -82,6 +82,8 @@ bool T_Demo::runInit( context = std::move( nContext ); Globals::Sync( ).clearInputs( ); + Globals::Sync( ).clearOverrides( ); + const auto n( context->initialInputs.size( ) ); assert( n == p.inputs.size( ) ); for ( auto i = 0u ; i < n ; i ++ ) { diff --git a/demo.srd b/demo.srd index fa7878f..f449c8f 100644 --- a/demo.srd +++ b/demo.srd @@ -258,10 +258,9 @@ (pipeline pl-bloom-blur prg-fullscreen prg-bloom-blur) # Inputs that control the high pass filter - # FIXME I don't remember what they actually do, rename them later - (input bloom-filter0 1.6) - (input bloom-filter1 1.2) - (input bloom-filter2 .95) + (input bloom-power 1.6) + (input bloom-factor 1.2) + (input bloom-output-factor 1.05) # Inputs that control the blur weights (input bloom-bw0 .324) @@ -271,6 +270,29 @@ # Blur size (input bloom-blur-size 1.3) + + # Input overrides + (ui-overrides + (section "Post-processing" + (section "Bloom" + (section "Input filter" + (float "Input power" bloom-power + (min .5) (max 4) (slider)) + (float "Input factor" bloom-factor + (min .5) (max 4) (slider)) + (float "Output factor" bloom-output-factor + (min .5) (max 4) (slider)) + ) + (section "Blur" + (float "Size" bloom-blur-size + (min .5) (max 4) (slider)) + (float4 "Weights" + bloom-bw0 bloom-bw1 bloom-bw2 bloom-bw3 + (min 0) (max 1) (step .00005)) + ) + ) + ) + ) ) (fn bloom-render (in-scene) @@ -286,11 +308,12 @@ # High pass (use-texture 0 in-scene smp-bloom-input) (uniforms prg-bloom-highpass 3 - (get-input bloom-filter0) - (get-input bloom-filter1) - (get-input bloom-filter2) + (get-input bloom-power) + (get-input bloom-factor) + (get-input bloom-output-factor) ) (use-framebuffer rt-bloom1-lod0) + (use-pipeline pl-bloom-highpass) (viewport 0 0 $vp-width $vp-height) (fullscreen) @@ -393,6 +416,20 @@ (input cg-gamma-r 0) (input cg-gamma-g 0) (input cg-gamma-b 0) + + # Input overrides + (ui-overrides + (section "Post-processing" + (section "Bloom" + (section "Output" + (float "Strength" bloom-strength + (min 0) (max 1) (slider)) + (float "Attenuation / level" bloom-attenuation + (min 0) (max 1) (slider)) + ) + ) + ) + ) ) (fn combine-render (in-main in-bloom) diff --git a/shaders/bloom-highpass.f.glsl b/shaders/bloom-highpass.f.glsl index 24bf5d2..71b600b 100644 --- a/shaders/bloom-highpass.f.glsl +++ b/shaders/bloom-highpass.f.glsl @@ -16,5 +16,5 @@ void main( void ) gl_FragCoord.xy / u_InputSize.xy , u_LOD ).xyz; color = max( vec3( 0 ) , ( pow( c , vec3( u_FilterParams.x ) ) * u_FilterParams.y - c ) - / u_FilterParams.z ); + * u_FilterParams.z ); } diff --git a/sync.cc b/sync.cc index 7ea84dd..2f7d2f1 100644 --- a/sync.cc +++ b/sync.cc @@ -520,14 +520,8 @@ T_SyncOverrideVisitor::T_OpElement T_SyncOverrideVisitor::nodeBrowser( T_SyncManager::T_SyncManager( ) : pConfig_( MakeCurvesParser_( ) ) , - pdOverrides_( "default" ) , soRoot_( "*root*" ) -{ - using namespace ebcl::SRD; - pdOverrides_.context( "default" ) - << ( Rule( ) << "section" << Text( ) << EnterContext( "section" ) ); - pdOverrides_.context( "section" ); -} +{ } /*----------------------------------------------------------------------------*/ @@ -655,14 +649,10 @@ void T_SyncManager::updateValues( ) /*----------------------------------------------------------------------------*/ -void T_SyncManager::registerOverrideRule( - ebcl::T_SRDInputRule rule ) +void T_SyncManager::clearOverrides( ) noexcept { - pdOverrides_.context( "section" ) << rule; - if ( pcOverrides_ ) { - pcOverrides_.clear( ); - } -// pcOverrides_ = NewOwned< T_SRDParserConfig >( pdOverrides_ ); + soRoot_.subsections.clear( ); + soRoot_.overrides.clear( ); } void T_SyncManager::mergeOverrides( diff --git a/sync.hh b/sync.hh index 4415af3..a3216ce 100644 --- a/sync.hh +++ b/sync.hh @@ -325,7 +325,7 @@ struct T_SyncManager // Overrides public: - void registerOverrideRule( ebcl::T_SRDInputRule rule ); + void clearOverrides( ) noexcept; void mergeOverrides( T_SyncOverrideSection& overrides ); void makeOverridesWindow( ); @@ -347,7 +347,5 @@ struct T_SyncManager T_SyncValues values_; // Value storage T_SyncCurves curves_; // Curves storage T_Array< P_SyncCurveCache > curveCaches_; // Cache for curve segments - ebcl::T_SRDParserDefs pdOverrides_; // Parser definitions for UI overrides - ebcl::OP_SRDParserConfig pcOverrides_; // Parser configuration for UI overrides T_SyncOverrideSection soRoot_; // Root for overrides }; diff --git a/syncoverrides.cc b/syncoverrides.cc index 5bcdffd..ad1429c 100644 --- a/syncoverrides.cc +++ b/syncoverrides.cc @@ -443,6 +443,7 @@ T_Float2::T_Float2( { inputs_.add( input0 ); inputs_.add( input1 ); + assert( inputs_.size( ) == 2 ); } void T_Float2::makeEditWidgets( @@ -480,6 +481,7 @@ T_Float3::T_Float3( inputs_.add( input0 ); inputs_.add( input1 ); inputs_.add( input2 ); + assert( inputs_.size( ) == 3 ); } void T_Float3::makeEditWidgets( @@ -519,6 +521,7 @@ T_Float4::T_Float4( inputs_.add( input1 ); inputs_.add( input2 ); inputs_.add( input3 ); + assert( inputs_.size( ) == 4 ); } void T_Float4::makeEditWidgets( @@ -610,6 +613,7 @@ T_Integer2::T_Integer2( { inputs_.add( input0 ); inputs_.add( input1 ); + assert( inputs_.size( ) == 2 ); } void T_Integer2::makeEditWidgets( @@ -647,6 +651,7 @@ T_Integer3::T_Integer3( inputs_.add( input0 ); inputs_.add( input1 ); inputs_.add( input2 ); + assert( inputs_.size( ) == 3 ); } void T_Integer3::makeEditWidgets( @@ -686,6 +691,7 @@ T_Integer4::T_Integer4( inputs_.add( input1 ); inputs_.add( input2 ); inputs_.add( input3 ); + assert( inputs_.size( ) == 4 ); } void T_Integer4::makeEditWidgets( diff --git a/syncoverrides.hh b/syncoverrides.hh index d4855a4..05ebd7a 100644 --- a/syncoverrides.hh +++ b/syncoverrides.hh @@ -14,7 +14,7 @@ class A_Float : public A_SyncOverride T_Optional< float > step_; T_Optional< ebcl::T_StaticArray< char , 12 > > decimals_; T_Optional< float > power_; - bool slider_; + bool slider_{ false }; protected: A_Float( char const* const type , @@ -105,7 +105,7 @@ class A_Integer : public A_SyncOverride T_Optional< int32_t > min_; T_Optional< int32_t > max_; T_Optional< float > step_; - bool slider_; + bool slider_{ false }; protected: A_Integer( char const* const type ,