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

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

?? d3dtriangle.cs

?? Particle System Test Application on C#
?? CS
?? 第 1 頁 / 共 2 頁
字號:
using System;
using System.Collections;
using System.Drawing;
using System.Windows.Forms;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;
using ParticleSystems.Verlet;
using ParticleSystems.Verlet.GlobalConstraints;
using ParticleSystems.Verlet.Constraints;
using ParticleSystems.Verlet.Effects;
using ParticleSystems.Verlet.Tools;
using Direct3D=Microsoft.DirectX.Direct3D;

public delegate void MessageDelegate(byte message); // Delegate for messages arriving via DirectPlay.
public delegate void AudioDelegate(); // Delegate to handle audio playback.
public delegate void PeerCloseCallback(); // This delegate will be called when the session terminated event is fired.

public class GraphicsClass : GraphicsSample
{
    private float x = 0;
    private float y = 0;
    private int bufferSize = 10000;
    private GraphicsFont drawingFont = null;
    private VertexBuffer linesVertexBuffer = null;
    private int renderedLines = 0;
    private int LastTick = Environment.TickCount;
    private int Elapsed = Environment.TickCount;
    private Point destination = new Point(0, 0);
    private ParticleSystem particleSystem = new ParticleSystem(0.02f);
    private bool updating = false;
    private Wind windEffect;

    public GraphicsClass()
    {
        this.MinimumSize = new Size(200,100);
        this.Text = "ParticleSystemTestApplication";
        this.KeyDown += new KeyEventHandler(this.OnPrivateKeyDown);
        this.KeyUp += new KeyEventHandler(this.OnPrivateKeyUp);
        drawingFont = new GraphicsFont( "Arial", System.Drawing.FontStyle.Bold );

        InitializeParticleSystem(particleSystem, out windEffect);
    }

    /// <summary>
    /// Initialize the particle system
    /// </summary>
    /// <param name="ps">A particle system</param>
    /// <param name="windEffect">out: A wind effect</param>
    static void InitializeParticleSystem(ParticleSystem ps, out Wind windEffect)
    {
        ParticleSystem.Transaction lTransaction = 
            ps.GetTransaction();

        // Set the gravity of the particle system
        ps.Gravity = new Vector3(0, -1, 0);

        // Create axis aligned box global constraint ( to prevent the particles
        // from falling out of view)
        Vector3 lCorner = new Vector3(-10, -15, -10);
        Vector3 lOppositeCorner = new Vector3(10, 15, 10);
        lTransaction.AddGlobalConstraint(new AxisAlignedBox(
            lCorner, 
            lOppositeCorner));

        // Create a RopeConstraintFactory for our parachute
        Tools.ITwoParticleConstraintFactory lConstraintFactory = 
            new Tools.RopeConstraintFactory(1.5f);

        // Generate a mesh of rope constraints. This will be the cloth of the 
        // parachute
        Particle[] lMeshParticles;
        int lParticleAlongXAxis = 10;
        int lParticleAlongYAxis = 10;
        {
            // The mesh is created in the x-y plane. We want it to be in the
            // x-z plane. Therefore rotate it
            Matrix lRotationMatrix = Matrix.RotationX((float)(Math.PI / 2.0));
            // Scale it as well
            Matrix lScaleMatrix = Matrix.Scaling(5.0f, 5.0f, 5.0f);

            // Create the mesh
            lMeshParticles = Tools.CreateMesh(
                10.0f, 
                lParticleAlongXAxis, 
                lParticleAlongYAxis, 
                lScaleMatrix * lRotationMatrix, 
                lConstraintFactory, 
                lTransaction);
        }

        // Index of the four corners of the mesh
        int l00CornerIndex = 0;
        int l01CornerIndex = lParticleAlongYAxis - 1;
        int l10CornerIndex = (lParticleAlongXAxis - 1)* lParticleAlongYAxis;
        int l11CornerIndex = lParticleAlongXAxis * lParticleAlongYAxis - 1;

        // Insert stick constraints between the corners to prevent the parachute
        // from falling together
        lTransaction.AddConstraint(new Stick(lMeshParticles[l00CornerIndex], lMeshParticles[l01CornerIndex]));
        lTransaction.AddConstraint(new Stick(lMeshParticles[l01CornerIndex], lMeshParticles[l11CornerIndex]));
        lTransaction.AddConstraint(new Stick(lMeshParticles[l11CornerIndex], lMeshParticles[l10CornerIndex]));
        lTransaction.AddConstraint(new Stick(lMeshParticles[l10CornerIndex], lMeshParticles[l00CornerIndex]));
        lTransaction.AddConstraint(new Stick(lMeshParticles[l11CornerIndex], lMeshParticles[l00CornerIndex]));
        lTransaction.AddConstraint(new Stick(lMeshParticles[l10CornerIndex], lMeshParticles[l01CornerIndex]));

        // Create a StickConstraint factory for our brave parachuter
        Tools.ITwoParticleConstraintFactory lStickConstraintFactory = 
            new Tools.StickConstraintFactory();

        Particle[] lJumperParticles;
        {
            // Translate the parachuter
            Matrix lTranslateMatrix = Matrix.Translation(0.0f, -5.0f, 0.0f);
            // And scale it
            Matrix lScaleMatrix = Matrix.Scaling(2.0f, 2.0f, 2.0f);

            Tools.IParticlePreProcessor lMatrixTransformPreProcessor = 
                new Tools.MatrixTransformParticlePreProcessor(lScaleMatrix * lTranslateMatrix);

            // This is an advanced feature. We want the top of the parachuter
            // to be "squeezed" together a bit. This is a nonlinear transform
            // which means we can't do it using matrices. However, 
            // SqueezeParticlePreProcessor comes to the rescure. We chain the 
            // this preprocessor together with the scale and rotation 
            // preprocessor
            Tools.IParticlePreProcessor lPreprocessor = 
                new Tools.SqueezeParticlePreProcessor(
                new Vector3(0.0f, -0.5f, 0.0f), 
                0.25f,
                new Vector3(1.0f, 0.0f, 1.0f),
                lMatrixTransformPreProcessor);

            // Create our parachuter
            lJumperParticles = Tools.CreateBox(
                100.0f, 
                lPreprocessor,
                lStickConstraintFactory, 
                lTransaction);
        }

        // Attach chains of rope constraints between the parachuter and the 
        // parachute. We use chains as it looks nicer. A simple rope constraint
        // would have a similar effect
        Tools.CreateChain(lJumperParticles[2], lMeshParticles[l00CornerIndex], 1.0f, 5, lConstraintFactory, lTransaction);
        Tools.CreateChain(lJumperParticles[3], lMeshParticles[l01CornerIndex], 1.0f, 5, lConstraintFactory, lTransaction);
        Tools.CreateChain(lJumperParticles[6], lMeshParticles[l10CornerIndex], 1.0f, 5, lConstraintFactory, lTransaction);
        Tools.CreateChain(lJumperParticles[7], lMeshParticles[l11CornerIndex], 1.0f, 5, lConstraintFactory, lTransaction);

        // Add a wind effect that blows upon the particles in the parachute only
        windEffect = new Wind(lMeshParticles, 0.5f, new Vector3(0.0f, 40.0f, 0.0f));
        lTransaction.AddEffect(windEffect);

        // We're done. Commit the changes into the particle system
        lTransaction.Commit();
    }

    /// <summary>
    /// Event Handler for windows messages
    /// </summary>
    private void OnPrivateKeyDown(object sender, KeyEventArgs e)
    {
        switch (e.KeyCode)
        {
            case Keys.Up:
            {
                destination.X = 1;
                break;
            }
            case Keys.Down:
            {
                destination.X = -1;
                break;
            }
            case Keys.Left:
            {
                destination.Y = 1;
                break;
            }
            case Keys.Right:
            {
                destination.Y = -1;
                break;
            }
            case Keys.A:
            {
                particleSystem.Gravity = new Vector3(0, -1, 0);
                break;
            }
            case Keys.B:
            {
                particleSystem.Gravity = new Vector3(0, 1, 0);
                break;
            }
            case Keys.S:
            {
                Tools.Shake(10.0f, particleSystem);
                break;
            }
            case Keys.K:
            {
                windEffect.Direction = windEffect.Direction * 1.10f;
                break;
            }
            case Keys.L:
            {
                windEffect.Direction = windEffect.Direction * (1.0f/1.10f);
                break;
            }

        }
    }

    override public void OnUpdateTimer(object sender, System.EventArgs e) 
    {
        if( !updating )
        {
            updating = true;
            try
            {
                particleSystem.TimeStep(5);
                FillVertexBuffer(
                    linesVertexBuffer, 
                    out renderedLines,
                    particleSystem);
            }
            finally
            {
                updating = false;
            }
        }
    }

    private void OnPrivateKeyUp(object sender, KeyEventArgs e)
    {
        switch (e.KeyCode)
        {
            case Keys.Up:
            case Keys.Down:
                destination.X = 0;
                break;
            case Keys.Left:
            case Keys.Right:
            {
                destination.Y = 0;
                break;
            }
        }
    }

    /// <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>
    protected override void Render()
    {
        //Clear the backbuffer to a Blue color 
        device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Blue, 1.0f, 0);
        //Begin the scene
        device.BeginScene();

        // Setup the world, view, and projection matrices
        Matrix m = new Matrix();
        
        if( destination.Y != 0 )
            y += DXUtil.Timer(DirectXTimer.GetElapsedTime) * (destination.Y * 25); 

        if( destination.X != 0 )
            x += DXUtil.Timer(DirectXTimer.GetElapsedTime) * (destination.X * 25);

        m = Matrix.RotationY(y);
        m *= Matrix.RotationX(x);

        device.Transform.World = m;
        device.Transform.View = Matrix.LookAtLH( new Vector3( 0.0f, 0.0f, 40.0f ), new Vector3( 0.0f, 0.0f, 0.0f ), new Vector3( 0.0f, 1.0f, 0.0f ) );   
        device.Transform.Projection = Matrix.PerspectiveFovLH( (float)Math.PI / 4, 1.0f, 1.0f, 100.0f );

        // set the vertexbuffer stream source
        device.SetStreamSource(0, linesVertexBuffer, 0, VertexInformation.GetFormatSize(CustomVertex.PositionColored.Format));
        device.VertexFormat = CustomVertex.PositionColored.Format;

        // set fill mode
        device.RenderState.FillMode = FillMode.Solid;
        device.DrawPrimitives(PrimitiveType.LineList, 0, renderedLines );

        device.EndScene();
    }

    /// <summary>
    /// Initialize scene objects.
    /// </summary>
    protected override void InitializeDeviceObjects()
    {
        drawingFont.InitializeDeviceObjects(device);
        
        // Now Create the VB
        linesVertexBuffer = new VertexBuffer(typeof(CustomVertex.PositionColored), bufferSize, device, Usage.WriteOnly, CustomVertex.PositionColored.Format, Pool.Default);
        linesVertexBuffer.Created += new System.EventHandler(this.OnCreateVertexBuffer);
        this.OnCreateVertexBuffer(linesVertexBuffer, null);
    }

    /// <summary>
    /// Called when a device needs to be restored.
    /// </summary>
    protected override void RestoreDeviceObjects(System.Object sender, System.EventArgs e)
    {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美视频在线观看一区| 欧美变态口味重另类| 美女视频免费一区| 亚洲人成精品久久久久| 精品国产一区二区精华| 欧洲中文字幕精品| 国产成人综合亚洲91猫咪| 午夜欧美一区二区三区在线播放| 国产视频一区二区三区在线观看| 欧美精品粉嫩高潮一区二区| 成人一级黄色片| 久久精品国产一区二区三| 亚洲男人的天堂在线aⅴ视频| 国产亚洲欧美中文| 日韩精品影音先锋| 51久久夜色精品国产麻豆| 91性感美女视频| 成人app软件下载大全免费| 国内精品伊人久久久久av一坑| 成人的网站免费观看| 日韩精品福利网| 亚洲国产aⅴ天堂久久| 亚洲欧美中日韩| 国产性色一区二区| 久久蜜桃av一区精品变态类天堂| 欧美一区二区免费| 91麻豆精品国产91久久久资源速度 | 日韩美女视频一区二区在线观看| 91免费在线播放| av不卡在线观看| 成人午夜电影小说| 成人午夜免费视频| 国产99久久久精品| 国产毛片一区二区| 韩国精品久久久| 精品一区二区三区影院在线午夜| 免费人成网站在线观看欧美高清| 天天综合网 天天综合色| 亚洲午夜视频在线| 亚洲综合成人在线视频| 亚洲永久免费av| 一区二区三区在线播放| 一片黄亚洲嫩模| 亚洲国产一区二区三区| 香蕉乱码成人久久天堂爱免费| 亚洲福利一区二区三区| 偷窥国产亚洲免费视频 | 在线综合+亚洲+欧美中文字幕| 在线观看亚洲a| 欧美三级资源在线| 51久久夜色精品国产麻豆| 91精品国产综合久久香蕉麻豆| 日韩欧美一级在线播放| 久久综合久色欧美综合狠狠| 国产肉丝袜一区二区| 亚洲欧美综合色| 亚洲一级二级在线| 免费成人av在线| 国产一区二区女| 成人国产亚洲欧美成人综合网| 99久久精品国产毛片| 欧洲一区二区三区在线| 日韩欧美中文字幕精品| 国产情人综合久久777777| 亚洲欧美另类图片小说| 午夜免费久久看| 激情综合一区二区三区| 99久久精品99国产精品| 欧美精选一区二区| www日韩大片| 亚洲六月丁香色婷婷综合久久 | 一个色综合网站| 免费看欧美女人艹b| 成人性生交大片免费看视频在线 | 日一区二区三区| 国产在线看一区| 91在线视频在线| 欧美一区二区视频观看视频 | 午夜精品久久久久久久久久久| 久久精品久久久精品美女| 成人性生交大合| 欧美乱妇15p| 中文字幕av一区 二区| 亚洲狠狠爱一区二区三区| 国产制服丝袜一区| 色播五月激情综合网| 精品国产sm最大网站免费看| 中文字幕综合网| 久久精品二区亚洲w码| 91麻豆免费观看| 欧美成人vr18sexvr| 亚洲永久精品大片| 国产91精品一区二区| 欧美精品123区| 亚洲视频香蕉人妖| 激情综合亚洲精品| 欧美精品在欧美一区二区少妇| 国产女人aaa级久久久级| 日日噜噜夜夜狠狠视频欧美人| www.色精品| 精品国产不卡一区二区三区| 亚洲高清三级视频| www.亚洲在线| 26uuu亚洲综合色| 婷婷激情综合网| 在线一区二区三区| 国产精品久久夜| 国产精品一区专区| 日韩小视频在线观看专区| 亚洲一区二区三区视频在线播放| 丁香婷婷综合五月| 天天影视网天天综合色在线播放 | 欧美日韩免费一区二区三区 | 日本道色综合久久| 国产精品私房写真福利视频| 美国十次综合导航| 欧美伦理影视网| 亚洲国产裸拍裸体视频在线观看乱了| 岛国一区二区三区| 久久精品视频网| 国产麻豆91精品| 精品国产一区二区三区av性色| 日韩av一区二区三区四区| 欧美偷拍一区二区| 一区二区三区免费在线观看| 97精品久久久午夜一区二区三区 | 精品一区中文字幕| 91精品国产综合久久精品图片| 亚洲一区二区欧美| 欧美视频精品在线| 亚洲国产三级在线| 欧美另类高清zo欧美| 亚洲成人资源网| 精品视频免费在线| 视频一区在线视频| 欧美精选午夜久久久乱码6080| 亚洲444eee在线观看| 欧美三级视频在线| 午夜精品久久久久久久久久久 | 最新国产成人在线观看| 成人精品视频一区二区三区| 国产无一区二区| 成人av在线播放网站| 中文字幕在线视频一区| 91浏览器打开| 亚洲一区二区三区小说| 欧美日韩视频专区在线播放| 日韩国产在线一| 日韩视频123| 国产传媒日韩欧美成人| 国产精品热久久久久夜色精品三区| 成人av先锋影音| 亚洲第一狼人社区| 亚洲不卡在线观看| 成人av片在线观看| 自拍视频在线观看一区二区| 久久久国产一区二区三区四区小说| 国产一区二区在线观看视频| 国产午夜精品久久久久久免费视| 成人手机电影网| 亚洲一区二区欧美激情| 91精品国产综合久久久久 | 成人开心网精品视频| 亚洲三级在线看| 欧美午夜精品一区二区三区| 蜜臀精品久久久久久蜜臀 | 午夜精品免费在线| 精品久久久三级丝袜| thepron国产精品| 亚洲bt欧美bt精品| 中文字幕欧美激情| 欧美日韩黄色影视| 国产jizzjizz一区二区| 亚洲一二三四久久| 久久老女人爱爱| 在线观看亚洲成人| 国产麻豆精品在线| 亚洲午夜电影在线观看| www久久久久| 欧美日韩国产综合一区二区| 国产精品自拍在线| 亚洲va国产va欧美va观看| 久久久蜜桃精品| 欧美人牲a欧美精品| 福利一区二区在线| 午夜精品视频一区| 亚洲欧洲性图库| 精品对白一区国产伦| 在线精品亚洲一区二区不卡| 国产呦精品一区二区三区网站| 亚洲精品视频免费看| 久久香蕉国产线看观看99| 欧美亚洲丝袜传媒另类| 粉嫩嫩av羞羞动漫久久久| 视频一区二区欧美| 亚洲天堂久久久久久久| 久久精品夜色噜噜亚洲a∨| 欧美福利电影网| 日本精品视频一区二区三区| 国产电影一区在线|