|
Blender V4.3
|
#include <Python.h>#include "BLI_string.h"#include "BLI_utildefines.h"#include "BKE_global.hh"#include "BKE_lib_id.hh"#include "BKE_scene.hh"#include "DNA_view3d_types.h"#include "GPU_context.hh"#include "GPU_framebuffer.hh"#include "GPU_texture.hh"#include "GPU_viewport.hh"#include "ED_view3d_offscreen.hh"#include "../mathutils/mathutils.hh"#include "../generic/py_capi_utils.hh"#include "../generic/python_compat.hh"#include "gpu_py.hh"#include "gpu_py_texture.hh"#include "gpu_py_offscreen.hh"Go to the source code of this file.
Classes | |
| struct | OffScreenStackContext |
Macros | |
| #define | BPYGPU_USE_GPUOBJ_FREE_METHOD |
Functions | |
Public API | |
| PyObject * | BPyGPUOffScreen_CreatePyObject (GPUOffScreen *ofs) |
GPUOffScreen Common Utilities | |
| #define | BPY_GPU_OFFSCREEN_CHECK_OBJ(bpygpu) |
| static const PyC_StringEnumItems | pygpu_framebuffer_color_texture_formats [] |
| static int | pygpu_offscreen_valid_check (BPyGPUOffScreen *py_ofs) |
Stack (Context Manager) | |
Safer alternative to ensure balanced push/pop calls. | |
| static PyMethodDef | pygpu_offscreen_stack_context__tp_methods [] |
| static PyTypeObject | PyGPUOffscreenStackContext_Type |
| static void | pygpu_offscreen_stack_context__tp_dealloc (OffScreenStackContext *self) |
| static PyObject * | pygpu_offscreen_stack_context_enter (OffScreenStackContext *self) |
| static PyObject * | pygpu_offscreen_stack_context_exit (OffScreenStackContext *self, PyObject *) |
| PyDoc_STRVAR (pygpu_offscreen_bind_doc, ".. function:: bind()\n" "\n" " Context manager to ensure balanced bind calls, even in the case of an error.\n") | |
| static PyObject * | pygpu_offscreen_bind (BPyGPUOffScreen *self) |
| PyDoc_STRVAR (pygpu_offscreen_unbind_doc, ".. method:: unbind(restore=True)\n" "\n" " Unbind the offscreen object.\n" "\n" " :arg restore: Restore the OpenGL state, can only be used when the state has been " "saved before.\n" " :type restore: bool\n") | |
| static PyObject * | pygpu_offscreen_unbind (BPyGPUOffScreen *self, PyObject *args, PyObject *kwds) |
GPUOffscreen Type | |
| static PyGetSetDef | pygpu_offscreen__tp_getseters [] |
| static PyMethodDef | pygpu_offscreen__tp_methods [] |
| PyTypeObject | BPyGPUOffScreen_Type |
| static PyObject * | pygpu_offscreen__tp_new (PyTypeObject *, PyObject *args, PyObject *kwds) |
| PyDoc_STRVAR (pygpu_offscreen_width_doc, "Width of the texture.\n" "\n" ":type: int") | |
| static PyObject * | pygpu_offscreen_width_get (BPyGPUOffScreen *self, void *) |
| PyDoc_STRVAR (pygpu_offscreen_height_doc, "Height of the texture.\n" "\n" ":type: int") | |
| static PyObject * | pygpu_offscreen_height_get (BPyGPUOffScreen *self, void *) |
| PyDoc_STRVAR (pygpu_offscreen_color_texture_doc, "OpenGL bindcode for the color texture.\n" "\n" ":type: int") | |
| static PyObject * | pygpu_offscreen_color_texture_get (BPyGPUOffScreen *self, void *) |
| PyDoc_STRVAR (pygpu_offscreen_texture_color_doc, "The color texture attached.\n" "\n" ":type: :class:`gpu.types.GPUTexture`") | |
| static PyObject * | pygpu_offscreen_texture_color_get (BPyGPUOffScreen *self, void *) |
| PyDoc_STRVAR (pygpu_offscreen_draw_view3d_doc, ".. method:: draw_view3d(scene, view_layer, view3d, region, view_matrix, projection_matrix, " "do_color_management=False, draw_background=True)\n" "\n" " Draw the 3d viewport in the offscreen object.\n" "\n" " :arg scene: Scene to draw.\n" " :type scene: :class:`bpy.types.Scene`\n" " :arg view_layer: View layer to draw.\n" " :type view_layer: :class:`bpy.types.ViewLayer`\n" " :arg view3d: 3D View to get the drawing settings from.\n" " :type view3d: :class:`bpy.types.SpaceView3D`\n" " :arg region: Region of the 3D View (required as temporary draw target).\n" " :type region: :class:`bpy.types.Region`\n" " :arg view_matrix: View Matrix (e.g. ``camera.matrix_world.inverted()``).\n" " :type view_matrix: :class:`mathutils.Matrix`\n" " :arg projection_matrix: Projection Matrix (e.g. ``camera.calc_matrix_camera(...)``).\n" " :type projection_matrix: :class:`mathutils.Matrix`\n" " :arg do_color_management: Color manage the output.\n" " :type do_color_management: bool\n" " :arg draw_background: Draw background.\n" " :type draw_background: bool\n") | |
| static PyObject * | pygpu_offscreen_draw_view3d (BPyGPUOffScreen *self, PyObject *args, PyObject *kwds) |
| PyDoc_STRVAR (pygpu_offscreen_free_doc, ".. method:: free()\n" "\n" " Free the offscreen object.\n" " The framebuffer, texture and render objects will no longer be accessible.\n") | |
| static PyObject * | pygpu_offscreen_free (BPyGPUOffScreen *self) |
| static void | BPyGPUOffScreen__tp_dealloc (BPyGPUOffScreen *self) |
| PyDoc_STRVAR (pygpu_offscreen__tp_doc, ".. class:: GPUOffScreen(width, height, *, format='RGBA8')\n" "\n" " This object gives access to off screen buffers.\n" "\n" " :arg width: Horizontal dimension of the buffer.\n" " :type width: int\n" " :arg height: Vertical dimension of the buffer.\n" " :type height: int\n" " :arg format: Internal data format inside GPU memory for color attachment " "texture. Possible values are:\n" " `RGBA8`,\n" " `RGBA16`,\n" " `RGBA16F`,\n" " `RGBA32F`,\n" " :type format: str\n") | |
This file defines the offscreen functionalities of the 'gpu' module used for off-screen OpenGL rendering.
bpygpu_ for local API.BPyGPU for public API. Definition in file gpu_py_offscreen.cc.
| #define BPY_GPU_OFFSCREEN_CHECK_OBJ | ( | bpygpu | ) |
Definition at line 73 of file gpu_py_offscreen.cc.
Referenced by pygpu_offscreen_color_texture_get(), pygpu_offscreen_draw_view3d(), pygpu_offscreen_free(), pygpu_offscreen_height_get(), pygpu_offscreen_stack_context_enter(), pygpu_offscreen_stack_context_exit(), pygpu_offscreen_texture_color_get(), pygpu_offscreen_unbind(), and pygpu_offscreen_width_get().
| #define BPYGPU_USE_GPUOBJ_FREE_METHOD |
Definition at line 44 of file gpu_py_offscreen.cc.
Referenced by pygpu_offscreen_valid_check(), pygpu_texture_valid_check(), and pygpu_uniformbuffer_valid_check().
|
static |
Definition at line 536 of file gpu_py_offscreen.cc.
References GPU_offscreen_free(), GPU_viewport_free(), and self.
| PyObject * BPyGPUOffScreen_CreatePyObject | ( | GPUOffScreen * | ofs | ) |
Definition at line 672 of file gpu_py_offscreen.cc.
References BPyGPUOffScreen_Type, and self.
Referenced by pygpu_offscreen__tp_new().
| PyDoc_STRVAR | ( | pygpu_offscreen__tp_doc | , |
| ".. class:: GPUOffScreen(width, height, *, format='RGBA8')\n" "\n" " This object gives access to off screen buffers.\n" "\n" " :arg width: Horizontal dimension of the buffer.\n" " :type width: int\n" " :arg height: Vertical dimension of the buffer.\n" " :type height: int\n" " :arg format: Internal data format inside GPU memory for color attachment " "texture. Possible values are:\n" " `RGBA8` | , | ||
| \n" " `RGBA16` | , | ||
| \n" " `RGBA16F` | , | ||
| \n" " `RGBA32F` | , | ||
| \n" " :type format:str\n" | ) |
| PyDoc_STRVAR | ( | pygpu_offscreen_bind_doc | , |
| ".. function:: bind()\n" "\n" " Context manager to ensure balanced bind | calls, | ||
| even in the case of an error.\n" | ) |
| PyDoc_STRVAR | ( | pygpu_offscreen_color_texture_doc | , |
| "OpenGL bindcode for the color texture.\n" "\n" ":type: int" | ) |
| PyDoc_STRVAR | ( | pygpu_offscreen_draw_view3d_doc | , |
| ".. method:: draw_view3d(scene, view_layer, view3d, region, view_matrix, projection_matrix, " "do_color_management=False, draw_background=True)\n" "\n" " Draw the 3d viewport in the offscreen object.\n" "\n" " :arg scene: Scene to draw.\n" " :type scene: :class:`bpy.types.Scene`\n" " :arg view_layer: View layer to draw.\n" " :type view_layer: :class:`bpy.types.ViewLayer`\n" " :arg view3d: 3D View to get the drawing settings from.\n" " :type view3d: :class:`bpy.types.SpaceView3D`\n" " :arg region: Region of the 3D View (required as temporary draw target).\n" " :type region: :class:`bpy.types.Region`\n" " :arg view_matrix: View Matrix (e.g. ``camera.matrix_world.inverted()``).\n" " :type view_matrix: :class:`mathutils.Matrix`\n" " :arg projection_matrix: Projection Matrix (e.g. ``camera.calc_matrix_camera(...)``).\n" " :type projection_matrix: :class:`mathutils.Matrix`\n" " :arg do_color_management: Color manage the output.\n" " :type do_color_management: bool\n" " :arg draw_background: Draw background.\n" " :type draw_background: bool\n" | ) |
| PyDoc_STRVAR | ( | pygpu_offscreen_free_doc | , |
| ".. method:: free()\n" "\n" " Free the offscreen object.\n" " The | framebuffer, | ||
| texture and render objects will no longer be accessible.\n" | ) |
| PyDoc_STRVAR | ( | pygpu_offscreen_height_doc | , |
| "Height of the texture.\n" "\n" ":type: int" | ) |
| PyDoc_STRVAR | ( | pygpu_offscreen_texture_color_doc | , |
| "The color texture attached.\n" "\n" ":type: :class:`gpu.types.GPUTexture`" | ) |
| PyDoc_STRVAR | ( | pygpu_offscreen_unbind_doc | , |
| ".. method:: unbind(restore=True)\n" "\n" " Unbind the offscreen object.\n" "\n" " :arg restore: Restore the OpenGL | state, | ||
| can only be used when the state has been " "saved before.\n" " :type restore:bool\n" | ) |
| PyDoc_STRVAR | ( | pygpu_offscreen_width_doc | , |
| "Width of the texture.\n" "\n" ":type: int" | ) |
|
static |
Definition at line 272 of file gpu_py_offscreen.cc.
References BPYGPU_IS_INIT_OR_ERROR_OBJ, BPyGPUOffScreen_CreatePyObject(), GPU_context_active_get(), GPU_offscreen_create(), GPU_RGBA8, GPU_TEXTURE_USAGE_HOST_READ, GPU_TEXTURE_USAGE_SHADER_READ, PY_ARG_PARSER_HEAD_COMPAT, PyC_ParseStringEnum(), pygpu_framebuffer_color_texture_formats, STRNCPY, and PyC_StringEnum::value_found.
|
static |
Definition at line 217 of file gpu_py_offscreen.cc.
References pygpu_offscreen_stack_context_enter(), PyGPUOffscreenStackContext_Type, ret, and self.
|
static |
Definition at line 350 of file gpu_py_offscreen.cc.
References BPY_GPU_OFFSCREEN_CHECK_OBJ, GPU_offscreen_color_texture(), GPU_texture_opengl_bindcode(), and self.
|
static |
Definition at line 394 of file gpu_py_offscreen.cc.
References BKE_id_is_in_global_main(), BKE_scene_ensure_depsgraph(), BLI_assert, BPY_GPU_OFFSCREEN_CHECK_OBJ, depsgraph, draw_background(), ED_view3d_draw_offscreen(), ED_view3d_draw_offscreen_check_nested(), G_MAIN, GPU_bgl_end(), GPU_bgl_get(), GPU_bgl_start(), GPU_offscreen_bind(), GPU_offscreen_height(), GPU_offscreen_unbind(), GPU_offscreen_width(), GPU_viewport_create(), GPU_viewport_tag_update(), Matrix_Parse4x4(), PY_ARG_PARSER_HEAD_COMPAT, PyC_ParseBool(), PyC_RNA_AsPointer(), scene, self, View3D::shading, and View3DShading::type.
|
static |
Definition at line 521 of file gpu_py_offscreen.cc.
References BPY_GPU_OFFSCREEN_CHECK_OBJ, GPU_offscreen_free(), GPU_viewport_free(), and self.
|
static |
Definition at line 338 of file gpu_py_offscreen.cc.
References BPY_GPU_OFFSCREEN_CHECK_OBJ, GPU_offscreen_height(), and self.
|
static |
Definition at line 97 of file gpu_py_offscreen.cc.
References self.
|
static |
Definition at line 103 of file gpu_py_offscreen.cc.
References BPY_GPU_OFFSCREEN_CHECK_OBJ, BPYGPU_IS_INIT_OR_ERROR_OBJ, GPU_framebuffer_stack_level_get(), GPU_offscreen_bind(), and self.
Referenced by pygpu_offscreen_bind().
|
static |
Definition at line 122 of file gpu_py_offscreen.cc.
References BPY_GPU_OFFSCREEN_CHECK_OBJ, BPYGPU_IS_INIT_OR_ERROR_OBJ, GPU_framebuffer_stack_level_get(), GPU_offscreen_unbind(), and self.
|
static |
Definition at line 363 of file gpu_py_offscreen.cc.
References BPY_GPU_OFFSCREEN_CHECK_OBJ, BPyGPUTexture_CreatePyObject(), GPU_offscreen_color_texture(), and self.
|
static |
Definition at line 242 of file gpu_py_offscreen.cc.
References BPY_GPU_OFFSCREEN_CHECK_OBJ, GPU_apply_state(), GPU_offscreen_unbind(), PY_ARG_PARSER_HEAD_COMPAT, PyC_ParseBool(), and self.
|
static |
Definition at line 58 of file gpu_py_offscreen.cc.
References BPYGPU_USE_GPUOBJ_FREE_METHOD, BPyGPUOffScreen::ofs, and UNLIKELY.
|
static |
Definition at line 326 of file gpu_py_offscreen.cc.
References BPY_GPU_OFFSCREEN_CHECK_OBJ, GPU_offscreen_width(), and self.
| PyTypeObject BPyGPUOffScreen_Type |
Definition at line 614 of file gpu_py_offscreen.cc.
Referenced by bpygpu_types_init(), and BPyGPUOffScreen_CreatePyObject().
|
static |
Definition at line 50 of file gpu_py_offscreen.cc.
Referenced by pygpu_offscreen__tp_new().
|
static |
Definition at line 547 of file gpu_py_offscreen.cc.
|
static |
Definition at line 576 of file gpu_py_offscreen.cc.
|
static |
Definition at line 149 of file gpu_py_offscreen.cc.
|
static |
Definition at line 159 of file gpu_py_offscreen.cc.
Referenced by pygpu_offscreen_bind().