diff options
author | mano-wii <germano.costa@ig.com.br> | 2018-09-21 21:06:22 +0300 |
---|---|---|
committer | mano-wii <germano.costa@ig.com.br> | 2018-09-21 21:07:41 +0300 |
commit | 4323ccfa6b9158cb32d56687c8f5c98bc5ca117d (patch) | |
tree | 984f0764204fa565fb28e060325aa996a1d69412 | |
parent | 444711e615e20855194a893c678c18474681e74f (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.
-rw-r--r-- | source/blender/python/gpu/gpu_py_matrix.c | 20 |
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, |