diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-09-25 02:58:49 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-09-25 02:58:49 +0400 |
commit | 38a80ff9a5c6d7bebef42bc3b8320d781b4e4f1c (patch) | |
tree | 325f16aebffa126c36f2377cb32c5dc8fd3f533b /source/gameengine | |
parent | 48bc5b2ac654229832752e7f8593f0dda2ccf80c (diff) |
BGE patch: add advanced parameters for SoftBody. Add Rasterizer.drawLine() Python function.
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Ketsji/KX_PythonInit.cpp | 32 | ||||
-rw-r--r-- | source/gameengine/PyDoc/Rasterizer.py | 11 |
2 files changed, 43 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 95693efe30e..3e271be7984 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -797,6 +797,36 @@ static PyObject* gPyGetMaterialType(PyObject*) return PyInt_FromLong(flag); } +static PyObject* gPyDrawLine(PyObject*, PyObject* args) +{ + PyObject* ob_from; + PyObject* ob_to; + PyObject* ob_color; + + if (!gp_Rasterizer) { + PyErr_SetString(PyExc_RuntimeError, "Rasterizer not available"); + return NULL; + } + + if (!PyArg_ParseTuple(args,"OOO",&ob_from,&ob_to,&ob_color)) + return NULL; + + MT_Vector3 from(0., 0., 0.); + MT_Vector3 to(0., 0., 0.); + MT_Vector3 color(0., 0., 0.); + if (!PyVecTo(ob_from, from)) + return NULL; + if (!PyVecTo(ob_to, to)) + return NULL; + if (!PyVecTo(ob_color, color)) + return NULL; + + gp_Rasterizer->DrawDebugLine(from,to,color); + + Py_RETURN_NONE; +} + + STR_String gPyGetWindowHeight__doc__="getWindowHeight doc"; STR_String gPyGetWindowWidth__doc__="getWindowWidth doc"; STR_String gPyEnableVisibility__doc__="enableVisibility doc"; @@ -838,6 +868,8 @@ 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"}, + {"drawLine", (PyCFunction) gPyDrawLine, + METH_VARARGS, "draw a line on the screen"}, { NULL, (PyCFunction) NULL, 0, NULL } }; diff --git a/source/gameengine/PyDoc/Rasterizer.py b/source/gameengine/PyDoc/Rasterizer.py index ebb5332d98d..cdda87fcb49 100644 --- a/source/gameengine/PyDoc/Rasterizer.py +++ b/source/gameengine/PyDoc/Rasterizer.py @@ -181,4 +181,15 @@ def getGLSLMaterialSetting(setting, enable): @type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures) @rtype: boolean """ +def drawLine(from,to,color): + """ + Draw a line in the 3D scene. + + @param from: the origin of the line + @type from: list [x, y, z] + @param to: the end of the line + @type to: list [x, y, z] + @param color: the color of the line + @type color: list [r, g, b] + """ |