Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ StepLiquids()

void Terraria.GameContent.Shaders.WaterShaderData.StepLiquids ( )
inlineprivate

Definition at line 127 of file WaterShaderData.cs.

128 {
129 _isWaveBufferDirty = true;
130 Vector2 vector = (Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange));
131 Vector2 vector2 = vector - Main.screenPosition;
132 TileBatch tileBatch = Main.tileBatch;
133 GraphicsDevice graphicsDevice = Main.instance.GraphicsDevice;
134 graphicsDevice.SetRenderTarget(_distortionTarget);
135 if (_clearNextFrame)
136 {
137 graphicsDevice.Clear(new Color(0.5f, 0.5f, 0f, 1f));
138 _clearNextFrame = false;
139 }
140 DrawWaves();
142 graphicsDevice.Clear(new Color(0.5f, 0.5f, 0.5f, 1f));
143 Main.tileBatch.Begin();
144 vector2 *= 0.25f;
145 vector2.X = (float)Math.Floor(vector2.X);
146 vector2.Y = (float)Math.Floor(vector2.Y);
147 Vector2 vector3 = vector2 - _lastDistortionDrawOffset;
150 GameShaders.Misc["WaterProcessor"].Apply(new DrawData(_distortionTarget, Vector2.Zero, Color.White));
151 tileBatch.End();
152 RenderTarget2D distortionTarget = _distortionTarget;
154 _distortionTargetSwap = distortionTarget;
156 {
158 tileBatch.Begin();
159 Rectangle cachedDrawArea = LiquidRenderer.Instance.GetCachedDrawArea();
160 Rectangle rectangle = new Rectangle(0, 0, cachedDrawArea.Height, cachedDrawArea.Width);
161 Vector4 destination = new Vector4(cachedDrawArea.X + cachedDrawArea.Width, cachedDrawArea.Y, cachedDrawArea.Height, cachedDrawArea.Width);
162 destination *= 16f;
163 destination.X -= vector.X;
164 destination.Y -= vector.Y;
165 destination *= 0.25f;
166 destination.X += vector2.X;
167 destination.Y += vector2.Y;
168 graphicsDevice.SamplerStates[0] = SamplerState.PointClamp;
169 tileBatch.Draw(_viscosityMaskChain[_activeViscosityMask], destination, rectangle, new VertexColors(Color.White), rectangle.Size(), SpriteEffects.FlipHorizontally, -(float)Math.PI / 2f);
170 tileBatch.End();
173 }
174 graphicsDevice.SetRenderTarget(null);
175 }
void Clear(ClearOptions options, Vector4 color, float depth, int stencil)
unsafe void SetRenderTarget(RenderTargetCube renderTarget, CubeMapFace cubeMapFace)
unsafe GraphicsDevice(IDirect3DDevice9 *pInterface, GraphicsDevice pDevice)
static readonly SamplerState PointClamp
const double PI
Definition Math.cs:16
static double Floor(double d)
static Dictionary< string, MiscShaderData > Misc
void Draw(Texture2D texture, Vector2 position, VertexColors colors)
Definition TileBatch.cs:127
void Begin(RasterizerState rasterizer, Matrix transformation)
Definition TileBatch.cs:115

References Terraria.GameContent.Shaders.WaterShaderData._activeViscosityMask, Terraria.GameContent.Shaders.WaterShaderData._clearNextFrame, Terraria.GameContent.Shaders.WaterShaderData._distortionTarget, Terraria.GameContent.Shaders.WaterShaderData._distortionTargetSwap, Terraria.GameContent.Shaders.WaterShaderData._isWaveBufferDirty, Terraria.GameContent.Shaders.WaterShaderData._lastDistortionDrawOffset, Terraria.GameContent.Shaders.WaterShaderData._useViscosityFilter, Terraria.GameContent.Shaders.WaterShaderData._viscosityMaskChain, Terraria.Graphics.TileBatch.Begin(), Microsoft.Xna.Framework.Graphics.GraphicsDevice.Clear(), Microsoft.Xna.Framework.Graphics.Color, System.destination, Terraria.Graphics.TileBatch.Draw(), Terraria.GameContent.Shaders.WaterShaderData.DrawWaves(), Terraria.Graphics.TileBatch.End(), System.Math.Floor(), Microsoft.Xna.Framework.Graphics.Texture2D.Height, Microsoft.Xna.Framework.Rectangle.Height, Terraria.GameContent.Liquid.LiquidRenderer.Instance, Terraria.Main.instance, Terraria.Graphics.Shaders.GameShaders.Misc, Terraria.Main.offScreenRange, System.Math.PI, Microsoft.Xna.Framework.Graphics.SamplerState.PointClamp, Microsoft.Xna.Framework.Graphics.GraphicsDevice.SamplerStates, Terraria.Main.screenPosition, Microsoft.Xna.Framework.Graphics.GraphicsDevice.SetRenderTarget(), Terraria.Main.tileBatch, Microsoft.Xna.Framework.Graphics.Vector2, Microsoft.Xna.Framework.Graphics.Vector4, Microsoft.Xna.Framework.Color.White, Microsoft.Xna.Framework.Graphics.Texture2D.Width, Microsoft.Xna.Framework.Rectangle.Width, Microsoft.Xna.Framework.Rectangle.X, Microsoft.Xna.Framework.Vector2.X, Microsoft.Xna.Framework.Rectangle.Y, Microsoft.Xna.Framework.Vector2.Y, and Microsoft.Xna.Framework.Vector2.Zero.

Referenced by Terraria.GameContent.Shaders.WaterShaderData.PreDraw().