Hello, I have Object3D created via addTriangle methods and I assign a texture to it:
public class PlaneObject extends Object3D {
private static final long serialVersionUID = 156115212L;
private int textureId;
public PlaneObject(float sizeX, float sizeY, int textureId) {
super(2);
this.textureId = textureId;
float x = sizeX / 2f;
float y = sizeY / 2f;
// vecX - see numeric part of your keyboard
SimpleVector vec7 = new SimpleVector(0 - x, 0 - y, 0);
SimpleVector vec1 = new SimpleVector(0 - x, 0 + y, 0);
SimpleVector vec3 = new SimpleVector(0 + x, 0 - y, 0);
SimpleVector vec9 = new SimpleVector(0 + x, 0 + y, 0);
this.addTriangle(vec1, vec7, vec3, new TextureInfo(textureId,
1.0f, 1.0f,
1.0f, 0.0f,
0.0f, 0.0f
));
this.addTriangle(vec1, vec3, vec9, new TextureInfo(textureId,
1.0f, 1.0f,
0.0f, 0.0f,
0.0f, 1.0f
));
}
public int getTextureId() {
return textureId;
}
public float getX(){
return this.getTranslation().x;
}
public float getY(){
return this.getTranslation().y;
}
}
However, I later want to change the texture to something else, so I tried using this subclass and function flipFrame()
public abstract class AnimatedObject extends PlaneObject {
private static final long serialVersionUID = -768657798172821902L;
private int[] frames;
private int fCount=1;
public AnimatedObject(float sizeX, float sizeY, int[] textureIds) {
super(sizeX, sizeY, textureIds[0]);
frames = textureIds;
AnimationManager.registerAnimation(this);
}
public void flipFrame(){
if (fCount >= frames.length){
fCount = 0;
}
setTexture(TextureManager.getInstance().getNameByID(frames[fCount]));
}
}
however, it does nothing...
What am I doing wrong?