# Command: AddVertex

AddVertex ( surface,x#,y#,z#[,u#][,v#][,w#] )

Parameters:

surface - surface handle x# - x coordinate of vertex y# - y coordinate of vertex z# - z coordinate of vertex u# (optional) - u texture coordinate of vertex v# (optional) - v texture coordinate of vertex w# (optional) - w texture coordinate of vertex - not used, included for future expansion

Description:

Adds a vertex to the specified surface and returns the vertices' index number, starting from 0.

x,y,z are the geometric coordinates of the vertex, and u,v,w are texture mapping coordinates.

A vertex is a point in 3D space which is used to connect edges of a triangle together. Without any vertices, you can't have any triangles. At least three vertices are needed to create one triangle; one for each corner.

The optional u,v parameters allow you to specify texture coordinates for a vertex, which will determine how any triangle created using those vertices will be texture mapped.

This works on the following basis: the bottom left of an image has the uv coordinates 0,0. The bottom right has coordinates 0,1, top left 0,1 and top right 1,1. Now, depending on what uv coordinate you assign to the vertex, this will represent a point on the image. For example, a coordinate of 0.5,0.5 would represent the centre of the image.

So now imagine you have a normal equilateral triangle. By assigning the bottom left vertex a uv coordinate of 0,0, then bottom right a coordinate of 1,0 and the top centre 0.5,1, this will texture map the triangle with an image that fits it.

Example:

None.

Index