示例#1
0
        bool initDone = false;                    // hold off on any reaction to messages until fully inited



        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public MyGraphicsSample()
        {
            // Set the window text
            this.Text = "ProgressiveMesh: Using Progressive Meshes in D3D";
            try
            {
                // Load the icon from our resources
                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(this.GetType());
                this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            }
            catch
            {
                // It's no big deal if we can't load our icons, but try to load the embedded one
                try { this.Icon = new System.Drawing.Icon(this.GetType(), "directx.ico"); }
                catch {}
            }

            arcBall          = new GraphicsArcBall(this);
            initialDirectory = DXUtil.SdkMediaPath;
            font             = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold);
            enumerationSettings.AppUsesDepthBuffer = true;

            // Add our new menu options
            this.mnuOptions   = new MenuItem();
            this.mnuOptimize  = new MenuItem();
            this.mnuOpenMesh  = new MenuItem();
            this.mnuMeshBreak = new MenuItem();

            // Add the Options menu to the main menu
            this.mnuMain.MenuItems.Add(this.mnuOptions);
            this.mnuOptions.Index = 1;
            this.mnuOptions.Text  = "&Options";

            // Add the optimize menu to the options menu
            this.mnuOptions.MenuItems.Add(this.mnuOptimize);
            this.mnuOptimize.Text   = "Show Optimized PMeshes 'o'";
            this.mnuOptimize.Click += new System.EventHandler(this.OptimizeClick);

            // Add the 'Open Mesh' dialog to the file menu.
            this.mnuFile.MenuItems.Add(0, mnuMeshBreak);
            this.mnuFile.MenuItems.Add(0, mnuOpenMesh);
            this.mnuMeshBreak.Text        = "-";
            this.mnuOpenMesh.Text         = "Open File...";
            this.mnuOpenMesh.Shortcut     = System.Windows.Forms.Shortcut.CtrlO;
            this.mnuOpenMesh.ShowShortcut = true;
            this.mnuOpenMesh.Click       += new System.EventHandler(this.OpenMesh);

            mnuOptimize.Checked = showOptimized;

            // Set up our event handlers
            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnPrivateKeyDown);
            this.KeyUp   += new System.Windows.Forms.KeyEventHandler(this.OnPrivateKeyUp);
        }
示例#2
0
        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public MyGraphicsSample()
        {
            // Add our new menu options
            this.mnuOpenMesh  = new MenuItem();
            this.mnuMeshBreak = new MenuItem();

            // Add the Open File menu to the file menu
            this.mnuFile.MenuItems.Add(0, this.mnuMeshBreak);
            this.mnuMeshBreak.Text = "-";
            this.mnuFile.MenuItems.Add(0, this.mnuOpenMesh);
            this.mnuOpenMesh.Text         = "Open File...";
            this.mnuOpenMesh.Shortcut     = System.Windows.Forms.Shortcut.CtrlO;
            this.mnuOpenMesh.ShowShortcut = true;
            this.mnuOpenMesh.Click       += new System.EventHandler(this.OpenMesh);

            InitializeComponent();
            this.RenderTarget = target;

            // Set the window text
            this.Text = "Allegiance MDL Viewer";
            try
            {
                // Load the icon from our resources
                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(this.GetType());
                this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            }
            catch
            {
                // It's no big deal if we can't load our icons, but try to load the embedded one
                try { this.Icon = new System.Drawing.Icon(this.GetType(), "directx.ico"); }
                catch {}
            }

            arcBall             = new GraphicsArcBall(this.target);
            initialDirectory    = DXUtil.SdkMediaPath;
            driveListBox1.Drive = System.IO.Path.GetPathRoot(initialDirectory);
            dirListBox1.Path    = initialDirectory;
            fileListBox1.Path   = initialDirectory;

            drawingFont = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold);
            enumerationSettings.AppUsesDepthBuffer = true;
            numberSegments = 2;

            // Set up our event handlers
            //this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnPrivateKeyDown);
        }
示例#3
0
        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public MyGraphicsSample()
        {
            // Set the window text
            this.Text = "ShadowVolume: RealTime Shadows Using The StencilBuffer";
            try
            {
                // Load the icon from our resources
                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(this.GetType());
                this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            }
            catch
            {
                // It's no big deal if we can't load our icons, but try to load the embedded one
                try { this.Icon = new System.Drawing.Icon(this.GetType(), "directx.ico"); }
                catch {}
            }

            arcBall = new GraphicsArcBall(this);
            font    = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold);
            enumerationSettings.AppUsesDepthBuffer = true;
            MinDepthBits   = 16;
            MinStencilBits = 4;
        }
示例#4
0
        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public MyGraphicsSample()
        {
            // Set the window text
            this.Text = "Motion Blur";
            try
            {
                // Load the icon from our resources
                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(this.GetType());
                this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            }
            catch
            {
                // It's no big deal if we can't load our icons, but try to load the embedded one
                try { this.Icon = new System.Drawing.Icon(this.GetType(), "directx.ico"); }
                catch {}
            }

            drawingFont      = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold);
            drawingFontSmall = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold, 9);
            enumerationSettings.AppUsesDepthBuffer = true;

            ourArcball    = new GraphicsArcBall(this);
            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnPrivateKeyDown);
        }