Garry's Mod Wiki

MeshVertex

Description

A table structure representing the data stored by a single vertex of a mesh.

MeshVertex structures are usually grouped together in sets of 3 to define the corners of a triangle.

Not all MeshVertex will contain all fields and not all fields are used by all shaders

Information on the fields used by most Source Engine shaders (Like VertexLitGeneric, UnlitGeneric, etc.) can be found on the Valve Developer Wiki here.

Returned by:

Used by:

Members

Color color
The Color that the area around this corner of a triangle should be tinted.
Vector normal
A normalized Vector representing a direction facing away from (perpendicular to) the surface of the triangle that this vertex is a part of.

Many shaders use this to calculate lighting.

Vector tangent
A normalized Vector representing a direction facing along (parallel with) the surface of the triangle that this vertex is a part of.
Vector binormal
A normalized Vector representing a direction facing away from (perpendicular to) both the vertex's normal and tangent directions.

This is the result of a Cross Product between the vertex's normal and tangent directions.

Vector pos
The position of the vertex in local space.
number u
The horizontal coordinate of a position on the texture of the triangle that this vertex is a part of.
This controls which part of the texture is drawn at this vertex.

In the range 0 (the texture's left edge) to 1 (the texture's right edge)

number v
The vertical coordinate of a position on the texture of the triangle that this vertex is a part of.
This controls which part of the texture is drawn at this vertex.

In the range 0 (the texture's top edge) to 1 (the texture's bottom edge)

number u1
A secondary U texture coordinate used by some shaders like LightmappedGeneric.

Currently used exclusively by IMesh:BuildFromTriangles.

number v1
A secondary V texture coordinate used by some shaders like LightmappedGeneric.

Currently used exclusively by IMesh:BuildFromTriangles.

table userdata
A sequential table of four numbers whose purpose and expected values are determined by the shader.

Many Source Engine shaders to hold tangent information of the vertex in the order tangentX, tangentY, tangentZ, tangentHandedness.

table weights
A sequential table of all the BoneWeight structures that affect this vertex.

The total sum of their weight values should be 1

Current added exclusively by util.GetModelMeshes