// Set blur parameters to effect void SetParameters(GaussianBlurDirection Direction) { if (Direction == GaussianBlurDirection.Horizontal) { gblur.Parameters["sampleWeights"].SetValue(sampleWeightsH); gblur.Parameters["sampleOffsets"].SetValue(sampleOffsetsH); } else { gblur.Parameters["sampleWeights"].SetValue(sampleWeightsV); gblur.Parameters["sampleOffsets"].SetValue(sampleOffsetsV); } }
// Applies post processor to texture in specified direction public void Draw(GaussianBlurDirection Direction, Texture2D Input) { this.Input = Input; SetParameters(Direction); base.Draw(); }
void SetParameters(GaussianBlurDirection Direction) { if (Direction == GaussianBlurDirection.Horizontal) { Effect.Parameters["sampleWeights"].SetValue(sampleWeightsH); Effect.Parameters["sampleOffsets"].SetValue(sampleOffsetsH); } else if (Direction == GaussianBlurDirection.Vertical) { Effect.Parameters["sampleWeights"].SetValue(sampleWeightsV); Effect.Parameters["sampleOffsets"].SetValue(sampleOffsetsV); } }