I'm getting WAY too many visibility lists created. I'm loading the OBJ model on the here copied loadModel method. It's a very simple 1k poly model, but I'm getting no animation whatsoever. The whole thing seems fairly straightforward, so what might I be doing wrong?
CONSOLE:
Object 'Hair_jPCT6' created using 395 polygons and 252 vertices
Additional visibility list (2) created with size: 4096
...
Additional visibility list (61) created with size: 4096
LOADING METHOD:
private void loadModel() {
TextureManager.getInstance().addTexture("LindyModelBellybutton.png", new Texture("LindyModelBellybutton.png"));
TextureManager.getInstance().addTexture("Lindy_HighResHair.png", new Texture("Lindy_HighResHair.png"));
lal3d = Object3D.mergeAll(Loader.loadOBJ("Head.obj", "Head.mtl", 1f));
// lal3d.getMesh().compress();
Object3D openMouth = Object3D.mergeAll(Loader.loadOBJ("MouthOpen.obj", null, 1f));
Object3D blinks = Object3D.mergeAll(Loader.loadOBJ("Blink.obj", null, 1f));
lal3d.build();
openMouth.build();
blinks.build();
Animation animation = new Animation(6);
animation.createSubSequence("Talks");
animation.addKeyFrame(lal3d.getMesh().cloneMesh(false));
animation.addKeyFrame(openMouth.getMesh());
animation.addKeyFrame(lal3d.getMesh().cloneMesh(false));
animation.createSubSequence("Blinks");
animation.addKeyFrame(lal3d.getMesh().cloneMesh(false));
animation.addKeyFrame(blinks.getMesh());
animation.addKeyFrame(lal3d.getMesh().cloneMesh(false));
animation.setInterpolationMethod(Animation.LINEAR);
lal3d.setAnimationSequence(animation);
Object3D hair = Object3D.mergeAll(Loader.loadOBJ("Hair.obj", "Hair.mtl", 1f));
hair.build();
lal3d.addChild(hair);
lal3d.rotateAxis(lal3d.getXAxis(), (float)Math.toRadians(160));
world.addObject(lal3d);
world.addObject(hair);
}
Afterwards, I attempt to play the animation with:
if (keepTalking) {
lal3d.animate((currentFrame+=Time.deltaTime()), TALKS);
if (currentFrame >= 1.00f)
currentFrame = 0.00f;
}
else if (blinking) {
lal3d.animate((currentFrame+=Time.deltaTime()), BLINKS);
if (currentFrame >= 1.00f)
blinking = false;
}
if (!keepTalking && Math.random() > .9 && System.currentTimeMillis() > timeSinceBlinked+4000) {
blinking = true;
currentFrame = 0.00f;
}
That's usually the symptom of your render loop causing some exception that you just swallow. In that case, each iteration causes a new visibility list being created because the former one has never been rendered. See if you swallow any exception and...don't do that... ;)
Not that I can tell. The entire loop consists of the animation bit and the following three lines:
draw();
paint(this.getGraphics());
Thread.yield();
By the way, I'm only using the software renderer.
If there's no exception, you are omitting the actual draw call. None of these methods in the code snippet is from jPCT, so i've no idea what draw() or paint() are actually doing.
OK, I solved the matter of the visibility lists by switching back to AWT components (I had a reason for going with Swing, but not anymore). But my animate() call (above) is not producing any animation. Any clue why (the models themselves are right and should work)?
What's Time.getDeltaTime() returning?