Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/Tools/3dsmaxExport/OgreExport/include/OgreExport.h @ 6

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

=…

File size: 9.1 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
30
31#include "OgreMaxConfig.h"
32#include "OgreMaxMaterialExport.h"
33#include "OgreMaxMeshExport.h"
34#include "OgreMaxMeshXMLExport.h"
35
36class OgreMaxExport;
37
38INT_PTR CALLBACK ExportPropertiesDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
39INT_PTR CALLBACK GeneralTabDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
40INT_PTR CALLBACK MeshTabDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
41INT_PTR CALLBACK SkeletalAnimationTabDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
42INT_PTR CALLBACK VertexAnimationTabDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
43INT_PTR CALLBACK MaterialTabDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
44
45// utility functions -- we do these a lot, nice to be able to shortcut them
46inline void disableControl(HWND dlg, INT id) { EnableWindow(GetDlgItem(dlg, id), FALSE); }
47inline void enableControl(HWND dlg, INT id) { EnableWindow(GetDlgItem(dlg, id), TRUE); }
48
49// export dialog tab pane handlers -- we delegate the processing of tab pane events to classes because it gets messy
50// in a hurry if we try to handle all of this in a huge monolithic case statement
51
52class OgreMaxExport_TabPaneHandler {
53public:
54        HWND getDialogHandle() { return m_hDlg; }
55        void setExportInterface(ExpInterface* ei, Interface* i) { m_ei = ei; m_i = i; }
56        virtual void onInitDialog(HWND hDlg) { m_hDlg = hDlg; }
57        virtual void update() = 0;
58
59protected:
60        HWND m_hDlg;
61        ExpInterface* m_ei;
62        Interface* m_i;
63};
64
65class OgreMaxExport_General : public OgreMaxExport_TabPaneHandler {
66        // this contains the switch/case statement that fires the events that this class handles
67        friend INT_PTR CALLBACK GeneralTabDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
68
69public:
70        // config holds all of the settings
71        OgreMaxExport_General(OgreMax::Config& config, OgreMaxExport* e) : m_config(config), m_exp(e) { }
72        virtual ~OgreMaxExport_General() {}
73
74        // all dialog handlers need to do this -- on demand, read data from their panes
75        void update();
76
77        // all dialog handlers need to catch the WM_DESTROY message too
78        void onDestroy();
79
80        // event handlers
81        void onInitDialog(HWND hDlg);
82        void onExportDirectoryChanged(const std::string& newDirectory);
83        void onInvertYZ(bool checked);
84        void onSetScale(float newScale);
85
86private:
87        OgreMax::Config& m_config;
88        OgreMaxExport* m_exp;
89};
90
91class OgreMaxExport_Mesh : public OgreMaxExport_TabPaneHandler {
92        // this contains the switch/case statement that fires the events that this class handles
93        friend INT_PTR CALLBACK MeshTabDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
94
95public:
96        // config holds all of the settings
97        OgreMaxExport_Mesh(OgreMax::Config& config, OgreMaxExport* e) : m_config(config), m_exp(e) { }
98        virtual ~OgreMaxExport_Mesh() {}
99
100        // all dialog handlers need to do this -- on demand, read data from their panes
101        void update();
102
103        // all dialog handlers need to catch the WM_DESTROY message too
104        void onDestroy();
105
106        // event handlers
107        void onInitDialog(HWND hDlg);
108        void onClickBinaryMesh();
109
110protected:
111        // internal utils
112        void setControlStates();
113
114private:
115        OgreMax::Config& m_config;
116        OgreMaxExport* m_exp;
117};
118
119class OgreMaxExport_SkeletalAnimation : public OgreMaxExport_TabPaneHandler {
120        // this contains the switch/case statement that fires the events that this class handles
121        friend INT_PTR CALLBACK SkeletalAnimationTabDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
122
123public:
124        // config holds all of the settings
125        OgreMaxExport_SkeletalAnimation(OgreMax::Config& config, OgreMaxExport* e) : m_config(config), m_exp(e) { }
126        virtual ~OgreMaxExport_SkeletalAnimation() {}
127
128        // all dialog handlers need to do this -- on demand, read data from their panes
129        void update();
130
131        // all dialog handlers need to catch the WM_DESTROY message too
132        void onDestroy();
133
134        // event handlers
135        void onInitDialog(HWND hDlg);
136        void onAddAnimation();
137        void onDeleteAnimation();
138
139protected:
140        // utility methods
141        void addAnimation();
142        void deleteAnimation();
143
144private:
145        OgreMax::Config& m_config;
146        OgreMaxExport* m_exp;
147};
148
149class OgreMaxExport_VertexAnimation : public OgreMaxExport_TabPaneHandler {
150        // this contains the switch/case statement that fires the events that this class handles
151        friend INT_PTR CALLBACK VertexAnimationTabDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
152
153public:
154        // config holds all of the settings
155        OgreMaxExport_VertexAnimation(OgreMax::Config& config, OgreMaxExport* e) : m_config(config), m_exp(e) { }
156        virtual ~OgreMaxExport_VertexAnimation() {}
157
158        // all dialog handlers need to do this -- on demand, read data from their panes
159        void update();
160
161        // all dialog handlers need to catch the WM_DESTROY message too
162        void onDestroy();
163
164        // event handlers
165        void onInitDialog(HWND hDlg);
166
167private:
168        OgreMax::Config& m_config;
169        OgreMaxExport* m_exp;
170};
171
172class OgreMaxExport_Material : public OgreMaxExport_TabPaneHandler {
173        // this contains the switch/case statement that fires the events that this class handles
174        friend INT_PTR CALLBACK MaterialTabDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
175
176public:
177        // config holds all of the settings
178        OgreMaxExport_Material(OgreMax::Config& config, OgreMaxExport* e) : m_config(config), m_exp(e) { }
179        virtual ~OgreMaxExport_Material() {}
180
181        // all dialog handlers need to do this -- on demand, read data from their panes
182        void update();
183
184        // all dialog handlers need to catch the WM_DESTROY message too
185        void onDestroy();
186
187        // event handlers
188        void onInitDialog(HWND hDlg);
189
190private:
191        OgreMax::Config& m_config;
192        OgreMaxExport* m_exp;
193};
194
195class OgreMaxExport : public SceneExport { 
196
197        friend INT_PTR CALLBACK ExportPropertiesDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
198        friend class OgreMaxExport_General;
199        friend class OgreMaxExport_Mesh;
200        friend class OgreMaxExport_SkeletalAnimation;
201        friend class OgreMaxExport_VertexAnimation;
202        friend class OgreMaxExport_Material;
203
204public:
205        OgreMaxExport(HINSTANCE hInst);
206        virtual ~OgreMaxExport();
207        virtual int ExtCount();                                 // Number of extemsions supported
208        virtual const TCHAR * Ext(int n);                                       // Extension #n (i.e. "3DS")
209        virtual const TCHAR * LongDesc();                                       // Long ASCII description (i.e. "Autodesk 3D Studio File")
210        virtual const TCHAR * ShortDesc();                              // Short ASCII description (i.e. "3D Studio")
211        virtual const TCHAR * AuthorName();                             // ASCII Author name
212        virtual const TCHAR * CopyrightMessage();                       // ASCII Copyright message
213        virtual const TCHAR * OtherMessage1();                  // Other message #1
214        virtual const TCHAR * OtherMessage2();                  // Other message #2
215        virtual unsigned int Version();                                 // Version number * 100 (i.e. v3.01 = 301)
216        virtual void ShowAbout(HWND hWnd);              // Show DLL's "About..." box
217        virtual int     DoExport(const TCHAR *name,ExpInterface *ei,Interface *i, BOOL suppressPrompts=FALSE, DWORD options=0); // Export file
218        virtual BOOL SupportsOptions(int ext, DWORD options); // Returns TRUE if all option bits set are supported for this extension
219
220protected:
221        OgreMax::Config m_config;
222        OgreMax::MaterialMap m_materialMap;
223
224        HINSTANCE m_hInstance;
225        HWND m_hWndDlgExport;
226        OgreMaxExport_TabPaneHandler* m_tabDisplay;
227
228        // Export implementations
229        OgreMax::MeshExporter m_meshExporter;
230        OgreMax::MeshXMLExporter m_meshXMLExporter;
231        OgreMax::MaterialExporter m_materialExporter;
232
233        // Property Page Dialog Handlers
234        OgreMaxExport_General m_tabGeneral;
235        OgreMaxExport_Mesh m_tabMesh;
236        OgreMaxExport_SkeletalAnimation m_tabSkeletalAnimation;
237        OgreMaxExport_VertexAnimation m_tabVertexAnimation;
238        OgreMaxExport_Material m_tabMaterial;
239
240        // utility methods
241        BOOL setupExportProperties();
242        bool export();
243
244        // properties page message handlers
245        void onTabSelectChange(HWND hTabControl, INT iTabId);
246};
247
248class OgreMaxExportClassDesc : public ClassDesc {
249public:
250        int IsPublic();
251        void * Create(BOOL loading = FALSE);
252        const TCHAR * ClassName();
253        SClass_ID SuperClassID();
254        Class_ID ClassID();
255        const TCHAR* Category();
256};
Note: See TracBrowser for help on using the repository browser.