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:
authorMitchell Stokes <mogurijin@gmail.com>2013-04-14 04:40:24 +0400
committerMitchell Stokes <mogurijin@gmail.com>2013-04-14 04:40:24 +0400
commitd2b14ed4f007d7eb1160b67c6b3722cec52df375 (patch)
treed42d26d45f701030a2d11eeef8da9e21c41c2335 /source/gameengine/Ketsji/KX_PythonInit.cpp
parent6b37baf34c0cfa94619a3106a25a10fc9626920c (diff)
BGE: Adding mipmapping control to bge.render via bge.render.setMipmapping() and bge.render.getMipmapping().
Diffstat (limited to 'source/gameengine/Ketsji/KX_PythonInit.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index af6297369bd..da605508762 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -1338,6 +1338,36 @@ static PyObject *gPyGetFullScreen(PyObject *)
return PyBool_FromLong(gp_Canvas->GetFullScreen());
}
+static PyObject *gPySetMipmapping(PyObject *, PyObject *args)
+{
+ int val = 0;
+
+ if (!PyArg_ParseTuple(args, "i:setMipmapping", &val))
+ return NULL;
+
+ if (val < 0 || val > RAS_IRasterizer::RAS_MIPMAP_MAX) {
+ PyErr_SetString(PyExc_ValueError, "Rasterizer.setMipmapping(val): invalid mipmaping option");
+ return NULL;
+ }
+
+ if (!gp_Rasterizer) {
+ PyErr_SetString(PyExc_RuntimeError, "Rasterizer.setMipmapping(val): Rasterizer not available");
+ return NULL;
+ }
+
+ gp_Rasterizer->SetMipmapping((RAS_IRasterizer::MipmapOption)val);
+ Py_RETURN_NONE;
+}
+
+static PyObject *gPyGetMipmapping(PyObject *)
+{
+ if (!gp_Rasterizer) {
+ PyErr_SetString(PyExc_RuntimeError, "Rasterizer.getMipmapping(): Rasterizer not available");
+ return NULL;
+ }
+ return PyLong_FromLong(gp_Rasterizer->GetMipmapping());
+}
+
static struct PyMethodDef rasterizer_methods[] = {
{"getWindowWidth",(PyCFunction) gPyGetWindowWidth,
METH_VARARGS, "getWindowWidth doc"},
@@ -1381,6 +1411,8 @@ static struct PyMethodDef rasterizer_methods[] = {
{"setWindowSize", (PyCFunction) gPySetWindowSize, METH_VARARGS, ""},
{"setFullScreen", (PyCFunction) gPySetFullScreen, METH_O, ""},
{"getFullScreen", (PyCFunction) gPyGetFullScreen, METH_NOARGS, ""},
+ {"setMipmapping", (PyCFunction) gPySetMipmapping, METH_VARARGS, ""},
+ {"getMipmapping", (PyCFunction) gPyGetMipmapping, METH_NOARGS, ""},
{ NULL, (PyCFunction) NULL, 0, NULL }
};
@@ -2147,6 +2179,10 @@ PyObject *initRasterizer(RAS_IRasterizer* rasty,RAS_ICanvas* canvas)
KX_MACRO_addTypesToDict(d, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL);
KX_MACRO_addTypesToDict(d, KX_BLENDER_GLSL_MATERIAL, KX_BLENDER_GLSL_MATERIAL);
+ KX_MACRO_addTypesToDict(d, RAS_MIPMAP_NONE, RAS_IRasterizer::RAS_MIPMAP_NONE);
+ KX_MACRO_addTypesToDict(d, RAS_MIPMAP_NEAREST, RAS_IRasterizer::RAS_MIPMAP_NEAREST);
+ KX_MACRO_addTypesToDict(d, RAS_MIPMAP_LINEAR, RAS_IRasterizer::RAS_MIPMAP_LINEAR);
+
// XXXX Add constants here
// Check for errors