コード例 #1
0
        public FluidSimulation1()
        {
            graphicsDeviceManager = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            fpsCounter = new FpsComponent(this);

            graphicsDeviceManager.PreferredBackBufferWidth = 1280;
            graphicsDeviceManager.PreferredBackBufferHeight = 1024;
            //graphics.PreferMultiSampling = true;
            graphicsDeviceManager.ApplyChanges();

            Camera = new Camera();
            Camera.AspectRatio = graphicsDeviceManager.PreferredBackBufferWidth / (float)graphicsDeviceManager.PreferredBackBufferHeight;

            Camera.Reset();

            Components.Add(fpsCounter);

            IsMouseVisible = true;
        }
コード例 #2
0
        public void Draw(Camera camera, Matrix world, BasicEffect basicEffect)
        {
            if (this.isActive)
            {
                this.CreateMesh();

                if (this.NumTriangles > 0)
                {
                    basicEffect.Alpha = 1.0f;
                    basicEffect.DiffuseColor = new Vector3(0.18f, 0.81f, 1);

                    basicEffect.World = world;
                    basicEffect.View = camera.View;
                    basicEffect.Projection = camera.Projection;

                    basicEffect.EnableDefaultLighting();

                    // reset render states
                    graphicsDevice.RasterizerState = RasterizerState.CullClockwise;

                    foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)
                    {
                        pass.Apply();
                        this.graphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, this.localVertices, 0, this.NumTriangles);
                    }
                }
            }
        }