# Class: vertexarray

meshes, l3dmodels (morphable or compiled) or l2dimage usermeshes contain vertices you can modify.This interface allows access to it. For models this only has effect if they are not rendered via display list, nor vbo, else those need to be updated as well.

## Hierarchy

    o-+ renderinterface
      o-+ vertexarray

## Classes that implement this interface:

- l2dimage
- l3dprimitive
- meshid
- rcmddrawmesh
- rendermesh

## Methods:

### Method overview:

- indexMeshtype
- indexType
- indexVidbuffer
- newfromptrs
- vertexAllocState
- vertexAllocatedcount
- vertexBBox
- vertexColor
- vertexColorTris
- vertexColorarray
- vertexCopy
- vertexCount
- vertexFromVBO
- vertexInverttexcoord
- vertexMeshtype
- vertexNormal
- vertexNormalTris
- vertexNormalarray
- vertexPos
- vertexPos2texcoord
- vertexPosTris
- vertexPosarray
- vertexPtrs
- vertexTexcoord
- vertexTexcoordTris
- vertexTexcoordtransform
- vertexTransform
- vertexType
- vertexUpdateVBO
- vertexVidbuffer

indexMeshtype (indexarray)
  returns: ([meshtype])
  returns what type of mesh the indices/vertices are stored for display.
indexType (vertexarray)
  returns: (scalartype)
  returns the scalartype of the indices.
indexVidbuffer (vertexarray)
  returns: ([vidbuffer,int ibooffset])
  if stored as VBO returns vidbuffer and offset bytes.
newfromptrs (vertextype,pointer begin,end)
  returns: (vertexarray)
  creates a vertexarray handle from the pointers. Make sure they stay valid as long as you use the handle.
vertexAllocState (vertexarray,[boolean])
  returns: ([boolean])
  can create or remove the local data copy of the vertices. Only allowed if mesh is a VBO usermesh.
vertexAllocatedcount (vertexarray)
  returns: ([int cnt])
  return vertex allocated count. This is the number of vertices that can be used in this vertexarray, index must always be smaller than this.
vertexBBox (vertexarray)
  returns: (float minx,miny,minz,maxx,maxy,maxz)
  gets bounding box of vertices
vertexColor (vertexarray, int index,[float r,g,b,a])
  returns: ([float r,g,b,a])
  set or return color
vertexColorTris (vertexarray, int a, int b, int c, float ba, float ca)
  returns: ([float r,g,b,a])
  returns interpolated color for given triangle indices, using the barycentric coordinates.
vertexColorarray (vertexarray,[floatarray])
  returns: ([floatarray])
  returns or sets vertex colors from given array (4 times the size of vertexAllocatedcount).
vertexCopy (vertexarray, int start, vertexarray from,int fromstart, int size, [matrix4x4])
  returns: ()
  copies vertices from other vertexarray, optionally with transfrom matrix.
vertexCount (vertexarray, [int cnt])
  returns: ([int cnt])
  set or return vertex count. This count is used for statistics and for optimizing, it can be smaller than allocated count and should be equal to the last vertex you use. Morphable l3dmodels will not allow setting it.
vertexFromVBO (vertexarray,[int fromidx, count])
  returns: (boolean)
  if possible retrieves array using vertexAllocatedcount or [from,to] range from VBO, returns true on success else false (no VBO or non compatible vertexarray).
vertexInverttexcoord (vertexarray, boolean y,[int texchannel 0-3])
  returns: ()
  inverts y (or x) coordinates of texcoord channel for all vertices by doing 1.0f-coord.
vertexMeshtype (vertexarray)
  returns: ([meshtype])
  returns what type of mesh the indices/vertices are stored for display.
vertexNormal (vertexarray, int index,[matrix4x4],[float x,y,z])
  returns: ([float x,y,z])
  set or return normal, some vertexarrays do not have normals
vertexNormalTris (vertexarray, int a, int b, int c, float ba, float ca)
  returns: ([float x,y,z])
  returns interpolated normal for given triangle indices, using the barycentric coordinates.
vertexNormalarray (vertexarray,[floatarray])
  returns: ([floatarray])
  returns or sets vertex position from given array (3 times the size of vertexAllocatedcount).
vertexPos (vertexarray, int index,[matrix4x4],[float x,y,z])
  returns: ([float x,y,z])
  set or return position. Transformed with by matrix if given.
vertexPos2texcoord (vertexarray,[float planex,y,z], [int texchannel 0-3])
  returns: ()
  copy xy coordinates from positions to texcoord channel for all vertices, or project them on given plane normal.
vertexPosTris (vertexarray, int a, int b, int c, float ba, float ca)
  returns: ([float x,y,z])
  returns interpolated position for given triangle indices, using the barycentric coordinates.
vertexPosarray (vertexarray,[floatarray])
  returns: ([floatarray])
  returns or sets vertex position from given array (3 times the size of vertexAllocatedcount).
vertexPtrs (vertexarray)
  returns: (pointer start,end])
  returns C pointers for begin and end of array.
vertexTexcoord (vertexarray, int index,[float u,v],[int texchannel 0-3])
  returns: ([float u,v])
  set or return texture coordinates for given channel. All vertices have 1 channel, without normals 2 and bigvertex 4. channel 0 is used for textures, channel 1 is used for lightmaps.
vertexTexcoordTris (vertexarray, int a, int b, int c, float ba, float ca,[int texchannel 0-3])
  returns: ([float u,v])
  returns texture coordinates for given triangle indices, using the barycentric coordinates.
vertexTexcoordtransform (vertexarray, matrix4x4,[int texchannel 0-3])
  returns: ()
  transforms texcoords by given matrix
vertexTransform (vertexarray, matrix4x4)
  returns: ()
  transform all vertices with given matrix
vertexType (vertexarray)
  returns: (vertextype)
  returns the vertextype.
vertexUpdateVBO (vertexarray,[int fromidx, count])
  returns: (boolean)
  if possible submits array using vertexAllocatedcount or [from,to] range to VBO, returns true on success else false (no VBO or non compatible vertexarray).
vertexVidbuffer (vertexarray)
  returns: ([vidbuffer,int vbooffset])
  if stored as VBO returns vidbuffer and offset bytes.

## Inherited Methods: