#ifndef OAG_OAGTEXTURE_H
#define OAG_OAGTEXTURE_H
#ifdef _MSC_VER
#ifndef _WINDOWS_
#include <windows.h>
#endif
#endif
#ifdef _WIN32
#include <gl/gl.h>
#include <gl/glu.h>
#include "..\..\..\Common\include\OAGVector3f.h"
#include "..\..\..\IOSystem\include\FileSystemFilter.h"
#endif
typedef enum _OAG_TEXTURE_FILTER_TYPE{
txNoFilter = 0,
txBilinear = 1,
txTrilinear = 2,
}OAG_TEXTURE_FILTER_TYPE;
typedef struct _OAG_TEXTURE
{
GLubyte *imageData;
GLuint glTexture[1]; // Texture ID Used To Select A Texture
//glTextureFilterType glTexTureType; // Texture Format
GLuint Width; // Image Width
GLuint Height; // Image Height
GLuint Bpp; //Image Color Depth In Bits Per Pixel
GLuint Type;
GLenum format;
GLint internalFormat;
}OAG_TEXTURE;
typedef enum _OAG_TEXTURE_MAPPING
{
OAG_TEXTURE_NOT_DEFINED
,OAG_TEXTURE_MAP_RECT
,OAG_TEXTURE_MAP_TRIANGLE
}OAG_TEXTURE_MAPPING;
namespace oag
{
class OAGTexture
{
public:
OAGTexture(void);
virtual ~OAGTexture(void);
//Attributes
protected:
bool m_bIsTextureLoaded;
GLuint m_nWidth, m_nHeight;
int m_nVectorPos;
oag::OAGVector3f m_position;
oag::OAGVector3f m_TextureVertices;
OAG_TEXTURE m_glTexture;
BYTE m_RedAlphaMatch, m_GreenAlphaMatch, m_BlueAlphaMatch;
bool m_bApplyAlphaColor;
std::string m_strName;
std::string m_strFolderPath, m_strFilename;
public:
GLuint m_glTextureId;
OAG_TEXTURE_MAPPING m_enumTextureMapping;
std::vector<float> m_nTextureCoordinates;
std::vector<double> m_nTextureVertices;
int m_nNumberOfPoints;
//Operations
private:
public:
void CreateTextureVertices();
std::string GetFileName()
{
return m_strFilename;
}
//Gets the current name set for the texture
std::string GetTextureName()
{
return m_strName;
}
GLuint GetTextureWidth()
{
return m_nWidth;
}
GLuint GetTextureHeight()
{
return m_nHeight;
}
GLuint GetTextureId()
{
return m_glTextureId;
}
bool IsTextureLoaded()
{
return m_bIsTextureLoaded;
}
//Sets the position for the texture or translation
void SetPosition(oag::OAGVector3f vector)
{
m_position = vector;
}
//Sets the position for the texture or translation
void SetPosition(float x, float y, float z)
{
m_position.SetVertex(x, y, z);
}
//Sets a for the object
void SetTextureName(std::string strName)
{
m_strName = strName;
}
void SetTextureWidth(GLuint nWidth)
{
m_nWidth = nWidth;
}
void SetTextureHeight(GLuint nHeight)
{
m_nHeight = nHeight;
}
void SetIOSystemFilter(std::string folderPath, std::string fileName)
{
m_strFolderPath = folderPath;
m_strFilename = fileName;
}
//static
static std::string GetExtension (const std::string& pFile);
//virtual
protected:
public:
virtual bool LoadTextureFromDisk(std::string strFileName){ return false; } // Loads a file as a texture
virtual void CreateTextureCoordinates();
virtual void BuildTexture(){}
virtual void SetDefaultFilter(){}
//Filters
void SetFilterTexParameteri(GLenum target, GLenum pname, GLint param)
{
glTexParameteri(target, pname, param);
}
};
};
#endif //OAG_OAGTEXTURE_H