a misleading trace in ParserBase

Software: Away3D 4.x

duggulous, Newbie
Posted: 30 September 2011 01:25 AM   Total Posts: 2

ParserBase.isBitmapDataValid() contains the following lines:

var isValid:Boolean = TextureUtils.isBitmapDataValid(bitmapData);
if(!
isValid) trace(">> bitmap loaded is not having power of 2 dimensions or is higher than 4096"); 

however, TextureUtils contains the following:

private static const MAX_SIZE : uint = 2048;

public static function 
isBitmapDataValid(bitmapData : BitmapData) : Boolean
{
 
if (bitmapData == null) return true;

 var 
w : int = bitmapData.width;
 var 
h : int = bitmapData.height;

 if (
w < 2 || h < 2 || w > MAX_SIZE || h > MAX_SIZE) return false;

 if (
isPowerOfTwo(w) && isPowerOfTwo(h)) return true;

 return 
false;
} 

so it seems the size limit on Bitmap textures is really 2048.  Either the MAX_SIZE value should be increased to 4096 or the trace should be changed, perhaps moved into the TextureUtils class so you can do this:

public static function isBitmapDataValid(bitmapData : BitmapData) : Boolean
{
 
if (bitmapData == null) return true;

 var 
w : int = bitmapData.width;
 var 
h : int = bitmapData.height;

 if (
w < 2 || h < 2 || w > MAX_SIZE || h > MAX_SIZE) 
 
{
  trace
("Bitmap width is "+bitmapData.width+" and height is "+bitmapData.height+".  Max size is "+MAX_SIZE+" and min is 2");
  return 
false;
 
}
 
if (isPowerOfTwo(w) && isPowerOfTwo(h)) 
 
{
  
return true;
 
}
 
else
 
{
  trace
("Bitmap width is "+bitmapData.width+" and height is "+bitmapData.height+". Each side should be a power of 2.");
 
}

 
return false;
} 
   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X