光って残像

■ひとつ前の描画を残して、残像っぽくしたかったので。

graphics.GraphicsDevice.Clear(Color.Black);

を使用せずにspriteで自分でクリアしています。

sprite.Begin();
prite.Draw(texture, new Vector2(0, 0), Color.White);
sprite.End();

今回は関係ないですが場合によってはデプスが気になるときは。

graphics.GraphicsDevice.Clear(ClearOptions.DepthBuffer, Color.Azure, 1.0f, 0);

sprite.Begin();
prite.Draw(texture, new Vector2(0, 0), Color.White);
sprite.End();

としてデプス部分だけでもクリアしておくのも良いかも。

protected override void Draw(GameTime gameTime)
{
    sprite.Begin();
    sprite.Draw(texture, new Vector2(0, 0), Color.White);
    sprite.End();
    //-----------------------------------------------------
    graphics.GraphicsDevice.RenderState.AlphaBlendEnable = true;
    graphics.GraphicsDevice.RenderState.SourceBlend = Blend.SourceAlpha;
    graphics.GraphicsDevice.RenderState.DestinationBlend = Blend.One;
    graphics.GraphicsDevice.RenderState.DepthBufferEnable = false;
    for (int k = -4; k < 5; k++)
    {
        for (int j = -4; j < 5; j++)
        {
            for (int i = -4; i < 5; i++)
            {
                mainWorld = viewInvert * Matrix.CreateTranslation(i * 2.5f, j * 2.5f, k * 2.5f);
                foreach (ModelMesh mesh in model.Meshes)
                {
                    foreach (BasicEffect effect in mesh.Effects)
                    {
                        effect.View = mainView;
                        effect.World = mainWorld;
                        effect.Projection = mainProjection;
                    }
                    mesh.Draw();
                }
            }
        }
    }
    base.Draw(gameTime);
}

■こんな感じ

今日は風邪気味で元気ないので・・・・