Finish webvrGetPose;

This commit is contained in:
bjorn 2018-05-02 19:02:29 -07:00 committed by bjornbytes
parent a3e4b9b2b3
commit 065a5aa0dd
2 changed files with 8 additions and 6 deletions

View File

@ -13,7 +13,7 @@ if(EMSCRIPTEN)
"-s FULL_ES3=1 "
"-s FORCE_FILESYSTEM=1 "
"-s ALLOW_MEMORY_GROWTH=1 "
"-s \"EXPORTED_FUNCTIONS=['_main','_quat_getAngleAxis']\" "
"-s \"EXPORTED_FUNCTIONS=['_main','_mat4_rotateQuat','_mat4_set','_mat4_transform','_quat_fromMat4','_quat_getAngleAxis']\" "
"-s \"EXTRA_EXPORTED_RUNTIME_METHODS=['getValue','setValue']\" "
"--js-library \"${CMAKE_CURRENT_SOURCE_DIR}/src/resources/lovr.js\""
)

View File

@ -11,6 +11,8 @@ var LibraryLOVR = {
frameData: null,
width: 0,
height: 0,
tempMat4: new Float32Array(16),
tempQuat: new Float32Array(4),
init: function() {
if (lovr.WebVR.initialized) {
@ -140,7 +142,7 @@ var LibraryLOVR = {
HEAPF32[z >> 2] = pose.position[2];
if (sittingToStanding) {
//Module._mat4_transformPoint(sittingToStanding, x, y, z);
Module._mat4_transform(sittingToStanding, x, y, z);
}
} else {
HEAPF32[x >> 2] = HEAPF32[y >> 2] = HEAPF32[z >> 2] = 0;
@ -148,10 +150,10 @@ var LibraryLOVR = {
if (pose.orientation) {
if (sittingToStanding) {
//Module._mat4_set(lovr.WebVR.tempMat4, sittingToStanding);
//Module._mat4_rotateQuat(lovr.WebVR.tempMat4, pose.orientation);
//Module._quat_fromMat4(lovr.WebVR.tempQuat, lovr.WebVR.tempMat4);
//Module._quat_getAngleAxis(lovr.WebVR.tempQuat, angle, ax, ay, az);
Module._mat4_set(lovr.WebVR.tempMat4, sittingToStanding);
Module._mat4_rotateQuat(lovr.WebVR.tempMat4, pose.orientation);
Module._quat_fromMat4(lovr.WebVR.tempQuat, lovr.WebVR.tempMat4);
Module._quat_getAngleAxis(lovr.WebVR.tempQuat, angle, ax, ay, az);
} else {
Module._quat_getAngleAxis(pose.orientation, angle, ax, ay, az);
}