UnityMol  0.9.6-875
UnityMol viewer / In developement
Molecule3D.cs
Go to the documentation of this file.
1 
66 using UnityEngine;
67 using System.Collections;
68 using System.Xml;
69 using System.Text;
70 using System;
71 using ParseData.ParsePDB;
72 using UI;
73 using Molecule.View;
74 using System.Net;
75 
77 using Cmd;
78 using Molecule.Model;
79 using Molecule.Control;
80 using System.IO;
81 
82 public class Molecule3D:MonoBehaviour {
83 
84  private bool fontInitialized = false;
85 
86  private static GameObject LocCamera;
87  private Skybox camSky;
90  private Boolean isControl=false;
91  public IPEndPoint _ipep;
92  public ArrayList clubLocationalist=new ArrayList();
93  public float sensitivityX = 1.5F;
94  public float sensitivityY = 1.5F;
95  public float minimumX = -360F;
96  public float maximumX = 360F;
97  public float minimumY = -60F;
98  public float maximumY = 60F;
99  private float rotationXX = 0F;
100  private float rotationYY = 0F;
101  public string location;
102  public Vector2 directoryScroll= new Vector2();
103  public Vector2 fileScroll= new Vector2();
104  private GameObject toggleNewUI;
105 
106  public GUISkin mySkin;
107 
108  // video with Benoit
109  public int polop = 0;
110  public int masque = 0;
111 
112  private GameObject scenecontroller;
113 
114  //T.T DEBUG
115  public bool fileLoadingFinished=false;
116 
117  // Stores the default FOV angle.
118  private float default_fov_angle;
119  private float default_fov_angle_rad;
120 
121  // Stores the default near plane distance.
123 
125 
126  // User configurable field of view angle in radians.
127  private float angle_rad;
128 
129  private Camera camera;
130 
131 // private string FPS="";
132 
133  //To keep track of the normal type when hiding atoms or in LOD mode
136  get {
137  return previous_AtomType;
138  }
139  }
140 
143  get {
144  return previous_BondType;
145  }
146  }
147 
148  public void OnDisable()
149  {
150  clearScene();
151  }
152 
156  public static void clearScene()
157  {
158  GUIDisplay.id="";
159 
161 
162  UnityMolMain.getVRPNManager().clearTools();
163 
164  // ----- Clearing all variables -----
165  UIData.isCubeLoaded = false;
166  UIData.isSphereLoaded = false;
167  UIData.isHBallLoaded = false;
168 
171  SugarOldGUI.toggle_OXYGEN = false;
172 
173  LoadTypeGUI.toggle_NA_HIDE = false;
176 
177  UIData.loadHireRNA = false;
178 
179  // FOLLOWING COMMENTS FOR HISTORIC REFERENCE. CAN BE CLEANED IN THE FUTURE (MVB)
180  // ON STOPPING WE PRVIOUSLY GOT THE FOLLOWING ERROR:
181  // go.IsActive() && go.GetTag() != 0
182  // UnityEngine.Camera:get_main()
183  // Molecule3D:clearScene() (at Assets/Scripts/Molecule3D.cs:161)
184  // Molecule3D:OnDisable() (at Assets/Scripts/Molecule3D.cs:136)
185  //
186  // it can be avoided as follows (but is not severe):
187  // It occurs because the method checks for Camera.main, but after stopping
188  // the scene, Camera.main no longer exits and even checking to see if exists
189  // causes an error.
190  // If you really, really want to get rid of it, you can do this:
191  // 1) Add a variable like this: private Camera myCamera;
192  // 2) In Start(), initialize the variable, like this: myCamera = Camera.main;
193  // 3) In this function replace any use of "Camera.main" with "myCamera". Make sure
194  // the first part of the method is something like this:
195  // if (myCamera == null)
196  // return;
197  // We actually have such a variable already: LocCamera. So replace the following
198  // code Camera.main by LocCamera
199  // if (Camera.main) {
200  // MeasureDistance mds = Camera.main.GetComponent<MeasureDistance> ();
201  // if (mds && mds.enabled) {
202  // mds.enabled = false;
203  // }
204  // }
205  if (LocCamera) {
206  MeasureDistance mds = LocCamera.GetComponent<MeasureDistance> ();
207  if (mds && mds.enabled) {
208  mds.enabled = false;
209  }
210  }
211 
216  UIData.secondarystruct = false;
217 
218  // UIData.atomtype = UIData.AtomType.noatom;
219  // UIData.bondtype = UIData.BondType.nobond;
220  MoleculeModel.existingName.Clear();
221  MoleculeModel.existingRes.Clear();
223 
224  MoleculeModel.residueIds.Clear();
225  MoleculeModel.residues.Clear();
226 
228  RequestPDB.isDone=false;
229 
230 
231  SurfaceManager.pdbGen = false;
232  UIData.hasMoleculeDisplay = false;
233  GUIMoleculeController.toggle_NA_INTERACTIVE = false; // causes all sorts of headaches otherwise
234  LocCamera.GetComponent<ClickAtom>().ClearSelection(); // so the halos don't stay after clearing
235 
237 
239 
240 
241  UIData.isMoleculeDisplayed = false;
242  UIData.isFileLoaded = false;
243 
244  // Delete all the Parents to start again on a clear ground
245  // GameObject.Destroy(Molecule.View.DisplayAtom.AtomCubeStyle.AtomCubeParent);
246  // GameObject.Destroy(Molecule.View.DisplayAtom.AtomSphereStyle.AtomSphereParent);
247  // GameObject.Destroy(Molecule.View.DisplayAtom.AtomMeshStyle.AtomMeshParent);
248 
249 
250  DepthCueing.reset = true;
251  AmbientOcclusion.reset = true;
252 
253  UIData.loadHireRNA = false;
254  }
255 
256  void Awake() {
257  System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
258 
259  LocCamera=Camera.main.gameObject;
260 
261  camera = LocCamera.GetComponent<Camera>();
262 
263  default_fov_angle = camera.fieldOfView;
264  default_near_clip_plane = camera.nearClipPlane;
265 
266  default_fov_angle_rad = default_fov_angle * Mathf.Deg2Rad;
267  default_near_plane_length = default_near_clip_plane * Mathf.Tan(default_fov_angle_rad / 2f);
268  }
269 
270  void Start() {
271  requestPDB = gameObject.AddComponent<RequestPDB>();
273  GameObject hbmeshManagerObj = GameObject.FindGameObjectWithTag("HBallMeshManager");
274  UnityMolMain.setCurrentAtomManager(hbmeshManagerObj.GetComponent<HBallMeshManager>());
275  GameObject hStickMeshManagerObj = GameObject.FindGameObjectWithTag("HStickMeshManager");
276  UnityMolMain.setCurrentBondManager(hStickMeshManagerObj.GetComponent<HStickMeshManager>());
277 
278  LocCamera=Camera.main.gameObject;
279  gUIDisplay = new GUIDisplay();
280  camSky = LocCamera.GetComponent<Skybox>();
281 
282  toggleNewUI = GameObject.Find("New UI Toggle Canvas");
283 
284  scenecontroller = GameObject.Find("LoadBox");
285 
286  gUIDisplay=new GUIDisplay();
287 
290  }
291 
292  public void Display() {
293 
294  Debug.Log("Displaying atoms !!! "+UIData.atomtype+" / "+UIData.bondtype);
296  }
297 
298  void OnGUI() {
299  GUI.skin = mySkin;
300 
301  if(!fontInitialized) {
303  fontInitialized = true;
304  }
305 
308 
309  if (gUIDisplay == null)
310  {
311  gUIDisplay = new GUIDisplay();
312  }
313 
314  if(gUIDisplay.m_fileBrowser != null) {
316  gUIDisplay.m_fileBrowser.OnGUI();
317  } else
319 
320  UIData.EnableUpdate=false;
322  gUIDisplay.Display();
323  }
324 
327  }
328 
329  if(!UIData.hiddenUI)
332 
333  if(!UIData.hiddenUI)
336 
337  if(!UIData.hiddenUI)
340 
341  if(!UIData.hiddenUI)
344 
345  if(UIData.changeStructure) {
346 
348 
349  UIData.changeStructure = false;
351  }
352 
354 
357  /*
358  ControlMolecule.CreateSplines();
359  ControlMolecule.CreateResiduesSugar2();*/
360 
361  if(UIData.loadHireRNA)
362  {
364  }
365 
366  if(GUIDisplay.pdbID == "3EI0")
367  UIData.isGLIC = true;
368 
369  UIData.isParticlesInitialized = false ; // new file, new particle system needed
370  MoleculeModel.networkLoaded = false ; // protein loaded, network removed if present
371 
372  Display();
375  // Deta=MoleculeModel.target;
376  isControl=true;
377 
379  SetCenter(0);
382  }
383 
384  if(UIData.isOpenFile) {
385  loadFile();
386  }
387 
388 
389 
390  camSky.enabled=UIData.backGroundIs;
391 
392  UIData.EnableUpdate=true;
393 
396  UIData.resetInteractive=false;
397  }
400  UIData.resetInteractive = false;
401  }
402 
403 
404  if(GUI.tooltip != "")GUI.Box ( new Rect(180,Screen.height-55,450,25), GUI.tooltip);
405  if(MoleculeModel.newtooltip != "")GUI.Box ( new Rect(180,Screen.height-55,450,25), MoleculeModel.newtooltip);
406  }
407 
408 
409  // loading the file in all possibilities
410  public void loadFile() {
411 
412  UIData.isMoleculeDisplayed = false;
413  UIData.isOpenFile = false;
414  UIData.isFileLoaded = false;
415 
416  #if !UNITY_WEBPLAYER
417  // check all format reading by unitymol PDB, XGMML and OBJ
418  if(UIData.fetchPDBFile) {
419  Debug.Log("pdbServer/pdbID :: "+GUIDisplay.pdbServer + GUIDisplay.pdbID);
420  Debug.Log("proxyServer+proxyPort :: "+GUIDisplay.proxyServer + GUIDisplay.proxyPort);
421  int proxyport = 0;
422  if(GUIDisplay.proxyPort != "")
423  proxyport = int.Parse(GUIDisplay.proxyPort);
424  else
425  proxyport = 0;
426 
427  // Debug.Log("RequestPDB = null ??????????????????????? "+(requestPDB==null));
428  // requestPDB.FetchPDB(GUIDisplay.pdbServer, GUIDisplay.pdbID, GUIDisplay.proxyServer, proxyport);
429  ParsePDB.FetchPDB2(GUIDisplay.pdbServer, GUIDisplay.pdbID,GUIDisplay.proxyServer, proxyport);
430  }
431  // if we laod a pdb file launch the reading of file
432  else if(GUIDisplay.file_extension=="pdb")
433  {
434  // requestPDB.LoadPDBRequest(GUIDisplay.file_base_name);
435  ParsePDB.LoadPDBRequest2(GUIDisplay.file_base_name);
436  }
437 
438  //Aurélien : reading a reaction file
439  else if(GUIDisplay.file_extension=="reaction")
440  {
442  }
443 
444  //Aurélien : reading a top animation file
445  else if(GUIDisplay.file_extension=="animtop")
446  {
448  }
449 
450  //Aurélien : reading a top animation file
451  else if(GUIDisplay.file_extension=="animcrd")
452  {
454  }
455 
456  // check the format of xgmml
457  else if(UI.GUIDisplay.file_extension=="xgmml") {
458  requestPDB.LoadXGMML("file://"+GUIDisplay.file_base_name+"."+GUIDisplay.file_extension);
459  // while(!RequestPDB.isDone) {
460  // Debug.Log(requestPDB.progress);
461  // yield return new WaitForEndOfFrame();
462  // }
463  UIData.atomtype=UIData.AtomType.hyperball;
464  UIData.bondtype=UIData.BondType.hyperstick;
466  RepresentationOldGUI.shrink = 0.0001f;
468  SendMessage("Display",SendMessageOptions.DontRequireReceiver);
469  }
470  else if(UI.GUIDisplay.file_extension=="obj") {
471  ParsePDB.LoadOBJRequest(GUIDisplay.file_base_name+"."+GUIDisplay.file_extension);
473  }
474  // requestPDB.GetTypelist();
475 
476  //if the application is an wep player or a mobile application
477  #else
478 
479 
480  // socketPDB=new SocketPDB(id);
481  // socketPDB.getAtoms();
482  // // socketPDB.getTypes();
483  // clubLocationalist=socketPDB.getClubLocation();
484  // clubRotationList=socketPDB.getClubRotation();
485 
486  if(UIData.init_molecule != "")
487  ParsePDB.LoadPDBResource2(UIData.init_molecule);
488 
489  #endif
490  //Debug.Log("SDGFSDGSDGDSG");
492  UIData.hasMoleculeDisplay = true;
493  Debug.Log("T.T ==> END OF LOADING");
494  }
495 
496 
497  // Update is called once per frame
498  void Update() {
499 
503 
504 
505 
506  //Aurélien : update of every atom's coordinate to the next animation step, rendering mode is set to hyperball-hyperstick with 0.2 radius
508  if(!Reaction.affichage)
509  {
510 
512 
513  //Setting radius at 0.2
515 
516  //Destroying previous particle effects (particlein 1 in particle manager)
517  GameObject.Find("ParticleManager").SendMessage("killCurrentEffects",SendMessageOptions.DontRequireReceiver);
518 
519  Reaction.affichage = true;
520  }
521  int j;
522  if(Reaction.forward){
523  ArrayList xyz = (ArrayList)Reaction.coord[Reaction.current];
524  for(int i=0;i<Reaction.acount;i++){
525  j = ((MoleculeModel.atoms[i] as GameObject).GetComponent("AtomIndex") as AtomIndex).index;
526  (MoleculeModel.atoms[i] as GameObject).transform.position = new Vector3((xyz[j] as float[])[0], (xyz[j] as float[])[1], (xyz[j] as float[])[2]);
527  }
528  }
529  else{
530  ArrayList xyz = (ArrayList)Reaction.coord[Reaction.count - Reaction.current - 1];
531  for(int i=0;i<Reaction.acount;i++){
532  j = ((MoleculeModel.atoms[i] as GameObject).GetComponent("AtomIndex") as AtomIndex).index;
533  (MoleculeModel.atoms[i] as GameObject).transform.position = new Vector3((xyz[j] as float[])[0], (xyz[j] as float[])[1], (xyz[j] as float[])[2]);
534  }
535  }
536 
537  // Copied from DisplayMolecule.GetManagers.
538  // Does not work otherwise. Why?
539  if (UIData.bondtype == UIData.BondType.line) {
540  GameObject lineManagerObj = GameObject.FindGameObjectWithTag("LineManager");
541  LineManager lineManager = lineManagerObj.GetComponent<LineManager>();
542  lineManager.ResetPositions();
543  } else if (UIData.bondtype == UIData.BondType.cube) {
544  GameObject cubeBondManagerObj = GameObject.FindGameObjectWithTag("CubeBondManager");
545  CubeBondManager cubeBondManager = cubeBondManagerObj.GetComponent<CubeBondManager>();
546  cubeBondManager.ResetPositions();
547  } else if (UIData.bondtype == UIData.BondType.hyperstick) {
548  GameObject hStickManagerObj = GameObject.FindGameObjectWithTag("HStickManager");
549  HStickManager hStickManager = hStickManagerObj.GetComponent<HStickManager>();
550  hStickManager.ResetPositions();
551  } else if (UIData.bondtype == UIData.BondType.optihs) {
552  GameObject hStickMeshManagerObj = GameObject.FindGameObjectWithTag("HStickMeshManager");
553  HStickMeshManager hStickMeshManager = hStickMeshManagerObj.GetComponent<HStickMeshManager>();
554  hStickMeshManager.ResetPositions();
555  }
556 
557  //Next step
558  Reaction.current++;
559  }
560 
561  //Aurélien : update of every atom's coordinate to the next reaction step, rendering mode is set to hyperball-hyperstick with 0.2 radius
563  if(!Reaction.affichage)
564  {
566 
567 
568  //Setting radius at 0.2
570 
571  //Destroying previous particle effects (particlein 1 in particle manager)
572  GameObject.Find("ParticleManager").SendMessage("killCurrentEffects",SendMessageOptions.DontRequireReceiver);
573 
574  Reaction.affichage = true;
575  }
576  int j;
577  if(Reaction.forward){
578  ArrayList xyz = (ArrayList)Reaction.coord[Reaction.current];
579  for(int i=0;i<Reaction.acount;i++){
580  j = ((MoleculeModel.atoms[i] as GameObject).GetComponent("AtomIndex") as AtomIndex).index - 1;
581  (MoleculeModel.atoms[i] as GameObject).transform.position = new Vector3((xyz[j] as float[])[0], (xyz[j] as float[])[1], (xyz[j] as float[])[2]);
582  }
583  }
584  else{
585  ArrayList xyz = (ArrayList)Reaction.coord[Reaction.count - Reaction.current - 1];
586  for(int i=0;i<Reaction.acount;i++){
587  j = ((MoleculeModel.atoms[i] as GameObject).GetComponent("AtomIndex") as AtomIndex).index - 1;
588  (MoleculeModel.atoms[i] as GameObject).transform.position = new Vector3((xyz[j] as float[])[0], (xyz[j] as float[])[1], (xyz[j] as float[])[2]);
589  }
590  }
591  //Updating the bonds
593 
594  //Next step
595  Reaction.current++;
596  }
597 
598  if(isControl&&(!UIData.cameraStop2)) { // Seems to be true as long as the mouse is in the game window and not on the gui
599  MouseOperate();
600  KeyOperate();
601 
602  //SetCenterbySpace();
603  HiddenOperate();
604  OpenMenuOperate();
605  }
606 
607  // Always false ?
608  /*if (GUIMoleculeController.toggle_HB_SANIM) {
609  GUIMoleculeController.shrink += Time.deltaTime * GUIMoleculeController.hb_sanim * GUIMoleculeController.hb_ssign;
610  if (GUIMoleculeController.shrink > 0.95f )
611  GUIMoleculeController.hb_ssign = -1.0f;
612  if (GUIMoleculeController.shrink < 0.05f )
613  GUIMoleculeController.hb_ssign = 1.0f;
614  }*/
615 
616  // Always false ?
617  /*if (GUIMoleculeController.toggle_HB_RANIM) {
618  GUIMoleculeController.globalRadius += Time.deltaTime * GUIMoleculeController.hb_ranim * GUIMoleculeController.hb_rsign;
619  if (GUIMoleculeController.globalRadius > 0.95f )
620  GUIMoleculeController.hb_rsign = -1.0f;
621  if (GUIMoleculeController.globalRadius < 0.05f )
622  GUIMoleculeController.hb_rsign = 1.0f;
623  }*/
624 
625  if(GUIMoleculeController.toggle_HB_TRANS) // Always true ?
627  else
629 
634 
638 
641  }
642 
644 
649 
650 // BallUpdateHB.depthfactor = GUIMoleculeController.depthfactor;
656 
659 
661 
663 
664  //SetVolumetricDensity();
665  // gUIDisplay.gUIMoleculeController.GetPanelPixel();
666  }
667 
680  float transition(float val, float newVal, float deltaVal) {
681  if(val <= newVal && deltaVal < 0.0f) return newVal;
682  if(val >= newVal && deltaVal > 0.0f) return newVal;
683  return val + deltaVal;
684  }
685 
689  private void OpenMenuOperate() {
690  if(Input.GetKeyDown(KeyCode.Delete)) {
693 
694  }
695  }
696 
697  public void SetFOV(float angle)
698  {
699  // Set field of view angle.
700  camera.fieldOfView = angle;
701 
702  // Compute frustum ratio.
703  angle_rad = angle * Mathf.Deg2Rad / 2f;
704 
705  float new_near_plane = default_near_plane_length / Mathf.Tan(angle_rad);
706 
707  // Reset projection matrix.
708  camera.ResetProjectionMatrix();
709 
710  // Adjust camera position.
711  camera.transform.localPosition = new Vector3(0f, 0f, -(new_near_plane - default_near_clip_plane) * 800f);
712  }
713 
718  private void HiddenOperate() {
719  if(Input.GetButtonDown("Hide GUI")) {
720  if(!UIData.hiddenUI) { //&& !UIData.hiddenUIbutFPS && !UIData.hiddenCamera) {
721  UIData.hiddenUI=true;
722  toggleNewUI.SetActive(false);
723  Debug.Log("Hide all the UI.");
724  }
725  // I really don't know why we'd want to disable the camera.
726 /* else if(UIData.hiddenUI && !UIData.hiddenUIbutFPS && !UIData.hiddenCamera) {
727  UIData.hiddenCamera=true;
728  LocCamera.GetComponent<Camera>().enabled=false;
729  Debug.Log("Hide all the UI and Camera.");
730  }
731 */
732  // Doesn't seem to work
733 /* else if(UIData.hiddenUI && !UIData.hiddenUIbutFPS) { //&& UIData.hiddenCamera) {
734  //UIData.hiddenCamera=false;
735  //LocCamera.GetComponent<Camera>().enabled=true;
736  UIData.hiddenUI=false;
737  UIData.hiddenUIbutFPS=true;
738  Debug.Log("Hide all the UI except FPS.");
739  }
740 */
741  else if(UIData.hiddenUI) {
742  UIData.hiddenUI=false;
743  toggleNewUI.SetActive(true);
744  //UIData.hiddenUIbutFPS=false;
745  Debug.Log("Show all the UI and Camera.");
746  }
747  }
748  }
749 
753  private void KeyOperate() {
754  /*
755  * This shit might be completely useless
756  */
757  if(Input.GetKeyUp(KeyCode.D))
758  if(UIData.switchmode)
759  ToNotParticle();
760 
761  if(Input.GetKeyUp(KeyCode.W))
762  if(UIData.switchmode)
763  ToNotParticle();
764 
765  if(Input.GetKeyUp(KeyCode.S))
766  if(UIData.switchmode)
767  ToNotParticle();
768 
769  if(Input.GetKeyUp(KeyCode.A))
770  if(UIData.switchmode)
771  ToNotParticle();
772 
773  if(Input.GetButtonUp("Zoom In"))
774  if(UIData.switchmode)
775  ToNotParticle();
776 
777  if(Input.GetButtonUp("Zoom Out"))
778  if(UIData.switchmode)
779  ToNotParticle();
780 
781  if(Input.GetButtonUp("Rotate X Right"))
782  if(UIData.switchmode)
783  ToNotParticle();
784 
785  if(Input.GetButtonUp("Rotate X Left"))
786  if(UIData.switchmode)
787  ToNotParticle();
788 
789  if(Input.GetButtonUp("Render Cubes")) {
791 
792  }
793 
794  if(Input.GetButtonUp("Render Spheres")) {
796 
797  }
798 
799  if(Input.GetButtonUp("Render Hyperballs")) {
801 
802 
803  }
804  if(Input.GetButtonUp("Render Optimized Hyperballs")) {
806 
807 
808  }
809  if(Input.GetButtonDown("Hide Molecule")) {
811 
812  }
813 
814  // Takes a screenshot of the scene
815  if(Input.GetButtonDown("Take Screenshot")) {
816  ScreenShot comp = LocCamera.GetComponent<ScreenShot> ();
817  comp.open = true;
818  }
819 
820  Vector3 vv=new Vector3();
821  vv=LocCamera.transform.localPosition;
822 
824  vv.z+=Input.GetAxis("Mouse ScrollWheel")*5;
825 
826  LocCamera.transform.localPosition=vv;
827  }
828 
835  /* replaced by R and C in maxCamera.
836  private void SetCenterbySpace() {
837  if(Input.GetKeyUp(KeyCode.R)) {
838  Debug.Log("Press the R key");
839  SetCenter(0);
840  }
841  replace by touch C in maxCamera
842  if(Input.GetKeyUp(KeyCode.T)) {
843  Debug.Log("Press the T key");
844  SetCenter(1);
845  }
846  }*/
847 
848 // controlled when maxcam is desactivate with the mouse =============================================================================================
852  private void MouseOperate() {
853  Vector3 v=new Vector3();
854  if (LocCamera == null)
855  LocCamera = Camera.main.gameObject;
856  v=LocCamera.transform.localPosition;
857 
859 // if (Input.GetMouseButton(1) )
860 // v=LocCamera.transform.localPosition;
861 
862  if (Input.GetMouseButton(0)) {
864  rotationXX += Input.GetAxis("Mouse X") * sensitivityX;
865  rotationYY += Input.GetAxis("Mouse Y") * sensitivityY;
866  print("Mouse X"+Input.GetAxis("Mouse X"));
867  print("Mouse Y"+Input.GetAxis("Mouse Y"));
868  print("rotationXX"+rotationXX);
869  print("rotationYY"+rotationYY);
870 
871  Quaternion xQuaternion = Quaternion.AngleAxis (rotationXX, Vector3.up);
872  Quaternion yQuaternion = Quaternion.AngleAxis (rotationYY, Vector3.left);
873  transform.localRotation = xQuaternion * yQuaternion;
874 // transform.localRotation = originalRotation * xQuaternion * yQuaternion;
876  }
877 
878  if(Input.GetMouseButtonUp(1))
880 
881  v.z+=Input.GetAxis("Mouse ScrollWheel")*5;
882  LocCamera.transform.localPosition=v;
883  Debug.Log ("get mouse: " +v.z);
884  }
885  }
886 
893  private void SetCenter( int mode) {
894  GameObject CamTarget = GameObject.Find("Cam Target");
895 
896  // choose the main function 0 to restart position or 1 to center around an atom
897  if (mode == 0) {
898  //Debug.Log("Entering :: SetCenter for cam target to" + MoleculeModel.cameraLocation.z);
899  if(scenecontroller.GetComponent<maxCamera>().enabled) {
900  maxCamera comp = scenecontroller.GetComponent<maxCamera>();
901  comp.ToCenter();
902  }
903  if(UIData.atomtype == UIData.AtomType.hyperball){
904  GameObject hbManagerObj = GameObject.FindGameObjectWithTag("HBallManager");
905  HBallManager hbManager = hbManagerObj.GetComponent<HBallManager>();
906  hbManager.ResetPositions();
907  }
908  } else if (mode ==1) {
909  Debug.Log("target : " +MoleculeModel.target);
910  CamTarget.transform.rotation = transform.rotation;
911  CamTarget.transform.position = MoleculeModel.target;
912  }
913  }
914 
915 
916 
920  public void ToNotParticle() {
921  if(UIData.atomtype != UIData.AtomType.particleball && UIData.atomtype != previous_AtomType) {
924  }
926  }
927 
931  public void ToParticle() {
932  if(UIData.atomtype != UIData.AtomType.particleball) {
935  }
937  }
938 }
939 
static bool openAllMenu
Definition: UIData.cs:170
UIData.BondType previous_BondType
Definition: Molecule3D.cs:141
void ToNotParticle()
Switch the protein representation to Hyperball.
Definition: Molecule3D.cs:920
override void ResetPositions()
Resets the positions of all balls.
float default_near_plane_length
Definition: Molecule3D.cs:124
static string init_molecule
Definition: UIData.cs:82
void ToCenter()
Definition: maxCamera.cs:427
string location
Definition: Molecule3D.cs:101
static bool fetchPDBFile
Definition: UIData.cs:93
static bool EnableUpdate
Definition: UIData.cs:143
static bool isOpenFile
Definition: UIData.cs:100
void Display()
Display a GUI pannel for selecting a PDB on a server or on a local file.
Definition: GUIDisplay.cs:401
UIData.BondType PreviousBondType
Definition: Molecule3D.cs:142
static float radiusFactor
Definition: StickUpdate.cs:82
static string proxyServer
Definition: GUIDisplay.cs:109
static float drag
Definition: BallUpdateHB.cs:77
override void ResetPositions()
Resets the positions of all balls.
void Display()
Definition: Molecule3D.cs:292
void LoadAnimCrd(string resource_name)
Definition: RequestPDB.cs:207
static GuidedNavigationManager getGuidedNavigationManager()
Definition: UnityMolMain.cs:38
static bool toggle_TWISTER
Definition: SugarOldGUI.cs:12
static float depthFactor
Definition: HBallManager.cs:81
static int ColorationModeBond
Definition: SugarManager.cs:24
static bool interactive
Definition: UIData.cs:145
static float scale
Definition: StickUpdate.cs:79
float minimumX
Definition: Molecule3D.cs:95
static bool secondarystruct
Switch between all atoms and C-alpha trace or BFactor secondary structure representation.
Definition: UIData.cs:176
static float spring
Definition: BallUpdateHB.cs:78
static List< string > existingName
List of the names existing in the molecule.
UIData.AtomType previous_AtomType
Definition: Molecule3D.cs:134
static ImprovedFileBrowser m_fileBrowser
float sensitivityX
Definition: Molecule3D.cs:93
Skybox camSky
Definition: Molecule3D.cs:87
static string id
Definition: GUIDisplay.cs:123
float rotationXX
Definition: Molecule3D.cs:99
void loadFile()
Definition: Molecule3D.cs:410
void OnDisable()
Definition: Molecule3D.cs:148
static bool toggle_OXYGEN
Definition: SugarOldGUI.cs:18
float maximumY
Definition: Molecule3D.cs:98
static bool isReaction
Definition: Reaction.cs:11
static bool switchmode
Definition: UIData.cs:155
Definition: CommandID.cs:66
float transition(float val, float newVal, float deltaVal)
Make the transition between metaphors.
Definition: Molecule3D.cs:680
GUIDisplay gUIDisplay
Definition: Molecule3D.cs:88
float minimumY
Definition: Molecule3D.cs:97
Camera camera
Definition: Molecule3D.cs:129
static bool isFileLoaded
Definition: UIData.cs:115
static bool pdbGen
static float scale
Definition: LineUpdate.cs:77
void SetFOV(float angle)
Definition: Molecule3D.cs:697
static bool cameraStop2
Definition: UIData.cs:135
static string file_base_name
Definition: GUIDisplay.cs:120
static VRPN.VRPNManager getVRPNManager()
Definition: UnityMolMain.cs:58
void ToParticle()
Switch the protein representation to Particle.
Definition: Molecule3D.cs:931
bool fileLoadingFinished
Definition: Molecule3D.cs:115
RequestPDB requestPDB
Definition: Molecule3D.cs:89
Vector2 fileScroll
Definition: Molecule3D.cs:103
static bool animation
Definition: Reaction.cs:19
void RecenterSurfaces(Vector3 pos)
static Color EnergyGrayColor
Definition: BallUpdateHB.cs:79
static bool affichage
Definition: Reaction.cs:16
static bool isMoleculeDisplayed
Definition: UIData.cs:116
float default_near_clip_plane
Definition: Molecule3D.cs:122
static void InitCutParameters()
static bool resetScale
static string pdbServer
Definition: GUIDisplay.cs:108
float sensitivityY
Definition: Molecule3D.cs:94
Color color
Definition: ColorObject.cs:72
static bool changeStructure
Definition: UIData.cs:95
static List< int > residueIds
The residue identifiers.
override void ResetPositions()
Resets the bond vectors, which is necessary when the balls move.
static List< string > existingRes
List of the residues existing in the molecule.
float angle_rad
Definition: Molecule3D.cs:127
static string pdbID
Definition: GUIDisplay.cs:107
static GameObject LocCamera
Definition: Molecule3D.cs:86
bool fontInitialized
Definition: Molecule3D.cs:84
Boolean isControl
Definition: Molecule3D.cs:90
static int current
Definition: Reaction.cs:14
ArrayList clubLocationalist
Definition: Molecule3D.cs:92
static bool reset
Definition: DepthCueing.cs:81
static bool loadHireRNA
Definition: UIData.cs:240
static bool toggle_RING_BLENDING
Definition: SugarOldGUI.cs:10
static void UpdateBondsFromGameObject(ArrayList atoms)
static bool resetInteractive
Definition: UIData.cs:147
float default_fov_angle
Definition: Molecule3D.cs:118
IPEndPoint _ipep
Definition: Molecule3D.cs:91
static void setCurrentAtomManager(GenericManager manager)
Definition: UnityMolMain.cs:63
void MouseOperate()
Sets the center of the scene on : The original center (&#39;R&#39; key) The targeted atom (&#39;T&#39; key) ...
Definition: Molecule3D.cs:852
void LoadPDBReaction(string resource_name)
Definition: RequestPDB.cs:187
static bool isReady
Definition: Reaction.cs:15
void Update()
Definition: Molecule3D.cs:498
static bool forward
Definition: Reaction.cs:17
static string proxyPort
Definition: GUIDisplay.cs:110
static ElectrostaticManager getElectrostaticManager()
Definition: UnityMolMain.cs:42
void KeyOperate()
For keyboard control.
Definition: Molecule3D.cs:753
Vector2 directoryScroll
Definition: Molecule3D.cs:102
void LoadXGMML(string file_name)
Definition: RequestPDB.cs:516
static void setCurrentBondManager(GenericManager manager)
Definition: UnityMolMain.cs:68
!WiP Includes FLAGS of GUI.
Definition: UIData.cs:78
static bool isParticlesInitialized
Definition: UIData.cs:101
static void ChangeRepresentation(UIData.AtomType newAtomType, UIData.BondType newBondType=UIData.BondType.nobond)
static bool isGLIC
Definition: UIData.cs:189
static BondType bondtype
Definition: UIData.cs:141
float rotationYY
Definition: Molecule3D.cs:100
bool open
Definition: ScreenShot.cs:81
override void ResetPositions()
!WiP manage GUI, and provide static strings for the GUI.
Definition: GUIDisplay.cs:94
ImprovedFileBrowser m_fileBrowser
Definition: GUIDisplay.cs:135
static float radiusFactor
Definition: BallUpdate.cs:81
void Awake()
Definition: Molecule3D.cs:256
static string file_extension
Definition: GUIDisplay.cs:121
static Dictionary< int, ArrayList > residues
The residues.
static ArtemisManager getArtemisManager()
Definition: UnityMolMain.cs:29
static bool backGroundIs
Definition: UIData.cs:128
static bool resetRadii
float maximumX
Definition: Molecule3D.cs:96
static bool isCubeLoaded
Definition: UIData.cs:103
static bool hiddenUI
Definition: UIData.cs:161
static List< string > existingChain
List of the chains existing in the molecule.
void HiddenOperate()
Hides the GUI and enables a sort of "full-screen" mode, as in GUI-less, not as opposed to windowed...
Definition: Molecule3D.cs:718
static void InitAtomic()
Inits the atomic and chains scales.
Definition: AtomModel.cs:180
static List< GenericManager > GetManagers()
Gets the list of active managers based on the atom type provided and based on the bond type in UIData...
void LoadAnimTop(string resource_name)
Definition: RequestPDB.cs:197
GameObject toggleNewUI
Definition: Molecule3D.cs:104
static AtomType atomtype
Definition: UIData.cs:139
void OpenMenuOperate()
Switch back to the particle mode.
Definition: Molecule3D.cs:689
static SurfaceManager getSurfaceManager()
Definition: UnityMolMain.cs:24
static bool hasMoleculeDisplay
Definition: UIData.cs:96
static bool hiddenUIbutFPS
Definition: UIData.cs:166
static void clearScene()
Clears the scene.
Definition: Molecule3D.cs:156
static void BuildMoleculeComponents()
Builds the molecule&#39;s components.
static ArrayList coord
Definition: Reaction.cs:8
override void ResetPositions()
Definition: LineManager.cs:105
GUISkin mySkin
Definition: Molecule3D.cs:106
static bool isSphereLoaded
Definition: UIData.cs:104
static bool isHBallLoaded
Definition: UIData.cs:105
static float depthFactor
static float shrink
Definition: StickUpdate.cs:76
void OnGUI()
Definition: Molecule3D.cs:298
static int ColorationModeRing
Definition: SugarManager.cs:23
GameObject scenecontroller
Definition: Molecule3D.cs:112
static ColorObject EnergyGrayColor
UIData.AtomType PreviousAtomType
Definition: Molecule3D.cs:135
static bool resetShrink
void SetCenter(int mode)
Sets the center of the scene on the original center or on an atom.
Definition: Molecule3D.cs:893
static void BuildHireRnaHydrogenBondsStructures()
float default_fov_angle_rad
Definition: Molecule3D.cs:119
Definition: GUIDisplay.cs:66
static List< float > atomsLocalScaleList
static void SetFontSize()
Sets the size of the font.
Definition: Rectangles.cs:405
void Start()
Definition: Molecule3D.cs:270