Blender
V3.3
|
#include <Python.h>
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BKE_global.h"
#include "BKE_lib_id.h"
#include "BKE_scene.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
#include "GPU_context.h"
#include "GPU_framebuffer.h"
#include "GPU_texture.h"
#include "GPU_viewport.h"
#include "ED_view3d_offscreen.h"
#include "../mathutils/mathutils.h"
#include "../generic/py_capi_utils.h"
#include "gpu_py.h"
#include "gpu_py_texture.h"
#include "gpu_py_offscreen.h"
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 struct PyC_StringEnumItems | pygpu_framebuffer_color_texture_formats [] |
static int | pygpu_offscreen_valid_check (BPyGPUOffScreen *py_ofs) |
Stack (Context Manager) | |
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 *UNUSED(args)) |
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 struct PyMethodDef | pygpu_offscreen__tp_methods [] |
PyTypeObject | BPyGPUOffScreen_Type |
static PyObject * | pygpu_offscreen__tp_new (PyTypeObject *UNUSED(self), 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 *UNUSED(type)) |
PyDoc_STRVAR (pygpu_offscreen_height_doc, "Height of the texture.\n\n:type: `int`") | |
static PyObject * | pygpu_offscreen_height_get (BPyGPUOffScreen *self, void *UNUSED(type)) |
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 *UNUSED(type)) |
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 *UNUSED(type)) |
PyDoc_STRVAR (pygpu_offscreen_draw_view3d_doc, ".. method:: draw_view3d(scene, view_layer, view3d, region, view_matrix, projection_matrix, " "do_color_management=False)\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") | |
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.c.
#define BPY_GPU_OFFSCREEN_CHECK_OBJ | ( | bpygpu | ) |
Definition at line 73 of file gpu_py_offscreen.c.
#define BPYGPU_USE_GPUOBJ_FREE_METHOD |
Definition at line 44 of file gpu_py_offscreen.c.
|
static |
Definition at line 434 of file gpu_py_offscreen.c.
References GPU_offscreen_free(), GPU_viewport_free(), and self.
PyObject* BPyGPUOffScreen_CreatePyObject | ( | GPUOffScreen * | ofs | ) |
Definition at line 510 of file gpu_py_offscreen.c.
References BPyGPUOffScreen_Type, and NULL.
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)\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" | |||
) |
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 210 of file gpu_py_offscreen.c.
References BPYGPU_IS_INIT_OR_ERROR_OBJ, BPyGPUOffScreen_CreatePyObject(), GPU_context_active_get(), GPU_offscreen_create(), GPU_RGBA8, height, NULL, PyC_ParseStringEnum(), pygpu_framebuffer_color_texture_formats, STRNCPY, PyC_StringEnum::value_found, and width.
|
static |
Definition at line 158 of file gpu_py_offscreen.c.
References pygpu_offscreen_stack_context_enter(), PyGPUOffscreenStackContext_Type, and ret.
|
static |
Definition at line 269 of file gpu_py_offscreen.c.
References BPY_GPU_OFFSCREEN_CHECK_OBJ, GPU_offscreen_color_texture(), GPU_texture_opengl_bindcode(), and self.
|
static |
Definition at line 308 of file gpu_py_offscreen.c.
References BKE_id_is_in_global_main(), BKE_scene_ensure_depsgraph(), BLI_assert, BPY_GPU_OFFSCREEN_CHECK_OBJ, depsgraph, ED_view3d_draw_offscreen(), 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(), Scene::id, Matrix_Parse4x4(), NULL, PyC_ParseBool(), PyC_RNA_AsPointer(), scene, self, View3D::shading, and View3DShading::type.
|
static |
Definition at line 419 of file gpu_py_offscreen.c.
References BPY_GPU_OFFSCREEN_CHECK_OBJ, GPU_offscreen_free(), GPU_viewport_free(), NULL, and self.
|
static |
Definition at line 261 of file gpu_py_offscreen.c.
References BPY_GPU_OFFSCREEN_CHECK_OBJ, GPU_offscreen_height(), and self.
|
static |
Definition at line 97 of file gpu_py_offscreen.c.
References self.
|
static |
Definition at line 103 of file gpu_py_offscreen.c.
References BPY_GPU_OFFSCREEN_CHECK_OBJ, GPU_framebuffer_stack_level_get(), GPU_offscreen_bind(), NULL, and self.
Referenced by pygpu_offscreen_bind().
|
static |
Definition at line 120 of file gpu_py_offscreen.c.
References BPY_GPU_OFFSCREEN_CHECK_OBJ, GPU_framebuffer_stack_level_get(), GPU_offscreen_unbind(), NULL, and self.
|
static |
Definition at line 280 of file gpu_py_offscreen.c.
References BPY_GPU_OFFSCREEN_CHECK_OBJ, BPyGPUTexture_CreatePyObject(), GPU_offscreen_color_texture(), and self.
|
static |
Definition at line 181 of file gpu_py_offscreen.c.
References BPY_GPU_OFFSCREEN_CHECK_OBJ, GPU_apply_state(), GPU_offscreen_unbind(), NULL, PyC_ParseBool(), and self.
|
static |
Definition at line 58 of file gpu_py_offscreen.c.
References BPYGPU_USE_GPUOBJ_FREE_METHOD, NULL, BPyGPUOffScreen::ofs, and UNLIKELY.
|
static |
Definition at line 254 of file gpu_py_offscreen.c.
References BPY_GPU_OFFSCREEN_CHECK_OBJ, GPU_offscreen_width(), and self.
PyTypeObject BPyGPUOffScreen_Type |
Definition at line 493 of file gpu_py_offscreen.c.
Referenced by bpygpu_types_init(), and BPyGPUOffScreen_CreatePyObject().
|
static |
Definition at line 1 of file gpu_py_offscreen.c.
Referenced by pygpu_offscreen__tp_new().
|
static |
Definition at line 445 of file gpu_py_offscreen.c.
|
static |
Definition at line 445 of file gpu_py_offscreen.c.
|
static |
Definition at line 140 of file gpu_py_offscreen.c.
|
static |
Definition at line 146 of file gpu_py_offscreen.c.
Referenced by pygpu_offscreen_bind().