Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormano-wii <germano.costa@ig.com.br>2018-09-21 21:06:22 +0300
committermano-wii <germano.costa@ig.com.br>2018-09-21 21:07:41 +0300
commit4323ccfa6b9158cb32d56687c8f5c98bc5ca117d (patch)
tree984f0764204fa565fb28e060325aa996a1d69412 /source/blender
parent444711e615e20855194a893c678c18474681e74f (diff)
GPU Python API: matrix.load_projection_matrix
If the `push_projection` and `pop_projection` functions already exist, there should naturally be a way to load a projection matrix.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/python/gpu/gpu_py_matrix.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/python/gpu/gpu_py_matrix.c b/source/blender/python/gpu/gpu_py_matrix.c
index f378c0203a2..7fd40767fb1 100644
--- a/source/blender/python/gpu/gpu_py_matrix.c
+++ b/source/blender/python/gpu/gpu_py_matrix.c
@@ -414,6 +414,24 @@ static PyObject *bpygpu_matrix_load_matrix(PyObject *UNUSED(self), PyObject *val
Py_RETURN_NONE;
}
+PyDoc_STRVAR(bpygpu_matrix_load_projection_matrix_doc,
+"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 *bpygpu_matrix_load_projection_matrix(PyObject *UNUSED(self), PyObject *value)
+{
+ MatrixObject *pymat;
+ if (!Matrix_Parse4x4(value, &pymat)) {
+ return NULL;
+ }
+ GPU_matrix_projection_set(pymat->matrix);
+ Py_RETURN_NONE;
+}
+
/** \} */
/* -------------------------------------------------------------------- */
@@ -517,6 +535,8 @@ static struct PyMethodDef bpygpu_matrix_methods[] = {
METH_NOARGS, bpygpu_matrix_load_identity_doc},
{"load_matrix", (PyCFunction)bpygpu_matrix_load_matrix,
METH_O, bpygpu_matrix_load_matrix_doc},
+ {"load_projection_matrix", (PyCFunction)bpygpu_matrix_load_projection_matrix,
+ METH_O, bpygpu_matrix_load_projection_matrix_doc},
/* Read State */
{"get_projection_matrix", (PyCFunction)bpygpu_matrix_get_projection_matrix,