MaterialPyImp.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "PreCompiled.h"
00025
00026 #include "App/Material.h"
00027
00028
00029 #include "MaterialPy.h"
00030 #include "MaterialPy.cpp"
00031
00032 using namespace App;
00033
00034
00035 std::string MaterialPy::representation(void) const
00036 {
00037 return std::string("<Material object>");
00038 }
00039
00040 PyObject* MaterialPy::set(PyObject * args)
00041 {
00042 char *pstr;
00043 if (!PyArg_ParseTuple(args, "s", &pstr))
00044 return NULL;
00045
00046 getMaterialPtr()->set(pstr);
00047
00048 Py_Return;
00049 }
00050
00051 Py::Tuple MaterialPy::getAmbientColor(void) const
00052 {
00053 Py::Tuple tuple(4);
00054 tuple.setItem(0, Py::Float(getMaterialPtr()->ambientColor.r));
00055 tuple.setItem(1, Py::Float(getMaterialPtr()->ambientColor.g));
00056 tuple.setItem(2, Py::Float(getMaterialPtr()->ambientColor.b));
00057 tuple.setItem(3, Py::Float(getMaterialPtr()->ambientColor.a));
00058 return tuple;
00059 }
00060
00061 void MaterialPy::setAmbientColor(Py::Tuple arg)
00062 {
00063 Color c;
00064 c.r = (float)Py::Float(arg.getItem(0));
00065 c.g = (float)Py::Float(arg.getItem(1));
00066 c.b = (float)Py::Float(arg.getItem(2));
00067 if (arg.size() == 4)
00068 c.a = (float)Py::Float(arg.getItem(3));
00069 getMaterialPtr()->ambientColor = c;
00070 }
00071
00072 Py::Tuple MaterialPy::getDiffuseColor(void) const
00073 {
00074 Py::Tuple tuple(4);
00075 tuple.setItem(0, Py::Float(getMaterialPtr()->diffuseColor.r));
00076 tuple.setItem(1, Py::Float(getMaterialPtr()->diffuseColor.g));
00077 tuple.setItem(2, Py::Float(getMaterialPtr()->diffuseColor.b));
00078 tuple.setItem(3, Py::Float(getMaterialPtr()->diffuseColor.a));
00079 return tuple;
00080 }
00081
00082 void MaterialPy::setDiffuseColor(Py::Tuple arg)
00083 {
00084 Color c;
00085 c.r = (float)Py::Float(arg.getItem(0));
00086 c.g = (float)Py::Float(arg.getItem(1));
00087 c.b = (float)Py::Float(arg.getItem(2));
00088 if (arg.size() == 4)
00089 c.a = (float)Py::Float(arg.getItem(3));
00090 getMaterialPtr()->diffuseColor = c;
00091 }
00092
00093 Py::Tuple MaterialPy::getEmissiveColor(void) const
00094 {
00095 Py::Tuple tuple(4);
00096 tuple.setItem(0, Py::Float(getMaterialPtr()->emissiveColor.r));
00097 tuple.setItem(1, Py::Float(getMaterialPtr()->emissiveColor.g));
00098 tuple.setItem(2, Py::Float(getMaterialPtr()->emissiveColor.b));
00099 tuple.setItem(3, Py::Float(getMaterialPtr()->emissiveColor.a));
00100 return tuple;
00101 }
00102
00103 void MaterialPy::setEmissiveColor(Py::Tuple arg)
00104 {
00105 Color c;
00106 c.r = (float)Py::Float(arg.getItem(0));
00107 c.g = (float)Py::Float(arg.getItem(1));
00108 c.b = (float)Py::Float(arg.getItem(2));
00109 if (arg.size() == 4)
00110 c.a = (float)Py::Float(arg.getItem(3));
00111 getMaterialPtr()->emissiveColor = c;
00112 }
00113
00114 Py::Tuple MaterialPy::getSpecularColor(void) const
00115 {
00116 Py::Tuple tuple(4);
00117 tuple.setItem(0, Py::Float(getMaterialPtr()->specularColor.r));
00118 tuple.setItem(1, Py::Float(getMaterialPtr()->specularColor.g));
00119 tuple.setItem(2, Py::Float(getMaterialPtr()->specularColor.b));
00120 tuple.setItem(3, Py::Float(getMaterialPtr()->specularColor.a));
00121 return tuple;
00122 }
00123
00124 void MaterialPy::setSpecularColor(Py::Tuple arg)
00125 {
00126 Color c;
00127 c.r = (float)Py::Float(arg.getItem(0));
00128 c.g = (float)Py::Float(arg.getItem(1));
00129 c.b = (float)Py::Float(arg.getItem(2));
00130 if (arg.size() == 4)
00131 c.a = (float)Py::Float(arg.getItem(3));
00132 getMaterialPtr()->specularColor = c;
00133 }
00134
00135 Py::Float MaterialPy::getShininess(void) const
00136 {
00137 return Py::Float(getMaterialPtr()->shininess);
00138 }
00139
00140 void MaterialPy::setShininess(Py::Float arg)
00141 {
00142 getMaterialPtr()->shininess = (float)arg;
00143 }
00144
00145 Py::Float MaterialPy::getTransparency(void) const
00146 {
00147 return Py::Float(getMaterialPtr()->transparency);
00148 }
00149
00150 void MaterialPy::setTransparency(Py::Float arg)
00151 {
00152 getMaterialPtr()->transparency = (float)arg;
00153 }
00154
00155 PyObject *MaterialPy::getCustomAttributes(const char* ) const
00156 {
00157 return 0;
00158 }
00159
00160 int MaterialPy::setCustomAttributes(const char* , PyObject* )
00161 {
00162 return 0;
00163 }