Changeset View
Changeset View
Standalone View
Standalone View
source/blender/python/gpu/gpu_py_batch.c
| Show First 20 Lines • Show All 121 Lines • ▼ Show 20 Lines | |||||
| "\n" | "\n" | ||||
| " Add another vertex buffer to the Batch.\n" | " Add another vertex buffer to the Batch.\n" | ||||
| " It is not possible to add more vertices to the batch using this method.\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" | " 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\n" | " A good use case would be when you have a separate\n" | ||||
| " vertex buffer for vertex positions and vertex normals.\n" | " 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" | " Current a batch can have at most " STRINGIFY(GPU_BATCH_VBO_MAX_LEN) " vertex buffers.\n" | ||||
| "\n" | "\n" | ||||
| " :param buf: The vertex buffer that will be added to the batch.\n" | " :arg buf: The vertex buffer that will be added to the batch.\n" | ||||
| " :type buf: :class:`gpu.types.GPUVertBuf`\n" | " :type buf: :class:`gpu.types.GPUVertBuf`\n" | ||||
| ); | ); | ||||
| static PyObject *pygpu_batch_vertbuf_add(BPyGPUBatch *self, BPyGPUVertBuf *py_buf) | static PyObject *pygpu_batch_vertbuf_add(BPyGPUBatch *self, BPyGPUVertBuf *py_buf) | ||||
| { | { | ||||
| if (!BPyGPUVertBuf_Check(py_buf)) { | if (!BPyGPUVertBuf_Check(py_buf)) { | ||||
| PyErr_Format(PyExc_TypeError, "Expected a GPUVertBuf, got %s", Py_TYPE(py_buf)->tp_name); | PyErr_Format(PyExc_TypeError, "Expected a GPUVertBuf, got %s", Py_TYPE(py_buf)->tp_name); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| Show All 27 Lines | PyDoc_STRVAR( | ||||
| pygpu_batch_program_set_doc, | pygpu_batch_program_set_doc, | ||||
| ".. method:: program_set(program)\n" | ".. method:: program_set(program)\n" | ||||
| "\n" | "\n" | ||||
| " Assign a shader to this batch that will be used for drawing when not overwritten later.\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" | " 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\n" | " This function does not need to be called when you always\n" | ||||
| " set the shader when calling :meth:`gpu.types.GPUBatch.draw`.\n" | " set the shader when calling :meth:`gpu.types.GPUBatch.draw`.\n" | ||||
| "\n" | "\n" | ||||
| " :param program: The program/shader the batch will use in future draw calls.\n" | " :arg program: The program/shader the batch will use in future draw calls.\n" | ||||
| " :type program: :class:`gpu.types.GPUShader`\n"); | " :type program: :class:`gpu.types.GPUShader`\n"); | ||||
| static PyObject *pygpu_batch_program_set(BPyGPUBatch *self, BPyGPUShader *py_shader) | static PyObject *pygpu_batch_program_set(BPyGPUBatch *self, BPyGPUShader *py_shader) | ||||
| { | { | ||||
| if (!BPyGPUShader_Check(py_shader)) { | if (!BPyGPUShader_Check(py_shader)) { | ||||
| PyErr_Format(PyExc_TypeError, "Expected a GPUShader, got %s", Py_TYPE(py_shader)->tp_name); | PyErr_Format(PyExc_TypeError, "Expected a GPUShader, got %s", Py_TYPE(py_shader)->tp_name); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| Show All 21 Lines | #endif | ||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| PyDoc_STRVAR(pygpu_batch_draw_doc, | PyDoc_STRVAR(pygpu_batch_draw_doc, | ||||
| ".. method:: draw(program=None)\n" | ".. method:: draw(program=None)\n" | ||||
| "\n" | "\n" | ||||
| " Run the drawing program with the parameters assigned to the batch.\n" | " Run the drawing program with the parameters assigned to the batch.\n" | ||||
| "\n" | "\n" | ||||
| " :param program: Program that performs the drawing operations.\n" | " :arg program: Program that performs the drawing operations.\n" | ||||
| " If ``None`` is passed, the last program set to this batch will run.\n" | " If ``None`` is passed, the last program set to this batch will run.\n" | ||||
| " :type program: :class:`gpu.types.GPUShader`\n"); | " :type program: :class:`gpu.types.GPUShader`\n"); | ||||
| static PyObject *pygpu_batch_draw(BPyGPUBatch *self, PyObject *args) | static PyObject *pygpu_batch_draw(BPyGPUBatch *self, PyObject *args) | ||||
| { | { | ||||
| BPyGPUShader *py_program = NULL; | BPyGPUShader *py_program = NULL; | ||||
| if (!PyArg_ParseTuple(args, "|O!:GPUBatch.draw", &BPyGPUShader_Type, &py_program)) { | if (!PyArg_ParseTuple(args, "|O!:GPUBatch.draw", &BPyGPUShader_Type, &py_program)) { | ||||
| return NULL; | return NULL; | ||||
| ▲ Show 20 Lines • Show All 127 Lines • Show Last 20 Lines | |||||