public IntBuffer writeIndexArray(IntBuffer store){
        int faceN = (getWidth()-1)*(getHeight()-1)*2;

        if (store!=null){
            if (store.remaining() < faceN*3)
                throw new BufferUnderflowException();
        }else{
            store = BufferUtils.createIntBuffer(faceN*3);
        }

        int i = 0;
        for (int z = 0; z < getHeight()-1; z++){
            for (int x = 0; x < getWidth()-1; x++){
                store.put(i).put(i+getWidth()).put(i+getWidth()+1);
                store.put(i+getWidth()+1).put(i+1).put(i);
                i++;

                // TODO: There's probably a better way to do this..
                if (x==getWidth()-2) i++;
            }
        }
        store.flip();

        return store;
    }
Creates a vertex array from the height data in this Geomap

The scale argument specifies the scale to use for the vertex buffer.
For example, if scale is 10,1,10, then the greatest X value is getWidth()*10

@param store A preallocated FloatBuffer where to store the data (optional), 
size must be &gt;= getWidth()*getHeight()*3
@param scale Created vertexes are scaled by this vector

@return store, or a new FloatBuffer if store is null

@throws NullPointerException If isLoaded() is false
jme3-terrain/src/main/java/com/jme3/terrain/GeoMap.java