Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/ogre/Tools/3dsmaxExport/LEXIExporter/LexiExport/Sources/LexiIntermediateMaterial.cpp @ 11

Last change on this file since 11 was 6, checked in by anonymous, 18 years ago

=…

File size: 6.4 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of LEXIExporter
4
5Copyright 2006 NDS Limited
6
7Author(s):
8Mark Folkenberg,
9Bo Krohn
10
11This program is free software; you can redistribute it and/or modify it under
12the terms of the GNU Lesser General Public License as published by the Free Software
13Foundation; either version 2 of the License, or (at your option) any later
14version.
15
16This program is distributed in the hope that it will be useful, but WITHOUT
17ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
19
20You should have received a copy of the GNU Lesser General Public License along with
21this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22Place - Suite 330, Boston, MA 02111-1307, USA, or go to
23http://www.gnu.org/copyleft/lesser.txt.
24-----------------------------------------------------------------------------
25*/
26
27#include "LexiStdAfx.h"
28#include "LexiIntermediateAPI.h"
29
30//
31
32CIntermediateMaterial::CIntermediateMaterial( Ogre::String name )
33{
34        m_sName = name;
35        m_Mask = 0;
36        m_b2Sided = false;
37        m_bWire = false;
38        m_bFaceted = false;
39}
40
41CIntermediateMaterial::CIntermediateMaterial(const CIntermediateMaterial& other)
42{
43        m_sName = other.m_sName;
44        m_sParentName = other.m_sParentName;
45        m_vAmbientColor = other.m_vAmbientColor;
46        m_vDiffuseColor = other.m_vDiffuseColor;
47        m_vSpecularColor = other.m_vSpecularColor;
48        m_fSpecularLevel = other.m_fSpecularLevel;
49        m_fGlossiness = other.m_fGlossiness;
50        m_fOpacity = other.m_fOpacity;
51        m_b2Sided = other.m_b2Sided;
52        m_bWire = other.m_bWire;
53        m_bFaceted = other.m_bFaceted;
54        m_lTextureMaps = other.m_lTextureMaps;
55        m_Mask = other.m_Mask;
56}
57
58CIntermediateMaterial::~CIntermediateMaterial( void )
59{
60
61}
62
63void CIntermediateMaterial::AddTextureMap( Ogre::String identifier, STextureMapInfo texInfo)
64{
65        std::map< Ogre::String, STextureMapInfo >::iterator it = m_lTextureMaps.find( identifier );
66        if (it != m_lTextureMaps.end())
67                return;
68
69        std::pair< Ogre::String, STextureMapInfo > entry(identifier, texInfo);
70        m_lTextureMaps.insert( entry );
71}
72
73short& CIntermediateMaterial::GetMask( void )
74{
75        return m_Mask;
76}
77
78const std::map< Ogre::String, STextureMapInfo >& CIntermediateMaterial::GetTextureMaps( void )
79{
80        return m_lTextureMaps;
81}
82
83STextureMapInfo CIntermediateMaterial::GetTextureMapInfoFromName( Ogre::String name )
84{
85        std::map< Ogre::String, STextureMapInfo >::iterator it = m_lTextureMaps.find( name );
86        if ( it ==      m_lTextureMaps.end() )
87                return STextureMapInfo();
88        else
89                return it->second;
90}
91
92bool CIntermediateMaterial::UsesSameTextureMaps( CIntermediateMaterial* pIMat )
93{
94        short& mask2 = pIMat->GetMask();
95
96        if ( (m_Mask^mask2) == 0 )
97                return true;
98        else
99                return false;
100}
101
102
103//////////////////////////////////////////////////////////////////////////
104// Gets
105//////////////////////////////////////////////////////////////////////////
106
107Ogre::String CIntermediateMaterial::GetName( void )
108{
109        return m_sName;
110}
111
112Ogre::String CIntermediateMaterial::GetParentName( void )
113{
114        return m_sParentName;
115}
116
117const Ogre::ColourValue& CIntermediateMaterial::GetAmbientColor( void ) const
118{
119        return m_vAmbientColor;
120}
121
122const Ogre::ColourValue& CIntermediateMaterial::GetDiffuseColor( void ) const
123{
124        return m_vDiffuseColor;
125}
126
127const Ogre::ColourValue& CIntermediateMaterial::GetSpecularColor( void ) const
128{
129        return m_vSpecularColor;
130}
131
132const Ogre::ColourValue& CIntermediateMaterial::GetEmissiveColor( void ) const
133{
134        return m_vEmissiveColor;
135}
136
137float CIntermediateMaterial::GetSpecularLevel( void ) const
138{
139        return m_fSpecularLevel;
140}
141
142float CIntermediateMaterial::GetGlossiness( void ) const
143{
144        return m_fGlossiness;
145}
146
147float CIntermediateMaterial::GetOpacity( void ) const
148{
149        return m_fOpacity;
150}
151
152bool CIntermediateMaterial::Get2Sided( void ) const
153{
154        return m_b2Sided;
155}
156
157bool CIntermediateMaterial::GetWired( void ) const
158{
159        return m_bWire;
160}
161
162bool CIntermediateMaterial::GetFaceted( void ) const
163{
164        return m_bFaceted;
165}
166
167//////////////////////////////////////////////////////////////////////////
168// Sets
169//////////////////////////////////////////////////////////////////////////
170
171void CIntermediateMaterial::SetParentName( Ogre::String parentName )
172{
173        m_sParentName = parentName;
174}
175
176void CIntermediateMaterial::SetAmbientColor( const Ogre::Vector4& color )
177{
178        m_vAmbientColor = Ogre::ColourValue(color.x,color.y, color.z, color.w);
179}
180
181void CIntermediateMaterial::SetAmbientColor( const Ogre::Vector3& color )
182{
183        m_vAmbientColor = Ogre::ColourValue(color.x, color.y, color.x, 1.0f);
184}
185
186void CIntermediateMaterial::SetAmbientColor( float r, float g, float b, float a )
187{
188        m_vAmbientColor = Ogre::ColourValue(r,g,b,a);
189}
190
191void CIntermediateMaterial::SetDiffuseColor( const Ogre::Vector4& color )
192{
193        m_vDiffuseColor = Ogre::ColourValue(color.x,color.y, color.z, color.w);
194}
195
196void CIntermediateMaterial::SetDiffuseColor( const Ogre::Vector3& color )
197{
198        m_vDiffuseColor = Ogre::ColourValue(color.x, color.y, color.x, 1.0f);
199}
200
201void CIntermediateMaterial::SetDiffuseColor( float r, float g, float b, float a )
202{
203        m_vDiffuseColor = Ogre::ColourValue(r,g,b,a);
204}
205
206void CIntermediateMaterial::SetSpecularColor( const Ogre::Vector4& color )
207{
208        m_vSpecularColor = Ogre::ColourValue(color.x,color.y, color.z, color.w);;
209}
210
211void CIntermediateMaterial::SetSpecularColor( const Ogre::Vector3& color )
212{
213        m_vSpecularColor = Ogre::ColourValue(color.x, color.y, color.x, 1.0f);
214}
215
216void CIntermediateMaterial::SetSpecularColor( float r, float g, float b, float a )
217{
218        m_vSpecularColor = Ogre::ColourValue(r,g,b,a);
219}
220
221void CIntermediateMaterial::SetEmissiveColor( const Ogre::Vector4& color )
222{
223        m_vEmissiveColor = Ogre::ColourValue(color.x,color.y, color.z, color.w);;
224}
225
226void CIntermediateMaterial::SetEmissiveColor( const Ogre::Vector3& color )
227{
228        m_vEmissiveColor = Ogre::ColourValue(color.x, color.y, color.x, 1.0f);
229}
230
231void CIntermediateMaterial::SetEmissiveColor( float r, float g, float b, float a )
232{
233        m_vEmissiveColor = Ogre::ColourValue(r,g,b,a);
234}
235
236void CIntermediateMaterial::SetSpecularLevel( float level )
237{
238        m_fSpecularLevel = level;
239}
240
241void CIntermediateMaterial::SetGlosiness( float glossiness )
242{
243        m_fGlossiness = glossiness;
244}
245
246void CIntermediateMaterial::SetOpacity( float opacity )
247{
248        m_fOpacity = opacity;
249}
250
251void CIntermediateMaterial::Set2Sided( bool b2Sided )
252{
253        m_b2Sided = b2Sided;
254}
255
256void CIntermediateMaterial::SetWired( bool bWired )
257{
258        m_bWire = bWired;
259}
260
261void CIntermediateMaterial::SetFaceted( bool bFaceted )
262{
263        m_bFaceted = bFaceted;
264}
265
Note: See TracBrowser for help on using the repository browser.