Abstract base class for IVertexFormat implementations.
abstract class
|
VertexFormat
|
implements
|
IVertexFormat
|
An empty vertex format.
public
static
readonly
field
|
Empty
|
||
type
|
IVertexFormat
|
Remarks:
Use this value as the initial seed when incrementally building vertex formats with Append.
Returns the vertex declaration elements.
public
property
|
VertexElements
{
get
}
|
||
type
|
VertexElements
|
||
value
|
|
The vertex declaration elements. | |
implements
|
IVertexElements.VertexElements
|
Returns an IVertexFormat for Color usage.
[Pure]
|
||||
public
static
method
|
Color
(Semantic semantic = null,
TupleComponent component = TupleComponent.X)
|
|||
type
|
IVertexFormat
|
|||
params
|
semantic
|
The
Semantic
to
source
data
from.
If
null ,
Texture
will
be
used.
Defaults
to
null .
|
||
component
|
The vertex array component to use. Defaults to X. | |||
returns
|
|
The vertex format. |
Remarks:
Color tuples are read from the given vertex array (see semantic) using either:
Byte offset #0: color (int32)
Returns an IVertexFormat for the given usage.
[Pure]
|
||||
public
static
method
|
Float32
(VertexElementUsage usage,
Semantic semantic,
int32 tupleSize = 0)
|
|||
type
|
IVertexFormat
|
|||
params
|
usage
|
The vertex element usage. | ||
semantic
|
[not-null]
|
The Semantic to source data from. | ||
tupleSize
|
[0..4]
|
Size
of
a
coordinate
tuple.
If
0 ,
the
TupleSize
of
semantic
is
used.
Defaults
to
0 .
|
||
returns
|
|
The vertex format. |
Remarks:
Coordinate tuples are read from the given vertex array (see semantic) and written to the vertex buffer as 32-bit floating-point values:
Byte offset #0: x (float32) Byte offset #4: y (float32) ? tupleSize >= 2 Byte offset #8: z (float32) ? tupleSize >= 3 Byte offset #12: w (float32) ? tupleSize == 4
Returns an IVertexFormat for TextureCoords usage.
[Pure]
|
||||
public
static
method
|
HeightmapCoordinates
(CoordinatePrecision precision = CoordinatePrecision.Float,
int32 tupleSize = 0,
Semantic semantic = null)
|
|||
type
|
IVertexFormat
|
|||
params
|
precision
|
The texture coordinate precision. Defaults to Float. | ||
tupleSize
|
[0..4]
|
Size
of
a
coordinate
tuple.
If
0 ,
the
TupleSize
of
semantic
is
used.
Defaults
to
0 .
|
||
semantic
|
The
Semantic
to
source
data
from.
If
null ,
HeightmapCoords
will
be
used.
Defaults
to
null .
|
|||
returns
|
|
The vertex format. |
Remarks:
Coordinate
tuples
are
read
from
the
vertex
array
(see
GetVertexArray)
using
the
GetI
method.
Input
coordinates
are
clamped
to
0
and
MaxCoord.
Then,
the
precision
fix
is
applied,
the
resulting
coordinates
are
normalized
to
[0..1]
and
finally
written
to
the
vertex
buffer:
Byte offset #0: x (float32 or int32) Byte offset #4: y (float32 or int32) ? tupleSize >= 2 Byte offset #8: z (float32 or int32) ? tupleSize >= 3 Byte offset #12: w (float32 or int32) ? tupleSize == 4
See also:
HeightmapsUtil.MaxCoordReturns an IVertexFormat for Color usage that encodes the weights of the specified materials.
[Pure]
|
||||
public
static
method
|
Material
(int32 material0 = 0,
int32 material1 = 1,
int32 material2 = 2,
int32 material3 = 3,
Semantic semantic = null,
TupleComponent component = TupleComponent.X)
|
|||
type
|
IVertexFormat
|
|||
params
|
material0
|
ID
of
first
material.
Defaults
to
0 . |
||
material1
|
ID
of
second
material.
Defaults
to
1 . |
|||
material2
|
ID
of
third
material.
Defaults
to
2 . |
|||
material3
|
ID
of
fourth
material.
Defaults
to
3 . |
|||
semantic
|
The
Semantic
to
source
data
from.
If
null ,
Material
will
be
used.
Defaults
to
null .
|
|||
component
|
The vertex array component to use. Defaults to X. | |||
returns
|
|
The vertex format. |
Remarks:
Material token values are read from the vertex array using the given tuple component. Then the weights are extracted for the specified materials (see WeightFor) and then written to the vertex buffer as a single 32-bit integer value:
Byte offset #0: material weights (int32) first material : blue channel second material : green channel third material : red channel fourth material : alpha channel
See also:
MaterialTokenReturns an IVertexFormat for Color usage that encodes the materials ID of a material token.
[Pure]
|
||||
public
static
method
|
MaterialId
(Semantic semantic = null,
TupleComponent component = TupleComponent.X)
|
|||
type
|
IVertexFormat
|
|||
params
|
semantic
|
The
Semantic
to
source
data
from.
If
null ,
Material
will
be
used.
Defaults
to
null .
|
||
component
|
The vertex array component to use. Defaults to X. | |||
returns
|
|
The vertex format. |
Remarks:
Material token values are read from the vertex array using the given tuple component. Then the material IDs are written to the vertex buffer as a single 32-bit integer value:
Byte offset #0: bits [32..64[ of material token (int32) first material : blue channel second material : green channel third material : red channel fourth material : alpha channel
See also:
MaterialTokenReturns an IVertexFormat for Color usage that encodes the materials weights of a material token.
[Pure]
|
||||
public
static
method
|
MaterialWeight
(Semantic semantic = null,
TupleComponent component = TupleComponent.X)
|
|||
type
|
IVertexFormat
|
|||
params
|
semantic
|
The
Semantic
to
source
data
from.
If
null ,
Material
will
be
used.
Defaults
to
null .
|
||
component
|
The vertex array component to use. Defaults to X. | |||
returns
|
|
The vertex format. |
Remarks:
Material token values are read from the vertex array using the given tuple component. Then the material weights are written to the vertex buffer as a single 32-bit integer value:
Byte offset #0: bits [0..32[ of material token (int32) first material : blue channel second material : green channel third material : red channel fourth material : alpha channel
See also:
MaterialTokenReturns an IVertexFormat for Normal usage.
[Pure]
|
||||
public
static
method
|
Normal
(Semantic semantic = null)
|
|||
type
|
IVertexFormat
|
|||
params
|
semantic
|
The
Semantic
to
source
data
from.
If
null ,
Normal
will
be
used.
Defaults
to
null .
|
||
returns
|
|
The vertex format. |
Remarks:
Coordinate tuples are read from the Normal vertex array and written to the vertex buffer as 32-bit floating-point values:
Byte offset #0: x (float32) Byte offset #4: y (float32) Byte offset #8: z (float32)
Returns an IVertexFormat that acts as a placeholder for the given usage.
[Pure]
|
||||
public
static
method
|
Placeholder
(VertexElementUsage usage)
|
|||
type
|
IVertexFormat
|
|||
params
|
usage
|
The vertex element usage. | ||
returns
|
|
The vertex format. |
Returns an IVertexFormat for Position usage.
[Pure]
|
||||
public
static
method
|
Position
(PositionPrecision precision = PositionPrecision.Float,
int32 tupleSize = 0,
Semantic semantic = null)
|
|||
type
|
IVertexFormat
|
|||
params
|
precision
|
The desired precision kind. Defaults to Float. | ||
tupleSize
|
[0..4]
|
Size
of
a
coordinate
tuple.
If
0 ,
the
TupleSize
of
semantic
is
used.
Defaults
to
0 .
|
||
semantic
|
The
Semantic
to
source
data
from.
If
null ,
Position
will
be
used.
Defaults
to
null .
|
|||
returns
|
|
The vertex format. |
Remarks:
Coordinate tuples are read from the vertex array (see GetVertexArray) using the GetF resp. GetD method. Then, the given precision fix is applied and the resulting coordinates and written to the vertex buffer as 32-bit floating-point values:
Byte offset #0: x (float32) Byte offset #4: y (float32) ? tupleSize >= 2 Byte offset #8: z (float32) ? tupleSize >= 3 Byte offset #12: w (float32) ? tupleSIze == 4
Returns an IVertexFormat for Tangent usage.
[Pure]
|
||||
public
static
method
|
Tangent
(Semantic semantic = null)
|
|||
type
|
IVertexFormat
|
|||
params
|
semantic
|
The
Semantic
to
source
data
from.
If
null ,
TangentX
will
be
used.
Defaults
to
null .
|
||
returns
|
|
The vertex format. |
Remarks:
Coordinate tuples are read from the given vertex array and written to the vertex buffer as 32-bit floating-point values:
Byte offset #0: x (float32) Byte offset #4: y (float32) Byte offset #8: z (float32)
Returns an IVertexFormat for TextureCoords usage.
[Pure]
|
||||
public
static
method
|
TextureCoords
()
|
|||
type
|
IVertexFormat
|
|||
returns
|
|
The vertex format. |
Remarks:
Coordinate tuples are read from the TextureCoords vertex array and written to the vertex buffer as 32-bit floating-point values:
Byte offset #0: x (float32) Byte offset #4: y (float32)
Appends the given vertex format to this vertex format.
[Pure]
|
||||
public
virtual
method
|
Append
(IVertexFormat format)
|
|||
type
|
IVertexFormat
|
|||
params
|
format
|
[not-null]
|
The vertex format to append. | |
returns
|
|
The resulting vertex format. | ||
implements
|
IVertexFormat.Append
|
Sets the vertex data containers from which this vertex converter shall read vertex data.
public
virtual
method
|
SetVertexArrays
(VertexArrays vertexArrays)
|
||
params
|
vertexArrays
|
[not-null]
|
The vertex data collection. |
implements
|
IVertexArraysDependent.SetVertexArrays
|
Writes vertex data to the given vertex buffer.
[Pure]
|
||||
public
abstract
method
|
WriteVertex
(int32 vertex,
ByteBuffer buffer)
|
|||
params
|
vertex
|
[>=0]
|
The vertex index. | |
buffer
|
[not-null]
|
The target vertex buffer region. | ||
implements
|
IVertexFormat.WriteVertex
|
The semantic of this vertex format.
protected
readonly
field
|
semantic
|
||
type
|
Semantic
|
The default vertex array this vertex format uses.
protected
field
|
vertexArray
|
||
type
|
IVertexArray
|
Remarks:
This field is set in SetVertexArrays.
Creates a new instance of VertexFormat.
protected
constructor
|
VertexFormat
(VertexElements elements,
Semantic semantic)
|
||
params
|
elements
|
[not-null]
|
The vertex elements. |
semantic
|
[not-null]
|
The Semantic to use for initializing vertexArray. |