Raymarcher controls
This commit is contained in:
parent
8b0e6e2143
commit
07b1960d5a
1 changed files with 21 additions and 1 deletions
22
main.cc
22
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 );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue