Go to the documentation of this file.00001 using System;
00002 using System.Collections.Generic;
00003 using System.Linq;
00004 using System.Text;
00005 using Microsoft.Xna.Framework;
00006 using Microsoft.Xna.Framework.Content;
00007 using Microsoft.Xna.Framework.Graphics;
00008 using Microsoft.Xna.Framework.Input;
00009
00010 namespace visLU2.Effects
00011 {
00016 class FlowShader: Effect
00017 {
00018 Game game;
00019 GraphicsDevice device;
00020 Effect effect;
00021
00022 private EffectParameter worldViewProjection;
00023 public EffectParameter world;
00024 public EffectParameter cameraPosition;
00025 private EffectParameter transferValues;
00026 private EffectParameter backBufferValues;
00027 private EffectParameter channel;
00028
00029 private Texture2D backBuffer;
00030 private Texture2D transfer;
00031
00038 public FlowShader(Game _game, GraphicsDevice _device, Effect _effect)
00039 : base(_device, _effect)
00040 {
00041 game = _game;
00042 device = _device;
00043 effect = _effect;
00044
00045
00046 worldViewProjection = this.Parameters["myWorldViewProjectionMatrix"];
00047
00048
00049 world = this.Parameters["myWorldMatrix"];
00050
00051
00052 cameraPosition = this.Parameters["CameraPosition"];
00053
00054
00055 transferValues = this.Parameters["Transfer"];
00056
00057
00058 backBufferValues = this.Parameters["BackBuffer"];
00059
00060
00061 channel = this.Parameters["Channel"];
00062 }
00063
00064
00068 public Texture2D TransferTexture
00069 {
00070 get { return transfer; }
00071 set { transfer = value; }
00072 }
00073
00077 public Texture2D BackBuffer
00078 {
00079 get { return backBuffer; }
00080 set { backBuffer = value; }
00081 }
00082
00083 #region SetEffectParameter
00084
00085
00091 public void SetEffectParameter(Matrix _worldViewProjection, Matrix _world, int channelNr)
00092 {
00093 this.worldViewProjection.SetValue(_worldViewProjection);
00094 this.world.SetValue(_world);
00095 this.transferValues.SetValue(transfer);
00096 this.channel.SetValue(channelNr);
00097 if (backBuffer != null)
00098 {
00099 this.backBufferValues.SetValue(backBuffer);
00100 }
00101 }
00102
00107 public void SetEffectParameter(Vector3 _cameraPosition)
00108 {
00109 this.cameraPosition.SetValue(_cameraPosition);
00110 }
00111
00112
00113
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158 #endregion
00159 }
00160 }