4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21 * All rights reserved.
23 * The Original Code is: all of this file.
25 * Contributor(s): none yet.
27 * ***** END GPL LICENSE BLOCK *****
29 #ifndef __KX_POLYGONMATERIAL_H__
30 #define __KX_POLYGONMATERIAL_H__
32 #include "PyObjectPlus.h"
34 #include "RAS_MaterialBucket.h"
35 #include "RAS_IRasterizer.h"
44 * This holds the shader, textures and python methods for setting the render state before
47 class KX_PolygonMaterial : public PyObjectPlus, public RAS_IPolyMaterial
51 /** Blender texture face structure. */
56 PyObject* m_pymaterial;
61 KX_PolygonMaterial(const STR_String &texname,
73 PyTypeObject *T = &Type);
74 virtual ~KX_PolygonMaterial();
77 * Returns the caching information for this material,
78 * This can be used to speed up the rasterizing process.
79 * @return The caching information.
81 virtual TCachingInfo GetCachingInfo(void) const
87 * Activates the material in the (OpenGL) rasterizer.
88 * On entry, the cachingInfo contains info about the last activated material.
89 * On exit, the cachingInfo should contain updated info about this material.
90 * @param rasty The rasterizer in which the material should be active.
91 * @param cachingInfo The information about the material used to speed up rasterizing.
93 void DefaultActivate(RAS_IRasterizer* rasty, TCachingInfo& cachingInfo) const;
94 virtual bool Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingInfo) const;
97 * Returns the Blender texture face structure that is used for this material.
98 * @return The material's texture face.
100 MTFace* GetMTFace(void) const
105 unsigned int* GetMCol(void) const
111 KX_PYMETHOD_DOC(KX_PolygonMaterial, updateTexture);
112 KX_PYMETHOD_DOC(KX_PolygonMaterial, setTexture);
113 KX_PYMETHOD_DOC(KX_PolygonMaterial, activate);
115 KX_PYMETHOD_DOC(KX_PolygonMaterial, setCustomMaterial);
116 KX_PYMETHOD_DOC(KX_PolygonMaterial, loadProgram);
118 virtual PyObject* py_getattro(PyObject *attr);
119 virtual int py_setattro(PyObject *attr, PyObject *pyvalue);
122 static PyObject* pyattr_get_texture(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
123 static PyObject* pyattr_get_material(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
125 static PyObject* pyattr_get_tface(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
126 static PyObject* pyattr_get_gl_texture(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
128 static PyObject* pyattr_get_diffuse(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
129 static int pyattr_set_diffuse(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
130 static PyObject* pyattr_get_specular(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
131 static int pyattr_set_specular(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
134 #endif // __KX_POLYGONMATERIAL_H__