1 #region Using Statements
3 using System.Collections.Generic;
6 using Microsoft.Xna.Framework;
7 using Microsoft.Xna.Framework.Content;
8 using Microsoft.Xna.Framework.Graphics;
9 using Microsoft.Xna.Framework.Input;
12 namespace visLU.Effects
20 GraphicsDevice device;
23 private EffectParameter worldViewProjection;
24 public EffectParameter world;
25 public EffectParameter cameraPosition;
26 private EffectParameter frontFaces;
27 private EffectParameter backFaces;
28 private EffectParameter transferValues;
29 private EffectParameter transferValuesAlpha;
30 private EffectParameter volumeTexture;
31 private EffectParameter directLightPosition;
32 private EffectParameter stepSize;
33 private EffectParameter baseSampleDist;
34 private EffectParameter sampleDist;
35 private EffectParameter iterations;
36 private EffectParameter side;
37 private EffectParameter scaleFactor;
38 private EffectParameter texSize;
39 private EffectParameter slice;
40 private EffectParameter prevControlPoint;
41 private EffectParameter currControlPoint;
42 private EffectParameter nextControlPoint;
44 private EffectParameter frontToBack;
45 private EffectParameter shading;
47 private EffectParameter useAlpha;
48 private EffectParameter useTransferColors;
50 private EffectParameter selectedPos;
53 private Texture3D volume;
54 private Texture2D front;
55 private Texture2D back;
56 private Texture2D transfer;
57 private Texture2D alpha;
72 worldViewProjection = this.Parameters[
"myWorldViewProjectionMatrix"];
75 world = this.Parameters[
"myWorldMatrix"];
78 cameraPosition = this.Parameters[
"CameraPosition"];
81 frontFaces = this.Parameters[
"Front"];
84 backFaces = this.Parameters[
"Back"];
87 transferValues = this.Parameters[
"Transfer"];
90 transferValuesAlpha = this.Parameters[
"TransferAlpha"];
93 volumeTexture = this.Parameters[
"Volume"];
96 directLightPosition = this.Parameters[
"DirectLightVector"];
99 stepSize = this.Parameters[
"StepSize"];
102 baseSampleDist = this.Parameters[
"baseSampleDist"];
105 sampleDist = this.Parameters[
"sampleDist"];
108 iterations = this.Parameters[
"Iterations"];
111 side = this.Parameters[
"Side"];
114 scaleFactor = this.Parameters[
"ScaleFactor"];
117 texSize = this.Parameters[
"textureSize"];
120 slice = this.Parameters[
"Slice"];
122 currControlPoint = this.Parameters[
"currentControlPoint"];
123 prevControlPoint = this.Parameters[
"prevControlPoint"];
124 nextControlPoint = this.Parameters[
"nextControlPoint"];
126 frontToBack = this.Parameters[
"frontToBack"];
128 shading = this.Parameters[
"shading"];
130 useAlpha = this.Parameters[
"useAlpha"];
132 useTransferColors = this.Parameters[
"useTransferColors"];
134 selectedPos = this.Parameters[
"selectedPositions"];
138 Console.WriteLine(
"TFWeights Shader Created");
145 public Texture3D VolumeTexture
147 get {
return volume; }
148 set { volume = value; }
154 public Texture2D FrontFacesTexture
156 get {
return front; }
160 { Console.WriteLine(
"frontfacetexture set"); }
167 public Texture2D BackFacesTexture
170 set { back = value; }
176 public Texture2D TransferTexture
178 get {
return transfer; }
179 set { transfer = value; }
185 public Texture2D TransferTextureAlpha
187 get {
return alpha; }
188 set { alpha = value; }
191 #region SetEffectParameter
200 this.worldViewProjection.SetValue(_worldViewProjection);
201 this.world.SetValue(_world);
210 this.cameraPosition.SetValue(_cameraPosition);
217 public void SetEffectParameter(
float _currControlPoint,
float _prevControlPoint,
float _nextControlPoint)
219 this.currControlPoint.SetValue(_currControlPoint);
220 this.prevControlPoint.SetValue(_prevControlPoint);
221 this.nextControlPoint.SetValue(_nextControlPoint);
230 this.selectedPos.SetValue(_selectedPos);
244 Vector3 _directLightPosition,
246 float _baseSampleDist,
250 Vector4 _scaleFactor,
254 this.volumeTexture.SetValue(_volumeTexture);
255 this.stepSize.SetValue(_stepSize);
256 this.iterations.SetValue(_iterations);
257 this.side.SetValue(_side);
258 this.scaleFactor.SetValue(_scaleFactor);
259 this.frontToBack.SetValue(
GameProperties.Instance.enableFrontToBackBlend);
261 this.useAlpha.SetValue(
GameProperties.Instance.enableTransferAlphaValues);
262 this.useTransferColors.SetValue(
GameProperties.Instance.enableTransferFunction);
266 this.frontFaces.SetValue(front);
270 this.backFaces.SetValue(back);
272 if (transfer != null)
274 this.transferValues.SetValue(transfer);
278 this.transferValuesAlpha.SetValue(alpha);
280 this.slice.SetValue(_slice);
282 this.directLightPosition.SetValue(_directLightPosition);
283 this.baseSampleDist.SetValue(_baseSampleDist);
284 this.sampleDist.SetValue(_sampleDist);
285 this.texSize.SetValue(_texSize);