The TerrainBuffer component is used as a shared buffer by zero or more TerrainMesh components.
sealed class
|
TerrainBuffer
|
extends
|
Disposable
|
||
implements
|
IDisposableGeneric<TerrainBuffer>
|
||||
IResourceHandle
|
TerrainBuffer objects act as resource handles and produce TerrainBufferResource resource objects.
See also:
TerrainBufferOptionsThe wrapped PyramidFileCache object.
public
property
|
Cache
{
get
}
|
||
type
|
PyramidFileCache
|
||
value
|
|
The cache. |
Returns the flags that have been used to create this terrain buffer.
public
property
|
Flags
{
get
}
|
||
type
|
TerrainBufferFlags
|
||
value
|
The terrain buffer flags. |
Will this object be disposed upon the next call to Dispose?
[ThreadSafe]
|
||||
public
property
|
IsSoleOwnership
{
get
}
|
|||
type
|
bool
|
|||
value
|
true
if
the
object
will
be
disposed
when
Dispose
is
called,
false
if
the
object
will
not
be
disposed,
because
some
other
code
is
still
holding
shared
ownership
(see
AcquireThrow).
|
|||
inherited
|
Disposable.IsSoleOwnership
|
Returns the lifecycle state of this object.
public
property
|
LifecycleState
{
get
}
|
||
type
|
LifecycleState
|
||
value
|
The lifecycle state. | ||
inherited
|
Disposable.LifecycleState
|
The wrapped MeshBuffer object.
public
property
|
MeshBuffer
{
get
}
|
||
type
|
MeshBuffer
|
||
value
|
|
The mesh buffer. |
The layout of the shared vertex buffer.
public
property
|
VertexLayout
{
get
}
|
||
type
|
VertexElements
|
||
value
|
|
The vertex buffer layout. |
Remarks:
The layout always the following VertexElementUsage semantics, in the given order:
0
:
terrain-space
vertex
positions,
sourced
from
Position.
1
:
precision
delta
of
terrain-space
vertex
positions,
sourced
from
Position.
0
:
terrain-space
normal
vectors
(maximum
LOD),
sourced
from
Normal.
1
:
terrain-space
normal
vectors
(base
LOD),
sourced
from
NormalBase.
0
:
terrain-space
tangent
vectors
along
the
heightmap
X-axis,
sourced
from
TangentX.
1
:
terrain-space
tangent
vectors
along
the
heightmap
Y-axis,
sourced
from
TangentY.
2
:
terrain-space
tangent
vectors
along
the
heightmap
Z-axis,
sourced
from
TangentZ.
0
:
diffuse
vertex
colors
(maximum
LOD),
sourced
from
Texture.
1
:
vertex
material
IDs
(maximum
LOD),
sourced
from
Material.
2
:
vertex
material
weights
(maximum
LOD),
sourced
from
Material.
0
:
heightmap
coordinates
(high
bits),
sourced
from
HeightmapCoords.
1
:
heightmap
coordinates
(low
bits),
sourced
from
HeightmapCoords.
2
:
level-of-detail
coefficients,
sourced
from
Area.
Creates a new instance of TerrainBuffer.
public
constructor
|
TerrainBuffer
([Owner]
PyramidFileCache cache,
TerrainBufferOptions options)
|
||
params
|
cache
|
The
pyramid
file
cache
or
null . |
|
options
|
The terrain buffer options. |
Remarks:
The CacheOptions and CachePath properties are ignored by this method. Use CreateTerrainBuffer if you want these to be taken into account.
Acquires a strong reference to this disposable object.
[OwnerReturn, Pure]
|
||||
public
method
|
Acquire
()
|
|||
type
|
TerrainBuffer
|
|||
returns
|
The
strong
reference
to
this
disposable
object
or
null
iff
this
object
is
no
longer
valid.
|
Remarks:
The object will not be actually disposed by calls to Dispose when there is at least one strong reference left. Code that calls this method is responsible for calling the Dispose method accordingly.
This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.
Acquires a strong reference to this disposable object.
[OwnerReturn, Pure]
|
||||
public
method
|
AcquireBase
()
|
|||
type
|
IDisposable
|
|||
returns
|
The
strong
reference
to
this
disposable
object
or
null
iff
this
object
is
no
longer
valid.
|
|||
inherited
|
Disposable.AcquireBase
|
Remarks:
The object will not be actually disposed by calls to IDisposable when there is at least one strong reference left. Code that calls this method is responsible for calling the IDisposable method accordingly.
This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.
Using this method usually requires type casting. Subclasses may additionally implement IDisposableGeneric, in order to provide some syntactic sugar for that.
Acquires a strong reference to this disposable object.
[OwnerReturn, Pure]
|
||||
public
method
|
AcquireThrow
()
|
|||
type
|
IDisposable
|
|||
returns
|
|
The strong reference to this disposable object. | ||
inherited
|
Disposable.AcquireThrow
|
Remarks:
The object will not be actually disposed by calls to IDisposable when there is at least one strong reference left. Code that calls this method is responsible for calling the IDisposable method accordingly.
This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.
Exceptions:
Clears the terrain buffer caches.
public
method
|
ClearCache
()
|
Remarks:
The texel pyramid cache (see Cache) is cleared with Clear and the cache of each TextureAtlas object is cleared with Clear.
See also:
TerrainBufferOptions.CachePathExceptions:
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. | ||
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).
Exceptions:
Releases all resources held by this object if there are no more strong references to it, decrements the reference counter by one otherwise.
[Dispose, OwnerThis, ThreadSafe]
|
||||
public
method
|
Dispose
()
|
|||
inherited
|
Disposable.Dispose
|
Remarks:
The Dispose method silently returns if the object has already been disposed.
Implementing methods must not throw any exceptions.
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.
|
[Pure]
|
||||
public
override
method
|
GetHashCode
()
|
|||
type
|
int32
|