00001 //============================================================================= 00002 // filename: RmPlugIn.h 00003 // 00004 // ATI Research, Inc. 00005 // 3D Application Research Group 00006 // 00007 // Description: Declaration file for plug-in interfaces for creation of RenderMonkey plug-ins 00008 // 00009 //============================================================================= 00010 // (C) 2004 ATI Research, Inc. All rights reserved. 00011 //============================================================================= 00012 00013 #ifndef _RM_CORE_PLUGIN_H_ 00014 #define _RM_CORE_PLUGIN_H_ 00015 00016 #include <Core/RmTypes.h> 00017 #include <Core/RmDefines.h> 00018 #include <Core/RmEffect.h> 00019 #include <Core/RmMesh.h> 00020 00021 00022 // Forward class declaration: 00023 class IRmPlugIn; 00024 00025 //============================================================================= 00033 //============================================================================= 00034 struct RmPlugInDescription 00035 { 00038 RmPlugInType plugInType; 00039 00041 RmPlugInID plugInID; 00042 00048 RmStringT supportedNodeTypes[RM_NODETYPE_COUNT]; 00049 00051 int nNumSupportedNodeTypes; 00052 00054 int nMajorSDKVersion; 00055 int nMinorSDKVersion; 00056 00058 RM_TCHAR strRenderAPIVersion[RM_NAME_SIZE]; 00059 00061 RM_TCHAR strName[ RM_NAME_SIZE ]; 00062 00063 }; // End of struct RmPlugInDescription declaration 00064 00065 00066 //.................................................................................................// 00067 //.................................................................................................// 00068 //.................................................................................................// 00069 // Hierarchy of plug-in interfaces in the application // 00070 // // 00071 // IRmPlugIn // 00072 // | // 00073 // |- IRmEditorPlugIn // 00074 // | | // 00075 // | |- IRmWorkspaceEditorPlugin // 00076 // | // 00077 // |- IRmEffectViewerPlugIn // 00078 // | // 00079 // |- IRmGeometryLoaderPlugIn // 00080 // | // 00081 // |- IRmImporterPlugIn // 00082 // | // 00083 // |- IRmExporterPlugIn // 00084 // | // 00085 // |- IRmGeneratorPlugIn // 00086 // // 00087 //.................................................................................................// 00088 //.................................................................................................// 00089 //.................................................................................................// 00090 00091 00092 //============================================================================= 00099 //============================================================================= 00100 class RM_API IRmPlugIn 00101 { 00102 public : 00103 //========================================================================== 00105 //========================================================================== 00106 virtual ~IRmPlugIn() {}; 00107 00108 //========================================================================== 00113 //========================================================================== 00114 virtual bool Init() = 0; 00115 00116 //========================================================================== 00121 //========================================================================== 00122 virtual void Uninitialize() = 0; 00123 00124 //========================================================================== 00128 //========================================================================== 00129 virtual const RmPlugInDescription& GetPlugInDescription() const = 0; 00130 00131 //========================================================================== 00143 //========================================================================== 00144 virtual int MessageHandler( int nMessageID, 00145 int nMessageData, 00146 int nMessageParameter = 0, 00147 const RmPlugInID* pRmPlugInID = NULL ) = 0; 00148 00149 //========================================================================== 00156 //========================================================================== 00157 virtual bool HasPropertyDlg() { return false; }; 00158 00159 //========================================================================== 00166 //========================================================================== 00167 virtual HWND AddPropertyDlg( HWND hParentWnd ) { return NULL; }; 00168 00169 }; // End of IRmPlugIn interface declaration 00170 00171 00172 //============================================================================= 00180 //============================================================================= 00181 class RM_API IRmEditorPlugIn : public IRmPlugIn 00182 { 00183 public : 00184 00185 //========================================================================== 00199 //========================================================================== 00200 virtual HWND EditNode( HWND hParentWindow, RmNode *pNode ) = 0; 00201 00202 }; // End of IRmEditorPlugIn interface declaration 00203 00204 //============================================================================= 00210 //============================================================================= 00211 class RM_API IRmEffectViewerPlugIn : public IRmPlugIn 00212 { 00213 public : 00214 00215 //========================================================================== 00220 //========================================================================== 00221 virtual void SetViewerUpdateMode( RmViewerUpdateMode updateMode ) = 0; 00222 00223 //========================================================================== 00227 //========================================================================== 00228 virtual RmViewerUpdateMode GetViewerUpdateMode() = 0; 00229 00230 //========================================================================== 00234 //========================================================================== 00235 virtual void UpdateScene() = 0; 00236 00237 //========================================================================== 00243 //========================================================================== 00244 virtual HWND CreateViewerWindow( HWND hParentWindow, RmEffect* pEffect ) = 0; 00245 00246 //========================================================================== 00247 // Retrieve window handle for the viewer window 00250 //========================================================================== 00251 virtual HWND GetViewerWindow() = 0; 00252 00253 }; // End of IRmEffectViewerPlugIn interface declaration 00254 00255 00256 //============================================================================= 00263 //============================================================================= 00264 class RM_API IRmImporterPlugIn : public IRmPlugIn 00265 { 00266 public : 00267 00268 //========================================================================== 00273 //========================================================================== 00274 virtual bool ImportNode( RmNode *pNodeToImportInto ) = 0; 00275 00276 }; // End of IRmImporterPlugIn interface declaration 00277 00278 00279 //============================================================================= 00286 //============================================================================= 00287 class RM_API IRmExporterPlugIn : public IRmPlugIn 00288 { 00289 public : 00290 00291 //========================================================================== 00296 //========================================================================== 00297 virtual bool ExportNode( RmNode *pNodeToExport ) = 0; 00298 00299 //========================================================================== 00308 //========================================================================== 00309 virtual RmExporterPlugInType GetExporterType() = 0; 00310 00311 }; // End of IRmExporterPlugIn interface declaration 00312 00313 00314 //============================================================================= 00323 //============================================================================= 00324 class RM_API IRmGeneratorPlugIn : public IRmPlugIn 00325 { 00326 public : 00327 00328 //========================================================================== 00343 //========================================================================== 00344 virtual bool GenerateData( RmNode *pNode, bool bSilentGenerate = false ) = 0; 00345 00346 }; // End of IRmGeneratorPlugIn interface declaration 00347 00348 00349 00350 00351 //============================================================================= 00359 //============================================================================= 00360 class RM_API IRmGeometryLoaderPlugIn : public IRmPlugIn 00361 { 00362 public : 00363 00364 //========================================================================== 00379 //========================================================================== 00380 virtual void GetSupportedExtensions( RmLinkedList<RmStringT> &formatDescriptions, 00381 RmLinkedList<RmStringT> &formatExtensions ) = 0; 00382 00383 //========================================================================== 00389 //========================================================================== 00390 virtual bool CanLoadGeometry( const RM_TCHAR *strFileName ) = 0; 00391 00392 //========================================================================== 00399 //========================================================================== 00400 virtual bool LoadGeometry( const RM_TCHAR *strFileName, 00401 RmMeshModelContainer *pModelContainer ) = 0; 00402 00403 }; // End of IRmGeometryLoaderPlugIn interface declaration 00404 00405 00406 //============================================================================= 00414 //============================================================================= 00415 class RM_API IRmTextureLoaderPlugIn : public IRmPlugIn 00416 { 00417 public : 00418 00419 //========================================================================== 00435 //========================================================================== 00436 virtual void GetSupportedExtensions( RmTextureType textureType, 00437 RmLinkedList<RmStringT> &formatDescriptions, 00438 RmLinkedList<RmStringT> &formatExtensions ) = 0; 00439 00440 //========================================================================== 00447 //========================================================================== 00448 virtual bool CanLoadTexture( RmTextureType textureType, 00449 const RM_TCHAR *strFileName ) = 0; 00450 00451 //========================================================================== 00459 //========================================================================== 00460 virtual bool LoadTexture( const RM_TCHAR *strFileName, 00461 RmTexture* pTexture, 00462 RmPixelFormatType format = RM_PIXELFORMAT_UNKNOWN ) = 0; 00463 }; // End of IRmTextureLoaderPlugIn interface declaration 00464 00465 00466 //============================================================================= 00472 //============================================================================= 00473 class RM_API IRmGeometryProcessorPlugIn : public IRmPlugIn 00474 { 00475 public : 00476 virtual void ProcessGeometry( const RmMeshModel *pInputMesh, RmMeshModel *pOutputMesh ) = 0; 00477 00478 }; // End of IRmGeometryProcessorPlugIn interface declaration 00479 00480 00481 //---------------------------------------------------------------------------------------------------// 00482 //---------------------------------------------------------------------------------------------------// 00483 // Each plug-in can have multiple instances of the actual plug-in associated with various nodes. // 00484 // For example, if we take the vector editor plug-in, it may have multiple instances (modules) // 00485 // existing at the same time if the user selected to edit multiple (say, 5) vectors at the same // 00486 // time. The developer implementing the plug-in may wish to manage individual instances in any // 00487 // way they choose, however, the RenderMonkey SDK provides a convenient method of managing these // 00488 // individual modules within a plug-in by using RmModule and RmModuleManager (see SDK documentation // 00489 // for more details). // 00490 //---------------------------------------------------------------------------------------------------// 00491 //---------------------------------------------------------------------------------------------------// 00492 00493 //============================================================================= 00499 //============================================================================= 00500 class RM_API RmModule 00501 { 00502 public : 00503 00505 RmModule(); 00506 00508 virtual ~RmModule(); 00509 00510 //========================================================================== 00513 //========================================================================== 00514 void SetTopNode( RmNode* pNode ); 00515 00516 //========================================================================== 00518 //========================================================================== 00519 const RmNode* GetTopNode() const { return m_pTopNode; }; 00520 RmNode* GetTopNode() { return m_pTopNode; }; 00521 00522 //========================================================================== 00525 //========================================================================== 00526 virtual void Shutdown() = 0; 00527 00528 //========================================================================== 00533 //========================================================================== 00534 virtual int MessageHandler( int nMessageID, 00535 int nMessageData, 00536 int nMessageParameter = 0, 00537 const RmPlugInID* pRmPlugInID = NULL ) = 0; 00538 00539 private : 00540 RmNode *m_pTopNode; 00541 00542 }; // End of RmModule class declaration 00543 00544 00545 //============================================================================= 00553 //============================================================================= 00554 class RM_API RmModuleManager 00555 { 00556 public : 00557 typedef RmLinkedList<RmModule*> ModuleList; 00558 typedef ModuleList::iterator ModuleListIterator; 00559 typedef ModuleList::const_iterator ModuleListConstIterator; 00560 00561 RmModuleManager(); 00562 virtual ~RmModuleManager(); 00563 00564 //========================================================================== 00567 //========================================================================== 00568 virtual void Init(); 00569 00570 //========================================================================== 00573 //========================================================================== 00574 virtual void Uninitialize(); 00575 00576 //========================================================================== 00580 //========================================================================== 00581 virtual RmModule* GetModule( RmNode *pNode ); 00582 00583 //========================================================================== 00585 //========================================================================== 00586 virtual void RegisterModule( RmModule* pModule ); 00587 00588 //========================================================================== 00592 //========================================================================== 00593 virtual void UnregisterModule( RmModule* pModule ); 00594 00595 //========================================================================== 00597 //========================================================================== 00598 ModuleListIterator BeginModule() { return m_moduleList.begin(); }; 00599 ModuleListConstIterator BeginModule() const { return m_moduleList.begin(); }; 00600 00601 ModuleListIterator EndModule() { return m_moduleList.end(); }; 00602 ModuleListConstIterator EndModule() const { return m_moduleList.end(); }; 00603 00604 //========================================================================== 00606 //========================================================================== 00607 ModuleListIterator EraseModuleItr( ModuleListIterator itr ); 00608 00609 //========================================================================== 00611 //========================================================================== 00612 int GetNumModules() const { return m_moduleList.size(); }; 00613 00614 //========================================================================== 00618 //========================================================================== 00619 virtual int MessageHandler( int nMessageID, 00620 int nMessageData, 00621 int nMessageParameter = 0, 00622 const RmPlugInID* pRmPlugInID = NULL ); 00623 00624 private : 00625 ModuleList m_moduleList; // List of opened modules 00626 00627 }; // End of RmModuleManager 00628 00629 00630 //.................................................................................................// 00631 //.................................................................................................// 00632 // Each plug-in library must export these functions from its DLL in order to function properly // 00633 //.................................................................................................// 00634 //.................................................................................................// 00635 #ifdef __cplusplus 00636 extern "C" { 00637 #endif 00638 00639 //============================================================================= 00643 //============================================================================= 00644 RM_API_EXPORT bool RmInitPlugInDLL(); 00645 00646 //============================================================================= 00650 //============================================================================= 00651 RM_API_EXPORT int RmGetNumPlugIns(); 00652 00653 //============================================================================= 00660 //============================================================================= 00661 RM_API_EXPORT void RmGetPlugIn( int nIndex, IRmPlugIn **ppPlugIn ); 00662 00663 //============================================================================= 00668 //============================================================================= 00669 RM_API_EXPORT void RmFreePlugIn( IRmPlugIn *pPlugIn ); 00670 00671 //============================================================================= 00675 //============================================================================= 00676 RM_API_EXPORT void RmUninitializePlugInDLL(); 00677 00678 #ifdef __cplusplus 00679 } 00680 #endif 00681 00682 #endif
1.3.6