A TextureFormat object represents a binary texel format.
abstract class
|
TextureFormat
|
implements
|
IBitsPerTexel
|
||
IConfigurable
|
|||||
extends
|
SerializableBase
|
The configurator object for this type.
public
static
readonly
field
|
Config
|
||
type
|
IConfigurator<TextureFormat>
|
Returns the configuration value that describes this object.
public
method
|
ToConfig
()
|
||
type
|
ConfigValue
|
||
returns
|
|
The configuration value. | |
implements
|
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.
1-bit channel for alpha, 5-bit channels for red, green and blue (16 bits per texel).
public
static
readonly
field
|
A1R5G5B5
|
||
type
|
TextureFormat
|
4-bit channels for alpha, red, green and blue (16 bits per texel).
public
static
readonly
field
|
A4R4G4B4
|
||
type
|
TextureFormat
|
8-bit channels for alpha and luminance resp. grayscale (16 bits per texel).
public
static
readonly
field
|
A8L8
|
||
type
|
TextureFormat
|
Remarks:
The red, green and blue channels store the grayscale value.
8-bit channels for alpha, red, green and blue (32 bits per texel).
public
static
readonly
field
|
A8R8G8B8
|
||
type
|
TextureFormat
|
Block compressed format (4 bits per texel: truecolor, 1-bit alpha).
public
static
readonly
field
|
BC1
|
||
type
|
TextureFormat
|
Block compressed format (8 bits per texel: truecolor, alpha).
public
static
readonly
field
|
BC3
|
||
type
|
TextureFormat
|
16-bit channel for luminance resp. grayscale, no alpha (16 bits per texel).
public
static
readonly
field
|
L16
|
||
type
|
TextureFormat
|
Remarks:
The
red,
green
and
blue
channels
store
the
grayscale
value.
The
alpha
channel
value
is
65535
.
8-bit channel for luminance resp. grayscale, no alpha (8 bits per texel).
public
static
readonly
field
|
L8
|
||
type
|
TextureFormat
|
Remarks:
The
red,
green
and
blue
channels
store
the
grayscale
value.
The
alpha
channel
value
is
255
.
16-bit channel for red, no alpha (16 bits per texel).
public
static
readonly
field
|
R16
|
||
type
|
TextureFormat
|
Remarks:
The
green
and
blue
channel
values
are
undefined.
The
alpha
channel
value
is
65535
.
5-bit channel for red, 6-bit channel for green, 5-bit channel for blue, no alpha (16 bits per texel).
public
static
readonly
field
|
R5G6B5
|
||
type
|
TextureFormat
|
8-bit channel for red, no alpha (8 bits per texel).
public
static
readonly
field
|
R8
|
||
type
|
TextureFormat
|
Remarks:
The
green
and
blue
channel
values
are
undefined.
The
alpha
channel
value
is
255
.
The number of bits per texture pixel.
public
property
|
BitsPerTexel
{
get
}
|
||
type
|
int32
|
||
value
|
|
The number of bits per pixel. | |
implements
|
IBitsPerTexel.BitsPerTexel
|
The texel block size of this texture format.
public
property
|
BlockSize
{
get
}
|
||
type
|
int32
|
||
value
|
|
The texel block size. |
Remarks:
Uncompressed
texture
formats
have
a
block
size
of
1
.
Texels
accesses
must
always
be
aligned
to
the
block
size.
Returns if texture pixels carry transparency data.
public
property
|
HasAlpha
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
texture
pixels
can
be
transparent,
false
if
all
texture
pixels
will
always
be
fully
opaque.
|
||
implements
|
IBitsPerTexel.HasAlpha
|
The name of this texture format.
public
property
|
Name
{
get
}
|
||
type
|
string
|
||
value
|
|
The texture format name. |
Returns the pixel format of this texture format.
public
abstract
property
|
PixelFormat
{
get
}
|
||
type
|
PixelFormat
|
||
value
|
The pixel format. |
Returns the serial type of this object.
public
property
|
SerialType
{
get
}
|
||
type
|
ISerialTypeInfo
|
||
value
|
|
The serial type. | |
inherited
|
SerializableBase.SerialType
|
Returns the serial data version.
public
virtual
property
|
SerialVersion
{
get
}
|
||
type
|
int32
|
||
value
|
|
The serial data version tag. | |
inherited
|
SerializableBase.SerialVersion
|
Remarks:
An ISerializable implementation is required to support all versions up to the one returned by SerialVersion.
See also:
ISerializable.Serialize
[Pure]
|
||||
public
method
|
BlockSizeAlign
(int32 x)
|
|||
type
|
int32
|
|||
params
|
x
|
Checks if the given texel location is aligned to this texture formats block size.
[Pure]
|
||||
public
method
|
CheckBlockSizeAlignment
(int32 x,
int32 y)
|
|||
type
|
bool
|
|||
params
|
x
|
X-coordinate of top-left texel rectangle. | ||
y
|
Y-coordinate of top-left texel rectangle. | |||
returns
|
true
if
the
texel
location
is
properly
aligned
to
the
block
size,
false
if
not.
|
Checks if the given texel rectangle is aligned to this texture formats block size.
[Pure]
|
||||
public
method
|
CheckBlockSizeAlignment
(int32 x,
int32 y,
int32 width,
int32 height)
|
|||
type
|
bool
|
|||
params
|
x
|
X-coordinate of top-left texel rectangle. | ||
y
|
Y-coordinate of top-left texel rectangle. | |||
width
|
Width of texel rectangle. | |||
height
|
Height of texel rectangle. | |||
returns
|
true
if
the
texel
rectangle
is
properly
aligned
to
the
block
size,
false
if
not.
|
Creates a texel buffer for this texture format.
[OwnerReturn]
|
||||
public
method
|
CreateBuffer
(int32 width,
int32 height,
int32 mipmaps = 1)
|
|||
type
|
TexelBuffer
|
|||
params
|
width
|
[>0]
|
The buffer width, in texels. | |
height
|
[>0]
|
The buffer height, in texels. | ||
mipmaps
|
[>=0]
|
The
number
of
mipmap
levels
(including
the
full-resolution
level).
If
0
the
number
of
levels
will
be
inferred
from
width
and
height
(see
MipmapLevelsRect).
Defaults
to
1 .
|
||
returns
|
|
The created TexelBuffer object. |
Initializes the state of this object from the given data stream.
public
virtual
method
|
Deserialize
(int32 serialVersion,
ISerializer data)
|
||
type
|
ISerializable
|
||
params
|
serialVersion
|
[>=1]
|
The serial data version. |
data
|
[not-null]
|
The serial data stream. | |
returns
|
|
The
deserialized
object.
This
will
typically
be
this ,
but
in
some
circumstances,
another
instance
may
be
returned
(e.g.
singletons).
|
|
inherited
|
SerializableBase.Deserialize
|
Remarks:
The Deserialize method will be called immediately after the object has been instantiated via its default constructor.
The provided serialVersion number is guaranteed to be equal to or less than the SerialVersion returned by this object (i.e. ISerializable object must provide backwards compatibility).
See also:
ISerializable.SerializeReturns the default TextureFormat for the given PixelFormat.
[Pure]
|
||||
public
static
method
|
For
(PixelFormat pixelFormat)
|
|||
type
|
TextureFormat
|
|||
params
|
pixelFormat
|
The pixel format. | ||
returns
|
|
The default TextureFormat. |
Returns a texture format that is capable of storing (almost) all information of this one but is more general in terms of being supported by some GPU.
public
virtual
method
|
Generalize
()
|
||
type
|
TextureFormat
|
||
returns
|
The
texture
format
that
is
more
general
or
null
if
this
texture
format
cannot
be
generalized.
|
Remarks:
This default implementation establishes the following mappings for the pre-defined texture formats:
null
null
Serializes the current state of this object to the given data stream.
public
virtual
method
|
Serialize
(ISerializer data)
|
||
params
|
data
|
[not-null]
|
The serial data stream. |
inherited
|
SerializableBase.Serialize
|
See also:
ISerializable.DeserializeCreates a new instance of TextureFormat.
protected
constructor
|
TextureFormat
(ISerialTypeInfo serialType,
string name,
int32 bitsPerTexel,
bool hasAlpha,
int32 blockSize = 1)
|
||
params
|
serialType
|
[not-null]
|
The serial type ID. |
name
|
[not-empty]
|
The texture format name. | |
bitsPerTexel
|
[>0]
|
Number of bits per texel. | |
hasAlpha
|
Does this texture format include transparency information? | ||
blockSize
|
[>0]
|
The
texel
block
size.
Defaults
to
1 . |
Creates a texel buffer for this texture format.
[OwnerReturn]
|
||||
protected
abstract
method
|
CreateBuffer
(int32 width,
int32 height,
[Owner]
TexelBuffer mipmap)
|
|||
type
|
TexelBuffer
|
|||
params
|
width
|
The buffer width, in texels. | ||
height
|
The buffer height, in texels. | |||
mipmap
|
The
next
smaller
mipmap
level
or
null . |
|||
returns
|
|
The created texel buffer. |