BGE: Remove old world bge.render API

This patch can be used to remove the old world bge.render API if the new world API D157 is used.

If  the new world API is applied we can remove the old API because the old has newer worked.
The patch keep the two old working methods for backward compatibility.

Reviewers: campbellbarton, moguri

Reviewed By: campbellbarton, moguri

Subscribers: brecht

Differential Revision: https://developer.blender.org/D158
This commit is contained in:
Thomas Szepe 2015-03-24 00:27:45 +01:00
parent fd22a92939
commit ee57968461
4 changed files with 0 additions and 313 deletions

@ -87,18 +87,6 @@ Constants
Right eye being used during stereoscopic rendering.
.. data:: KX_MIST_QUADRATIC
Type of quadratic attenuation used to fade mist. (Deprecated: use KX_WorldInfo.KX_MIST_QUADRATIC)
.. data:: KX_MIST_LINEAR
Type of linear attenuation used to fade mist. (Deprecated: use KX_WorldInfo.KX_MIST_LINEAR)
.. data:: KX_MIST_INV_QUADRATIC
Type of inverse quadratic attenuation used to fade mist. (Deprecated: use KX_WorldInfo.KX_MIST_INV_QUADRATIC)
*********
Functions
@ -178,64 +166,6 @@ Functions
:type rgba: list [r, g, b, a]
.. function:: setAmbientColor(rgb)
Sets the color of ambient light. (Deprecated: use KX_WorldInfo.ambient_color)
:type rgb: list [r, g, b]
.. function:: setMistColor(rgb)
Sets the mist color. (Deprecated: use KX_WorldInfo.mist_color)
:type rgb: list [r, g, b]
.. function:: setMistType(mode)
Sets the mist attenuation type. (Deprecated: use KX_WorldInfo.mist_type)
:type mode: KX_MIST_QUADRATIC, KX_MIST_LINEAR, KX_MIST_INV_QUADRATIC
.. function:: setMistStart(start)
Sets the mist start value. Objects further away than start will have mist applied to them.
(Deprecated: use KX_WorldInfo.mist_start)
:type start: float
.. function:: setMistEnd(end)
Sets the mist end value. Objects further away from this will be colored solid with
the color set by setMistColor(). (Deprecated: use KX_WorldInfo.mist_distance)
:type end: float
.. function:: setMistIntensity(intensity)
Sets the mist intensity value. (Deprecated: use KX_WorldInfo.mist_intensity)
:type start: float
.. function:: disableMist()
Disables mist.
.. note:: Deprecated: use KX_WorldInfo.mist_enable.
.. function:: setUseMist(enable)
Disable or enable the mist. (Deprecated: use KX_WorldInfo.mist_enable)
:type enable: boolean
.. function:: setEyeSeparation(eyesep)
Sets the eye separation for stereo mode. Usually Focal Length/30 provides a confortable value.

@ -1045,152 +1045,6 @@ static PyObject *gPySetBackgroundColor(PyObject *, PyObject *value)
Py_RETURN_NONE;
}
static PyObject *gPySetMistColor(PyObject *, PyObject *value)
{
MT_Vector3 vec;
if (!PyVecTo(value, vec))
return NULL;
KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo();
if (!wi->hasWorld()) {
PyErr_SetString(PyExc_RuntimeError, "bge.render.setMistColor(color), World not available");
return NULL;
}
ShowDeprecationWarning("setMistColor()", "KX_WorldInfo.mist_color");
wi->setMistColor((float)vec[0], (float)vec[1], (float)vec[2]);
Py_RETURN_NONE;
}
static PyObject *gPyDisableMist(PyObject *)
{
KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo();
if (!wi->hasWorld()) {
PyErr_SetString(PyExc_RuntimeError, "bge.render.DisableMist(), World not available");
return NULL;
}
ShowDeprecationWarning("DisableMist()", "KX_WorldInfo.mist_enable = False");
wi->setUseMist(false);
Py_RETURN_NONE;
}
static PyObject *gPySetUseMist(PyObject *, PyObject *args)
{
int enable;
if (!PyArg_ParseTuple(args,"i:setUseMist",&enable))
return NULL;
KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo();
if (!wi->hasWorld()) {
PyErr_SetString(PyExc_RuntimeError, "bge.render.setUseMist(enable), World not available");
return NULL;
}
ShowDeprecationWarning("setUseMist()", "KX_WorldInfo.mist_enable");
wi->setUseMist(enable);
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;
}
ShowDeprecationWarning("setMistType()", "KX_WorldInfo.mist_type");
wi->setMistType(type);
Py_RETURN_NONE;
}
static PyObject *gPySetMistStart(PyObject *, PyObject *args)
{
float miststart;
if (!PyArg_ParseTuple(args,"f:setMistStart",&miststart))
return NULL;
KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo();
if (!wi->hasWorld()) {
PyErr_SetString(PyExc_RuntimeError, "bge.render.setMistStart(float), World not available");
return NULL;
}
ShowDeprecationWarning("setMistStart()", "KX_WorldInfo.mist_start");
wi->setMistStart(miststart);
Py_RETURN_NONE;
}
static PyObject *gPySetMistEnd(PyObject *, PyObject *args)
{
float mistdist;
if (!PyArg_ParseTuple(args,"f:setMistEnd",&mistdist))
return NULL;
KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo();
if (!wi->hasWorld()) {
PyErr_SetString(PyExc_RuntimeError, "bge.render.setMistEnd(float), World not available");
return NULL;
}
ShowDeprecationWarning("setMistEnd()", "KX_WorldInfo.mist_distance");
wi->setMistDistance(mistdist);
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;
}
ShowDeprecationWarning("setMistIntensity()", "KX_WorldInfo.mist_intensity");
wi->setMistIntensity(intensity);
Py_RETURN_NONE;
}
static PyObject *gPySetAmbientColor(PyObject *, PyObject *value)
{
MT_Vector3 vec;
if (!PyVecTo(value, vec))
return NULL;
KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo();
if (!wi->hasWorld()) {
PyErr_SetString(PyExc_RuntimeError, "bge.render.setAmbientColor(color), World not available");
return NULL;
}
ShowDeprecationWarning("setAmbientColor()", "KX_WorldInfo.ambient_color");
wi->setAmbientColor((float)vec[0], (float)vec[1], (float)vec[2]);
Py_RETURN_NONE;
}
static PyObject *gPyMakeScreenshot(PyObject *, PyObject *args)
{
char* filename;
@ -1567,14 +1421,6 @@ static struct PyMethodDef rasterizer_methods[] = {
{"setMousePosition",(PyCFunction) gPySetMousePosition,
METH_VARARGS, "setMousePosition(int x,int y)"},
{"setBackgroundColor",(PyCFunction)gPySetBackgroundColor,METH_O,"set Background Color (rgb)"},
{"setAmbientColor",(PyCFunction)gPySetAmbientColor,METH_O,"set Ambient Color (rgb)"},
{"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"},
@ -2421,11 +2267,6 @@ 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

@ -86,76 +86,6 @@ bool KX_WorldInfo::hasWorld()
return m_hasworld;
}
bool KX_WorldInfo::hasMist()
{
return m_hasmist;
}
float KX_WorldInfo::getBackColorRed()
{
return m_backgroundcolor[0];
}
float KX_WorldInfo::getBackColorGreen()
{
return m_backgroundcolor[1];
}
float KX_WorldInfo::getBackColorBlue()
{
return m_backgroundcolor[2];
}
float KX_WorldInfo::getAmbientColorRed()
{
return m_ambientcolor[0];
}
float KX_WorldInfo::getAmbientColorGreen()
{
return m_ambientcolor[1];
}
float KX_WorldInfo::getAmbientColorBlue()
{
return m_ambientcolor[2];
}
short KX_WorldInfo::getMistType()
{
return m_misttype;
}
float KX_WorldInfo::getMistStart()
{
return m_miststart;
}
float KX_WorldInfo::getMistDistance()
{
return m_mistdistance;
}
float KX_WorldInfo::getMistIntensity()
{
return m_mistintensity;
}
float KX_WorldInfo::getMistColorRed()
{
return m_mistcolor[0];
}
float KX_WorldInfo::getMistColorGreen()
{
return m_mistcolor[1];
}
float KX_WorldInfo::getMistColorBlue()
{
return m_mistcolor[2];
}
void KX_WorldInfo::setBackColor(float r, float g, float b)
{
m_backgroundcolor[0] = r;

@ -81,20 +81,6 @@ public:
const STR_String &GetName();
bool hasWorld();
bool hasMist();
short getMistType();
float getMistStart();
float getMistDistance();
float getMistIntensity();
float getMistColorRed();
float getMistColorGreen();
float getMistColorBlue();
float getBackColorRed();
float getBackColorGreen();
float getBackColorBlue();
float getAmbientColorRed();
float getAmbientColorGreen();
float getAmbientColorBlue();
void setUseMist(bool enable);
void setMistType(short type);
void setMistStart(float d);