source: OGRE/trunk/ogrenew/Tools/3dsmaxExport/OgreExport/include/OgreExport.h @ 692

Revision 692, 4.9 KB checked in by mattausch, 19 years ago (diff)

adding ogre 1.2 and dependencies

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-2005 The OGRE Team
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-----------------------------------------------------------------------------
24*/
25
26#pragma once
27#include <string>
28#include <iosfwd>
29#include <map>
30#include <queue>
31#include <list>
32
33class Modifier;
34class INode;
35class IBipMaster;
36
37INT_PTR CALLBACK ExportPropertiesDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
38
39class OgreMaxExport : public SceneExport, public ITreeEnumProc {
40
41        typedef enum {
42                UV,
43                VW,
44                WU
45        } Tex2D;
46
47        typedef struct {
48                std::string name;
49                int start;
50                int end;
51        } NamedAnimation;
52
53        friend INT_PTR CALLBACK ExportPropertiesDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
54
55public:
56        OgreMaxExport(HINSTANCE hInst);
57        virtual ~OgreMaxExport();
58        virtual int ExtCount();                                 // Number of extemsions supported
59        virtual const TCHAR * Ext(int n);                                       // Extension #n (i.e. "3DS")
60        virtual const TCHAR * LongDesc();                                       // Long ASCII description (i.e. "Autodesk 3D Studio File")
61        virtual const TCHAR * ShortDesc();                              // Short ASCII description (i.e. "3D Studio")
62        virtual const TCHAR * AuthorName();                             // ASCII Author name
63        virtual const TCHAR * CopyrightMessage();                       // ASCII Copyright message
64        virtual const TCHAR * OtherMessage1();                  // Other message #1
65        virtual const TCHAR * OtherMessage2();                  // Other message #2
66        virtual unsigned int Version();                                 // Version number * 100 (i.e. v3.01 = 301)
67        virtual void ShowAbout(HWND hWnd);              // Show DLL's "About..." box
68        virtual int     DoExport(const TCHAR *name,ExpInterface *ei,Interface *i, BOOL suppressPrompts=FALSE, DWORD options=0); // Export file
69        virtual BOOL SupportsOptions(int ext, DWORD options); // Returns TRUE if all option bits set are supported for this extension
70
71        // ITreeEnumProc methods
72        int callback(INode *node);
73       
74protected:
75        bool m_exportMultipleFiles;
76        bool m_useSingleSkeleton;
77        bool m_rebuildNormals;
78        bool m_exportMaterial; // alernate is to use default material
79        bool m_skeletonLink;
80        std::string m_defaultMaterialName;
81        bool m_invertNormals;
82        bool m_flipYZ;
83        bool m_exportVertexColors;
84        float m_scale;
85        int m_fps;
86        std::list <NamedAnimation> m_animations;
87
88        Tex2D m_2DTexCoord;
89        std::string m_materialFilename;
90        std::string m_skeletonFilename;
91        std::queue< std::string > m_submeshNames;
92        std::map< std::string, Mtl * > m_materialMap;
93        std::list <INode *> m_nodeList;
94        std::map< std::string, int > m_boneIndexMap;
95        int m_currentBoneIndex;
96
97        HINSTANCE m_hInstance;
98        HWND m_hWndDlgExport;
99        std::string m_filename;
100        std::string m_exportPath;
101        std::string m_exportFilename;
102        bool m_exportOnlySelectedNodes;
103        ExpInterface *m_ei;
104        Interface *m_i;
105
106        // utility methods
107        void updateExportOptions(HWND hDlg);
108        bool export();
109        void addAnimation();
110        void deleteAnimation();
111
112        // mesh file stream functions
113        bool streamFileHeader(std::ostream &of);
114        bool streamFileFooter(std::ostream &of);
115        bool streamSubmesh(std::ostream &of, INode *node, std::string &mtlName);
116        bool streamMaterial(std::ostream &of);
117        bool streamPass(std::ostream &of, Mtl *mtl);
118        bool streamBoneAssignments(std::ostream &of, Modifier *mod, INode *node);
119        bool streamAnimTracks(std::ostream &of, TimeValue startFrame, TimeValue endFrame);
120        bool streamKeyframes(std::ostream &of, INode *node, Tab<TimeValue> &keyTimes, Interval &interval, Matrix3 &initTM);
121        bool streamBipedKeyframes(std::ostream &of, IBipMaster *bip, INode *node, Tab<TimeValue> &keyTimes, Interval &interval, Matrix3 &initTM);
122
123        // skeleton file stream functions
124        Modifier *FindPhysiqueModifier (INode* nodePtr);
125        int getBoneIndex(char *name);
126        bool streamSkeleton(std::ostream &of);
127        std::string removeSpaces(const std::string &s);
128};
129
130class OgreMaxExportClassDesc : public ClassDesc {
131public:
132        int IsPublic();
133        void * Create(BOOL loading = FALSE);
134        const TCHAR * ClassName();
135        SClass_ID SuperClassID();
136        Class_ID ClassID();
137        const TCHAR* Category();
138};
Note: See TracBrowser for help on using the repository browser.