3 using System.Collections.Generic;
26 originPoint = GameObject.CreatePrimitive (PrimitiveType.Sphere);
27 originPoint.transform.position =
new Vector3 (0, 1, 0);
28 originPoint.transform.localScale =
new Vector3 (4, 4, 4);
30 symmetryAxis = GameObject.CreatePrimitive (PrimitiveType.Cylinder);
31 symmetryAxis.transform.position =
new Vector3 (0, 1, 0);
33 symmetryAxis.GetComponent<Renderer>().material.color = Color.red;
38 GameObject.Destroy(originPoint);
39 GameObject.Destroy(symmetryAxis);
60 if (Input.GetKeyUp (KeyCode.U)) {
67 if (Input.GetKeyUp (KeyCode.J)) {
73 if (Input.GetKeyUp (KeyCode.I)) {
84 if (Input.GetKeyUp (KeyCode.M)) {
89 if (Input.GetKeyUp (KeyCode.L))
143 Debug.Log (
"Go back from panoramic view to normal view");
176 Debug.Log (
"LookAt phase");
224 if (Input.GetButton (
"Guided Navigation Rotate X Right")){
236 if (Input.GetButton (
"Guided Navigation Rotate X Left")) {
249 if (Input.GetButton (
"Guided Navigation Rotate Y Down")){
263 if (Input.GetButton (
"Guided Navigation Rotate Y Up")){
280 if (Input.GetKey (KeyCode.KeypadPlus) || Input.GetKey (KeyCode.B))
282 Debug.Log (
"Spreading");
286 if (Input.GetKey (KeyCode.KeypadMinus) || Input.GetKey(KeyCode.V))
289 if (Input.GetKey (KeyCode.KeypadMultiply) || Input.GetKey(KeyCode.T))
295 if(Input.GetKey (KeyCode.Keypad1))
298 if(Input.GetKey (KeyCode.Keypad2))
301 if(Input.GetKey (KeyCode.Keypad3))
304 if(Input.GetKey (KeyCode.Keypad4))
306 if(Input.GetKey (KeyCode.O))
399 BallUpdateSphere ball;
428 if(atomChain ==
"A"){
431 if(atomChain ==
"B"){
434 if(atomChain ==
"C"){
437 if(atomChain ==
"D"){
440 if(atomChain ==
"E"){
446 if(atomChain ==
"A"){
449 if(atomChain ==
"B"){
452 if(atomChain ==
"C"){
455 if(atomChain ==
"D"){
458 if(atomChain ==
"E"){
468 GameObject[] ribA = GameObject.FindGameObjectsWithTag(
"RibbonObjA");
469 GameObject[] ribB = GameObject.FindGameObjectsWithTag(
"RibbonObjB");
470 GameObject[] ribC = GameObject.FindGameObjectsWithTag(
"RibbonObjC");
471 GameObject[] ribD = GameObject.FindGameObjectsWithTag(
"RibbonObjD");
472 GameObject[] ribE = GameObject.FindGameObjectsWithTag(
"RibbonObjE");
500 foreach( GameObject rib
in ribC)
505 foreach( GameObject rib
in ribA)
509 foreach( GameObject rib
in ribB)
513 foreach( GameObject rib
in ribD)
517 foreach( GameObject rib
in ribE)
524 foreach( GameObject rib
in ribA)
528 foreach( GameObject rib
in ribB)
532 foreach( GameObject rib
in ribD)
536 foreach( GameObject rib
in ribE)
553 Debug.Log (
"isGLIC = true");
678 GameObject[] ribA = GameObject.FindGameObjectsWithTag(
"RibbonObjA");
679 GameObject[] ribB = GameObject.FindGameObjectsWithTag(
"RibbonObjB");
680 GameObject[] ribC = GameObject.FindGameObjectsWithTag(
"RibbonObjC");
681 GameObject[] ribD = GameObject.FindGameObjectsWithTag(
"RibbonObjD");
682 GameObject[] ribE = GameObject.FindGameObjectsWithTag(
"RibbonObjE");
711 foreach( GameObject rib
in ribC)
716 foreach( GameObject rib
in ribA)
720 foreach( GameObject rib
in ribB)
724 foreach( GameObject rib
in ribD)
728 foreach( GameObject rib
in ribE)
735 foreach( GameObject rib
in ribA)
739 foreach( GameObject rib
in ribB)
743 foreach( GameObject rib
in ribD)
747 foreach( GameObject rib
in ribE)
792 vectemp =
new Vector3();
811 vectemp =
new Vector3();
830 vectemp =
new Vector3();
881 float x = 0, y = 0, z = 0;
897 return new Vector3(x/nb_atoms, y/nb_atoms, z/nb_atoms);
909 return new Vector3(x/nb_atoms, y/nb_atoms, z/nb_atoms);
950 float x1 = 0, y1 = 0, z1 = 0;
951 float x2 = 0, y2 = 0, z2 = 0;
976 Vector3 temp1 =
new Vector3 (x1 / nb_atoms1, y1 / nb_atoms1, z1 / nb_atoms1);
977 Spread1 = temp1 - sym_center;
978 Spread1.Normalize ();
980 Vector3 temp2 =
new Vector3 (x2 / nb_atoms2, y2 / nb_atoms2, z2 / nb_atoms2);
981 Spread2 = temp2 - sym_center;
982 Spread2.Normalize ();
993 private void computeSpreadHelix(out Vector3 Spreadhelix,
int first_atom,
int last_atom,
string chain){
994 float x = 0, y = 0, z = 0;
997 for (
int i=first_atom; i < last_atom; i++) {
1004 Vector3 temp =
new Vector3 (x / nb_atoms, y / nb_atoms, z / nb_atoms);
1006 Vector3 center =
get_com (chain);
1008 Spreadhelix = temp - center;
1009 Spreadhelix.Normalize ();
static bool navigationUp
Are we moving down. Boolean set to true on key press.
static Vector3 poscloseatom
3D coordinates of the closest atom to the camera.
static Vector3 optim_user_cam_pos
3D coordinates of the selected best camera position.
static bool ghost_target_instantiate
Have the game objects for camera target and position been instantiated.
static Vector3 spreadA
Spreading vectors for each chain (up to 5). Computed by GuidedNavigationManager::computeSpreadingVect...
void NarrowSpheres()
Narrow the chains when rendering spheres.
static bool secondarystruct
Switch between all atoms and C-alpha trace or BFactor secondary structure representation.
void ResetChainPosForSpheres()
Resets the chains positions when rendering spheres.
static Vector3 velocity
Camera 3D speed during its repositioning.
static bool newUIActivated
void CreateAxeAndOrigin()
Instantiate the origin and symmetry axis game objects.
static bool guidedzoom
Should we zoom? True when the camera is not at the right distance (maxCamera.desiredDistance != maxCa...
static bool navigationDown
Are we moving down? Boolean set to true on key press.
Vector3 get_com(string chain)
Compute center of mass.
static bool isunder
Allows to dive into the channel when zoom in the structure from below.
static bool toggle_SEC_STRUCT
Triggers the switch between atom and secondary structure generation and rendering.
void computeSpreadHelix(out Vector3 Spreadhelix, int first_atom, int last_atom, string chain)
Computes spreading vectors for helices (third step spreading)
void DestroyAxeAndOrigin()
Destroy the axis and origin game objects.
void computeSpreadPart(out Vector3 Spread1, out Vector3 Spread2, string chain)
Compute spreading vectors (second step).
static List< string > atomsChainList
The chain of each atom.
static float currentDistance
static bool onlyTMD
If true, triggers the computation of the center of mass of only the TransMembrane Domain (TMD)...
static Vector3 optim_target
3D coordinates of the target.
static void DestroyBonds()
static bool panoramic
Activates/Deactivate the panoramic view (immersive camera positioning).
static List< int > residueIds
The residue identifiers.
void NarrowHyperballs()
Narrow the chains when rendering hyperballs.
void goDownConstrained()
Only available in "guided navigation" and specific to pentameric channels.
static GameObject ghost_target
Reference to the sphere primitive representing the camera target.
static bool next_right
Jump to the next monomer on the right.
GameObject originPoint
GameObjects representing the space origin and molecule symmetry axis.
void NearSpreading()
Slightly spreads the chains when the camera is near the protein structure.
void goUpConstrained()
Only available in "guided navigation" mode and specific to pentameric channels.
abstract void ResetPositions()
string GetClosestAtomType(Vector3 pos)
void ResetChainsPos()
Resets the chains position.
void SpreadHyperballs()
Spread chains when rendering the atoms as hyperballs.
void NarrowCAlpha()
Narrow the chains of C-alpha traces.
static bool monomer_jump
Enter or exit jump navigation Triggered by key press (see GuidedNavigationManager::UpdateManager) ...
void SpreadSpheres()
Spread chains when rendering the atoms as spheres.
static List< float[]> CaSplineList
The coordinates of each Carbon alpha in the CA-Spline.
static BallUpdateHB[] hballs
List of all hyperballs mono behavior scripts Filled when spreading, narrowing or resetting chains pos...
void NarrowSecondaryStructure()
!WiP Includes FLAGS of GUI.
static bool next_left
Jump to the next monomer on the left.
static SecondaryStructureManager getSecondaryStructureManager()
static GameObject mainCamera
Reference to the scene camera.
The GNParameters class regroups settings used for Guided Navigation and GLIC spreading.
static void ChangeRepresentation(UIData.AtomType newAtomType, UIData.BondType newBondType=UIData.BondType.nobond)
static float desiredDistance
static bool reset_panoramic
When true, triggers the transition from panoramic view to normal view.
void SpreadSecondaryStructure()
Spread chains when rendering the secondary structure.
static Vector3 MaxValue
The "biggest" corner of the bounding box that encloses the molecule.
static List< string > CaSplineChainList
The chain of each carbon alpha in the CA-Spline.
void Narrowing()
Narrowing chains.
static Vector3[] optim_cam_position
3D coordinates of the 4 best camera positions.
void SpreadCAlpha()
Spread chains when rendering the C-alpha spline as hyperballs.
static float distclose
Distance between the camera and the closest atom.
static List< string > existingChain
List of the chains existing in the molecule.
static Vector3 MinValue
The "smallest" corner of the bounding box that encloses the molecule.
static bool near_spread
Activate/Deactivate the spreading relative the closeness of the camera to the molecule.
static bool reoriented
When true, triggers the camera repositioning inside the molecule bounding box.
static GameObject ghost_camera
Reference to the sphere primitive representing the camera ending position.
static double comp_spread
Current distance of spreading.
static bool showGuidedMenu
static float rotation_done
static GenericManager getCurrentBondManager()
void ResetChainPosForHyperballs()
Resets the chains positions when rendering hyperballs.
static float[] closeatom
3D coordinates of the closest atom to the camera.
static BallUpdateSphere[] sballs
List of all spheres mono behavior scripts.
static bool isabove
Allows to dive into the channel when zoom in the structure from above.
void Spreading()
Spreading chains (limit: 5 chains)
static float transitionDuration
static int reslim
Number of the first residue outside of the GLIC transmembrane domain.
void ResetChainPosForHyperballsAndSecondaryStructure()
Resets the chains positions when rendering the secondary structure.
static GenericManager getCurrentAtomManager()
static List< float[]> atomsLocationlist
The coordinates of each atom.
void computeSpreadingVector()
Compute spreading vectors (first step).