int AddLayerVertex(vect3d v,float tu,float tv,DWORD color)

v: Coordinates in pixel of screen. And the Z [0..1] is the depth.

tu,tv: U,V texture coordinates. The texture area is [0..1], but you can tile it [-8192..8192].

color: Color of vertex in dxColor format.

 

Result:

If it was not successfull, it is -1.

If it was succesfull, so it is the vertex index in layer buffer.