TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

interface IModelTexture in Tinman.AddOns.Models

Base interface for classes that represent textures for 3D models.

interface IModelTexture extends IConfigurable
  IPreloadingResourceHandle
  base of ModelTexture

Remarks

IModelTexture objects act as resource handles and produce ITexture2D resource objects.

Attributes

CanPreloadResource

Does this resource handle support preloading?

property CanPreloadResource { get }
type bool
value true if preloading is supported (i.e. PreloadResource will never return null),
false if preloading is not supported (i.e. PreloadResource always returns null).
inherited IPreloadingResourceHandle.CanPreloadResource

PreferredTextureFormat

The preferred format to use for this model texture.

property PreferredTextureFormat { get }
type TextureFormat
value The preferred texture format or null.

Methods

CreateResource

Creates a new resource object, using the given graphics context.

[OwnerReturn]
method CreateResource (Graphics graphics)
type IResource
params graphics [not-null] The graphics context to use.
returns The resource object or null.
inherited 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).

Equals

Compares this object with the given one.

[Pure]
method Equals (T other)
type bool
params other The object to compare to.
returns true if this object is equal to other, false if not.
inherited IEquatable.Equals

PreloadResource

Preloads resource data, without creating the resource object.

[OwnerReturn, ThreadSafe]
method PreloadResource ()
type IResourceData
returns The preloaded resource data or null if this resource handle does not support resp. require preloading.
inherited IPreloadingResourceHandle.PreloadResource

Remarks:

Calling CreateResource on the returned resource will perform no additional loading, which means that all necessary data is already present in memory.

ReadElevation

Reads elevation data.

method ReadElevation (PixelRange range)
type ElevationBuffer
params range The pixel range to use (see ScanlineRange).
returns [not-null] The elevation data.

ReadPixels

Reads pixel data.

method ReadPixels ()
type ColorBuffer
returns The pixel data or null if not found.

ReadTexels

Reads texture data.

[OwnerReturn]
method ReadTexels ()
type TexelBuffer
returns The texture data or null if not found.

ToConfig

Returns the configuration value that describes this object.

method ToConfig ()
type ConfigValue
returns [not-null] The configuration value.
inherited IConfigurable.ToConfig

Remarks:

All configurable objects need to implement this interface. For simple types, it is preferable to delegate to ToValue.

The returned value may be of type Invalid, which means that this object in its current state cannot be described with the configuration API.

Before returning the resulting configuration value, Cache must be called on it, passing this IConfigurable object as parameter.

Extensions

NormalMap

Interprets this model texture as a bump map and computes a normal map from it.

method NormalMap (float64 height = 0.01)
type IModelTexture
params height [>0] The relative bump height (see remarks). Defaults to 0.01f.
returns [not-null] The resulting model texture.

Remarks:

Black pixels lie in the XY plane (see figure), white pixels are at the given height. The height is specified relative to the size of this texture (i.e. maximum of width and height), e.g. a value of 1 would turn the cuboid below into a cube.

     .............
    .:          .:
Z+ . :         . :
| .  +--------.--+-- X+
|.  /        .  /
.............  /
: /         : /
:/          :/
+-----------+
           /
          Y+