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(){
Map = new LeafletObject('leaflet_map',Data,{});
//wait until it DOM is extended
x3dom.runtime.ready = function(){
map_resize_init();
deep_init();
align_init();
x3d_initial_camera_placement();
x3d_events();
leaf_events();
};
});
......@@ -239,7 +243,7 @@ function deep_init(){
cnt = parseInt(progress_counter[1]);
if (!Scene._X3DOM_SCENE_INIT_DONE&&(cnt==0)){
//Scene.initResize();
// now then all shapes are parsed and accessible
......@@ -247,8 +251,6 @@ function deep_init(){
Scene._X3DOM_SCENE_INIT_DONE = true;
x3d_events();
leaf_events();
}
};
......@@ -545,6 +547,8 @@ function leaf_mousemove_hc(){
x3dom_altelev(altitude,elevation);
X3DOMObject.displayViewInfo({});
}
function leaf_mousemove_nohc(e){
......
......@@ -35,6 +35,15 @@
* 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
*/
......@@ -277,8 +286,12 @@ function x3dom_altelev(alt,elev){
var mat = R0.mult(mat);
var ypr = x3dom_YawPitchRoll_nc(mat);
var ypr2 = x3dom_YawPitchRoll_nc_degs(mat);
console.log("Check1");
console.log(ypr2);
var from = mat.e3();
console.log(from);
from.y = alt;
var az = ypr.yaw;
......@@ -295,13 +308,17 @@ function x3dom_altelev(alt,elev){
var R_rw = x3dom_TixMxT(R);
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 newmat = matt.mult(R_w);
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