Changeset View
Changeset View
Standalone View
Standalone View
source/gameengine/Ketsji/KX_PythonInit.cpp
| Show First 20 Lines • Show All 1,085 Lines • ▼ Show 20 Lines | if (!wi->hasWorld()) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| wi->setUseMist(enable); | wi->setUseMist(enable); | ||||
| Py_RETURN_NONE; | 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) | 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; | ||||
| KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | ||||
| if (!wi->hasWorld()) { | if (!wi->hasWorld()) { | ||||
| Show All 18 Lines | if (!wi->hasWorld()) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| wi->setMistDistance(mistdist); | wi->setMistDistance(mistdist); | ||||
| Py_RETURN_NONE; | 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) | static PyObject *gPySetAmbientColor(PyObject *, PyObject *value) | ||||
| { | { | ||||
| MT_Vector3 vec; | MT_Vector3 vec; | ||||
| if (!PyVecTo(value, vec)) | if (!PyVecTo(value, vec)) | ||||
| return NULL; | return NULL; | ||||
| KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | ||||
| if (!wi->hasWorld()) { | if (!wi->hasWorld()) { | ||||
| ▲ Show 20 Lines • Show All 381 Lines • ▼ Show 20 Lines | static struct PyMethodDef rasterizer_methods[] = { | ||||
| METH_VARARGS, "showMouse(bool visible)"}, | METH_VARARGS, "showMouse(bool visible)"}, | ||||
| {"setMousePosition",(PyCFunction) gPySetMousePosition, | {"setMousePosition",(PyCFunction) gPySetMousePosition, | ||||
| 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"}, | {"disableMist",(PyCFunction)gPyDisableMist,METH_NOARGS,"turn off mist"}, | ||||
| {"setUseMist",(PyCFunction)gPySetUseMist,METH_VARARGS,"enable or disable mist"}, | {"setUseMist",(PyCFunction)gPySetUseMist,METH_VARARGS,"enable or disable mist"}, | ||||
| {"setMistColor",(PyCFunction)gPySetMistColor,METH_O,"set Mist Color (rgb)"}, | {"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"}, | {"setMistStart",(PyCFunction)gPySetMistStart,METH_VARARGS,"set Mist Start"}, | ||||
| {"setMistEnd",(PyCFunction)gPySetMistEnd,METH_VARARGS,"set Mist End"}, | {"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"}, | {"enableMotionBlur",(PyCFunction)gPyEnableMotionBlur,METH_VARARGS,"enable motion blur"}, | ||||
| {"disableMotionBlur",(PyCFunction)gPyDisableMotionBlur,METH_NOARGS,"disable motion blur"}, | {"disableMotionBlur",(PyCFunction)gPyDisableMotionBlur,METH_NOARGS,"disable motion blur"}, | ||||
| {"setEyeSeparation", (PyCFunction) gPySetEyeSeparation, METH_VARARGS, "set the eye separation for stereo mode"}, | {"setEyeSeparation", (PyCFunction) gPySetEyeSeparation, METH_VARARGS, "set the eye separation for stereo mode"}, | ||||
| {"getEyeSeparation", (PyCFunction) gPyGetEyeSeparation, METH_NOARGS, "get the eye separation for stereo mode"}, | {"getEyeSeparation", (PyCFunction) gPyGetEyeSeparation, METH_NOARGS, "get the eye separation for stereo mode"}, | ||||
| {"setFocalLength", (PyCFunction) gPySetFocalLength, METH_VARARGS, "set the focal length for stereo mode"}, | {"setFocalLength", (PyCFunction) gPySetFocalLength, METH_VARARGS, "set the focal length for stereo mode"}, | ||||
| {"getFocalLength", (PyCFunction) gPyGetFocalLength, METH_VARARGS, "get the focal length for stereo mode"}, | {"getFocalLength", (PyCFunction) gPyGetFocalLength, METH_VARARGS, "get the focal length for stereo mode"}, | ||||
| {"getStereoEye", (PyCFunction) gPyGetStereoEye, METH_VARARGS, "get the current stereoscopy eye being rendered"}, | {"getStereoEye", (PyCFunction) gPyGetStereoEye, METH_VARARGS, "get the current stereoscopy eye being rendered"}, | ||||
| ▲ Show 20 Lines • Show All 830 Lines • ▼ Show 20 Lines | PyMODINIT_FUNC initRasterizerPythonBinding() | ||||
| KX_MACRO_addTypesToDict(d, VSYNC_OFF, VSYNC_OFF); | KX_MACRO_addTypesToDict(d, VSYNC_OFF, VSYNC_OFF); | ||||
| KX_MACRO_addTypesToDict(d, VSYNC_ON, VSYNC_ON); | KX_MACRO_addTypesToDict(d, VSYNC_ON, VSYNC_ON); | ||||
| KX_MACRO_addTypesToDict(d, VSYNC_ADAPTIVE, VSYNC_ADAPTIVE); | KX_MACRO_addTypesToDict(d, VSYNC_ADAPTIVE, VSYNC_ADAPTIVE); | ||||
| /* stereoscopy */ | /* stereoscopy */ | ||||
| KX_MACRO_addTypesToDict(d, LEFT_EYE, RAS_IRasterizer::RAS_STEREO_LEFTEYE); | KX_MACRO_addTypesToDict(d, LEFT_EYE, RAS_IRasterizer::RAS_STEREO_LEFTEYE); | ||||
| KX_MACRO_addTypesToDict(d, RIGHT_EYE, RAS_IRasterizer::RAS_STEREO_RIGHTEYE); | 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 | // XXXX Add constants here | ||||
| // Check for errors | // Check for errors | ||||
| if (PyErr_Occurred()) | if (PyErr_Occurred()) | ||||
| { | { | ||||
| Py_FatalError("can't initialize module Rasterizer"); | Py_FatalError("can't initialize module Rasterizer"); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 342 Lines • Show Last 20 Lines | |||||