public void Render(GraphicsDevice GraphicsDevice, RenderTargetDouble input, float scale, RenderTargetDouble output) { boundaryFx.Parameters["read"].SetValue(input.Read); boundaryFx.Parameters["gridSize"].SetValue(new Vector2(w, h)); boundaryFx.Parameters["scale"].SetValue(scale); GraphicsDevice.SetRenderTarget(output.Write); SpriteBatch spriteBatch = new SpriteBatch(GraphicsDevice); DrawLine(spriteBatch, new Rectangle(0, 0, 1, h), new Vector2(1, 0)); DrawLine(spriteBatch, new Rectangle(w - 1, 0, 1, h), new Vector2(-1, 0)); DrawLine(spriteBatch, new Rectangle(0, h - 1, w, 1), new Vector2(0, 1)); DrawLine(spriteBatch, new Rectangle(0, 0, w, 1), new Vector2(0, -1)); GraphicsDevice.SetRenderTarget(null); }
public void Render(GraphicsDevice GraphicsDevice, RenderTargetDouble velocity, RenderTargetDouble output) { vorticityFx.Parameters["velocity"].SetValue(velocity.Read); vorticityFx.Parameters["gridSize"].SetValue(new Vector2(this.w, this.h)); vorticityFx.Parameters["gridScale"].SetValue(1.0f); GraphicsDevice.SetRenderTarget(output.Write); SpriteBatch spriteBatch = new SpriteBatch(GraphicsDevice); Rectangle r = new Rectangle(0, 0, this.w, this.h); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque, null, null, null, vorticityFx); spriteBatch.Draw(Game1.textureWhite, r, Color.White); spriteBatch.End(); GraphicsDevice.SetRenderTarget(null); output.Swap(); }
public void Render(GraphicsDevice GraphicsDevice, RenderTargetDouble input, Vector3 color, Vector2 point, float radius, RenderTargetDouble output) { splatFx.Parameters["read"].SetValue(input.Read); splatFx.Parameters["color"].SetValue(color); splatFx.Parameters["center"].SetValue(point); splatFx.Parameters["gridSize"].SetValue(new Vector2(this.w, this.h)); splatFx.Parameters["radius"].SetValue(radius); GraphicsDevice.SetRenderTarget(output.Write); SpriteBatch spriteBatch = new SpriteBatch(GraphicsDevice); Rectangle r = new Rectangle(0, 0, this.w, this.h); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque, null, null, null, splatFx); spriteBatch.Draw(Game1.textureWhite, r, Color.White); spriteBatch.End(); GraphicsDevice.SetRenderTarget(null); output.Swap(); }
public void Render(GraphicsDevice GraphicsDevice, RenderTargetDouble velocity, RenderTargetDouble advected, RenderTargetDouble output) { advect.Parameters["velocity"].SetValue(velocity.Read); advect.Parameters["advected"].SetValue(advected.Read); advect.Parameters["gridSize"].SetValue(new Vector2(w, h)); advect.Parameters["gridScale"].SetValue(1.0f); advect.Parameters["timestep"].SetValue(timestep); advect.Parameters["dissipation"].SetValue(dissipation); GraphicsDevice.SetRenderTarget(output.Write); SpriteBatch spriteBatch = new SpriteBatch(GraphicsDevice); Rectangle r = new Rectangle(0, 0, w, h); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque, null, null, null, advect); spriteBatch.Draw(Game1.textureWhite, r, Color.White); spriteBatch.End(); GraphicsDevice.SetRenderTarget(null); output.Swap(); }
public void Render(GraphicsDevice GraphicsDevice, RenderTargetDouble x, RenderTargetDouble b, RenderTargetDouble output, Boundary boundary, float scale) { for (var i = 0; i < iterations; i++) { jacobiFx.Parameters["x"].SetValue(x.Read); jacobiFx.Parameters["b"].SetValue(b.Read); jacobiFx.Parameters["gridSize"].SetValue(new Vector2(w, h)); jacobiFx.Parameters["alpha"].SetValue(alpha); jacobiFx.Parameters["beta"].SetValue(beta); GraphicsDevice.SetRenderTarget(output.Write); SpriteBatch spriteBatch = new SpriteBatch(GraphicsDevice); Rectangle r = new Rectangle(0, 0, w, h); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque, null, null, null, jacobiFx); spriteBatch.Draw(Game1.textureWhite, r, Color.White); spriteBatch.End(); GraphicsDevice.SetRenderTarget(null); output.Swap(); boundary.Render(GraphicsDevice, output, scale, output); } }