Raycaster

References
public sealed class Raycaster : IObjectStack
Type for populating images with a raycasting technique.

Constructors

Raycaster

#
Create a new raycaster.
public Raycaster(
width,
Target image width.
height,
Target image height.
background,
Background shader. If null, a transparent background will be used.
objects
Ordered collection of objects.
)

Raycaster

#
Create a new raycaster with a transparent background.
public Raycaster(
width,
Target image width.
height,
Target image height.
objects
Ordered collection of objects.
)

Fields

MaxSize

#
Specifies the maximum linear size (in pixels) of a raycasting image.
public const int MaxSize = 16384

Properties

Background

#
Gets the background shader. This shader may be null, in which case a fully transparent background is implied.
public ColourShader Background { get; }

CurrentSamplingLevel

#
Gets the current sampling level. Not all pixels are necessarily being sampled at this level though, only at least one of them is. Negative sampling levels indicate a coarse sampling, every (-N)th pixels.
public int CurrentSamplingLevel { get; }

Height

#
Gets the height of the raycasting image.
public int Height { get; }

Width

#
Gets the width of the raycasting image.
public int Width { get; }

Indexers

this[]

#
Gets the pixel at the given coordinates.
public Pixel this[
indexX,
X index.
indexY
Y index.
] { get; }
Pixel at index.

this[]

#
Gets the shape+shader pair at the given index.
public ShapeShaderPair this[
index
Index of pair.
] { get; }
Pair at index.

Methods

ComputeImage

#
Start a new raycasting process.
public void ComputeImage(
settings,
Settings.
token
Cancellation token.
)

ComputeImageAsync

#
Start the image computation asynchronously.
public void ComputeImageAsync(
settings,
Settings.
token
Cancellation token.
)

ContinueAndSample

#
Continue an existing ray.
public Color ContinueAndSample(
ray
Ray to continue.
)
Colour at continued ray location.
ContinueAndSample

ContinueImage

#
Continue a finished raycasting process. This method cannot be called while a process is already running.
public void ContinueImage(
settings,
Settings to use.
token
Cancellation token.
)

ContinueImageAsync

#
Continue a finished raycasting process asynchronously. This method cannot be called while a process is already running.
public void ContinueImageAsync(
settings,
Settings to use.
token
Cancellation token.
)

FirstObjectAbove

#
Find the index of the first object at the (u,v) location at or above the given layer index.
public int FirstObjectAbove(
x,
U coordinate.
y,
V coordinate.
startAt
Start layer. Objects on this layer are taken into account.
)
The index of the first object coincident with (u,v) at or above the start layer. Or, if no object was found, -1.
FirstObjectAbove

FirstObjectBelow

#
Find the index of the first object at the (u,v) location at or below the given layer index.
public int FirstObjectBelow(
x,
U coordinate.
y,
V coordinate.
startAt
Start layer. Objects on this layer are taken into account.
)
The index of the first object coincident with (u,v) at or below the start layer. Or, if no object was found, -1.
FirstObjectBelow

ResurrectAllPixels

#
Move all dead pixels back onto the alive list.
public void ResurrectAllPixels()

ResurrectAllPixels

#
Move all dead pixels back onto the alive list.
public void ResurrectAllPixels(
filter
Per pixel filter method.
)

Sample

#
Shoot a way into the object stack and evaluate the colour.
public Color Sample(
ray
Ray to shoot.
)
Colour at ray location.
Sample

ToBitmap

#
Create a bitmap from the current cache.
public Bitmap ToBitmap()

ToBitmap

#
Blit this raycaster into an existing bitmap. The bitmap will be locked for this procedure.
public void ToBitmap(
Bitmap
bitmap
Lockable bitmap with the correct dimensions.
)

ToBucketMap

#
Create a bitmap showing the bucket occupancy.
public Bitmap ToBucketMap()
Bucket map.

ToCompletionMap

#
Create a bitmap showing the completed pixels vs the live pixels.
public Bitmap ToCompletionMap(
gradient,
Gradient to use on dead pixels. If null, the default gradient will be used.
Color?
liveColour
Optional colour to use on live pixels. If omitted, live pixels will be mapped onto the gradient.
)

ToCompletionMap

#
Blit the raycaster live-pixel data into an existing bitmap. The bitmap will be locked for this procedure.
public void ToCompletionMap(
Bitmap
bitmap,
Lockable bitmap with the correct dimensions.
gradient,
Gradient to use on dead pixels. If null, the default gradient will be used.
Color?
liveColour
Optional colour to use on live pixels. If omitted, live pixels will be mapped onto the gradient.
)