Ejemplo n.º 1
0
        private void EncoderSetup()
        {
#if VIMEO_LOOKING_GLASS_SUPPORT
            if (_recorder.captureLookingGlassRT)
            {
                Quilt quilt = GetHoloPlayQuilt();
                if (quilt != null)
                {
                    _recorder.renderTextureTarget = quilt.quiltRT;

    #if VIMEO_AVPRO_CAPTURE_SUPPORT
                    if (_recorder.encoderType == EncoderType.AVProMovieCapture && _recorder.avproEncoder != null)
                    {
                        RenderHeads.Media.AVProMovieCapture.CaptureFromTexture avproTexture = _recorder.avproEncoder.gameObject.GetComponent <RenderHeads.Media.AVProMovieCapture.CaptureFromTexture>();
                        if (avproTexture != null)
                        {
                            avproTexture.SetSourceTexture(_recorder.renderTextureTarget);
                        }
                        else
                        {
                            Debug.LogError("[VimeoRecorder] In order to use AVPro and HoloPlay together, you need to use the CaptureFromTexture component.");
                        }
                    }
    #endif // VIMEO_AVPRO_CAPTURE_SUPPORT
                }
                else
                {
                    Debug.LogError("[VimeoRecorer] HoloPlay SDK was not found.");
                }
            }
#endif // VIMEO_LOOKING_GLASS_SUPPORT
        }
Ejemplo n.º 2
0
 public void RemoveCapture(Quilt quilt)
 {
     Undo.RegisterFullObjectHierarchyUndo(quilt, "Remove Capture");
     if (quilt.captures.Length == 0)
     {
         Debug.Log(Misc.debugText + "No Captures to remove!");
     }
     else
     {
         var newCaptures = new Capture[quilt.captures.Length - 1];
         if (quilt.captures.Length == 1)
         {
             if (quilt.captures[quilt.captures.Length - 1] != null)
             {
                 Undo.DestroyObjectImmediate(quilt.captures[quilt.captures.Length - 1]);
                 Undo.DestroyObjectImmediate(quilt.captures[quilt.captures.Length - 1].Cam.gameObject);
             }
         }
         else
         {
             for (int i = 0; i < quilt.captures.Length - 1; i++)
             {
                 newCaptures[i] = quilt.captures[i];
             }
             if (quilt.captures[quilt.captures.Length - 1] != null)
             {
                 Undo.DestroyObjectImmediate(quilt.captures[quilt.captures.Length - 1].gameObject);
             }
         }
         quilt.captures = newCaptures;
     }
 }
Ejemplo n.º 3
0
        public void TestQuiltValidate()
        {
            var  quilt  = new Quilt();
            bool bValid = quilt.Validate();

            Assert.IsFalse(bValid);
        }
Ejemplo n.º 4
0
        static Bitmap GetImageInBBAsync(Quilt quilt, double latitude1, double longitude1, double latitude2, double longitude2, int maxLevelofDetail)
        {
            Task drawQuilt = RecursivelyGetImageinBBAsync(latitude1, longitude1, latitude2, longitude2, quilt, "");

            drawQuilt.Wait();
            return(quilt.GetImage());
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            double minLatitudeInput  = 0;
            double minLongitudeInput = 0;
            double maxLatitudeInput  = 0;
            double maxLongitudeInput = 0;
            int    maxLevelOfDetail  = 1; // between 1 and 23
            string imagePath         = "";
            Quilt  quilt;

            // get user input
            Console.WriteLine("Enter q for any input to quit.");
            while (true)
            {
                minLatitudeInput  = GetUserInput <double>("Enter the minimum latitude value of the desired bounding box: ");
                minLongitudeInput = GetUserInput <double>("Enter the minimum longitude value of the desired bounding box: ");
                maxLatitudeInput  = GetUserInput <double>("Enter the maximum latitude value of the desired bounding box: ");
                maxLongitudeInput = GetUserInput <double>("Enter the maximum longitude value of the desired bounding box: ");
                maxLevelOfDetail  = GetUserInput <int>("Enter the maximum level of detail (1-23): ");

                // correct values before sending them to get bounding box
                if (maxLevelOfDetail > 21)
                {
                    maxLevelOfDetail = 21;
                }
                else if (maxLevelOfDetail < 1)
                {
                    maxLevelOfDetail = 1;
                }
                TileSystem.Clip(minLatitudeInput, TileSystem.MinLatitude, TileSystem.MaxLatitude);
                TileSystem.Clip(minLongitudeInput, TileSystem.MinLongitude, TileSystem.MaxLongitude);

                try
                {
                    quilt = new Quilt(minLatitudeInput, minLongitudeInput, maxLatitudeInput, maxLongitudeInput, maxLevelOfDetail);
                    break;
                }
                catch (Exception)
                {
                    Console.WriteLine("Bounding Box invalid (too large or zero).");
                }
            }
            imagePath = GetUserInput <string>("Enter the absolute path to the directory you would like the image saved in: ");
            Console.WriteLine("Fetching images... (this may take some time)");
            // Bitmap image = GetImageInBBAsync(41.78, -87.7, 41.783, -87.705);
            // my absolute path = C:\Users\Julianna\Documents\Documents\Academic\CS 513 Windows\CS 513 Repository HW 3\CS513-Homework3
            Bitmap image = GetImageInBBAsync(quilt, minLatitudeInput, minLongitudeInput, maxLatitudeInput, maxLongitudeInput, maxLevelOfDetail);

            image.Save(imagePath + "/BoundingBoxImage.png", ImageFormat.Png);
        }
    void Start()
    {
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
        window = gameObject.AddComponent <WindowController>();
        window.enableFileDrop = true;
        window.enableDragMove = false;
#endif
        if (window != null)
        {
            window.OnFilesDropped += Window_OnFilesDropped;
        }

        quilt         = FindObjectOfType <Quilt>();
        defaultTiling = quilt.tiling;   // Tilingの初期設定
    }
Ejemplo n.º 7
0
    // Use this for initialization
    void Start()
    {
        // ファイルドロップなどを扱うためのWindowControllerインスタンスを取得
        window = FindObjectOfType <WindowController>();
        window.OnFilesDropped += Window_OnFilesDropped;

        // Quiltのインスタンスを取得
        quilt         = FindObjectOfType <Quilt>();
        defaultTiling = quilt.tiling;   // Tilingの初期設定を記憶しておく

        // フレームレートを下げる
        Application.targetFrameRate = 15;

        // サンプルの画像を読み込み
        LoadFile(Path.Combine(Application.streamingAssetsPath, "startup.png"), true);
    }
Ejemplo n.º 8
0
        public void TestQuiltUpdateList()
        {
            using (var db = new QulltContext())
            {
                bool bFoundQuilt = false;
                var  find_query  = from query_quilts in db.Quilts
                                   orderby query_quilts.Name
                                   select query_quilts;
                foreach (var item in find_query)
                {
                    if (item.Name == "CreateQuiltTest Name")
                    {
                        bFoundQuilt = true;
                        break;
                    }
                }

                Assert.IsTrue(bFoundQuilt);

                if (bFoundQuilt == true)
                {
                    Quilt modq = db.Quilts.First(i => i.Name == "CreateQuiltTest Name");
                    modq.Name = "CreateQuiltTest Name New";
                    db.SaveChanges();
                    // Display all Quilts/Orders/Recipients from the database
                    var query = from q in db.Quilts
                                orderby q.Description
                                select q;
                    int item_count = 0;
                    foreach (var item in query)
                    {
                        item_count++;
                    }
                    Assert.IsTrue(item_count > 0);
                    // put it back
                    Quilt modq_2 = db.Quilts.First(i => i.Name == "CreateQuiltTest Name New");
                    modq_2.Name = "CreateQuiltTest Name";
                    db.SaveChanges();
                }
            }
        }
Ejemplo n.º 9
0
        public void AddCapture(Quilt quilt)
        {
            Undo.RegisterFullObjectHierarchyUndo(quilt, "Add Capture");
            var newCaptures = new Capture[quilt.captures.Length + 1];
            int i           = 0;

            if (quilt.captures.Length == 0)
            {
                newCaptures[i] = Undo.AddComponent <Capture>(quilt.gameObject);
            }
            else
            {
                foreach (var c in captures)
                {
                    newCaptures[i] = quilt.captures[i];
                    i++;
                }
                newCaptures[i] = new GameObject("HoloPlay Capture " + (i + 1), typeof(Capture)).GetComponent <Capture>();
                Undo.RegisterCreatedObjectUndo(newCaptures[i].gameObject, "Add Capture");
            }
            quilt.captures = newCaptures;
        }
Ejemplo n.º 10
0
        public void TestDesignBlockUpdateList()
        {
            using (var db = new QulltContext())
            {
                bool bFoundQuilt = false;
                var  find_query  = from query_quilts in db.Quilts
                                   orderby query_quilts.Name
                                   select query_quilts;
                foreach (var item in find_query)
                {
                    if (item.Name == "CreateQuiltTest Name")
                    {
                        bFoundQuilt = true;
                        break;
                    }
                }

                Assert.IsTrue(bFoundQuilt);

                if (bFoundQuilt == true)
                {
                    Quilt       q    = db.Quilts.First(i => i.Name == "CreateQuiltTest Name");
                    DesignBlock modb = q.DesignBlock;
                    modb.Description = "New Description";
                    db.SaveChanges();
                    // Display all Quilts/Orders/Recipients from the database
                    var query = from dblock in db.DesignBlocks
                                orderby dblock.Description
                                select dblock;
                    int item_count = 0;
                    foreach (var item in query)
                    {
                        item_count++;
                    }
                    Assert.IsTrue(item_count > 0);
                }
            }
        }
Ejemplo n.º 11
0
        public void TestRecipientUpdateList()
        {
            using (var db = new QulltContext())
            {
                bool bFoundQuilt = false;
                var  find_query  = from query_quilts in db.Quilts
                                   orderby query_quilts.Name
                                   select query_quilts;
                foreach (var item in find_query)
                {
                    if (item.Name == "CreateQuiltTest Name")
                    {
                        bFoundQuilt = true;
                        break;
                    }
                }

                Assert.IsTrue(bFoundQuilt);

                if (bFoundQuilt == true)
                {
                    Quilt     q    = db.Quilts.First(i => i.Name == "CreateQuiltTest Name");
                    Recipient modr = q.Order.Recipient;
                    modr.Address1 = "987 Main St";
                    db.SaveChanges();
                    // Display all Quilts/Orders/Recipients from the database
                    var query = from r in db.Recipients
                                orderby r.Address1
                                select r;
                    int item_count = 0;
                    foreach (var item in query)
                    {
                        item_count++;
                    }
                    Assert.IsTrue(item_count > 0);
                }
            }
        }
Ejemplo n.º 12
0
 void OnEnable()
 {
     quilt = GetComponent <Quilt>();
 }
Ejemplo n.º 13
0
            public override void OnInspectorGUI()
            {
                serializedObject.Update();
                Quilt quilt = (Quilt)target;

                EditorGUILayout.Space();

                GUI.color = Misc.guiColor;
                EditorGUILayout.LabelField("- Quilt -", EditorStyles.whiteMiniLabel);
                GUI.color = Color.white;

                GUI.enabled = false;
                EditorGUILayout.PropertyField(quiltRT);
                GUI.enabled = true;

                advancedFoldout.boolValue = EditorGUILayout.Foldout(
                    advancedFoldout.boolValue,
                    "Advanced",
                    true
                    );
                if (advancedFoldout.boolValue)
                {
                    EditorGUI.indentLevel++;

                    EditorGUILayout.PropertyField(captures, true);
                    EditorGUILayout.PropertyField(overrideQuilt);
                    // EditorGUILayout.PropertyField(overrideViews, true);
                    EditorGUILayout.PropertyField(renderOverrideBehind);
                    EditorGUILayout.PropertyField(debugPrintoutKey);
                    EditorGUILayout.PropertyField(screenshot2DKey);
                    EditorGUILayout.PropertyField(screenshot3DKey);
                    EditorGUILayout.PropertyField(forceConfigResolution);

                    List <string> tilingPresetNames = new List <string>();
                    foreach (var p in Quilt.tilingPresets)
                    {
                        tilingPresetNames.Add(p.presetName);
                    }
                    tilingPresetNames.Add("Default (determined by quality setting)");
                    tilingPresetNames.Add("Custom");

                    EditorGUI.BeginChangeCheck();
                    tilingPresetIndex.intValue = EditorGUILayout.Popup(
                        "Tiling",
                        tilingPresetIndex.intValue,
                        tilingPresetNames.ToArray()
                        );
                    if (EditorGUI.EndChangeCheck())
                    {
                        serializedObject.ApplyModifiedProperties();
                    }

                    // if it's a custom
                    int custom = Quilt.tilingPresets.Length + 1;
                    if (tilingPresetIndex.intValue == custom)
                    {
                        EditorGUI.BeginChangeCheck();
                        EditorGUILayout.PropertyField(tilesX);
                        EditorGUILayout.PropertyField(tilesY);
                        EditorGUILayout.PropertyField(quiltW);
                        EditorGUILayout.PropertyField(quiltH);
                        if (EditorGUI.EndChangeCheck())
                        {
                            quilt.ApplyPreset();
                        }
                    }

                    string tilingDisplay = numViews.displayName + ": " + numViews.intValue.ToString() + "\n";
                    tilingDisplay += "Tiles: " + tilesX.intValue + " x " + tilesY.intValue.ToString() + "\n";
                    tilingDisplay += "Quilt Size: " + quiltW.intValue.ToString() + " x " +
                                     quiltH.intValue.ToString() + " px" + "\n";
                    tilingDisplay += "Tile Size: " + tileSizeX.intValue.ToString() + " x " +
                                     tileSizeY.intValue.ToString() + " px";

                    EditorGUILayout.LabelField(tilingDisplay, EditorStyles.helpBox);

                    // on quilt setup event
                    EditorGUILayout.PropertyField(onQuiltSetup);

                    EditorGUI.indentLevel--;
                }

                EditorGUILayout.Space();

                GUI.color = Misc.guiColor;
                EditorGUILayout.LabelField("- Preview -", EditorStyles.whiteMiniLabel);
                GUI.color = Color.white;

                EditorGUILayout.PropertyField(renderIn2D);

                string previewerShortcutKey = "Ctrl + E";
                string settingsShortcutKey  = "Ctrl + Shift + E";

#if UNITY_EDITOR_OSX
                previewerShortcutKey = "⌘E";
                settingsShortcutKey  = "⌘^E";
#endif

                if (GUILayout.Button(new GUIContent(
                                         "Toggle Preview (" + previewerShortcutKey + ")",
                                         "If your LKG device is set up as a second display, " +
                                         "this will generate a game window on it to use as a " +
                                         "realtime preview"),
                                     EditorStyles.miniButton
                                     ))
                {
                    PreviewWindow.ToggleWindow();
                }

                if (GUILayout.Button(new GUIContent(
                                         "Settings (" + settingsShortcutKey + ")",
                                         "Use to set previewer position"),
                                     EditorStyles.miniButton
                                     ))
                {
                    EditorApplication.ExecuteMenuItem("HoloPlay/Preview Settings");
                }

                EditorGUILayout.Space();

                GUI.color = Misc.guiColor;
                EditorGUILayout.LabelField("- Config -", EditorStyles.whiteMiniLabel);
                GUI.color = Color.white;

#if CALIBRATOR
                EditorGUILayout.PropertyField(config, true);
#endif

                if (GUILayout.Button(new GUIContent(
                                         "Reload Config",
                                         "Reload the config, only really necessary if " +
                                         "you edited externally and the new config settings won't load"),
                                     EditorStyles.miniButton
                                     ))
                {
                    quilt.LoadConfig();
                }

                EditorGUILayout.Space();

                GUI.color = Misc.guiColor;
                EditorGUILayout.LabelField("- Project Settings -", EditorStyles.whiteMiniLabel);
                GUI.color = Color.white;

                if (GUILayout.Button(new GUIContent(
                                         "Optimization Settings",
                                         "Open a window that will let you select project settings " +
                                         "to be optimized for best performance with HoloPlay"),
                                     EditorStyles.miniButton
                                     ))
                {
                    OptimizationSettings window = EditorWindow.GetWindow <OptimizationSettings>();
                    window.Show();
                }

                EditorGUILayout.Space();

                serializedObject.ApplyModifiedProperties();
            }
Ejemplo n.º 14
0
        public void TestQuiltDeleteCreate()
        {
            using (var db = new QulltContext())
            {
                bool bFoundQuilt = false;
                var  find_query  = from query_quilts in db.Quilts
                                   orderby query_quilts.Name
                                   select query_quilts;
                foreach (var item in find_query)
                {
                    if (item.Name == "CreateQuiltTest Name")
                    {
                        bFoundQuilt = true;
                    }
                }

                if (bFoundQuilt == true)
                {
                    Quilt       xq = db.Quilts.First(i => i.Name == "CreateQuiltTest Name");
                    DesignBlock xb = xq.DesignBlock;
                    Order       xo = xq.Order;
                    Recipient   xr = xo.Recipient;

                    List <Award> listAward = xq.Awards.ToList();
                    foreach (var item in listAward)
                    {
                        db.Awards.Remove(item);
                    }

                    List <BOM> listBom = xq.BOMs.ToList();
                    foreach (var item in listBom)
                    {
                        db.BOMs.Remove(item);
                    }

                    db.Quilts.Remove(xq);
                    db.DesignBlocks.Remove(xb);
                    db.Orders.Remove(xo);
                    db.Recipients.Remove(xr);

                    db.SaveChanges();
                }

                // Create and save a new quilt et al
                // Quilt
                var quilt_desc = "CreateQuiltTest Description";
                var quilt_name = "CreateQuiltTest Name";
                // Order
                var order_desc  = "CreateQuiltTest Order Description";
                var order_start = "05/01/2013";
                var order_end   = "05/21/2013";
                // Recipient
                var rec_fn   = "Fred";
                var rec_ln   = "Smith";
                var rec_a1   = "123";
                var rec_a2   = "Elm";
                var rec_type = "Individual";
                // Design Block
                var dblock_desc    = "sunflower";
                var dblock_genesis = "CreateQuiltTest Name";
                //
                var order = new Order {
                    Description = order_desc, StartDate = order_start, EndDate = order_end
                };
                var quilt = new Quilt {
                    Name = quilt_name, Description = quilt_desc
                };
                var recipient = new Recipient {
                    FirstName = rec_fn, LastName = rec_ln, Address1 = rec_a1, Address2 = rec_a2, Type = rec_type
                };
                var dblock = new DesignBlock {
                    Genesis = dblock_genesis, Description = dblock_desc
                };
                //
                var qid = quilt.QuiltId;        // do I have to mess with these ?
                var oid = order.OrderId;
                var rid = recipient.RecipientId;
                var bib = dblock.DesignBlockId;
                //
                quilt.Order       = order;
                order.Quilt       = quilt;
                order.Recipient   = recipient;      // this seems clumsy
                quilt.DesignBlock = dblock;
                //
                db.Orders.Add(order);
                db.Quilts.Add(quilt);
                db.Recipients.Add(recipient);
                db.DesignBlocks.Add(dblock);
                //
                var awd = new Award();
                awd.AwardingBody = "Hancock Fabric";
                awd.DateOfAward  = "5/22/2008";
                awd.Description  = "Blue Ribbon";

                quilt.Awards.Add(awd);
                db.Awards.Add(awd);
                //
                var bom = new BOM();
                bom.TypeOfItem  = "Border Squares";
                bom.Count       = "35";
                bom.Description = "Yellow fabric with orange edges";

                quilt.BOMs.Add(bom);
                db.BOMs.Add(bom);
                //
                //
                db.SaveChanges();
                //
                // Display all Quilts from the database
                bool bFoundName = false;
                var  query      = from q in db.Quilts
                                  orderby q.Name
                                  select q;
                // it should be there
                foreach (var item in query)
                {
                    if (item.Name == "CreateQuiltTest Name")
                    {
                        bFoundName = true;
                    }
                }
                Assert.IsTrue(bFoundName);
            }
        }
Ejemplo n.º 15
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            Quilt quilt = (Quilt)target;

            EditorGUILayout.Space();

            GUI.color = Misc.guiColor;
            EditorGUILayout.LabelField("- Quilt -", EditorStyles.whiteMiniLabel);
            GUI.color = Color.white;

            GUI.enabled = false;
            EditorGUILayout.PropertyField(quiltRT);
            GUI.enabled = true;

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("Take 2D Screenshot", EditorStyles.miniButton))
            {
                quilt.Screenshot2D();
            }
            if (GUILayout.Button("Take 3D Screenshot", EditorStyles.miniButton))
            {
                quilt.Screenshot3D();
            }
            EditorGUILayout.EndHorizontal();

            advancedFoldout.boolValue = EditorGUILayout.Foldout(
                advancedFoldout.boolValue,
                "Advanced",
                true
                );
            if (advancedFoldout.boolValue)
            {
                EditorGUI.indentLevel++;

                GUI.color = Misc.guiColor;
                EditorGUILayout.LabelField("- Captures -", EditorStyles.whiteMiniLabel);
                GUI.color = Color.white;

                EditorGUILayout.PropertyField(captures, true);
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("Add Capture", EditorStyles.miniButton))
                {
                    AddCapture(quilt);
                    EditorUtility.SetDirty(quilt);
                }
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                }
                EditorGUI.BeginChangeCheck();
                if (GUILayout.Button("Remove Capture", EditorStyles.miniButton))
                {
                    RemoveCapture(quilt);
                    EditorUtility.SetDirty(quilt);
                }
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.Space();

                GUI.color = Misc.guiColor;
                EditorGUILayout.LabelField("- Quilt Settings -", EditorStyles.whiteMiniLabel);
                GUI.color = Color.white;

                EditorGUILayout.PropertyField(overrideQuilt);
                // EditorGUILayout.PropertyField(overrideViews, true);
                EditorGUILayout.PropertyField(renderOverrideBehind);
                EditorGUILayout.PropertyField(debugPrintoutKey);
                EditorGUILayout.PropertyField(screenshot2DKey);
                EditorGUILayout.PropertyField(screenshot3DKey);

                EditorGUILayout.PropertyField(forceResolution);

                List <string> tilingPresetNames = new List <string>();
                foreach (var p in System.Enum.GetValues(typeof(Quilt.QuiltPreset)))
                {
                    tilingPresetNames.Add(p.ToString());
                }
                tilingPresetNames.Add("Default (determined by quality setting)");
                tilingPresetNames.Add("Custom");

                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(currentQuiltPreset);
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                }

                // if it's a custom
                if (currentQuiltPreset.intValue == (int)Quilt.QuiltPreset.Custom)
                {
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.PropertyField(viewWidth);
                    EditorGUILayout.PropertyField(viewHeight);
                    EditorGUILayout.PropertyField(numViews);
                    if (EditorGUI.EndChangeCheck())
                    {
                        quilt.ApplyPreset();
                        EditorUtility.SetDirty(quilt);
                    }
                }

                string tilingDisplay = numViews.displayName + ": " + numViews.intValue.ToString() + "\n";

                tilingDisplay += "View Tiling: " + viewsHorizontal.intValue + " x " +
                                 viewsVertical.intValue.ToString() + "\n";

                tilingDisplay += "View Size: " + viewWidth.intValue.ToString() + " x " +
                                 viewHeight.intValue.ToString() + " px" + "\n";

                tilingDisplay += "Quilt Size: " + quiltWidth.intValue.ToString() + " x " +
                                 quiltHeight.intValue.ToString() + " px";

                EditorGUILayout.LabelField(tilingDisplay, EditorStyles.helpBox);
                EditorGUILayout.Space();

                GUI.color = Misc.guiColor;
                EditorGUILayout.LabelField("- Multi Display -", EditorStyles.whiteMiniLabel);
                GUI.color = Color.white;

                EditorGUILayout.PropertyField(calibrationIndex);

                // change display if displayIndex changes
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(displayIndex);
                if (EditorGUI.EndChangeCheck())
                {
                    quilt.QuiltCam.targetDisplay = displayIndex.intValue;
                }

                EditorGUILayout.PropertyField(multiDisplayKey);
                EditorGUILayout.HelpBox(
                    "Display Index 0 = Display 1.\n" +
                    "Unity names it Display 1 but the array is 0 indexed.\n\n" +
                    "Keep in mind that the main display is usually Display 1, and the plugged in Looking Glass is likely Display 2.\n\n" +
                    "In most cases, you will want to leave this at 0 and set the display in the Launch window, but " +
                    "if you're using Multi Display you can set this manually for multiple Looking Glasses.",
                    MessageType.None);

                // on quilt setup event
                EditorGUILayout.PropertyField(onQuiltSetup);

                EditorGUI.indentLevel--;
            }

            EditorGUILayout.Space();

            GUI.color = Misc.guiColor;
            EditorGUILayout.LabelField("- Preview -", EditorStyles.whiteMiniLabel);
            GUI.color = Color.white;

            EditorGUILayout.PropertyField(renderIn2D);

            string previewerShortcutKey = "Ctrl + E";
            string settingsShortcutKey  = "Ctrl + Shift + E";

#if UNITY_EDITOR_OSX
            previewerShortcutKey = "⌘E";
            settingsShortcutKey  = "⌘^E";
#endif

            if (GUILayout.Button(new GUIContent(
                                     "Toggle Preview (" + previewerShortcutKey + ")",
                                     "If your LKG device is set up as a second display, " +
                                     "this will generate a game window on it to use as a " +
                                     "realtime preview"),
                                 EditorStyles.miniButton
                                 ))
            {
                PreviewWindow.ToggleWindow();
            }

            if (GUILayout.Button(new GUIContent(
                                     "Settings (" + settingsShortcutKey + ")",
                                     "Use to set previewer position"),
                                 EditorStyles.miniButton
                                 ))
            {
                EditorApplication.ExecuteMenuItem("HoloPlay/Preview Settings");
            }

            EditorGUILayout.Space();

            GUI.color = Misc.guiColor;
            EditorGUILayout.LabelField("- Calibration -", EditorStyles.whiteMiniLabel);
            GUI.color = Color.white;

            if (GUILayout.Button(new GUIContent(
                                     "Reload Calibration",
                                     "Reload the calibration, only really necessary if " +
                                     "you edited externally and the new calibration settings won't load"),
                                 EditorStyles.miniButton
                                 ))
            {
                CalibrationManager.LoadCalibrations();
                EditorUtility.SetDirty(quilt);
            }

            EditorGUILayout.Space();

            GUI.color = Misc.guiColor;
            EditorGUILayout.LabelField("- Project Settings -", EditorStyles.whiteMiniLabel);
            GUI.color = Color.white;

            if (GUILayout.Button(new GUIContent(
                                     "Optimization Settings",
                                     "Open a window that will let you select project settings " +
                                     "to be optimized for best performance with HoloPlay"),
                                 EditorStyles.miniButton
                                 ))
            {
                OptimizationSettings window = EditorWindow.GetWindow <OptimizationSettings>();
                window.Show();
            }

            EditorGUILayout.Space();

            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 16
0
        static async Task RecursivelyGetImageinBBAsync(double latitude1, double longitude1, double latitude2, double longitude2, Quilt targetQuilt, string quadKey)
        {
            int levelOfDetail = quadKey.Length;

            if (levelOfDetail > 0)
            {
                //Console.WriteLine("\tDownloading image " + quadKey);
                Bitmap tileImage = GetTile("http://h0.ortho.tiles.virtualearth.net/tiles/a" + quadKey + ".jpeg?g=131");
                if (tileImage == null)
                {
                    //Console.WriteLine("\tImage for " + quadKey + " was null");
                    return;
                }
                targetQuilt.Add(tileImage, quadKey);
                //Console.WriteLine("\tDrew image " + quadKey);
                if (levelOfDetail >= targetQuilt.getMaxLevelOfDetail())
                {
                    return;
                }
            }

            List <Task> children = new List <Task>();

            foreach (char d in "0123")
            {
                if (DoesQuadTouchBB(latitude1, longitude1, latitude2, longitude2, quadKey + d))
                {
                    //Console.WriteLine("Created child for " + quadKey + d);
                    children.Add(RecursivelyGetImageinBBAsync(latitude1, longitude1, latitude2, longitude2, targetQuilt, quadKey + d));
                }
            }
            await Task.WhenAll(children.ToArray());

            //Console.WriteLine("Task " + quadKey + " finished");
        }