diff --git a/demo.cc b/demo.cc index 513aafe..6b45eb5 100644 --- a/demo.cc +++ b/demo.cc @@ -22,6 +22,14 @@ bool T_Demo::initialise( ) dof->output( ) , bloom->output( ) ); fxaa = std::make_unique< T_FXAAPass >( combine->output( ) ); + + Globals::Sync( ).clearInputs( ); + Globals::Sync( ).addInput( "dof:sharp-distance" , 15 ); + Globals::Sync( ).addInput( "dof:sharp-range" , 25 ); + Globals::Sync( ).addInput( "dof:falloff" , 100 ); + Globals::Sync( ).addInput( "dof:max-blur" , 16 ); + Globals::Sync( ).addInput( "dof:samples" , 16 ); + return true; } diff --git a/dof.cc b/dof.cc index 9cd506e..4538bbf 100644 --- a/dof.cc +++ b/dof.cc @@ -23,9 +23,7 @@ T_DoFPass::T_DoFPass( txOutput_( imageInput.width( ) , imageInput.height( ) , E_TexType::RGB16F ) , rtPass1_( T_RendertargetSetup( ).add( txPass1_ ).create( ) ) , - rtPass2_( T_RendertargetSetup( ).add( txOutput_ ).create( ) ) , - filterParams_{ 15 , 25 , 100 , 16 } , - nSamples_( 16 ) + rtPass2_( T_RendertargetSetup( ).add( txOutput_ ).create( ) ) { txPass1_.wrap( E_TexWrap::CLAMP_EDGE ); @@ -65,13 +63,13 @@ void T_DoFPass::render( ) << OPLoadVariable( "width" ) << OPLoadConstant( U_RES_TIME ) << OPDup( 8 ) - << OPLoadConstant( nSamples_ ) + << OPLoadInput( "dof:samples" ) << OPLoadConstant( U_SAMPLES ) << OPDup( 11 ) - << OPLoadConstant( filterParams_[ 3 ] ) - << OPLoadConstant( filterParams_[ 2 ] ) - << OPLoadConstant( filterParams_[ 1 ] ) - << OPLoadConstant( filterParams_[ 0 ] ) + << OPLoadInput( "dof:max-blur" ) + << OPLoadInput( "dof:falloff" ) + << OPLoadInput( "dof:sharp-distance" ) + << OPLoadInput( "dof:sharp-range" ) << OPLoadConstant( U_PARAMS ) << OPDup( 17 ) << OPLoadConstant( 1 ) @@ -121,6 +119,7 @@ void T_DoFPass::render( ) void T_DoFPass::makeUI( ) { +#if 0 if ( !ImGui::CollapsingHeader( "Depth of field" ) ) { return; } @@ -131,4 +130,5 @@ void T_DoFPass::makeUI( ) ImGui::DragFloat( "Max blur" , &filterParams_[ 3 ] , .1 , .1 , 100 ); ImGui::DragInt( "Samples" , &nSamples_ , .2 , 1 , 32 ); +#endif } diff --git a/dof.hh b/dof.hh index ffd74ce..1a284d9 100644 --- a/dof.hh +++ b/dof.hh @@ -30,9 +30,5 @@ struct T_DoFPass T_Texture txPass1_ , txOutput_; T_Rendertarget rtPass1_ , rtPass2_; - - // SharpDist/SharpRange/Falloff/MaxBlur - float filterParams_[ 4 ]; - int nSamples_; }; diff --git a/sync.hh b/sync.hh index 93f2d11..ab2fd18 100644 --- a/sync.hh +++ b/sync.hh @@ -160,6 +160,12 @@ struct T_SyncManager // --------------------------------------------------------------------- // Value access + void clearInputs( ) + { values_.clear( ); } + bool addInput( __rd__ std::string const& name , + __rd__ const float initial = 0.f ) noexcept + { return values_.addValue( name , initial ); } + uint32_t inputPos( __rd__ std::string const& name ) const noexcept { return values_.indexOf( name ); } std::vector< float > const& inputs( ) const noexcept