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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? lighting.cs

?? Windows Mobile6 D3D案例
?? CS
?? 第 1 頁 / 共 2 頁
字號:
//---------------------------------------------------------------------
//  This file is part of the Microsoft .NET Framework SDK Code Samples.
// 
//  Copyright (C) Microsoft Corporation.  All rights reserved.
// 
//This source code is intended only as a supplement to Microsoft
//Development Tools and/or on-line documentation.  See these other
//materials for detailed information regarding Microsoft code samples.
// 
//THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
//KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
//IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//PARTICULAR PURPOSE.
//---------------------------------------------------------------------

using System;
using System.Windows.Forms;
using Microsoft.WindowsMobile.DirectX;
using Microsoft.WindowsMobile.DirectX.Direct3D;

namespace Microsoft.Samples.MD3DM
{
    // Custom D3D vertex format used by the vertex buffer
    struct MyVertex
    {
        public Vector3 p;       // vertex position
        public Vector3 n;       // vertex normal

        public static readonly VertexFormats Format = 
            VertexFormats.Position | VertexFormats.Normal;
    };
    
    /// <summary>
    /// Main form that renders this sample
    /// </summary>
    public class LightingForm : System.Windows.Forms.Form
    {
        private Microsoft.WindowsMobile.DirectX.Direct3D.Device device = null;
        // Tessellated plane to serve as the walls and floor
        private Mesh wallMesh = null;
        // Representation of point light
        private Mesh sphereMesh = null;  
        // Representation of dir/spot light
        private Mesh coneMesh = null;                 
        // Description of the D3D light
        private Light lightData;           
        // Number of vertices in the wall mesh along X
        private uint numberVertsX = 16;         
        // Number of vertices in the wall mesh along Z         
        private uint numberVertsZ = 16;
        // Number of triangles in the wall mesh                  
        private int numberTriangles = 0;         

        // the tick count when the app started rendering
        private int tickStart = 0;

        // the number of seconds since rendering started
        private float appTime;

        // a helper to record and render fps statistics
        private FpsTimerTool fpsTimer;

        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public LightingForm()
        {
            // the number of traingles in the wall mesh
            numberTriangles = (int)((numberVertsX - 1) *
                (numberVertsZ - 1) * 2);

            // Set the window text
            this.Text = "Lighting";

            // Now let's setup our D3D stuff
            PresentParameters presentParams = new PresentParameters();
            presentParams.Windowed = true;
            presentParams.SwapEffect = SwapEffect.Discard;
            presentParams.AutoDepthStencilFormat = DepthFormat.D16;
            presentParams.EnableAutoDepthStencil = true;
            device = new Device(0, DeviceType.Default, this, CreateFlags.None,
                presentParams);

            // setup those objects which persist through reset
            InitializeDeviceObjects();
            // attach the device reset handler
            device.DeviceReset += new EventHandler(RestoreDeviceObjects);
            // setup any device resources that will not persist through reset
            RestoreDeviceObjects(device, EventArgs.Empty);
        }

        /// <summary>
        /// Called once per frame, the call is the entry point for animating
        /// the scene.
        /// </summary>
        public void FrameMove()
        {
            lightData = device.Lights[2];
            // Rotate through the various light types
            if (((int)appTime % 20) < 10)
                device.Lights[2].Type = LightType.Point;
            else
                device.Lights[2].Type = LightType.Directional;

            // Make sure the light type is supported by the device.  If 
            // VertexProcessingCaps.PositionAllLights is not set, the device
            // does not support point or spot lights, so change light #2's
            // type to a directional light.
            if 
            (!device.DeviceCaps.VertexProcessingCaps.SupportsPositionalLights)
            {
                if (device.Lights[2].Type == LightType.Point)
                    device.Lights[2].Type = LightType.Directional;
            }

            // Values for the light position, direction, and color
            float x = (float)Math.Sin(appTime * 2.000f);
            float y = (float)Math.Sin(appTime * 2.246f);
            float z = (float)Math.Sin(appTime * 2.640f);

            byte r = (byte)((0.5f + 0.5f * x) * 0xff);
            byte g = (byte)((0.5f + 0.5f * y) * 0xff);
            byte b = (byte)((0.5f + 0.5f * z) * 0xff);
            device.Lights[2].Diffuse = System.Drawing.Color.FromArgb(r, g, b);
            device.Lights[2].Range = 100.0f;
    
            switch(device.Lights[2].Type)
            {
                case LightType.Point:
                    device.Lights[2].Position = new Vector3(4.5f * x,
                        4.5f * y, 4.5f * z);
                    device.Lights[2].Attenuation1 = 0.4f;
                    break;
                case LightType.Directional:
                    device.Lights[2].Direction = new Vector3(x, y, z);
                    break;
            }
            device.Lights[2].Update();
        }

        /// <summary>
        /// Called once per frame, the call is the entry point for 3d
        /// rendering. This function sets up render states, clears the
        /// viewport, and renders the scene.
        /// </summary>
        public void Render()
        {
            Matrix matWorld;
            Matrix matTrans;
            Matrix matRotate;

            fpsTimer.StartFrame();

            // Clear the viewport
            device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, 0x000000ff,
                1.0f, 0);

            device.BeginScene();

            // Turn on light #0 and #2, and turn off light #1
            device.Lights[0].Enabled = true;
            device.Lights[1].Enabled = false;
            device.Lights[2].Enabled = true;

            // Draw the floor
            matTrans = Matrix.Translation(-5.0f, -5.0f, -5.0f);
            matRotate = Matrix.RotationZ(0.0f);
            matWorld = matRotate * matTrans;
            device.SetTransform(TransformType.World, matWorld);
            wallMesh.DrawSubset(0);

            // Draw the back wall
            matTrans = Matrix.Translation(5.0f, -5.0f, -5.0f);
            matRotate = Matrix.RotationZ((float)Math.PI / 2);
            matWorld = matRotate * matTrans;
            device.SetTransform(TransformType.World, matWorld);
            wallMesh.DrawSubset(0);

            // Draw the side wall
            matTrans = Matrix.Translation(-5.0f, -5.0f, 5.0f);
            matRotate = Matrix.RotationX((float)-Math.PI / 2);
            matWorld = matRotate * matTrans;
            device.SetTransform(TransformType.World, matWorld);
            wallMesh.DrawSubset(0);

            // Turn on light #1, and turn off light #0 and #2
            device.Lights[0].Enabled = false;
            device.Lights[1].Enabled = true;
            device.Lights[2].Enabled = false;

            // Draw the mesh representing the light
            if (lightData.Type == LightType.Point)
            {
                // Just position the point light -- no need to orient it
                matWorld = Matrix.Translation(lightData.Position.X, 
                    lightData.Position.Y, lightData.Position.Z);
                device.SetTransform(TransformType.World, matWorld);
                sphereMesh.DrawSubset(0);
            }
            else
            {
                // Position the light and point it in the light's direction
                Vector3 vecFrom = new Vector3(lightData.Position.X,
                    lightData.Position.Y, lightData.Position.Z);
                Vector3 vecAt = new Vector3(
                    lightData.Position.X + lightData.Direction.X, 
                    lightData.Position.Y + lightData.Direction.Y,
                    lightData.Position.Z + lightData.Direction.Z);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品沙发午睡系列990531| 亚洲精品一区二区精华| 亚洲免费电影在线| 日本韩国欧美在线| 婷婷六月综合网| 日韩欧美一级片| 国产成人免费在线| 亚洲免费观看在线观看| 精品视频在线视频| 狠狠久久亚洲欧美| 国产日韩高清在线| 色婷婷av一区二区三区大白胸| 亚洲国产日韩一级| 精品国产一区二区三区四区四| 国产成人午夜精品5599 | 国产91精品一区二区麻豆亚洲| 欧美激情一二三区| 色哟哟国产精品免费观看| 视频在线在亚洲| 日本一区二区三区在线不卡| 91小视频免费看| 蜜臀av一区二区在线免费观看 | 7799精品视频| 国产一区美女在线| 一区二区视频免费在线观看| 欧美一区二区在线视频| 成人黄色在线网站| 日韩电影在线免费看| 欧美国产一区二区| 欧美军同video69gay| 成人动漫一区二区在线| 天天综合网 天天综合色| 亚洲国产精品成人久久综合一区| 欧美性生活大片视频| 国产精品一色哟哟哟| 亚洲一区二区三区四区在线观看| 2024国产精品视频| 欧美日韩免费观看一区二区三区| 国产一区二区精品久久99| 亚洲一线二线三线视频| 日韩av一二三| 亚洲国产一二三| 欧美一级高清大全免费观看| 成人污污视频在线观看| 首页综合国产亚洲丝袜| 国产精品萝li| 2022国产精品视频| 欧美日韩精品电影| 色综合久久综合中文综合网| 狠狠狠色丁香婷婷综合激情 | 久久欧美一区二区| 欧美日韩精品福利| 色综合天天综合色综合av| 国产乱妇无码大片在线观看| 日韩中文字幕一区二区三区| 亚洲精品日韩综合观看成人91| 国产色产综合色产在线视频| 日韩欧美一区中文| 4438成人网| 欧美日韩一区二区三区在线看| 9色porny自拍视频一区二区| 国产精品亚洲一区二区三区妖精| 免费观看日韩av| 男女性色大片免费观看一区二区 | 自拍偷拍亚洲欧美日韩| 91.成人天堂一区| 欧美三级中文字幕| 91搞黄在线观看| 色综合天天性综合| 91麻豆视频网站| 9人人澡人人爽人人精品| 成人综合激情网| 成人动漫在线一区| www.亚洲激情.com| 北条麻妃国产九九精品视频| 成人午夜电影小说| 国产精品性做久久久久久| 国内精品在线播放| 国产一区美女在线| 国产一区二区精品久久91| 美国欧美日韩国产在线播放| 久久精品国产久精国产| 精品一区二区av| 国产一区二区三区香蕉| 国产91精品免费| 成人黄色777网| 91久久精品一区二区三区| 欧美日韩一区精品| 91精品视频网| 精品精品国产高清a毛片牛牛 | 国产亚洲自拍一区| 久久久国产一区二区三区四区小说 | 亚洲永久免费av| 亚洲超碰精品一区二区| 日韩成人免费电影| 九一九一国产精品| 成人精品gif动图一区| 91丨porny丨蝌蚪视频| 欧美写真视频网站| 日韩欧美一区二区在线视频| 久久亚洲精品国产精品紫薇| 国产精品成人一区二区艾草 | 免费成人性网站| 五月婷婷激情综合网| 裸体一区二区三区| 国产激情一区二区三区桃花岛亚洲| 成人免费看视频| 欧美日韩日本视频| 久久影音资源网| 亚洲精选视频在线| 偷偷要91色婷婷| 国产成人精品免费看| 在线观看一区二区精品视频| 日韩视频在线你懂得| 国产欧美日本一区二区三区| 一区二区三区不卡视频在线观看| 麻豆免费看一区二区三区| av在线不卡网| 日韩一区二区三区免费看| 国产欧美一区二区在线| 亚洲国产成人av好男人在线观看| 狠狠色丁香九九婷婷综合五月| 色先锋久久av资源部| 精品欧美一区二区三区精品久久 | 久久亚洲综合色| 亚洲一区二区三区四区五区中文| 国产一区二区精品久久| 欧美专区日韩专区| 欧美激情在线一区二区| 日韩电影在线观看网站| 99国产欧美久久久精品| 精品日韩一区二区三区| 夜夜揉揉日日人人青青一国产精品| 国产一区免费电影| 欧美日韩激情一区| 最新高清无码专区| 久久国产精品色婷婷| 精品视频免费在线| 中文字幕在线观看一区| 国内精品嫩模私拍在线| 欧美日韩国产精品自在自线| 日韩伦理av电影| 国产精品123| 久久综合给合久久狠狠狠97色69| 亚洲第一主播视频| 91蜜桃网址入口| 国产欧美一区二区精品性| 久久se精品一区精品二区| 欧美日韩一卡二卡三卡| 亚洲精品第一国产综合野| www.欧美日韩| 中文字幕欧美国产| 国产成人久久精品77777最新版本| 91精品国产综合久久婷婷香蕉| 亚洲制服丝袜在线| 日本乱人伦一区| 一区二区三区四区亚洲| 精品国产凹凸成av人导航| 日韩精品电影一区亚洲| 欧美日韩国产色站一区二区三区| 一区二区三区成人在线视频| 91丨porny丨蝌蚪视频| 亚洲欧美在线视频| jiyouzz国产精品久久| 国产精品日产欧美久久久久| 国产成人av电影免费在线观看| 亚洲精品在线电影| 国产精品中文字幕欧美| 久久久久久久性| 国产精品一区二区视频| 亚洲国产精品国自产拍av| 国产91精品精华液一区二区三区| 国产色一区二区| 成人性色生活片| 亚洲丝袜精品丝袜在线| 色悠悠久久综合| 亚洲大尺度视频在线观看| 在线观看91精品国产麻豆| 日韩国产欧美在线播放| 精品人在线二区三区| 国产成人一区在线| 亚洲青青青在线视频| 色婷婷精品大在线视频| 一片黄亚洲嫩模| 91精品国产一区二区三区| 久久精品久久精品| 国产欧美精品日韩区二区麻豆天美| 成人午夜激情片| 亚洲综合丝袜美腿| 日韩欧美国产综合| 成人激情免费网站| 一二三区精品视频| 欧美一级视频精品观看| 国产精品亚洲а∨天堂免在线| 最新成人av在线| 6080日韩午夜伦伦午夜伦| 国产精品一区二区黑丝| 亚洲男人电影天堂| 日韩欧美卡一卡二| 99riav一区二区三区|