diff --git a/main.cc b/main.cc index 6c41d4e..99ca730 100644 --- a/main.cc +++ b/main.cc @@ -17,16 +17,18 @@ struct T_Main const std::string projectFile; SDL_Window * window; SDL_GLContext gl; - T_FilesWatcher watcher; - T_WatchedFiles shaderFiles; - GLuint prog; - std::string loadError; bool done = false; bool capture = false; ImVec2 mouseInitial; ImVec2 mouseMove; + T_Camera camera; + + T_FilesWatcher watcher; + T_WatchedFiles shaderFiles; + GLuint prog; + void startIteration( ); void handleCapture( ); void makeUI( ); @@ -128,8 +130,7 @@ void T_Main::handleCapture( ) ImGui::SetMouseCursor( ImGuiMouseCursor_Arrow ); } else if ( capture ) { ImGui::SetMouseCursor( ImGuiMouseCursor_Move ); - //project->handleDND( mouseMove , ctrl , shift , lmb ); - // FIXME: D'n'D + camera.handleDND( mouseMove , ctrl , shift , lmb ); } else if ( appCanGrab && mb ) { capture = true; mouseInitial = ImGui::GetMousePos( ); @@ -139,8 +140,7 @@ void T_Main::handleCapture( ) } if ( ( appCanGrab || capture ) && io.MouseWheel ) { - //project->handleWheel( io.MouseWheel , ctrl , shift ); - // FIXME wheel + camera.handleWheel( io.MouseWheel , ctrl , shift ); } } @@ -175,10 +175,10 @@ void T_Main::render( ) glUniform1f( U_TIME , 0 ); glUniform2f( U_RESOLUTION , dspSize.x , dspSize.y ); - glUniform3f( U_CAM_POS , 0 , 0 , -15 ); - glUniform3f( U_LOOK_AT , 0 , 0 , 0 ); - glUniform3f( U_CAM_UP , 0 , 1 , 0 ); - glUniform1f( U_NEAR_PLANE , 1 ); + glUniform3fv( U_CAM_POS , 1 , &camera.pos.x ); + glUniform3fv( U_LOOK_AT , 1 , &camera.lookAt.x ); + glUniform3fv( U_CAM_UP , 1 , &camera.up.x ); + glUniform1f( U_NEAR_PLANE , camera.np ); glUniform3f( U_LIGHT_DIR , 0 , 1 , 1 ); glUniform4f( U_RENDER , 128 , 0.9 , 0.001 , 100 );