Last of the config.h mods...
[blender.git] / source / gameengine / Rasterizer / RAS_IPolygonMaterial.cpp
1 /**
2  * $Id$
3  * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version. The Blender
9  * Foundation also sells licenses for use in proprietary software under
10  * the Blender License.  See http://www.blender.org/BL/ for information
11  * about this.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software Foundation,
20  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21  *
22  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
23  * All rights reserved.
24  *
25  * The Original Code is: all of this file.
26  *
27  * Contributor(s): none yet.
28  *
29  * ***** END GPL/BL DUAL LICENSE BLOCK *****
30  */
31
32 #include "RAS_IPolygonMaterial.h"
33
34 #ifdef HAVE_CONFIG_H
35 #include <config.h>
36 #endif
37
38 RAS_IPolyMaterial::RAS_IPolyMaterial(const STR_String& texname,
39                                                                          bool ba,
40                                                                          const STR_String& matname,
41                                                                          int tile,
42                                                                          int tilexrep,
43                                                                          int tileyrep,
44                                                                          int mode,
45                                                                          int transparant,
46                                                                          int lightlayer,
47                                                                          bool bIsTriangle,
48                                                                          void* clientobject=NULL) :
49
50                 m_texturename(texname),
51                 m_materialname(matname),
52                 m_tile(tile),
53                 m_tilexrep(tilexrep),
54                 m_tileyrep(tileyrep),
55                 m_drawingmode (mode),
56                 m_transparant(transparant),
57                 m_lightlayer(lightlayer),
58                 m_bIsTriangle(bIsTriangle)
59 {
60         m_shininess = 35.0;
61         m_specular = MT_Vector3(0.5,0.5,0.5);
62         m_specularity = 1.0;
63         m_diffuse = MT_Vector3(0.5,0.5,0.5);
64 }
65
66
67 bool RAS_IPolyMaterial::Equals(const RAS_IPolyMaterial& lhs) const
68 {
69         return (
70                         this->m_texturename     ==              lhs.m_texturename &&
71                         this->m_tile            ==              lhs.m_tile &&
72                         this->m_tilexrep        ==              lhs.m_tilexrep &&
73                         this->m_tileyrep        ==              lhs.m_tileyrep &&
74                         this->m_transparant     ==              lhs.m_transparant &&
75                         this->m_drawingmode     ==              lhs.m_drawingmode &&
76                         this->m_bIsTriangle     ==              lhs.m_bIsTriangle &&
77                         this->m_lightlayer  ==          lhs.m_lightlayer &&
78                         this->m_materialname ==         lhs.m_materialname
79         );
80 }
81
82
83
84 int RAS_IPolyMaterial::GetLightLayer()
85 {
86         return m_lightlayer;
87 }
88
89
90
91 bool RAS_IPolyMaterial::IsTransparant()
92 {
93         return (m_transparant != 0);
94 }
95
96
97
98 bool RAS_IPolyMaterial::UsesTriangles()
99 {
100         return m_bIsTriangle;
101 }
102
103
104
105 unsigned int RAS_IPolyMaterial::hash() const
106 {
107         return m_texturename.hash();
108 }
109
110
111
112 int RAS_IPolyMaterial::GetDrawingMode()
113 {
114         return m_drawingmode;
115 }
116
117
118
119 const STR_String& RAS_IPolyMaterial::GetMaterialName() const
120
121         return m_materialname;
122 }
123
124
125 const STR_String& RAS_IPolyMaterial::GetTextureName() const
126 {
127         return m_texturename;
128 }