1 #region
using statements
3 using System.Collections.Generic;
6 using System.Windows.Forms;
8 using Microsoft.Xna.Framework;
19 bool xnaDrawSurface_MouseDownEvent =
false;
20 int mouseDownPosX, mouseDownPosY, mouseDownPosZ = 0;
24 public bool XnaDrawSurface_MouseDownEvent
26 set { xnaDrawSurface_MouseDownEvent = value; }
27 get {
return xnaDrawSurface_MouseDownEvent; }
31 public int MouseDownPosX
33 set { mouseDownPosX = value; }
35 public int MouseDownPosY
37 set { mouseDownPosY = value; }
39 public Vector3 MouseMovePos
41 set { MouseMovePos = value; }
73 switch (currentViewMode)
127 updateXnaEngineState(
false,
false,
false,
true);
155 updateXnaEngineState(
false,
false,
false,
true);
196 updateXnaEngineState(
false,
false,
true,
true);
200 #region extended feature set
201 public void enableClippingPlane(
bool enable)
208 updateXnaEngineState(
true,
false,
true,
true);
218 updateXnaEngineState(
true,
false,
true,
true);
228 updateXnaEngineState(
true,
false,
true,
true);
238 updateXnaEngineState(
true,
false,
true,
true);
248 updateXnaEngineState(
true,
false,
false,
false);
251 #region old version fullscreen option
277 mouseDownPosX = posX;
278 mouseDownPosY = posY;
282 public void resetMousePos()
299 int mousePos = getMousePos(mouseDownPosX, mouseDownPosY);
343 private int getMousePos(
int posX,
int posY)
363 public void loadTransferFunction(String fileName)
368 XmlTextReader xmlReader =
new XmlTextReader(fileName);
369 xmlReader.MoveToElement();
377 while (xmlReader.Read())
379 if (xmlReader.NodeType == XmlNodeType.Element && xmlReader.Name.Equals(
"ControlPoint"))
381 while (!(xmlReader.NodeType == XmlNodeType.EndElement && xmlReader.Name.Equals(
"ControlPoint")))
385 if (xmlReader.NodeType.Equals(XmlNodeType.Element))
387 String elementName = xmlReader.Name;
389 if (xmlReader.NodeType.Equals(XmlNodeType.Text))
394 r =
float.Parse(xmlReader.Value);
398 g =
float.Parse(xmlReader.Value);
402 b =
float.Parse(xmlReader.Value);
406 a =
float.Parse(xmlReader.Value);
410 isoValue =
int.Parse(xmlReader.Value);
418 GameProperties.Instance.colorControlPoints.Add(
new TransferControlPoint(r, g, b, isoValue));
419 GameProperties.Instance.alphaControlPoints.Add(
new TransferControlPoint(a, isoValue));
429 XmlTextWriter xmlWriter =
new XmlTextWriter(fileName, null);
431 xmlWriter.WriteStartDocument();
432 xmlWriter.WriteStartElement(
"TransferFunction");
434 for (
int i = 0; i <
GameProperties.Instance.colorControlPoints.Count(); i++)
436 xmlWriter.WriteStartElement(
"ControlPoint");
438 xmlWriter.WriteStartElement(
"ColorR");
439 xmlWriter.WriteString(
GameProperties.Instance.colorControlPoints[i].color.X.ToString());
440 xmlWriter.WriteEndElement();
442 xmlWriter.WriteStartElement(
"ColorG");
443 xmlWriter.WriteString(
GameProperties.Instance.colorControlPoints[i].color.Y.ToString());
444 xmlWriter.WriteEndElement();
446 xmlWriter.WriteStartElement(
"ColorB");
447 xmlWriter.WriteString(
GameProperties.Instance.colorControlPoints[i].color.Z.ToString());
448 xmlWriter.WriteEndElement();
450 xmlWriter.WriteStartElement(
"ColorA");
451 xmlWriter.WriteString(
GameProperties.Instance.alphaControlPoints[i].color.W.ToString());
452 xmlWriter.WriteEndElement();
454 xmlWriter.WriteStartElement(
"IsoValue");
455 xmlWriter.WriteString(
GameProperties.Instance.colorControlPoints[i].isoValue.ToString());
456 xmlWriter.WriteEndElement();
458 xmlWriter.WriteEndElement();
461 xmlWriter.WriteEndElement();
462 xmlWriter.WriteEndDocument();
466 #region update game and engine state
467 public void updateXnaEngineState(
bool updateCam,
bool load,
bool update,
bool draw)