예제 #1
0
        public void InitTexturesAndDecals()
        {
            // Load all the decals (has to wait for OpenGL to init)
            tex_manager = new TextureManager(editor);
            tex_manager.LoadTexturesInDir(editor.m_filepath_decal_textures, false, true);

            // Add decals from the decal directory
            LoadDecalsInDir(editor.m_filepath_decals, false);

            //Update listbox
            ListboxUpdate();
        }
예제 #2
0
        private void Editor_Load(object sender, EventArgs e)
        {
            m_dmesh        = new DMesh("default_dmesh");
            tm_decal       = new TextureManager(this);
            texture_list   = new TextureList(this);
            uv_editor      = new UVEditor(this);
            tunnel_builder = new TunnelBuilder(this);
            dmesh_browser  = new DMeshBrowser(this);
            NewDMesh();
            UndoInit();
            KeyPreview = true;

            // Init views and view labels
            Size sz = gl_panel.Size;

            sz.Height -= 5;
            sz.Width  -= 5;

            // Create GL views and labels
            for (int i = 0; i < (int)ViewType.NUM; i++)
            {
                gl_view[i]        = new GLView((ViewType)i, this);
                gl_view[i].Parent = gl_panel;
                switch (i)
                {
                case 0: gl_view[i].Location = new Point(0, 0); break;

                case 1: gl_view[i].Location = new Point(sz.Width / 2, 0); break;

                case 2: gl_view[i].Location = new Point(0, sz.Height / 2); break;

                case 3: gl_view[i].Location = new Point(sz.Width / 2, sz.Height / 2); break;
                }
                gl_view[i].Size = new Size(sz.Width / 2, sz.Height / 2);
                gl_view[i].Show();
            }

            for (int i = 0; i < (int)ViewType.NUM; i++)
            {
                label_viewport[i]           = new Label();
                label_viewport[i].Parent    = gl_panel;
                label_viewport[i].Location  = new Point(gl_view[i].Location.X + 2, gl_view[i].Location.Y + 2);
                label_viewport[i].AutoSize  = true;
                label_viewport[i].Text      = ((ViewType)i).ToString();
                label_viewport[i].BackColor = GLView.C_bg;
                label_viewport[i].ForeColor = Color.White;
                label_viewport[i].Show();
                gl_panel.Controls.Add(label_viewport[i]);
                label_viewport[i].BringToFront();
            }

            // Could make this save/load?
            WindowState = FormWindowState.Maximized;

            ResetViews();

            UpdateDirectories();
            LoadPreferences();
            UpdateOptionLabels();
            RefreshGrid();
            ResetViews();
            InitChecklists();

            ComputerInfo ci           = new ComputerInfo();
            ulong        total_memory = (ulong)ci.TotalPhysicalMemory;
            bool         low_mem      = total_memory < 5000000000; // 5 GB

            if (m_low_res_force || low_mem)
            {
                m_low_res_textures = true;
            }
            tm_decal.LoadTexturesInDir(m_filepath_decal_textures, false, false);
            tm_decal.LoadTexturesInDir(m_filepath_level_textures, false, false);
            texture_list.InitImageLists();
            texture_list.Hide();

            uv_editor.Hide();
            tunnel_builder.Hide();
        }