mesh
mesh
¶
Meshes: a list of vertices you control, drawn as triangles, a triangle fan,
or a triangle strip, with an optional texture. Build a vertex with
meshVertex, make the mesh with newMesh, and draw it.
MeshDraw
¶
type MeshDraw = enum
How a mesh's vertices form triangles: independent triples, a fan around
the first vertex, or a strip.
Values
-
mdTriangles -
mdFan -
mdStrip
Source:
src/nim2d/mesh.nim:10
Mesh
¶
type Mesh = ref object
A list of vertices you control, drawn as triangles with an optional
texture. Without one the vertex colors show directly, which is how you make gradients.
Fields
-
vertsseq[Vertex] -
textureTexture -
modeMeshDraw
Source:
src/nim2d/mesh.nim:17
meshVertex ¶
proc meshVertex(x, y: float; u = 0.0; v = 0.0; color: Color = (255'u8, 255'u8, 255'u8, 255'u8)): Vertex
A mesh vertex from a position, texture coordinates from 0 to 1, and a
color.
Parameters
-
x(float) -
y(float) -
u(auto) -
v(auto) -
color(Color)
Returns
Vertex
Source:
src/nim2d/mesh.nim:25
newMesh ¶
proc newMesh(verts: seq[Vertex]; mode = mdTriangles; texture: Texture = nil): Mesh
A mesh from vertices built with meshVertex. Pass a texture to map it
across the vertices' texture coordinates.
Parameters
-
verts(seq[Vertex]) -
mode(auto) -
texture(Texture)
Returns
Mesh
Source:
src/nim2d/mesh.nim:41
draw ¶
proc draw(mesh: Mesh; nim2d: Nim2d; x = 0.0; y = 0.0)
Draw the mesh, optionally offset by (x, y), through the current transform.
Parameters
-
mesh(Mesh) -
nim2d(Nim2d) -
x(auto) -
y(auto)
Source:
src/nim2d/mesh.nim:71
Generated with mkdocstrings-nim