source: OGRE/trunk/ogrenew/Tools/MayaExport/shared/include/OgreMayaMaterial.h @ 657

Revision 657, 3.1 KB checked in by mattausch, 19 years ago (diff)

added ogre dependencies and patched ogre sources

Line 
1/*
2============================================================================
3This source file is part of the Ogre-Maya Tools.
4Distributed as part of Ogre (Object-oriented Graphics Rendering Engine).
5Copyright (C) 2003 Fifty1 Software Inc., Bytelords
6
7This program is free software; you can redistribute it and/or
8modify it under the terms of the GNU General Public License
9as published by the Free Software Foundation; either version 2
10of the License, or (at your option) any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this program; if not, write to the Free Software
19Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20or go to http://www.gnu.org/licenses/gpl.txt
21============================================================================
22*/
23#ifndef _OGREMAYA_MAT_H_
24#define _OGREMAYA_MAT_H_
25
26#include "OgreMayaCommon.h"
27
28#include <maya/MFnMesh.h>
29
30#include <fstream>
31
32#include <string>
33#include <list>
34#include <vector>
35
36namespace OgreMaya {
37   
38//    using namespace std;
39        using std::string;
40        using std::list;
41        using std::vector;
42
43    struct TextureUnitState {
44
45        TextureUnitState(string textureName, int uvSet):
46            textureName(textureName), uvSet(uvSet) {}
47
48        string textureName;
49        int uvSet;
50    };
51
52    typedef list<TextureUnitState> TextureLayerList;
53
54
55    struct Material {       
56
57        string name;
58        string shadingMode;
59       
60        ColourValue ambient;
61        ColourValue diffuse;
62        ColourValue selfIllumination;
63        ColourValue specular;
64
65        Real shininess;
66       
67        TextureLayerList textureLayers;
68    };
69
70        //      ===========================================================================
71        /** \class              MatGenerator
72                \author         John Van Vliet, Fifty1 Software Inc.
73                \version        1.0
74                \date           June 2003
75
76                Generates an Ogre material file from a Maya scene.
77        */     
78        //      ===========================================================================
79        class MatGenerator {
80        public:
81
82                /// Utility function for other classes
83                /// \return             Name of the material attached to the given mesh
84                static MString getMaterialName(MFnMesh &fnMesh);
85
86                /// Standard constructor.
87                MatGenerator();
88               
89                /// Destructor.
90                virtual ~MatGenerator();
91
92                /// Export the complete Maya scene (called by OgreMaya.mll or OgreMaya.exe).
93                bool exportAll();
94
95                /// Export selected parts of the Maya scene (called by OgreMaya.mll).
96                bool exportSelection();
97
98        protected:
99        vector<Material*> materials;
100
101                bool _extractMaterials();
102                void _makeMaterials(MObject &ShaderSet);
103                Material* _makePhongMaterial(MObject &ShaderNode);
104                Material* _makeBlinnMaterial(MObject &ShaderNode);
105                Material* _makeLambertMaterial(MObject &ShaderNode);
106        };
107
108} // namespace OgreMaya
109
110#endif
Note: See TracBrowser for help on using the repository browser.