Пример #1
0
 IEnumerator SaveTimer()
 {
     saveTimerIsRunning = true;
     while (saveTimerFloat > 0)
     {
         saveTimerFloat -= Time.deltaTime;
         yield return(null);
     }
     HoloPlay.SaveConfigToFile();
     saveTimerIsRunning = false;
 }
Пример #2
0
        void OnEnable()
        {
            //setup the static ref
            Main = this;

            //tiles default
            tilesX = 4;
            tilesY = 8;

            //setup the main camera: this is the child that pivots around the focal pane
            Transform holoPlayCamChild = transform.Find("HoloPlay Camera");

            if (holoPlayCamChild == null)
            {
                holoPlayCamChild        = new GameObject("HoloPlay Camera", typeof(Camera)).transform;
                holoPlayCamChild.parent = transform;
                var lc = holoPlayCamChild.GetComponent <Camera>();
                lc.clearFlags      = CameraClearFlags.Color;
                lc.backgroundColor = Color.black;
            }
            Cam = holoPlayCamChild.GetComponent <Camera>();
            Cam.transform.hideFlags = HideFlags.NotEditable;

            //setup final camera. this is the camera which does the final render
            camFinal = GetComponent <Camera>();
            if (camFinal == null)
            {
                gameObject.AddComponent <Camera>();
            }
            camFinal.useOcclusionCulling = false;
            // camFinal.allowHDR = false;
            // camFinal.allowMSAA = false;
            camFinal.cullingMask      = 0;
            camFinal.clearFlags       = CameraClearFlags.Nothing;
            camFinal.backgroundColor  = Color.black;
            camFinal.orthographic     = true;
            camFinal.orthographicSize = 0.001f;
            camFinal.nearClipPlane    = 0;
            camFinal.farClipPlane     = 0.001f;
            camFinal.stereoTargetEye  = StereoTargetEyeMask.None;

            //setup material to post-process the final cam
            matFinal             = new Material(Shader.Find("Hidden/HoloPlay/HoloPlay Final"));
            matFinal.mainTexture = rtFinal;

            //setup textures used in the tests
            if (colorTestTex == null)
            {
                colorTestTex = (Texture2D)Resources.Load("HoloPlay_colorTestTex__");
            }
            if (numTestTex == null)
            {
                numTestTex = (Texture2D)Resources.Load("HoloPlay_numTestTex__");
            }

            //enforce the one-active-at-a-time rule
            var otherHoloPlay = FindObjectsOfType <HoloPlay>();

            if (otherHoloPlay.Length > 0)
            {
                bool displayMsg = false;
                for (int i = 0; i < otherHoloPlay.Length; i++)
                {
                    if (otherHoloPlay[i].gameObject != gameObject)
                    {
                        otherHoloPlay[i].gameObject.SetActive(false);
                        displayMsg = true;
                    }
                }
                if (displayMsg)
                {
                    Debug.LogWarning(warningText +
                                     "Can only have one active HoloPlay at a time! disabling all others."
                                     );
                }
            }

            //if the config isn't loaded yet, load it
            if (Config == null)
            {
                LoadConfig();
            }
            else
            {
                ForceCalibrationRefresh();
            }

            //read command line arguments to determine if we were launched by launcher
            comArgs = System.Environment.GetCommandLineArgs();
            foreach (var arg in comArgs)
            {
                if (!Application.isEditor)
                {
                    Debug.Log("com arg: " + arg);
                }
                if (arg == HoloPlayLauncher.quitToLauncherArg)
                {
                    quitToLauncher = true;
                }
            }
        }
Пример #3
0
 public void LoadConfig()
 {
     HoloPlay.LoadConfig();
 }
Пример #4
0
 public void SaveConfig()
 {
     HoloPlay.SaveConfigToFile();
 }
Пример #5
0
 public void LoadConfig()
 {
     HoloPlay.InitializeConfig();
 }
Пример #6
0
        void OnEnable()
        {
            //setup the static ref
            Main = this;

            //setup the main camera: this is the child that pivots around the focal pane
            Transform holoPlayCamChild = transform.Find("HoloPlay Camera");

            if (holoPlayCamChild == null)
            {
                holoPlayCamChild        = new GameObject("HoloPlay Camera", typeof(Camera)).transform;
                holoPlayCamChild.parent = transform;
                var lc = holoPlayCamChild.GetComponent <Camera>();
                lc.clearFlags      = CameraClearFlags.Color;
                lc.backgroundColor = Color.black;
            }
            Cam = holoPlayCamChild.GetComponent <Camera>();
            Cam.transform.hideFlags = HideFlags.NotEditable;

            //setup final camera. this is the camera which does the final render
            camFinal = GetComponent <Camera>();
            if (camFinal == null)
            {
                gameObject.AddComponent <Camera>();
            }
            camFinal.useOcclusionCulling = false;
            // camFinal.allowHDR = false;
            // camFinal.allowMSAA = false;
            camFinal.cullingMask      = 0;
            camFinal.clearFlags       = CameraClearFlags.Nothing;
            camFinal.backgroundColor  = Color.black;
            camFinal.orthographic     = true;
            camFinal.orthographicSize = 0.001f;
            camFinal.nearClipPlane    = 0;
            camFinal.farClipPlane     = 0.001f;
            camFinal.hideFlags        = HideFlags.HideInInspector;

            //setup material to post-process the final cam
            matFinal             = new Material(Shader.Find("Hidden/HoloPlay/HoloPlay Final"));
            matFinal.mainTexture = rtFinal;

            //setup textures used in the tests
            if (colorTestTex == null)
            {
                colorTestTex = (Texture2D)Resources.Load("HoloPlay_colorTestTex__");
            }
            if (numTestTex == null)
            {
                numTestTex = (Texture2D)Resources.Load("HoloPlay_numTestTex__");
            }

            //enforce the one-active-at-a-time rule
            var otherHoloPlay = FindObjectsOfType <HoloPlay>();

            if (otherHoloPlay.Length > 0)
            {
                bool displayMsg = false;
                for (int i = 0; i < otherHoloPlay.Length; i++)
                {
                    if (otherHoloPlay[i].gameObject != gameObject)
                    {
                        otherHoloPlay[i].gameObject.SetActive(false);
                        displayMsg = true;
                    }
                }
                if (displayMsg)
                {
                    Debug.LogWarning(warningText +
                                     "Can only have one active HoloPlay at a time! disabling all others.");
                }
            }

            //if the config isn't loaded yet, load it
            if (Config == null)
            {
                InitializeConfig();
            }
            else
            {
                ForceCalibrationRefresh();
            }
        }