Blender
V3.3
|
#include <Python.h>
#include "BLI_utildefines.h"
#include "../mathutils/mathutils.h"
#include "../generic/py_capi_utils.h"
#include "GPU_matrix.h"
#include "gpu_py_matrix.h"
Go to the source code of this file.
Classes | |
struct | BPyGPU_MatrixStackContext |
Macros | |
#define | USE_GPU_PY_MATRIX_API |
Functions | |
Helper Functions | |
static bool | pygpu_stack_is_push_model_view_ok_or_error (void) |
static bool | pygpu_stack_is_push_projection_ok_or_error (void) |
static bool | pygpu_stack_is_pop_model_view_ok_or_error (void) |
static bool | pygpu_stack_is_pop_projection_ok_or_error (void) |
Manage Stack | |
PyDoc_STRVAR (pygpu_matrix_push_doc, ".. function:: push()\n" "\n" " Add to the model-view matrix stack.\n") | |
static PyObject * | pygpu_matrix_push (PyObject *UNUSED(self)) |
PyDoc_STRVAR (pygpu_matrix_pop_doc, ".. function:: pop()\n" "\n" " Remove the last model-view matrix from the stack.\n") | |
static PyObject * | pygpu_matrix_pop (PyObject *UNUSED(self)) |
PyDoc_STRVAR (pygpu_matrix_push_projection_doc, ".. function:: push_projection()\n" "\n" " Add to the projection matrix stack.\n") | |
static PyObject * | pygpu_matrix_push_projection (PyObject *UNUSED(self)) |
PyDoc_STRVAR (pygpu_matrix_pop_projection_doc, ".. function:: pop_projection()\n" "\n" " Remove the last projection matrix from the stack.\n") | |
static PyObject * | pygpu_matrix_pop_projection (PyObject *UNUSED(self)) |
Manipulate State | |
PyDoc_STRVAR (pygpu_matrix_multiply_matrix_doc, ".. function:: multiply_matrix(matrix)\n" "\n" " Multiply the current stack matrix.\n" "\n" " :param matrix: A 4x4 matrix.\n" " :type matrix: :class:`mathutils.Matrix`\n") | |
static PyObject * | pygpu_matrix_multiply_matrix (PyObject *UNUSED(self), PyObject *value) |
PyDoc_STRVAR (pygpu_matrix_scale_doc, ".. function:: scale(scale)\n" "\n" " Scale the current stack matrix.\n" "\n" " :param scale: Scale the current stack matrix.\n" " :type scale: sequence of 2 or 3 floats\n") | |
static PyObject * | pygpu_matrix_scale (PyObject *UNUSED(self), PyObject *value) |
PyDoc_STRVAR (pygpu_matrix_scale_uniform_doc, ".. function:: scale_uniform(scale)\n" "\n" " :param scale: Scale the current stack matrix.\n" " :type scale: float\n") | |
static PyObject * | pygpu_matrix_scale_uniform (PyObject *UNUSED(self), PyObject *value) |
PyDoc_STRVAR (pygpu_matrix_translate_doc, ".. function:: translate(offset)\n" "\n" " Scale the current stack matrix.\n" "\n" " :param offset: Translate the current stack matrix.\n" " :type offset: sequence of 2 or 3 floats\n") | |
static PyObject * | pygpu_matrix_translate (PyObject *UNUSED(self), PyObject *value) |
Write State | |
PyDoc_STRVAR (pygpu_matrix_reset_doc, ".. function:: reset()\n" "\n" " Empty stack and set to identity.\n") | |
static PyObject * | pygpu_matrix_reset (PyObject *UNUSED(self)) |
PyDoc_STRVAR (pygpu_matrix_load_identity_doc, ".. function:: load_identity()\n" "\n" " Empty stack and set to identity.\n") | |
static PyObject * | pygpu_matrix_load_identity (PyObject *UNUSED(self)) |
PyDoc_STRVAR (pygpu_matrix_load_matrix_doc, ".. function:: load_matrix(matrix)\n" "\n" " Load a matrix into the stack.\n" "\n" " :param matrix: A 4x4 matrix.\n" " :type matrix: :class:`mathutils.Matrix`\n") | |
static PyObject * | pygpu_matrix_load_matrix (PyObject *UNUSED(self), PyObject *value) |
PyDoc_STRVAR (pygpu_matrix_load_projection_matrix_doc, ".. function:: load_projection_matrix(matrix)\n" "\n" " Load a projection matrix into the stack.\n" "\n" " :param matrix: A 4x4 matrix.\n" " :type matrix: :class:`mathutils.Matrix`\n") | |
static PyObject * | pygpu_matrix_load_projection_matrix (PyObject *UNUSED(self), PyObject *value) |
Read State | |
PyDoc_STRVAR (pygpu_matrix_get_projection_matrix_doc, ".. function:: get_projection_matrix()\n" "\n" " Return a copy of the projection matrix.\n" "\n" " :return: A 4x4 projection matrix.\n" " :rtype: :class:`mathutils.Matrix`\n") | |
static PyObject * | pygpu_matrix_get_projection_matrix (PyObject *UNUSED(self)) |
PyDoc_STRVAR (pygpu_matrix_get_model_view_matrix_doc, ".. function:: get_model_view_matrix()\n" "\n" " Return a copy of the model-view matrix.\n" "\n" " :return: A 4x4 view matrix.\n" " :rtype: :class:`mathutils.Matrix`\n") | |
static PyObject * | pygpu_matrix_get_model_view_matrix (PyObject *UNUSED(self)) |
PyDoc_STRVAR (pygpu_matrix_get_normal_matrix_doc, ".. function:: get_normal_matrix()\n" "\n" " Return a copy of the normal matrix.\n" "\n" " :return: A 3x3 normal matrix.\n" " :rtype: :class:`mathutils.Matrix`\n") | |
static PyObject * | pygpu_matrix_get_normal_matrix (PyObject *UNUSED(self)) |
Stack (Context Manager) | |
enum | { PYGPU_MATRIX_TYPE_MODEL_VIEW = 1 , PYGPU_MATRIX_TYPE_PROJECTION = 2 } |
static PyMethodDef | pygpu_matrix_stack_context__tp_methods [] |
static PyTypeObject | PyGPUMatrixStackContext_Type |
static PyObject * | pygpu_matrix_stack_context_enter (BPyGPU_MatrixStackContext *self) |
static PyObject * | pygpu_matrix_stack_context_exit (BPyGPU_MatrixStackContext *self, PyObject *args) |
static PyObject * | pygpu_matrix_stack_context_exit (BPyGPU_MatrixStackContext *self, PyObject *UNUSED(args)) |
static PyObject * | pygpu_matrix_push_pop_impl (int type) |
PyDoc_STRVAR (pygpu_matrix_push_pop_doc, ".. function:: push_pop()\n" "\n" " Context manager to ensure balanced push/pop calls, even in the case of an error.\n") | |
static PyObject * | pygpu_matrix_push_pop (PyObject *UNUSED(self)) |
PyDoc_STRVAR (pygpu_matrix_push_pop_projection_doc, ".. function:: push_pop_projection()\n" "\n" " Context manager to ensure balanced push/pop calls, even in the case of an error.\n") | |
static PyObject * | pygpu_matrix_push_pop_projection (PyObject *UNUSED(self)) |
Module | |
static struct PyMethodDef | pygpu_matrix__tp_methods [] |
static PyModuleDef | pygpu_matrix_module_def |
PyDoc_STRVAR (pygpu_matrix__tp_doc, "This module provides access to the matrix stack.") | |
PyObject * | bpygpu_matrix_init (void) |
This file defines the gpu.matrix stack API.
bpygpu_
for local API.BPyGPU
for public API. Definition in file gpu_py_matrix.c.
#define USE_GPU_PY_MATRIX_API |
Definition at line 23 of file gpu_py_matrix.c.
anonymous enum |
Enumerator | |
---|---|
PYGPU_MATRIX_TYPE_MODEL_VIEW | |
PYGPU_MATRIX_TYPE_PROJECTION |
Definition at line 146 of file gpu_py_matrix.c.
PyObject* bpygpu_matrix_init | ( | void | ) |
Definition at line 536 of file gpu_py_matrix.c.
References NULL, pygpu_matrix_module_def, and PyGPUMatrixStackContext_Type.
Referenced by BPyInit_gpu().
PyDoc_STRVAR | ( | pygpu_matrix__tp_doc | , |
"This module provides access to the matrix stack." | |||
) |
PyDoc_STRVAR | ( | pygpu_matrix_get_model_view_matrix_doc | , |
".. function:: get_model_view_matrix()\n" "\n" " Return a copy of the model-view matrix.\n" "\n" " :return: A 4x4 view matrix.\n" " :rtype: :class:`mathutils.Matrix`\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_matrix_get_normal_matrix_doc | , |
".. function:: get_normal_matrix()\n" "\n" " Return a copy of the normal matrix.\n" "\n" " :return: A 3x3 normal matrix.\n" " :rtype: :class:`mathutils.Matrix`\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_matrix_get_projection_matrix_doc | , |
".. function:: get_projection_matrix()\n" "\n" " Return a copy of the projection matrix.\n" "\n" " :return: A 4x4 projection matrix.\n" " :rtype: :class:`mathutils.Matrix`\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_matrix_load_identity_doc | , |
".. function:: load_identity()\n" "\n" " Empty stack and set to identity.\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_matrix_load_matrix_doc | , |
".. function:: load_matrix(matrix)\n" "\n" " Load a matrix into the stack.\n" "\n" " :param matrix: A 4x4 matrix.\n" " :type matrix: :class:`mathutils.Matrix`\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_matrix_load_projection_matrix_doc | , |
".. function:: load_projection_matrix(matrix)\n" "\n" " Load a projection matrix into the stack.\n" "\n" " :param matrix: A 4x4 matrix.\n" " :type matrix: :class:`mathutils.Matrix`\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_matrix_multiply_matrix_doc | , |
".. function:: multiply_matrix(matrix)\n" "\n" " Multiply the current stack matrix.\n" "\n" " :param matrix: A 4x4 matrix.\n" " :type matrix: :class:`mathutils.Matrix`\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_matrix_pop_doc | , |
".. function:: pop()\n" "\n" " Remove the last model-view matrix from the stack.\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_matrix_pop_projection_doc | , |
".. function:: pop_projection()\n" "\n" " Remove the last projection matrix from the stack.\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_matrix_push_doc | , |
".. function:: push()\n" "\n" " Add to the model-view matrix stack.\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_matrix_push_pop_doc | , |
".. function:: push_pop()\n" "\n" " Context manager to ensure balanced push/pop | calls, | ||
even in the case of an error.\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_matrix_push_pop_projection_doc | , |
".. function:: push_pop_projection()\n" "\n" " Context manager to ensure balanced push/pop | calls, | ||
even in the case of an error.\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_matrix_push_projection_doc | , |
".. function:: push_projection()\n" "\n" " Add to the projection matrix stack.\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_matrix_reset_doc | , |
".. function:: reset()\n" "\n" " Empty stack and set to identity.\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_matrix_scale_doc | , |
".. function:: scale(scale)\n" "\n" " Scale the current stack matrix.\n" "\n" " :param scale: Scale the current stack matrix.\n" " :type scale: sequence of 2 or 3 floats\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_matrix_scale_uniform_doc | , |
".. function:: scale_uniform(scale)\n" "\n" " :param scale: Scale the current stack matrix.\n" " :type scale: float\n" | |||
) |
PyDoc_STRVAR | ( | pygpu_matrix_translate_doc | , |
".. function:: translate(offset)\n" "\n" " Scale the current stack matrix.\n" "\n" " :param offset: Translate the current stack matrix.\n" " :type offset: sequence of 2 or 3 floats\n" | |||
) |
|
static |
Definition at line 432 of file gpu_py_matrix.c.
References GPU_matrix_model_view_get, Matrix_CreatePyObject(), and NULL.
|
static |
Definition at line 446 of file gpu_py_matrix.c.
|
static |
Definition at line 418 of file gpu_py_matrix.c.
References GPU_matrix_projection_get, Matrix_CreatePyObject(), and NULL.
|
static |
Definition at line 365 of file gpu_py_matrix.c.
References GPU_matrix_identity_set().
|
static |
Definition at line 378 of file gpu_py_matrix.c.
References GPU_matrix_set, Matrix_Parse4x4(), and NULL.
|
static |
Definition at line 395 of file gpu_py_matrix.c.
References GPU_matrix_projection_set, Matrix_Parse4x4(), and NULL.
|
static |
Definition at line 271 of file gpu_py_matrix.c.
References GPU_matrix_mul, Matrix_Parse4x4(), and NULL.
|
static |
Definition at line 96 of file gpu_py_matrix.c.
References GPU_matrix_pop(), NULL, and pygpu_stack_is_pop_model_view_ok_or_error().
|
static |
Definition at line 122 of file gpu_py_matrix.c.
References GPU_matrix_pop_projection(), NULL, and pygpu_stack_is_pop_projection_ok_or_error().
|
static |
Definition at line 83 of file gpu_py_matrix.c.
References GPU_matrix_push(), NULL, and pygpu_stack_is_push_model_view_ok_or_error().
|
static |
Definition at line 243 of file gpu_py_matrix.c.
References pygpu_matrix_push_pop_impl(), and PYGPU_MATRIX_TYPE_MODEL_VIEW.
|
static |
Definition at line 229 of file gpu_py_matrix.c.
References PyGPUMatrixStackContext_Type, ret, and type.
Referenced by pygpu_matrix_push_pop(), and pygpu_matrix_push_pop_projection().
|
static |
Definition at line 253 of file gpu_py_matrix.c.
References pygpu_matrix_push_pop_impl(), and PYGPU_MATRIX_TYPE_PROJECTION.
|
static |
Definition at line 109 of file gpu_py_matrix.c.
References GPU_matrix_push_projection(), NULL, and pygpu_stack_is_push_projection_ok_or_error().
|
static |
Definition at line 355 of file gpu_py_matrix.c.
References GPU_matrix_reset().
|
static |
Definition at line 288 of file gpu_py_matrix.c.
References GPU_matrix_scale_2fv(), GPU_matrix_scale_3fv(), len, mathutils_array_parse(), and NULL.
|
static |
Definition at line 310 of file gpu_py_matrix.c.
References GPU_matrix_scale_1f(), and NULL.
|
static |
Definition at line 167 of file gpu_py_matrix.c.
References BLI_assert_unreachable, GPU_matrix_push(), GPU_matrix_push_projection(), GPU_matrix_stack_level_get_model_view(), GPU_matrix_stack_level_get_projection(), NULL, PYGPU_MATRIX_TYPE_MODEL_VIEW, PYGPU_MATRIX_TYPE_PROJECTION, pygpu_stack_is_push_model_view_ok_or_error(), pygpu_stack_is_push_projection_ok_or_error(), and self.
|
static |
|
static |
Definition at line 195 of file gpu_py_matrix.c.
References BLI_assert_unreachable, GPU_matrix_pop(), GPU_matrix_pop_projection(), GPU_matrix_stack_level_get_model_view(), GPU_matrix_stack_level_get_projection(), PYGPU_MATRIX_TYPE_MODEL_VIEW, PYGPU_MATRIX_TYPE_PROJECTION, and self.
|
static |
Definition at line 328 of file gpu_py_matrix.c.
References GPU_matrix_translate_2fv(), GPU_matrix_translate_3fv(), len, mathutils_array_parse(), NULL, and offset.
Definition at line 55 of file gpu_py_matrix.c.
References GPU_matrix_stack_level_get_model_view().
Referenced by pygpu_matrix_pop().
Definition at line 64 of file gpu_py_matrix.c.
References GPU_matrix_stack_level_get_projection().
Referenced by pygpu_matrix_pop_projection().
Definition at line 33 of file gpu_py_matrix.c.
References GPU_matrix_stack_level_get_model_view(), and STRINGIFY.
Referenced by pygpu_matrix_push(), and pygpu_matrix_stack_context_enter().
Definition at line 44 of file gpu_py_matrix.c.
References GPU_matrix_stack_level_get_projection(), and STRINGIFY.
Referenced by pygpu_matrix_push_projection(), and pygpu_matrix_stack_context_enter().
|
static |
Definition at line 446 of file gpu_py_matrix.c.
|
static |
Definition at line 529 of file gpu_py_matrix.c.
Referenced by bpygpu_matrix_init().
|
static |
Definition at line 154 of file gpu_py_matrix.c.
|
static |
Definition at line 160 of file gpu_py_matrix.c.
Referenced by bpygpu_matrix_init(), and pygpu_matrix_push_pop_impl().