Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/ogre/Tools/XSIExport/include/OgreXSIMaterialExporter.h @ 20

Last change on this file since 20 was 6, checked in by anonymous, 17 years ago

=…

File size: 4.3 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4(Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2006 Torus Knot Software Ltd
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23
24You may alternatively use this source under the terms of a specific version of
25the OGRE Unrestricted License provided you have obtained such a license from
26Torus Knot Software Ltd.
27-----------------------------------------------------------------------------
28*/
29#ifndef __XSIMATERIALEXPORTER_H__
30#define __XSIMATERIALEXPORTER_H__
31
32#include "OgreXSIHelper.h"
33#include "OgreBlendMode.h"
34#include "OgreMaterialSerializer.h"
35
36namespace Ogre {
37
38        class XsiMaterialExporter
39        {
40        public:
41                XsiMaterialExporter();
42                virtual ~XsiMaterialExporter();
43
44                /** Export a set of XSI materials to a material script.
45                @param materials List of materials to export
46                @param filename Name of the script file to create
47                @param copyTextures Whether to copy any textures used into the same
48                        folder as the material script.
49                */
50                void exportMaterials(MaterialMap& materials, TextureProjectionMap& texProjMap, 
51                        const String& filename, bool copyTextures);
52        protected:     
53                MaterialSerializer mMatSerializer;
54               
55                typedef std::multimap<long,TextureUnitState*> TextureUnitTargetMap;
56                /// Map of target id -> texture unit to match up tex transforms
57                TextureUnitTargetMap mTextureUnitTargetMap;
58                /// Pass queue, used to invert ordering
59                PassQueue mPassQueue;
60                /// Texture projection map
61                TextureProjectionMap mTextureProjectionMap;
62
63               
64                // Export a single material
65                void exportMaterial(MaterialEntry* matEntry, bool copyTextures, 
66                        const String& texturePath);
67                /// Fill in all the details of a pass
68                void populatePass(Pass* pass, XSI::Shader& xsishader);
69                /// Fill in the texture units - note this won't pick up transforms yet
70                void populatePassTextures(Pass* pass, PassEntry* passEntry, 
71                        bool copyTextures, const String& texturePath);
72                /// Find any texture transforms and hook them up via 'target'
73                void populatePassTextureTransforms(Pass* pass, XSI::Shader& xsishader);
74                /// Populate basic rejection parameters for the pass
75                void populatePassDepthCull(Pass* pass, XSI::Shader& xsishader);
76                /// Populate lighting parameters for the pass
77                void populatePassLighting(Pass* pass, XSI::Shader& xsishader);
78                /// Populate scene blending parameters for the pass
79                void populatePassSceneBlend(Pass* pass, XSI::Shader& xsishader);
80                void populatePassCgPrograms(Pass* pass, XSI::Shader& xsishader);
81                void populatePassHLSLPrograms(Pass* pass, XSI::Shader& xsishader);
82                void populatePassD3DAssemblerPrograms(Pass* pass, XSI::Shader& xsishader);
83                void populateOGLFiltering(TextureUnitState* tex, XSI::Shader& xsishader);
84                void populateDXFiltering(TextureUnitState* tex, XSI::Shader& xsishader);
85
86
87                // Utility method to get texture coord set from tspace_id name
88                unsigned short getTextureCoordIndex(const String& tspace);
89
90                /// Add a 2D texture from a shader
91                TextureUnitState* add2DTexture(Pass* pass, XSI::Shader& shader, 
92                        bool copyTextures, const String& targetFolder);
93                /// Add a cubic texture from a shader
94                TextureUnitState* addCubicTexture(Pass* pass, XSI::Shader& shader, 
95                        bool copyTextures, const String& targetFolder);
96
97
98                void clearPassQueue(void);
99
100                SceneBlendFactor convertSceneBlend(short xsiVal);
101                TextureUnitState::TextureAddressingMode convertAddressingMode(short xsiVal);
102                void convertTexGenOGL(TextureUnitState* tex, long xsiVal, XSI::Shader& shader);
103                void convertTexGenDX(TextureUnitState* tex, long xsiVal, XSI::Shader& shader);
104        };
105}
106
107#endif
108
109
Note: See TracBrowser for help on using the repository browser.