ModelGeometryBuilder

Description

sealed class Tinman.Engine.Models.ModelGeometryBuilder

Helper class for generating content for IModelGeometry objects.

Public / Methods

Append


public method Append → ()

returns → ModelGeometryBuilder

this

Remembers the current values of CountVertices and CountIndices, in order to resolve subsequently added vertices and indices.

The remembered vertex count is added to each vertex index value that is added by any of the primitive building methods:

The remembered vertex resp. index count is added to PrimitiveBatch.First by the Batch method.

Batch


public method Batch → (1)

batch in : PrimitiveBatch

The relative primitive batch to resolve.

returns → PrimitiveBatch

The resolved absolute primitive batch.

Resolves the given relative primitive batch into an absolute one.

Build


public method Build → ()

returns → IModelGeometry

The built model geometry.

Builds a static model geometry from the content of this builder.

Build​Dynamic


public method BuildDynamic → (1)

positionExtra in : int32

Defines how to treat ModelVertexFormat.PositionExtra:
< 0 : never use high-precision vertex positions
= 0 : use high-precision vertex positions only if necessary
> 0 : always use high-precision vertex positions

returns → IModelGeometryDynamic

The built model geometry.

Builds a dynamic model geometry from the content of this builder.

Build​Simple

2 overloads


public method BuildSimple1 → (1)

triangles in : int32

[-1..ModelGeometryBuilder.CountIndices]
The number of vertex indices to use for the triangle list. If negative, CountVertices will be used. The remaining vertex indices will be used for the line list.

returns → IModelGeometrySimple

The built model geometry.

Builds a simple model geometry from the content of this builder.

The IModelGeometrySimple.Triangles batch will be an indexed Primitive.TriangleList, using vertices in the range [0..triangles[.
The IModelGeometrySimple.Lines batch will be an indexed Primitive.LineList, using vertices in the range [triangles..CountIndices[.


public method BuildSimple2 → (2)

triangles in : PrimitiveBatch

The absolute primitive batch for triangles (i.e. surface).

lines in : PrimitiveBatch

The absolute primitive batch for lines (i.e. edges).

returns → IModelGeometrySimple

The built model geometry.

Builds simple model geometry from the content of this builder, using the given primitive batches for triangles and/or lines.

Line​Segment


public method LineSegment → (2)

in : int32

First line vertex index.

in : int32

Second line vertex index.

Adds the given vertex indices, usually to create a single primitive of a Primitive.LineList.

Vertex indices are added in this sequence:
(in, in)

Point


public method Point → (1)

in : int32

Point vertex index.

Adds the given vertex index, usually to create a single primitive of a Primitive.PointList.

Vertex indices are added in this sequence:
(in)

Quad


public method Quad → (4)

in : int32

First quadrilateral vertex index.

in : int32

Second quadrilateral vertex index.

in : int32

Third quadrilateral vertex index.

in : int32

Fourth quadrilateral vertex index.

Adds the given vertex indices, usually to create a two primitives of a Primitive.TriangleList, that forms a single quadrilateral.

The resulting quadrilateral has the following structure:

(a)---(b)
 | \ 1.|    a,b,c,d = quadrilateral vertices
 |  \  |
 |2. \ |    1,2     = 1st resp. 2nd triangle
(d)---(c)

Vertex indices are added in this sequence:
(in, in, in, in, in, in)

Triangle


public method Triangle → (3)

in : int32

First triangle vertex index.

in : int32

Second triangle vertex index.

in : int32

Third triangle vertex index.

Adds the given vertex indices, usually to create a single primitive of a Primitive.TriangleList.

Vertex indices are added in this sequence:
(in, in, in)

Public / Attributes

Count​Indices


public attribute CountIndices → (get)

value : int32

[>=0]
The number of written vertex indices.

Returns the number of vertex indices that have been written since the last call to Append.

Count​Vertices


public attribute CountVertices → (get)

value : int32

[>=0]
The number of written vertices.

Returns the number of vertices that have been written since the last call to Append.

Flip


public attribute Flip → (get,set)

value : bool

true to flip primitives, false to do not.

Flip winding of subsequently added triangles and line segments?

Defaults to false.

Indices


public attribute Indices → (get)

value : int32 [ ]

The vertex index array of null if no indices have been written.

Returns the vertex indices.

Vertices


public attribute Vertices → (get)

value : VertexWriter

[not-null]
The object to use for writing vertex data.

The vertex writer.