Garry's Mod Wiki

mesh

The mesh library allows you to create meshes. A mesh is a set of vertices that define a 3D shape, for constant meshes you should use the IMesh object instead.

Methods

Pushes the currently set vertex data (via other mesh. * functions) into the mesh stack. See example on mesh. Begin.
mesh.Begin( number primitiveType, number primitiveCount )
Starts constructing a new 3D mesh constructed from a given number of primitives in a given primitive format. The resulting mesh can be stored in an IMesh if it is intended to be drawn multiple times or on multiple frames.
mesh.Color( number r, number g, number b, number a )
Sets the color to be used for the next vertex. See mesh. Begin.
mesh.End()
Ends the mesh (Started with mesh. Begin) and renders it.
mesh.Normal( Vector normal ) (+ 1 overload)
Sets the normal to be used for the next vertex. See mesh. Begin.
mesh.Position( Vector position ) (+ 1 overloads)
Sets the position to be used for the next vertex. See mesh. Begin.
mesh.Quad( Vector vertex1, Vector vertex2, Vector vertex3, Vector vertex4, table color )
Adds a quad (4 vertices) to the currently built mesh. See mesh. Begin.
mesh.QuadEasy( Vector position, Vector normal, number sizeX, number sizeY, table color )
Adds a quad (4 vertices) to the currently built mesh, by using position, normal and sizes. See mesh. Begin. See also mesh. Quad.
mesh.Specular( number r, number g, number b, number a )
Sets the specular map values. There is no known use case for this function.
mesh.TangentS( Vector tangentS )
Sets the S tangent to be used, also known as "binormal". Tangents and binormals are using in bumpmap rendering. See also mesh. TangentT and mesh. Begin.
mesh.TangentT( Vector tangentT )
Sets the T tangent to be used. Tangents and binormals are using in bumpmap rendering. See also mesh. TangentS and mesh. Begin.
mesh.TexCoord( number set, number u, number v )
Sets the texture coordinates for the next vertex.
mesh.UserData( number tangentX, number tangentY, number tangentZ, number tangentHandedness )
A set of four numbers that can be used for arbitrary purposes by Material shaders. This is most commonly used to provide tangent information about each vertex to the Material's shader.
Returns the amount of vertices that have been pushed via mesh. AdvanceVertex.