www.jpct.net
Bones - Skeletal and Pose Animations for jPCT/jPCT-AE => Bones => Topic started by: cefengxu on October 30, 2015, 09:27:20 am
-
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]
-
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);
}