Changeset View
Changeset View
Standalone View
Standalone View
source/gameengine/Ketsji/KX_PythonInit.cpp
| Context not available. | |||||
| static PyObject *gPySetBackgroundColor(PyObject *, PyObject *value) | static PyObject *gPySetBackgroundColor(PyObject *, PyObject *value) | ||||
| { | { | ||||
| MT_Vector4 vec; | MT_Vector4 vec; | ||||
| if (!PyVecTo(value, vec)) | if (!PyVecTo(value, vec)) | ||||
| return NULL; | return NULL; | ||||
| if (gp_Canvas) | |||||
| { | |||||
| gp_Rasterizer->SetBackColor((float)vec[0], (float)vec[1], (float)vec[2], (float)vec[3]); | |||||
| } | |||||
| KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | ||||
| if (wi->hasWorld()) | if (!wi->hasWorld()) { | ||||
| wi->setBackColor((float)vec[0], (float)vec[1], (float)vec[2]); | PyErr_SetString(PyExc_RuntimeError, "bge.render.SetBackgroundColor(color), World not available"); | ||||
| return NULL; | |||||
| } | |||||
| wi->setBackColor((float)vec[0], (float)vec[1], (float)vec[2]); | |||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| static PyObject *gPySetMistColor(PyObject *, PyObject *value) | static PyObject *gPySetMistColor(PyObject *, PyObject *value) | ||||
| { | { | ||||
| MT_Vector3 vec; | MT_Vector3 vec; | ||||
| if (!PyVecTo(value, vec)) | if (!PyVecTo(value, vec)) | ||||
| return NULL; | return NULL; | ||||
| if (!gp_Rasterizer) { | KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | ||||
| PyErr_SetString(PyExc_RuntimeError, "Rasterizer.setMistColor(color), Rasterizer not available"); | if (!wi->hasWorld()) { | ||||
| PyErr_SetString(PyExc_RuntimeError, "bge.render.setMistColor(color), World not available"); | |||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| gp_Rasterizer->SetFogColor((float)vec[0], (float)vec[1], (float)vec[2]); | |||||
| wi->setMistColor((float)vec[0], (float)vec[1], (float)vec[2]); | |||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| static PyObject *gPyDisableMist(PyObject *) | static PyObject *gPyEnableMist(PyObject *, PyObject *args) | ||||
| { | { | ||||
| int enable; | |||||
| if (!gp_Rasterizer) { | if (!PyArg_ParseTuple(args,"i:enableMist",&enable)) | ||||
| PyErr_SetString(PyExc_RuntimeError, "Rasterizer.setMistColor(color), Rasterizer not available"); | return NULL; | ||||
| KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | |||||
| if (!wi->hasWorld()) { | |||||
| PyErr_SetString(PyExc_RuntimeError, "bge.render.enableMist(enable), World not available"); | |||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| gp_Rasterizer->DisableFog(); | |||||
| wi->setMistEnable(enable); | |||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| static PyObject *gPySetMistStart(PyObject *, PyObject *args) | static PyObject *gPySetMistStart(PyObject *, PyObject *args) | ||||
| { | { | ||||
| float miststart; | float miststart; | ||||
| if (!PyArg_ParseTuple(args,"f:setMistStart",&miststart)) | if (!PyArg_ParseTuple(args,"f:setMistStart",&miststart)) | ||||
| return NULL; | return NULL; | ||||
| if (!gp_Rasterizer) { | KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | ||||
| PyErr_SetString(PyExc_RuntimeError, "Rasterizer.setMistStart(float), Rasterizer not available"); | if (!wi->hasWorld()) { | ||||
| PyErr_SetString(PyExc_RuntimeError, "bge.render.setMistStart(float), World not available"); | |||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| gp_Rasterizer->SetFogStart(miststart); | |||||
| Py_RETURN_NONE; | |||||
| } | |||||
| wi->setMistStart(miststart); | |||||
| Py_RETURN_NONE; | |||||
| } | |||||
| static PyObject *gPySetMistEnd(PyObject *, PyObject *args) | static PyObject *gPySetMistDistance(PyObject *, PyObject *args) | ||||
| { | { | ||||
| float mistdist; | |||||
| float mistend; | if (!PyArg_ParseTuple(args,"f:setMistDistance",&mistdist)) | ||||
| if (!PyArg_ParseTuple(args,"f:setMistEnd",&mistend)) | |||||
| return NULL; | return NULL; | ||||
| if (!gp_Rasterizer) { | KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | ||||
| PyErr_SetString(PyExc_RuntimeError, "Rasterizer.setMistEnd(float), Rasterizer not available"); | if (!wi->hasWorld()) { | ||||
| PyErr_SetString(PyExc_RuntimeError, "bge.render.setMistDistance(float), World not available"); | |||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| gp_Rasterizer->SetFogEnd(mistend); | wi->setMistDistance(mistdist); | ||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| static PyObject *gPySetAmbientColor(PyObject *, PyObject *value) | static PyObject *gPySetAmbientColor(PyObject *, PyObject *value) | ||||
| { | { | ||||
| MT_Vector3 vec; | MT_Vector3 vec; | ||||
| if (!PyVecTo(value, vec)) | if (!PyVecTo(value, vec)) | ||||
| return NULL; | return NULL; | ||||
| if (!gp_Rasterizer) { | KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | ||||
| PyErr_SetString(PyExc_RuntimeError, "Rasterizer.setAmbientColor(color), Rasterizer not available"); | if (!wi->hasWorld()) { | ||||
| PyErr_SetString(PyExc_RuntimeError, "bge.render.setAmbientColor(color), World not available"); | |||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| gp_Rasterizer->SetAmbientColor((float)vec[0], (float)vec[1], (float)vec[2]); | |||||
| Py_RETURN_NONE; | |||||
| } | |||||
| wi->setAmbientColor((float)vec[0], (float)vec[1], (float)vec[2]); | |||||
| Py_RETURN_NONE; | |||||
| } | |||||
| static PyObject *gPyMakeScreenshot(PyObject *, PyObject *args) | static PyObject *gPyMakeScreenshot(PyObject *, PyObject *args) | ||||
| { | { | ||||
| Context not available. | |||||
| METH_VARARGS, "setMousePosition(int x,int y)"}, | METH_VARARGS, "setMousePosition(int x,int y)"}, | ||||
| {"setBackgroundColor",(PyCFunction)gPySetBackgroundColor,METH_O,"set Background Color (rgb)"}, | {"setBackgroundColor",(PyCFunction)gPySetBackgroundColor,METH_O,"set Background Color (rgb)"}, | ||||
| {"setAmbientColor",(PyCFunction)gPySetAmbientColor,METH_O,"set Ambient Color (rgb)"}, | {"setAmbientColor",(PyCFunction)gPySetAmbientColor,METH_O,"set Ambient Color (rgb)"}, | ||||
| {"disableMist",(PyCFunction)gPyDisableMist,METH_NOARGS,"turn off mist"}, | {"enableMist",(PyCFunction)gPyEnableMist,METH_VARARGS,"enable or disable mist"}, | ||||
| {"setMistColor",(PyCFunction)gPySetMistColor,METH_O,"set Mist Color (rgb)"}, | {"setMistColor",(PyCFunction)gPySetMistColor,METH_O,"set Mist Color (rgb)"}, | ||||
| {"setMistStart",(PyCFunction)gPySetMistStart,METH_VARARGS,"set Mist Start(rgb)"}, | {"setMistStart",(PyCFunction)gPySetMistStart,METH_VARARGS,"set Mist Start"}, | ||||
| {"setMistEnd",(PyCFunction)gPySetMistEnd,METH_VARARGS,"set Mist End(rgb)"}, | {"setMistDistance",(PyCFunction)gPySetMistDistance,METH_VARARGS,"set Mist Distance"}, | ||||
| {"enableMotionBlur",(PyCFunction)gPyEnableMotionBlur,METH_VARARGS,"enable motion blur"}, | {"enableMotionBlur",(PyCFunction)gPyEnableMotionBlur,METH_VARARGS,"enable motion blur"}, | ||||
| {"disableMotionBlur",(PyCFunction)gPyDisableMotionBlur,METH_NOARGS,"disable motion blur"}, | {"disableMotionBlur",(PyCFunction)gPyDisableMotionBlur,METH_NOARGS,"disable motion blur"}, | ||||
| Context not available. | |||||