1 | /*
|
---|
2 | -----------------------------------------------------------------------------
|
---|
3 | This source file is part of OGRE
|
---|
4 | (Object-oriented Graphics Rendering Engine)
|
---|
5 | For the latest info, see http://www.ogre3d.org/
|
---|
6 |
|
---|
7 | Copyright (c) 2000-2005 The OGRE Team
|
---|
8 | Also see acknowledgements in Readme.html
|
---|
9 |
|
---|
10 | This program is free software; you can redistribute it and/or modify it under
|
---|
11 | the terms of the GNU Lesser General Public License as published by the Free Software
|
---|
12 | Foundation; either version 2 of the License, or (at your option) any later
|
---|
13 | version.
|
---|
14 |
|
---|
15 | This program is distributed in the hope that it will be useful, but WITHOUT
|
---|
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
---|
17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
---|
18 |
|
---|
19 | You should have received a copy of the GNU Lesser General Public License along with
|
---|
20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
---|
21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to
|
---|
22 | http://www.gnu.org/copyleft/lesser.txt.
|
---|
23 | -----------------------------------------------------------------------------
|
---|
24 | */
|
---|
25 |
|
---|
26 | #include "max.h"
|
---|
27 | #include "plugapi.h"
|
---|
28 | #include "impexp.h"
|
---|
29 |
|
---|
30 | #include "OgreExport.h"
|
---|
31 |
|
---|
32 | static int controlsInit = FALSE;
|
---|
33 | static HINSTANCE hInstance;
|
---|
34 |
|
---|
35 | BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) {
|
---|
36 | hInstance = hinstDLL;
|
---|
37 |
|
---|
38 | if ( !controlsInit ) {
|
---|
39 | controlsInit = TRUE;
|
---|
40 |
|
---|
41 | // jaguar controls
|
---|
42 | InitCustomControls(hInstance);
|
---|
43 |
|
---|
44 | // initialize Chicago controls
|
---|
45 | InitCommonControls();
|
---|
46 | }
|
---|
47 | switch(fdwReason) {
|
---|
48 | case DLL_PROCESS_ATTACH:
|
---|
49 | //MessageBox(NULL,_T("3DSIMP.DLL: DllMain"),_T("3DSIMP"),MB_OK);
|
---|
50 | if (FAILED(CoInitialize(NULL)))
|
---|
51 | return FALSE;
|
---|
52 | break;
|
---|
53 | case DLL_THREAD_ATTACH:
|
---|
54 | break;
|
---|
55 | case DLL_THREAD_DETACH:
|
---|
56 | break;
|
---|
57 | case DLL_PROCESS_DETACH:
|
---|
58 | break;
|
---|
59 | }
|
---|
60 | return(TRUE);
|
---|
61 | }
|
---|
62 |
|
---|
63 |
|
---|
64 | //------------------------------------------------------
|
---|
65 | static OgreMaxExportClassDesc OgreMaxExportDescInst;
|
---|
66 |
|
---|
67 | int OgreMaxExportClassDesc::IsPublic() {
|
---|
68 | return 1;
|
---|
69 | }
|
---|
70 |
|
---|
71 | void * OgreMaxExportClassDesc::Create(BOOL loading) {
|
---|
72 | OgreMaxExport *inst = new OgreMaxExport(hInstance);
|
---|
73 | return inst;
|
---|
74 | }
|
---|
75 |
|
---|
76 | const TCHAR * OgreMaxExportClassDesc::ClassName() {
|
---|
77 | return _T("Ogre 3DSMax Exporter");
|
---|
78 | }
|
---|
79 |
|
---|
80 | SClass_ID OgreMaxExportClassDesc::SuperClassID() {
|
---|
81 | return SCENE_EXPORT_CLASS_ID;
|
---|
82 | }
|
---|
83 |
|
---|
84 | Class_ID OgreMaxExportClassDesc::ClassID() {
|
---|
85 | return Class_ID(0x2a961d1d, 0x8160db1);
|
---|
86 | }
|
---|
87 |
|
---|
88 | const TCHAR* OgreMaxExportClassDesc::Category() {
|
---|
89 | return _T("Ogre 3DSMax Exporter");
|
---|
90 | }
|
---|
91 |
|
---|
92 | extern "C" {
|
---|
93 | //------------------------------------------------------
|
---|
94 | // This is the interface to Jaguar:
|
---|
95 | //------------------------------------------------------
|
---|
96 |
|
---|
97 | // what does this DLL contain?
|
---|
98 | __declspec( dllexport ) const TCHAR *
|
---|
99 | LibDescription() {
|
---|
100 | return _T("Ogre 3DSMax Exporter");
|
---|
101 | }
|
---|
102 |
|
---|
103 | // how many plugin classes do we implement in this DLL?
|
---|
104 | __declspec( dllexport ) int
|
---|
105 | LibNumberClasses() {
|
---|
106 | return 1;
|
---|
107 | }
|
---|
108 |
|
---|
109 | // return a class descriptor class for each plugin class in this DLL;
|
---|
110 | // 0-based, so i==0 is the first plugin in this DLL, and so on
|
---|
111 | __declspec( dllexport ) ClassDesc *
|
---|
112 | LibClassDesc(int i) {
|
---|
113 | switch(i) {
|
---|
114 | case 0:
|
---|
115 | return &OgreMaxExportDescInst;
|
---|
116 | break;
|
---|
117 | default:
|
---|
118 | return 0;
|
---|
119 | break;
|
---|
120 | }
|
---|
121 | }
|
---|
122 |
|
---|
123 | // Return version so can detect obsolete DLLs
|
---|
124 | __declspec( dllexport ) ULONG
|
---|
125 | LibVersion() {
|
---|
126 | return VERSION_3DSMAX;
|
---|
127 | }
|
---|
128 |
|
---|
129 | // Let the plug-in register itself for deferred loading
|
---|
130 | __declspec( dllexport ) ULONG CanAutoDefer()
|
---|
131 | {
|
---|
132 | return 1;
|
---|
133 | }
|
---|
134 |
|
---|
135 | } |
---|