Exemplo n.º 1
0
		public static void DrawArea (VoxelTerrain land, GeovoxData.Area area) //drawing area in OnSceneGui
			{
					#if UNITY_EDITOR
				
					float density = 64;
					for (int x=0; x<density+1; x++)
						for (int z=0; z<density+1; z++)
					{
						float xCoord = area.offsetX + x*area.size/density;
						float zCoord = area.offsetZ + z*area.size/density;
			
						Vector3 start = new Vector3(xCoord, land.data.GetTopPoint((int)xCoord, (int)zCoord), zCoord);
						Vector3 xPoint = new Vector3(xCoord+area.size/density, land.data.GetTopPoint((int)(xCoord+area.size/density), (int)zCoord), zCoord);
						Vector3 zPoint = new Vector3(xCoord, land.data.GetTopPoint((int)xCoord, (int)(zCoord+area.size/density)), zCoord+area.size/density);

						start = land.transform.TransformPoint(start);
						xPoint = land.transform.TransformPoint(xPoint);
						zPoint = land.transform.TransformPoint(zPoint);

						if (x!=density) UnityEditor.Handles.DrawLine(start, xPoint);
						if (z!=density) UnityEditor.Handles.DrawLine(start, zPoint);
					}

					#endif
			}
Exemplo n.º 2
0
			public void PerformUndo (GeovoxData data)
			{
				int minX = x-range; int minZ = z-range;
				int maxX = x+range; int maxZ = z+range;
				
				for (int xi = 0; xi<=maxX-minX; xi++)
					for (int zi = 0; zi<=maxZ-minZ; zi++)
				{
					//working directly with columns
					Area area = data.areas[ data.GetAreaNum( xi+minX, zi+minZ ) ];
					int columnNum =  (z+minZ-area.offsetZ)*area.size + x+minX - area.offsetX;
					area.columns[columnNum] = new Column( columns[xi*(range*2+1) + zi] ); //copy from columns[]
					//data.GetArea(xi+minX, zi+minZ).SetColumn(xi+minX, zi+minZ, new Column(columns[xi*(range*2+1) + zi]) ); 
				}
			}