@@ -198,30 +198,30 @@ class Konstructs: public nanogui::Screen {
198198 if (client.is_connected ()) {
199199 handle_network ();
200200 handle_keys ();
201+ handle_mouse ();
202+ looking_at = player.looking_at (world, blocks);
203+ glClear (GL_DEPTH_BUFFER_BIT);
204+ for (auto model : model_factory.fetch_models ()) {
205+ chunk_shader.add (model);
206+ }
207+ sky_shader.render (player, mSize .x (), mSize .y (), time_of_day ());
208+ glClear (GL_DEPTH_BUFFER_BIT);
209+ int faces = chunk_shader.render (player, mSize .x (), mSize .y (),
210+ daylight (), time_of_day (), world, client);
211+ player_shader->render (player, mSize .x (), mSize .y (),
212+ daylight (), time_of_day ());
213+ if (looking_at && !hud.get_interactive () && !menu_state) {
214+ selection_shader.render (player, mSize .x (), mSize .y (),
215+ looking_at->second .position );
216+ }
217+ // cout << "Faces: " << faces << " FPS: " << fps.fps << endl;
218+ glClear (GL_DEPTH_BUFFER_BIT);
219+ if (!hud.get_interactive () && !menu_state)
220+ crosshair_shader.render (mSize .x (), mSize .y ());
221+ double mx, my;
222+ glfwGetCursorPos (mGLFWWindow , &mx, &my);
223+ hud_shader.render (mSize .x (), mSize .y (), mx, my, hud, blocks);
201224 }
202- handle_mouse ();
203- looking_at = player.looking_at (world, blocks);
204- glClear (GL_DEPTH_BUFFER_BIT);
205- for (auto model : model_factory.fetch_models ()) {
206- chunk_shader.add (model);
207- }
208- sky_shader.render (player, mSize .x (), mSize .y (), time_of_day ());
209- glClear (GL_DEPTH_BUFFER_BIT);
210- int faces = chunk_shader.render (player, mSize .x (), mSize .y (),
211- daylight (), time_of_day (), world, client);
212- player_shader->render (player, mSize .x (), mSize .y (),
213- daylight (), time_of_day ());
214- if (looking_at && !hud.get_interactive () && !menu_state) {
215- selection_shader.render (player, mSize .x (), mSize .y (),
216- looking_at->second .position );
217- }
218- // cout << "Faces: " << faces << " FPS: " << fps.fps << endl;
219- glClear (GL_DEPTH_BUFFER_BIT);
220- if (!hud.get_interactive () && !menu_state)
221- crosshair_shader.render (mSize .x (), mSize .y ());
222- double mx, my;
223- glfwGetCursorPos (mGLFWWindow , &mx, &my);
224- hud_shader.render (mSize .x (), mSize .y (), mx, my, hud, blocks);
225225 }
226226
227227private:
0 commit comments