Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - AeroShark333

Pages: 1 ... 7 8 [9] 10 11 12
121
Support / Re: Color bug
« on: October 04, 2015, 01:35:59 am »
I'm using the latest version of jPCT-AE.

Texture loading code:
Code: [Select]
         public void addOrReplaceTexture(final TextureManager textureManager,
final String textureName, final Texture texture) {
texture.setClamping(true);
texture.setFiltering(false);
texture.setMipmap(true);
if (textureManager.containsTexture(textureName)) {
textureManager.replaceTexture(textureName, texture);
} else {
textureManager.addTexture(textureName, texture);
}

}

@SuppressWarnings("deprecation")
public void loadTextures() {
System.gc();
toaster("Loading...", Toast.LENGTH_LONG);

com.threed.jpct.Config.unloadImmediately = false;

Texture.defaultTo4bpp(true);
// Texture.defaultToMipmapping(true);

final TextureManager textureManager = TextureManager.getInstance();

// For flipping the bitmap from left to right
final Matrix mHor = new Matrix();
mHor.preScale(-1, 1);
// For flipping the bitmap upside-down
final Matrix mVer = new Matrix();
mVer.preScale(1, -1);
// load background (moved down!)

Texture bg = null;

final Bitmap tempSkin = this.gLkinScaledBitmap(skin);

this.addOrReplaceTexture(
textureManager,
"snow",
new Texture(((BitmapDrawable) this.getResources().getDrawable(
R.drawable.snow)).getBitmap(), false));
this.addOrReplaceTexture(
textureManager,
"rain",
new Texture(((BitmapDrawable) this.getResources().getDrawable(
R.drawable.rain)).getBitmap(), false));

this.addOrReplaceTexture(
textureManager,
"hamburger",
new Texture(((BitmapDrawable) this.getResources().getDrawable(
R.drawable.hamburger)).getBitmap(), false));

// (tex, coordX, coordY, sizeX, sizeY)
if (hasOldSkinDimensions(tempSkin)) {
final int height = tempSkin.getHeight();
final int width = tempSkin.getWidth();

// HEAD
final Bitmap headFront1 = Bitmap.createBitmap(tempSkin, width / 8,
height / 4, width / 8, height / 4); // x,y,x,y (64,32,64,32)
final Bitmap headTop1 = Bitmap.createBitmap(tempSkin, width / 8, 0,
width / 8, height / 4);
final Bitmap headBack1 = Bitmap.createBitmap(tempSkin,
width / 8 * 3, height / 4, width / 8, height / 4);
final Bitmap headRight1 = Bitmap.createBitmap(tempSkin, 0,
height / 4, width / 8, height / 4, mHor, false);
final Bitmap headLeft1 = Bitmap.createBitmap(tempSkin, width / 4,
height / 4, width / 8, height / 4);
final Bitmap headBottom1 = Bitmap.createBitmap(tempSkin, width / 4,
0, width / 8, height / 4);

final Texture headFront2 = new Texture(headFront1, true);
final Texture headTop2 = new Texture(headTop1, true);
final Texture headBack2 = new Texture(headBack1, true);
final Texture headRight2 = new Texture(headRight1, true);
final Texture headLeft2 = new Texture(headLeft1, true);
final Texture headBottom2 = new Texture(headBottom1, true);

// HAT
final Bitmap hatFront1 = Bitmap.createBitmap(tempSkin,
width / 8 * 5, height / 4, width / 8, height / 4);
final Bitmap hatTop1 = Bitmap.createBitmap(tempSkin, width / 8 * 5,
0, width / 8, height / 4);
final Bitmap hatBack1 = Bitmap.createBitmap(tempSkin,
width / 8 * 7, height / 4, width / 8, height / 4);
final Bitmap hatRight1 = Bitmap.createBitmap(tempSkin, width / 2,
height / 4, width / 8, height / 4, mHor, false);
final Bitmap hatLeft1 = Bitmap.createBitmap(tempSkin,
width / 4 * 3, height / 4, width / 8, height / 4);
final Bitmap hatBottom1 = Bitmap.createBitmap(tempSkin,
width / 4 * 3, 0, width / 8, height / 4);

final Texture hatFront2 = new Texture(hatFront1, true);
final Texture hatTop2 = new Texture(hatTop1, true);
final Texture hatBack2 = new Texture(hatBack1, true);
final Texture hatRight2 = new Texture(hatRight1, true);
final Texture hatLeft2 = new Texture(hatLeft1, true);
final Texture hatBottom2 = new Texture(hatBottom1, true);

// BODY
final Bitmap bodyFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 16 * 5, height / 8 * 5,
width / 8, height / 8 * 3), 64, 64, false);
final Bitmap bodyTop1 = Bitmap.createBitmap(tempSkin,
width / 16 * 5, 16, width / 8, height / 4);
final Bitmap bodyBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 2, height / 8 * 5,
width / 8, height / 8 * 3, mHor, false), 64, 64,
false);
final Bitmap bodyRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 4, height / 8 * 5,
width / 16, height / 8 * 3, mHor, false), 64, 64,
false);
final Bitmap bodyLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 16 * 7, height / 8 * 5,
width / 16, height / 8 * 3), 64, 64, false);
final Bitmap bodyBottom1 = Bitmap.createBitmap(tempSkin,
width / 16 * 7, height / 2, width / 8, height / 4);

final Texture bodyFront2 = new Texture(bodyFront1, true);
final Texture bodyTop2 = new Texture(bodyTop1, true);
final Texture bodyBack2 = new Texture(bodyBack1, true);
final Texture bodyRight2 = new Texture(bodyRight1, true);
final Texture bodyLeft2 = new Texture(bodyLeft1, true);
final Texture bodyBottom2 = new Texture(bodyBottom1, true);

// ARM
final Bitmap armFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 16 * 11, height / 8 * 5,
width / 16, height / 8 * 3), 64, 64, false);
final Bitmap armTop1 = Bitmap.createBitmap(tempSkin,
width / 16 * 11, height / 2, width / 16, height / 8);
final Bitmap armBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 16 * 13, height / 8 * 5,
width / 16, height / 8 * 3), 64, 64, false);
final Bitmap armRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 8 * 5, height / 8 * 5,
width / 16, height / 8 * 3, mHor, false), 64, 64,
false);
final Bitmap armLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 4 * 3, height / 8 * 5,
width / 16, height / 8 * 3), 64, 64, false);
final Bitmap armBottom1 = Bitmap.createBitmap(tempSkin,
width / 4 * 3, height / 2, width / 16, height / 8);

final Texture armFront2 = new Texture(armFront1, true);
final Texture armTop2 = new Texture(armTop1, true);
final Texture armBack2 = new Texture(armBack1, true);
final Texture armRight2 = new Texture(armRight1, true);
final Texture armLeft2 = new Texture(armLeft1, true);
final Texture armBottom2 = new Texture(armBottom1, true);

// LEG
final Bitmap legFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 16, height / 8 * 5,
width / 16, height / 8 * 3), 64, 64, false);
final Bitmap legTop1 = Bitmap.createBitmap(tempSkin, width / 16,
height / 2, width / 16, height / 8);
final Bitmap legBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 16 * 3, height / 8 * 5,
width / 16, height / 8 * 3), 64, 64, false);
final Bitmap legRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, 0, height / 8 * 5, width / 16,
height / 8 * 3, mHor, false), 64, 64, false);
final Bitmap legLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, 8, height / 8 * 5, width / 16,
height / 8 * 3), 64, 64, false);
final Bitmap legBottom1 = Bitmap.createBitmap(tempSkin, width / 8,
height / 2, width / 16, height / 8);

final Texture legFront2 = new Texture(legFront1, true);
final Texture legTop2 = new Texture(legTop1, true);
final Texture legBack2 = new Texture(legBack1, true);
final Texture legRight2 = new Texture(legRight1, true);
final Texture legLeft2 = new Texture(legLeft1, true);
final Texture legBottom2 = new Texture(legBottom1, true);

final Bitmap rightLegFront1 = Bitmap.createBitmap(legFront1, 0, 0,
legFront1.getWidth(), legFront1.getHeight(), mHor, false);
final Texture leftLegFront2 = new Texture(rightLegFront1, true);

final Bitmap rightArmFront1 = Bitmap.createBitmap(armFront1, 0, 0,
legFront1.getWidth(), legFront1.getHeight(), mHor, false);
final Texture leftArmFront2 = new Texture(rightArmFront1, true);

final int maxDimension;
if (Build.VERSION.SDK_INT > 12) {
// Prevents OOM's
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
maxDimension = Math.max(size.x, size.y);
} else {
Display display = getWindowManager().getDefaultDisplay();
maxDimension = Math
.max(display.getWidth(), display.getHeight());
}

if (maxDimension <= 512) {
// minimum
bg = new Texture(Bitmap.createScaledBitmap(Bitmap.createBitmap(
background, 0, 0, background.getWidth(),
background.getHeight(), mVer, false), 256, 256, false));
} else if (maxDimension <= 1024) {
// default
try {
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 512,
512, false));
} catch (final OutOfMemoryError e1) {
e1.printStackTrace();
System.gc();
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 256,
256, false));
}
} else if (maxDimension <= 1536) {
// big
try {
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 1024,
1024, false));
} catch (final OutOfMemoryError e2) {
e2.printStackTrace();
System.gc();
try {
bg = new Texture(Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false),
512, 512, false));
} catch (final OutOfMemoryError e1) {
e1.printStackTrace();
System.gc();
bg = new Texture(Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false),
256, 256, false));
}

}
} else {
// maximum
try {
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 2048,
2048, false));
} catch (final OutOfMemoryError e3) {
e3.printStackTrace();
System.gc();
try {
bg = new Texture(Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false),
1024, 1024, false));
} catch (final OutOfMemoryError e2) {
e2.printStackTrace();
System.gc();
try {
bg = new Texture(
Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(),
mVer, false), 512, 512,
false));
} catch (final OutOfMemoryError e1) {
e1.printStackTrace();
System.gc();
bg = new Texture(
Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(),
mVer, false), 256, 256,
false));
}

}
}
}

// BACKGROUND
addOrReplaceTexture(textureManager, "bg", bg);
// HEAD
addOrReplaceTexture(textureManager, "headfront", headFront2);
addOrReplaceTexture(textureManager, "headtop", headTop2);
addOrReplaceTexture(textureManager, "headback", headBack2);
addOrReplaceTexture(textureManager, "headright", headRight2);
addOrReplaceTexture(textureManager, "headleft", headLeft2);
addOrReplaceTexture(textureManager, "headbottom", headBottom2);
// HAT
addOrReplaceTexture(textureManager, "hatfront", hatFront2);
addOrReplaceTexture(textureManager, "hattop", hatTop2);
addOrReplaceTexture(textureManager, "hatback", hatBack2);
addOrReplaceTexture(textureManager, "hatright", hatRight2);
addOrReplaceTexture(textureManager, "hatleft", hatLeft2);
addOrReplaceTexture(textureManager, "hatbottom", hatBottom2);
// BODY
addOrReplaceTexture(textureManager, "bodyfront", bodyFront2);
addOrReplaceTexture(textureManager, "bodytop", bodyTop2);
addOrReplaceTexture(textureManager, "bodyback", bodyBack2);
addOrReplaceTexture(textureManager, "bodyright", bodyRight2);
addOrReplaceTexture(textureManager, "bodyleft", bodyLeft2);
addOrReplaceTexture(textureManager, "bodybottom", bodyBottom2);
// RIGHTARM
addOrReplaceTexture(textureManager, "outerrightarmfront", armFront2);
addOrReplaceTexture(textureManager, "outerrightarmtop", armTop2);
addOrReplaceTexture(textureManager, "outerrightarmback", armBack2);
addOrReplaceTexture(textureManager, "outerrightarmright", armRight2);
addOrReplaceTexture(textureManager, "outerrightarmleft", armLeft2);
addOrReplaceTexture(textureManager, "outerrightarmbottom",
armBottom2);
// LEFTARM
addOrReplaceTexture(textureManager, "outerleftarmfront",
leftArmFront2);
addOrReplaceTexture(textureManager, "outerleftarmtop", armTop2);
addOrReplaceTexture(textureManager, "outerleftarmback", armBack2);
addOrReplaceTexture(textureManager, "outerleftarmright", armRight2);
addOrReplaceTexture(textureManager, "outerleftarmleft", armLeft2);
addOrReplaceTexture(textureManager, "outerleftarmbottom",
armBottom2);
// RIGHTLEG
addOrReplaceTexture(textureManager, "outerrightlegfront", legFront2);
addOrReplaceTexture(textureManager, "outerrightlegtop", legTop2);
addOrReplaceTexture(textureManager, "outerrightlegback", legBack2);
addOrReplaceTexture(textureManager, "outerrightlegright", legRight2);
addOrReplaceTexture(textureManager, "outerrightlegleft", legLeft2);
addOrReplaceTexture(textureManager, "outerrightlegbottom",
legBottom2);
// LEFTLEG
addOrReplaceTexture(textureManager, "outerleftlegfront",
leftLegFront2);
addOrReplaceTexture(textureManager, "outerleftlegtop", legTop2);
addOrReplaceTexture(textureManager, "outerleftlegback", legBack2);
addOrReplaceTexture(textureManager, "outerleftlegright", legRight2);
addOrReplaceTexture(textureManager, "outerleftlegleft", legLeft2);
addOrReplaceTexture(textureManager, "outerleftlegbottom",
legBottom2);

} else {
// NEW SKIN TEMPLATE!
final int dimen = tempSkin.getHeight(); // default = 64

// HEAD
final Bitmap headFront1 = Bitmap.createBitmap(tempSkin, dimen / 8,
dimen / 8, dimen / 8, dimen / 8);
final Bitmap headTop1 = Bitmap.createBitmap(tempSkin, dimen / 8, 0,
dimen / 8, dimen / 8);
final Bitmap headBack1 = Bitmap.createBitmap(tempSkin,
dimen / 8 * 3, dimen / 8, dimen / 8, dimen / 8);
final Bitmap headRight1 = Bitmap.createBitmap(tempSkin, 0,
dimen / 8, dimen / 8, dimen / 8, mHor, false);
final Bitmap headLeft1 = Bitmap.createBitmap(tempSkin, dimen / 4,
dimen / 8, dimen / 8, dimen / 8);
final Bitmap headBottom1 = Bitmap.createBitmap(tempSkin, dimen / 4,
0, dimen / 8, dimen / 8);

final Texture headFront2 = new Texture(headFront1, true);
final Texture headTop2 = new Texture(headTop1, true);
final Texture headBack2 = new Texture(headBack1, true);
final Texture headRight2 = new Texture(headRight1, true);
final Texture headLeft2 = new Texture(headLeft1, true);
final Texture headBottom2 = new Texture(headBottom1, true);

// HAT
final Bitmap hatFront1 = Bitmap.createBitmap(tempSkin,
dimen / 8 * 5, dimen / 8, dimen / 8, dimen / 8);
final Bitmap hatTop1 = Bitmap.createBitmap(tempSkin, dimen / 8 * 5,
0, dimen / 8, dimen / 8);
final Bitmap hatBack1 = Bitmap.createBitmap(tempSkin,
dimen / 8 * 7, dimen / 8, dimen / 8, dimen / 8);
final Bitmap hatRight1 = Bitmap.createBitmap(tempSkin, dimen / 2,
dimen / 8, dimen / 8, dimen / 8, mHor, false);
final Bitmap hatLeft1 = Bitmap.createBitmap(tempSkin,
dimen / 4 * 3, dimen / 8, dimen / 8, dimen / 8);
final Bitmap hatBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 4 * 3, 0, dimen / 8, dimen / 8);

final Texture hatFront2 = new Texture(hatFront1, true);
final Texture hatTop2 = new Texture(hatTop1, true);
final Texture hatBack2 = new Texture(hatBack1, true);
final Texture hatRight2 = new Texture(hatRight1, true);
final Texture hatLeft2 = new Texture(hatLeft1, true);
final Texture hatBottom2 = new Texture(hatBottom1, true);

// BODY
final Bitmap bodyFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 5, dimen / 16 * 5,
dimen / 8, dimen / 16 * 3), 64, 64, false);
final Bitmap bodyTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 5, dimen / 4, dimen / 8, dimen / 8);
final Bitmap bodyBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 2, dimen / 16 * 5,
dimen / 8, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap bodyRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 4, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap bodyLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 7, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap bodyBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 7, dimen / 4, dimen / 8, dimen / 8);

final Texture bodyFront2 = new Texture(bodyFront1, true);
final Texture bodyTop2 = new Texture(bodyTop1, true);
final Texture bodyBack2 = new Texture(bodyBack1, true);
final Texture bodyRight2 = new Texture(bodyRight1, true);
final Texture bodyLeft2 = new Texture(bodyLeft1, true);
final Texture bodyBottom2 = new Texture(bodyBottom1, true);

// OUTERBODY
final Bitmap outerBodyFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 5, dimen / 16 * 9,
dimen / 8, dimen / 16 * 3), 64, 64, false);
final Bitmap outerBodyTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 5, dimen / 2, dimen / 8, dimen / 8);
final Bitmap outerBodyBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 2, dimen / 16 * 9,
dimen / 8, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap outerBodyRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 4, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap outerBodyLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 7, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerBodyBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 7, dimen / 2, dimen / 8, dimen / 8);

final Texture outerBodyFront2 = new Texture(outerBodyFront1, true);
final Texture outerBodyTop2 = new Texture(outerBodyTop1, true);
final Texture outerBodyBack2 = new Texture(outerBodyBack1, true);
final Texture outerBodyRight2 = new Texture(outerBodyRight1, true);
final Texture outerBodyLeft2 = new Texture(outerBodyLeft1, true);
final Texture outerBodyBottom2 = new Texture(outerBodyBottom1, true);

// INNERRIGHTARM
final Bitmap innerRightArmFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 11, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerRightArmTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 11, dimen / 4, dimen / 16, dimen / 16);
final Bitmap innerRightArmBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 13, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerRightArmRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8 * 5, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap innerRightArmLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 4 * 3, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerRightArmBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 4 * 3, dimen / 4, dimen / 16, dimen / 16);

final Texture innerRightArmFront2 = new Texture(
innerRightArmFront1, true);
final Texture innerRightArmTop2 = new Texture(innerRightArmTop1,
true);
final Texture innerRightArmBack2 = new Texture(innerRightArmBack1,
true);
final Texture innerRightArmRight2 = new Texture(
innerRightArmRight1, true);
final Texture innerRightArmLeft2 = new Texture(innerRightArmLeft1,
true);
final Texture innerRightArmBottom2 = new Texture(
innerRightArmBottom1, true);

// OUTERRIGHTARM
final Bitmap outerRightArmFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 11, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerRightArmTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 11, dimen / 2, dimen / 16, dimen / 16);
final Bitmap outerRightArmBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 13, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerRightArmRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8 * 5, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap outerRightArmLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 4 * 3, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerRightArmBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 4 * 3, dimen / 2, dimen / 16, dimen / 16);

final Texture outerRightArmFront2 = new Texture(
outerRightArmFront1, true);
final Texture outerRightArmTop2 = new Texture(outerRightArmTop1,
true);
final Texture outerRightArmBack2 = new Texture(outerRightArmBack1,
true);
final Texture outerRightArmRight2 = new Texture(
outerRightArmRight1, true);
final Texture outerRightArmLeft2 = new Texture(outerRightArmLeft1,
true);
final Texture outerRightArmBottom2 = new Texture(
outerRightArmBottom1, true);

// INNERRIGHTLEG
final Bitmap innerRightLegFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerRightLegTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16, dimen / 4, dimen / 16, dimen / 16);
final Bitmap innerRightLegBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 3, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerRightLegRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, 0, dimen / 16 * 5, dimen / 16,
dimen / 16 * 3, mHor, false), 64, 64, false);
final Bitmap innerRightLegLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerRightLegBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 8, dimen / 4, dimen / 16, dimen / 16);

final Texture innerRightLegFront2 = new Texture(
innerRightLegFront1, true);
final Texture innerRightLegTop2 = new Texture(innerRightLegTop1,
true);
final Texture innerRightLegBack2 = new Texture(innerRightLegBack1,
true);
final Texture innerRightLegRight2 = new Texture(
innerRightLegRight1, true);
final Texture innerRightLegLeft2 = new Texture(innerRightLegLeft1,
true);
final Texture innerRightLegBottom2 = new Texture(
innerRightLegBottom1, true);

// OUTERRIGHTLEG
final Bitmap outerRightLegFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerRightLegTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16, dimen / 2, dimen / 16, dimen / 16);
final Bitmap outerRightLegBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 3, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerRightLegRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, 0, dimen / 16 * 9, dimen / 16,
dimen / 16 * 3, mHor, false), 64, 64, false);
final Bitmap outerRightLegLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerRightLegBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 8, dimen / 2, dimen / 16, dimen / 16);

final Texture outerRightLegFront2 = new Texture(
outerRightLegFront1, true);
final Texture outerRightLegTop2 = new Texture(outerRightLegTop1,
true);
final Texture outerRightLegBack2 = new Texture(outerRightLegBack1,
true);
final Texture outerRightLegRight2 = new Texture(
outerRightLegRight1, true);
final Texture outerRightLegLeft2 = new Texture(outerRightLegLeft1,
true);
final Texture outerRightLegBottom2 = new Texture(
outerRightLegBottom1, true);

// OUTERLEFTLEG
final Bitmap outerLeftLegFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerLeftLegTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16, dimen / 4 * 3, dimen / 16, dimen / 16);
final Bitmap outerLeftLegBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 3, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerLeftLegRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, 0, dimen / 16 * 13, dimen / 16,
dimen / 16 * 3, mHor, false), 64, 64, false);
final Bitmap outerLeftLegLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerLeftLegBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 8, dimen / 4 * 3, dimen / 16, dimen / 16);

final Texture outerLeftLegFront2 = new Texture(outerLeftLegFront1,
true);
final Texture outerLeftLegTop2 = new Texture(outerLeftLegTop1, true);
final Texture outerLeftLegBack2 = new Texture(outerLeftLegBack1,
true);
final Texture outerLeftLegRight2 = new Texture(outerLeftLegRight1,
true);
final Texture outerLeftLegLeft2 = new Texture(outerLeftLegLeft1,
true);
final Texture outerLeftLegBottom2 = new Texture(
outerLeftLegBottom1, true);

// INNERLEFTLEG
final Bitmap innerLeftLegFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 5, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerLeftLegTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 5, dimen / 4 * 3, dimen / 16, dimen / 16);
final Bitmap innerLeftLegBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 7, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerLeftLegRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 4, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap innerLeftLegLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8 * 3, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerLeftLegBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 8 * 3, dimen / 4 * 3, dimen / 16, dimen / 16);

final Texture innerLeftLegFront2 = new Texture(innerLeftLegFront1,
true);
final Texture innerLeftLegTop2 = new Texture(innerLeftLegTop1, true);
final Texture innerLeftLegBack2 = new Texture(innerLeftLegBack1,
true);
final Texture innerLeftLegRight2 = new Texture(innerLeftLegRight1,
true);
final Texture innerLeftLegLeft2 = new Texture(innerLeftLegLeft1,
true);
final Texture innerLeftLegBottom2 = new Texture(
innerLeftLegBottom1, true);

// INNERLEFTARM
final Bitmap innerLeftArmFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 9, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerLeftArmTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 9, dimen / 4 * 3, dimen / 16, dimen / 16);
final Bitmap innerLeftArmBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 11, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerLeftArmRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 2, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap innerLeftArmLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8 * 5, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerLeftArmBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 8 * 5, dimen / 4 * 3, dimen / 16, dimen / 16);

final Texture innerLeftArmFront2 = new Texture(innerLeftArmFront1,
true);
final Texture innerLeftArmTop2 = new Texture(innerLeftArmTop1, true);
final Texture innerLeftArmBack2 = new Texture(innerLeftArmBack1,
true);
final Texture innerLeftArmRight2 = new Texture(innerLeftArmRight1,
true);
final Texture innerLeftArmLeft2 = new Texture(innerLeftArmLeft1,
true);
final Texture innerLeftArmBottom2 = new Texture(
innerLeftArmBottom1, true);

// OUTERLEFTARM
final Bitmap outerLeftArmFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 13, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerLeftArmTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 13, dimen / 4 * 3, dimen / 16, dimen / 16);
final Bitmap outerLeftArmBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 15, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
// /
final Bitmap outerLeftArmRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 4 * 3, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap outerLeftArmLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8 * 7, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerLeftArmBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 8 * 7, dimen / 4 * 3, dimen / 16, dimen / 16);

final Texture outerLeftArmFront2 = new Texture(outerLeftArmFront1,
true);
final Texture outerLeftArmTop2 = new Texture(outerLeftArmTop1, true);
final Texture outerLeftArmBack2 = new Texture(outerLeftArmBack1,
true);
final Texture outerLeftArmRight2 = new Texture(outerLeftArmRight1,
true);
final Texture outerLeftArmLeft2 = new Texture(outerLeftArmLeft1,
true);
final Texture outerLeftArmBottom2 = new Texture(
outerLeftArmBottom1, true);

final int maxDimension;
if (Build.VERSION.SDK_INT > 12) {
// Prevents OOM's
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
maxDimension = Math.max(size.x, size.y);
} else {
Display display = getWindowManager().getDefaultDisplay();
maxDimension = Math
.max(display.getWidth(), display.getHeight());
}

if (maxDimension <= 512) {
// minimum
bg = new Texture(Bitmap.createScaledBitmap(Bitmap.createBitmap(
background, 0, 0, background.getWidth(),
background.getHeight(), mVer, false), 256, 256, false));
} else if (maxDimension <= 1024) {
// default
try {
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 512,
512, false));
} catch (final OutOfMemoryError e1) {
e1.printStackTrace();
System.gc();
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 256,
256, false));
}
} else if (maxDimension <= 1536) {
// big
try {
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 1024,
1024, false));
} catch (final OutOfMemoryError e2) {
e2.printStackTrace();
System.gc();
try {
bg = new Texture(Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false),
512, 512, false));
} catch (final OutOfMemoryError e1) {
e1.printStackTrace();
System.gc();
bg = new Texture(Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false),
256, 256, false));
}

}
} else {
// maximum
try {
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 2048,
2048, false));
} catch (final OutOfMemoryError e3) {
e3.printStackTrace();
System.gc();
try {
bg = new Texture(Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false),
1024, 1024, false));
} catch (final OutOfMemoryError e2) {
e2.printStackTrace();
System.gc();
try {
bg = new Texture(
Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(),
mVer, false), 512, 512,
false));
} catch (final OutOfMemoryError e1) {
e1.printStackTrace();
System.gc();
bg = new Texture(
Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(),
mVer, false), 256, 256,
false));
}

}
}
}

// BACKGROUND
addOrReplaceTexture(textureManager, "bg", bg);
// HEAD
addOrReplaceTexture(textureManager, "headfront", headFront2);
addOrReplaceTexture(textureManager, "headtop", headTop2);
addOrReplaceTexture(textureManager, "headback", headBack2);
addOrReplaceTexture(textureManager, "headright", headRight2);
addOrReplaceTexture(textureManager, "headleft", headLeft2);
addOrReplaceTexture(textureManager, "headbottom", headBottom2);
// HAT
addOrReplaceTexture(textureManager, "hatfront", hatFront2);
addOrReplaceTexture(textureManager, "hattop", hatTop2);
addOrReplaceTexture(textureManager, "hatback", hatBack2);
addOrReplaceTexture(textureManager, "hatright", hatRight2);
addOrReplaceTexture(textureManager, "hatleft", hatLeft2);
addOrReplaceTexture(textureManager, "hatbottom", hatBottom2);
// BODY
addOrReplaceTexture(textureManager, "innerbodyfront", bodyFront2);
addOrReplaceTexture(textureManager, "innerbodytop", bodyTop2);
addOrReplaceTexture(textureManager, "innerbodyback", bodyBack2);
addOrReplaceTexture(textureManager, "innerbodyright", bodyRight2);
addOrReplaceTexture(textureManager, "innerbodyleft", bodyLeft2);
addOrReplaceTexture(textureManager, "innerbodybottom", bodyBottom2);
// OUTERBODY
addOrReplaceTexture(textureManager, "bodyfront", outerBodyFront2);
addOrReplaceTexture(textureManager, "bodytop", outerBodyTop2);
addOrReplaceTexture(textureManager, "bodyback", outerBodyBack2);
addOrReplaceTexture(textureManager, "bodyright", outerBodyRight2);
addOrReplaceTexture(textureManager, "bodyleft", outerBodyLeft2);
addOrReplaceTexture(textureManager, "bodybottom", outerBodyBottom2);
// INNERRIGHTARM
addOrReplaceTexture(textureManager, "innerrightarmfront",
innerRightArmFront2);
addOrReplaceTexture(textureManager, "innerrightarmtop",
innerRightArmTop2);
addOrReplaceTexture(textureManager, "innerrightarmback",
innerRightArmBack2);
addOrReplaceTexture(textureManager, "innerrightarmright",
innerRightArmRight2);
addOrReplaceTexture(textureManager, "innerrightarmleft",
innerRightArmLeft2);
addOrReplaceTexture(textureManager, "innerrightarmbottom",
innerRightArmBottom2);

// OUTERRIGHTARM
addOrReplaceTexture(textureManager, "outerrightarmfront",
outerRightArmFront2);
addOrReplaceTexture(textureManager, "outerrightarmtop",
outerRightArmTop2);
addOrReplaceTexture(textureManager, "outerrightarmback",
outerRightArmBack2);
addOrReplaceTexture(textureManager, "outerrightarmright",
outerRightArmRight2);
addOrReplaceTexture(textureManager, "outerrightarmleft",
outerRightArmLeft2);
addOrReplaceTexture(textureManager, "outerrightarmbottom",
outerRightArmBottom2);

// INNERRIGHTLEG
addOrReplaceTexture(textureManager, "innerrightlegfront",
innerRightLegFront2);
addOrReplaceTexture(textureManager, "innerrightlegtop",
innerRightLegTop2);
addOrReplaceTexture(textureManager, "innerrightlegback",
innerRightLegBack2);
addOrReplaceTexture(textureManager, "innerrightlegright",
innerRightLegRight2);
addOrReplaceTexture(textureManager, "innerrightlegleft",
innerRightLegLeft2);
addOrReplaceTexture(textureManager, "innerrightlegbottom",
innerRightLegBottom2);

// OUTERRIGHTLEG
addOrReplaceTexture(textureManager, "outerrightlegfront",
outerRightLegFront2);
addOrReplaceTexture(textureManager, "outerrightlegtop",
outerRightLegTop2);
addOrReplaceTexture(textureManager, "outerrightlegback",
outerRightLegBack2);
addOrReplaceTexture(textureManager, "outerrightlegright",
outerRightLegRight2);
addOrReplaceTexture(textureManager, "outerrightlegleft",
outerRightLegLeft2);
addOrReplaceTexture(textureManager, "outerrightlegbottom",
outerRightLegBottom2);

// OUTERLEFTLEG
addOrReplaceTexture(textureManager, "outerleftlegfront",
outerLeftLegFront2);
addOrReplaceTexture(textureManager, "outerleftlegtop",
outerLeftLegTop2);
addOrReplaceTexture(textureManager, "outerleftlegback",
outerLeftLegBack2);
addOrReplaceTexture(textureManager, "outerleftlegright",
outerLeftLegRight2);
addOrReplaceTexture(textureManager, "outerleftlegleft",
outerLeftLegLeft2);
addOrReplaceTexture(textureManager, "outerleftlegbottom",
outerLeftLegBottom2);

// INNERLEFTLEG
addOrReplaceTexture(textureManager, "innerleftlegfront",
innerLeftLegFront2);
addOrReplaceTexture(textureManager, "innerleftlegtop",
innerLeftLegTop2);
addOrReplaceTexture(textureManager, "innerleftlegback",
innerLeftLegBack2);
addOrReplaceTexture(textureManager, "innerleftlegright",
innerLeftLegRight2);
addOrReplaceTexture(textureManager, "innerleftlegleft",
innerLeftLegLeft2);
addOrReplaceTexture(textureManager, "innerleftlegbottom",
innerLeftLegBottom2);

// OUTERLEFTARM
addOrReplaceTexture(textureManager, "outerleftarmfront",
outerLeftArmFront2);
addOrReplaceTexture(textureManager, "outerleftarmtop",
outerLeftArmTop2);
addOrReplaceTexture(textureManager, "outerleftarmback",
outerLeftArmBack2);
addOrReplaceTexture(textureManager, "outerleftarmright",
outerLeftArmRight2);
addOrReplaceTexture(textureManager, "outerleftarmleft",
outerLeftArmLeft2);
addOrReplaceTexture(textureManager, "outerleftarmbottom",
outerLeftArmBottom2);

// INNERLEFTARM
addOrReplaceTexture(textureManager, "innerleftarmfront",
innerLeftArmFront2);
addOrReplaceTexture(textureManager, "innerleftarmtop",
innerLeftArmTop2);
addOrReplaceTexture(textureManager, "innerleftarmback",
innerLeftArmBack2);
addOrReplaceTexture(textureManager, "innerleftarmright",
innerLeftArmRight2);
addOrReplaceTexture(textureManager, "innerleftarmleft",
innerLeftArmLeft2);
addOrReplaceTexture(textureManager, "innerleftarmbottom",
innerLeftArmBottom2);

}
if (this.armor != null) {
// Load armor
if (hasArmorDimensions()) {

final Bitmap bodyArmorTop1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 6, 33, 8, 6), 32, 32, false);
final Bitmap bodyArmorFront1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 6, 39, 8, 13), 32,
32, false);
final Bitmap bodyArmorBack1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 20, 39, 8, 13), 32, 32,
false);
final Bitmap bodyArmorRight1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 14, 39, 6, 13), 32, 32,
false);
final Bitmap bodyArmorLeft1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 0, 39, 6, 13), 32,
32, false);

final Bitmap headArmorTop1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 40, 54, 10, 10), 32, 32,
false);
final Bitmap headArmorFront1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 10, 54, 10, 10), 32, 32,
false);
final Bitmap headArmorBack1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 30, 54, 10, 10), 32, 32,
false);
final Bitmap headArmorRight1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 20, 54, 10, 10), 32, 32,
false);
final Bitmap headArmorLeft1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 0, 54, 10, 10), 32, 32,
false);

final Bitmap footArmorTop1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 8, 8, 6, 6), 32, 32, false);
final Bitmap footArmorFront1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 34, 49, 6, 4), 32,
32, false);
final Bitmap footArmorBack1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 45, 49, 6, 4), 32,
32, false);
final Bitmap footArmorRight1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 40, 49, 5, 4), 32,
32, false);
final Bitmap footArmorLeft1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 29, 49, 5, 4), 32,
32, false);

final Bitmap legArmorFront1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 29, 33, 4, 9), 32,
32, false);
final Bitmap legArmorBack1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 33, 33, 4, 9), 32,
32, false);
final Bitmap legArmorRight1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 37, 33, 4, 9), 32,
32, false);
final Bitmap legArmorLeft1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 41, 33, 4, 9), 32,
32, false);

final Bitmap shoulderArmorTop1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 53, 51, 6, 6), 32,
32, false);
final Bitmap shoulderArmorFront1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 53, 33, 6, 6), 32,
32, false);
final Bitmap shoulderArmorBack1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 53, 45, 6, 6), 32,
32, false);
final Bitmap shoulderArmorRight1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 53, 57, 6, 6), 32,
32, false);
final Bitmap shoulderArmorLeft1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 53, 39, 6, 6), 32,
32, false);

final Drawable transparent = getResources().getDrawable(
R.drawable.transparent);

final Texture bodyArmorTop2 = new Texture(bodyArmorTop1, true);
final Texture bodyArmorFront2 = new Texture(bodyArmorFront1,
true);
final Texture bodyArmorLeft2 = new Texture(bodyArmorLeft1, true);
final Texture bodyArmorRight2 = new Texture(bodyArmorRight1,
true);
final Texture bodyArmorBack2 = new Texture(bodyArmorBack1, true);
final Texture bodyArmorBottom2 = new Texture(transparent, true);

final Texture headArmorTop2 = new Texture(headArmorTop1, true);
final Texture headArmorFront2 = new Texture(headArmorFront1,
true);
final Texture headArmorLeft2 = new Texture(headArmorLeft1, true);
final Texture headArmorRight2 = new Texture(headArmorRight1,
true);
final Texture headArmorBack2 = new Texture(headArmorBack1, true);
final Texture headArmorBottom2 = new Texture(transparent, true);

final Texture footArmorTop2 = new Texture(footArmorTop1, true);
final Texture footArmorFront2 = new Texture(footArmorFront1,
true);
final Texture footArmorLeft2 = new Texture(footArmorLeft1, true);
final Texture footArmorRight2 = new Texture(footArmorRight1,
true);
final Texture footArmorBack2 = new Texture(footArmorBack1, true);
final Texture footArmorBottom2 = new Texture(transparent, true);

final Texture legArmorTop2 = new Texture(transparent, true);
final Texture legArmorFront2 = new Texture(legArmorFront1, true);
final Texture legArmorLeft2 = new Texture(legArmorLeft1, true);
final Texture legArmorRight2 = new Texture(legArmorRight1, true);
final Texture legArmorBack2 = new Texture(legArmorBack1, true);
final Texture legArmorBottom2 = new Texture(transparent, true);

final Texture shoulderArmorTop2 = new Texture(
shoulderArmorTop1, true);
final Texture shoulderArmorFront2 = new Texture(
shoulderArmorFront1, true);
final Texture shoulderArmorLeft2 = new Texture(
shoulderArmorLeft1, true);
final Texture shoulderArmorRight2 = new Texture(
shoulderArmorRight1, true);
final Texture shoulderArmorBack2 = new Texture(
shoulderArmorBack1, true);
final Texture shoulderArmorBottom2 = new Texture(transparent,
true);

bodyArmorTop2.setFiltering(false);
bodyArmorFront2.setFiltering(false);
bodyArmorLeft2.setFiltering(false);
bodyArmorRight2.setFiltering(false);
bodyArmorBack2.setFiltering(false);
bodyArmorBottom2.setFiltering(false);

headArmorTop2.setFiltering(false);
headArmorFront2.setFiltering(false);
headArmorLeft2.setFiltering(false);
headArmorRight2.setFiltering(false);
headArmorBack2.setFiltering(false);
headArmorBottom2.setFiltering(false);

footArmorTop2.setFiltering(false);
footArmorFront2.setFiltering(false);
footArmorLeft2.setFiltering(false);
footArmorRight2.setFiltering(false);
footArmorBack2.setFiltering(false);
footArmorBottom2.setFiltering(false);

legArmorTop2.setFiltering(false);
legArmorFront2.setFiltering(false);
legArmorLeft2.setFiltering(false);
legArmorRight2.setFiltering(false);
legArmorBack2.setFiltering(false);
legArmorBottom2.setFiltering(false);

shoulderArmorTop2.setFiltering(false);
shoulderArmorFront2.setFiltering(false);
shoulderArmorLeft2.setFiltering(false);
shoulderArmorRight2.setFiltering(false);
shoulderArmorBack2.setFiltering(false);
shoulderArmorBottom2.setFiltering(false);

addOrReplaceTexture(textureManager, "armorbodytop",
bodyArmorTop2);
addOrReplaceTexture(textureManager, "armorbodyfront",
bodyArmorFront2);
addOrReplaceTexture(textureManager, "armorbodyleft",
bodyArmorLeft2);
addOrReplaceTexture(textureManager, "armorbodyright",
bodyArmorRight2);
addOrReplaceTexture(textureManager, "armorbodyback",
bodyArmorBack2);
addOrReplaceTexture(textureManager, "armorbodybottom",
bodyArmorBottom2);

addOrReplaceTexture(textureManager, "armorheadtop",
headArmorTop2);
addOrReplaceTexture(textureManager, "armorheadfront",
headArmorFront2);
addOrReplaceTexture(textureManager, "armorheadleft",
headArmorLeft2);
addOrReplaceTexture(textureManager, "armorheadright",
headArmorRight2);
addOrReplaceTexture(textureManager, "armorheadback",
headArmorBack2);
addOrReplaceTexture(textureManager, "armorheadbottom",
headArmorBottom2);

addOrReplaceTexture(textureManager, "armorfootbottom",
footArmorTop2);
addOrReplaceTexture(textureManager, "armorfootfront",
footArmorFront2);
addOrReplaceTexture(textureManager, "armorfootleft",
footArmorLeft2);
addOrReplaceTexture(textureManager, "armorfootright",
footArmorRight2);
addOrReplaceTexture(textureManager, "armorfootback",
footArmorBack2);
addOrReplaceTexture(textureManager, "armorfoottop",
footArmorBottom2);

addOrReplaceTexture(textureManager, "armorlegtop", legArmorTop2);
addOrReplaceTexture(textureManager, "armorlegfront",
legArmorFront2);
addOrReplaceTexture(textureManager, "armorlegleft",
legArmorLeft2);
addOrReplaceTexture(textureManager, "armorlegright",
legArmorRight2);
addOrReplaceTexture(textureManager, "armorlegback",
legArmorBack2);
addOrReplaceTexture(textureManager, "armorlegbottom",
legArmorBottom2);

addOrReplaceTexture(textureManager, "armorshouldertop",
shoulderArmorTop2);
addOrReplaceTexture(textureManager, "armorshoulderfront",
shoulderArmorFront2);
addOrReplaceTexture(textureManager, "armorshoulderleft",
shoulderArmorLeft2);
addOrReplaceTexture(textureManager, "armorshoulderright",
shoulderArmorRight2);
addOrReplaceTexture(textureManager, "armorshoulderback",
shoulderArmorBack2);
addOrReplaceTexture(textureManager, "armorshoulderbottom",
shoulderArmorBottom2);
}
}
for (final String name : textureManager.getNames()) {
textureManager.getTexture(name).setFiltering(false);
}
textureManager.compress();
}

I might have to clean up the code a bit sometime...

122
Support / Re: Color bug
« on: September 30, 2015, 12:32:10 pm »
No, I never call that method.
I do call other texture methods:
Texture.setClamping(true);
Texture.setFiltering(false);
Texture.setMipmap(true):

123
Support / Re: Color bug
« on: September 29, 2015, 11:30:27 pm »
Yes I am, I think I can disable it though

I am using TextureManager.compress()
I suppose that does the same thing?

124
Support / Re: Color bug
« on: September 22, 2015, 12:01:49 am »
I thought the Asus MeMo Pad 7 did have an Intel CPU/GPU...
https://www.asus.com/Tablets/ASUS_MeMO_Pad_7_ME176C/specifications/

I doubt that something is wrong with the way I load textures... Well, I'm not sure.
The application has had over 200k downloads so far.
And I have only had a very few reports about the color bug.

125
Support / Re: Color bug
« on: September 20, 2015, 01:26:23 am »
Well the textures are actual image textures, not one solid color.

Devices with this bug:
- Asus MeMo Pad 7 (Android 4.4)
- Asus MeMo Pad 7 (Android 5.0)

I think there are other devices that those Asus devices... But I am not too sure

PS: It's also kind of difficult to get in touch with an user with such issue...
I'll try my best



126
Support / Color bug
« on: September 09, 2015, 11:02:07 am »
Hello,

I got a bug with either the EGLConfig or the shader I think.
Basically, something is wrong with the colors.
The colors are displayed correctly on MOST devices.
However some devices show something similar to this:
https://drive.google.com/file/d/0ByAoxZrYMOphVnFQOE52b01WSkF0V2wzVHlkak5rY0l6Nmo0/view?usp=sharing

I hope that someone is able to help me here.
I am not sure which of both would be causing the bug...
Thanks in advance.

Cheers,
Abiram


127
Support / Re: Object3D's transparency issue
« on: May 30, 2015, 09:57:57 pm »
Thanks for the help! It works like a charm and it doesn't lag at all really :)

128
Support / Re: Object3D's transparency issue
« on: May 30, 2015, 04:21:08 pm »
I tried both: both lead to the same stacktrace/crash.
The only place it does work is when it is initializing the renderer. (before adding it to the world)

EDIT: If I remove Object3D.strip() then it won't crash, however the new meshdata is not completely applied.
It is applied (since I can see another Object3D, which is tied to a the Object3D's mesh's SimpleVector, does move)
But the new shape/texturedeforming is not visible. Only the initialized meshdata form is applied, not the changes that I want to apply in the renderer/listener.

129
Support / Re: Object3D's transparency issue
« on: May 30, 2015, 01:42:40 pm »
Hmm, I have been getting a nullpointerexception and I have no idea how to fix it.
Basically I am trying to alter the meshdata while running the application.
Code:
Code: [Select]
Mesh mesh = rA.getMesh();
mesh.setVertexController(new GenericVertexController(){

private static final long serialVersionUID = 1311476511641434156L;

@Override
public void apply() {
SimpleVector[] s = getSourceMesh();
//System.out.println("length:"+ s.length);
SimpleVector[] d = getDestinationMesh();
for (int i = 0; i < 26;i++){
d[i].z =  s[i].z - (lastX - firstX)*0.001f * (i/2) * (i/2);
d[i+26].z =  s[i+26].z -(lastX - firstX)* 0.001f * (i/2) * (i/2);
d[i].x = s[i].x;
d[i].y = s[i].y;
}
}

}, true);
mesh.applyVertexController();
mesh.removeVertexController();

Stacktrace:
Code: [Select]
05-30 13:36:21.741: W/dalvikvm(5893): threadid=17: thread exiting with uncaught exception (group=0xa61f2908)
05-30 13:36:21.745: E/AndroidRuntime(5893): FATAL EXCEPTION: GLThread 392
05-30 13:36:21.745: E/AndroidRuntime(5893): java.lang.NullPointerException
05-30 13:36:21.745: E/AndroidRuntime(5893): at com.threed.jpct.GenericVertexController.init(GenericVertexController.java:88)
05-30 13:36:21.745: E/AndroidRuntime(5893): at com.threed.jpct.Mesh.setVertexController(Mesh.java:164)
05-30 13:36:21.745: E/AndroidRuntime(5893): at com.aeroshark333.skinviewer.SkinActivity$18.run(SkinActivity.java:1251)
05-30 13:36:21.745: E/AndroidRuntime(5893): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1462)
05-30 13:36:21.745: E/AndroidRuntime(5893): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

The code is run in a queued GL-thread.

130
Support / Re: Object3D's transparency issue
« on: May 03, 2015, 06:44:18 pm »
An Android 4.3 reference image (see previous post)

131
Support / Re: Object3D's transparency issue
« on: May 03, 2015, 06:43:20 pm »
I have a small issue and I do not know why I have this problem.
The head on Android 2.2 does look filtered, while it is not filtered on Android 4.3.
(Android 2.2 uses OpenGL 1.0 (SDK emulator) and Android 4.3 uses OpenGL 2.0 (Genymotion emulator))
The weird thing is: the rest of the body is not filtered on Android 2.2 (or looks not filtered), which is why I think this issue does not make sense.
And when I apply a body texture to the head object (in code), then it is not filtered.
So I cannot blame the object for filtering the textures.
I do not know why the head textures are filtered on Android 2.2 but not on Android 4.3.

132
Support / Re: Object3D's transparency issue
« on: April 26, 2015, 01:10:57 pm »
Hmm, you're right... I don't really have a reason for the flushing in onPause... So I guess I'll remove that line.

And what about the stacktrace?

133
Support / Re: Object3D's transparency issue
« on: April 25, 2015, 03:41:07 pm »
So...
This is the problem causer? (the only time I use .flush();):
Code: [Select]
@Override
public void onPause() {
hasRendererLoaded = false;
gLView.onPause();
super.onPause();
TextureManager.getInstance().flush();
this.finish();
}

But even then...:
Code: [Select]
@Override
public void onDrawFrame(GL10 gl) {
if (!hasRendererLoaded) {
return;

                // irrelevant code

                       }

}

Textures won't really be used if it 'return;'s.

Also... I have a new stacktrace from an user:
Code: [Select]
java.lang.RuntimeException: [ 1429958366470 ] - ERROR: Failed to load and compile fragment shaders!
at com.threed.jpct.Logger.log(Logger.java:206)
at com.threed.jpct.GLSLShader.loadProgram(GLSLShader.java:1077)
at com.threed.jpct.GLSLShader.preInit(GLSLShader.java:285)
at com.threed.jpct.GL20.setShader(GL20.java:362)
at com.threed.jpct.GLRenderer.setShader(GLRenderer.java:553)
at com.threed.jpct.CompiledInstance.render(CompiledInstance.java:189)
at com.threed.jpct.GLRenderer.drawVertexArray(GLRenderer.java:2308)
at com.threed.jpct.World.draw(World.java:1417)
at com.threed.jpct.World.draw(World.java:1100)
at com.aeroshark333.skinviewer.SkinActivity$ViewerRenderer.onDrawFrame(SkinActivity.java:1659)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1363)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)

Line #1659
Code: [Select]
mainWorld.draw(frameBuffer);
Device information:
LG-P920 (cosmo_TMO-XXX)
Android 2.3.3 - 2.3.7

134
Support / Re: Object3D's transparency issue
« on: April 24, 2015, 10:41:34 am »
Hmm, okay! Thanks for the help. (it happened on just one device, I guess the user is unlucky then...)

A new stacktrace:
Code: [Select]
java.lang.NullPointerException: Attempt to invoke virtual method 'int com.threed.jpct.Texture.getOpenGLID(int)' on a null object reference
at com.threed.jpct.GLRenderer.setTextures(GLRenderer.java:2441)
at com.threed.jpct.GLRenderer.drawVertexArray(GLRenderer.java:2297)
at com.threed.jpct.World.draw(World.java:1417)
at com.threed.jpct.World.draw(World.java:1100)
at com.aeroshark333.skinviewer.SkinActivity$ViewerRenderer.onDrawFrame(SkinActivity.java:1659)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1531)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248)

line #1659
Code: [Select]
mainWorld.draw(frameBuffer);
Amount of reports: 1
Android: 5.0
Device: Samsung Galaxy S5

As far as I know... I am not messing with Object textures...

135
Support / Re: EGL_BAD_ALLOC error
« on: April 15, 2015, 11:07:37 pm »
No sorry, this is all I got...

Pages: 1 ... 7 8 [9] 10 11 12