|
Blender V4.3
|
#include <Python.h>#include "BLI_utildefines.h"#include "GPU_batch.hh"#include "../generic/py_capi_utils.hh"#include "../generic/python_compat.hh"#include "gpu_py.hh"#include "gpu_py_element.hh"#include "gpu_py_shader.hh"#include "gpu_py_vertex_buffer.hh"#include "gpu_py_batch.hh"Go to the source code of this file.
Functions | |
Utility Functions | |
| static bool | pygpu_batch_is_program_or_error (BPyGPUBatch *self) |
Public API | |
| PyObject * | BPyGPUBatch_CreatePyObject (blender::gpu::Batch *batch) |
GPUBatch Type | |
| static PyMethodDef | pygpu_batch__tp_methods [] |
| PyTypeObject | BPyGPUBatch_Type |
| static PyObject * | pygpu_batch__tp_new (PyTypeObject *, PyObject *args, PyObject *kwds) |
| PyDoc_STRVAR (pygpu_batch_vertbuf_add_doc, ".. 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\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" "\n" " :arg buf: The vertex buffer that will be added to the batch.\n" " :type buf: :class:`gpu.types.GPUVertBuf`\n") | |
| static PyObject * | pygpu_batch_vertbuf_add (BPyGPUBatch *self, BPyGPUVertBuf *py_buf) |
| PyDoc_STRVAR (pygpu_batch_program_set_doc, ".. 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\n" " set the shader when calling :meth:`gpu.types.GPUBatch.draw`.\n" "\n" " :arg program: The program/shader the batch will use in future draw calls.\n" " :type program: :class:`gpu.types.GPUShader`\n") | |
| static PyObject * | pygpu_batch_program_set (BPyGPUBatch *self, BPyGPUShader *py_shader) |
| PyDoc_STRVAR (pygpu_batch_draw_doc, ".. method:: draw(program=None)\n" "\n" " Run the drawing program with the parameters assigned to the batch.\n" "\n" " :arg program: Program that performs the drawing operations.\n" " If ``None`` is passed, the last program set to this batch will run.\n" " :type program: :class:`gpu.types.GPUShader`\n") | |
| static PyObject * | pygpu_batch_draw (BPyGPUBatch *self, PyObject *args) |
| PyDoc_STRVAR (pygpu_batch_draw_instanced_doc, ".. method:: draw_instanced(program, *, instance_start=0, instance_count=0)\n" "\n" " Draw multiple instances of the drawing program with the parameters assigned\n" " to the batch. In the vertex shader, `gl_InstanceID` will contain the instance\n" " number being drawn.\n" "\n" " :arg program: Program that performs the drawing operations.\n" " :type program: :class:`gpu.types.GPUShader`\n" " :arg instance_start: Number of the first instance to draw.\n" " :type instance_start: int\n" " :arg instance_count: Number of instances to draw. When not provided or set to 0\n" " the number of instances will be determined by the number of rows in the first\n" " vertex buffer.\n" " :type instance_count: int\n") | |
| static PyObject * | pygpu_batch_draw_instanced (BPyGPUBatch *self, PyObject *args, PyObject *kw) |
| PyDoc_STRVAR (pygpu_batch_draw_range_doc, ".. method:: draw_range(program, *, elem_start=0, elem_count=0)\n" "\n" " Run the drawing program with the parameters assigned to the batch. " "Only draw the ``elem_count`` elements of the index buffer starting at ``elem_start``.\n" "\n" " :arg program: Program that performs the drawing operations.\n" " :type program: :class:`gpu.types.GPUShader`\n" " :arg elem_start: First index to draw. When not provided or set to 0 drawing\n" " will start from the first element of the index buffer.\n" " :type elem_start: int\n" " :arg elem_count: Number of elements of the index buffer to draw. When not\n" " provided or set to 0 all elements from ``elem_start`` to the end of the\n" " index buffer will be drawn.\n" " :type elem_count: int\n") | |
| static PyObject * | pygpu_batch_draw_range (BPyGPUBatch *self, PyObject *args, PyObject *kw) |
| static PyObject * | pygpu_batch_program_use_begin (BPyGPUBatch *self) |
| static PyObject * | pygpu_batch_program_use_end (BPyGPUBatch *self) |
| static int | pygpu_batch__tp_traverse (BPyGPUBatch *self, visitproc visit, void *arg) |
| static int | pygpu_batch__tp_clear (BPyGPUBatch *self) |
| static int | pygpu_batch__tp_is_gc (BPyGPUBatch *self) |
| static void | pygpu_batch__tp_dealloc (BPyGPUBatch *self) |
| PyDoc_STRVAR (pygpu_batch__tp_doc, ".. class:: GPUBatch(type, buf, elem=None)\n" "\n" " Reusable container for drawable geometry.\n" "\n" " :arg type: The primitive type of geometry to be drawn.\n" " Possible values are `POINTS`, `LINES`, `TRIS`, `LINE_STRIP`, `LINE_LOOP`, `TRI_STRIP`, " "`TRI_FAN`, `LINES_ADJ`, `TRIS_ADJ` and `LINE_STRIP_ADJ`.\n" " :type type: str\n" " :arg buf: Vertex buffer containing all or some of the attributes required for drawing.\n" " :type buf: :class:`gpu.types.GPUVertBuf`\n" " :arg elem: An optional index buffer.\n" " :type elem: :class:`gpu.types.GPUIndexBuf`\n") | |
This file defines the off-screen functionalities of the 'gpu' module used for off-screen OpenGL rendering.
bpygpu_ for local API.BPyGPU for public API. Definition in file gpu_py_batch.cc.
| PyObject * BPyGPUBatch_CreatePyObject | ( | blender::gpu::Batch * | batch | ) |
Definition at line 529 of file gpu_py_batch.cc.
References batch, BPyGPUBatch_Type, BPyGPUBatch::references, and self.
Referenced by pygpu_batch__tp_new().
| PyDoc_STRVAR | ( | pygpu_batch__tp_doc | , |
| ".. class:: GPUBatch(type, buf, elem=None)\n" "\n" " Reusable container for drawable geometry.\n" "\n" " :arg type: The primitive type of geometry to be drawn.\n" " Possible values are `POINTS` | , | ||
| `LINES` | , | ||
| `TRIS` | , | ||
| `LINE_STRIP` | , | ||
| `LINE_LOOP` | , | ||
| `TRI_STRIP` | , | ||
| " "`TRI_FAN` | , | ||
| `LINES_ADJ` | , | ||
| `TRIS_ADJ` and `LINE_STRIP_ADJ`.\n" " :type type:str\n" " :arg buf:Vertex buffer containing all or some of the attributes required for drawing.\n" " :type buf::class:`gpu.types.GPUVertBuf`\n" " :arg elem:An optional index buffer.\n" " :type elem::class:`gpu.types.GPUIndexBuf`\n" | ) |
| PyDoc_STRVAR | ( | pygpu_batch_draw_doc | , |
| ".. method:: draw(program=None)\n" "\n" " Run the drawing program with the parameters assigned to the batch.\n" "\n" " :arg program: Program that performs the drawing operations.\n" " If ``None`` is | passed, | ||
| the last program set to this batch will run.\n" " :type program::class:`gpu.types.GPUShader`\n" | ) |
| PyDoc_STRVAR | ( | pygpu_batch_draw_instanced_doc | , |
| ".. method:: draw_instanced(program, *, instance_start=0, instance_count=0)\n" "\n" " Draw multiple instances of the drawing program with the parameters assigned\n" " to the batch. In the vertex | shader, | ||
| `gl_InstanceID` will contain the instance\n" " number being drawn.\n" "\n" " :arg program:Program that performs the drawing operations.\n" " :type program::class:`gpu.types.GPUShader`\n" " :arg instance_start:Number of the first instance to draw.\n" " :type instance_start:int\n" " :arg instance_count:Number of instances to draw. When not provided or set to 0\n" " the number of instances will be determined by the number of rows in the first\n" " vertex buffer.\n" " :type instance_count:int\n" | ) |
| PyDoc_STRVAR | ( | pygpu_batch_draw_range_doc | , |
| ".. method:: draw_range(program, *, elem_start=0, elem_count=0)\n" "\n" " Run the drawing program with the parameters assigned to the batch. " "Only draw the ``elem_count`` elements of the index buffer starting at ``elem_start``.\n" "\n" " :arg program: Program that performs the drawing operations.\n" " :type program: :class:`gpu.types.GPUShader`\n" " :arg elem_start: First index to draw. When not provided or set to 0 drawing\n" " will start from the first element of the index buffer.\n" " :type elem_start: int\n" " :arg elem_count: Number of elements of the index buffer to draw. When not\n" " provided or set to 0 all elements from ``elem_start`` to the end of the\n" " index buffer will be drawn.\n" " :type elem_count: int\n" | ) |
| PyDoc_STRVAR | ( | pygpu_batch_program_set_doc | , |
| ".. 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\n" " set the shader when calling :meth:`gpu.types.GPUBatch.draw`.\n" "\n" " :arg program: The program/shader the batch will use in future draw calls.\n" " :type program: :class:`gpu.types.GPUShader`\n" | ) |
| PyDoc_STRVAR | ( | pygpu_batch_vertbuf_add_doc | , |
| ".. 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\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" "\n" " :arg buf: The vertex buffer that will be added to the batch.\n" " :type buf: :class:`gpu.types.GPUVertBuf`\n" | ) |
|
static |
Definition at line 412 of file gpu_py_batch.cc.
References self.
Referenced by pygpu_batch__tp_dealloc().
|
static |
Definition at line 425 of file gpu_py_batch.cc.
References GPU_batch_discard(), pygpu_batch__tp_clear(), and self.
|
static |
Definition at line 418 of file gpu_py_batch.cc.
References self.
|
static |
Definition at line 50 of file gpu_py_batch.cc.
References batch, BLI_assert, BPYGPU_IS_INIT_OR_ERROR_OBJ, bpygpu_primtype_items, BPyGPUBatch_CreatePyObject(), BPyGPUIndexBuf_Type, BPyGPUVertBuf_Type, BPyGPUVertBuf::buf, BPyGPUIndexBuf::elem, GPU_batch_create, GPU_PRIM_LINE_LOOP, GPU_PRIM_NONE, GPU_PRIM_TRI_FAN, PY_ARG_PARSER_HEAD_COMPAT, PyC_ParseStringEnum(), BPyGPUBatch::references, ret, and PyC_StringEnum::value_found.
|
static |
Definition at line 406 of file gpu_py_batch.cc.
References self.
|
static |
Definition at line 237 of file gpu_py_batch.cc.
References BPyGPUShader_Type, GPU_batch_draw(), GPU_batch_set_shader(), pygpu_batch_is_program_or_error(), self, and BPyGPUShader::shader.
|
static |
Definition at line 287 of file gpu_py_batch.cc.
References BPyGPUShader_Type, GPU_batch_draw_instance_range(), GPU_batch_set_shader(), PY_ARG_PARSER_HEAD_COMPAT, self, and BPyGPUShader::shader.
|
static |
Definition at line 332 of file gpu_py_batch.cc.
References BPyGPUShader_Type, GPU_batch_draw_range(), GPU_batch_set_shader(), PY_ARG_PARSER_HEAD_COMPAT, self, and BPyGPUShader::shader.
|
static |
Definition at line 35 of file gpu_py_batch.cc.
References self.
Referenced by pygpu_batch_draw(), pygpu_batch_program_use_begin(), and pygpu_batch_program_use_end().
|
static |
Definition at line 184 of file gpu_py_batch.cc.
References BPyGPUShader_Check, GPU_batch_set_shader(), self, and BPyGPUShader::shader.
|
static |
Definition at line 360 of file gpu_py_batch.cc.
References GPU_shader_bind(), pygpu_batch_is_program_or_error(), and self.
|
static |
Definition at line 369 of file gpu_py_batch.cc.
References GPU_shader_unbind(), pygpu_batch_is_program_or_error(), and self.
|
static |
Definition at line 140 of file gpu_py_batch.cc.
References BPyGPUVertBuf_Check, BPyGPUVertBuf::buf, GPU_BATCH_VBO_MAX_LEN, GPU_batch_vertbuf_add(), GPU_vertbuf_get_vertex_len(), self, and STRINGIFY.
| PyTypeObject BPyGPUBatch_Type |
Definition at line 455 of file gpu_py_batch.cc.
Referenced by bpygpu_types_init(), and BPyGPUBatch_CreatePyObject().
|
static |
Definition at line 383 of file gpu_py_batch.cc.