Browse Source

Fixed rendering issues on tegra3

Tim Newell 12 years ago
parent
commit
7809aecaff

+ 3 - 1
engine/source/graphics/TextureManager.cc

@@ -392,7 +392,7 @@ void TextureManager::getSourceDestByteFormat(GBitmap *pBitmap, U32 *sourceFormat
 {
     *byteFormat = GL_UNSIGNED_BYTE;
     U32 byteSize = 1;
-#if defined(TORQUE_OS_IOS)
+#if defined(TORQUE_OS_IOS) || defined(TORQUE_OS_ANDROID)
     switch(pBitmap->getFormat()) 
     {
     case GBitmap::Intensity:
@@ -423,6 +423,7 @@ void TextureManager::getSourceDestByteFormat(GBitmap *pBitmap, U32 *sourceFormat
         *byteFormat   = GL_UNSIGNED_SHORT_5_5_5_1;
         byteSize = 1; // Incorrect but assume worst case.
         break;
+#ifdef TORQUE_OS_IOS
     case GBitmap::PVR2:
         *sourceFormat = GL_RGB;
         *byteFormat = GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
@@ -443,6 +444,7 @@ void TextureManager::getSourceDestByteFormat(GBitmap *pBitmap, U32 *sourceFormat
         *byteFormat = GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
         byteSize = 1; // Incorrect but assume worst case.
         break;
+#endif
     }
     *destFormat = *sourceFormat;
     *texelSize = byteSize;

+ 38 - 17
engine/source/platformAndroid/AndroidFileio.cpp

@@ -47,11 +47,32 @@
 //-----------------------------------------------------------------------------
 bool isCachePath(const char* path)
 {
-	//TODO: implement isCachePath
 	if (!path || !*path)
 	      return false;
 
-	return false;
+	if (path[0] == '/')
+	{
+		if (strstr(path, Platform::getUserDataDirectory()) != NULL)
+		{
+			return true;
+		}
+		else
+		{
+			return false;
+		}
+	}
+	else
+	{
+		const char* tmp = Platform::getUserDataDirectory();
+		if (strstr(path, tmp+1) != NULL)
+		{
+			return true;
+		}
+		else
+		{
+			return false;
+		}
+	}
 }
 
 //-----------------------------------------------------------------------------
@@ -121,7 +142,7 @@ File::~File()
 File::Status File::open(const char *filename, const AccessMode openMode)
 {
 	//If its a cache path then we need to open it using C methods not AssetManager
-   if (isCachePath(filename))
+  /* if (isCachePath(filename))
    {
 	  if (dStrlen(filename) > MAX_MAC_PATH_LONG)
 	   	  Con::warnf("File::open: Filename length is pretty long...");
@@ -178,7 +199,7 @@ File::Status File::open(const char *filename, const AccessMode openMode)
 
 	  // success!
 	  return currentStatus;
-   }
+   }*/
 
    if (dStrlen(filename) > MAX_MAC_PATH_LONG)
       Con::warnf("File::open: Filename length is pretty long...");
@@ -773,7 +794,7 @@ bool Platform::isFile(const char *path)
    if (!path || !*path) 
       return false;
 
-   if (isCachePath(path))
+   /*if (isCachePath(path))
    {
 	  // make sure we can stat the file
 	  struct stat statData;
@@ -787,7 +808,7 @@ bool Platform::isFile(const char *path)
 	  return false;
    }
 
-
+*/
    return android_IsFile(path);
 }
 
@@ -798,7 +819,7 @@ bool Platform::isDirectory(const char *path)
    if (!path || !*path) 
       return false;
    
-   if (isCachePath(path))
+ /*  if (isCachePath(path))
    {
 	  // make sure we can stat the file
 	  struct stat statData;
@@ -811,7 +832,7 @@ bool Platform::isDirectory(const char *path)
 
 	  return false;
    }
-
+*/
    return android_IsDir(path);
 }
 
@@ -821,7 +842,7 @@ S32 Platform::getFileSize(const char* pFilePath)
    if (!pFilePath || !*pFilePath) 
       return 0;
    
-   if (isCachePath(pFilePath))
+  /* if (isCachePath(pFilePath))
    {
 	  struct stat statData;
 	  if( stat(pFilePath, &statData) < 0 )
@@ -829,7 +850,7 @@ S32 Platform::getFileSize(const char* pFilePath)
 
 	  // and return it's size in bytes
 	  return (S32)statData.st_size;
-   }
+   }*/
 
    return android_GetFileSize(pFilePath);
 }
@@ -873,7 +894,7 @@ inline bool isGoodDirectoryCache(dirent* entry)
 //-----------------------------------------------------------------------------
 bool Platform::hasSubDirectory(const char *path) 
 {
-	if (isCachePath(path))
+	/*if (isCachePath(path))
 	{
 	   DIR *dir;
 	   dirent *entry;
@@ -899,7 +920,7 @@ bool Platform::hasSubDirectory(const char *path)
 	   return false; // either this dir had no subdirectories, or they were all on the exclude list.
 
 	}
-
+*/
 	android_InitDirList(path);
 	char dir[80];
 	char pdir[255];
@@ -1065,7 +1086,7 @@ bool recurseDumpDirectoriesCache(const char *basePath, const char *path, Vector<
 //-----------------------------------------------------------------------------
 bool Platform::dumpDirectories(const char *path, Vector<StringTableEntry> &directoryVector, S32 depth, bool noBasePath)
 {
-	if (isCachePath(path))
+	/*if (isCachePath(path))
 	{
 	   PROFILE_START(dumpDirectories);
 
@@ -1086,7 +1107,7 @@ bool Platform::dumpDirectories(const char *path, Vector<StringTableEntry> &direc
 
 	   return ret;
 	}
-
+*/
    PROFILE_START(dumpDirectories);
 
    ResourceManager->initExcludedDirectories();
@@ -1201,7 +1222,7 @@ static bool recurseDumpPathCache(const char* curPath, Vector<Platform::FileInfo>
            break;
 
       // construct the full file path. we need this to get the file size and to recurse
-      const U32 len = dStrlen(curPath) + dStrlen(entry->d_name) + 2;
+      const U32 len = dStrlen(curPath) + entry->d_reclen + 2;
       char pathbuf[len];
       dSprintf( pathbuf, len, "%s/%s", curPath, entry->d_name);
 
@@ -1241,7 +1262,7 @@ static bool recurseDumpPathCache(const char* curPath, Vector<Platform::FileInfo>
 //-----------------------------------------------------------------------------
 bool Platform::dumpPath(const char *path, Vector<Platform::FileInfo>& fileVector, S32 depth)
 {
-	if (isCachePath(path))
+	/*if (isCachePath(path))
 	{
 		PROFILE_START(dumpPath);
 		const S32 len = dStrlen(path) + 1;
@@ -1256,7 +1277,7 @@ bool Platform::dumpPath(const char *path, Vector<Platform::FileInfo>& fileVector
 	   PROFILE_END();
 
 	   return ret;
-	}
+	}*/
 
    PROFILE_START(dumpPath);
    char apath[80];

+ 1 - 1
engine/source/platformAndroid/AndroidGL2ES.h

@@ -198,7 +198,7 @@ class ColorI;
 //
 ///* DataType */
 //#define GL_BYTE                           0x1400
-//#define GL_UNSIGNED_BYTE                  0x1401
+#define GL_UNSIGNED_BYTE                  0x1401
 //#define GL_SHORT                          0x1402
 //#define GL_UNSIGNED_SHORT                 0x1403
 //#define GL_INT                            0x1404

+ 2 - 0
engine/source/platformAndroid/T2DActivity.cpp

@@ -936,6 +936,8 @@ struct engine engine;
  */
 void android_main(struct android_app* state) {
 
+	sleep(10);
+
 	//init startup time so U32 doesnt overflow
 	android_StartupTime();