From 6ae84ddc6e7c40d89896c3c5a4f7c67dceb586d5 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Tue, 13 Nov 2018 12:59:50 +0100 Subject: Py API Docs: GPUBatch documentation --- source/blender/python/gpu/gpu_py_batch.c | 50 +++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/source/blender/python/gpu/gpu_py_batch.c b/source/blender/python/gpu/gpu_py_batch.c index b3bdf663621..add813dd928 100644 --- a/source/blender/python/gpu/gpu_py_batch.c +++ b/source/blender/python/gpu/gpu_py_batch.c @@ -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) -- cgit v1.2.3