Exemplo n.º 1
0
void vsx_widget_2d_pager::init() {
  set_size(vsx_vector(0.06,0.1));
  pos.x = 0.0f;
  pos.y = 0.0f;
	render_type = VSX_WIDGET_RENDER_2D;
	coord_type = VSX_WIDGET_COORD_CENTER;
}
Exemplo n.º 2
0
void vsx_widget_base_editor::i_draw() {
  calc_pos();
  calc_size();
  //vsx_widget_panel::base_draw();
  float db15 = dragborder*2.5f;
  scrollbar_horiz->set_pos(vsx_vector(-size.x*0.5,-size.y*0.5));
  scrollbar_horiz->set_size(vsx_vector(target_size.x-db15, db15));
  scrollbar_horiz->scroll_window_size = editor->scroll_x_size;

  scrollbar_vert->set_pos(vsx_vector(size.x*0.5-db15,-size.y*0.5+db15));
  scrollbar_vert->set_size(vsx_vector(db15,target_size.y-scrollbar_horiz->size.y));
  scrollbar_vert->scroll_window_size = editor->scroll_y_size;
  editor->set_pos(vsx_vector(-scrollbar_vert->size.x*0.5f,scrollbar_horiz->size.y*0.5f));

  editor->target_size.x = target_size.x-scrollbar_vert->size.x;
  editor->target_size.y = target_size.y-scrollbar_horiz->size.y;
}
Exemplo n.º 3
0
void vsx_widget_window::i_draw() {
	if (button_close)
	{
		//MessageBox(0, name.c_str(), name.c_str(), MB_OK);
		//button_close->set_render_type(render_type);
		((vsx_widget_button*)button_close)->border = 0.0001;
  	button_close->set_pos(vsx_vector(size.x-font_size*0.4f,size.y-font_size*0.5f-0.5f*dragborder));
  	button_close->set_size(vsx_vector(font_size*0.4f,font_size*0.8f-dragborder));
	}

  if (visible) {
    myf.color.a = color.a;
  glColor4f(skin_color[1].r,skin_color[1].g,skin_color[1].b,skin_color[1].a);
  draw_box(pos,size.x,size.y);
  glColor4f(skin_color[2].r,skin_color[2].g,skin_color[2].b,skin_color[2].a);
  draw_box(pos+vsx_vector(0.0f,size.y-font_size),size.x,font_size);
  // border
  glColor4f(skin_color[0].r,skin_color[0].g,skin_color[0].b,skin_color[0].a);
  // left
  draw_box(pos+vsx_vector(0,dragborder),dragborder,size.y-dragborder-dragborder);
  // right
  draw_box(pos+vsx_vector(size.x-dragborder,dragborder),dragborder,size.y-dragborder-dragborder);
  // bottom
  draw_box(pos,size.x,dragborder);
  // top
  draw_box(pos+vsx_vector(0.0f,size.y-dragborder),size.x,dragborder);
	glColor4f(skin_color[3].r,skin_color[3].g,skin_color[3].b,skin_color[3].a);
  myf.print(vsx_vector((pos.x+font_size*0.1)*screen_aspect,pos.y+size.y-font_size*0.85),title,font_size*0.6);
	}
}
void vsx_window_object_inspector::unload() {
  resize_to(vsx_vector(0.001,0.001));
  move(1-0.001,1,0);
#ifndef VSXU_PLAYER
  texture.unload();
#endif
  filename_loaded = "";
  view_type = 0;
}
vsx_window_object_inspector::vsx_window_object_inspector()
{
  vsx_widget_window::init();
  inspected  = 0;
  init_run = false;
  init_run = true;
  component_rename_edit = add(new vsx_widget_base_edit,"edit1");
  component_rename_edit->init();
  topmost = true;
  component_rename_button = add(new vsx_widget_button,"button_rename");
  label1 = add(new vsx_widget_2d_label,"label1");
  label2 = add(new vsx_widget_2d_label,"label1");

  vsx_widget::init_children();
  title = "object inspector";
	set_pos(vsx_vector(1.0f,1.0f));
	set_size(vsx_vector(0.25f,0.05f));
  allow_resize_x = allow_resize_y = 1;

  //-- COMPONENT INSPECTOR ---------------------------------------------------------------------------------------------

  component_rename_button->visible = 0;
  component_rename_button->set_size(vsx_vector(0.033,0.020));
  component_rename_button->set_pos(vsx_vector(0.18,0.025));
  component_rename_button->title = "RENAME";
  component_rename_button->commands.adds(4,"component_rename_button","component_rename_button","");
  ((vsx_widget_button*)component_rename_button)->border = 0.0003;

  component_rename_edit->visible = 1;
	component_rename_edit->set_pos(vsx_vector(0.085f,0.025f));
	component_rename_edit->set_size(vsx_vector(0.155f,0.02f));
  component_rename_edit->set_font_size(0.018f);
  ((vsx_widget_base_edit*)component_rename_edit)->size_from_parent = true;
  ((vsx_widget_base_edit*)component_rename_edit)->single_row = true;
  ((vsx_widget_base_edit*)component_rename_edit)->set_string("");
  ((vsx_widget_base_edit*)component_rename_edit)->caret_goto_end();
  ((vsx_widget_base_edit*)component_rename_edit)->allowed_chars = "_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";

  component_list.push_back(component_rename_button);
  component_list.push_back(component_rename_edit);
  component_list.push_back(label1);
  component_list.push_back(label2);

  // -------------------------------------------------------------------------------------------------------------------
  //-- CHOOSER INSPECTOR -----------------------------------------------------------------------------------------------

  ((vsx_widget_2d_label*)label1)->halign = a_left;
  label1->pos.x = 0.005f;
  label1->pos.y = 0.05f;
  label1->visible = 1;
  ((vsx_widget_2d_label*)label2)->halign = a_left;
  label2->pos.x = 0.005f;
  label2->pos.y = 0.12f;
  label2->visible = 0;

  // normal OI
  view_type = 0;
}
Exemplo n.º 6
0
void vsx_widget_window::init() {
  render_type = VSX_WIDGET_RENDER_2D;
  coord_type = VSX_WIDGET_COORD_CORNER;
  pos.y = 0.7f;
  set_size(vsx_vector(0.3f,0.3f));
  topmost = true;
  title = "window";
  constrained_x = false;
  constrained_y = false;
  visible = 1;
  target_pos = pos;
  target_size = size;
  support_interpolation = true;
  button_close = add(new vsx_widget_button,"bc1");
  init_children();
  init_run = true;


  button_close->title = "x";
  button_close->commands.adds(4,"close","close","bc1");
}
Exemplo n.º 7
0
bool app_draw(int id)
{
  if (id == 0) {
    my_draw.draw();
  } else
  {
    if (dual_monitor) {
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);	// Clear Screen And Depth Buffer
      vxe->process_message_queue(&internal_cmd_in,&internal_cmd_out);
      vxe->render();
      glDisable(GL_DEPTH_TEST);

      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      glMatrixMode(GL_MODELVIEW);
      glLoadIdentity();											// Reset The Modelview Matrix
      glEnable(GL_BLEND);
      ++frame_counter;
      ++delta_frame_counter;
      float dt = time2.dtime();
      delta_frame_time+= dt;
      total_time += dt;
      if (delta_frame_counter == 100) {
        delta_fps = 100.0f/delta_frame_time;
        delta_frame_counter = 0;
        delta_frame_time = 0.0f;
      }
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
      glColor4f(0,0,0,0.4f);
      glBegin(GL_QUADS);									// Draw A Quad
        glVertex3f(-1.0f, 1.0f, 0.0f);					// Top Left
        glVertex3f( 1.0f, 1.0f, 0.0f);					// Top Right
        glVertex3f( 1.0f,0.92f, 0.0f);					// Bottom Right
        glVertex3f(-1.0f,0.92f, 0.0f);					// Bottom Left
      glEnd();											// Done Drawing The Quad
      myf.print(vsx_vector(-1.0f,0.92f)," Fc "+i2s(frame_counter)+" Fps "+f2s(delta_fps)+" T "+f2s(total_time)+" Tfps "+f2s(frame_counter/total_time)+" MC "+i2s(vxe->get_num_modules())+" VSX Ultra (c) Vovoid",0.07);
    }
  }
  return true;
}
Exemplo n.º 8
0
void vsx_widget_controller_sequence::init()
{
  if (init_run) return;
  init_children();
  init_run = true;
  set_size(vsx_vector(0.12f,0.1f));
  seq_chan = add(new vsx_widget_seq_channel,"chan");
  if (size_controlled_from_outside)
  {
  	seq_chan->size = size;
  } else
  {
  	seq_chan->size = size*0.95f;
  }
  seq_chan->target_size = seq_chan->size;
  seq_chan->init();
  seq_chan->visible = 1;
  ((vsx_widget_seq_channel*)seq_chan)->set_view_time(-0.05f, 1.05f);
  ((vsx_widget_seq_channel*)seq_chan)->hidden_by_sequencer = false;
  ((vsx_widget_seq_channel*)seq_chan)->y_start = -0.15f;
  ((vsx_widget_seq_channel*)seq_chan)->y_end = 1.1f;
  ((vsx_widget_seq_channel*)seq_chan)->is_controller = true;
  get_value();
}
Exemplo n.º 9
0
/*******************************************************************************
        _               _
       (_)             | |
  _  _  _            _ | |  ____   ____  _ _ _
 (_)(_)| |          / || | / ___) / _  || | | |
  _  _ | | _______ ( (_| || |    ( ( | || | | |
 (_)(_)|_|(_______) \____||_|     \_||_| \____|
********************************************************************************/
void vsx_widget_base_edit::i_draw() {
  if (!lines.size()) return;

  allow_move_y = allow_move_x = false;
  //base_draw();
  scroll_x = round(scrollbar_pos_x*(longest_line-characters_width));
  if (scroll_x < 0) scroll_x = 0;
  float ff = longest_y - characters_height;
  if (ff < 0) ff = 0;
  scroll_y = round(scrollbar_pos_y*(ff));
  vsx_vector p = get_pos_p();
  p.x -= target_size.x*0.5;
  p.y -= target_size.y*0.5;
  if (render_type == VSX_WIDGET_RENDER_3D) {
    p.z = pos.z;
  } else {
    p.z = 0.0f;
  }
  skin_color[18].gl_color();
  draw_box(p, target_size.x, target_size.y);
  //int ypos = 0;
  p.y += target_size.y-font_size;
  calculate_scroll_size();
  bool run = true;

  int num_visible_found = 0;
  int real_line = 0;
  while (num_visible_found < scroll_y && real_line < (int)(lines.size()-1)) {
    //printf("traversing visible found\n");
    if (lines_visible[real_line] == 0) num_visible_found++;
    real_line++;
  }
  while (lines_visible[real_line] != 0 && real_line < (int)(lines.size()-1)) real_line++;

  int curline = real_line;
  vsx_vector pp = p;
  //std::vector<vsx_string>::iterator it = lines.begin();
  myf.syntax_colors[0] = skin_color[14];
  int cur_render_line = 0;
  if (selected_line_highlight) myf.color = skin_color[14];
  if (scroll_y < lines.size())
  if (curline < (int)lines.size())
  while (run)
  {
    if (lines_visible[curline] == 0)
    {
      //printf("rendering %d\n",curline);
      // save current size for speed in a variable
      long cursize = (long)lines[curline].size();
      //printf("scroll_x: %d\n",scroll_x);
      //printf("curline: %d\n",curline);
      //printf("cursize: %d\n",cursize);
      if (selected_line_highlight && curline == selected_line)
      {
        skin_color[15].gl_color();
        myf.syntax_colors[0] = skin_color[16]; // base color
        draw_box(pp,target_size.x,font_size);
      }
      if (cursize-(long)scroll_x >= (long)characters_width) {
        myf.print(pp,lines[curline].substr((int)scroll_x,(int)characters_width),font_size,lines_p[curline].substr((int)scroll_x,(int)characters_width));
      } else
      if (scroll_x < cursize)
      myf.print(pp,lines[curline].substr((int)scroll_x,(int)(lines[curline].size()-floor(scroll_x))),font_size,lines_p[curline].substr((int)scroll_x,(int)(lines[curline].size()-scroll_x)));

      if (enable_line_action_buttons)
      {
        if (cur_render_line+1 > (int)action_buttons.size())
        {
          vsx_widget* new_action_button = add(new vsx_widget_button,"ab_"+i2s(cur_render_line));
          new_action_button->init();
          new_action_button->set_size( vsx_vector(0.005f, font_size) );
          new_action_button->coord_related_parent = false;
          new_action_button->render_type = this->render_type;
          new_action_button->title = "x";
          new_action_button->commands.adds(4,"","action",i2s(cur_render_line));
          action_buttons.push_back(new_action_button);
        }
        action_buttons[cur_render_line]->set_pos(pp + vsx_vector(target_size.x-0.0025f,font_size*0.5f));
        action_buttons[cur_render_line]->visible = 1.0f;
      }

      pp.y -= font_size;

      if (selected_line_highlight && curline == selected_line)
      {
        myf.syntax_colors[0] = skin_color[14]; // base color
      }
      cur_render_line++;
    }
//    ++it;
    ++curline;
    //printf("%d %d %d %d\n",cur_render_line,(int)(characters_height-1), (int)curline, (lines.size()-1));
    if (cur_render_line > (long)characters_height-1 || (long)curline > (long)lines.size()-1)
    run = false;
  //  if (it == lines.end()) run = false;
  }
  if (k_focus == this && editing_enabled) {
    pp.x = p.x+(float)caretx*font_size*0.37;
    pp.y = p.y-font_size*(float)(carety);
    float tt = (float)((int)(time*3000) % 1000)*0.001;
    if (selected_line_highlight) myf.color = skin_color[17];
    myf.color.a = 1-tt;
    myf.print(pp,"_",font_size);
    myf.color.a = 1;
  }
  myf.color = vsx_color__(1,1,1,1);
}
Exemplo n.º 10
0
void vsx_widget_timeline::i_draw() {
  parentpos = parent->get_pos_p();
	float time_diff = owner->tend - owner->tstart;
  totalsize = (owner->tend - owner->tstart);

  float y_mid = parentpos.y+pos.y;
  float y_size = size.y;
  if (a_focus == this) y_size *= 3.0f;
  float y_size_half = y_size * 0.5f;

  if (auto_move_dir) {
    //float c_time = owner->curtime;
    float curtime = owner->curtime + auto_move_dir*dtime*time_diff*10.0f*a_dist;//totalsize*0.01;
    float tstart = owner->tstart + auto_move_dir*dtime*time_diff*10.0f*a_dist;//totalsize*0.01;
    float tend = owner->tend + auto_move_dir*dtime*time_diff*10.0f*a_dist;//totalsize*0.01;
    if (curtime >= 0) {
      owner->curtime = curtime;
      owner->tstart = tstart;
      owner->tend = tend;
    }
    command_q_b.add_raw("time_set "+f2s(owner->curtime));
    parent->vsx_command_queue_b(this);
  }

 	glBegin(GL_QUADS);
    if (owner->tstart < 0) {
   	  glColor4f(0.4,0.3,0.3f,0.5f);
   	  ff = size.x*(fabs(owner->tstart)/totalsize);
  		glVertex2f(parentpos.x+pos.x-size.x*0.5f, y_mid+y_size_half);
  		glVertex2f(parentpos.x+pos.x-size.x*0.5f+ff, y_mid+y_size_half);
  		glVertex2f(parentpos.x+pos.x-size.x*0.5f+ff, y_mid-y_size_half);
  		glVertex2f(parentpos.x+pos.x-size.x*0.5f, y_mid-y_size_half);
      if (owner->tend > 0) {
    	  glColor4f(0.3,0.4,0.3,0.5f);
    		glVertex2f(parentpos.x+pos.x-size.x*0.5f+ff, y_mid+y_size_half);
    		glVertex2f(parentpos.x+pos.x+size.x*0.5f, y_mid+y_size_half);
    		glVertex2f(parentpos.x+pos.x+size.x*0.5f, y_mid-y_size_half);
    		glVertex2f(parentpos.x+pos.x-size.x*0.5f+ff, y_mid-y_size_half);
      }
    } else {
   	  glColor4f(0.3,0.4,0.3,0.5f);
  		glVertex2f(parentpos.x+pos.x-size.x*0.5f, y_mid+y_size_half);
  		glVertex2f(parentpos.x+pos.x+size.x*0.5f, y_mid+y_size_half);
  		glVertex2f(parentpos.x+pos.x+size.x*0.5f, y_mid-y_size_half);
  		glVertex2f(parentpos.x+pos.x-size.x*0.5f, y_mid-y_size_half);
    }
	glEnd();

  if (a_focus == this) {
 	  glColor3f(1.0f,1.0f,1.0f);
  } else
  glColor3f(0.5f,0.5f,0.5f);
  draw_box_border(vsx_vector(parentpos.x+pos.x-size.x*0.5,y_mid-y_size_half), vsx_vector(size.x,y_size), dragborder*0.5);

  levelstart = ((float)z_round(owner->tstart) - owner->tstart)/totalsize;
  //printf("levelstart: %f\n",levelstart);
  levelstart = 0;

  myf.color.a = 0.8f;

  float one_div_totalsize_times_sizex = 1.0f / totalsize * size.x;
	for (int i = (int)owner->tstart; i < (int)(owner->tend)+1; ++i)
	{
    glColor3f(0.5,0.5,0.5);
    float x =  (float)(i-owner->tstart) * one_div_totalsize_times_sizex;
    if (x > 0)
    {
      x += parentpos.x+pos.x - size.x*0.5f+levelstart*size.x;
      glBegin(GL_LINES);
        glVertex2f(x,y_mid+y_size*0.416666667f);
        glVertex2f(x,y_mid-y_size*0.416666667f);
      glEnd();
      myf.print_center(vsx_vector(x,y_mid), i2s(i),0.005);
    }
	}

  glColor3f(1,1,1);
  float f = ((owner->curtime-owner->tstart)/(owner->tend-owner->tstart))*size.x;
  glBegin(GL_LINES);
    glVertex2f(parentpos.x+pos.x-size.x*0.5f+f,y_mid+y_size*0.416666667);
    glVertex2f(parentpos.x+pos.x-size.x*0.5f+f,y_mid-y_size*0.416666667);
  glEnd();

  // ************************************************************
  // sound waveform display
	// ************************************************************
  if (show_wave_data)
  {
		vsx_widget_server* server = (vsx_widget_server*)owner->get_server();
		vsx_engine* engine = (vsx_engine*)(server->engine);

		if (engine->engine_info.param_float_arrays.size() >= 4 && a_focus == this)
		{
			vsx_engine_float_array *full_pcm_data_l;
			vsx_engine_float_array *full_pcm_data_r;
			full_pcm_data_l = engine->engine_info.param_float_arrays[2];
			full_pcm_data_r = engine->engine_info.param_float_arrays[3];
			if (full_pcm_data_l->array.size() > 0)
			{
				// assuming we have 44100 samples per second
				float x_start = parentpos.x+pos.x-size.x*0.5f;
				float x_end   = parentpos.x+pos.x+size.x*0.5f;
				float t_start = owner->tstart;
				float t_end = owner->tend;
				size_t data_end = (size_t) (t_end * 44100.0f);
				if (owner->tstart < 0)
				{
					x_start += fabs(t_start / (t_end - t_start)) * size.x;
					//data_end -= fabs(t_start) * 44100.0f;
					t_start = 0.0f;
				}
				size_t data_start = (size_t) (t_start * 44100.0f);

				size_t data_count = data_end - data_start;
				float x_dist = x_end - x_start;
				double x_diff = (double)x_dist / (double)data_count;

	//			printf("data_start: %d\n", data_start);
				//printf("data_end: %d\n", data_end);
				//printf("data_count: %d\n", data_count);

				glColor4f(1.0f,0.2f,0.2f,0.15f);
				double x_pos = x_start;
				glBegin(GL_LINE_STRIP);
					for (
								size_t i = data_start;
								i < data_end;
								i++
							)
					{
						glVertex2f(x_pos, y_mid + (*full_pcm_data_l).array[i] * y_size_half );
						x_pos += x_diff;
					}
				glEnd();


				glColor4f(0.2f,1.0f,0.2f,0.1f);
				x_pos = x_start;
				glBegin(GL_LINE_STRIP);
					for (
								size_t i = data_start;
								i < data_end;
								i++
							)
					{
						glVertex2f(x_pos, y_mid + (*full_pcm_data_r).array[i] * y_size_half );
						x_pos += x_diff;
					}
				glEnd();
			} // pcm data pool size
		}
  }

	vsx_widget::i_draw();
}
Exemplo n.º 11
0
  void draw() {
    if (record_movie) {
      vxe->set_constant_frame_progression(1.0f / 60.0f);
      vxe->play();
    }

    if (desktop)
    {
      desktop->vsx_command_process_f();
    }

    if (first) {
      intro = new vsx_logo_intro;
    }
    dt = gui_t.dtime();
    gui_f_time += dt;
    gui_g_time += dt;

    float f_wait;
    bool run_always = false;
    if (desktop)
    {
      if (desktop->global_framerate_limit == -1)
      {
        run_always = true;
      }
      else
      {
        f_wait = 1.0f/desktop->global_framerate_limit;
      }
    }
    else
    {
      f_wait = 1.0f/100.0f;
    }

    if (run_always || gui_f_time > f_wait)
    {
      ++frame_count;

      if (desktop) {
        desktop->dtime = gui_f_time;
        desktop->time += desktop->dtime;
        desktop->frames = frame_count;
      }
      gui_fullscreen_fpstimer += gui_f_time;
      current_fps = f2s(round(1.0f/gui_f_time),2);
      if (gui_fullscreen_fpstimer > 1)
      {
        vsx_string h = fpsstring + " @ "+ current_fps+ "fps";
        gui_fullscreen_fpstimer = 0;
      }

      gui_f_time = 0;
      if (!*gui_prod_fullwindow)
      {
        if (desktop) {
          desktop->init_frame();
          desktop->draw();
          desktop->draw_2d();
        }
      }
      if (!dual_monitor)
      {
        vxe->process_message_queue(&internal_cmd_in,&internal_cmd_out);
      }

      if (*gui_prod_fullwindow)
      {

        glDepthMask(GL_TRUE);
        glClearColor(0.0f,0.0f,0.0f,1.0f);

        glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

        #ifndef NO_INTRO
          if (vxe->e_state == VSX_ENGINE_STOPPED)
          {
            //intro->draw(true);
          }
        #endif
        if (vxe && !dual_monitor) {
          vxe->render();
          glDisable(GL_DEPTH_TEST);

          glMatrixMode(GL_PROJECTION);
          glLoadIdentity();
          glMatrixMode(GL_MODELVIEW);
          glLoadIdentity();
          glEnable(GL_BLEND);
          ++frame_counter;
          ++delta_frame_counter;

          delta_frame_time+= dt;
          total_time += dt;
          if (delta_frame_counter == 100) {
            delta_fps = 100.0f/delta_frame_time;
            delta_frame_counter = 0;
            delta_frame_time = 0.0f;
          }

          if (gui_prod_fullwindow_helptext)
          {
            glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
            glColor4f(0,0,0,0.4f);
            glBegin(GL_QUADS);                  // Draw A Quad
              glVertex3f(-1.0f, 1.0f, 0.0f);          // Top Left
              glVertex3f( 1.0f, 1.0f, 0.0f);          // Top Right
              glVertex3f( 1.0f,0.92f, 0.0f);          // Bottom Right
              glVertex3f(-1.0f,0.92f, 0.0f);          // Bottom Left
            glEnd();                      // Done Drawing The Quad
            myf.print(vsx_vector(-1.0f,0.92f)," Fc "+i2s(frame_counter)+" Fps "+f2s(delta_fps)+" T "+f2s(total_time)+" Tfps "+f2s(frame_counter/total_time)+" MC "+i2s(vxe->get_num_modules())+" VSX Ultra (c) 2003-2010 Vovoid - Alt+T=toggle this text, Ctrl+Alt+P=screenshot (data dir), Alt+F=performance mode ",0.03f);
          }
        }
        if (desktop && desktop->performance_mode) {
          glClear(GL_DEPTH_BUFFER_BIT);
          desktop->init_frame();
          desktop->draw();
          desktop->draw_2d();
        }
      }
      #ifndef NO_INTRO
        //intro->draw();
      #endif
      if (!first && !desktop)
      {
        pgv.iterations = -1;
      }
      pgv.process_garbage();
      if (first)
      {
        if (!dual_monitor) {
          vxe->init();
          vxe->start();
        }
        load_desktop_a();
        first = false;
      }
    } else
    {
      int zz = (int)((f_wait-gui_f_time)*1000.0f);
      if (zz < 0) zz = 0;
      //printf("zz%d ",zz);
      //Sleep(zz);
    }
    //------------------------------------------------------------------
    // movie recording
    //------------------------------------------------------------------
    if (record_movie)
    {
      GLint viewport[4];
      glGetIntegerv(GL_VIEWPORT, viewport);
      char* pixeldata = (char*)malloc( viewport[2] * viewport[3] * 3 );
      char* pixeldata_flipped = (char*)malloc( viewport[2] * viewport[3] * 3 );
      take_screenshot = false;
      glReadPixels(0,0,viewport[2],viewport[3],GL_RGB,GL_UNSIGNED_BYTE, (GLvoid*)pixeldata);
      int x3 = viewport[2]*3;
      int hi = viewport[3];
      for (int y = 0; y < hi; y++)
      {
        for (int x = 0; x < x3; x++)
        {
          pixeldata_flipped[y*x3+x] = pixeldata[ (hi-y)*x3+x];
        }
      }

      CJPEGTest jpeg;
      jpeg.m_nResX = viewport[2];
      jpeg.m_nResY = viewport[3];
      jpeg.m_pBuf = (unsigned char*)pixeldata_flipped;

      //char filename[32768];
      #if PLATFORM_FAMILY == PLATFORM_FAMILY_UNIX
      if (access((vsx_get_data_path()+"videos").c_str(),0) != 0) mkdir((vsx_get_data_path()+"/videos").c_str(),0700);
        //sprintf(filename, "%sscreenshots/%d_%d_%d_rgb.jpg",vsx_get_data_path().c_str(),(int)time(0),viewport[2],viewport[3]);
      #endif
      vsx_string err;
      char mfilename[32];
      sprintf(mfilename, "%05d", movie_frame_count);

      jpeg.SaveJPEG( vsx_get_data_path()+"videos"+DIRECTORY_SEPARATOR+vsx_string(mfilename)+"_"+ i2s(viewport[2]) + "_" + i2s(viewport[3])+".jpg", err, 100 );
      jpeg.m_pBuf = 0;
      free(pixeldata);
      free(pixeldata_flipped);
      movie_frame_count++;
    }

    //------------------------------------------------------------------
    // screenshots
    //------------------------------------------------------------------

    if (take_screenshot)
    {
      GLint viewport[4];
      glGetIntegerv(GL_VIEWPORT, viewport);
      char* pixeldata = (char*)malloc( viewport[2] * viewport[3] * 3 );
      char* pixeldata_flipped = (char*)malloc( viewport[2] * viewport[3] * 3 );
      take_screenshot = false;
      glReadPixels(0,0,viewport[2],viewport[3],GL_RGB,GL_UNSIGNED_BYTE, (GLvoid*)pixeldata);

      int x3 = viewport[2]*3;
      int hi = viewport[3];
      for (int y = 0; y < hi; y++)
      {
        for (int x = 0; x < x3; x++)
        {
          pixeldata_flipped[y*x3+x] = pixeldata[ (hi-y)*x3+x];
        }
      }

      CJPEGTest jpeg;
      jpeg.m_nResX = viewport[2];
      jpeg.m_nResY = viewport[3];
      jpeg.m_pBuf = (unsigned char*)pixeldata_flipped;

      //char filename[32768];
      #if PLATFORM_FAMILY == PLATFORM_FAMILY_UNIX
      if (access((vsx_get_data_path()+"screenshots").c_str(),0) != 0) mkdir((vsx_get_data_path()+"/screenshots").c_str(),0700);
        //sprintf(filename, "%sscreenshots/%d_%d_%d_rgb.jpg",vsx_get_data_path().c_str(),(int)time(0),viewport[2],viewport[3]);
      #endif
      /*FILE* fp = fopen(filename,"wb");
      fwrite(pixeldata_flipped, 1, viewport[2] * viewport[3] * 3, fp);
      fclose(fp);*/
      vsx_string err;
      jpeg.SaveJPEG( vsx_get_data_path()+"screenshots"+DIRECTORY_SEPARATOR+i2s(time(0))+"_"+ i2s(viewport[2]) + "_" + i2s(viewport[3])+".jpg", err, 100 );
      jpeg.m_pBuf = 0;
      free(pixeldata);
      free(pixeldata_flipped);
    }
  } // ::draw()
Exemplo n.º 12
0
// VSX_WIDGET_POPUP ****************************************************************************************************
// VSX_WIDGET_POPUP ****************************************************************************************************
// VSX_WIDGET_POPUP ****************************************************************************************************
// VSX_WIDGET_POPUP ****************************************************************************************************
  void vsx_widget_popup_menu::i_draw() {
    render_type =   VSX_WIDGET_RENDER_2D;

    target_size.y = (float)(menu_items.count())*row_size;

    if (visible >= 1) {
      if (a_focus->widget_type != VSX_WIDGET_TYPE_2D_MENU_POPUP && visible != 2) {
        visible = 0;
        return;
      } else {
        if (visible == 2 && a_focus->widget_type == VSX_WIDGET_TYPE_2D_MENU_POPUP) {
          // in case of another menu being open before us
          if (a_focus != this)
          if (a_focus != parent) {
            a_focus->visible = 0;
          }
        }
        if (visible == 2) {
          hide_children();
          over = 0;
          oversub = false;
          target_pos.y -= target_size.y;
          pos.y = target_pos.y;
        }
        visible = 1;
        a_focus = this;
        if (parent->widget_type != VSX_WIDGET_TYPE_2D_MENU_POPUP) {
          if (pos.x+size.x > 1) pos.x = 1-size.x;
        }
      }
   	  float sx = target_pos.x;
   	  float alpha = 0.8f;
   	  //if (!oversub) alpha = 1.0f; else alpha = 1.0f;

     	//glBegin(GL_QUADS);
      if (parent->widget_type == VSX_WIDGET_TYPE_2D_MENU_POPUP) {
        if (((vsx_widget_popup_menu*)parent)->over && ((vsx_widget_popup_menu*)parent)->over != id_over)
        visible = 0; else
        {
          alpha = 1.0f;
        glColor4f(skin_color[0].r*alpha,skin_color[0].g,skin_color[0].b,skin_color[0].a*alpha);
        draw_box(vsx_vector((sx-0.001)*screen_aspect,target_pos.y+0.001+target_size.y),(size.x+0.002)*screen_aspect,-((float)menu_items.count())*row_size-0.002);
        }
      } else {
        glColor4f(skin_color[0].r*alpha,skin_color[0].g,skin_color[0].b,skin_color[0].a*alpha);
        draw_box(vsx_vector((sx-0.001)*screen_aspect,target_pos.y+0.001+target_size.y),(size.x+0.002)*screen_aspect,-((float)menu_items.count())*row_size-0.002);
    	  myf.print(vsx_vector(sx*screen_aspect,target_pos.y+target_size.y),parent->title,row_size);
      }


   	  double y = target_pos.y+target_size.y;
   	  vsx_command_s *t;

   	  menu_items.reset();
   	  int c = 1;
      while ( (t = menu_items.get()) ) {
        if (c == over && over != 0)
        {
          current_command_over = t;
          glColor4f(skin_color[4].r,skin_color[4].g,skin_color[4].b,skin_color[4].a);
          if (t->cmd == "" && l_list.find(t->title) != l_list.end())
          {
            vsx_widget_popup_menu* sub = ((vsx_widget_popup_menu*)l_list[t->title]);
            if (!sub->visible) {
              sub->visible = 2;
              sub->target_pos.x = target_pos.x+(1/screen_aspect)*row_size*(float)t->title.size()*0.33;
              sub->target_pos.y = y;
              sub->size = size;
              sub->id_over = over;
            }
            oversub = true;
          } else {
            oversub = false;
          }
        }
        else
        glColor4f(skin_color[1].r,skin_color[1].g,skin_color[1].b,skin_color[1].a*alpha);
        draw_box(vsx_vector((sx)*screen_aspect,y),size.x*screen_aspect,-row_size);
        myf.print(vsx_vector((sx+0.003)*screen_aspect,y-row_size),t->title,row_size*0.8);
        y-=row_size;
        ++c;
      }
      draw_children_2d();
    }
  }
Exemplo n.º 13
0
void run() {
  if (filename->get() != current_filename) {
   	if (!verify_filesuffix(filename->get(),"obj")) {
   		filename->set(current_filename);
   		message = "module||ERROR! This is not a OBJ mesh file!";
   		return;
   	} else message = "module||ok";

    current_filename = filename->get();
    vsxf_handle *fp;
    //printf("a\n");
    if ((fp = engine->filesystem->f_open(current_filename.c_str(), "r")) == NULL)
    {
      return;
    }
    
    char buf[65535];
    vsx_string line;
    vsx_array<vsx_vector> vertices; //vertices.set_allocation_increment(15000);
    vsx_array<vsx_vector> normals; //normals.set_allocation_increment(15000);
    vsx_array<vsx_tex_coord> texcoords; //texcoords.set_allocation_increment(15000);
    //mesh->data->vertex_tex_coords.reset_used();
    mesh->data->clear();
    //mesh->data->vertices.set_allocation_increment(15000);
    //mesh->data->vertex_normals.set_allocation_increment(15000);
    //mesh->data->vertex_tex_coords.set_allocation_increment(15000);
    //mesh->data->faces.set_allocation_increment(15000);

    int face_cur = 0;
    //printf("b\n");
    bool found_normals = false;
    bool found_texcoords = false;
    if (preserve_uv_coords->get()) {
      mesh->data->vertices.reset_used();
      mesh->data->vertex_tex_coords.reset_used();
      mesh->data->vertex_normals.reset_used();
      mesh->data->faces.reset_used();

	    while (engine->filesystem->f_gets(buf,65535,fp)) {
	      line = buf;
	      if (line[line.size()-1] == 0x0A) line.pop_back();
	      if (line[line.size()-1] == 0x0D) line.pop_back();
	      //printf("reading line: %s\n",line.c_str());
	      //printf("c\n");
	      if (line.size()) {
	        vsx_avector<vsx_string> parts;
	        vsx_string deli = " ";
	        explode(line, deli, parts);
	        if (parts[0] == "v") {
	        	//printf("v\n");
	          //mesh->data->vertices.push_back(vsx_vector(s2f(parts[1]),s2f(parts[2]),s2f(parts[3])));
	          vertices.push_back(vsx_vector(s2f(parts[1]),s2f(parts[2]),s2f(parts[3])));
	        } else
	        if (parts[0] == "vt") {
	        	//printf("vt\n");
	          vsx_tex_coord a;
	          a.s = (s2f(parts[1]));
	          a.t = (s2f(parts[2]));
	          //printf("%f  ::   %f\n",a.s,a.t);
	          texcoords.push_back(a);
	          //vsx_vector__(s2f(parts[1]),s2f(parts[2]),s2f(parts[3])));
	          found_texcoords = true;

	        } else
	        if (parts[0] == "vn") {
	        	//printf("vn\n");
	          //printf("normal\n");
	          normals.push_back(vsx_vector(s2f(parts[1]),s2f(parts[2]),s2f(parts[3])));
	          found_normals = true;
	          //mesh->data->vertex_normals.push_back(vsx_vector__(s2f(parts[1]),s2f(parts[2]),s2f(parts[3])));
	        } else
	        if (parts[0] == "f") {
	        	//printf("f1\n");
	          //printf("face\n");
	          //if (parts.size() == 4) {
	            //printf("num texcoords %d\n",texcoords.size());
	            vsx_face ff;
	//            vsx_avector<vsx_string> parts2;
	            vsx_string deli2 = "/";

	/*            explode(parts[1], deli2, parts2);
	            ff.c = s2i(parts2[0])-1;
	            mesh->data->vertex_normals[ff.c] = normals[s2i(parts2[1])-1];
	            mesh->data->vertex_tex_coords[ff.c] = texcoords[s2i(parts2[1])-1];

	            explode(parts[2], deli2, parts2);
	            ff.b = s2i(parts2[0])-1;
	            mesh->data->vertex_normals[ff.b] = normals[s2i(parts2[1])-1];
	            mesh->data->vertex_tex_coords[ff.b] = texcoords[s2i(parts2[1])-1];

	            explode(parts[3], deli2, parts2);
	            ff.a = s2i(parts2[0])-1;
	            mesh->data->vertex_normals[ff.a] = normals[s2i(parts2[1])-1];
	            mesh->data->vertex_tex_coords[ff.a] = texcoords[s2i(parts2[1])-1];*/


	            vsx_avector<vsx_string> parts2;
	            explode(parts[1], deli2, parts2);
	            vsx_avector<vsx_string> parts3;
	            explode(parts[2], deli2, parts3);
	            vsx_avector<vsx_string> parts4;
	            explode(parts[3], deli2, parts4);

	            ff.c = face_cur;   //s2i(parts2[0])-1;
	            ff.b = face_cur+1; //s2i(parts3[0])-1;
	            ff.a = face_cur+2; //s2i(parts4[0])-1;

              
	            //printf("f2\n");
              //printf("reading line: %s\n",line.c_str());
              int id;
              id = s2i(parts2[0])-1; if (id < 0) id=0;
	            mesh->data->vertices[ff.a] = vertices[id];
              id = s2i(parts3[0])-1; if (id < 0) id=0;
              mesh->data->vertices[ff.b] = vertices[id];
              id = s2i(parts4[0])-1; if (id < 0) id=0;
	            mesh->data->vertices[ff.c] = vertices[id];

	            if (found_texcoords && found_normals) {
                if (parts2[1] != "") {
                  mesh->data->vertex_tex_coords[ff.a] = texcoords[s2i(parts2[1])-1];
                  mesh->data->vertex_tex_coords[ff.b] = texcoords[s2i(parts3[1])-1];
                  mesh->data->vertex_tex_coords[ff.c] = texcoords[s2i(parts4[1])-1];
                }
	              if (parts2[2] != "") {
                  mesh->data->vertex_normals[ff.a] = normals[s2i(parts2[2])-1];
                  mesh->data->vertex_normals[ff.b] = normals[s2i(parts3[2])-1];
                  mesh->data->vertex_normals[ff.c] = normals[s2i(parts4[2])-1];
                }
	            } else
	            if (found_normals) {
                if (parts2[2] != "") {
                  mesh->data->vertex_normals[ff.a] = normals[s2i(parts2[2])-1];
                  mesh->data->vertex_normals[ff.b] = normals[s2i(parts3[2])-1];
                  mesh->data->vertex_normals[ff.c] = normals[s2i(parts4[2])-1];
                }
	            } else
	            if (found_texcoords) {
                if (parts2[1] != "") {
                  mesh->data->vertex_tex_coords[ff.a] = texcoords[s2i(parts2[1])-1];
                  mesh->data->vertex_tex_coords[ff.b] = texcoords[s2i(parts3[1])-1];
                  mesh->data->vertex_tex_coords[ff.c] = texcoords[s2i(parts4[1])-1];
                }
	            }


						  //printf("%d  ",s2i(parts2[1]));
						  //printf("%d  ",s2i(parts3[1]));
						  //printf("%d\n",s2i(parts4[1]));
						  //printf("f3\n");

	            /*printf("ida: %d\n",s2i(parts2[1]));
	            printf("orig coords: %f %f\n",texcoords[s2i(parts2[1])-1].s,texcoords[s2i(parts2[1])-1].t);
	            printf("texcoord s: %f   %f\n",mesh->data->vertex_tex_coords[ff.a].s,mesh->data->vertex_tex_coords[ff.a].t);

	            printf("idb: %d\n",s2i(parts3[1]));
	            printf("orig coords: %f %f\n",texcoords[s2i(parts3[1])-1].s,texcoords[s2i(parts3[1])-1].t);
	            printf("texcoord s: %f   %f\n",mesh->data->vertex_tex_coords[ff.a].s,mesh->data->vertex_tex_coords[ff.a].t);

	            printf("idc: %d\n",s2i(parts4[1]));
	            printf("orig coords: %f %f\n",texcoords[s2i(parts4[1])-1].s,texcoords[s2i(parts4[1])-1].t);
	            printf("texcoord s: %f   %f\n",mesh->data->vertex_tex_coords[ff.a].s,mesh->data->vertex_tex_coords[ff.a].t);
	*/
	            face_cur += 3;
	            mesh->data->faces.push_back(ff);
	            //printf("f4\n");
	          //}
	        }

	      }
	    }
    } else {

	    while (engine->filesystem->f_gets(buf,65535,fp)) {
	      line = buf;
	      if (line[line.size()-1] == 0x0A) line.pop_back();
	      if (line[line.size()-1] == 0x0D) line.pop_back();
	      if (line.size()) {
	        vsx_avector<vsx_string> parts;
	        vsx_string deli = " ";
	        explode(line, deli, parts);
	        if (parts[0] == "v") {
	        	mesh->data->vertices.push_back(vsx_vector(s2f(parts[1]),s2f(parts[2]),s2f(parts[3])));
	        } else
	        if (parts[0] == "f") {
	            vsx_face ff;
	            vsx_string deli2 = "/";

	            vsx_avector<vsx_string> parts2;
	            explode(parts[1], deli2, parts2);
	            vsx_avector<vsx_string> parts3;
	            explode(parts[2], deli2, parts3);
	            vsx_avector<vsx_string> parts4;
	            explode(parts[3], deli2, parts4);

	            ff.c = s2i(parts2[0])-1;
	            ff.b = s2i(parts3[0])-1;
	            ff.a = s2i(parts4[0])-1;

	            //printf("face %d %d %d %d\n", mesh->data->faces.size(), ff.a, ff.b, ff.c);

	            mesh->data->faces.push_back(ff);
	        }

	      }
	    }
    }

    engine->filesystem->f_close(fp);
    loading_done = true;
    mesh->timestamp = (int)(engine->real_vtime*1000.0f);
    #ifdef VSXU_DEBUG
      //printf("mesh timestamp: %d\n", (int)mesh->timestamp);
    #endif
  }
  result->set_p(mesh);
}
Exemplo n.º 14
0
void vsx_widget_button::i_draw() {
	//if (type == 0) return;
	if (!visible) return;

	vsx_vector p = get_pos_p();
	if (coord_type == VSX_WIDGET_COORD_CENTER) {
		p.x -= size.x*0.5;
		p.y += size.y*0.5;
		//p.z = 1.1f;
	}
	//printf("p.z %f\n",p.z);
	//if (render_type == VSX_WIDGET_RENDER_2D) {
//      p.z = 0.0f;
//    }
	float font_size_smaller = 1.0f;
	if ((m_focus == this) && (!outside)) {
		font_size_smaller = 0.75f;
		skin_color[0].gl_color();
	}
	else
		skin_color[6].gl_color();

	glBegin(GL_QUADS);
			glVertex3f((p.x+border)*screen_aspect, p.y-size.y+border, p.z);
			glVertex3f((p.x+border)*screen_aspect, p.y-border, p.z);
			glVertex3f((p.x+size.x-border)*screen_aspect, p.y-border, p.z);
			glVertex3f((p.x+size.x-border)*screen_aspect, p.y-size.y+border, p.z);

	if ((m_focus == this) && (!outside))
	skin_color[1].gl_color();
	else
	skin_color[4].gl_color();

			// left
			glVertex3f(p.x, p.y-border, p.z);
			glVertex3f((p.x+border), p.y-border, p.z);
			glVertex3f((p.x+border), p.y-size.y+border, p.z);
			glVertex3f(p.x,p.y-size.y+border, p.z);

			// right
			glVertex3f((p.x+size.x-border), p.y-border, p.z);
			glVertex3f((p.x+size.x), p.y-border, pos.z);
			glVertex3f((p.x+size.x), p.y-size.y+border, p.z);
			glVertex3f((p.x+size.x-border),p.y-size.y+border, p.z);

			glVertex3f(p.x, p.y, p.z);
			glVertex3f((p.x+size.x), p.y, p.z);
			glVertex3f((p.x+size.x), p.y-border, p.z);
			glVertex3f(p.x,p.y-border, p.z);

			glVertex3f(p.x, p.y-size.y+border, p.z);
			glVertex3f((p.x+size.x), p.y-size.y+border, p.z);
			glVertex3f((p.x+size.x), p.y-size.y, p.z);
			glVertex3f(p.x,p.y-size.y, p.z);
	glEnd();
	//glColor3f(1,1,1);
	float dd;
	if ((m_focus == this) && (!outside))
	dd = size.y*0.05;
	else
	dd = 0;

	myf.print_center(vsx_vector((p.x+size.x/2+dd),p.y-size.y+size.y*0.25), title,size.y*0.4f*font_size_smaller);
}
Exemplo n.º 15
0
void vsx_window_object_inspector::draw() {
  if (a_focus != component_rename_edit && inspected != a_focus && a_focus != this) {
    //resize_to(vsx_vector(0.001,0.001));
    //move(1-0.001,1);
  	move(1.0f,1.0f);

    inspected = a_focus;
    for (unsigned int i = 0; i < component_list.size(); ++i) component_list[i]->visible = 0;

    if (inspected->widget_type == VSX_WIDGET_TYPE_ANCHOR)
    {
      //label1->title = +a_focus->type;
      label2->title = vsx_string("Anchor data type:")+((vsx_widget_anchor*)inspected)->p_type;
      label1->visible = label2->visible = 1;
      if (((vsx_widget_anchor*)inspected)->alias) {
      	label1->title = "Rename alias:";
      	component_rename_button->visible = 1;
      	component_rename_edit->visible = 1;
      }
      //for (int i = 0; i < component_list.size(); ++i) component_list[i]->visible = 1;
      ((vsx_widget_base_edit*)component_rename_edit)->set_string(((vsx_widget_anchor*)a_focus)->name);
      //((vsx_widget_2d_edit*)component_rename_edit)->value.clear();
      title = "anchor "+((vsx_widget_anchor*)a_focus)->name;
      view_type = 0;
      set_size(vsx_vector(0.2f, 0.175f, 0.0f));
      move(1.0f - 0.2f , 1.0f - 0.175f, 0.0f);
    }
    else
    if (inspected->widget_type == VSX_WIDGET_TYPE_CONNECTOR)
    {
      label1->title = ((vsx_widget_connector_bezier*)a_focus)->destination->name;
      view_type = 0;
      label1->visible = 1;
      //label2->title = ((vsx_widget_anchor*)inspected)->p_type;
    }
    else
    if (inspected->widget_type == VSX_WIDGET_TYPE_COMPONENT)
    {
    	label1->title = "Rename module:";
    	component_rename_button->visible = 1;
    	component_rename_edit->visible = 1;

      for (unsigned long i = 0; i < component_list.size(); ++i) component_list[i]->visible = 1;
      //component_rename_button->visible = 1;
      //component_rename_edit->visible = 1;
      //label1->title = a_focus->name;

      ((vsx_widget_base_edit*)component_rename_edit)->set_string(((vsx_widget_component*)a_focus)->real_name);
      ((vsx_widget_base_edit*)component_rename_edit)->caret_goto_end();
//      ((vsx_widget_base_edit*)component_rename_edit)->value.clear();
      title = ((vsx_widget_component*)a_focus)->real_name;
      view_type = 0;
      //printf("resize to\n");
      set_size(vsx_vector(0.2f, 0.175f, 0.0f));
      move(1.0f - 0.2f , 1.0f - 0.175f, 0.0f);
      // request timing data
      label2->title = "This build of the engine does not\nsupport timing. The reason?\nTiming slows down performance.\n";
#ifdef VSXU_MODULE_TIMING
			command_q_b.add_raw("component_timing "+((vsx_widget_component*)a_focus)->real_name+" "+i2s(id));
#endif
  		((vsx_widget_component*)a_focus)->server->vsx_command_queue_b(this);
    } else
    if (inspected->widget_type == VSX_WIDGET_TYPE_ULTRA_CHOOSER)
    {

      //((vsx_widget_2d_edit*)component_rename_edit)->value.str(((vsx_widget_component*)a_focus)->real_name);
      //((vsx_widget_2d_edit*)component_rename_edit)->value.clear();
      //title = ((vsx_widget_component*)inspected)->component_type;
    } else view_type = 0;
    // image viewer
  }
  vsx_status_timer -= dtime;
  if (inspected->widget_type == VSX_WIDGET_TYPE_COMPONENT)
  {
  	if (vsx_status_timer < 0.0f) {
  		vsx_status_timer = 1.0f;
#ifdef VSXU_MODULE_TIMING
			command_q_b.add_raw("component_timing "+((vsx_widget_component*)inspected)->real_name+" "+i2s(id));
  		((vsx_widget_component*)inspected)->server->vsx_command_queue_b(this);
#endif
  	}
  }
}
Exemplo n.º 16
0
void gravity_strip::generate_mesh(
       vsx_mesh       &mesh,
       vsx_face*      &fs_d,
       vsx_vector*    &vs_d,
       vsx_vector*    &ns_d,
       vsx_tex_coord* &ts_d,
       vsx_matrix*    modelview_matrix,
       vsx_vector*    upvector,
       int &generated_vertices,
       int &generated_faces
     )
{
  VSX_UNUSED(mesh);
  if (!oldPos.size()) return;
  //glEnable(GL_LINE_SMOOTH);
  //glLineWidth(1.0f);
  //for(int i = 0; i < num_lines; i++) {
    //glBegin(GL_LINES);
    //glBegin(GL_POINTS);

    //float p = 1.0f/num_lines;

    if (length > 1.0f) length = 1.0f;
    if (length < 0.01f) length = 0.01f;

    // compute eyvec
    // 1. get the modelview matrix
    // 2. invert it
    // 3. multiply by vector [0,0,0,1]
    // 4. profit
    vsx_matrix model_matrix = *modelview_matrix;
    //vsx_matrix inverted_model_matrix;
    //glGetFloatv(GL_MODELVIEW_MATRIX, model_matrix.m);
    //modelview_matrix->dump();
    //model_matrix = *modelview_matrix;
    model_matrix.transpose();//assign_inverse(modelview_matrix);
    vsx_vector eye_pos = model_matrix.multiply_vector(vsx_vector(upvector->x,upvector->y,upvector->z));

    //printf("eye pos: %f, %f, %f\n", eye_pos.x, eye_pos.y, eye_pos.z);

    int num = (int)((float)BUFF_LEN * length);
    float fnum = (float)num;
    int i_ofs = offs - num;
    if (i_ofs < 0) i_ofs += BUFF_LEN;

    //int generated_vertices = 0;
    /*int num2 = num << 1;
    mesh.data->faces.allocate(num2);
    mesh.data->vertices.allocate(num2);
    mesh.data->vertex_normals.allocate(num2);
    mesh.data->vertex_tex_coords.allocate(num2);

    mesh.data->faces.reset_used(num2);
    mesh.data->vertices.reset_used(num2);
    mesh.data->vertex_normals.reset_used(num2);
    mesh.data->vertex_tex_coords.reset_used(num2);
*/
    //vsx_face*      fs_d = &mesh.data->faces[0];
    //vsx_vector*    vs_d = &mesh.data->vertices[0];
    //vsx_vector*    ns_d = &mesh.data->vertex_normals[0];
    //vsx_tex_coord* ts_d = &mesh.data->vertex_tex_coords[0];

    float m_width = width*0.1f;
    float d_inc = 1.0f / fnum;
    float d_j = 0.0f;
    int loop_counter = 0;
    for(int j = 0; j < num; j++)
    {
      int k = (i_ofs + j) % (BUFF_LEN-1);
      vsx_vector kk = oldPos[0][k+1] - oldPos[0][k];
      if (kk.norm() > 0.0001f)
      {
        //kk.normalize();
        vsx_vector a;
        a.cross( -kk, eye_pos );

        a.normalize();
        //vsx_vector b;
        //b.cross(kk,a);
        //b.normalize();
        vsx_vector d;
        //d.cross(b,kk);
        //d.normalize();

        d = a * m_width;

        vsx_vector res = oldPos[0][k] + d * 0.5f;
        //#
        *vs_d = res + d;
        *ns_d = *vs_d;
        (*ns_d).normalize();
        vs_d++;
        ns_d++;
        //#
        *vs_d = res - d;
        *ns_d = *vs_d;
        (*ns_d).normalize();
        vs_d++;
        ns_d++;

        (*ts_d).s = 0.0f;
        (*ts_d).t = d_j;
        ts_d++;
        (*ts_d).s = 1.0f;
        (*ts_d).t = d_j;
        ts_d++;
        generated_vertices++;
        generated_vertices++;

        // -1   -2
        // -3   -4
// TODO: add faces
        if (loop_counter > 2)
        {
          //printf("generated_vertices_id: %d\n", generated_vertices);
          (*fs_d).a = generated_vertices -2;
          (*fs_d).b = generated_vertices -3;
          (*fs_d).c = generated_vertices -1;
          fs_d++;
          generated_faces++;
          (*fs_d).a = generated_vertices -4;
          (*fs_d).b = generated_vertices -3;
          (*fs_d).c = generated_vertices -2;
          fs_d++;
          generated_faces++;
        }
        loop_counter++;
      }
      d_j += d_inc;
    }
    //num2 = generated_vertices << 1;
    //mesh.data->faces.reset_used(num2);
    //mesh.data->vertices.reset_used(num2);
    //mesh.data->vertex_normals.reset_used(num2);
    //mesh.data->vertex_tex_coords.reset_used(num2);

    //printf("timer: %f\n", t_acc );

}
Exemplo n.º 17
0
void vsxu_assistant::i_draw() {
  if (auto_) {
    reload = false;

    if (help_timestamp != timestamp) {
      timestamp = help_timestamp;
      reload = true;
    }
    if (a_focus != this)
    if (a_focus->widget_type != VSX_WIDGET_TYPE_2D_MENU_POPUP)
    if (a_focus != inspected)
    reload = true;
    //else reload = false;
    if (reload)
    {
//    printf("auto buuuu\n");
      inspected = a_focus;
      if (course.size())
      course.clear();
      std::vector<vsx_string> parts;
      vsx_string deli = "|||";
      if (inspected->help_text != "") {
        explode(inspected->help_text,deli,parts);
        for (unsigned int i = 0; i < parts.size(); ++i) {
          course.push_back(parts[i]);
        }
      } //else {
        //course.push_back("");
      //}
      ((vsx_widget_2d_pager*)pager)->max_pages = course.size();
      ((vsx_widget_2d_pager*)pager)->cur_page = 0;
    }
  }

	tt = dtime*10.0f*global_interpolation_speed;
  if (tt > 1) tt = 1;
	clickpoint.x = clickpoint.x*(1-tt)+size_multiplier*tt;

  size.x = 0.3*clickpoint.x*(screen_aspect);
  size.y = 0.5*clickpoint.x;
  //printf("pos.x: %f\n",pos.x);
  //size.y-0.09f*clickpoint.x;
  alpha = (clickpoint.x-0.2)*2;
  set_pos(vsx_vector((screen_aspect-size.x),-0.03));

  pager->set_pos(vsx_vector(0.065f*clickpoint.x,clickpoint.x*0.14f));
  pager->set_size(vsx_vector(0.1f*clickpoint.x,0.03f*clickpoint.x));
  //pager->size.x = 0.1*clickpoint.x;
  //pager->size.y = 0.030*clickpoint.x;

//  float screen_aspect = 1.0f/this->screen_aspect;
  texture.bind();
  glColor3f(1,1,1);
  draw_box_tex(pos, size.x, size.y);
 	/*
   glColor4f(0.9,0.9,1,1);
 	glBegin(GL_QUADS);
     	glTexCoord2f(0, 0);
  			glVertex3f(pos.x, pos.y-size.y, 0);
     	glTexCoord2f(0, 1);
  			glVertex3f(pos.x, pos.y, 0);
     	glTexCoord2f(1, 1);
  			glVertex3f((pos.x+size.x), pos.y, 0);
     	glTexCoord2f(1, 0);
   			glVertex3f((pos.x+size.x), pos.y-size.y, 0);
	glEnd();*/
	texture._bind();
  if (alpha > 0.01) {
    if (course.size()) {
      text = course[((vsx_widget_2d_pager*)pager)->cur_page];
      //else text = "";
      myf.color.a = alpha;
      myf.print(vsx_vector((pos.x+size.x*0.06)*screen_aspect,pos.y+size.y-size.y*0.12),text,0.012*clickpoint.x);
    }
  }
  target_pos = pos;
  target_size = size;
}
Exemplo n.º 18
0
bool vsx_widget_desktop::key_down(signed long key, bool n_alt, bool n_ctrl, bool n_shift) {
	this->alt = n_alt;
	this->ctrl = n_ctrl;
	this->shift = n_shift;
	char test[2]; test[0] = (char)key; test[1] = 0;
	//printf("key as char: %s\n", test);
	//printf("got key: %d\n", key);
  if (k_focus) {
    if (k_focus->event_key_down(key,alt,ctrl,shift)) {
      if (ctrl) {
#ifdef _WIN32
        switch (tolower(abs(key))) {
#else
        switch (tolower(key)) {
#endif
          case ' ':
            ((vsx_window_texture_viewer*)tv)->run = !((vsx_window_texture_viewer*)tv)->run;
            break;
          // fullwindow
          case 'F':
          case 'f': // F
          	//printf("going fullwindow\n");
            ((vsx_window_texture_viewer*)tv)->fullwindow = !((vsx_window_texture_viewer*)tv)->fullwindow;
            if (((vsx_window_texture_viewer*)tv)->fullwindow) mouse.hide_cursor(); else mouse.show_cursor();
            if (!((vsx_window_texture_viewer*)tv)->fullwindow) this->performance_mode = false;
            //if (alt) this->performance_mode = !this->performance_mode;
          break;
          // close all controllers
          case 'c':
            delete_all_by_type(VSX_WIDGET_TYPE_CONTROLLER);
          break;
          // close all open anchors
          case 'd':
            for (std::map<int, vsx_widget*>::iterator it = ilist.begin();  it != ilist.end(); ++it) {
              if ((*it).second->widget_type == VSX_WIDGET_TYPE_ANCHOR) {
              	if ((*it).second->parent)
                if ((*it).second->parent->widget_type == VSX_WIDGET_TYPE_COMPONENT) {
                  ((vsx_widget_anchor*)(*it).second)->toggle(1);
                }
              }
            }
          break;
        }
      }

      if (alt)
      {
#ifdef _WIN32
        switch (tolower(abs(key))) {
#else
        switch (tolower(key)) {
#endif
          case 'F':
          case 'f': // F
          	if (((vsx_window_texture_viewer*)tv)->fullwindow)
          	{
          		mouse.show_cursor();
          		this->performance_mode = !this->performance_mode;
          	}

          default:
          	break;
        }
      }

      if (!ctrl && !alt)
#ifdef _WIN32
      switch (tolower(abs(key))) {
#else
      switch (abs(key)) {
#endif
      case 0x08:
        case ' ': {
          //if (a_focus->type >= 100)
          {
            if (a_focus->widget_type != VSX_WIDGET_TYPE_SERVER) {
              vsx_vector a = a_focus->get_pos_p();
              move_camera(vsx_vector(a.x,a.y,2.0f));
            } else move_camera(vsx_vector(xp,yp,2.0f));
            /*zp = 2;
            xp = a.x;
            yp = a.y;
            xps = 0;
            yps = 0;
            zps = 0;*/
          }
        }
        break;
        case 'E': case 'e':{ interpolating = false;ypd=1.0;} break;
        case 'D': case 'd':{ interpolating = false;ypd=-1.0;} break;
        case 's': case 'S':{ interpolating = false;xpd=-1.0;} break;
        case 'F': case 'f':{ interpolating = false;xpd=1.0;} break;
        case 'R': case 'r':{ interpolating = false;zpd=-1.0;} break;
        case 'W': case 'w':{ interpolating = false;zpd=1.0;} break;
      } // switch
    } else {
      return true;
    }
  } else return true;
  return false;
}


bool vsx_widget_desktop::key_up(signed long key, bool alt, bool ctrl, bool shift) {
  this->ctrl = ctrl;
  if (k_focus) {
    if (k_focus->event_key_up(key,alt,ctrl,shift)) {
      //if (!ctrl)
      switch (key) {
        case 'E': case 'e': ypd=0.0; break;
        case 'D': case 'd': ypd=0.0; break;
        case 'S': case 's': xpd=0.0; break;
        case 'F': case 'f': xpd=0.0; break;
        case 'R': case 'r': zpd=0.0; break;
        case 'W': case 'w': zpd=0.0; break;
#ifndef VSXU_PLAYER
#ifndef _WIN32
        case GLFW_KEY_TAB:
#else
        case 0x09:
#endif
        {
          ((vsxu_assistant*)assistant)->toggle_size();
        } break;
#endif
        //case 'c': tcp_main_client.connect(578); break;
      }
    } else {
      return false;
    }
  } else return true;
  return false;
}

void vsx_widget_desktop::event_mouse_wheel(float y) {

	//if (y > 0)
	zps += -y;

	if (zps > 2.0f) zps = 2.0f;
	if (zps < -2.0f) zps = -2.0f;
	//else
	//zps += ;
}

void vsx_widget_desktop::move_camera(vsx_vector world) {
  camera_target = world;
  interpolating = true;
}
Exemplo n.º 19
0
  void run() {
    vsx_mesh* p = mesh_in->get_addr();
    if (!p)
    {
      mesh_empty.timestamp = (int)(engine->real_vtime*1000.0f);
      mesh_out->set_p(mesh_empty);
      prev_timestamp = 0xFFFFFFFF;
      return;
    }

    debug = false;
    bool newMeshLoaded = false;


    //after a mesh change clone the mesh
    if (p && (prev_timestamp != p->timestamp)) {
      prev_timestamp = p->timestamp;
      mesh.data->vertices.reset_used(0);
      mesh.data->vertex_normals.reset_used(0);
      mesh.data->vertex_tex_coords.reset_used(0);
      mesh.data->vertex_colors.reset_used(0);
      mesh.data->faces.reset_used(0);

      for (unsigned int i = 0; i < p->data->vertices.size(); i++)
      {
        mesh.data->vertices[i] = p->data->vertices[i] + v;
        verticesSpeed[i] = vsx_vector(0, 0, 0);
      }

      for (unsigned int i = 0; i < p->data->vertex_normals.size(); i++) mesh.data->vertex_normals[i] = p->data->vertex_normals[i];
      for (unsigned int i = 0; i < p->data->vertex_tangents.size(); i++) mesh.data->vertex_tangents[i] = p->data->vertex_tangents[i];
      for (unsigned int i = 0; i < p->data->vertex_tex_coords.size(); i++) mesh.data->vertex_tex_coords[i] = p->data->vertex_tex_coords[i];
      for (unsigned int i = 0; i < p->data->vertex_colors.size(); i++) mesh.data->vertex_colors[i] = p->data->vertex_colors[i];
      for (unsigned int i = 0; i < p->data->faces.size(); i++) mesh.data->faces[i] = p->data->faces[i];

      //calc and store original face lengths
      faceLengths.reset_used();
      vsx_vector normal;
      vsx_vector len;
      vsx_vector hypVec;
      for (unsigned int i = 0; i < p->data->faces.size(); i++) {
        vsx_face& f = mesh.data->faces[i];
        vsx_vector& v0 = mesh.data->vertices[f.a];
        vsx_vector& v1 = mesh.data->vertices[f.b];
        vsx_vector& v2 = mesh.data->vertices[f.c];
        //calc face area
        normal.assign_face_normal(&v0, &v1, &v2);
        float area = normal.length() / 2.0f;
        faceAreas[i] = area;
        //facelengths a, b, c stored in vector x, y, z
        len.x = (v1 - v0).length();
        len.y = (v2 - v1).length();
        len.z = (v0 - v2).length();
        faceLengths.push_back(len);
      }
      mesh.timestamp++;
      param_updates = 0;

      newMeshLoaded = true;
      dtimeRest = 0.0f;
    }

    float stepSize = step_size->get();
    //float stepsPerSecond = steps_per_second->get();
    float gasExpansionFactor = gas_expansion_factor->get();
    float gridStiffnessFactor = grid_stiffness_factor->get();
    float dampingFactor =  damping_factor->get();
    float materialWeight = material_weight->get();
    float lowerBoundary = lower_boundary->get();

    //use engine->dtime; and dtimeRest
    //to repeat the calculation several times ((dtime + rest) * stepsPerSecond)



    //calculate volume
    float volume = 0.0f;
    vsx_face* face_p = mesh.data->faces.get_pointer();
    vsx_vector* vertex_p = mesh.data->vertices.get_pointer();
    vsx_vector* faces_length_p = faceLengths.get_pointer();

    verticesSpeed.allocate(mesh.data->vertices.size());
    vsx_vector* vertices_speed_p = verticesSpeed.get_pointer();

    float onedivsix = (1.0f / 6.0f);
    for(unsigned int i = 0; i < mesh.data->faces.size(); i++) {
      vsx_face& f = face_p[i];//mesh.data->faces[i];
      vsx_vector& v0 = vertex_p[f.a];
      vsx_vector& v2 = vertex_p[f.b];
      vsx_vector& v1 = vertex_p[f.c];

      volume += (v0.x * (v1.y - v2.y) +
           v1.x * (v2.y - v0.y) +
           v2.x * (v0.y - v1.y)) * (v0.z + v1.z + v2.z) * onedivsix;

    }

    //default gas_amount to volume of a new mesh i.e. no pressure
    if(newMeshLoaded) {
      gas_amount->set(volume);
    }
    float pressure = (gas_amount->get() - volume) / volume;

    //mesh.data->face_normals.reset_used(0);
    //mesh.data->vertex_normals.reset_used(0);


    //calculate face areas, normals, forces and add to speed
    for(unsigned int i = 0; i < mesh.data->faces.size(); i++) {
      vsx_face& f = face_p[i];//mesh.data->faces[i];
      vsx_vector& v0 = vertex_p[f.a];//mesh.data->vertices[f.a];
      vsx_vector& v1 = vertex_p[f.b];//mesh.data->vertices[f.b];
      vsx_vector& v2 = vertex_p[f.c];//mesh.data->vertices[f.c];

              printVector("v0", i, v0);
              printVector("v1", i, v1);
              printVector("v2", i, v2);

      //vsx_vector normal = mesh.data->get_face_normal(i);
      vsx_vector a = vertex_p[face_p[i].b] - vertex_p[face_p[i].a];
      vsx_vector b = vertex_p[face_p[i].c] - vertex_p[face_p[i].a];
      vsx_vector normal;
      normal.cross(a,b);



              printVector("normal", i, normal);

      //float len = normal.length();
      //float area = len / 2;

              printFloat("length", i, len);
              printFloat("area", i, len);

      vsx_vector edgeA = (v1 - v0);
      vsx_vector edgeB = (v2 - v1);
      vsx_vector edgeC = (v0 - v2);

              printVector("edgeA", i, edgeA);
              printVector("edgeB", i, edgeB);
              printVector("edgeC", i, edgeC);

      float lenA = edgeA.length();
      float lenB = edgeB.length();
      float lenC = edgeC.length();

              printFloat("lenA", i, lenA);
              printFloat("lenB", i, lenB);
              printFloat("lenC", i, lenC);


      float edgeForceA = (faces_length_p[i].x - lenA) / faces_length_p[i].x;
      float edgeForceB = (faces_length_p[i].y - lenB) / faces_length_p[i].y;
      float edgeForceC = (faces_length_p[i].z - lenC) / faces_length_p[i].z;

              printFloat("edgeForceA", i, edgeForceA);
              printFloat("edgeForceB", i, edgeForceB);
              printFloat("edgeForceC", i, edgeForceC);

      float edgeAccA = edgeForceA / lenA;
      float edgeAccB = edgeForceB / lenB;
      float edgeAccC = edgeForceC / lenC;

              printFloat("edgeAccA", i, edgeAccA);
              printFloat("edgeAccB", i, edgeAccB);
              printFloat("edgeAccC", i, edgeAccC);

      vsx_vector accA = edgeA * edgeAccA;
      vsx_vector accB = edgeB * edgeAccB;
      vsx_vector accC = edgeC * edgeAccC;

              printVector("accA", i, accA);
              printVector("accB", i, accB);
              printVector("accC", i, accC);

      vertices_speed_p[f.a] -= (accA - accC) * gridStiffnessFactor;
      vertices_speed_p[f.b] -= (accB - accA) * gridStiffnessFactor;
      vertices_speed_p[f.c] -= (accC - accB) * gridStiffnessFactor;

      //applying pressure to areas of faces
      vsx_vector pressureAcc = normal * pressure * gasExpansionFactor;
      vertices_speed_p[f.a] -= pressureAcc;
      vertices_speed_p[f.b] -= pressureAcc;
      vertices_speed_p[f.c] -= pressureAcc;

      //apply material weight
      float gravityAcc = materialWeight;
      vertices_speed_p[f.a].y -= gravityAcc;
      vertices_speed_p[f.b].y -= gravityAcc;
      vertices_speed_p[f.c].y -= gravityAcc;

    }

    //apply speeds to vertices
    for(unsigned int i = 0; i < mesh.data->vertices.size(); i++) {
      vertex_p[i] += vertices_speed_p[i] * stepSize;
      if(vertex_p[i].y < lowerBoundary) {
        vertex_p[i].y = lowerBoundary;
      }
      vertices_speed_p[i] = vertices_speed_p[i] * dampingFactor;
    }


    mesh.data->vertex_normals.allocate(mesh.data->vertices.size());
    mesh.data->vertex_normals.memory_clear();
    vsx_vector* vertex_normals_p = mesh.data->vertex_normals.get_pointer();
    /*for(unsigned int i = 0; i < mesh.data->vertices.size(); i++) {
      mesh.data->vertex_normals[i] = vsx_vector(0, 0, 0);
    }*/

    //TODO: create vertex normals, for rendering... should be a separate module...
    for(unsigned int i = 0; i < mesh.data->faces.size(); i++) {
      vsx_vector a = vertex_p[face_p[i].b] - vertex_p[face_p[i].a];
      vsx_vector b = vertex_p[face_p[i].c] - vertex_p[face_p[i].a];
      vsx_vector normal;
      normal.cross(a,b);

      //vsx_vector normal = mesh.data->get_face_normal(i);
      normal = -normal;
      normal.normalize();
      vertex_normals_p[face_p[i].a] += normal;
      vertex_normals_p[face_p[i].b] += normal;
      vertex_normals_p[face_p[i].c] += normal;
    }

    volume_out->set(volume);

    //printf("***************Pressure %f     ", pressure);
    //printf(" Volume %f\n", volume);

    mesh_out->set_p(mesh);
  }
Exemplo n.º 20
0
bool vsx_widget_desktop::key_down(signed long key, bool n_alt, bool n_ctrl, bool n_shift)
{
  this->alt = n_alt;
	this->ctrl = n_ctrl;
	this->shift = n_shift;

  if (k_focus) {
    if (k_focus->event_key_down(key,alt,ctrl,shift))
    {
      if (ctrl)
      {
        #ifdef VSXU_DEBUG
          printf("desktop key: %d\n",key);
          printf("f:  %d",'f');
          printf("F:  %d",'F');
          printf("res: %d", tolower(abs(key)));
        #endif
        switch (key)
        {
          case -GLFW_KEY_SPACE:
            ((vsx_window_texture_viewer*)tv)->run = !((vsx_window_texture_viewer*)tv)->run;
            break;
          // fullwindow
          case -'F':
          case -'f': // F
          	//printf("going fullwindow\n");
            ((vsx_window_texture_viewer*)tv)->fullwindow = !((vsx_window_texture_viewer*)tv)->fullwindow;
            if (((vsx_window_texture_viewer*)tv)->fullwindow) mouse.hide_cursor(); else mouse.show_cursor();
            if (!((vsx_window_texture_viewer*)tv)->fullwindow) this->performance_mode = false;
            //if (alt) this->performance_mode = !this->performance_mode;
          break;
          // close all controllers
          case -'C':
          case -'c':
            delete_all_by_type(VSX_WIDGET_TYPE_CONTROLLER);
          break;
          // close all open anchors
          case -'D':
          case -'d':
            for (std::map<int, vsx_widget*>::iterator it = ilist.begin();  it != ilist.end(); ++it) {
              if ((*it).second->widget_type == VSX_WIDGET_TYPE_ANCHOR) {
              	if ((*it).second->parent)
                if ((*it).second->parent->widget_type == VSX_WIDGET_TYPE_COMPONENT) {
                  ((vsx_widget_anchor*)(*it).second)->toggle(1);
                }
              }
            }
          break;
        }
      }

      if (alt)
      {
        switch (key)
        {
          case -'F':
          case -'f': // F
          	if (((vsx_window_texture_viewer*)tv)->fullwindow)
          	{
          		mouse.show_cursor();
          		this->performance_mode = !this->performance_mode;
          	}

          default:
          	break;
        }
      }

      if (!ctrl && !alt)
      switch (key)
      {
        case -GLFW_KEY_SPACE:
        {
          {
            if (a_focus->widget_type != VSX_WIDGET_TYPE_SERVER) {
              vsx_vector a = a_focus->get_pos_p();
              move_camera(vsx_vector(a.x,a.y,2.0f));
            } else move_camera(vsx_vector(xp,yp,2.0f));
          }
        }
        break;
        case -GLFW_KEY_UP: case -'E': case -'e':{ interpolating = false;ypd=1.0;} break;
        case -GLFW_KEY_DOWN: case -'D': case -'d':{ interpolating = false;ypd=-1.0;} break;
        case -GLFW_KEY_LEFT: case -'s': case -'S':{ interpolating = false;xpd=-1.0;} break;
        case -GLFW_KEY_RIGHT: case -'F': case -'f':{ interpolating = false;xpd=1.0;} break;
        case -GLFW_KEY_PAGEUP: case -'R': case -'r':{ interpolating = false;zpd=-1.0;} break;
        case -GLFW_KEY_PAGEDOWN: case -'W': case -'w':{ interpolating = false;zpd=1.0;} break;
      } // switch
    } else {
      return true;
    }
  } else return true;
  return false;
}