Merge branch 'master' of goat:git/laserbrain_demo
authorJohn Tsiombikas <nuclear@member.fsf.org>
Sat, 29 Sep 2018 03:05:06 +0000 (06:05 +0300)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Sat, 29 Sep 2018 03:05:06 +0000 (06:05 +0300)
1  2 
src/app.cc

diff --combined src/app.cc
@@@ -345,8 -345,11 +345,8 @@@ static void update(float dt
                avatar.pos.y -= speed;
        }
  
 -      float theta = M_PI * avatar.body_rot / 180.0f;
 -      Vec3 newpos;
 -      newpos.x = avatar.pos.x + cos(theta) * dir.x - sin(theta) * dir.z;
 -      newpos.y = avatar.pos.y;
 -      newpos.z = avatar.pos.z + sin(theta) * dir.x + cos(theta) * dir.z;
 +      Vec3 walk_dir = avatar.calc_walk_dir(dir.z, dir.x);
 +      Vec3 newpos = avatar.pos + walk_dir;
  
        if(noclip) {
                avatar.pos = newpos;
@@@ -559,6 -562,12 +559,12 @@@ void app_display(
                vp_width = win_width;
                vp_height = win_height;
  
+               if(!gfbo && !fb_srgb && sdr_post_gamma) {
+                       glViewport(0, 0, win_width, win_height);
+                       slow_post(sdr_post_gamma);
+                       glUseProgram(0);
+               }
                if(should_swap) {
                        app_swap_buffers();
                }
@@@ -777,24 -786,6 +783,24 @@@ void app_keyboard(int key, bool pressed
                        exui_change_tab(1);
                        break;
  
 +              case '\t':
 +                      if(exsel_grab_mouse) {
 +                              Exhibit *ex = exsel_grab_mouse.ex;
 +                              exslot_mouse.detach_exhibit();
 +                              exman->stash_exhibit(ex);
 +                              exsel_grab_mouse = ExSelection::null;
 +                      } else {
 +                              Exhibit *ex = exman->unstash_exhibit();
 +                              if(ex) {
 +                                      exslot_mouse.attach_exhibit(ex, EXSLOT_ATTACH_TRANSIENT);
 +                                      exsel_grab_mouse = ex;
 +
 +                                      Vec3 fwd = avatar.get_body_fwd();
 +                                      exslot_mouse.node.set_position(avatar.pos + fwd * 100);
 +                              }
 +                      }
 +                      break;
 +
                case KEY_F5:
                case KEY_F6:
                case KEY_F7:
@@@ -852,7 -843,7 +858,7 @@@ void app_mouse_button(int bn, bool pres
  
                                exslot_mouse.detach_exhibit();
  
 -                              ExhibitSlot *slot = exman->nearest_empty_slot(pos, 100);
 +                              ExhibitSlot *slot = exman->nearest_empty_slot(pos, 300);
                                if(!slot) {
                                        debug_log("no empty slot nearby\n");
                                        if(ex->prev_slot && ex->prev_slot->empty()) {
  static inline void mouse_look(float dx, float dy)
  {
        float scrsz = (float)win_height;
 -      avatar.body_rot += dx * 512.0 / scrsz;
 +      avatar.set_body_rotation(avatar.body_rot + dx * 512.0 / scrsz);
        avatar.head_alt += dy * 512.0 / scrsz;
  
        if(avatar.head_alt < -90) avatar.head_alt = -90;