00001 /* 00002 Copyright (C) 2002 Malte Weiß, Carsten Winkelholz 00003 00004 Malte Weiß, 01.08.2002: Texture manager class developed. 00005 00006 Address: FGAN Forschungsgesellschaft fr Angewandte Naturwissenschaften e. V. 00007 Neuenahrer Str. 20 00008 D - 53343 Wachtberg 00009 00010 Email: winkelholz@fgan.de 00011 00012 This program is free software; you can redistribute it and/or 00013 modify it under the terms of the GNU General Public License 00014 as published by the Free Software Foundation; either version 2 00015 of the License, or (at your option) any later version. 00016 00017 This program is distributed in the hope that it will be useful, 00018 but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 GNU General Public License for more details. 00021 00022 You should have received a copy of the GNU General Public License 00023 along with this program; if not, write to the Free Software 00024 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00025 */ 00026 00027 00028 #ifndef CYBTEXTUREMANAGERC_H 00029 #define CYBTEXTUREMANAGERC_H 00030 00031 #include "oaw/misc/stringc.h" 00032 #include "oaw/misc/urlc.h" 00033 #include "../oawconfig.h" 00034 00035 OAW_BEGIN_NAMESPACE 00036 00037 00038 //#include <stdio.h> 00039 00040 // Structure for a texture 00041 00042 typedef struct _Texture 00043 { 00044 // File information 00045 UrlC urlFile; // URL 00046 StringC strName; // Name 00047 00048 // Image properties 00049 long lWidth, lHeight, lChannels; 00050 unsigned char *pBuffer; 00051 00052 unsigned int nRef; // Reference counter 00053 unsigned int nId; // Id 00054 00055 // Next texture 00056 _Texture *pNext; 00057 } Texture; 00058 00059 // Type definitions 00060 00061 typedef Texture* TEXTURE; 00062 00063 // Class definition 00064 00065 class CybWorldC; 00066 class CybPixelImageC; 00067 00068 class OAW_DLLMAPPING CybTextureManagerC 00069 { 00070 public: 00071 CybTextureManagerC(CybWorldC *pParent); 00072 ~CybTextureManagerC(); 00073 00074 protected: 00075 char DeleteEntry (Texture* pTexture); 00076 TEXTURE FindByName (const StringC &strName); 00077 00078 public: 00079 virtual TEXTURE LoadFromUrl (const char *pUrl); 00080 virtual char SetTexture (const TEXTURE&) { return 0; } 00081 virtual void UnloadTexture (TEXTURE &pTexture); 00082 virtual CybPixelImageC* CreateImage(); 00083 virtual void LoadTextureFromPng(CybPixelImageC*,FILE*); 00084 virtual void LoadTextureFromJpeg(CybPixelImageC*,FILE*); 00085 00086 protected: 00087 CybWorldC *m_pWorld; // Pointer to world parent 00088 00089 Texture *m_pTextureRoot; // Texture root 00090 }; 00091 00092 OAW_END_NAMESPACE 00093 00094 00095 #endif 00096 00097 00098 00099
1.3-rc2