UnityMol  0.9.6-875
UnityMol viewer / In developement
AdvancedOptionsOldGUI.cs
Go to the documentation of this file.
1 using UnityEngine;
2 using System.Collections;
3 using System.Collections.Generic;
4 using UI;
5 using Molecule.Model;
6 using Molecule.View;
7 
8 
10 
11 
12 public class AdvancedOptionsOldGUI {
13 
14 
15  public static bool showAdvMenu = false;
16  public static bool showEffectType = false;
17  public static bool showBackgroundType = false;
18  private static Camera mainCamera;
19 
20  public static int id_screenshot_sequence = 0;
21 
22 
23  protected static DepthCueing depthCueing;
25 
26  public static bool showVolumetricDepth = false;
27 
28  protected static bool toggle_VE_BLUR = false;
29  protected static bool toggle_VE_SSAO = false;
30  protected static bool toggle_VE_DOF = false;
31  protected static bool toggle_VE_CREASE = false;
32  protected static bool toggle_VE2_VORTX = false;
33  protected static bool toggle_VE2_TWIRL = false;
34  protected static bool toggle_VE2_SEPIA = false;
35  protected static bool toggle_VE2_NOISE = false;
36  protected static bool toggle_VE2_GRAYS = false;
37  protected static bool toggle_VE2_GLOW = false;
38  protected static bool toggle_VE2_EDGE = false;
39  protected static bool toggle_VE2_EDGEONLY = false;
40  protected static bool toggle_VE2_CONTR = false;
41  protected static bool toggle_VE2_CCORR = false;
42  protected static bool toggle_VE2_BLUR2 = false;
43  protected static bool toggle_VE2_DREAM = false;
44 
45 
46  // Ramps for grayscale effect
47  protected static string[] ve2_grays_ramps = {"grayscale ramp", "grayscale ramp inverse"};
48  protected static int ve2_grays_rampn = 1;
49  protected static int ve2_grays_rampc = 1;
50 
51  // Ramps for color correction effect
52  protected static string[] ve2_ccorr_ramps = {"oceangradient", "nightgradient"};
53  protected static int ve2_ccorr_rampn = 1;
54  protected static int ve2_ccorr_rampc = 0;
55 
56 
63  public static void AdvOptions(int a){
64  showAdvMenu = LoadTypeGUI.SetTitleExit("Advanced Options");
65  if(!showAdvMenu)
66  LoadTypeGUI.m_colorPicker = null ;
67 
68  if(mainCamera == null)
69  mainCamera = Camera.main;
70 
73 
74  if(showBackgroundType)
75  GUI.enabled = false;
76 
77  BackColor ();
78 
79  GUI.enabled = true;
80 
81  GUILayout.BeginHorizontal ();
82  if (GUILayout.Button (new GUIContent ("Effects", "Toggle what kind of special effect to apply to the scene")))
83  showEffectType = !showEffectType;
84  GUILayout.EndHorizontal ();
85 
86  GUILayout.BeginHorizontal ();
87  if (GUILayout.Button (new GUIContent ("Infos", "Show/Hide the FPS, atom count and bond count")))
89  GUILayout.EndHorizontal ();
90 
91  if (Event.current.type == EventType.Repaint)
92  MoleculeModel.newtooltip = GUI.tooltip;
93 
94 
95 
96 
97  GUILayout.BeginHorizontal();
98  GUILayout.Label (new GUIContent ("GUI Scale: " + GUIDisplay.guiScale.ToString("0.00"), "Adjusts the scale of the GUI windows"), GUILayout.MinWidth ((int)(Rectangles.advOptWidth * 0.4f)));
99  GUIDisplay.guiScale = GUILayout.HorizontalSlider (GUIDisplay.guiScale, 0.3f, 1.7f, GUILayout.Width (((int)(Rectangles.advOptWidth * 0.4f))));
100 
101  if (GUILayout.Button(new GUIContent("OK", "Apply new GUI Scale")))
104  Rectangles.Scale();
105  }
106  GUILayout.EndHorizontal();
107 
108  GUILayout.BeginHorizontal();
109  if (GUILayout.Button(new GUIContent("Ortho/Persp", "Switches between orthographic and perspective camera"))){
110  if(mainCamera.orthographic)
111  mainCamera.orthographic = false ;
112  else {
113  mainCamera.orthographic = true ;
114  mainCamera.orthographicSize = 20f ;
115  }
116  }
117  GUILayout.EndHorizontal();
118 
119  GUILayout.BeginHorizontal();
121  "Camera Size", "This slider changes the size of the orthographic camera.", mainCamera.orthographic, 100, 20);
122  GUI.enabled = true; // LabeLSlider can disable the entire GUI. I don't like that at all, but it's expected in some parts of the GUI.
123  // Still needs changing, methinks. ---Alexandre
124  GUILayout.EndHorizontal();
125 
126  mainCamera.orthographicSize = LoadTypeGUI.orthoSize ;
127 
128  GUILayout.BeginHorizontal();
129  if (GUILayout.Button(new GUIContent("Best Textures: "+ LoadTypeGUI.queryBestTextures(),
130  "This switches between the complete set of textures and a selection of the best ones"))){
134  else
136  }
137 
138  if (GUILayout.Button(new GUIContent("Depth Cueing", "Depth Cueing"))) {
142  }
144  depthCueing.Revert();
145  else {
146  depthCueing = new DepthCueing();
147  depthCueing.Darken();
148  }
149  }
150  GUILayout.EndHorizontal();
151 
152  GUILayout.BeginHorizontal();
153  if (GUILayout.Button(new GUIContent("Volumetric Depth Cueing", "Volumetric Depth Cueing"))) {
154  showVolumetricDepth = !showVolumetricDepth;
155 
159  }
160 
161  GameObject volumObj;
162  volumObj = GameObject.FindGameObjectWithTag("Volumetric");
163  VolumetricDepth volumetricDepth = null;
164 
165  if(showVolumetricDepth) {
166  volumObj.AddComponent<VolumetricDepth>(); // adding the script
167  volumetricDepth = volumObj.GetComponent<VolumetricDepth>();
168  volumetricDepth.Init();
169  }
170  else {
171  volumetricDepth = volumObj.GetComponent<VolumetricDepth>();
172  volumetricDepth.Clear();
173  }
174  }
175 
176  if(GUILayout.Button(new GUIContent("Ambient Occlusion", "Ambient occlusion based on molecular density."))) {
178  ambientOcclusion.Revert();
179  else {
180  ambientOcclusion = new AmbientOcclusion();
181  ambientOcclusion.Occlude();
182  }
183  }
184  GUILayout.EndHorizontal();
185 
186  // TODO : Make C-Alpha trace and his texture/color work again !
187 /* //if((structType != "C-alpha trace"))
188  //GUI.enabled = false ;
189 
190  // Creating textures to put on the buttons. Not created if they already exist.
191  chainATex = MakeButtonTex(chainATex);
192  chainBTex = MakeButtonTex(chainBTex);
193  chainCTex = MakeButtonTex(chainCTex);
194  chainDTex = MakeButtonTex(chainDTex);
195  chainETex = MakeButtonTex(chainETex);
196  chainFTex = MakeButtonTex(chainFTex);
197  chainGTex = MakeButtonTex(chainGTex);
198  chainHTex = MakeButtonTex(chainHTex);
199 
200  // Refreshing the color of each chain if needed
201  if( (AtomModel.IsAlive()) && (!chainColorsInit) ) {
202  chainAColor.color = AtomModel.GetChainColor("chainA");
203  chainBColor.color = AtomModel.GetChainColor("chainB");
204  chainCColor.color = AtomModel.GetChainColor("chainC");
205  chainDColor.color = AtomModel.GetChainColor("chainD");
206  chainEColor.color = AtomModel.GetChainColor("chainE");
207  chainFColor.color = AtomModel.GetChainColor("chainF");
208  chainGColor.color = AtomModel.GetChainColor("chainG");
209  chainHColor.color = AtomModel.GetChainColor("chainH");
210 
211  chainColorsInit = true;
212  }
213 
214  // Getting the current colors of each chain
215  for(int i=0; i<200; i++) {
216  if(!AtomModel.IsAlive()) {
217  chainAColors[i] = Color.white;
218  chainBColors[i] = Color.white;
219  chainCColors[i] = Color.white;
220  chainDColors[i] = Color.white;
221  chainEColors[i] = Color.white;
222  chainFColors[i] = Color.white;
223  chainGColors[i] = Color.white;
224  chainHColors[i] = Color.white;
225  }
226  else {
227  chainAColors[i] = chainAColor.color;
228  chainBColors[i] = chainBColor.color;
229  chainCColors[i] = chainCColor.color;
230  chainDColors[i] = chainDColor.color;
231  chainEColors[i] = chainEColor.color;
232  chainFColors[i] = chainFColor.color;
233  chainGColors[i] = chainGColor.color;
234  chainHColors[i] = chainHColor.color;
235  }
236  }
237 
238 
239  // Actually setting the colors to the textures
240  chainATex.SetPixels(chainAColors);
241  chainATex.Apply(true);
242 
243  chainBTex.SetPixels(chainBColors);
244  chainBTex.Apply(true);
245 
246  chainCTex.SetPixels(chainCColors);
247  chainCTex.Apply(true);
248 
249  chainDTex.SetPixels(chainDColors);
250  chainDTex.Apply(true);
251 
252  chainETex.SetPixels(chainEColors);
253  chainETex.Apply(true);
254 
255  chainFTex.SetPixels(chainFColors);
256  chainFTex.Apply(true);
257 
258  chainGTex.SetPixels(chainGColors);
259  chainGTex.Apply(true);
260 
261  chainHTex.SetPixels(chainHColors);
262  chainHTex.Apply(true);
263 
264  // New Layout line
265  GUILayout.BeginHorizontal();
266  GUILayout.Label("Carbon alpha trace chains colors");
267  GUILayout.EndHorizontal();
268 
269  // New Layout line
270  GUILayout.BeginHorizontal();
271  GUILayout.Label("Chain A color");
272  if(GUILayout.Button(chainATex,GUILayout.MinWidth(50),GUILayout.MinHeight(20)))
273  CreateColorPicker(chainAColor, "Chain A Color", "chainA");
274  GUILayout.EndHorizontal();
275 
276  // New Layout line
277  GUILayout.BeginHorizontal();
278  GUILayout.Label("Chain B color");
279  if(GUILayout.Button(chainBTex,GUILayout.MinWidth(50),GUILayout.MinHeight(20)))
280  CreateColorPicker(chainBColor, "Chain B color", "chainB");
281  GUILayout.EndHorizontal();
282 
283  // New Layout line
284  GUILayout.BeginHorizontal();
285  GUILayout.Label("Chain C color");
286  if(GUILayout.Button(chainCTex,GUILayout.MinWidth(50),GUILayout.MinHeight(20)))
287  CreateColorPicker(chainCColor, "Chain C color", "chainC");
288  GUILayout.EndHorizontal();
289 
290  // New Layout line
291  GUILayout.BeginHorizontal();
292  GUILayout.Label("Chain D color");
293  if(GUILayout.Button(chainDTex,GUILayout.MinWidth(50),GUILayout.MinHeight(20)))
294  CreateColorPicker(chainDColor, "Chain D color", "chainD");
295  GUILayout.EndHorizontal();
296 
297  // New Layout line
298  GUILayout.BeginHorizontal();
299  GUILayout.Label("Chain E color");
300  if(GUILayout.Button(chainETex,GUILayout.MinWidth(50),GUILayout.MinHeight(20)))
301  CreateColorPicker(chainEColor, "Chain E color", "chainE");
302  GUILayout.EndHorizontal();
303 
304  // New Layout line
305  GUILayout.BeginHorizontal();
306  GUILayout.Label("Chain F color");
307  if(GUILayout.Button(chainFTex,GUILayout.MinWidth(50),GUILayout.MinHeight(20)))
308  CreateColorPicker(chainFColor, "Chain F color", "chainF");
309  GUILayout.EndHorizontal();
310 
311  // New Layout line
312  GUILayout.BeginHorizontal();
313  GUILayout.Label("Chain G color");
314  if(GUILayout.Button(chainGTex,GUILayout.MinWidth(50),GUILayout.MinHeight(20)))
315  CreateColorPicker(chainGColor, "Chain G color", "chainG");
316  GUILayout.EndHorizontal();
317 
318  // New Layout line
319  GUILayout.BeginHorizontal();
320  GUILayout.Label("Chain H color");
321  if(GUILayout.Button(chainHTex,GUILayout.MinWidth(50),GUILayout.MinHeight(20)))
322  CreateColorPicker(chainHColor, "Chain H color", "chainH");
323  GUILayout.EndHorizontal();
324 
325  // New Layout line
326  GUILayout.BeginHorizontal();
327  if(GUILayout.Button(new GUIContent("Apply", "Apply changes"))) {
328  AtomModel.ChangeChainColor("chainA", chainAColor.color);
329  AtomModel.ChangeChainColor("chainB", chainBColor.color);
330  AtomModel.ChangeChainColor("chainC", chainCColor.color);
331  AtomModel.ChangeChainColor("chainD", chainDColor.color);
332  AtomModel.ChangeChainColor("chainE", chainEColor.color);
333  AtomModel.ChangeChainColor("chainF", chainFColor.color);
334  AtomModel.ChangeChainColor("chainG", chainGColor.color);
335  AtomModel.ChangeChainColor("chainH", chainHColor.color);
336 
337  UIData.resetDisplay = true;
338  //BallUpdate.resetColors = true;
339  }
340  GUILayout.EndHorizontal();
341 */
342 
343  GUI.enabled = true;
344  GUI.DragWindow();
345  } // End of AdvOptions
346 
347 
348 
356  public static void Background (int a) {
357  showBackgroundType = LoadTypeGUI.SetTitleExit("Background");
358  GameObject LocCamera = GameObject.Find ("Camera");
359 
360  GUILayout.BeginHorizontal ();
361 
362  if (GUILayout.Button (new GUIContent ("1", "Lerpz background")))
363  LocCamera.GetComponent<Skybox> ().material = (Material)Resources.Load ("skybox/skyBoxLerpzMaterial");
364 
365  if (GUILayout.Button (new GUIContent ("2", "HotDesert background")))
366  LocCamera.GetComponent<Skybox> ().material = (Material)Resources.Load ("skybox/skyBoxHotDesert");
367 
368  if (GUILayout.Button (new GUIContent ("3", "Molecule background")))
369  LocCamera.GetComponent<Skybox> ().material = (Material)Resources.Load ("skybox/skyBoxmolecularMaterial");
370 
371  if (GUILayout.Button (new GUIContent ("4", "Snow background")))
372  LocCamera.GetComponent<Skybox> ().material = (Material)Resources.Load ("skybox/skyBoxSnow");
373 
374  GUILayout.EndHorizontal ();
375 
376  GUILayout.BeginHorizontal ();
377  if (GUILayout.Button (new GUIContent ("5", "DawnDusk Skybox")))
378  LocCamera.GetComponent<Skybox> ().material = (Material)Resources.Load ("skybox/DawnDusk Skybox");
379 
380  if (GUILayout.Button (new GUIContent ("6", "Eerie Skybox")))
381  LocCamera.GetComponent<Skybox> ().material = (Material)Resources.Load ("skybox/Eerie Skybox");
382 
383  if (GUILayout.Button (new GUIContent ("7", "MoonShine Skybox")))
384  LocCamera.GetComponent<Skybox> ().material = (Material)Resources.Load ("skybox/MoonShine Skybox");
385 
386  if (GUILayout.Button (new GUIContent ("8", "Overcast1 Skybox")))
387  LocCamera.GetComponent<Skybox> ().material = (Material)Resources.Load ("skybox/Overcast1 Skybox");
388 
389  GUILayout.EndHorizontal ();
390 
391  GUILayout.BeginHorizontal ();
392 
393  if (GUILayout.Button (new GUIContent ("9", "Overcast2 Skybox")))
394  LocCamera.GetComponent<Skybox> ().material = (Material)Resources.Load ("skybox/Overcast2 Skybox");
395 
396  if (GUILayout.Button (new GUIContent ("10", "StarryNight Skybox")))
397  LocCamera.GetComponent<Skybox> ().material = (Material)Resources.Load ("skybox/StarryNight Skybox");
398 
399  if (GUILayout.Button (new GUIContent ("11", "Sunny1 Skybox")))
400  LocCamera.GetComponent<Skybox> ().material = (Material)Resources.Load ("skybox/Sunny1 Skybox");
401 
402  GUILayout.EndHorizontal ();
403 
404  GUILayout.BeginHorizontal ();
405 
406  if (GUILayout.Button (new GUIContent ("12", "Sunny2 Skybox")))
407  LocCamera.GetComponent<Skybox> ().material = (Material)Resources.Load ("skybox/Sunny2 Skybox");
408 
409  if (GUILayout.Button (new GUIContent ("13", "Sunny3 Skybox")))
410  LocCamera.GetComponent<Skybox> ().material = (Material)Resources.Load ("skybox/Sunny3 Skybox");
411 
412  GUILayout.EndHorizontal ();
413 
414  if (Event.current.type == EventType.Repaint)
415  MoleculeModel.newtooltip = GUI.tooltip;
416 
417  GUI.DragWindow();
418  } // End of Background
419 
426  public static void Effects (int a) {
427  showEffectType = LoadTypeGUI.SetTitleExit("Visual Effects");
428  if(mainCamera == null)
429  mainCamera = Camera.main;
430  GUILayout.BeginHorizontal ();
431 
432  if(UIData.atomtype == UIData.AtomType.hyperball || UIData.atomtype == UIData.AtomType.optihb || UIData.bondtype == UIData.BondType.hyperstick || UIData.bondtype == UIData.BondType.optihs)
433  GUI.enabled = false;
434 
435  toggle_VE_SSAO = GUILayout.Toggle (toggle_VE_SSAO, new GUIContent ("SSAO", "Toggle screen space ambient occlusion effect"));
436  if (!toggle_VE_SSAO) {
437  if (mainCamera.GetComponent<ScreenSpaceAmbientOcclusion> ().enabled)
438  mainCamera.GetComponent<ScreenSpaceAmbientOcclusion> ().enabled = false;
439  }
440  else {
441  mainCamera.GetComponent<ScreenSpaceAmbientOcclusion>().enabled = true;
442  // mainCamera.GetComponent<ScreenSpaceAmbientOcclusion>().m_Radius = 4f;
443  // mainCamera.GetComponent<ScreenSpaceAmbientOcclusion>().m_OcclusionIntensity = 1f;
444  }
445  GUI.enabled = true;
446  GUILayout.EndHorizontal ();
447 
448  GUILayout.BeginHorizontal();
449  // if(UIData.atomtype == UIData.AtomType.hyperball || UIData.atomtype == UIData.AtomType.optihb || UIData.bondtype == UIData.BondType.hyperstick || UIData.bondtype == UIData.BondType.optihs)
450  // GUI.enabled = false;
451 
452 
453  // Make a toggle for DOF :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
454  toggle_VE_DOF = GUILayout.Toggle (toggle_VE_DOF, new GUIContent ("DOF", "Toggle depth of field effect."));
455  if (!toggle_VE_DOF && mainCamera.GetComponent<DepthOfField>().enabled) {
456  mainCamera.GetComponent<DepthOfField>().enabled = false;
457  mainCamera.GetComponent<SelectAtomFocus>().enabled = false;
458  } else if (toggle_VE_DOF && !mainCamera.GetComponent<DepthOfField>().enabled) {
459  // mainCamera.GetComponent<DepthOfField>().dofHdrShader = Shader.Find("Hidden/Dof/DepthOfFieldHdr");
460  // mainCamera.GetComponent<DepthOfField>().focalSize = 0;
461 
462  //Hyperball shaders need Z-buffer writes for this effect
463  if(UIData.atomtype == UIData.AtomType.hyperball || UIData.atomtype == UIData.AtomType.optihb || UIData.bondtype == UIData.BondType.hyperstick || UIData.bondtype == UIData.BondType.optihs){
464  if(!UIData.shadow){
465 
467  atomManager.EnableShadows();
468 
470  if(bondManager != null){
471  bondManager.EnableShadows();
472  }
473  UIData.shadow = true;
474  }
475  }
476 
477 
478  mainCamera.GetComponent<DepthOfField>().enabled = true ;
479  mainCamera.GetComponent<DepthOfField>().aperture = 0.75f;
480  Debug.Log(mainCamera.GetComponent<DepthOfField>().aperture);
481  mainCamera.GetComponent<SelectAtomFocus>().enabled = true;
482  }
483  GUI.enabled = true;
484  GUILayout.EndHorizontal ();
485 
486  GUILayout.BeginHorizontal ();
487 
488 
489  // Make a toggle for Crease :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
490  toggle_VE_CREASE = GUILayout.Toggle (toggle_VE_CREASE, new GUIContent ("Crease", "Toggle crease effect"));
491  if (!toggle_VE_CREASE && mainCamera.GetComponent<CreaseShading>().enabled)
492  mainCamera.GetComponent<CreaseShading> ().enabled = false;
493  else if (toggle_VE_CREASE && !mainCamera.GetComponent<CreaseShading> ().enabled) {
494 
495 
496  //Hyperball shaders need Z-buffer writes for this effect
497  if(UIData.atomtype == UIData.AtomType.hyperball || UIData.atomtype == UIData.AtomType.optihb || UIData.bondtype == UIData.BondType.hyperstick || UIData.bondtype == UIData.BondType.optihs){
498  if(!UIData.shadow){
499 
501  atomManager.EnableShadows();
502 
504  if(bondManager != null){
505  bondManager.EnableShadows();
506  UIData.shadow = true;
507  }
508  UIData.shadow = true;
509  }
510  }
511 
512  // mainCamera.GetComponent<CreaseShading> ().creaseApplyShader = Shader.Find("Hidden/CreaseApply");
513  mainCamera.GetComponent<CreaseShading> ().intensity = 10;
514  mainCamera.GetComponent<CreaseShading> ().enabled = true ;
515  }
516  GUI.enabled = true;
517  GUILayout.EndHorizontal ();
518 
519  GUILayout.BeginHorizontal ();
520 
521 
522  // Make a toggle for EDGE :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
523  toggle_VE2_EDGE = GUILayout.Toggle (toggle_VE2_EDGE, new GUIContent ("Edge", "Toggle edge detection effect"));
524 
525  toggle_VE2_EDGEONLY = GUILayout.Toggle (toggle_VE2_EDGEONLY, new GUIContent ("Edge Only", "Toggle edge only"));
526  if (!toggle_VE2_EDGE && mainCamera.GetComponent<EdgeDetection> ().enabled)
527  mainCamera.GetComponent<EdgeDetection> ().enabled = false;
528  else if (toggle_VE2_EDGE && !mainCamera.GetComponent<EdgeDetection> ().enabled) {
529 
530  //Hyperball shaders need Z-buffer writes for this effect
531  if(UIData.atomtype == UIData.AtomType.hyperball || UIData.atomtype == UIData.AtomType.optihb || UIData.bondtype == UIData.BondType.hyperstick || UIData.bondtype == UIData.BondType.optihs){
532  if(!UIData.shadow){
533 
535  atomManager.EnableShadows();
536 
538  if(bondManager != null){
539  bondManager.EnableShadows();
540  UIData.shadow = true;
541  }
542  UIData.shadow = true;
543  }
544  }
545 
546 
547  mainCamera.GetComponent<EdgeDetection> ().edgeDetectShader = Shader.Find ("Hidden/EdgeDetect");
548  mainCamera.GetComponent<EdgeDetection> ().enabled = true;
549  }
550  if(toggle_VE2_EDGE && mainCamera.GetComponent<EdgeDetection> ().enabled){
551  if(toggle_VE2_EDGEONLY)
552  mainCamera.GetComponent<EdgeDetection> ().edgesOnly = 1f;
553  else
554  mainCamera.GetComponent<EdgeDetection> ().edgesOnly = 0f;
555  }
556  GUILayout.EndHorizontal ();
557 
558  GUILayout.BeginHorizontal ();
559  // Make a toggle for GLOW :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
560  toggle_VE2_GLOW = GUILayout.Toggle (toggle_VE2_GLOW, new GUIContent ("Glow", "Toggle glow effect"));
561  if (!toggle_VE2_GLOW && mainCamera.GetComponent<BloomOptimized> ().enabled)
562  mainCamera.GetComponent<BloomOptimized> ().enabled = false;
563  else if (toggle_VE2_GLOW && !mainCamera.GetComponent<BloomOptimized> ().enabled) {
564  // mainCamera.GetComponent<BloomOptimized> ().compositeShader = Shader.Find ("Hidden/GlowCompose");
565  // mainCamera.GetComponent<BloomOptimized> ().blurShader = Shader.Find ("Hidden/GlowConeTap");
566  // mainCamera.GetComponent<BloomOptimized> ().downsampleShader = Shader.Find ("Hidden/Glow Downsample");
567  // mainCamera.GetComponent<BloomOptimized>().blurSize = 0.7f;
568  // mainCamera.GetComponent<BloomOptimized>().blurIterations = 3;
569  // mainCamera.GetComponent<BloomOptimized> ().intensity = 0.3f;
570  mainCamera.GetComponent<BloomOptimized> ().enabled = true;
571  }
572  GUILayout.EndHorizontal ();
573 
574  GUILayout.BeginHorizontal ();
575  // Make a toggle for CONTRAST STRETCH ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
576  toggle_VE2_CONTR = GUILayout.Toggle (toggle_VE2_CONTR, new GUIContent ("ContrastStretch", "Toggle contrast stretch effect"));
577  if (!toggle_VE2_CONTR && mainCamera.GetComponent<ContrastStretch> ().enabled)
578  mainCamera.GetComponent<ContrastStretch> ().enabled = false;
579  else if (toggle_VE2_CONTR && !mainCamera.GetComponent<Twirl> ().enabled) {
580  mainCamera.GetComponent<ContrastStretch> ().enabled = true;
581  }
582  GUILayout.EndHorizontal ();
583 
584  GUILayout.BeginHorizontal ();
585  // Make a toggle for SEPIA :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
586  toggle_VE2_SEPIA = GUILayout.Toggle (toggle_VE2_SEPIA, new GUIContent ("Sepia", "Toggle sepia tone color effect"));
587  if (!toggle_VE2_SEPIA && mainCamera.GetComponent<SepiaTone> ().enabled)
588  mainCamera.GetComponent<SepiaTone> ().enabled = false;
589  else if (toggle_VE2_SEPIA && !mainCamera.GetComponent<SepiaTone> ().enabled) {
590  mainCamera.GetComponent<SepiaTone> ().shader = Shader.Find ("Hidden/Sepiatone Effect");
591  mainCamera.GetComponent<SepiaTone> ().enabled = true;
592  }
593  GUILayout.EndHorizontal ();
594 
595  /*
596  // Make a combined toggle+button for CCORR ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
597  GUILayout.BeginHorizontal ();
598  toggle_VE2_CCORR = GUILayout.Toggle (toggle_VE2_CCORR, new GUIContent ("CCORR", "Toggle color correction ramp effect"));
599  if (!toggle_VE2_CCORR && mainCamera.GetComponent<ColorCorrectionRamp> ().enabled)
600  mainCamera.GetComponent<ColorCorrectionRamp> ().enabled = false;
601  else if (toggle_VE2_CCORR && !mainCamera.GetComponent<ColorCorrectionRamp> ().enabled) {
602  GameObject.FindWithTag ("MainCamera").AddComponent <ColorCorrectionRamp>();
603  mainCamera.GetComponent<ColorCorrectionRamp> ().enabled = true;
604  mainCamera.GetComponent<ColorCorrectionRamp> ().shader = Shader.Find ("Hidden/Grayscale Effect");
605  mainCamera.GetComponent<ColorCorrectionRamp> ().textureRamp = Resources.Load (ve2_ccorr_ramps [ve2_ccorr_rampc]) as Texture2D;
606  }
607  if (GUILayout.Button (new GUIContent ("Ramp " + ve2_ccorr_rampc, "Choose among several color correction ramps"))) {
608  ve2_ccorr_rampc += 1;
609  if (ve2_ccorr_rampc > ve2_ccorr_rampn)
610  ve2_ccorr_rampc = 0;
611 
612  if (toggle_VE2_CCORR)
613  mainCamera.GetComponent<ColorCorrectionRamp> ().textureRamp = Resources.Load (ve2_ccorr_ramps [ve2_ccorr_rampc]) as Texture2D;
614  }
615  GUILayout.EndHorizontal ();
616  */
617 
618 
619  // Make a combined toggle+button for GRAYS ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
620  GUILayout.BeginHorizontal ();
621  toggle_VE2_GRAYS = GUILayout.Toggle (toggle_VE2_GRAYS, new GUIContent ("Grays", "Toggle grayscale color effect"));
622  if (!toggle_VE2_GRAYS && mainCamera.GetComponent<Grayscale> ().enabled)
623  mainCamera.GetComponent<Grayscale> ().enabled = false;
624  else if (toggle_VE2_GRAYS && !mainCamera.GetComponent<Grayscale> ().enabled) {
625  mainCamera.GetComponent<Grayscale> ().enabled = true;
626  mainCamera.GetComponent<Grayscale> ().shader = Shader.Find ("Hidden/Grayscale Effect");
627  mainCamera.GetComponent<Grayscale> ().textureRamp = Resources.Load (ve2_grays_ramps [ve2_grays_rampc]) as Texture2D;
628  }
629  GUILayout.EndHorizontal ();
630 
631  GUILayout.BeginHorizontal ();
632  if (GUILayout.Button (new GUIContent ("Ramp " + ve2_grays_rampc, "Choose among several grayscale ramps"))) {
633  ve2_grays_rampc += 1;
634  if (ve2_grays_rampc > ve2_grays_rampn)
635  ve2_grays_rampc = 0;
636 
637  if (toggle_VE2_GRAYS)
638  mainCamera.GetComponent<Grayscale> ().textureRamp = Resources.Load (ve2_grays_ramps [ve2_grays_rampc]) as Texture2D;
639  }
640  GUILayout.EndHorizontal ();
641 
642  GUILayout.BeginHorizontal ();
643  // Make a toggle for NOISE :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
644  toggle_VE2_NOISE = GUILayout.Toggle (toggle_VE2_NOISE, new GUIContent ("Noise", "Toggle noise effect"));
645  if (!toggle_VE2_NOISE && mainCamera.GetComponent<NoiseAndScratches> ().enabled)
646  mainCamera.GetComponent<NoiseAndScratches> ().enabled = false;
647  else if (toggle_VE2_NOISE && !mainCamera.GetComponent<NoiseAndScratches> ().enabled) {
648  mainCamera.GetComponent<NoiseAndScratches> ().enabled = true;
649  // mainCamera.GetComponent<NoiseAndScratches> ().shaderRGB = Shader.Find ("Hidden/Noise Shader RGB");
650  // mainCamera.GetComponent<NoiseAndScratches> ().shaderYUV = Shader.Find ("Hidden/Noise Shader YUV");
651  // mainCamera.GetComponent<NoiseAndScratches> ().grainTexture = Resources.Load ("NoiseEffectGrain") as Texture2D;
652  // mainCamera.GetComponent<NoiseAndScratches> ().scratchTexture = Resources.Load ("NoiseEffectScratch") as Texture2D;
653  }
654  GUILayout.EndHorizontal ();
655 
656  GUILayout.BeginHorizontal ();
657  // Make a toggle for BLUR ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
658  toggle_VE_BLUR = GUILayout.Toggle (toggle_VE_BLUR, new GUIContent ("Motion Blur", "Toggle motion blur effect"));
659  if (!toggle_VE_BLUR && mainCamera.GetComponent<MotionBlur> ().enabled)
660  mainCamera.GetComponent<MotionBlur> ().enabled = false;
661  else if (toggle_VE_BLUR && !mainCamera.GetComponent<MotionBlur> ().enabled) {
662  // mainCamera.GetComponent<MotionBlur> ().shader = Shader.Find ("Hidden/MotionBlur");
663  mainCamera.GetComponent<MotionBlur> ().enabled = true;
664  }
665  GUILayout.EndHorizontal ();
666 
667  GUILayout.BeginHorizontal ();
668  // Make a toggle for BLUR2 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
669  toggle_VE2_BLUR2 = GUILayout.Toggle (toggle_VE2_BLUR2, new GUIContent ("Blur", "Toggle overall blur effect"));
670  if (!toggle_VE2_BLUR2 && mainCamera.GetComponent<BlurOptimized> ().enabled)
671  mainCamera.GetComponent<BlurOptimized> ().enabled = false;
672  else if (toggle_VE2_BLUR2 && !mainCamera.GetComponent<BlurOptimized> ().enabled) {
673  // mainCamera.GetComponent<BlurOptimized> ().blurShader = Shader.Find ("Hidden/BlurEffectConeTap");
674  mainCamera.GetComponent<BlurOptimized> ().enabled = true;
675  }
676  GUILayout.EndHorizontal ();
677 
678  GUILayout.BeginHorizontal ();
679  // Make a toggle for TWIRL :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
680  toggle_VE2_TWIRL = GUILayout.Toggle (toggle_VE2_TWIRL, new GUIContent ("Twirl", "Toggle twirl deformation effect"));
681  if (!toggle_VE2_TWIRL && mainCamera.GetComponent<Twirl> ().enabled)
682  mainCamera.GetComponent<Twirl> ().enabled = false;
683  else if (toggle_VE2_TWIRL && !mainCamera.GetComponent<Twirl> ().enabled) {
684  mainCamera.GetComponent<Twirl> ().shader = Shader.Find ("Hidden/Twirt Effect Shader");
685  mainCamera.GetComponent<Twirl> ().enabled = true;
686  }
687  GUILayout.EndHorizontal ();
688 
689  GUILayout.BeginHorizontal ();
690  // Make a toggle for VORTX :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
691  toggle_VE2_VORTX = GUILayout.Toggle (toggle_VE2_VORTX, new GUIContent ("Vortex", "Toggle vortex deformation effect"));
692  if (!toggle_VE2_VORTX && mainCamera.GetComponent<Vortex> ().enabled)
693  mainCamera.GetComponent<Vortex> ().enabled = false;
694  else if (toggle_VE2_VORTX && !mainCamera.GetComponent<Vortex> ().enabled) {
695  mainCamera.GetComponent<Vortex> ().shader = Shader.Find ("Hidden/Twist Effect");
696  mainCamera.GetComponent<Vortex> ().enabled = true;
697  }
698  GUILayout.EndHorizontal ();
699 
700 
701 
702 
703 
704  showBackgroundType = false;
705  LoadTypeGUI.showGrayColor = false;
706 // ParamshowFieldLine=false;
708 
709 
710 // GUI.Label ( new Rect(120,Screen.height-35,Screen.width-360,20), GUI.tooltip);
711  if (Event.current.type == EventType.Repaint)
712  MoleculeModel.newtooltip = GUI.tooltip;
713 
714  GUI.DragWindow();
715  } // End of Effects
716 
717 
721  private static void LoadScreenShot () {
722  GUILayout.BeginHorizontal();
723  if (GUILayout.Button (new GUIContent ("ScreenShot", "Capture the screen and save image to the original file path"))) {
724  GameObject LocCamera = Camera.main.gameObject;
725  ScreenShot comp = LocCamera.GetComponent<ScreenShot> ();
726  comp.open = true;
727  }
728 
729  UIData.backGroundTrans = GUILayout.Toggle (UIData.backGroundTrans, new GUIContent ("Transparent background", "Transparent background without UI"));
730 
731 
732  GUILayout.EndHorizontal();
734 
735  if (GUILayout.Button (new GUIContent ("ScreenShot Sequence", "Capture the screen sequentially and save images to the original file path"))) {
736  GameObject LocCamera = Camera.main.gameObject;
737  ScreenShot comp = LocCamera.GetComponent<ScreenShot> ();
738  comp.sequence = !comp.sequence;
739  comp.open = comp.sequence;
740  comp.idseq = id_screenshot_sequence/2;
741  id_screenshot_sequence++;
742  }
743  if (Event.current.type == EventType.Repaint)
744  MoleculeModel.newtooltip = GUI.tooltip;
745  } // End of LoadScreenShot
746 
747 
748 
752  private static void BackGroundControl () {
753  GUILayout.BeginHorizontal ();
754 
755  GUILayout.Label (new GUIContent ("BackGround", "Toggle the use of a skybox on/off"), GUILayout.MaxWidth (120));
756  bool tmpback = UIData.backGroundIs;
757  UIData.backGroundIs = GUILayout.Toggle (UIData.backGroundIs, new GUIContent ("Yes", "Toggle the use of a skybox to ON"));
759 
760  UIData.backGroundNo = GUILayout.Toggle (UIData.backGroundNo, new GUIContent ("No", "Toggle the use of a skybox to OFF"));
762 
763  GUILayout.EndHorizontal ();
764 
765  if(tmpback != UIData.backGroundIs)
766  // MB: only show possibility to change skybox if it is set to on
767  showBackgroundType = UIData.backGroundIs ;
768 
769  if (Event.current.type == EventType.Repaint)
770  MoleculeModel.newtooltip = GUI.tooltip;
771  }
772 
773 
774 
778  private static void BackColor () {
780  GUILayout.BeginHorizontal ();
781  if (GUILayout.Button (new GUIContent ("White", "Set background to plain white")))
782  LoadTypeGUI.BackgroundColor.color = new Color(1,1,1,0);
783 
784  if(GUILayout.Button(new GUIContent ("Grey", "Set background color to grey")))
785  LoadTypeGUI.BackgroundColor.color = Color.gray;
786 
787  if (GUILayout.Button (new GUIContent ("Black", "Set background color to plain black")))
788  LoadTypeGUI.BackgroundColor.color = Color.black;
789  GUILayout.EndHorizontal ();
790 
791 
792  GUILayout.BeginHorizontal ();
793  if (GUILayout.Button (new GUIContent ("Background Color", "Choose the background color"))) {
794  if (LoadTypeGUI.m_colorPicker != null)
795  LoadTypeGUI.m_colorPicker = null;
796 
797  LoadTypeGUI.m_colorPicker = new ColorPicker(Rectangles.colorPickerRect, LoadTypeGUI.BackgroundColor, null, "All", "All", "Background Color");
798  }
799  GUILayout.EndHorizontal ();
800 
801 
802  if (Event.current.type == EventType.Repaint)
803  MoleculeModel.newtooltip = GUI.tooltip;
804  }
805 
806 
807 }
static void BackColor()
Defines the GUI components for setting the BackGround color.
static string[] ve2_ccorr_ramps
void ReadFile(string file_name)
Definition: ReadDX.cs:122
void Revert()
Reverts the molecule to its original colors, that is before the Depth Cueing effect was applied...
static bool isEnabled
static void Background(int a)
Defines the Background selection window.
static float oldGuiScale
Definition: GUIDisplay.cs:102
static Rect colorPickerRect
Definition: Rectangles.cs:246
static ColorPicker m_colorPicker
static Vector3 Offset
The offset for the molecule.
static string file_base_name
Definition: GUIDisplay.cs:120
void Occlude()
Perfoms the actual Ambient Occlusion operations.
static bool backGroundNo
Definition: UIData.cs:129
static int advOptWidth
Definition: Rectangles.cs:250
static void Scale()
Scales all rectangles according to the new guiScale value input by the user.
Definition: Rectangles.cs:439
static ColorObject BackgroundColor
Color color
Definition: ColorObject.cs:72
bool sequence
Definition: ScreenShot.cs:82
static bool backGroundTrans
Definition: UIData.cs:130
static void LoadScreenShot()
Loads the GUI components for taking screenshots in the display window.
void Revert()
Reverts the molecule to its original colors, that is before the Depth Cueing effect was applied...
Definition: DepthCueing.cs:180
static float guiScale
Definition: GUIDisplay.cs:101
override void Init()
Initializes this instance.
static bool reset
Definition: DepthCueing.cs:81
static float LabelSlider(float sliderValue, float sliderMinValue, float sliderMaxValue, string labelText, string toolTip, bool enable, int sliderwidth, int labelwidth=100, bool newLine=false)
static bool isEnabled
Definition: DepthCueing.cs:80
static void Effects(int a)
Defines the Effect selection window for SSAO, DOF, etc.
!WiP Includes FLAGS of GUI.
Definition: UIData.cs:78
static void AdvOptions(int a)
Defines the advanced options menu window, which is opened from the main menu window.
static bool SetTitleExit(string s)
This is a somewhat odd but very convenient function.
Definition: LoadTypeGUI.cs:153
static BondType bondtype
Definition: UIData.cs:141
bool open
Definition: ScreenShot.cs:81
!WiP manage GUI, and provide static strings for the GUI.
Definition: GUIDisplay.cs:94
static bool backGroundIs
Definition: UIData.cs:128
static void BackGroundControl()
Defines the GUI components that allow for background color control in the display menu...
static AmbientOcclusion ambientOcclusion
void Darken()
Darkens the molecule.
Definition: DepthCueing.cs:141
static AtomType atomtype
Definition: UIData.cs:139
static GenericManager getCurrentBondManager()
Definition: UnityMolMain.cs:54
static DepthCueing depthCueing
void Clear()
Clears this instance.
Definition: Volumetric.cs:105
static string[] ve2_grays_ramps
static bool shadow
Definition: UIData.cs:198
abstract void EnableShadows()
Definition: GUIDisplay.cs:66
static GenericManager getCurrentAtomManager()
Definition: UnityMolMain.cs:50