| 1 | /* |
|---|
| 2 | ----------------------------------------------------------------------------- |
|---|
| 3 | This source file is part of LEXIExporter |
|---|
| 4 | |
|---|
| 5 | Copyright 2006 NDS Limited |
|---|
| 6 | |
|---|
| 7 | Author(s): |
|---|
| 8 | Mark Folkenberg, |
|---|
| 9 | Bo Krohn |
|---|
| 10 | |
|---|
| 11 | This program is free software; you can redistribute it and/or modify it under |
|---|
| 12 | the terms of the GNU Lesser General Public License as published by the Free Software |
|---|
| 13 | Foundation; either version 2 of the License, or (at your option) any later |
|---|
| 14 | version. |
|---|
| 15 | |
|---|
| 16 | This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|---|
| 18 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
|---|
| 19 | |
|---|
| 20 | You should have received a copy of the GNU Lesser General Public License along with |
|---|
| 21 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
|---|
| 22 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to |
|---|
| 23 | http://www.gnu.org/copyleft/lesser.txt. |
|---|
| 24 | ----------------------------------------------------------------------------- |
|---|
| 25 | */ |
|---|
| 26 | |
|---|
| 27 | #ifndef __NDS_LexiExporter_IntermediateMaterial__ |
|---|
| 28 | #define __NDS_LexiExporter_IntermediateMaterial__ |
|---|
| 29 | |
|---|
| 30 | // |
|---|
| 31 | struct STextureMapInfo |
|---|
| 32 | { |
|---|
| 33 | Ogre::String m_sFilename; |
|---|
| 34 | Ogre::String m_sMapType; |
|---|
| 35 | unsigned int m_iCoordSet; |
|---|
| 36 | |
|---|
| 37 | Ogre::TextureUnitState::TextureAddressingMode m_AdressingMode; |
|---|
| 38 | |
|---|
| 39 | float m_fAmount; |
|---|
| 40 | float m_fOffset[2]; |
|---|
| 41 | float m_fScale[2]; |
|---|
| 42 | float m_fAngle; |
|---|
| 43 | bool m_bAlpha; |
|---|
| 44 | |
|---|
| 45 | bool isNull( void ) |
|---|
| 46 | { |
|---|
| 47 | if(m_sFilename.empty()) |
|---|
| 48 | return true; |
|---|
| 49 | else |
|---|
| 50 | return false; |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | }; |
|---|
| 54 | |
|---|
| 55 | class CIntermediateMaterial { |
|---|
| 56 | |
|---|
| 57 | public: |
|---|
| 58 | |
|---|
| 59 | CIntermediateMaterial( Ogre::String name ); |
|---|
| 60 | CIntermediateMaterial(const CIntermediateMaterial& other); |
|---|
| 61 | ~CIntermediateMaterial( void ); |
|---|
| 62 | |
|---|
| 63 | bool UsesSameTextureMaps( CIntermediateMaterial* pIMat ); |
|---|
| 64 | |
|---|
| 65 | void AddTextureMap( Ogre::String identifier, STextureMapInfo texInfo ); |
|---|
| 66 | |
|---|
| 67 | // Gets |
|---|
| 68 | Ogre::String GetName( void ); |
|---|
| 69 | Ogre::String GetParentName( void ); |
|---|
| 70 | |
|---|
| 71 | const Ogre::ColourValue& GetAmbientColor( void ) const; |
|---|
| 72 | const Ogre::ColourValue& GetDiffuseColor( void ) const; |
|---|
| 73 | const Ogre::ColourValue& GetSpecularColor( void ) const; |
|---|
| 74 | const Ogre::ColourValue& GetEmissiveColor( void ) const; |
|---|
| 75 | |
|---|
| 76 | float GetSpecularLevel( void ) const; |
|---|
| 77 | float GetGlossiness( void ) const; |
|---|
| 78 | float GetOpacity( void ) const; |
|---|
| 79 | |
|---|
| 80 | bool Get2Sided( void ) const; |
|---|
| 81 | bool GetWired( void ) const; |
|---|
| 82 | bool GetFaceted( void ) const; |
|---|
| 83 | |
|---|
| 84 | short& GetMask( void ); |
|---|
| 85 | const std::map< Ogre::String, STextureMapInfo >& GetTextureMaps( void ); |
|---|
| 86 | STextureMapInfo GetTextureMapInfoFromName( Ogre::String name ); |
|---|
| 87 | |
|---|
| 88 | // Sets |
|---|
| 89 | void SetParentName( Ogre::String parentName ); |
|---|
| 90 | |
|---|
| 91 | void SetAmbientColor( const Ogre::Vector4& color ); |
|---|
| 92 | void SetAmbientColor( const Ogre::Vector3& color ); |
|---|
| 93 | void SetAmbientColor( const Ogre::ColourValue& color ); |
|---|
| 94 | void SetAmbientColor( float r, float g, float b, float a=1.0f ); |
|---|
| 95 | |
|---|
| 96 | void SetDiffuseColor( const Ogre::Vector4& color ); |
|---|
| 97 | void SetDiffuseColor( const Ogre::Vector3& color ); |
|---|
| 98 | void SetDiffuseColor( float r, float g, float b, float a=1.0f ); |
|---|
| 99 | |
|---|
| 100 | void SetSpecularColor( const Ogre::Vector4& color ); |
|---|
| 101 | void SetSpecularColor( const Ogre::Vector3& color ); |
|---|
| 102 | void SetSpecularColor( float r, float g, float b, float a=1.0f ); |
|---|
| 103 | |
|---|
| 104 | void SetEmissiveColor( const Ogre::Vector4& color ); |
|---|
| 105 | void SetEmissiveColor( const Ogre::Vector3& color ); |
|---|
| 106 | void SetEmissiveColor( float r, float g, float b, float a=1.0f ); |
|---|
| 107 | |
|---|
| 108 | void SetSpecularLevel( float level ); |
|---|
| 109 | void SetGlosiness( float glossiness ); |
|---|
| 110 | void SetOpacity( float opacity ); |
|---|
| 111 | |
|---|
| 112 | void Set2Sided( bool b2Sided ); |
|---|
| 113 | void SetWired( bool bWired ); |
|---|
| 114 | void SetFaceted( bool bFaceted ); |
|---|
| 115 | |
|---|
| 116 | |
|---|
| 117 | private: |
|---|
| 118 | |
|---|
| 119 | // Name |
|---|
| 120 | Ogre::String m_sName; |
|---|
| 121 | |
|---|
| 122 | // Parent name |
|---|
| 123 | Ogre::String m_sParentName; |
|---|
| 124 | |
|---|
| 125 | // Ambient color |
|---|
| 126 | Ogre::ColourValue m_vAmbientColor; |
|---|
| 127 | |
|---|
| 128 | // Diffuse color |
|---|
| 129 | Ogre::ColourValue m_vDiffuseColor; |
|---|
| 130 | |
|---|
| 131 | // Specular color |
|---|
| 132 | Ogre::ColourValue m_vSpecularColor; |
|---|
| 133 | |
|---|
| 134 | // Emissive color |
|---|
| 135 | Ogre::ColourValue m_vEmissiveColor; |
|---|
| 136 | |
|---|
| 137 | // Specular level |
|---|
| 138 | float m_fSpecularLevel; |
|---|
| 139 | |
|---|
| 140 | // Glossiness |
|---|
| 141 | float m_fGlossiness; |
|---|
| 142 | |
|---|
| 143 | // Opacity |
|---|
| 144 | float m_fOpacity; |
|---|
| 145 | |
|---|
| 146 | // Emissive Strength |
|---|
| 147 | float m_fEmmisiveStrength; |
|---|
| 148 | |
|---|
| 149 | // 2-Sided |
|---|
| 150 | bool m_b2Sided; |
|---|
| 151 | |
|---|
| 152 | // Wire Framed |
|---|
| 153 | bool m_bWire; |
|---|
| 154 | |
|---|
| 155 | // Faceted |
|---|
| 156 | bool m_bFaceted; |
|---|
| 157 | |
|---|
| 158 | // Texture map |
|---|
| 159 | std::map< Ogre::String, STextureMapInfo > m_lTextureMaps; |
|---|
| 160 | |
|---|
| 161 | // Mask used for determining materials with same texture usage |
|---|
| 162 | short m_Mask; |
|---|
| 163 | |
|---|
| 164 | }; |
|---|
| 165 | |
|---|
| 166 | // |
|---|
| 167 | |
|---|
| 168 | #endif // __NDS_LexiExporter_IntermediateMaterial__ |
|---|