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.

BuildDynamic


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.

BuildSimple

2 overloads


public method BuildSimple1 → (1)

triangles in : int32

[>=0]
The number of vertices to use for the triangle 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.

LineSegment


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

CountIndices


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.

CountVertices


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.