DoF parameters moved to sync system
This commit is contained in:
parent
59128de38f
commit
e58b88737c
4 changed files with 22 additions and 12 deletions
8
demo.cc
8
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;
|
||||
}
|
||||
|
||||
|
|
16
dof.cc
16
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
|
||||
}
|
||||
|
|
4
dof.hh
4
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_;
|
||||
};
|
||||
|
||||
|
|
6
sync.hh
6
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
|
||||
|
|
Loading…
Reference in a new issue