| 1 | /* |
| 2 | Copyright (C) 2001-2006, William Joseph. |
| 3 | All Rights Reserved. |
| 4 | |
| 5 | This file is part of GtkRadiant. |
| 6 | |
| 7 | GtkRadiant is free software; you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation; either version 2 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 12 | GtkRadiant is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with GtkRadiant; if not, write to the Free Software |
| 19 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ |
| 21 | |
| 22 | #include "ifilesystem.h" |
| 23 | #include "iimage.h" |
| 24 | |
| 25 | #include "jpeg.h" |
| 26 | #include "tga.h" |
| 27 | #include "bmp.h" |
| 28 | #include "pcx.h" |
| 29 | #include "dds.h" |
| 30 | #include "ktx.h" |
| 31 | |
| 32 | |
| 33 | #include "modulesystem/singletonmodule.h" |
| 34 | |
| 35 | class ImageDependencies : public GlobalFileSystemModuleRef |
| 36 | { |
| 37 | }; |
| 38 | |
| 39 | class ImageTGAAPI |
| 40 | { |
| 41 | _QERPlugImageTable m_imagetga; |
| 42 | public: |
| 43 | typedef _QERPlugImageTable Type; |
| 44 | STRING_CONSTANT( Name, "tga" ); |
| 45 | |
| 46 | ImageTGAAPI(){ |
| 47 | m_imagetga.loadImage = LoadTGA; |
| 48 | } |
| 49 | _QERPlugImageTable* getTable(){ |
| 50 | return &m_imagetga; |
| 51 | } |
| 52 | }; |
| 53 | |
| 54 | typedef SingletonModule<ImageTGAAPI> ImageTGAModule; |
| 55 | |
| 56 | ImageTGAModule g_ImageTGAModule; |
| 57 | |
| 58 | |
| 59 | class ImageJPGAPI |
| 60 | { |
| 61 | _QERPlugImageTable m_imagejpg; |
| 62 | public: |
| 63 | typedef _QERPlugImageTable Type; |
| 64 | STRING_CONSTANT( Name, "jpg" ); |
| 65 | |
| 66 | ImageJPGAPI(){ |
| 67 | m_imagejpg.loadImage = LoadJPG; |
| 68 | } |
| 69 | _QERPlugImageTable* getTable(){ |
| 70 | return &m_imagejpg; |
| 71 | } |
| 72 | }; |
| 73 | |
| 74 | typedef SingletonModule<ImageJPGAPI, ImageDependencies> ImageJPGModule; |
| 75 | |
| 76 | ImageJPGModule g_ImageJPGModule; |
| 77 | |
| 78 | |
| 79 | class ImageBMPAPI |
| 80 | { |
| 81 | _QERPlugImageTable m_imagebmp; |
| 82 | public: |
| 83 | typedef _QERPlugImageTable Type; |
| 84 | STRING_CONSTANT( Name, "bmp" ); |
| 85 | |
| 86 | ImageBMPAPI(){ |
| 87 | m_imagebmp.loadImage = LoadBMP; |
| 88 | } |
| 89 | _QERPlugImageTable* getTable(){ |
| 90 | return &m_imagebmp; |
| 91 | } |
| 92 | }; |
| 93 | |
| 94 | typedef SingletonModule<ImageBMPAPI, ImageDependencies> ImageBMPModule; |
| 95 | |
| 96 | ImageBMPModule g_ImageBMPModule; |
| 97 | |
| 98 | |
| 99 | class ImagePCXAPI |
| 100 | { |
| 101 | _QERPlugImageTable m_imagepcx; |
| 102 | public: |
| 103 | typedef _QERPlugImageTable Type; |
| 104 | STRING_CONSTANT( Name, "pcx" ); |
| 105 | |
| 106 | ImagePCXAPI(){ |
| 107 | m_imagepcx.loadImage = LoadPCX32; |
| 108 | } |
| 109 | _QERPlugImageTable* getTable(){ |
| 110 | return &m_imagepcx; |
| 111 | } |
| 112 | }; |
| 113 | |
| 114 | typedef SingletonModule<ImagePCXAPI, ImageDependencies> ImagePCXModule; |
| 115 | |
| 116 | ImagePCXModule g_ImagePCXModule; |
| 117 | |
| 118 | |
| 119 | class ImageDDSAPI |
| 120 | { |
| 121 | _QERPlugImageTable m_imagedds; |
| 122 | public: |
| 123 | typedef _QERPlugImageTable Type; |
| 124 | STRING_CONSTANT( Name, "dds" ); |
| 125 | |
| 126 | ImageDDSAPI(){ |
| 127 | m_imagedds.loadImage = LoadDDS; |
| 128 | } |
| 129 | _QERPlugImageTable* getTable(){ |
| 130 | return &m_imagedds; |
| 131 | } |
| 132 | }; |
| 133 | |
| 134 | typedef SingletonModule<ImageDDSAPI, ImageDependencies> ImageDDSModule; |
| 135 | |
| 136 | ImageDDSModule g_ImageDDSModule; |
| 137 | |
| 138 | |
| 139 | class ImageKTXAPI |
| 140 | { |
| 141 | _QERPlugImageTable m_imagektx; |
| 142 | public: |
| 143 | typedef _QERPlugImageTable Type; |
| 144 | STRING_CONSTANT( Name, "ktx" ); |
| 145 | |
| 146 | ImageKTXAPI(){ |
| 147 | m_imagektx.loadImage = LoadKTX; |
| 148 | } |
| 149 | _QERPlugImageTable* getTable(){ |
| 150 | return &m_imagektx; |
| 151 | } |
| 152 | }; |
| 153 | |
| 154 | typedef SingletonModule<ImageKTXAPI, ImageDependencies> ImageKTXModule; |
| 155 | |
| 156 | ImageKTXModule g_ImageKTXModule; |
| 157 | |
| 158 | |
| 159 | extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules( ModuleServer& server ){ |
| 160 | initialiseModule( server ); |
| 161 | |
| 162 | g_ImageTGAModule.selfRegister(); |
| 163 | g_ImageJPGModule.selfRegister(); |
| 164 | g_ImageBMPModule.selfRegister(); |
| 165 | g_ImagePCXModule.selfRegister(); |
| 166 | g_ImageDDSModule.selfRegister(); |
| 167 | g_ImageKTXModule.selfRegister(); |
| 168 | } |