texture manager update + updating panoramic camera

This commit is contained in:
vladislav.khorev committed 2013-04-18 20:21:19 +00:00
1 parent 8fdd1da938
commit c657c91851
11 files changed
+581 -193

No files matched your search

+72 -68
View File
@@ -38,13 +38,83 @@ bool findString(char* in, char* list);
bool IsFileExistsInUserData(const std::string& filename);
std::string GetFilePathUserData(const std::string& filename);
//utitily to process texture uploading
inline char* GetFileName(const char* filename)
{
char* fname = (char*)filename + strlen(filename);
while ((*fname != '\\')&&(*fname != '/')&&(fname >= filename ))
--fname;
++fname;
return fname;
}
inline std::string GetFileName(const std::string& filename)
{
std::string::const_iterator i = filename.end() - 1;
while ((i > filename.begin() )&&(*i != '\\')&&(*i != '/'))
--i;
if (*i == '\\' || *i == '/')
{
i++;
}
return std::string(i, filename.end());
}
//utitily to process texture uploading
inline char* GetFileExt(const char* filename)
{
char* fext = (char*)filename + strlen(filename);
while (*fext != '.')
--fext;
return fext;
}
inline std::string GetFileExt(const std::string& filename)
{
std::string::const_iterator i = filename.end() - 1;
while (*i != '.')
--i;
return std::string(i, filename.end());
}
inline std::string GetFileNameWithoutExt(const std::string& filename)
{
std::string result = GetFileName(filename);
std::string::const_iterator i = result.end() - 1;
while (*i != '.')
--i;
return std::string(result.begin(), i);
}
std::string GetFilePath(const std::string& filename);
#ifdef TARGET_WIN32
void GetFileList(const std::string& searchkey, std::vector<std::string> &list);
std::string AutocompleteExtension(const std::string& fileName);
template<typename TYPENAME>
boost::shared_array<TYPENAME> CreateMemFromFile(const std::string& fileName, cardinal& intCount)
{
@@ -57,11 +127,9 @@ boost::shared_array<TYPENAME> CreateMemFromFile(const std::string& fileName, car
size_t result;
TYPENAME* fileData;
std::string realFileName = fileName;
if (fopen_s(&pFile, realFileName.c_str(), "rb" ) != 0)
if (fopen_s(&pFile, fileName.c_str(), "rb" ) != 0)
{
throw ErrorToLog("File not loaded: " + fileName);
}
@@ -196,70 +264,6 @@ boost::shared_array<TYPENAME> CreateMemFromFile(const std::string& fileName, car
#endif
//utitily to process texture uploading
inline char* GetFileName(const char* filename)
{
char* fname = (char*)filename + strlen(filename);
while ((*fname != '\\')&&(*fname != '/')&&(fname >= filename ))
--fname;
++fname;
return fname;
}
inline std::string GetFileName(const std::string& filename)
{
std::string::const_iterator i = filename.end() - 1;
while ((i > filename.begin() )&&(*i != '\\')&&(*i != '/'))
--i;
if (*i == '\\' || *i == '/')
{
i++;
}
return std::string(i, filename.end());
}
//utitily to process texture uploading
inline char* GetFileExt(const char* filename)
{
char* fext = (char*)filename + strlen(filename);
while (*fext != '.')
--fext;
return fext;
}
inline std::string GetFileExt(const std::string& filename)
{
std::string::const_iterator i = filename.end() - 1;
while (*i != '.')
--i;
return std::string(i, filename.end());
}
inline std::string GetFileNameWithoutExt(const std::string& filename)
{
std::string result = GetFileName(filename);
std::string::const_iterator i = result.end() - 1;
while (*i != '.')
--i;
return std::string(result.begin(), i);
}
std::string GetFilePath(const std::string& filename);
#ifdef TARGET_IOS
//Special for IOS, because Foundation.h conflicts with sq_plus.h
+16
View File
@@ -0,0 +1,16 @@
#ifndef JPEG_HELPER_H_INCLUDED
#define JPEG_HELPER_H_INCLUDED
#include <string>
namespace SE
{
struct TTextureData; // Find it in SalmonTexture.h
bool LoadJpg(const std::string& filename, TTextureData& texData);
} //namespace SE
#endif //JPEG_HELPER_H_INCLUDED
+55
View File
@@ -0,0 +1,55 @@
#ifndef TGA_LOADER_H_INCLUDED
#define TGA_LOADER_H_INCLUDED
#include "include/Utils/Utils.h"
//Thanks to NeHe
namespace SE
{
const int CONST_TGA_OUTER_HEADER_SIZE = 12;
typedef struct
{
GLubyte Header[CONST_TGA_OUTER_HEADER_SIZE]; // TGA File Header
} TGAHeader;
const int CONST_TGA_INNER_HEADER_SIZE = 6;
typedef struct
{
GLubyte header[CONST_TGA_INNER_HEADER_SIZE]; // First 6 Useful Bytes From The Header
GLuint bytesPerPixel; // Holds Number Of Bytes Per Pixel Used In The TGA File
GLuint imageSize; // Used To Store The Image Size When Setting Aside Ram
GLuint temp; // Temporary Variable
GLuint type;
GLuint Height; //Height of Image
GLuint Width; //Width ofImage
GLuint Bpp; // Bits Per Pixel
} TGA;
//TGAHeader tgaheader; // TGA header
//TGA tga; // TGA image data
extern GLubyte uTGAcompare[12]; // Uncompressed TGA Header
extern GLubyte cTGAcompare[12]; // Compressed TGA Header
struct TTextureData; // Find it in SalmonTexture.h
bool LoadTGA(const std::string& filename, TTextureData& texture);
bool LoadUncompressedTGA(TTextureData& texture, boost::shared_array<char> fTGA); // Load an Uncompressed file
bool LoadCompressedTGA(TTextureData& texture, boost::shared_array<char> fTGA); // Load a Compressed file
} //namespace SE
#endif //TGA_LOADER_H_INCLUDED