# Class: indexarray

meshes contain indices for rendering their primitives, with this interface you can modify them. Always make sure that the corresponding vertices exist and always run indexMinmax once you set all indices. If you use display lists or vbos, changes to a loaded model will not be visible.

## Hierarchy

    o-+ renderinterface
      o-+ indexarray

## Classes that implement this interface:

- l2dimage
- l3dprimitive
- meshid
- rcmddraw2dmesh

## Methods:

### Method overview:

- indexAllocatedcount
- indexCopy
- indexCount
- indexMeshtype
- indexMinmax
- indexPrimitive
- indexPrimitivecount
- indexPrimitivetype
- indexPtrs
- indexTrianglecount
- indexUpdateVBO
- indexValue

indexAllocatedcount (indexarray)
  returns: ([int cnt])
  return indices count. This is the number of indices that can be used in this indexarray, index must always be smaller than this.
indexCopy (indexarray,int start,indexarray from,int fromstart, int size,[int vertexoffset])
  returns: ([int])
  copies indices from one indexarray into self, starting at given index and optionally offsetting the copied.
indexCount (indexarray,[int cnt])
  returns: ([int])
  set or return the number of indices to be used on rendering. This value must always be smaller than Allocatedcount.
indexMeshtype (indexarray)
  returns: ([string])
  returns what type of mesh the indices/vertices are stored in (unset,va,vbo)
indexMinmax (indexarray,[min,max])
  returns: (int min,max)
  computes minimum and maximum index used within indexCount, or you can manually set them. This is required for an indexarray to work, call this after all indices are set.
indexPrimitive (indexarray,primindex,[int a,b,c...])
  returns: ([int a,b,c...])
  set or returns the primitive at given position. The function will return/need 1 index for points, 2 for lines, 3 indices for triangles, 4 indices for quads and can only return indices for any strips/loops/fan. Polygons are not supported, since the whole indexarray always contains only one.
indexPrimitivecount (indexarray)
  returns: ([int])
  returns the number of primitives based on indexCount
indexPrimitivetype (indexarray, [primitivetype])
  returns: ([primitivetype])
  set or return the primitive type.
indexPtrs (indexarray)
  returns: (pointer start,end])
  returns C pointers for begin and end of array. [start,end[
indexTrianglecount (indexarray)
  returns: ([int])
  returns and updates the internal number of triangles based on current indexCount. This is only needed for statistics and should be called at least once after all indices were written.
indexUpdateVBO (indexarray,[int fromidx, toidx])
  returns: (boolean)
  if possible resubmits array using indexAllocatedcount or [from,to] range to VBO, returns true on success else false (no VBO or non compatible indexarray).
indexValue (indexarray,index,[int value])
  returns: ([int value])
  set or returns value at the given index. Make sure the corresponding vertex exists

## Inherited Methods: