Performs computations for shadow mapping.
sealed class
|
ShadowMapping
|
implements
|
IMeshBoundMinRadius
|
||
IMeshBoundMinSize
|
|||||
INearAtZero
|
|||||
IResourceHandle
|
|||||
extends
|
MeshBoundBase
|
A full computation cycle is made of these steps:
ShadowMapping objects act as resource handles and produce ShadowMappingResource resource objects.
The camera frustum to use for clipping the bounding boxes of the shadow receivers (see Receivers).
public
property
|
CameraFrustum
{
get
set
}
|
||
type
|
IFrustum
|
||
value
|
The
frustum
or
null
to
disable
clipping. |
The object that provides the current camera position.
public
property
|
CameraInfo
{
get
set
}
|
||
type
|
CameraInfo
|
||
value
|
|
The camera position provider. | |
implements
|
ICameraInfoDependent.CameraInfo
|
The number of shadow map cascades.
public
property
|
CascadeCount
{
get
}
|
||
type
|
int32
|
||
value
|
|
The cascade count. |
The relative overlap of the shadow cascades, along the view direction.
public
property
|
CascadeOverlap
{
get
set
}
|
||
type
|
float64
|
||
value
|
|
The relative overlap. |
Remarks:
The
cascade
overlap
is
applied
by
shifting
the
far
splitting
plane
away
from
the
view
point,
by
the
amount
S
:
S = Zfar * Owhere
Zfar
is
the
view-space
Z-coordinate
of
the
far
splitting
plane
of
the
cascade
(see
ViewRangeZ)
and
O
is
the
configured
cascade
overlap.
The cascade overlap is not applied to the last cascade.
The
default
value
is
0.1
.
The fixed Z-range (in camera-space) of the whole shadow volume, before being split into cascades.
public
property
|
CascadeRange
{
get
set
}
|
||
type
|
RangeD
|
||
value
|
The Z-range of the shadow volume. |
Remarks:
This range only influences the Z-slices of the shadow cascades. All collected shadow receivers will be covered by the shadow maps.
If the given range is empty (see IsEmpty), the Z-range will be determined automatically from the collected shadow receivers.
The default value is Zero.
public
property
|
FilterIn
{
get
set
}
|
||
type
|
MeshTreeFilter
|
||
value
|
public
property
|
FilterOut
{
get
set
}
|
||
type
|
MeshTreeFilter
|
||
value
|
Has this object been bound to an IMesh object?
public
property
|
HasMesh
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
object
is
currently
bound
to
an
IMesh,
false
if
not.
|
||
inherited
|
MeshBoundBase.HasMesh
|
The light direction.
public
property
|
LightDirection
{
get
set
}
|
||
type
|
Vec3D
|
||
value
|
The light direction vector. |
The CLOD mesh this object is currently bound to.
public
property
|
Mesh
{
get
}
|
||
type
|
IMesh
|
||
value
|
The
CLOD
mesh
or
null . |
||
inherited
|
MeshBoundBase.Mesh
|
The mesh sector quadtree is traversed until the bounding sphere radius of a mesh sector falls below this limit.
public
property
|
MinRadius
{
get
set
}
|
||
type
|
float32
|
||
value
|
|
The minimum bounding sphere radius, in terrain-space. | |
implements
|
IMeshBoundMinRadius.MinRadius
|
Remarks:
The
default
value
is
0
(i.e.
the
entire
mesh
is
traversed).
The mesh sector quadtree is traversed until the projected screen-size of a mesh sector falls below this limit.
public
property
|
MinSize
{
get
set
}
|
||
type
|
float32
|
||
value
|
|
Minimum sector size, in screen-space. | |
implements
|
IMeshBoundMinSize.MinSize
|
Remarks:
This value is the square root of the approximated pixel area of the mesh sector on the screen.
The
default
value
is
256.0f
pixels.
Is
the
near-clipping
plane
mapped
to
0
in
clip-space
(true
),
or
is
it
mapped
to
-1
(false
)?
public
property
|
NearAtZero
{
get
set
}
|
||
type
|
bool
|
||
value
|
The mapping behaviour for the near-clipping plane. | ||
implements
|
INearAtZero.NearAtZero
|
Remarks:
The
default
value
is
true
.
The camera view direction that has been used for shadow computations.
public
property
|
ViewDirection
{
get
}
|
||
type
|
Vec3D
|
||
value
|
The unit-length view direction vector. |
See also:
ComputeThe camera position that has been used for shadow computations.
public
property
|
ViewPoint
{
get
}
|
||
type
|
Vec3D
|
||
value
|
The camera position, in terrain-space. |
See also:
ComputeThe current viewport object.
public
property
|
Viewport
{
get
set
}
|
||
type
|
Viewport
|
||
value
|
|
The viewport object. | |
implements
|
IViewportDependent.Viewport
|
Creates a new instance of ShadowMapping.
public
constructor
|
ShadowMapping
(CameraInfo cameraInfo = null,
Viewport viewport = null,
int32 cascadeCount = 3)
|
||
params
|
cameraInfo
|
The
terrain-space
camera
position.
If
null ,
a
new
instance
of
CameraInfo
will
be
used.
Defaults
to
null .
|
|
viewport
|
The
projection
viewport.
If
null ,
a
new
instance
of
Viewport
will
be
used.
Defaults
to
null .
|
||
cascadeCount
|
[>=1]
|
The number of shadow cascades. |
Returns a shadow mapping cascade.
public
method
|
Cascade
(int32 index)
|
||
type
|
ShadowCascade
|
||
params
|
index
|
[0..CascadeCount-1]
|
The shadow mapping cascade index (0 is near). |
returns
|
|
The list of shadow mapping cascades. |
Returns the Z-range in view-space of the given shadow cascade, to be used for culling shadow casters.
public
method
|
CascadeCullZ
(int32 index)
|
||
type
|
RangeD
|
||
params
|
index
|
[0..CascadeCount-1]
|
The shadow mapping cascade index (0 is near). |
returns
|
The Z-range, in view-space. |
Performs shadow mapping computations (see class remarks).
public
method
|
Compute
(TerrainBoundsDelegate receivers = null,
bool skipCascades = false)
|
||
params
|
receivers
|
Additional non-terrain shadow receivers. This callback will only be invoked when CameraFrustum has been set. | |
skipCascades
|
Skip
computation
of
shadow
cascades?
If
set
to
true ,
only
the
shadow
receivers
(see
Receivers)
will
be
updated
and
the
terrain
mesh
filter
will
not
be
modified
(see
FilterOut).
Defaults
to
false .
|
Creates a new resource object, using the given graphics context.
[OwnerReturn]
|
||||
public
method
|
CreateResource
(Graphics graphics)
|
|||
type
|
IResource
|
|||
params
|
graphics
|
[not-null]
|
The graphics context to use. | |
returns
|
The
resource
object
or
null . |
|||
implements
|
IResourceHandle.CreateResource
|
Remarks:
Resource objects may implement the IMemoryConsumption interface. In this case, the reported memory consumption will be interpreted as an estimate on how much GPU memory is consumed by the resource. This estimate can then be used for resource caching (e.g. CacheMemory).
Compares this object with the given one.
[Pure]
|
||||
public
method
|
Equals
(IResourceHandle other)
|
|||
type
|
bool
|
|||
params
|
other
|
The object to compare to. | ||
returns
|
true
if
this
object
is
equal
to
other,
false
if
not.
|
|||
implements
|
IEquatable.Equals
|
[Pure]
|
||||
public
override
method
|
GetHashCode
()
|
|||
type
|
int32
|
Binds this object to the given IMesh.
public
override
method
|
MeshBind
(IMesh mesh)
|
||
params
|
mesh
|
The mesh object. | |
overrides
|
MeshBoundBase.MeshBind
|
Unbinds this object from its current IMesh.
public
override
method
|
MeshUnbind
()
|
||
overrides
|
MeshBoundBase.MeshUnbind
|