Exemple #1
0
void GeoSettings::Apply(){
   if (mol.IsReady()) {
     if (mode==BALL_N_STICKS) {
       mol.SetBallAndSticks(stickRadius);
     }
     if (mode==LICORICE) {
       mol.SetLicorice(licoRadius);
     }
     if (mode==SPACE_FILL) mol.SetSpaceFill();
   }
   
   cgSettings.setGeoSettings(*this);
   cgSettings.UpdateShaders();
   
   UpdateShadowmap();
   
   mol.ResetAO();
}
Exemple #2
0
void TestGLCanvas::OnPaint( wxPaintEvent& event )
{


    /* must always be here */
    wxPaintDC dc(this);

#ifndef __WXMOTIF__
    if (!GetContext()) return;
#endif

    SetCurrent();

    if (!initdone) {
      static bool once=false;
      if (!once) {
        once=true; 
        int errcode=initGl();
        if (errcode!=ERRGL_OK){
          wxMessageBox(errorMSG(errcode), _T("Unrecoverable error: Problems initializing graphics"), wxOK | wxICON_EXCLAMATION, this);
          exit(0);
          }
        else initdone=true;
      }
    }
    
    if (!initdone) wxGLCanvas::OnPaint(event); else
    if (mol.IsReady()) { 
      if (mustDoHQ) {
        drawFrame( hardSettings.STILL_QUALITY );  
        shownHQ=true;
        mustDoHQ=false;
      } else {
        drawFrame( hardSettings.MOVING_QUALITY );  
        shownHQ=false;
      }
      SwapBuffers();  
    }  
    else {
      clearFrame();
      SwapBuffers();  
    }   
}
Exemple #3
0
void TestGLCanvas::OnKeyDown( wxKeyEvent& event ){
  wxConsumeTrackBallEvent(event,true,track);
#ifdef __DARWIN__
	wxString path = wxStandardPaths::Get().GetResourcesDir() + "/presets/new.preset";
#else
	wxString path =  "presets\\new.preset";
#endif
  if (event.GetKeyCode() == WXK_F7 ) {
    cgSettings.Save(path.c_str());
  }

  if (event.GetKeyCode() == WXK_F6 ) {
    if (cgSettings.Load(path.c_str())) {
      MyTab::UpdateAll();
      
      cgSettings.ResetHalo();
      cgSettings.UpdateShaders();
      SceneChanged();
    }

  }

  if (event.GetKeyCode() == WXK_F5 ) {
    mol.PrepareAOSingleView();
    SceneChanged();
  }

  if (event.GetKeyCode() == WXK_F2 ) {
    static int status=0;
    status=(status+1) % 5;
    draw_balls = (status==0) || (status==1)  || (status==2) ; 
    draw_sticks = (status==0) || (status==1) || (status==3) || (status==4) ; 
    draw_wireframe_balls= (status==1)  ;
    draw_wireframe_sticks= (status==1)  || (status==3) ;
    
    SceneChanged();
  }
  
  if (event.GetKeyCode() == WXK_F1 ) {
    wxString text; 
    if (!mol.IsReady() ) text=wxT("(no molecule)");
    else {

      text=wxString( mol.GetMolName(), wxConvUTF8 ).BeforeLast('.') + 
           wxT("\n (file: \"")+wxString( mol.filename, wxConvUTF8 ) +wxT("\")\n\n");
      
      text=text+wxString::Format(wxT("%d atoms\n"),mol.atom.size());
      
      if (mol.sticks) {
        text=text+wxString::Format(wxT("%d bonds\n"),mol.bond.size());
      }
      
           
      text=text+wxString::Format(
        _T("\nUsing:\n Texture size = %dx%d\n Patch size=%dx%d"), 
        moltextureCanvas.GetHardRes(),
        moltextureCanvas.GetHardRes(),
        CSIZE,CSIZE
      );

      
    }       
    wxMessageBox(text, _T("QuteMol - file info"), wxOK | wxICON_INFORMATION, this);
  }

  if (event.GetKeyCode() == WXK_F6 ) {
    use_accurate_halo=!use_accurate_halo;
    SceneChanged();
  }
  
  // temp, should e set auto depending on dist
  if (event.GetKeyCode() == WXK_F2 ) {

    cgSettings.P_capping=!cgSettings.P_capping;
    cgSettings.UpdateShaders();
    SceneChanged();
  }
}