Dwarrowdelf.ShadowCastRecursiveStrict.Calculate C# (CSharp) Method

Calculate() public static method

public static Calculate ( IntVector2 viewerLocation, int visionRange, Grid2D visibilityMap, IntSize2 mapSize, bool>.Func blockerDelegate ) : void
viewerLocation IntVector2
visionRange int
visibilityMap Grid2D
mapSize IntSize2
blockerDelegate bool>.Func
return void
		public static void Calculate(IntVector2 viewerLocation, int visionRange, Grid2D<bool> visibilityMap, IntSize2 mapSize,
			Func<IntVector2, bool> blockerDelegate)
		{
			visibilityMap.Clear();

			if (blockerDelegate(viewerLocation) == true)
				return;

			visibilityMap[0, 0] = true;

			SCRData data = new SCRData()
			{
				ViewerLocation = viewerLocation,
				VisionRange = visionRange,
				VisionRangeSquared = (visionRange + 1) * (visionRange + 1),	// +1 to get a bit bigger view area
				VisibilityMap = visibilityMap,
				MapSize = mapSize,
				BlockerDelegate = blockerDelegate,
			};

			for (int octant = 0; octant < 8; ++octant)
				Calculate(ref data, 1, octant, 0.0, 1.0, 1);
		}

Same methods

ShadowCastRecursiveStrict::Calculate ( SCRData &data, int startColumn, int octant, double startSlope, double endSlope, int id ) : void
ShadowCastRecursiveStrict