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:
authorThomas Szepe <HG1_public@gmx.net>2015-03-23 23:40:11 +0300
committerThomas Szepe <HG1_public@gmx.net>2015-03-23 23:40:11 +0300
commitd07c666a0e542517914dad580d1b3f4787525852 (patch)
tree4f9c2c5999817acaca97351e72e71f3f19cb7652 /source/gameengine/Ketsji/KX_PythonInit.cpp
parent2affbb437bd3cbf3e1a502bd65a5eefb64a92b9b (diff)
BGE: Add setMistType and setMistIntensity API.
This patch adds the missing setMistType() and setMistIntensity() to the API Reviewers: campbellbarton, brecht, moguri Reviewed By: campbellbarton, brecht, moguri Subscribers: campbellbarton, dingto Differential Revision: https://developer.blender.org/D149
Diffstat (limited to 'source/gameengine/Ketsji/KX_PythonInit.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index e0af3283f44..8fd38db4a2a 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -1091,6 +1091,29 @@ static PyObject *gPySetUseMist(PyObject *, PyObject *args)
Py_RETURN_NONE;
}
+static PyObject *gPySetMistType(PyObject *, PyObject *args)
+{
+ short type;
+
+ if (!PyArg_ParseTuple(args,"i:setMistType",&type))
+ return NULL;
+
+ if (type < 0 || type > 2) {
+ PyErr_SetString(PyExc_ValueError, "Rasterizer.setMistType(int): Mist type is not known");
+ return NULL;
+ }
+
+ KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo();
+ if (!wi->hasWorld()) {
+ PyErr_SetString(PyExc_RuntimeError, "bge.render.setMistType(int), World not available");
+ return NULL;
+ }
+
+ wi->setMistType(type);
+
+ Py_RETURN_NONE;
+}
+
static PyObject *gPySetMistStart(PyObject *, PyObject *args)
{
float miststart;
@@ -1125,6 +1148,24 @@ static PyObject *gPySetMistEnd(PyObject *, PyObject *args)
Py_RETURN_NONE;
}
+static PyObject *gPySetMistIntensity(PyObject *, PyObject *args)
+{
+
+ float intensity;
+ if (!PyArg_ParseTuple(args,"f:setMistIntensity",&intensity))
+ return NULL;
+
+ KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo();
+ if (!wi->hasWorld()) {
+ PyErr_SetString(PyExc_RuntimeError, "bge.render.setMistIntensity(float), World not available");
+ return NULL;
+ }
+
+ wi->setMistIntensity(intensity);
+
+ Py_RETURN_NONE;
+}
+
static PyObject *gPySetAmbientColor(PyObject *, PyObject *value)
{
MT_Vector3 vec;
@@ -1522,8 +1563,10 @@ static struct PyMethodDef rasterizer_methods[] = {
{"disableMist",(PyCFunction)gPyDisableMist,METH_NOARGS,"turn off mist"},
{"setUseMist",(PyCFunction)gPySetUseMist,METH_VARARGS,"enable or disable mist"},
{"setMistColor",(PyCFunction)gPySetMistColor,METH_O,"set Mist Color (rgb)"},
+ {"setMistType",(PyCFunction)gPySetMistType,METH_VARARGS,"set mist type (short type)"},
{"setMistStart",(PyCFunction)gPySetMistStart,METH_VARARGS,"set Mist Start"},
{"setMistEnd",(PyCFunction)gPySetMistEnd,METH_VARARGS,"set Mist End"},
+ {"setMistIntensity",(PyCFunction)gPySetMistIntensity,METH_VARARGS,"set mist intensity (float intensity)"},
{"enableMotionBlur",(PyCFunction)gPyEnableMotionBlur,METH_VARARGS,"enable motion blur"},
{"disableMotionBlur",(PyCFunction)gPyDisableMotionBlur,METH_NOARGS,"disable motion blur"},
@@ -2370,6 +2413,11 @@ PyMODINIT_FUNC initRasterizerPythonBinding()
KX_MACRO_addTypesToDict(d, LEFT_EYE, RAS_IRasterizer::RAS_STEREO_LEFTEYE);
KX_MACRO_addTypesToDict(d, RIGHT_EYE, RAS_IRasterizer::RAS_STEREO_RIGHTEYE);
+ /* KX_WorldInfo mist types */
+ KX_MACRO_addTypesToDict(d, KX_MIST_QUADRATIC, KX_WorldInfo::KX_MIST_QUADRATIC);
+ KX_MACRO_addTypesToDict(d, KX_MIST_LINEAR, KX_WorldInfo::KX_MIST_LINEAR);
+ KX_MACRO_addTypesToDict(d, KX_MIST_INV_QUADRATIC, KX_WorldInfo::KX_MIST_INV_QUADRATIC);
+
// XXXX Add constants here
// Check for errors