コード例 #1
0
        private void DownloadAssets()
        {
            if (progress_bar != null)
            {
                progress_bar.SetRange(0, _meshesId.Length - 1, "Descargando archivos..");
            }

            WebClient wc = new WebClient();

            for (int i = 0; i < _meshesId.Length; i++)
            {
                var mn = _meshesId[i];
                if (Path.GetFileNameWithoutExtension(mn).Length != 0 && !File.Exists(mn))
                {
                    try
                    {
                        Directory.CreateDirectory(Path.GetDirectoryName(mn));
                        string webpath = WEB_MESH_FOLDER + mn.Substring(MESH_FOLDER.Length).Replace('\\', '/').Replace(" ", "%20").ToLower();
                        //GuiController.Instance.Logger.log("Descargando archivo: " + webpath);
                        if (progress_bar != null)
                        {
                            progress_bar.SetPos(i);
                            progress_bar.text = "Descargando archivo: " + webpath;
                        }
                        GuiController.Instance.MessageLoop();

                        wc.DownloadFile(webpath, mn);
                    }
                    catch (Exception)
                    {
                        GuiController.Instance.Logger.log("Archivo: " + mn + " no se encuentra.");
                    }
                }
            }
        }
コード例 #2
0
ファイル: GuiTest.cs プロジェクト: nicoschtein/TGC2014
        public void ProgressBarDlg()
        {
            gui.InitDialog(false, false);

            int W  = GuiController.Instance.Panel3d.Width;
            int H  = GuiController.Instance.Panel3d.Height;
            int x0 = -20;
            int y0 = 100;
            int dy = 350;
            int dx = W + 50;

            gui_item frame = gui.InsertFrame("Cargando mision", x0, y0, dx, dy, Color.FromArgb(240, 240, 240), frameBorder.sin_borde);

            frame.c_font = Color.FromArgb(0, 0, 0);
            progress_bar = gui.InsertProgressBar(ID_PROGRESS1, 50, y0 + 150, W - 100, 60);

            Device d3dDevice     = GuiController.Instance.D3dDevice;
            int    cant_textures = 5;

            progress_bar.SetRange(0, cant_textures, "Descargando archivos..");
            progress_bar.SetPos(1);
            for (int i = 0; i < cant_textures; ++i)
            {
                progress_bar.SetPos(i);
                progress_bar.text = "Descargando archivo: " + MyMediaDir + "f1\\piso3.png";

                Texture textura_piso = Texture.FromBitmap(d3dDevice, (Bitmap)Bitmap.FromFile(MyMediaDir + "f1\\piso3.png"), Usage.None, Pool.Managed);
                textura_piso.Dispose();
                MessageLoop();
            }

            gui.EndDialog();            // progress bar dialog
        }
コード例 #3
0
ファイル: YParser.cs プロジェクト: gigc/tgc-kinect
        private void ParseVertices()
        {
            //numero de faces
            _cantFaces = _byteData.ReadInt32();

            //vertices
            _cantVertices = _byteData.ReadInt32();

            _vertices = new TgcSceneLoader.DiffuseMapVertex[_cantVertices];

            //bytes por vertice
            _sizeofVertex = _byteData.ReadInt32();

            if (progress_bar != null)
            {
                progress_bar.SetRange(0, _cantVertices - 1, fname);
            }

            for (int i = 0; i < _cantVertices; i++)
            {
                if (i % 200 == 0)
                {
                    // Cada 200 vertices llamo al loop
                    if (progress_bar != null)
                    {
                        progress_bar.SetPos(i);
                    }
                    GuiController.Instance.MessageLoop();
                }
                var   p = new TgcSceneLoader.DiffuseMapVertex();
                float x = _byteData.ReadSingle();
                float z = _byteData.ReadSingle();
                float y = _byteData.ReadSingle();
                //_vertices.push(new Vertex(x, y, z));
                p.Position = new Vector3(x, y, -z);

                minVert = Vector3.Minimize(minVert, p.Position);
                maxVert = Vector3.Maximize(maxVert, p.Position);

                x = _byteData.ReadSingle();
                z = _byteData.ReadSingle();
                y = _byteData.ReadSingle();

                p.Normal = new Vector3(x, y, -z);
                p.Color  = 0xFFFFFF;

                if (_sizeofVertex >= 32)
                {
                    p.Tu = _byteData.ReadSingle();
                    p.Tv = _byteData.ReadSingle();
                }

                if (_sizeofVertex > 32)
                {
                    _byteData.ReadBytes(_sizeofVertex - 32);
                }
                _vertices[i] = p;
            }
        }