ModelGeometry
Description
- Derived from
Abstract base class for IModelGeometry implementations.
This class provides factory methods for building instances of the IModelGeometry interface:
Public / Constructors
Append
Concatenates the vertices and indices of the given model geometries in.
Calling this method is equivalent to calling IModelGeometry.Append repeatedly for the elements in geometries in.
Box
Builds an axis-aligned box.
The following figure shows the mapping from the given box in to the 3D model:
121-----221 /| /| / | / | 122-----222 | | 111---|-211 | / | / |/ |/ 112-----212
Capsule
Builds a capsule.
________________ / \ A = (0,0,0) | A------------B | \________________/ B = (0,length,0) |____________| length |__| radius
- See also
Cone
Builds a cone.
B /|\ A = (0,0,0) / | \ / | \ B = (0,length,0) / | \ +----A----+ |____| radius
- See also
Cylinder
Builds a cylinder.
____________ | | A = (0,0,0) A------------B |____________| B = (0,length,0)
- See also
Generic
Builds a 3D primitive from a generic, possibly degenerated capsule.
The point A
is at (0,0,0), the point B
is at (0, length in ,0):
________________ / \ | A------------B | Round (cap > 0) \________________/ ____________ | | A------------B Flat (cap = 0) |____________| ____________ A------------B None (cap < 0) ____________ |____________| length |__| |__| radiusA, radiusB
By choosing parameter values carefully, a variety of 3D primitives can be built with this method:
Primitive | len = 0 | rA = 0 | rB = 0 | rA = rB | cA | cB -----------+---------+--------+--------+---------+----+---- Capsule | no | no | no | yes | 1 | 1 -----------+---------+--------+--------+---------+----+---- Cone | no | yes | no | no | -1 | 0 | no | no | yes | no | 0 | -1 -----------+---------+--------+--------+---------+----+---- Cylinder | no | no | no | yes | 0 | 0 -----------+---------+--------+--------+---------+----+---- Disc | yes | no | no | yes | 0 | 0 -----------+---------+--------+--------+---------+----+---- Hemisphere | yes | no | no | no | 1 | 0 | yes | no | yes | yes | 0 | 1 -----------+---------+--------+--------+---------+----+---- Line | no | yes | yes | yes | -1 | -1 -----------+---------+--------+--------+---------+----+---- Point | yes | yes | yes | yes | -1 | -1 -----------+---------+--------+--------+---------+----+---- Sphere | yes | no | no | yes | 1 | 1 -----------+---------+--------+--------+---------+----+---- Tube | no | no | no | yes | -1 | -1
where len
is length in, rA
is radiusA in, rB
is radiusB in, cA
is capA in and cB
is capB in.
Shape
Builds a 3D shape.
The shape is in the XY-plane, having the normal vector (0,0,1). Texture coordinates are generated in the range (u0 opt, v0 opt) to ( u1 opt, v1 opt), which maps to Box2D.TopLeft resp. Box2D.BottomRight of IShape.Bounds.
The triangles of the 3D shape are obtained by first converting the given shape in to ShapeType.Mesh and then using IShape.TriangleAt.
The lines of the 3D shape are obtained by first converting the given shape in to ShapeType.Graph and then using IShape.EdgeAt.
SphereIco
Builds a sphere by subdividing an icosahedron.
The number of triangle vertices resp. line vertices (see PrimitiveBatch.Count) can be computed from the subdivision count levels in resp. levelsEdges opt as follows:
vertices = 4 ^ levels * 60
The first eight subdivision levels produce the following triangle resp. line vertex counts:
count = 0 : vertices = 60 count = 1 : vertices = 240 count = 2 : vertices = 960 count = 3 : vertices = 3,840 count = 4 : vertices = 15,360 count = 5 : vertices = 61,440 count = 6 : vertices = 245,760 count = 7 : vertices = 983,040
Tube
Builds a tube.
______________ A = (0,0,0) A------------B ______________ B = (0,length,0)
- See also
Wrap
Creates a new instance of ModelGeometry.
The given vertices in object and indices opt array will be referenced by the returned IModelGeometry object, no data is copied.