Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/Tools/3dsmaxExport/OgreExport/src/dllmain.cpp @ 6

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

=…

File size: 3.7 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#include "OgreExport.h"
31
32#include "max.h"
33#include "plugapi.h"
34#include "impexp.h"
35
36static int controlsInit = FALSE;
37static HINSTANCE hInstance;
38
39BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) {
40        hInstance = hinstDLL;
41        if ( !controlsInit ) {
42                controlsInit = TRUE;
43               
44                // jaguar controls
45                InitCustomControls(hInstance);
46
47                // initialize Chicago controls
48                InitCommonControls();
49                }
50        switch(fdwReason) {
51                case DLL_PROCESS_ATTACH:
52                        //MessageBox(NULL,_T("3DSIMP.DLL: DllMain"),_T("3DSIMP"),MB_OK);
53                        if (FAILED(CoInitialize(NULL)))
54                                return FALSE;
55                        break;
56                case DLL_THREAD_ATTACH:
57                        break;
58                case DLL_THREAD_DETACH:
59                        break;
60                case DLL_PROCESS_DETACH:
61                        break;
62                }
63        return(TRUE);
64        }
65
66
67//------------------------------------------------------
68static OgreMaxExportClassDesc OgreMaxExportDescInst;
69
70int OgreMaxExportClassDesc::IsPublic() {
71        return 1; 
72}
73
74void * OgreMaxExportClassDesc::Create(BOOL loading) { 
75        OgreMaxExport *inst = new OgreMaxExport(hInstance); 
76        return inst;
77}
78
79const TCHAR * OgreMaxExportClassDesc::ClassName() { 
80        return _T("Ogre 3DSMax Exporter"); 
81}
82
83SClass_ID OgreMaxExportClassDesc::SuperClassID() { 
84        return SCENE_EXPORT_CLASS_ID; 
85}
86
87Class_ID OgreMaxExportClassDesc::ClassID() { 
88        return Class_ID(0x2a961d1d, 0x8160db1); 
89}
90
91const TCHAR* OgreMaxExportClassDesc::Category() { 
92        return _T("Ogre 3DSMax Exporter"); 
93}
94
95
96TCHAR *GetString(int id)
97{
98        static TCHAR buf[256];
99
100        if (hInstance)
101                return LoadString(hInstance, id, buf, sizeof(buf)) ? buf : NULL;
102        return NULL;
103}
104
105extern "C" {
106//------------------------------------------------------
107// This is the interface to Jaguar:
108//------------------------------------------------------
109
110// what does this DLL contain?
111__declspec( dllexport ) const TCHAR *
112LibDescription() { 
113        return _T("Ogre 3DSMax Exporter"); 
114}
115
116// how many plugin classes do we implement in this DLL?
117__declspec( dllexport ) int
118LibNumberClasses() { 
119        return 1; 
120}
121
122// return a class descriptor class for each plugin class in this DLL;
123// 0-based, so i==0 is the first plugin in this DLL, and so on
124__declspec( dllexport ) ClassDesc *
125LibClassDesc(int i) {
126        switch(i) {
127                case 0: 
128                        return &OgreMaxExportDescInst; 
129                        break;
130                default: 
131                        return 0; 
132                        break;
133        }
134}
135
136// Return version so can detect obsolete DLLs
137__declspec( dllexport ) ULONG
138LibVersion() { 
139        return VERSION_3DSMAX; 
140}
141
142// Let the plug-in register itself for deferred loading
143__declspec( dllexport ) ULONG CanAutoDefer()
144{
145        return 1;
146}
147
148}
Note: See TracBrowser for help on using the repository browser.