Table of Contents

Class OcclusionIntervalMapGenerator

Namespace
AlphaFramework.World.Terrains
Assembly
AlphaFramework.World.dll

Generates an occlusion interval map from a height map for a ITerrain as a background task.

public class OcclusionIntervalMapGenerator : TaskBase, ITask
Inheritance
OcclusionIntervalMapGenerator
Implements
Inherited Members
Extension Methods

Constructors

OcclusionIntervalMapGenerator(ByteGrid, float, float, double)

Prepares to calculate an occlusion interval map for a height-map.

public OcclusionIntervalMapGenerator(ByteGrid heightMap, float stretchH = 1, float stretchV = 1, double lightSourceInclination = 90)

Parameters

heightMap ByteGrid

The height-map data. This is not cloned and must not be modified during calculation!

stretchH float

A factor by which the terrain is horizontally stretched.

stretchV float

A factor by which the terrain is vertically stretched.

lightSourceInclination double

The angle of inclination of the sun's path away from the horizon in degrees.

Properties

CanCancel

Indicates whether this task can be canceled once it has been started.

public override bool CanCancel { get; }

Property Value

bool

MaxDegreeOfParallelism

Maximum number of threads to use for the computation. -1 to use ProcessorCount.

public int MaxDegreeOfParallelism { get; set; }

Property Value

int

Name

A name describing the task in human-readable form.

public override string Name { get; }

Property Value

string

Result

Returns the calculated occlusion end map array once the calculation is complete.

public ByteVector4Grid Result { get; }

Property Value

ByteVector4Grid

Remarks

A light rise angle is the minimum vertical angle (0 = 0°, 255 = 90°) which a directional light must achieve to be not occluded.

Exceptions

InvalidOperationException

The calculation is not complete yet.

UnitsByte

true if UnitsProcessed and UnitsTotal are measured in bytes; false if they are measured in generic units.

protected override bool UnitsByte { get; }

Property Value

bool

Methods

Execute()

The actual code to be executed.

protected override void Execute()

Remarks

State is automatically set to Started before calling this method, to Complete after a successful exit and to an appropriate error state in case on an exception. You can set additional TaskStates during execution.

Exceptions

OperationCanceledException

The operation was canceled.

IOException

The task ended with IOError.

WebException

The task ended with WebError.

FromTerrain(ITerrain, double)

Prepares to calculate an occlusion interval map for the height-map of a ITerrain.

public static OcclusionIntervalMapGenerator FromTerrain(ITerrain terrain, double lightSourceInclination)

Parameters

terrain ITerrain

The ITerrain providing the height-map. The height-map is not cloned and must not be modified during calculation!

lightSourceInclination double

The angle of inclination of the sun's path away from the horizon in degrees.

Returns

OcclusionIntervalMapGenerator

The newly crated occlusion interval map generator.

Remarks

The results are not automatically written back to terrain.

See Also