[resolved]rendering a animating model via JPCT-Bones basic on ARToolkit Porject

Started by cefengxu, October 30, 2015, 09:27:20 AM

Previous topic - Next topic

cefengxu

Purpose:
rendering a animating model via JPCT-Bones basic on ARToolkit Porject for Augmented Reality Application.


According  for the demo you support(Bones-Android-Ninja) , I have injected the code another project about ARToolkit and the model can be rendered on the screen in front of preview data ,  as shown on fig1.


Question:
If I  want to render  the model witch stand on the mark in real-time, how to change the camera position , camera direction and the model position/rotation.

Actually, I can realize it with md2 model using JPCE-AE ( as shown in figure2 , the code was shown as bellow) : But , for JPCT-Bones, how to do ?

[size=12pt]public void onDrawFrame(GL10 unused) {
float[] projection = ARNativeActivity.getProjectM();

Matrix projMatrix = new Matrix();
projMatrix.setDump(projection);
projMatrix.transformToGL();
SimpleVector translation = projMatrix.getTranslation();
SimpleVector dir = projMatrix.getZAxis();
SimpleVector up = projMatrix.getYAxis();
cam.setPosition(translation);
cam.setOrientation(dir, up);

float[] transformation = ARNativeActivity.getTransformationM();

Matrix dump = new Matrix();
dump.setDump(transformation);
dump.transformToGL();
cube.clearTranslation();
cube.translate(dump.getTranslation());
cube.setRotationMatrix(dump);

cube.setState(stat);
cube.animate(ticks);

world.renderScene(fb);
world.draw(fb);
fb.display();
}[/size]




raft

it's the same Bones, i.e. Animated3D extends Obejct3D so it inherits all the bevaviour

for (Animated3D a : group) {
  // ...
  a.clearTranslation();
  a.translate(dump.getTranslation());
  a.setRotationMatrix(dump); 
}