Ejemplo n.º 1
0
        /// <summary>
        /// Allows the game component to draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            Matrix world      = fCamera.Camera.WorldMatrix;
            Matrix view       = fCamera.Camera.ViewMatrix;
            Matrix projection = fCamera.Camera.ProjectionMatrix;

            if (!fHalted)
            {
                fWorldAngle += Convert.ToSingle(gameTime.ElapsedGameTime.TotalSeconds * 0.5f);
            }
            world        = Matrix.CreateRotationY(fWorldAngle);
            fPlaneAngle += Convert.ToSingle(gameTime.ElapsedGameTime.TotalSeconds * 2.5f);

            CreateRenderTarget(gameTime);

            GraphicsDevice.SamplerStates[0] = SamplerState.LinearWrap;

            GraphicsDevice.BlendState        = BlendState.NonPremultiplied;
            GraphicsDevice.DepthStencilState = DepthStencilState.Default;
            GraphicsDevice.RasterizerState   = RasterizerState.CullNone;

            fTargetEffect.View       = view;
            fTargetEffect.Projection = projection;
            fTargetEffect.World      = world;
            fTargetEffect.Texture    = fTarget;
            fTargetEffect.CurrentTechnique.Passes[0].Apply();
            fBillboard.Render();

            base.Draw(gameTime);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Render the points
 /// </summary>
 private void DrawPoints()
 {
     if (fPoints.Count > 0 && fBillboard != null)
     {
         GraphicsDevice.BlendState        = fBlendState;
         GraphicsDevice.DepthStencilState = DepthStencilState.None;
         Matrix vp = fCamera.Camera.ViewMatrix * fCamera.Camera.ProjectionMatrix;
         fShader.Parameters["world"].SetValue(fCamera.Camera.WorldMatrix);
         fShader.Parameters["vp"].SetValue(vp);
         fShader.Parameters["particleTexture"].SetValue(fTexture);
         for (int ps = 0; ps < fShader.CurrentTechnique.Passes.Count; ps++)
         {
             fShader.CurrentTechnique.Passes[ps].Apply();
             fBillboard.Render();
         }
     }
 }