|
MeshFactoryCreateExtrudedMesh(Vector2, Int32, Vector2, Boolean, Boolean, Boolean, Vector3, Vector3, Vector3, Vector3, MeshFactoryExtrudeTextureCoordinatesGenerationType, Boolean, Boolean, String) Method |
Generate a mesh extruded from multiple 2D shapes.
The base surface is defined by sequence of positions and
triangle indices, and is extruded in the direction of the extrudeVector. The texture coordinates are generated
according to the textureCoordinatesGenerationType parameter.
Namespace: Ab4d.SharpEngine.MeshesAssembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 2.0.8956+4c7684e186ca1be74e7a284fbe739d9a1b843d3c
Syntax public static StandardMesh CreateExtrudedMesh(
Vector2[] triangulatedPositions,
int[]? triangleIndices,
Vector2[][]? allPolygons,
bool isSmooth,
bool isYAxisUp,
bool flipNormals,
Vector3 modelOffset,
Vector3 extrudeVector,
Vector3 shapeXVector,
Vector3 shapeYVector,
MeshFactoryExtrudeTextureCoordinatesGenerationType textureCoordinatesGenerationType = MeshFactoryExtrudeTextureCoordinatesGenerationType.Cylindrical,
bool closeBottom = true,
bool closeTop = true,
string? name = null
)
Parameters
- triangulatedPositions Vector2
- Array of 2D positions that was generated by the Triangulator from allPolygons.
- triangleIndices Int32
- Array of indices that was generated by the Triangulator from allPolygons.
- allPolygons Vector2
- The original 2D positions that define the outer polygons and holes.
- isSmooth Boolean
- If true, the mesh appears smooth, otherwise the edges are sharp.
- isYAxisUp Boolean
- When false (by default), then the Y axis in the 2D coordinate system is pointing down - (0,0) is the top-left position; true if Y axis is pointing up.
- flipNormals Boolean
- Flip the normals. Use when triangles are defined in counter-clockwise direction.
- modelOffset Vector3
- A 3D vector defining the offset of the model. This offset is applied to each position.
- extrudeVector Vector3
- A 3D vector that defines the extrusion, i.e., the direction and the distance between the bottom and top surface.
- shapeXVector Vector3
- A 3D vector that defined the 3D direction along the 2D shape X axis.
- shapeYVector Vector3
- A 3D vector that defines the 3D direction along the 2D shape Y axis.
- textureCoordinatesGenerationType MeshFactoryExtrudeTextureCoordinatesGenerationType (Optional)
- Type of texture coordinate generation. By default, cylindrical projection is used.
- closeBottom Boolean (Optional)
- Close the bottom surface of the mesh (true by default).
- closeTop Boolean (Optional)
- Close the top surface of the mesh (true by default).
- name String (Optional)
- Mesh name (for debug purposes).
Return Value
StandardMeshStandardMesh with filled vertices array and index array.
Exceptions Exception | Condition |
---|
ArgumentException | Thrown when fewer than 3 positions are given. |
Exception | Thrown when extrudeVector and shapeYVector are parallel or close to parallel. |
See Also