BGE patch: fix support of group hidden layer in dupli group instantiation: only the...
[blender.git] / source / gameengine / BlenderRoutines / KX_BlenderPolyMaterial.cpp
1 /**
2  * $Id$
3  * ***** BEGIN GPL 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.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software Foundation,
17  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18  *
19  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
20  * All rights reserved.
21  *
22  * The Original Code is: all of this file.
23  *
24  * Contributor(s): none yet.
25  *
26  * ***** END GPL LICENSE BLOCK *****
27  */
28
29 #include "KX_BlenderPolyMaterial.h"
30 #include "BKE_mesh.h"
31
32 #ifdef HAVE_CONFIG_H
33 #include <config.h>
34 #endif
35 #if 0
36 KX_BlenderPolyMaterial::KX_BlenderPolyMaterial(const STR_String &texname,
37                                                                                            bool ba,
38                                                                                            const STR_String& matname,
39                                                                                            int tile,
40                                                                                            int tilexrep,
41                                                                                            int tileyrep,
42                                                                                            int mode,
43                                                                                            bool transparant,
44                                                                                            bool zsort,
45                                                                                            int lightlayer,
46                                                                                            bool bIsTriangle,
47                                                                                            void* clientobject,
48                                                                                            struct MTFace* tface)
49                 : RAS_IPolyMaterial(texname,
50                                                         false,
51                                                         matname,
52                                                         tile,
53                                                         tilexrep,
54                                                         tileyrep,
55                                                         mode,
56                                                         transparant,
57                                                         zsort,
58                                                         lightlayer,
59                                                         bIsTriangle,
60                                                         clientobject),
61                 m_tface(tface)
62 {
63 }
64
65 void KX_BlenderPolyMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingInfo) const 
66 {
67
68         
69         if (GetCachingInfo() != cachingInfo)
70         {
71                 if (!cachingInfo)
72                 {
73                         set_tpage(NULL);
74                 }
75                 cachingInfo = GetCachingInfo();
76
77                 if ((m_drawingmode & 4)&& (rasty->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED))
78                 {
79                         update_realtime_texture((struct MTFace*) m_tface, rasty->GetTime());
80                         set_tpage(m_tface);
81                         rasty->EnableTextures(true);
82                 }
83                 else
84                 {
85                         set_tpage(NULL);
86                         rasty->EnableTextures(false);
87                 }
88                 
89                 if(m_drawingmode & RAS_IRasterizer::KX_TWOSIDE)
90                 {
91                         rasty->SetCullFace(false);
92                 }
93                 else
94                 {
95                         rasty->SetCullFace(true);
96                 }
97
98                 if (m_drawingmode & RAS_IRasterizer::KX_LINES) {
99                         rasty->SetLines(true);
100                 }
101                 else {
102                         rasty->SetLines(false);
103                 }
104         }
105
106         rasty->SetSpecularity(m_specular[0],m_specular[1],m_specular[2],m_specularity);
107         rasty->SetShinyness(m_shininess);
108         rasty->SetDiffuse(m_diffuse[0], m_diffuse[1],m_diffuse[2], 1.0);
109 }
110
111
112 #endif
113
114