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( IMesh mesh = nil, number primitiveType, number primiteCount )
Starts a new dynamic mesh. If an IMesh is passed, it will use that mesh instead.
mesh.Color( number r, number g, number b, number a )
Sets the color to be used for the next vertex.
mesh.End()
Ends the mesh and renders it.
mesh.Normal( Vector normal )
Sets the normal to be used for the next vertex.
mesh.Position( Vector position )
Sets the position to be used for the next vertex.
mesh.Quad( Vector vertex1, Vector vertex2, Vector vertex3, Vector vertex4 )
Draws a quad using 4 vertices.
mesh.QuadEasy( Vector position, Vector normal, number sizeX, number sizeY )
Draws a quad using a position, a normal and the size.
mesh.Specular( number r, number g, number b, number a )
Sets the specular map values. This function actually does nothing.
mesh.TangentS( Vector sTanger )
Sets the "S" tangent to be used.
mesh.TangentT( Vector tTanger )
Sets the "T" tangent to be used.
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 )
It is recommended to use IMesh:BuildFromTriangles instead of the mesh library. A table of four numbers. This is used by most shaders in Source to hold tangent information of the vertex ( tangentX, tangentY, tangentZ, tangentHandedness ).
Returns the amount of vertices that have been pushed via mesh. AdvanceVertex.