本文介绍了与QCAR整合JPCT-AE(vuforia)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道什么,我要问的是,有时已经讨论通过,但所有的人都去后,我无法找到我的完整的答案,所以我提出一个新的问题

i know what i am going to ask is already discussed sometimes but after going through all of them i can't found my complete answer so i am asking a new question

当我试图整合,提供的一切顺利如预期,我得到了我的模型视图矩阵从JNI renderframe并成功转移,在Java中jpct模式完全显示为预期。但是当我试图通过这个矩阵JPCT世界的相机我的模型中消失。

when i tried integrating JPCT-ae with QCAR all goes well as expected, i got my modelview matrix from renderframe from jni and successfully transferred that in java to jpct model is shown perfectly as expected. but when i tried to pass this matrix to JPCT world camera my model disappear.

我的code:在onsurfacechanged:

my code:in onsurfacechanged:

world = new World();
            world.setAmbientLight(20, 20, 20);
            sun = new Light(world);
            sun.setIntensity(250, 250, 250);
            cube = Primitives.getCube(1);
            cube.calcTextureWrapSpherical();
            cube.strip();
            cube.build();
            world.addObject(cube);
            cam = world.getCamera();
            cam.moveCamera(Camera.CAMERA_MOVEOUT, 10);
            cam.lookAt(cube.getTransformedCenter());
            SimpleVector sv = new SimpleVector();
            sv.set(cube.getTransformedCenter());
            sv.y -= 100;
            sv.z -= 100;
            sun.setPosition(sv);
            MemoryHelper.compact();

和在OnDraw中:

com.threed.jpct.Matrix mResult = new com.threed.jpct.Matrix();
            mResult.setDump(modelviewMatrix );  //modelviewMatrix i get from Qcar
            cube.setRotationMatrix(mResult);
            cam.setBack(mResult);
                     fb.clear(back);
        world.renderScene(fb);
        world.draw(fb);
        fb.display();

经过一番研究,我发现,QCAR使用右手坐标系这意味着X轴正进入正确的,在Y积极的上升和Z轴的正出来的画面,但在JPCT坐标系中的X轴正进入权, Ÿ积极的下降和Z轴正进入画面。

after some research i found that QCAR uses a right-handed coordinate system meaning that the X positive goes right, the Y positive goes up and the Z positive comes out of screen but in JPCT coordinate system the X positive goes right, the Y positive goes down and the Z positive goes into the screen.

Qcar坐标系:

我知道,矩阵QCar是给是具有3 * 3的旋转值和平移矢量一个4 * 4矩阵。

i know that matrix QCar is giving is a 4*4 matrix having 3*3 rotational values and translation vector .

我张贴矩阵更加明确:

modelviewmatrix:

modelviewmatrix:

1.512537      -159.66255   -10.275316   0.0
-89.86529      -1.1592013   4.7839375            0.0
-8.619186     10.179538     -159.44305   0.0
59.182976        93.205956     437.2832            1.0

反向使用cam.setBack(modelviewmatrix.invert(modelviewmatrix))后modelviewmatrix:

modelviewmatrix after reverse using cam.setBack(modelviewmatrix.invert(modelviewmatrix)) :

5.9083453E-5   -0.01109448   -3.3668696E-4   0.0
0.0040540528   -3.8752193E-4   0.0047518034   0.0
-0.004756433   -4.6811014E-4   0.0040459237   0.0
0.7533285     0.4116795            2.7063704   0.9999999

如果我删除13,14和15个矩阵元素假设3 * 3的旋转矩阵产品型号是否正确,但旋转,平移(输入和输出图像的运动)是不存在
终于我不知道需要什么样的变化平移向量。
所以请建议我什么,我在这里丢失?

if i remove 13,14 and 15 matrix element assuming 3*3 rotation matrix...model is rotated properly but translation(in and out movement of image) is not therefinally i dont know what changes translation vector is needed.so please suggest me what i am missing here?

推荐答案

QCAR :: Matrix44F inverseMatrix = SampleMath :: Matrix44FInverse(modelViewMatrix);
 QCAR :: Matrix44F invTransposeMatrix = SampleMath :: Matrix44FTranspose(inverseMatrix);

然后通过 invTransposeMatrix 价值为Java

then pass the invTransposeMatrix value to java

env-> SetFloatArrayRegion(modelviewArray,0,16,invTransposeMatrix.data);
 env-> CallVoidMethod(OBJ,方法,modelviewArray);

这篇关于与QCAR整合JPCT-AE(vuforia)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 03:48