resolved conflict state with HEAD r14096
[blender.git] / source / gameengine / BlenderRoutines / KX_BlenderPolyMaterial.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 "KX_BlenderPolyMaterial.h"
33 #include "BKE_mesh.h"
34
35 #ifdef HAVE_CONFIG_H
36 #include <config.h>
37 #endif
38 #if 0
39 KX_BlenderPolyMaterial::KX_BlenderPolyMaterial(const STR_String &texname,
40                                                                                            bool ba,
41                                                                                            const STR_String& matname,
42                                                                                            int tile,
43                                                                                            int tilexrep,
44                                                                                            int tileyrep,
45                                                                                            int mode,
46                                                                                            bool transparant,
47                                                                                            bool zsort,
48                                                                                            int lightlayer,
49                                                                                            bool bIsTriangle,
50                                                                                            void* clientobject,
51                                                                                            struct MTFace* tface)
52                 : RAS_IPolyMaterial(texname,
53                                                         false,
54                                                         matname,
55                                                         tile,
56                                                         tilexrep,
57                                                         tileyrep,
58                                                         mode,
59                                                         transparant,
60                                                         zsort,
61                                                         lightlayer,
62                                                         bIsTriangle,
63                                                         clientobject),
64                 m_tface(tface)
65 {
66 }
67
68 void KX_BlenderPolyMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingInfo) const 
69 {
70
71         
72         if (GetCachingInfo() != cachingInfo)
73         {
74                 if (!cachingInfo)
75                 {
76                         set_tpage(NULL);
77                 }
78                 cachingInfo = GetCachingInfo();
79
80                 if ((m_drawingmode & 4)&& (rasty->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED))
81                 {
82                         update_realtime_texture((struct MTFace*) m_tface, rasty->GetTime());
83                         set_tpage(m_tface);
84                         rasty->EnableTextures(true);
85                 }
86                 else
87                 {
88                         set_tpage(NULL);
89                         rasty->EnableTextures(false);
90                 }
91                 
92                 if(m_drawingmode & RAS_IRasterizer::KX_TWOSIDE)
93                 {
94                         rasty->SetCullFace(false);
95                 }
96                 else
97                 {
98                         rasty->SetCullFace(true);
99                 }
100
101                 if (m_drawingmode & RAS_IRasterizer::KX_LINES) {
102                         rasty->SetLines(true);
103                 }
104                 else {
105                         rasty->SetLines(false);
106                 }
107         }
108
109         rasty->SetSpecularity(m_specular[0],m_specular[1],m_specular[2],m_specularity);
110         rasty->SetShinyness(m_shininess);
111         rasty->SetDiffuse(m_diffuse[0], m_diffuse[1],m_diffuse[2], 1.0);
112 }
113
114
115 #endif
116
117