// 3 / 22 / 04 Forrest Briggs
// Loads a TGA texture image, borrowed code from nehe

#ifndef ctextureimage_h
#define ctextureimage_h

#include "ForwardDeclarations.h"
#include "OGLPlatformSpecific.h"
#include "cTriangle.h"

#include <stdio.h>			// Header File For Standard Input / Output
#include <stdarg.h>			// Header File For Variable Argument Routines
#include <string.h>			// Header File For String Management
#include <stdlib.h>

#include <vector>

class cTextureImage
{
public:
        bool loadTGA(char *filename, bool envMap);	// load a TGA file and return true if success	
        
        void bindGLTexture();		// tell open gl to bind this texture
        
        void unbindGLTexture();		// clean up if we were using env mapping
        
        // returns blue at x, y
        int getPixelB(int x, int y);
        
        ~cTextureImage();		// free image data
        
        // a vector of pointers to all of the triangles that have this texture
        vector<cTriangle*> trianglesWithThisTexture_;
        
	GLubyte	*imageData;		// Image Data (Up To 32 Bits)
	GLuint	bpp;			// Image Color Depth In Bits Per Pixel.
	GLuint	width;			// Image Width
	GLuint	height;			// Image Height
	GLuint	texID;			// Texture ID Used To Select A Texture
        GLuint	bytesPerPixel;		// Holds Number Of Bytes Per Pixel Used In The TGA File
        
        bool envMap_;
};				

#endif