//Class Constructor 1 public Surface(Size size, Technique surfaceTechnique) { this._Size = size; this._ControlPoint = new ControlPoint[size.Width, size.Height]; this._SurfaceTechnique = surfaceTechnique; this.SurfaceTechnique.Modified += new Technique.ModifiedHandler(this.OnSurfaceTechniqueModified); }
//Class Constructor 2 public SurfaceSplatted(Size size, ControlPoint initValue, Technique surfaceTechnique, int numDivisions, Device device) : base(size, initValue, surfaceTechnique) { this._SpaceObject = null; //no space object initially attached this.Device = device; this._NumDivisions = numDivisions; this._Geometry = new GeometryIndexedSplatted(this.Device, typeof(FVF_PosNorColTex), FVF_PosNorColTex.Format, PrimitiveType.TriangleList, this.NumDivisions); //an empty geometry }
//--- //DEFAULT OBJECTS //--- //Default Rectangled Simple Surface (no shifts) public static Technique DefaultRectangledSimple(SizeF tileSize, HatchingMode hatching) { Technique t; t = new Technique(tileSize, new Point(1, 1), new Point(1, 1)); t.SetTileHatching(0, 0, hatching); t.SetPointShift(0, 0, new PointF(0, 0)); return(t); }
//Default Rectangled Alternated Surface (no shifts) / hatching00 represents the hatching of tile (0,0). the rest are alternated to this public static Technique DefaultRectangledAlternated(SizeF tileSize, HatchingMode hatchingOnTile00) { Technique t; t = new Technique(tileSize, new Point(2, 2), new Point(1, 1)); t.SetTileHatching(0, 0, hatchingOnTile00); t.SetTileHatching(0, 1, (HatchingMode)(1 - (int)hatchingOnTile00)); //1-x does bool negation t.SetTileHatching(1, 0, (HatchingMode)(1 - (int)hatchingOnTile00)); // --''-- t.SetTileHatching(1, 1, hatchingOnTile00); t.SetPointShift(0, 0, new PointF(0, 0)); return(t); }
//Class Constructor 2 public Surface(Size size, ControlPoint initValue, Technique surfaceTechnique) { this._Size = size; this._ControlPoint = new ControlPoint[Size.Width, Size.Height]; int i, j; for (j = 0; j <= this.Size.Height - 1; j++) { for (i = 0; i <= this.Size.Width - 1; i++) { this._ControlPoint[i, j] = (ControlPoint)initValue.Clone(); } } this._SurfaceTechnique = surfaceTechnique; this.SurfaceTechnique.Modified += new Technique.ModifiedHandler(this.OnSurfaceTechniqueModified); }
//Default Triangled Surface (shifts used to make the surface triangle-oriented) public static Technique DefaultTriangledSimple(SizeF tileSize, bool shiftOnRow0) { Technique t; t = new Technique(tileSize, new Point(1, 2), new Point(1, 2)); if (shiftOnRow0 == false) { t.SetTileHatching(0, 0, HatchingMode.NWSE); t.SetTileHatching(0, 1, HatchingMode.NESW); t.SetPointShift(0, 0, new PointF(0, 0)); t.SetPointShift(0, 1, new PointF(+tileSize.Width / 2, 0)); } else { t.SetTileHatching(0, 0, HatchingMode.NESW); t.SetTileHatching(0, 1, HatchingMode.NWSE); t.SetPointShift(0, 0, new PointF(+tileSize.Width / 2, 0)); t.SetPointShift(0, 1, new PointF(0, 0)); } return(t); }