Commit bdf704be authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

1. restored getViewTranslation 2. Fixed init when the scene required...

1. restored getViewTranslation 2. Fixed init when the scene required enterFrame to start being movable
parent 3011b8ee
...@@ -165,10 +165,14 @@ function light_init(){ ...@@ -165,10 +165,14 @@ function light_init(){
Map = new LeafletObject('leaflet_map',Data,{}); Map = new LeafletObject('leaflet_map',Data,{});
//wait until it DOM is extended //wait until it DOM is extended
x3dom.runtime.ready = function(){ x3dom.runtime.ready = function(){
map_resize_init(); map_resize_init();
deep_init(); deep_init();
align_init(); align_init();
x3d_initial_camera_placement(); x3d_initial_camera_placement();
x3d_events();
leaf_events();
}; };
}); });
...@@ -247,8 +251,6 @@ function deep_init(){ ...@@ -247,8 +251,6 @@ function deep_init(){
Scene._X3DOM_SCENE_INIT_DONE = true; Scene._X3DOM_SCENE_INIT_DONE = true;
x3d_events();
leaf_events();
} }
}; };
...@@ -545,6 +547,8 @@ function leaf_mousemove_hc(){ ...@@ -545,6 +547,8 @@ function leaf_mousemove_hc(){
x3dom_altelev(altitude,elevation); x3dom_altelev(altitude,elevation);
X3DOMObject.displayViewInfo({});
} }
function leaf_mousemove_nohc(e){ function leaf_mousemove_nohc(e){
......
...@@ -35,6 +35,15 @@ ...@@ -35,6 +35,15 @@
* for the JavaScript code in this page. * for the JavaScript code in this page.
*/ */
function x3dom_getViewTranslation(elem){
var m = elem.runtime.viewMatrix().inverse();
var tr = m.e3();
return tr;
}
/** /**
* get position and orientation in the 3D scene defined by mouse's canvas x,y * get position and orientation in the 3D scene defined by mouse's canvas x,y
*/ */
...@@ -277,8 +286,12 @@ function x3dom_altelev(alt,elev){ ...@@ -277,8 +286,12 @@ function x3dom_altelev(alt,elev){
var mat = R0.mult(mat); var mat = R0.mult(mat);
var ypr = x3dom_YawPitchRoll_nc(mat); var ypr = x3dom_YawPitchRoll_nc(mat);
var ypr2 = x3dom_YawPitchRoll_nc_degs(mat); var ypr2 = x3dom_YawPitchRoll_nc_degs(mat);
console.log("Check1");
console.log(ypr2);
var from = mat.e3(); var from = mat.e3();
console.log(from);
from.y = alt; from.y = alt;
var az = ypr.yaw; var az = ypr.yaw;
...@@ -295,7 +308,9 @@ function x3dom_altelev(alt,elev){ ...@@ -295,7 +308,9 @@ function x3dom_altelev(alt,elev){
var R_rw = x3dom_TixMxT(R); var R_rw = x3dom_TixMxT(R);
var R_w = R0.inverse().mult(R_rw); var R_w = R0.inverse().mult(R_rw);
var ypr2 = x3dom_YawPitchRoll_nc_degs(R_w); var ypr2 = x3dom_YawPitchRoll_nc_degs(R_rw);
console.log("Check2");
console.log(ypr2);
var matt = x3dom.fields.SFMatrix4f.translation(from); var matt = x3dom.fields.SFMatrix4f.translation(from);
...@@ -303,6 +318,8 @@ function x3dom_altelev(alt,elev){ ...@@ -303,6 +318,8 @@ function x3dom_altelev(alt,elev){
x3dom_setViewpoint(newmat); x3dom_setViewpoint(newmat);
console.log(newmat.e3());
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment