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.


Topics - lancew

Pages: [1]
1
Support / animation performance
« on: February 02, 2012, 09:43:35 pm »
Before committing to this engine I needed to verify that it could handle 22 uniquely animated meshes (same base model) concurrently.    Here's the setup code:

Code: [Select]
models = new Object3D[22];
for(int i = 0; i < 22; i++)
{
models[i] = new Object3D(model, false);
        //spread them out in a line for viewing them all at once
        models[i].translate(i*30, 0 0);
models[i].build();
world.addObject(models[i]);
}

I also have the app setup with a Primitive Plane representing the ground:

Code: [Select]
Object3D ground = Primitives.getPlane(10, 200);
ground.build();
ground.setTexture("grass");
ground.calcTextureWrap();
//function from http://www.jpct.net/wiki/index.php/Advanced_example
tileTexture(ground, .5f);
//rotate by 90 degrees to put it on the x-z plane
ground.rotateX(0.0174532925f * 90f);

world.addObject(ground);

as well as the exact skydome model and code from http://www.jpct.net/wiki/index.php/Advanced_example

and then later in the render function:

Code: [Select]
//repeat the animation every 5 seconds
float anim = (float)(System.currentTimeMillis() % 5000)/5000;

for(int i = 0; i < 22; i++)
{
        //set them all to a slightly different key frame
float index = anim + (float)(i*5)/1000;
if(index > 1f)
index -= 1f;
models[i].animate(index);
models[i].build();
}

The compiled app comes out at 488kb.

When all the animations are visible I am getting ~6-10 fps.  With only 1 animation running, it runs at 58-60 fps.  My phone is http://www.htc.com/us/support/aria-att/tech-specs/
Is this low fps what you would expect, or might I have some other problem going on?

The animation I am using is attached (i got it from http://jpct.de/download/mesh/quake2_models.7z)

[attachment deleted by admin]

2
Support / question about object3d.translate
« on: January 27, 2012, 10:33:02 pm »
I basically want to move the horse based upon user input, and have the camera follow the horse.  moveVec.y will always be 0 so that the horse will always move in the x-z plane.  The problem is that the horse moves, but the camera doesn't follow it.  The camera just sits at its initial position.  Heres the code:
Code: [Select]
horse.translate(moveVec);
horse.translateMesh();
SimpleVector horsePos = horse.getTransformedCenter();
horsePos.add(horse.getTranslation());
cam.setPosition(horsePos);
//want cam up to match horse up
SimpleVector up = horse.getYAxis();
up.y *= -1;
//horse is facing along x axis
SimpleVector dir = horse.getXAxis();
cam.setOrientation(dir, up);
//move back according to zoom input
cam.moveCamera(Camera.CAMERA_MOVEOUT, currentZoom);
//move up, but move up less if looking up
cam.moveCamera(Camera.CAMERA_MOVEUP, (currentZoom - lookUp) * .5f);
SimpleVector look = horse.getXAxis();
//look at position ahead of horse
look.scalarMul(currentZoom * 2f);
//look at position above horse if user input indicated to do so
look.y -= lookUp;
cam.lookAt(look);
horse.clearTranslation();

I'm assuming I'm doing the translation wrong in some way, but have no idea how, or what else it could be.
Thanks in advance
/lance

Pages: [1]