From f63d049adc268bc71ac87c2b781e2f44f60da1f5 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Wed, 31 Aug 2011 05:51:51 +0000 Subject: BGE: Adding two new functions to bge.render to allow users to change the anisotropic filtering level used by textures: * setAnisotropicFiltering(level) * getAnisotropicFiltering() --- source/gameengine/Ketsji/KX_PythonInit.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'source/gameengine/Ketsji') diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 06db84feb23..8557ebab0a9 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -1208,6 +1208,28 @@ static PyObject* gPyGetMaterialType(PyObject*) return PyLong_FromSsize_t(flag); } +static PyObject* gPySetAnisotropicFiltering(PyObject*, PyObject* args) +{ + short level; + + if (!PyArg_ParseTuple(args, "h:setAnisotropicFiltering", &level)) + return NULL; + + if (level != 1 && level != 2 && level != 4 && level != 8 && level != 16) { + PyErr_SetString(PyExc_ValueError, "Rasterizer.setAnisotropicFiltering(level): Expected value of 1, 2, 4, 8, or 16 for value"); + return NULL; + } + + gp_Rasterizer->SetAnisotropicFiltering(level); + + Py_RETURN_NONE; +} + +static PyObject* gPyGetAnisotropicFiltering(PyObject*, PyObject* args) +{ + return PyLong_FromLong(gp_Rasterizer->GetAnisotropicFiltering()); +} + static PyObject* gPyDrawLine(PyObject*, PyObject* args) { PyObject* ob_from; @@ -1272,6 +1294,10 @@ static struct PyMethodDef rasterizer_methods[] = { METH_VARARGS, "set the state of a GLSL material setting"}, {"getGLSLMaterialSetting",(PyCFunction) gPyGetGLSLMaterialSetting, METH_VARARGS, "get the state of a GLSL material setting"}, + {"setAnisotropicFiltering", (PyCFunction) gPySetAnisotropicFiltering, + METH_VARARGS, "set the anisotropic filtering level (must be one of 1, 2, 4, 8, 16)"}, + {"getAnisotropicFiltering", (PyCFunction) gPyGetAnisotropicFiltering, + METH_VARARGS, "get the anisotropic filtering level"}, {"drawLine", (PyCFunction) gPyDrawLine, METH_VARARGS, "draw a line on the screen"}, { NULL, (PyCFunction) NULL, 0, NULL } -- cgit v1.2.3