[Bf-blender-cvs] [4323ccfa6b9] blender2.8: GPU Python API: matrix.load_projection_matrix
mano-wii
noreply at git.blender.org
Fri Sep 21 20:07:57 CEST 2018
Commit: 4323ccfa6b9158cb32d56687c8f5c98bc5ca117d
Author: mano-wii
Date: Fri Sep 21 15:06:22 2018 -0300
Branches: blender2.8
https://developer.blender.org/rB4323ccfa6b9158cb32d56687c8f5c98bc5ca117d
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.
===================================================================
M source/blender/python/gpu/gpu_py_matrix.c
===================================================================
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,
More information about the Bf-blender-cvs
mailing list