• R/O
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

FreeTrainの進化系を目指す


Commit MetaInfo

Revision27 (tree)
Time2014-09-15 23:47:40
Authorc477

Log Message

マウスポインタ位置の地形ポリゴンを検出できるようにした。

Change Summary

Incremental Difference

--- trunk/framework/framework/drawing/I3DObject.cs (revision 26)
+++ trunk/framework/framework/drawing/I3DObject.cs (revision 27)
@@ -63,6 +63,14 @@
6363 public override string ToString() {
6464 return "PointF3D("+X+","+Y+","+Z+")";
6565 }
66+
67+ Point3D Ceiling() {
68+ return new Point3D((int)Math.Ceiling(X), (int)Math.Ceiling(Y), (int)Math.Ceiling(Z));
69+ }
70+
71+ Point3D Floor() {
72+ return new Point3D((int)Math.Floor(X), (int)Math.Floor(Y), (int)Math.Floor(Z));
73+ }
6674 }
6775
6876 /// <summary>
--- trunk/xna/NFT.XNA/XnaSurface.cs (revision 26)
+++ trunk/xna/NFT.XNA/XnaSurface.cs (revision 27)
@@ -264,9 +264,9 @@
264264 }
265265
266266 public UInt32 HitTestAt(int vx, int vy) {
267- XnaColor xc = GetWorkPixelAt(vx, vy, 1);
268- Debug.WriteLine("mouse=" + xc);
269- return xc.PackedValue&0xffffff;
267+ XnaColor xc = GetWorkPixelAt(vx, vy, (int)RenderOutput.ObjKeyMap);
268+ //Debug.WriteLine("mouse=" + xc);
269+ return xc.PackedValue;
270270 }
271271 #endregion
272272
--- trunk/core/impl/game/TerrainMapImpl.cs (revision 26)
+++ trunk/core/impl/game/TerrainMapImpl.cs (revision 27)
@@ -113,7 +113,7 @@
113113 try {
114114 return hmap[x, y].GetPieces(viewupper);
115115 } catch (IndexOutOfRangeException) {
116- Debug.WriteLine("x="+x+", y="+y+", map="+hmap.GetUpperBound(0)+","+hmap.GetUpperBound(1));
116+ Debug.WriteLine("The location (" + x + ", y=" + y + ") is OUTSIDE of the map{ size:(" + hmap.GetUpperBound(0) + "," + hmap.GetUpperBound(1)+")}");
117117 return NullEnumerator();
118118 }
119119 }
--- trunk/core/impl/view/SceneBuilder.cs (revision 26)
+++ trunk/core/impl/view/SceneBuilder.cs (revision 27)
@@ -9,6 +9,7 @@
99 using System.Diagnostics;
1010 using Geocon = nft.core.geometry.GeometricConstants;
1111 using nft.core.game;
12+using nft.core.view;
1213
1314 namespace nft.impl.view
1415 {
@@ -16,19 +17,24 @@
1617 {
1718 public delegate void TerrainPlateModifier(ITerrainPlate plate, ITerrainMap map, int x, int y, TerrainPieceTemplate.TerrainPolygonSet tpset);
1819
19- CoordinationUtil cdUtil = null;
20- Scaler scaler;
21- InterCardinalDirection upperDir;
20+ internal const int TrMk_Ground = 0;
21+ internal const int TrMk_CliffLeft = 1;
22+ internal const int TrMk_CliffRight = 2;
23+ internal const int TrMk_CliffDiag = 3;
2224
25+ internal CoordinationUtil cdUtil = null;
26+ internal Scaler scaler;
27+ internal InterCardinalDirection upperDir;
28+
2329 IApparentAssignor apparents;
24- GameImpl game;
25- ISurface surface;
30+ internal GameImpl game;
31+ internal ISurface surface;
2632 Point viewpos;
2733 int voffset;
2834
2935 public SceneBuilder(GameImpl g) {
3036 this.game = g;
31- SetViewFactor(new ViewFactor(InterCardinalDirection.NORTHEAST));
37+ SetViewFactor(new ViewFactor(InterCardinalDirection.NORTHEAST, ZoomScale.x2));
3238 }
3339
3440 public SceneBuilder(GameImpl g, ISurface s) : this(g){
@@ -83,6 +89,19 @@
8389 viewpos = p;
8490 }
8591
92+ private bool CheckMarker(Point uv, int typecode, ref ITerrainPlate plate) {
93+ if (marker0 != null && marker0.Same(uv, typecode)) {
94+ //Debug.WriteLine("Hit("+x+","+y+")");
95+ PointF3D pmk = plate.Location;
96+ pmk.Z += 0.5f;
97+ plate.Location = pmk;
98+ plate.Effect = GraphicManagerEx.GraphicManager.GetFilterByUsage();
99+ return true;
100+ } else {
101+ return false;
102+ }
103+ }
104+
86105 Stopwatch watch0 = new Stopwatch();
87106 int xxx = 0;
88107 public IEnumerator<I3DObject> GetEnumerator() {
@@ -117,12 +136,8 @@
117136 plate.Location = new PointF3D(pv.VX, pv.VY, pv.VZ);
118137 watch0.Stop();
119138 yield return plate;
120- if (marker0 != null && marker0.Same(uv, tpset)) {
139+ if (CheckMarker(uv, TrMk_Ground, ref plate)) {
121140 //Debug.WriteLine("Hit("+x+","+y+")");
122- PointF3D pmk = plate.Location;
123- pmk.Z += 0.5f;
124- plate.Location = pmk;
125- plate.Effect = GraphicManagerEx.GraphicManager.GetFilterByUsage();
126141 yield return plate;
127142 }
128143 }
@@ -142,6 +157,9 @@
142157 plate = apparents.DefaultCliffTexture.Get(cp, hgap, pv);
143158 plate.Location = new PointF3D(pv.VX, pv.VY, pvz);
144159 yield return plate;
160+ if (CheckMarker(uv, TrMk_CliffLeft, ref plate)) {
161+ yield return plate;
162+ }
145163 }
146164 }
147165 if (dside != ViewDirection8.RIGHT && cdUtil.IsRightCliffVisible(map, l, out hgap)) {
@@ -158,6 +176,9 @@
158176 plate = apparents.DefaultCliffTexture.Get(cp, hgap, pv);
159177 plate.Location = new PointF3D(pv.VX, pv.VY, pvz);
160178 yield return plate;
179+ if (CheckMarker(uv, TrMk_CliffRight, ref plate)) {
180+ yield return plate;
181+ }
161182 }
162183 }
163184 } else {
@@ -175,6 +196,9 @@
175196 plate = apparents.DefaultCliffTexture.Get(cp, hgap, pv);
176197 plate.Location = new PointF3D(pv.VX, pv.VY, pvz);
177198 yield return plate;
199+ if (CheckMarker(uv, TrMk_CliffDiag, ref plate)) {
200+ yield return plate;
201+ }
178202 }
179203 }
180204 }
@@ -219,13 +243,23 @@
219243 #endif
220244 for (int h = hmin; h <= hmax; h++) {
221245 for (int w = wmin; w <= wmax; w++) {
222- yield return ViewToIsometricPlane(w, h);
246+ yield return ViewGridToIsometricPlane(w, h);
223247 }
224248 }
225249 }
226250
227251 // view grid (cell sized) to isometric grid
252+ internal protected Point ViewGridToIsometricPlane(int vx, int vy) {
253+ int v2 = vy / 2;
254+ int x = v2 - vx + (vy & 1);
255+ int y = v2 + vx;
256+ return new Point(x, y);
257+ }
258+
259+ // view pixel pos to isometric grid
228260 internal protected Point ViewToIsometricPlane(int vx, int vy) {
261+ vx = (vx / Geocon.UnitWidthPixel) / 2;
262+ vy = (vy / Geocon.HalfOf_UnitWidthPixel) - 10;
229263 int v2 = vy / 2;
230264 int x = v2 - vx + (vy & 1);
231265 int y = v2 + vx;
@@ -232,7 +266,6 @@
232266 return new Point(x, y);
233267 }
234268
235-
236269 // isometric grid to view positon (in pixel).
237270 internal protected Point IsometricGridToView(int isx, int isy) {
238271 int x = (isy - isx)/2;
@@ -240,7 +273,24 @@
240273 return new Point(x * Geocon.UnitWidthPixel, y * Geocon.HalfOf_UnitWidthPixel);
241274 }
242275
276+ protected Point WorldPosToGrid(PointF3D p3d) {
277+ int isx = (int)Math.Floor(p3d.X / Geocon.UnitWidthPixel);
278+ int isy = (int)Math.Floor(p3d.Y / Geocon.UnitWidthPixel);
279+ int d = (int)Math.Ceiling(p3d.Z / Geocon.HalfOf_UnitWidthPixel);
280+ return new Point(isx - d, isy - d);
281+ }
282+
243283 public object GetObjectAt(Point spos) {
284+ ITerrainPolygon pol;
285+ PointF3D p3dv;
286+ if (DrawIndexUtil.ResolveTerrain(this, spos, out pol, out p3dv)) {
287+
288+ return pol;
289+ }
290+ return null;
291+ }
292+
293+ public object GetObjectAt_old(Point spos) {
244294 PointF3D p3d = surface.ToWorldPosition(spos);
245295 #if DEBUG
246296 Debug.Write("mouse(" + spos.X + "," + spos.Y + ")");
@@ -297,18 +347,29 @@
297347 class TerrainMarker
298348 {
299349 int x, y;
300- ushort id;
350+ int code;
301351 bool trianglehit;
352+ public TerrainMarker(Point pt, int typecode, bool inner_triangle) {
353+ this.x = pt.X;
354+ this.y = pt.Y;
355+ this.code = typecode;
356+ this.trianglehit = inner_triangle;
357+ }
302358 public TerrainMarker(Point pt, TerrainPieceTemplate.TerrainPolygonSet tpset, bool inner_triangle) {
303359 this.x = pt.X;
304360 this.y = pt.Y;
305- this.id = tpset.Ground.ID;
361+ this.code = -1;
306362 this.trianglehit = inner_triangle;
307363 }
308- public bool Same(Point pt, TerrainPieceTemplate.TerrainPolygonSet tpset) {
309- return pt.X == x && pt.Y == y && tpset.Ground.ID == id;
364+ public bool Same(Point pt, int typecode) {
365+ return pt.X == x && pt.Y == y && this.code == typecode;
310366 }
311367 }
368+
369+ internal void CreateMarker(int gx, int gy, int tpcode) {
370+ marker0 = new TerrainMarker(new Point(gx, gy), tpcode, true);
371+ }
372+
312373 TerrainMarker marker0;
313374 protected bool HitTest(Point iso_p, Point vw_p, out object ret){
314375 //Debug.Write("HitTest at="+iso_p);
--- trunk/core/impl/view/DrawIndexUtil.cs (nonexistent)
+++ trunk/core/impl/view/DrawIndexUtil.cs (revision 27)
@@ -0,0 +1,163 @@
1+using System;
2+using System.Collections.Generic;
3+using System.Text;
4+using nft.core.geometry;
5+using System.Drawing;
6+using nft.framework.drawing;
7+using nft.impl.game;
8+using Geocon = nft.core.geometry.GeometricConstants;
9+using System.Diagnostics;
10+
11+namespace nft.impl.view {
12+ public class DrawIndexUtil {
13+ private const UInt32 IndexForUnknown = 0xffffffff;
14+ private const UInt32 TypeMask = 0xf0000000;
15+ private const UInt32 ValueMask = 0x0fffffff;
16+ private const UInt32 Mask_GroundPolygon = 0x80000000;
17+ private const UInt32 Mask_GroundPolygon2 = 0xa0000000;
18+ private const UInt32 Mask_CliffPolygon = 0xc0000000;
19+ private const UInt32 Mask_CliffPolygon_L = 0xc0000000;
20+ private const UInt32 Mask_CliffPolygon_R = 0xe0000000;
21+ private const UInt32 Mask_CliffPolygon_D = 0xf0000000;
22+ private static UInt32[] cliffMaskMap;
23+
24+ static DrawIndexUtil() {
25+ cliffMaskMap = new UInt32[Enum.GetValues(typeof(CliffPolygon.CliffSide)).Length];
26+ cliffMaskMap[(int)CliffPolygon.CliffSide.Left] = Mask_CliffPolygon_L;
27+ cliffMaskMap[(int)CliffPolygon.CliffSide.Right] = Mask_CliffPolygon_R;
28+ cliffMaskMap[(int)CliffPolygon.CliffSide.Diagonal] = Mask_CliffPolygon_D;
29+ }
30+
31+ public static UInt32 GetIndexForTerrain(Point3DV pos, ITerrainPolygon polygon) {
32+ if (polygon is GroundPolygon) {
33+ return GetIndexForGroundPolygon((GroundPolygon)polygon, pos);
34+ } else if (polygon is CliffPolygon) {
35+ return GetIndexForCliffPolygon((CliffPolygon)polygon, pos);
36+ }
37+ return IndexForUnknown;
38+ }
39+
40+ public static UInt32 GetIndexForGroundPolygon(GroundPolygon polygon, Point3DV pos) {
41+ bool b = polygon.DiagonalSide == ViewDirection8.FRONT || polygon.DiagonalSide == ViewDirection8.LEFT;
42+ UInt32 idx = (UInt32)(pos.VX + pos.VY + (b ? Mask_GroundPolygon2 : Mask_GroundPolygon));
43+ return idx;
44+ }
45+
46+ public static UInt32 GetIndexForCliffPolygon(CliffPolygon polygon, Point3DV pos) {
47+ UInt32 idx = (UInt32)(pos.VX + pos.VY + cliffMaskMap[(int)polygon._Side]);
48+ return idx;
49+ }
50+
51+
52+ internal static bool ResolveTerrain(SceneBuilder sb, Point mousePos, out ITerrainPolygon pol, out PointF3D p3dv) {
53+ pol = null;
54+ //mousePos.Y++;
55+ Debug.Write("ResolveTerrain: mouse=(" + mousePos.X + "," + mousePos.Y + ")");
56+ p3dv = sb.surface.ToWorldPosition(mousePos);
57+ UInt32 idx = sb.surface.HitTestAt(mousePos.X, mousePos.Y);
58+ TerrainMapImpl map = sb.game.TerrainMap;
59+ if (AdjustPointForGround(ref p3dv, idx)) {
60+ int gx = (int)Math.Round(p3dv.X / Geocon.UnitWidthPixel);
61+ int gy = (int)Math.Round(p3dv.Y / Geocon.UnitWidthPixel);
62+ Debug.Write("->(" + p3dv.X + "," + p3dv.Y + ") : grid[" + gx + "," + gy + "]");
63+ foreach (ITerrainPiece p in map[gx, gy, sb.upperDir]) {
64+ TerrainPieceTemplate.TerrainPolygonSet tpset = p.Template.GetPolygons(sb.upperDir);
65+ if (tpset.Ground.IsVisible) {
66+ Point rep = sb.surface.ToScreenPosition(p3dv);
67+ int xoff = mousePos.X - rep.X;
68+ int yoff = mousePos.Y - rep.Y;
69+ //Debug.Write("!");
70+ if (TerrainUtil.IsInnerPoint2D(tpset.Ground.GetVerticis(sb.scaler), new Point(xoff, yoff))) {
71+ pol = tpset.Ground;
72+ Debug.WriteLine(": Ground hit 1 off(" + xoff + ", yoff=" + yoff + ")");
73+ break;
74+ } else if (pol == null) {
75+ Debug.WriteLine(": Ground hit 2 off(" + xoff + ", yoff=" + yoff + ")");
76+ pol = tpset.Ground;
77+ }
78+ }
79+ sb.CreateMarker(gx, gy, SceneBuilder.TrMk_Ground);
80+ }
81+ Debug.WriteLineIf(pol == null, "WTF!?");
82+ return pol != null;
83+ } else if (AdjustPointForCliff(ref p3dv, idx)) {
84+ int gx = (int)Math.Round(p3dv.X / Geocon.UnitWidthPixel);
85+ int gy = (int)Math.Round(p3dv.Y / Geocon.UnitWidthPixel);
86+ Debug.Write("->(" + p3dv.X + "," + p3dv.Y + ") : grid[" + gx + "," + gy + "]");
87+ foreach (ITerrainPiece p in map[gx, gy, sb.upperDir]) {
88+ //if (p.BaseHeight < p3dv.Z) continue;
89+ TerrainPieceTemplate.TerrainPolygonSet tpset = p.Template.GetPolygons(sb.upperDir);
90+ UInt32 testval = (idx & Mask_CliffPolygon_D);
91+ if (testval == Mask_CliffPolygon_D) {
92+ Debug.WriteLine(": Cliff(Diagonal)");
93+ pol = tpset.CliffDiagonal;
94+ sb.CreateMarker(gx, gy, SceneBuilder.TrMk_CliffDiag);
95+ } else if (testval == Mask_CliffPolygon_R) {
96+ Debug.WriteLine(": Cliff(Right)");
97+ pol = tpset.CliffRight;
98+ sb.CreateMarker(gx, gy, SceneBuilder.TrMk_CliffRight);
99+ } else {
100+ Debug.WriteLine(": Cliff(Left)");
101+ pol = tpset.CliffLeft;
102+ sb.CreateMarker(gx, gy, SceneBuilder.TrMk_CliffLeft);
103+ }
104+ }
105+ Debug.WriteLineIf(pol == null, "WTF2!?");
106+ return pol != null;
107+ }
108+ Debug.WriteLine("--");
109+ return false;
110+ }
111+
112+ internal static bool AdjustPointForCliff(ref PointF3D p3dv, UInt32 idx) {
113+ if ((idx & Mask_CliffPolygon) == Mask_CliffPolygon) {
114+ AdjustPoint(ref p3dv, ValueMask & idx);
115+ return true;
116+ } else {
117+ return false;
118+ }
119+ }
120+
121+ internal static bool AdjustPointForGround(ref PointF3D p3dv, UInt32 idx) {
122+ UInt32 test = (idx & TypeMask);
123+ if (test == Mask_GroundPolygon || test == Mask_GroundPolygon2) {
124+ AdjustPoint(ref p3dv, ValueMask & idx);
125+ return true;
126+ } else {
127+ return false;
128+ }
129+ }
130+
131+ private static void AdjustPoint(ref PointF3D p3dv, UInt32 idxval) {
132+ float diff = p3dv.X + p3dv.Y - idxval;
133+ p3dv.Z = diff;
134+ diff = diff/2.0f;
135+ float x = p3dv.X - diff;
136+ float y = p3dv.Y - diff;
137+ if (x < 0) {
138+ p3dv.Z -= x * 2;
139+ x = 0;
140+ }
141+ if (y < 0) {
142+ p3dv.Z -= y * 2;
143+ y = 0;
144+ }
145+ int ix = (int)Math.Floor(x);
146+ int iy = (int)Math.Floor(y);
147+ int v2 = ix + iy;
148+ p3dv.X = ix;
149+ p3dv.Y = iy;
150+ //Debug.Write(" [check idxval-v2=" + (idxval - v2) + ", fx=" + x + ", ix=" + ix + ", fy=" + y + ", iy=" + iy + "]");
151+ if (idxval != v2) {
152+ /*
153+ float w = (x - ix) / Geocon.UnitWidthPixel;
154+ if (w > 0.5f) {
155+ p3dv.X += 1;
156+ } else {
157+ p3dv.Y += 1;
158+ }
159+ */
160+ }
161+ }
162+ }
163+}
--- trunk/core/contributions/terrain/TerrainPlateSet.cs (revision 26)
+++ trunk/core/contributions/terrain/TerrainPlateSet.cs (revision 27)
@@ -11,6 +11,7 @@
1111 using System.Windows.Forms;
1212 using nft.framework.plugin;
1313 using nft.core;
14+using nft.impl.view;
1415
1516 namespace nft.contributions.terrain {
1617 public interface IGroundPlateSet {
@@ -73,7 +74,7 @@
7374 holder = Add(key, templ);
7475 }
7576 templ = holder.AddRef();
76- UInt32 idkey = (UInt32)(hint.VX + hint.VY+0x800000);
77+ UInt32 idkey = DrawIndexUtil.GetIndexForTerrain(hint, polygon);
7778 return GraphicManager.CreateTerrainPlate(idkey, templ);
7879 }
7980
@@ -138,7 +139,7 @@
138139 holder = Add(key, templ);
139140 }
140141 templ = holder.AddRef();
141- UInt32 idkey = (UInt32)(hint.VX + hint.VY);
142+ UInt32 idkey = DrawIndexUtil.GetIndexForCliffPolygon(polygon, hint);
142143 return GraphicManager.CreateTerrainPlate(idkey, templ);
143144 }
144145
--- trunk/core/contributions/terrain/CliffPolygon.cs (revision 26)
+++ trunk/core/contributions/terrain/CliffPolygon.cs (revision 27)
@@ -12,7 +12,7 @@
1212 namespace nft.core.geometry {
1313 public class CliffPolygon : ITerrainPolygon, ISerializable {
1414 [Flags]
15- public enum Side { Undefined = 0, Right = 0x01, Left = 0x02, Diagonal = 0x03 }
15+ public enum CliffSide { Undefined = 0, Right = 0x01, Left = 0x02, Diagonal = 0x03 }
1616
1717 static Dictionary<ushort, CliffPolygon> stock = new Dictionary<ushort, CliffPolygon>(256);
1818 static CliffPolygon[] fillers = new CliffPolygon[4];
@@ -58,9 +58,9 @@
5858 registerRectPattern(-1, p2, p1);
5959 }
6060 }
61- fillers[(int)Side.Left] = CreateFillerPattern(-1, 0);
62- fillers[(int)Side.Right] = CreateFillerPattern(0, -1);
63- fillers[(int)Side.Diagonal] = CreateFillerPattern(-1, -1);
61+ fillers[(int)CliffSide.Left] = CreateFillerPattern(-1, 0);
62+ fillers[(int)CliffSide.Right] = CreateFillerPattern(0, -1);
63+ fillers[(int)CliffSide.Diagonal] = CreateFillerPattern(-1, -1);
6464 }
6565
6666 /// <summary>
@@ -75,13 +75,13 @@
7575 private static void registerTriPattern(int near, int left, int right) {
7676 ushort id = PrivateMakePolygonID(near, left, right);
7777 int hp = Geocon.UnitHeightPixel;
78- Side s = Side.Undefined;
78+ CliffSide s = CliffSide.Undefined;
7979 if (!stock.ContainsKey(id)) {
8080 Point3D[] pt = new Point3D[3];
8181 int idx = 0;
8282 int id2 = 0;
8383 if (left >= 0) {
84- s |= Side.Left;
84+ s |= CliffSide.Left;
8585 pt[idx++] = new Point3D(0, Geocon.UnitWidthPixel, left * hp);
8686 if (left > 0) {
8787 id2 = idx;
@@ -96,7 +96,7 @@
9696 }
9797 }
9898 if (right >= 0) {
99- s |= Side.Right;
99+ s |= CliffSide.Right;
100100 pt[idx++] = new Point3D(Geocon.UnitWidthPixel, 0, right * hp);
101101 if (right > 0) {
102102 id2 = idx;
@@ -122,12 +122,12 @@
122122 private static void registerRectPattern(int near, int left, int right) {
123123 ushort id = PrivateMakePolygonID(near, left, right);
124124 int hp = Geocon.UnitHeightPixel;
125- Side s = Side.Undefined;
125+ CliffSide s = CliffSide.Undefined;
126126 if (!stock.ContainsKey(id)) {
127127 Point3D[] pt = new Point3D[6];
128128 int idx = 0;
129129 if (left >= 0) {
130- s |= Side.Left;
130+ s |= CliffSide.Left;
131131 pt[idx++] = new Point3D(0, Geocon.UnitWidthPixel, left * hp);
132132 pt[idx] = new Point3D(0, Geocon.UnitWidthPixel, 0);
133133 idx += 2;
@@ -138,7 +138,7 @@
138138 idx += 2;
139139 }
140140 if (right >= 0) {
141- s |= Side.Right;
141+ s |= CliffSide.Right;
142142 pt[idx++] = new Point3D(Geocon.UnitWidthPixel, 0, right * hp);
143143 pt[idx] = new Point3D(Geocon.UnitWidthPixel, 0, 0);
144144 idx += 2;
@@ -159,13 +159,13 @@
159159 /// <param name="right"></param>
160160 /// <param name="far"></param>
161161 private static CliffPolygon CreateFillerPattern(int bl_left, int bl_right) {
162- Side s = Side.Undefined;
162+ CliffSide s = CliffSide.Undefined;
163163 const int hmax = 0x7fffffff;
164164 Point3D[] pt = new Point3D[6];
165165 int idx = 0;
166166
167167 if (bl_left != 0) {
168- s |= Side.Left;
168+ s |= CliffSide.Left;
169169 pt[idx++] = new Point3D(0, Geocon.UnitWidthPixel, hmax);
170170 pt[idx] = new Point3D(0, Geocon.UnitWidthPixel, 0);
171171 idx += 2;
@@ -176,7 +176,7 @@
176176 idx += 2;
177177 }
178178 if (bl_right != 0) {
179- s |= Side.Right;
179+ s |= CliffSide.Right;
180180 pt[idx++] = new Point3D(Geocon.UnitWidthPixel, 0, hmax);
181181 pt[idx] = new Point3D(Geocon.UnitWidthPixel, 0, 0);
182182 idx += 2;
@@ -250,7 +250,7 @@
250250 protected Point[] verticis;
251251 protected Point3D[] verticis3d;
252252 protected Rectangle bounds;
253- protected Side side;
253+ protected CliffSide side;
254254 /// <summary>
255255 /// Determined by surface normal angle between the sun light. 255 is maximum.
256256 /// Visible surface has positive value, effected at least by environment light.
@@ -258,7 +258,7 @@
258258 /// </summary>
259259 public readonly float Brightness;
260260
261- protected CliffPolygon(ushort id, Point3D[] pts, Side s) {
261+ protected CliffPolygon(ushort id, Point3D[] pts, CliffSide s) {
262262 this.id = id;
263263 this.verticis3d = pts;
264264 this.side = s;
@@ -276,6 +276,12 @@
276276 Brightness = (float)l;
277277 }
278278
279+ public CliffSide _Side {
280+ get {
281+ return side;
282+ }
283+ }
284+
279285 #region ITerrainPolygon メンバ
280286
281287 public ushort ID {
@@ -390,7 +396,7 @@
390396 return (ushort)((height & 0x03ff)<<2 + (bl_left & 0x02) + (bl_right & 0x01));
391397 }
392398
393- private static ushort PrivateMakeFillerID(int height, Side side) {
399+ private static ushort PrivateMakeFillerID(int height, CliffSide side) {
394400 return (ushort)(((height & 0x03ff)<<2) + side);
395401 }
396402