Py API Docs: GPUBatch documentation

This commit is contained in:
Jacques Lucke 2018-11-13 12:59:50 +01:00
parent de36a2f99b
commit 6ae84ddc6e
1 changed files with 33 additions and 17 deletions

View File

@ -130,7 +130,16 @@ static PyObject *bpygpu_Batch_new(PyTypeObject *UNUSED(type), PyObject *args, Py
}
PyDoc_STRVAR(bpygpu_Batch_vertbuf_add_doc,
"TODO"
".. method:: vertbuf_add(buf)\n"
"\n"
" Add another vertex buffer to the Batch. \n"
" It is not possible to add more vertices to the batch using this method. \n"
" Instead it can be used to add more attributes to the existing vertices. \n"
" A good use case would be when you have a separate vertex buffer for vertex positions and vertex normals. \n"
" Current a batch can have at most " STRINGIFY(GPU_BATCH_VBO_MAX_LEN) " vertex buffers. \n"
"\n"
" :param buf: The vertex buffer that will be added to the batch. \n"
" :type buf: :class:`gpu.types.GPUVertBuf` \n"
);
static PyObject *bpygpu_Batch_vertbuf_add(BPyGPUBatch *self, BPyGPUVertBuf *py_buf)
{
@ -165,7 +174,14 @@ static PyObject *bpygpu_Batch_vertbuf_add(BPyGPUBatch *self, BPyGPUVertBuf *py_b
}
PyDoc_STRVAR(bpygpu_Batch_program_set_doc,
"TODO"
".. method:: program_set(program)\n"
"\n"
" Assign a shader to this batch that will be used for drawing when not overwritten later. \n"
" Note: This method has to be called in the draw context that the batch will be drawn in. \n"
" This function does not need to be called when you always set the shader when calling `batch.draw`. \n"
"\n"
" :param program: The program/shader the batch will use in future draw calls. \n"
" :type program: :class:`gpu.types.GPUShader` \n"
);
static PyObject *bpygpu_Batch_program_set(BPyGPUBatch *self, BPyGPUShader *py_shader)
{
@ -307,21 +323,21 @@ PyDoc_STRVAR(py_gpu_batch_doc,
"Contains VAOs + VBOs + Shader representing a drawable entity."
"\n"
" :param type: One of these primitive types: {\n"
" 'POINTS',\n"
" 'LINES',\n"
" 'TRIS',\n"
" 'LINE_STRIP',\n"
" 'LINE_LOOP',\n"
" 'TRI_STRIP',\n"
" 'TRI_FAN',\n"
" 'LINES_ADJ',\n"
" 'TRIS_ADJ',\n"
" 'LINE_STRIP_ADJ'}\n"
" :type type: `str`\n"
" :param buf: Vertex buffer.\n"
" :type buf: :class: `gpu.types.GPUVertBuf`\n"
" :param elem: Optional Index buffer.\n"
" :type elem: :class: `gpu.types.GPUIndexBuf`\n"
" `POINTS`,\n"
" `LINES`,\n"
" `TRIS`,\n"
" `LINE_STRIP`,\n"
" `LINE_LOOP`,\n"
" `TRI_STRIP`,\n"
" `TRI_FAN`,\n"
" `LINES_ADJ`,\n"
" `TRIS_ADJ`,\n"
" `LINE_STRIP_ADJ` }\n"
" :type type: :class:`str`\n"
" :param buf: Vertex buffer containing all or some of the attributes required for drawing.\n"
" :type buf: :class:`gpu.types.GPUVertBuf`\n"
" :param elem: Optional index buffer.\n"
" :type elem: :class:`gpu.types.GPUIndexBuf`\n"
);
PyTypeObject BPyGPUBatch_Type = {
PyVarObject_HEAD_INIT(NULL, 0)