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

◆ SetWorldViewProjAndFog()

static EffectDirtyFlags Microsoft.Xna.Framework.Graphics.EffectHelpers.SetWorldViewProjAndFog ( EffectDirtyFlags dirtyFlags,
ref Matrix world,
ref Matrix view,
ref Matrix projection,
ref Matrix worldView,
bool fogEnabled,
float fogStart,
float fogEnd,
EffectParameter worldViewProjParam,
EffectParameter fogVectorParam )
inlinestaticpackage

Definition at line 22 of file EffectHelpers.cs.

23 {
24 if ((dirtyFlags & EffectDirtyFlags.WorldViewProj) != 0)
25 {
26 Matrix.Multiply(ref world, ref view, out worldView);
27 Matrix.Multiply(ref worldView, ref projection, out var result);
28 worldViewProjParam.SetValue(result);
29 dirtyFlags &= ~EffectDirtyFlags.WorldViewProj;
30 }
31 if (fogEnabled)
32 {
33 if ((dirtyFlags & (EffectDirtyFlags.Fog | EffectDirtyFlags.FogEnable)) != 0)
34 {
35 SetFogVector(ref worldView, fogStart, fogEnd, fogVectorParam);
36 dirtyFlags &= ~(EffectDirtyFlags.Fog | EffectDirtyFlags.FogEnable);
37 }
38 }
39 else if ((dirtyFlags & EffectDirtyFlags.FogEnable) != 0)
40 {
41 fogVectorParam.SetValue(Vector4.Zero);
42 dirtyFlags &= ~EffectDirtyFlags.FogEnable;
43 }
44 return dirtyFlags;
45 }
static void SetFogVector(ref Matrix worldView, float fogStart, float fogEnd, EffectParameter fogVectorParam)

References Microsoft.Xna.Framework.Matrix.Multiply(), Microsoft.Xna.Framework.Graphics.EffectHelpers.SetFogVector(), Microsoft.Xna.Framework.Graphics.EffectParameter.SetValue(), and Microsoft.Xna.Framework.Vector4.Zero.

Referenced by Microsoft.Xna.Framework.Graphics.AlphaTestEffect.OnApply(), Microsoft.Xna.Framework.Graphics.BasicEffect.OnApply(), Microsoft.Xna.Framework.Graphics.DualTextureEffect.OnApply(), Microsoft.Xna.Framework.Graphics.EnvironmentMapEffect.OnApply(), and Microsoft.Xna.Framework.Graphics.SkinnedEffect.OnApply().