Commit da183e17 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev
Browse files

1. fixed incorrect zFar (when mouse wasalready in the scene) 2. inverted scene...

1. fixed incorrect zFar (when mouse wasalready in the scene) 2. inverted scene rotation 3. fixed coordinates for extra models
parent b825e1f0
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -369,9 +369,9 @@ function manualposor_refresh_content(){
      '<tr class=\'mpr_content\'>',
      '  <td align=\'center\' class=\'mpr_name mpr_modelname\'>'+name+'</td>',
      '  <td><input type=\'checkbox\' class=\'mpr_hide\'></td>',
      '  <td><input type=\'text\' class=\'mpr_input mpr_tra mpr_x\' value=\''+tra_tra_rw.x+'\' \></td>',
      '  <td><input type=\'text\' class=\'mpr_input mpr_tra mpr_y\' value=\''+tra_tra_rw.y+'\' \></td>',
      '  <td><input type=\'text\' class=\'mpr_input mpr_tra mpr_z\' value=\''+tra_tra_rw.z+'\' \></td>',
      '  <td><input type=\'text\' class=\'mpr_input mpr_tra mpr_x\' value=\''+tra_tra_rw.x.toFixed(3)+'\' \></td>',
      '  <td><input type=\'text\' class=\'mpr_input mpr_tra mpr_y\' value=\''+tra_tra_rw.y.toFixed(3)+'\' \></td>',
      '  <td><input type=\'text\' class=\'mpr_input mpr_tra mpr_z\' value=\''+tra_tra_rw.z.toFixed(3)+'\' \></td>',
      '  <td><input type=\'text\' class=\'mpr_input mpr_rot mpr_h\' value=\''+htr.yaw.toFixed(2)+'\' \></td>',
      '  <td><input type=\'text\' class=\'mpr_input mpr_rot mpr_t\' value=\''+htr.pitch.toFixed(2)+'\' \></td>',
      '  <td><input type=\'text\' class=\'mpr_input mpr_rot mpr_r\' value=\''+htr.roll.toFixed(2)+'\' \></td>',
@@ -453,10 +453,15 @@ function manualposor_refresh_content(){
        };

        distance = Math.sqrt(dp_rw.x*dp_rw.x+dp_rw.z*dp_rw.z);

        angle = 180/Math.PI*Math.atan2(dp_rw.x,-dp_rw.z);

        if (dp_rw.z!=0){
          angle = 180/Math.PI*Math.atan2(dp_rw.x,-dp_rw.z);
        }

        console.log("Angle-Distance: "+angle+" "+distance);

        var dp_r = x3dom_real_to_scene(dp_rw.x,dp_rw.y,dp_rw.z);
        var new_tra = [dp_r.x,dp_r.y,dp_r.z].join(",");

+15 −7
Original line number Diff line number Diff line
@@ -419,13 +419,6 @@ function deep_init(){

        if (!Scene._X3DOM_SCENE_INIT_DONE&&(cnt==0)){

            var ss = 10/Scene.element.runtime.viewpoint().getFar();

            ss = ss.toFixed(4);

            $("#shiftspeed").val(ss);
            $("#shiftspeed").change();

            //Scene.initResize();

            // now then all shapes are parsed and accessible
@@ -433,11 +426,25 @@ function deep_init(){

            Scene._X3DOM_SCENE_INIT_DONE = true;
            Scene._X3DOM_SCENE_INIT_BACK_DONE = true;

            x3d_setShiftSpeed();

        }
    };

}

function x3d_setShiftSpeed(){

  var ss = 10/Scene.element.runtime.viewpoint().getFar();

  ss = ss.toFixed(4);

  $("#shiftspeed").val(ss);
  $("#shiftspeed").change();

}

function x3d_initial_camera_placement(mode){

    if (mode==undefined){
@@ -612,6 +619,7 @@ function x3d_events(){
    },true);

    elem.addEventListener('mousedown',function(){
        x3d_setShiftSpeed();
        elem.addEventListener('mousemove',x3d_mouseMove,true);
    });

+1834 −1831
Original line number Diff line number Diff line
@@ -45362,6 +45362,9 @@ x3dom.DefaultNavigation.prototype.onDrag = function(view, x, y, buttonState)
    if (buttonState & 1) //left
    {
        //examine rotation is here. oleg.
        dx = -dx/3;
        dy = -dy/3;

        alpha = (dy * 2 * Math.PI) / view._width;
        beta = (dx * 2 * Math.PI) / view._height;
        mat = view.getViewMatrix();
+0 −2
Original line number Diff line number Diff line
@@ -843,8 +843,6 @@ function x3dom_update_map(){
// uses globals
function x3dom_setViewpoint(m){

    //console.log("Setting a viewpoint");

    var Q = new x3dom.fields.Quaternion(0, 0, 1, 0);
    Q.setValue(m);
    var AA = Q.toAxisAngle();