/*
  Copyright (C) 2010-2011  Charles Pence <charles@charlespence.net>
  Copyright (C) 1996-1997  Id Software, Inc.

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef R_TEXTURE_H__
#define R_TEXTURE_H__

#define TEXTURE_8BIT            0x00000001
#define TEXTURE_RGB             0x00000002
#define TEXTURE_RGBA            0x00000004
#define TEXTURE_MIPMAP          0x00000010
#define TEXTURE_CLAMP           0x00000020
#define TEXTURE_LUMA            0x00000100


extern void R_InitTextures(void);
extern void R_ShutdownTextures(void);

extern GLuint R_LoadTextureFromData(const std::string &identifier, byte *data, unsigned width, unsigned height, int flags);
extern GLuint R_LoadTextureFromFile(const std::string &filename, int flags);

// Pass this a filename without extension ("textures/sky1"), and it will return
// true if there is any loadable texture with that filename.  The extension
// will also be set.
qboolean R_TextureFileExists(const std::string &filebase, std::string &extension);

// Load texture for a model/sprite skin, with appropriate fallbacks.  modelname
// should be something like "progs/player.mdl".  skinnum can be -1 if there
// aren't skins/frames for this kind of model.
extern GLuint R_LoadModelTexture(const std::string &modelname, int skinnum, byte *data,
    unsigned width, unsigned height, int flags);

// Load texture for a BSP, with appropriate fallbacks.
extern GLuint R_LoadBSPTexture(const std::string &mapname, const std::string &texname,
    byte *data, unsigned width, unsigned height, int flags);

// Load texture from the WAD file, with appropriate fallbacks.
extern GLuint R_LoadWadTexture(const std::string &wadname, unsigned *wad_width, unsigned *wad_height);

// Load texture from a LMP file, with appropriate fallbacks.
extern GLuint R_LoadLumpTexture(const std::string &path, unsigned *file_width, unsigned *file_height);


#endif /* R_TEXTURE_H__ */
