00001 00014 /*************************************************************************** 00015 * Copyright (C) 2007 by Jan Koci * 00016 * honza.koci@email.cz * 00017 * http://kengine.sourceforge.net/tutorial/ 00018 * * 00019 * This program is free software; you can redistribute it and/or modify * 00020 * it under the terms of the GNU General Public License as published by * 00021 * the Free Software Foundation; either version 2 of the License, or * 00022 * (at your option) any later version. * 00023 * * 00024 * This program is distributed in the hope that it will be useful, * 00025 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00027 * GNU General Public License for more details. * 00028 * * 00029 * You should have received a copy of the GNU General Public License * 00030 * along with this program; if not, write to the * 00031 * Free Software Foundation, Inc., * 00032 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00033 ***************************************************************************/ 00034 00035 #pragma once 00036 00037 #include "../K3dStream.h" 00038 #include "../../Graphics/K3dTextureObj.h" 00039 #include "../../Script/K3dLua.h" 00040 00041 #include <SDL/SDL.h> 00042 #include <SDL/SDL_opengl.h> 00043 #include <SDL/SDL_image.h> 00044 00045 #define K_MAX_TEXTURES 2000 00046 00047 00048 class K3dTextureBuild 00049 { 00050 K3dGameData *m_pGameData; 00051 int m_iWidth; 00052 int m_iHeight; 00053 00054 bool SwapSurfaceRows ( SDL_Surface *_ptSurface ); 00056 GLuint CreateTexture ( SDL_Surface *_ptSurface ); 00057 public: 00058 00059 K3dTextureBuild ( K3dGameData *_pGameData ); 00060 ~K3dTextureBuild(); 00061 00062 void LoadTextures(); 00063 int FindTextureId ( const char* _strName ); 00065 GLuint CreateTexture ( const char* _strFileName ); 00066 00069 int GetTextureWidth() 00070 { 00071 return m_iWidth; 00072 } 00075 int GetTextureHeight() 00076 { 00077 return m_iHeight; 00078 } 00079 00080 void DeleteTextures(); 00081 }; 00082