亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? d3dapp.cs

?? Particle System Test Application on C#
?? CS
?? 第 1 頁 / 共 4 頁
字號:
        {
            HandleSampleException(e,ApplicationMessage.ApplicationMustExit);
        }
        catch
        {
            HandleSampleException(new SampleException(),ApplicationMessage.ApplicationMustExit);
        }
        ready = true;
    }




    /// <summary>
    /// Called when our sample has nothing else to do, and it's time to render
    /// </summary>
    private void FullRender()
    {
        // Render a frame during idle time (no messages are waiting)
        if (active && ready)
        {
            try 
            {
                if ((deviceLost) || (System.Windows.Forms.Form.ActiveForm != this))
                {
                    // Yield some CPU time to other processes
                    System.Threading.Thread.Sleep(100); // 100 milliseconds
                }
                // Render a frame during idle time
                if (active)
                {
                    Render3DEnvironment();
                }
            }
            catch (Exception ee)
            {
                System.Windows.Forms.MessageBox.Show("An exception has occurred.  This sample must exit.\r\n\r\n" + ee.ToString(), "Exception", 
                                                     System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                this.Close();
            }
        }
    }




    /// <summary>
    /// Run the simulation
    /// </summary>
    public void Run()
    {
        // Now we're ready to recieve and process Windows messages.
        System.Windows.Forms.Control mainWindow = this;

        // If the render target is a form and *not* this form, use that form instead,
        // otherwise, use the main form.
        if ((ourRenderTarget is System.Windows.Forms.Form) && (ourRenderTarget != this))
            mainWindow = ourRenderTarget;

        mainWindow.Show();
        while (mainWindow.Created)
        {
            FullRender();
            System.Windows.Forms.Application.DoEvents();
        }
    }




    /// <summary>
    /// Draws the scene 
    /// </summary>
    public void Render3DEnvironment()
    {
        if (deviceLost)
        {
            try
            {
                // Test the cooperative level to see if it's okay to render
                device.TestCooperativeLevel();
            }
            catch (DeviceLostException)
            {
                // If the device was lost, do not render until we get it back
                isHandlingSizeChanges = false;
                isWindowActive = false;
                return;
            }
            catch (DeviceNotResetException)
            {
                // Check if the device needs to be resized.

                // If we are windowed, read the desktop mode and use the same format for
                // the back buffer
                if (windowed)
                {
                    GraphicsAdapterInfo adapterInfo = graphicsSettings.AdapterInfo;
                    graphicsSettings.WindowedDisplayMode = Manager.Adapters[adapterInfo.AdapterOrdinal].CurrentDisplayMode;
                    presentParams.BackBufferFormat = graphicsSettings.WindowedDisplayMode.Format;
                }

                // Reset the device and resize it
                device.Reset(device.PresentationParameters);
                EnvironmentResized(device, new System.ComponentModel.CancelEventArgs());
            }
            deviceLost = false;
        }

        // Get the app's time, in seconds. Skip rendering if no time elapsed
        float fAppTime        = DXUtil.Timer(DirectXTimer.GetApplicationTime);
        float fElapsedAppTime = DXUtil.Timer(DirectXTimer.GetElapsedTime);
        if ((0.0f == fElapsedAppTime) && frameMoving)
            return;

        // FrameMove (animate) the scene
        if (frameMoving || singleStep)
        {
            // Store the time for the app
            appTime        = fAppTime;
            elapsedTime = fElapsedAppTime;

            // Frame move the scene
            FrameMove();

            singleStep = false;
        }

        // Render the scene as normal
        Render();

        UpdateStats();

        try
        {
            // Show the frame on the primary surface.
            device.Present();
        }
        catch(DeviceLostException)
        {
            deviceLost = true;
        }
    }




    /// <summary>
    /// Update the various statistics the simulation keeps track of
    /// </summary>
    public void UpdateStats()
    {
        // Keep track of the frame count
        float time = DXUtil.Timer(DirectXTimer.GetAbsoluteTime);
        ++frames;

        // Update the scene stats once per second
        if (time - lastTime > 1.0f)
        {
            framePerSecond    = frames / (time - lastTime);
            lastTime = time;
            frames  = 0;

            string strFmt;
            Format fmtAdapter = graphicsSettings.DisplayMode.Format;
            if (fmtAdapter == device.PresentationParameters.BackBufferFormat)
            {
                strFmt = fmtAdapter.ToString();
            }
            else
            {
                strFmt = String.Format("backbuf {0}, adapter {1}", 
                    device.PresentationParameters.BackBufferFormat.ToString(), fmtAdapter.ToString());
            }

            string strDepthFmt;
            if (enumerationSettings.AppUsesDepthBuffer)
            {
                strDepthFmt = String.Format(" ({0})", 
                    graphicsSettings.DepthStencilBufferFormat.ToString());
            }
            else
            {
                // No depth buffer
                strDepthFmt = "";
            }

            string strMultiSample;
            switch (graphicsSettings.MultisampleType)
            {
                case Direct3D.MultiSampleType.NonMaskable: strMultiSample = " (NonMaskable Multisample)"; break;
                case Direct3D.MultiSampleType.TwoSamples: strMultiSample = " (2x Multisample)"; break;
                case Direct3D.MultiSampleType.ThreeSamples: strMultiSample = " (3x Multisample)"; break;
                case Direct3D.MultiSampleType.FourSamples: strMultiSample = " (4x Multisample)"; break;
                case Direct3D.MultiSampleType.FiveSamples: strMultiSample = " (5x Multisample)"; break;
                case Direct3D.MultiSampleType.SixSamples: strMultiSample = " (6x Multisample)"; break;
                case Direct3D.MultiSampleType.SevenSamples: strMultiSample = " (7x Multisample)"; break;
                case Direct3D.MultiSampleType.EightSamples: strMultiSample = " (8x Multisample)"; break;
                case Direct3D.MultiSampleType.NineSamples: strMultiSample = " (9x Multisample)"; break;
                case Direct3D.MultiSampleType.TenSamples: strMultiSample = " (10x Multisample)"; break;
                case Direct3D.MultiSampleType.ElevenSamples: strMultiSample = " (11x Multisample)"; break;
                case Direct3D.MultiSampleType.TwelveSamples: strMultiSample = " (12x Multisample)"; break;
                case Direct3D.MultiSampleType.ThirteenSamples: strMultiSample = " (13x Multisample)"; break;
                case Direct3D.MultiSampleType.FourteenSamples: strMultiSample = " (14x Multisample)"; break;
                case Direct3D.MultiSampleType.FifteenSamples: strMultiSample = " (15x Multisample)"; break;
                case Direct3D.MultiSampleType.SixteenSamples: strMultiSample = " (16x Multisample)"; break;
                default: strMultiSample = string.Empty; break;
            }
            frameStats = String.Format("{0} fps ({1}x{2}), {3}{4}{5}", framePerSecond.ToString("f2"),
                device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight, 
                strFmt, strDepthFmt, strMultiSample);
        }
    }




    /// <summary>
    /// Called in to toggle the pause state of the app.
    /// </summary>
    /// <param name="pause">true if the simulation should pause</param>
    public void Pause(bool pause)
    {
        appPausedCount  += (int)(pause ? +1 : -1);
        ready = ((appPausedCount > 0) ? false : true);

        // Handle the first pause request (of many, nestable pause requests)
        if (pause && (1 == appPausedCount))
        {
            // Stop the scene from animating
            if (frameMoving)
                DXUtil.Timer(DirectXTimer.Stop);
        }

        if (0 == appPausedCount)
        {
            // Restart the timers
            if (frameMoving)
                DXUtil.Timer(DirectXTimer.Start);
        }
    }




    /// <summary>
    /// Set our variables to not active and not ready
    /// </summary>
    public void CleanupEnvironment()
    {
        active = false;
        ready  = false;
        if (device != null)
            device.Dispose();

        device = null;
    }
    #region Menu EventHandlers




    /// <summary>
    /// Prepares the simulation for a new device being selected
    /// </summary>
    public void UserSelectNewDevice(object sender, EventArgs e)
    {
        // Prompt the user to select a new device or mode
        if (active && ready)
        {
            Pause(true);
            DoSelectNewDevice();
            Pause(false);
        }
    }




    /// <summary>
    /// Displays a dialog so the user can select a new adapter, device, or
    /// display mode, and then recreates the 3D environment if needed
    /// </summary>
    private void DoSelectNewDevice()
    {
        isHandlingSizeChanges = false;
        // Can't display dialogs in fullscreen mode
        if (windowed == false)
        {
            try
            {
                ToggleFullscreen();
                isHandlingSizeChanges = false;
            }
            catch
            {
                HandleSampleException(new ResetFailedException(), ApplicationMessage.ApplicationMustExit);
                return;
            }
        }

        // Make sure the main form is in the background
        this.SendToBack();
        D3DSettingsForm settingsForm = new D3DSettingsForm(enumerationSettings, graphicsSettings);
        System.Windows.Forms.DialogResult result = settingsForm.ShowDialog(null);
        if (result != System.Windows.Forms.DialogResult.OK)
        {
            isHandlingSizeChanges = true;
            return;
        }
        graphicsSettings = settingsForm.settings;

        windowed = graphicsSettings.IsWindowed;

        // Release display objects, so a new device can be created
        device.Dispose();
        device = null;

        // Inform the display class of the change. It will internally
        // re-create valid surfaces, a d3ddevice, etc.
        try
        {
            InitializeEnvironment();
        }
        catch(SampleException d3de)
        {
            HandleSampleException(d3de, ApplicationMessage.ApplicationMustExit);
        }
        catch
        {
            HandleSampleException(new SampleException(), ApplicationMessage.ApplicationMustExit);
        }

        // If the app is paused, trigger the rendering of the current frame
        if (false == frameMoving)
        {
            singleStep = true;
            DXUtil.Timer(DirectXTimer.Start);
            DXUtil.Timer(DirectXTimer.Stop);
        }
        isHandlingSizeChanges = true;
    }




    /// <summary>
    /// Will start (or stop) simulation
    /// </summary>
    private void ToggleStart(object sender, EventArgs e)
    {
        //Toggle frame movement
        frameMoving = !frameMoving;
        DXUtil.Timer(frameMoving ? DirectXTimer.Start : DirectXTimer.Stop);
    }




    /// <summary>
    /// Will single step the simulation
    /// </summary>
    private void SingleStep(object sender, EventArgs e)
    {
        // Single-step frame movement
        if (false == frameMoving)
            DXUtil.Timer(DirectXTimer.Advance);
        else
            DXUtil.Timer(DirectXTimer.Stop);
        frameMoving = false;
        singleStep  = true;
    }




    /// <summary>
    /// Will end the simulation
    /// </summary>
    private void ExitSample(object sender, EventArgs e)
    {
        this.Close();
    }
    #endregion




    #region WinForms Overrides
    /// <summary>
    /// Clean up any resources
    /// </summary>
    protected override void Dispose(bool disposing)
    {
        CleanupEnvironment();
        mnuMain.Dispose();
        base.Dispose(disposing);
    }




    /// <summary>
    /// Handle any key presses
    /// </summary>
    protected override void OnKeyPress(System.Windows.Forms.KeyPressEventArgs e)
    {
        // Check for our shortcut keys (Space)
        if (e.KeyChar == ' ')
        {
            mnuSingle.PerformClick();
            e.Handled = true;
        }

        // Check for our shortcut keys (Return to start or stop)
        if (e.KeyChar == '\r')
        {
            mnuGo.PerformClick();
            e.Handled = true;
        }

        // Check for our shortcut keys (Escape to quit)
        if ((byte)e.KeyChar == (byte)(int)System.Windows.Forms.Keys.Escape)
        {
            mnuExit.PerformClick();
            e.Handled = true;
        }

        // Allow the control to handle the keystroke now

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人综合网站| 久久久精品tv| 五月婷婷激情综合网| 色综合久久综合| 久久免费的精品国产v∧| 日韩高清在线一区| 91精品国产黑色紧身裤美女| 性欧美疯狂xxxxbbbb| 91免费视频观看| 亚洲欧美日韩国产手机在线 | 国产无人区一区二区三区| 免费久久99精品国产| 久久久影视传媒| 成人激情文学综合网| 国产清纯在线一区二区www| 国产成人午夜片在线观看高清观看| 久久综合av免费| 国产精品主播直播| 国产欧美日韩精品在线| 成人a级免费电影| 一区二区三区在线不卡| 欧美午夜视频网站| 奇米一区二区三区av| 久久免费视频色| 国产.欧美.日韩| 日本一区二区综合亚洲| 99r精品视频| 亚洲国产日产av| 欧美一区二区在线视频| 国产一区三区三区| 中文字幕一区免费在线观看| 在线观看亚洲专区| 日韩av中文字幕一区二区三区| 日韩欧美亚洲国产精品字幕久久久| 国产麻豆精品95视频| 国产精品乱人伦一区二区| 欧美在线999| 激情亚洲综合在线| 日本一区二区电影| 欧美日韩一二区| 国产福利91精品一区| 亚洲欧美另类小说| 欧美一区午夜视频在线观看| 国产成人av电影在线| 亚洲影院理伦片| 精品捆绑美女sm三区| 波多野结衣亚洲| 亚洲曰韩产成在线| 久久综合九色综合欧美98 | 国产一区二区精品久久99| 自拍偷拍国产精品| 欧美成人女星排行榜| 97se狠狠狠综合亚洲狠狠| 午夜天堂影视香蕉久久| 精品久久久久久亚洲综合网| 99视频国产精品| 久草在线在线精品观看| 亚洲一区二区三区四区在线免费观看| 欧美一区二区福利在线| 91在线无精精品入口| 日本成人在线视频网站| 亚洲日本一区二区三区| 精品国产精品一区二区夜夜嗨| 欧美日韩中文一区| 国产v综合v亚洲欧| 毛片av一区二区| 一区二区成人在线| 中文字幕不卡在线| 精品国产乱码久久久久久久| 欧美日韩一区国产| 91麻豆产精品久久久久久| 国产精品影视在线| 日韩va亚洲va欧美va久久| 亚洲欧美一区二区三区国产精品 | 久久综合九色综合欧美98| 欧美日韩亚洲综合在线 | 亚洲欧洲日本在线| 日韩视频一区二区三区在线播放| 91美女福利视频| 丁香亚洲综合激情啪啪综合| 久久精品国产网站| 免费人成网站在线观看欧美高清| 亚洲精品国产一区二区精华液 | 丝袜美腿亚洲一区二区图片| 亚洲美女少妇撒尿| 亚洲日本电影在线| 国产精品久久777777| 久久久www成人免费无遮挡大片 | 99精品视频免费在线观看| 国产在线播精品第三| 老司机精品视频线观看86| 日产国产欧美视频一区精品 | 国产精品天美传媒沈樵| 久久久国产一区二区三区四区小说 | 久久久亚洲国产美女国产盗摄| 91精品国产高清一区二区三区蜜臀| 欧美日韩一区久久| 欧美日本国产视频| 在线不卡中文字幕| 91精品国产免费| 日韩欧美一二三四区| 欧美剧情片在线观看| 在线播放一区二区三区| 欧美一二三四在线| 欧美成va人片在线观看| 欧美大黄免费观看| 91精品麻豆日日躁夜夜躁| 色综合久久久网| 欧美日韩亚洲丝袜制服| 日韩色视频在线观看| 久久久噜噜噜久久人人看| 国产精品婷婷午夜在线观看| 国产精品高潮呻吟久久| 中文字幕在线播放不卡一区| 日韩伦理av电影| 国产乱子轮精品视频| 国产一区二区三区免费播放| 处破女av一区二区| 色999日韩国产欧美一区二区| 欧美麻豆精品久久久久久| 精品美女被调教视频大全网站| 久久影院视频免费| 亚洲美女精品一区| 热久久免费视频| 成人av在线看| 欧美精品一二三| 久久天天做天天爱综合色| 自拍偷在线精品自拍偷无码专区| 亚洲成人黄色小说| 国产在线国偷精品产拍免费yy| 91在线播放网址| 99久久99久久精品免费看蜜桃| 欧美性色综合网| 亚洲视频图片小说| 国内精品不卡在线| 欧美精品高清视频| 亚洲精品中文在线观看| 国产一区二区伦理| 91精品国产91久久久久久一区二区| 亚洲欧美一区二区视频| 国模一区二区三区白浆| 欧美日本视频在线| 一区二区三区在线播| av成人动漫在线观看| 久久久久久久精| 精品一区二区免费在线观看| 欧美三级资源在线| 亚洲精品美国一| 91视频一区二区| 中文一区在线播放| 国产精品一区免费视频| 91麻豆精品国产91久久久久| 亚洲国产综合91精品麻豆| 99热精品一区二区| 国产精品网曝门| 成人久久视频在线观看| 欧美激情一区二区三区蜜桃视频 | 中文字幕一区二区三中文字幕| 精品制服美女久久| 欧美不卡视频一区| 青青草国产精品亚洲专区无| 欧美日韩小视频| 亚洲mv在线观看| 欧美日韩一本到| 日韩精品视频网| 日韩欧美久久久| 久久99精品国产麻豆不卡| 日韩欧美专区在线| 激情偷乱视频一区二区三区| 亚洲精品一线二线三线| 国产精品性做久久久久久| 久久久久国产一区二区三区四区 | 精品视频在线视频| 婷婷开心激情综合| 欧美一区二区黄| 久久国产欧美日韩精品| 欧美变态凌虐bdsm| 激情综合网最新| 欧美国产1区2区| 色综合久久久久| 午夜不卡av免费| 欧美va亚洲va在线观看蝴蝶网| 久久se这里有精品| 中文字幕国产一区| 色久优优欧美色久优优| 午夜婷婷国产麻豆精品| 精品免费国产一区二区三区四区| 欧美日韩国产区一| 麻豆国产91在线播放| 久久精品夜色噜噜亚洲aⅴ| 99久免费精品视频在线观看| 一区二区三区精品视频在线| 欧美一级一区二区| 国产成人鲁色资源国产91色综| 中文字幕亚洲区| 欧美日韩国产一区二区三区地区| 久久精品国产99国产精品| 国产精品白丝在线| 欧美日韩另类一区| 国产成人免费视频一区|