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

mesh.AdvanceVertex()
Pushes the new vertex data onto the render stack.
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. This function actually does nothing.
mesh.TangentT( Vector tTanger )
Sets the T tangent to be used. This function actually does nothing.
mesh.TexCoord( number stage, number u, number v )
Sets the texture coordinates for the next vertex. Non-zero values of stage require the currently bound material to support it. For example, any LightmappedGeneric material supports stages 1 and 2 (lightmap texture coordinates).
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 ).
number mesh.VertexCount()
Returns the amount of vertex that have yet been pushed.