Overrides - Various bugs fixed, new overrides in script

This commit is contained in:
Emmanuel BENOîT 2017-11-18 16:13:07 +01:00
parent aeefcbb633
commit 7d85a87488
7 changed files with 60 additions and 27 deletions

View file

@ -82,6 +82,8 @@ bool T_Demo::runInit(
context = std::move( nContext ); context = std::move( nContext );
Globals::Sync( ).clearInputs( ); Globals::Sync( ).clearInputs( );
Globals::Sync( ).clearOverrides( );
const auto n( context->initialInputs.size( ) ); const auto n( context->initialInputs.size( ) );
assert( n == p.inputs.size( ) ); assert( n == p.inputs.size( ) );
for ( auto i = 0u ; i < n ; i ++ ) { for ( auto i = 0u ; i < n ; i ++ ) {

View file

@ -258,10 +258,9 @@
(pipeline pl-bloom-blur prg-fullscreen prg-bloom-blur) (pipeline pl-bloom-blur prg-fullscreen prg-bloom-blur)
# Inputs that control the high pass filter # Inputs that control the high pass filter
# FIXME I don't remember what they actually do, rename them later (input bloom-power 1.6)
(input bloom-filter0 1.6) (input bloom-factor 1.2)
(input bloom-filter1 1.2) (input bloom-output-factor 1.05)
(input bloom-filter2 .95)
# Inputs that control the blur weights # Inputs that control the blur weights
(input bloom-bw0 .324) (input bloom-bw0 .324)
@ -271,6 +270,29 @@
# Blur size # Blur size
(input bloom-blur-size 1.3) (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) (fn bloom-render (in-scene)
@ -286,11 +308,12 @@
# High pass # High pass
(use-texture 0 in-scene smp-bloom-input) (use-texture 0 in-scene smp-bloom-input)
(uniforms prg-bloom-highpass 3 (uniforms prg-bloom-highpass 3
(get-input bloom-filter0) (get-input bloom-power)
(get-input bloom-filter1) (get-input bloom-factor)
(get-input bloom-filter2) (get-input bloom-output-factor)
) )
(use-framebuffer rt-bloom1-lod0) (use-framebuffer rt-bloom1-lod0)
(use-pipeline pl-bloom-highpass)
(viewport 0 0 $vp-width $vp-height) (viewport 0 0 $vp-width $vp-height)
(fullscreen) (fullscreen)
@ -393,6 +416,20 @@
(input cg-gamma-r 0) (input cg-gamma-r 0)
(input cg-gamma-g 0) (input cg-gamma-g 0)
(input cg-gamma-b 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) (fn combine-render (in-main in-bloom)

View file

@ -16,5 +16,5 @@ void main( void )
gl_FragCoord.xy / u_InputSize.xy , u_LOD ).xyz; gl_FragCoord.xy / u_InputSize.xy , u_LOD ).xyz;
color = max( vec3( 0 ) , color = max( vec3( 0 ) ,
( pow( c , vec3( u_FilterParams.x ) ) * u_FilterParams.y - c ) ( pow( c , vec3( u_FilterParams.x ) ) * u_FilterParams.y - c )
/ u_FilterParams.z ); * u_FilterParams.z );
} }

18
sync.cc
View file

@ -520,14 +520,8 @@ T_SyncOverrideVisitor::T_OpElement T_SyncOverrideVisitor::nodeBrowser(
T_SyncManager::T_SyncManager( ) T_SyncManager::T_SyncManager( )
: pConfig_( MakeCurvesParser_( ) ) , : pConfig_( MakeCurvesParser_( ) ) ,
pdOverrides_( "default" ) ,
soRoot_( "*root*" ) 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( void T_SyncManager::clearOverrides( ) noexcept
ebcl::T_SRDInputRule rule )
{ {
pdOverrides_.context( "section" ) << rule; soRoot_.subsections.clear( );
if ( pcOverrides_ ) { soRoot_.overrides.clear( );
pcOverrides_.clear( );
}
// pcOverrides_ = NewOwned< T_SRDParserConfig >( pdOverrides_ );
} }
void T_SyncManager::mergeOverrides( void T_SyncManager::mergeOverrides(

View file

@ -325,7 +325,7 @@ struct T_SyncManager
// Overrides // Overrides
public: public:
void registerOverrideRule( ebcl::T_SRDInputRule rule ); void clearOverrides( ) noexcept;
void mergeOverrides( T_SyncOverrideSection& overrides ); void mergeOverrides( T_SyncOverrideSection& overrides );
void makeOverridesWindow( ); void makeOverridesWindow( );
@ -347,7 +347,5 @@ struct T_SyncManager
T_SyncValues values_; // Value storage T_SyncValues values_; // Value storage
T_SyncCurves curves_; // Curves storage T_SyncCurves curves_; // Curves storage
T_Array< P_SyncCurveCache > curveCaches_; // Cache for curve segments 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 T_SyncOverrideSection soRoot_; // Root for overrides
}; };

View file

@ -443,6 +443,7 @@ T_Float2::T_Float2(
{ {
inputs_.add( input0 ); inputs_.add( input0 );
inputs_.add( input1 ); inputs_.add( input1 );
assert( inputs_.size( ) == 2 );
} }
void T_Float2::makeEditWidgets( void T_Float2::makeEditWidgets(
@ -480,6 +481,7 @@ T_Float3::T_Float3(
inputs_.add( input0 ); inputs_.add( input0 );
inputs_.add( input1 ); inputs_.add( input1 );
inputs_.add( input2 ); inputs_.add( input2 );
assert( inputs_.size( ) == 3 );
} }
void T_Float3::makeEditWidgets( void T_Float3::makeEditWidgets(
@ -519,6 +521,7 @@ T_Float4::T_Float4(
inputs_.add( input1 ); inputs_.add( input1 );
inputs_.add( input2 ); inputs_.add( input2 );
inputs_.add( input3 ); inputs_.add( input3 );
assert( inputs_.size( ) == 4 );
} }
void T_Float4::makeEditWidgets( void T_Float4::makeEditWidgets(
@ -610,6 +613,7 @@ T_Integer2::T_Integer2(
{ {
inputs_.add( input0 ); inputs_.add( input0 );
inputs_.add( input1 ); inputs_.add( input1 );
assert( inputs_.size( ) == 2 );
} }
void T_Integer2::makeEditWidgets( void T_Integer2::makeEditWidgets(
@ -647,6 +651,7 @@ T_Integer3::T_Integer3(
inputs_.add( input0 ); inputs_.add( input0 );
inputs_.add( input1 ); inputs_.add( input1 );
inputs_.add( input2 ); inputs_.add( input2 );
assert( inputs_.size( ) == 3 );
} }
void T_Integer3::makeEditWidgets( void T_Integer3::makeEditWidgets(
@ -686,6 +691,7 @@ T_Integer4::T_Integer4(
inputs_.add( input1 ); inputs_.add( input1 );
inputs_.add( input2 ); inputs_.add( input2 );
inputs_.add( input3 ); inputs_.add( input3 );
assert( inputs_.size( ) == 4 );
} }
void T_Integer4::makeEditWidgets( void T_Integer4::makeEditWidgets(

View file

@ -14,7 +14,7 @@ class A_Float : public A_SyncOverride
T_Optional< float > step_; T_Optional< float > step_;
T_Optional< ebcl::T_StaticArray< char , 12 > > decimals_; T_Optional< ebcl::T_StaticArray< char , 12 > > decimals_;
T_Optional< float > power_; T_Optional< float > power_;
bool slider_; bool slider_{ false };
protected: protected:
A_Float( char const* const type , 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 > min_;
T_Optional< int32_t > max_; T_Optional< int32_t > max_;
T_Optional< float > step_; T_Optional< float > step_;
bool slider_; bool slider_{ false };
protected: protected:
A_Integer( char const* const type , A_Integer( char const* const type ,