From 07b1960d5a76537beb57c2e324d95833104894af Mon Sep 17 00:00:00 2001 From: Emmanuel Benoit Date: Sat, 30 Sep 2017 21:37:35 +0200 Subject: [PATCH] Raymarcher controls --- main.cc | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/main.cc b/main.cc index f994cdb..5af1755 100644 --- a/main.cc +++ b/main.cc @@ -43,6 +43,13 @@ struct T_Main void render( ); void initProgram( ); + + // FIXME: move + int rmIterations = 128; + float rmStep = .9; + float rmEpsilon = .000001; + float rmMaxDist = 50; + float epsLog = log( rmEpsilon ) / log( 10 ); }; /*----------------------------------------------------------------------------*/ @@ -165,6 +172,18 @@ void T_Main::makeUI( ) ImGui::Begin( "Yay! Demo!" ); camera.makeUI( ); + + if ( ImGui::CollapsingHeader( "Raymarcher" ) ) { + ImGui::DragInt( "Iterations" , &rmIterations , .1 , 1 , 512 ); + ImGui::DragFloat( "Step" , &rmStep , .005 , .1 , 2 ); + ImGui::DragFloat( "Max. dist." , &rmMaxDist , .1f , + 0.01 , 1000.0 , "%.2f" ); + if ( ImGui::DragFloat( "Epsilon" , &epsLog , .01f , + -10 , -0.5 , "10 ^ %.2f" ) ) { + rmEpsilon = pow( 10 , epsLog ); + } + } + bloomPass->makeUI( ); ImGui::End( ); @@ -198,7 +217,8 @@ void T_Main::render( ) glUniform3f( U_LIGHT_DIR , 0 , 1 , 1 ); - glUniform4f( U_RAYMARCHER , 128 , 0.9 , 0.001 , 100 ); + glUniform4f( U_RAYMARCHER , rmIterations , rmStep , + rmEpsilon , rmMaxDist ); glRectf( -1, -1 , 1 , 1 ); }