#include <ExCTexture.h>
Graphe d'héritage de la classe ExCTexture
Membres publics | |
ExCTexture (void) | |
ExCTexture (std::string FileName) | |
~ExCTexture (void) | |
void | SetName (std::string Name) |
bool | LoadFile (std::string FileName) |
bool | SaveFile (std::string FileName, int width, int height) |
void | SetActive (void) |
GLuint | GetGlTextureId (void) |
void | SetAnisotropyLevel (bool state, int level) |
void | SetSGISMipMap (bool state) |
void | SetTextureCompression (bool state) |
void | SetFlux (std::ostrstream *consol, ExCFluxAction *action) |
virtual void | Draw (void) |
void | SetIdName (ExNihilo::IdName idname) |
ExNihilo::ExId | GetId (void) |
std::string | GetName (void) |
std::string | GetFileName (void) |
std::string | GetType (void) |
void | SetId (ExNihilo::ExId Id) |
void | SetFileName (std::string FileName) |
void | SetType (std::string Type) |
Attributs Publics | |
GLuint | m_Texture |
int | m_Compression |
ExCImageLoader * | m_Image |
std::ostrstream * | Consol |
ExCFluxAction * | FluxAction |
Attributs Protégés | |
PFNGLCOMPRESSEDTEXIMAGE3DARBPROC | glCompressedTexImage3DARB |
PFNGLCOMPRESSEDTEXIMAGE2DARBPROC | glCompressedTexImage2DARB |
PFNGLCOMPRESSEDTEXIMAGE1DARBPROC | glCompressedTexImage1DARB |
PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC | glCompressedTexSubImage3DARB |
PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC | glCompressedTexSubImage2DARB |
PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC | glCompressedTexSubImage1DARB |
PFNGLGETCOMPRESSEDTEXIMAGEARBPROC | glGetCompressedTexImageARB |
int | m_Anisotropy_level |
bool | m_Anisotropy |
bool | m_SGIS_Mimap |
bool | m_ARB_Texture_Compression |
ExNihilo::ExId | m_ObjectId |
std::string | m_ObjectName |
std::string | m_ObjectFileName |
std::string | m_ObjectType |
|
Définition à la ligne 27 du fichier ExCTexture.cpp. Références ExCTexture(), Guard, m_Anisotropy, m_Anisotropy_level, m_ARB_Texture_Compression, m_SGIS_Mimap, SetName(), ExCObject::SetType(), et UnGuard. Référencé par ExCTexture(), et ~ExCTexture().
00028 { 00029 Guard(ExCTexture::ExCTexture(void)) 00030 SetName("ExCTexture"); 00031 SetType(typeid(this).name()); 00032 m_Anisotropy_level=-1; 00033 m_Anisotropy=true; 00034 m_SGIS_Mimap=true; 00035 m_ARB_Texture_Compression=true; 00036 UnGuard 00037 } |
|
Définition à la ligne 39 du fichier ExCTexture.cpp. Références ExCTexture(), Guard, LoadFile(), SetName(), ExCObject::SetType(), et UnGuard.
|
|
Définition à la ligne 48 du fichier ExCTexture.cpp. Références ExCTexture(), Guard, et UnGuard.
00049 { 00050 Guard(ExCTexture::~ExCTexture(void)) 00051 UnGuard 00052 } |
|
|
Définition à la ligne 94 du fichier ExCObject.h. Références ExCObject::m_ObjectFileName. Référencé par ExManagerMap::InputAction().
00094 {return m_ObjectFileName;} |
|
Définition à la ligne 102 du fichier ExCTexture.h. Références m_Texture.
00102 {return m_Texture;} |
|
Définition à la ligne 92 du fichier ExCObject.h. Références ExNihilo::ExId, et ExCObject::m_ObjectId. Référencé par ExCSystemeParticule::CreateNewParticle(), ExManagerModel::Load(), ExManagerMesh::Load(), ExManagerId::RecordObject(), ExCObject3D::ShowInfo(), et ExCModelMD2::ShowInfo().
00092 {return m_ObjectId;} |
|
Définition à la ligne 93 du fichier ExCObject.h. Références ExCObject::m_ObjectName. Référencé par ExManagerTexture::Add(), ExManagerInterface::Load(), ExManagerEntity::LoadGroupe(), ExManagerId::RecordObject(), ExManagerCollision::ResolveCollision(), ExCObject3D::ShowInfo(), et ExCModelMD2::ShowInfo().
00093 {return m_ObjectName;} |
|
Définition à la ligne 95 du fichier ExCObject.h. Références ExCObject::m_ObjectType. Référencé par ExManagerId::RecordObject(), et ExManagerCollision::ResolveCollision().
00095 {return m_ObjectType;} |
|
Redéfinie à partir de ExCObject. Définition à la ligne 86 du fichier ExCTexture.cpp. Références BMP, ExCObject::Consol, DDS, glCompressedTexImage1DARB, glCompressedTexImage2DARB, glCompressedTexImage3DARB, glCompressedTexSubImage1DARB, glCompressedTexSubImage2DARB, glCompressedTexSubImage3DARB, glGetCompressedTexImageARB, Guard, LoadFile(), ExCImageLoader::LoadImage(), m_Anisotropy, m_Anisotropy_level, m_ARB_Texture_Compression, ExCImageLoader::m_channels, ExCImageLoader::m_data, ExCImageLoader::m_ddsFormat, ExCImageLoader::m_ddsNumMipmaps, m_Image, ExCObject::m_ObjectFileName, m_SGIS_Mimap, ExCImageLoader::m_sizeX, ExCImageLoader::m_sizeY, m_Texture, ExCImageLoader::m_TextureType, PCX, PPM, PREFIX, SetName(), TGA, et UnGuard. Référencé par ExCTexture(), et LoadFile().
00087 { 00088 Guard(ExCTexture::LoadFile(std::string FileName)) 00089 //std::cout<<"Fichier:"<<FileName<<std::endl; 00090 m_ObjectFileName=FileName; 00091 m_Image= new ExCImageLoader; 00092 int Type = GL_RGB; 00093 int offset = 0; 00094 int size=0; 00095 int blockSize =0; 00096 std::string StrPath; 00097 SetName(FileName); 00098 #ifdef UNIX_SRC 00099 StrPath=PREFIX "/ExNihilo/Data/Textures/"; 00100 #else 00101 StrPath="../Data/Textures/"; 00102 #endif 00103 00104 00105 glCompressedTexImage3DARB = (PFNGLCOMPRESSEDTEXIMAGE3DARBPROC)wglGetProcAddress("glCompressedTexImage3DARB"); 00106 glCompressedTexImage2DARB = (PFNGLCOMPRESSEDTEXIMAGE2DARBPROC)wglGetProcAddress("glCompressedTexImage2DARB"); 00107 glCompressedTexImage1DARB = (PFNGLCOMPRESSEDTEXIMAGE1DARBPROC)wglGetProcAddress("glCompressedTexImage1DARB"); 00108 glCompressedTexSubImage3DARB = (PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC)wglGetProcAddress("glCompressedTexSubImage3DARB"); 00109 glCompressedTexSubImage2DARB = (PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC)wglGetProcAddress("glCompressedTexSubImage2DARB"); 00110 glCompressedTexSubImage1DARB = (PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC)wglGetProcAddress("glCompressedTexSubImage1DARB"); 00111 glGetCompressedTexImageARB = (PFNGLGETCOMPRESSEDTEXIMAGEARBPROC)wglGetProcAddress("glGetCompressedTexImageARB"); 00112 00113 if(m_Image->LoadImage(StrPath+FileName)) 00114 { 00115 SetName(FileName); 00116 glGenTextures(1,&m_Texture); 00117 glBindTexture(GL_TEXTURE_2D,m_Texture); 00118 00119 00120 switch (m_Image->m_TextureType) 00121 { 00122 case BMP: 00123 //std::cout<<"Extension:BMP"<<std::endl; 00124 gluBuild2DMipmaps(GL_TEXTURE_2D, GL_COMPRESSED_RGB_ARB, m_Image->m_sizeX, m_Image->m_sizeY, 00125 GL_RGB, GL_UNSIGNED_BYTE, m_Image->m_data); 00126 m_ARB_Texture_Compression=true; 00127 break; 00128 case PCX: 00129 //std::cout<<"Extension:PCX"<<std::endl; 00130 gluBuild2DMipmaps(GL_TEXTURE_2D, GL_COMPRESSED_RGBA_ARB, m_Image->m_sizeX,m_Image->m_sizeY, 00131 GL_RGBA, GL_UNSIGNED_BYTE, m_Image->m_data); 00132 break; 00133 case TGA: 00134 //std::cout<<"Extension:TGA"<<std::endl; 00135 gluBuild2DMipmaps(GL_TEXTURE_2D, 00136 (m_Image->m_channels == 4) ? GL_COMPRESSED_RGBA_ARB : GL_COMPRESSED_RGB_ARB, 00137 m_Image->m_sizeX, m_Image->m_sizeY, 00138 Type, GL_UNSIGNED_BYTE, m_Image->m_data); 00139 m_ARB_Texture_Compression=true; 00140 break; 00141 case PPM: 00142 //std::cout<<"Extension:PPM"<<std::endl; 00143 gluBuild2DMipmaps(GL_TEXTURE_2D,GL_COMPRESSED_RGB_ARB, m_Image->m_sizeX, m_Image->m_sizeY, 00144 GL_RGB, GL_UNSIGNED_BYTE, m_Image->m_data); 00145 break; 00146 case DDS: 00147 //std::cout<<"Extension:DDS"<<std::endl; 00148 /* load the mipmaps */ 00149 blockSize = (m_Image->m_ddsFormat == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) ? 8 : 16;//if not dxt1 blocksize = 16 00150 for (int i = 0; i < m_Image->m_ddsNumMipmaps&& (m_Image->m_sizeX || m_Image->m_sizeY); ++i) 00151 { 00152 00153 if (m_Image->m_sizeX == 0)m_Image->m_sizeX = 1; 00154 if (m_Image->m_sizeY == 0)m_Image->m_sizeY = 1; 00155 size = ((m_Image->m_sizeX+3)/4)*((m_Image->m_sizeY+3)/4)*blockSize; 00156 00157 glCompressedTexImage2DARB(GL_TEXTURE_2D, i, m_Image->m_ddsFormat, m_Image->m_sizeX, m_Image->m_sizeY, 00158 0, size, m_Image->m_data ); 00159 00160 offset += size; 00161 m_Image->m_sizeX>>= 1; 00162 m_Image->m_sizeY >>= 1; 00163 m_ARB_Texture_Compression=false; 00164 //std::cout<<"Compression :"<<i<<" ";ExNihilo::ShowGlError(); 00165 } 00166 break; 00167 default: 00168 break; 00169 } 00170 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); 00171 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); 00172 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); 00173 //-------------------------------- 00174 //MIMAP SGIS EXTENSION 00175 //-------------------------------- 00176 if(m_SGIS_Mimap) 00177 { 00178 glHint(GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST); 00179 //std::cout<<"glHint m_SGIS_Mimap :"<<" ";ExNihilo::ShowGlError(); 00180 glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, true); 00181 //std::cout<<"GL_GENERATE_MIPMAP_SGIS :"<<" ";ExNihilo::ShowGlError(); 00182 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); 00183 //std::cout<<"GL_TEXTURE_MIN_FILTER :"<<" ";ExNihilo::ShowGlError(); 00184 }else 00185 { 00186 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR); 00187 } 00188 00189 //std::cout<<"Tex ID :"<<m_Texture<<std::endl; 00190 00191 00192 //-------------------------------- 00193 //ANISOTROPIC EXTENSION 00194 //-------------------------------- 00195 if(m_Anisotropy) 00196 { 00197 glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT,&m_Anisotropy_level); 00198 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, m_Anisotropy_level); 00199 //std::cout<<"m_Anisotropy :"<<" ";ExNihilo::ShowGlError(); 00200 } 00201 00202 //-------------------------------- 00203 //TEXTURE COMPRESSION EXTENSION 00204 //-------------------------------- 00205 00206 if(m_ARB_Texture_Compression) 00207 { 00208 00209 int compressed_size; 00210 int num_compressed_format; 00211 int * compressed_format = NULL; 00212 int compressed; 00213 int internalformat; 00214 unsigned char * img = NULL; 00215 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, &num_compressed_format); 00216 compressed_format = (int*)malloc(num_compressed_format * sizeof(int)); 00217 glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS_ARB, compressed_format); 00218 00219 // Check if the image has been compressed by GL 00220 glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED_ARB, &compressed); 00221 00222 // Query for the compressed internal format 00223 glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &internalformat); 00224 00225 // Query for the size of the compressed data texture buffer 00226 //glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_IMAGE_SIZE_ARB, &compressed_size); 00227 glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB, &compressed_size); 00228 00229 //std::cout<<"FileNAme:"<<FileName<<" Compressed: "<<compressed<<" Internal format: "<<internalformat<<" Compressed size: "<<compressed_size<<std::endl; 00230 // Allocate a buffer to host a copy of the compressed image data 00231 img = (unsigned char *)malloc(compressed_size * sizeof(unsigned char)); 00232 00233 // get the compressed data buffer 00234 glGetCompressedTexImageARB(GL_TEXTURE_2D, 0, img); 00235 //glBindTexture(GL_TEXTURE_2D,m_Texture); 00236 glCompressedTexImage2DARB(GL_TEXTURE_2D, 0, internalformat, m_Image->m_sizeX, m_Image->m_sizeY, 0, compressed_size, img); 00237 00238 delete img; 00239 delete compressed_format; 00240 //std::cout<<"m_ARB_Texture_Compression :"<<" ";ExNihilo::ShowGlError(); 00241 } 00242 delete m_Image->m_data; 00243 //ExNihilo::ShowGlError(); 00244 //std::cout<<"---------------------------------------------------------------"<<std::endl; 00245 return true; 00246 } 00247 00248 *Consol<<"ExCTexture Exception::unable to load file "<<FileName<<std::endl; 00249 delete m_Image; 00250 return false; 00251 UnGuard 00252 } |
|
Définition à la ligne 77 du fichier ExCTexture.cpp. Références Guard, m_Image, SaveFile(), ExCImageLoader::SaveImage(), et UnGuard. Référencé par ExManagerTexture::InputAction(), et SaveFile().
|
|
Définition à la ligne 68 du fichier ExCTexture.cpp. Références Guard, m_Texture, SetActive(), et UnGuard. Référencé par SetActive().
|
|
Définition à la ligne 103 du fichier ExCTexture.h. Références m_Anisotropy, et m_Anisotropy_level. Référencé par ExManagerTexture::Add().
00103 {m_Anisotropy=state;m_Anisotropy_level=level;} |
|
Définition à la ligne 98 du fichier ExCObject.h. Références ExCObject::m_ObjectFileName. Référencé par ExManagerModel::Load(), ExManagerMap::Load(), ExManagerEntity::Load(), ExCGizmoLineBezier::LoadFile(), ExCAnimation::LoadFile(), et ExManagerEntity::LoadGroupe().
00098 {m_ObjectFileName = FileName;} |
|
Définition à la ligne 66 du fichier ExCObject.cpp. Références ExCObject::Consol, et ExCObject::FluxAction. Référencé par ExManagerId::RecordObject().
00067 { 00068 Consol=consol; 00069 FluxAction=action; 00070 } |
|
Définition à la ligne 96 du fichier ExCObject.h. Références ExNihilo::ExId, et ExCObject::m_ObjectId. Référencé par ExCSystemeParticule::CreateNewParticle(), ExCObject::ExCObject(), ExManagerId::RecordObject(), et ExCObject::SetIdName().
00096 {m_ObjectId=Id;} |
|
Définition à la ligne 47 du fichier ExCObject.cpp. Références ExNihilo::IdName, ExCObject::SetId(), et ExCObject::SetName().
|
|
Redéfinie à partir de ExCObject. Définition à la ligne 54 du fichier ExCTexture.cpp. Références Guard, ExCObject::m_ObjectName, SetName(), et UnGuard. Référencé par ExCTexture(), LoadFile(), et SetName().
00055 { 00056 Guard(void ExCTexture::SetName(std::string Name)) 00057 if(Name.find(".")<Name.length())//if extension remove them 00058 { 00059 Name.erase(Name.find("."),Name.length()-Name.find(".")); 00060 m_ObjectName=Name; 00061 }else 00062 { 00063 m_ObjectName=Name; 00064 } 00065 UnGuard 00066 } |
|
Définition à la ligne 104 du fichier ExCTexture.h. Références m_SGIS_Mimap. Référencé par ExManagerTexture::Add().
00104 {m_SGIS_Mimap=state;} |
|
Définition à la ligne 105 du fichier ExCTexture.h. Références m_ARB_Texture_Compression. Référencé par ExManagerTexture::Add().
00105 {m_ARB_Texture_Compression=state;} |
|
|
Redéfinie dans ExCInterface, et ExCSystemeParticule. Définition à la ligne 75 du fichier ExCObject.h. Référencé par LoadFile(), et ExCObject::SetFlux(). |
|
Définition à la ligne 76 du fichier ExCObject.h. Référencé par ExCAnimation::Draw(), et ExCObject::SetFlux(). |
|
Définition à la ligne 74 du fichier ExCTexture.h. Référencé par LoadFile(). |
|
Définition à la ligne 73 du fichier ExCTexture.h. Référencé par LoadFile(). |
|
Définition à la ligne 72 du fichier ExCTexture.h. Référencé par LoadFile(). |
|
Définition à la ligne 77 du fichier ExCTexture.h. Référencé par LoadFile(). |
|
Définition à la ligne 76 du fichier ExCTexture.h. Référencé par LoadFile(). |
|
Définition à la ligne 75 du fichier ExCTexture.h. Référencé par LoadFile(). |
|
Définition à la ligne 78 du fichier ExCTexture.h. Référencé par LoadFile(). |
|
Définition à la ligne 81 du fichier ExCTexture.h. Référencé par ExCTexture(), LoadFile(), et SetAnisotropyLevel(). |
|
Définition à la ligne 80 du fichier ExCTexture.h. Référencé par ExCTexture(), LoadFile(), et SetAnisotropyLevel(). |
|
Définition à la ligne 83 du fichier ExCTexture.h. Référencé par ExCTexture(), LoadFile(), et SetTextureCompression(). |
|
Définition à la ligne 87 du fichier ExCTexture.h. |
|
Définition à la ligne 88 du fichier ExCTexture.h. Référencé par LoadFile(), et SaveFile(). |
|
Définition à la ligne 72 du fichier ExCObject.h. Référencé par ExCObject::GetFileName(), LoadFile(), et ExCObject::SetFileName(). |
|
Définition à la ligne 70 du fichier ExCObject.h. Référencé par ExCObject::GetId(), et ExCObject::SetId(). |
|
Définition à la ligne 71 du fichier ExCObject.h. Référencé par ExCObject::GetName(), ExCGroupEntity::LoadFile(), ExCEntity::LoadFile(), SetName(), et ExCObject::SetName(). |
|
Définition à la ligne 73 du fichier ExCObject.h. Référencé par ExCObject::GetType(), et ExCObject::SetType(). |
|
Définition à la ligne 82 du fichier ExCTexture.h. Référencé par ExCTexture(), LoadFile(), et SetSGISMipMap(). |
|
Définition à la ligne 86 du fichier ExCTexture.h. Référencé par GetGlTextureId(), ExManagerTexture::GetTextureId(), LoadFile(), et SetActive(). |