Commit 57a926af authored by Andrey Filippov's avatar Andrey Filippov
Browse files

Merge branch 'master' of https://github.com/Elphel/freecad_x3d

parents 8ea0e3b8 b683b8f9
Loading
Loading
Loading
Loading
+247 −219
Original line number Diff line number Diff line
/*
FILE NAME  : viewmodel.js
DESCRIPTION: x3d viewer
REVISION: 1.00
AUTHOR: Oleg Dzhimiev <oleg@elphel.com>
LICENSE: AGPL v3+, see http://www.gnu.org/licenses/agpl.txt
Copyright (C) 2015 Elphel, Inc.
/** @licstart  The following is the entire license notice for the
 *  JavaScript code in this page.
 *
 *   Copyright (C) 2017 Elphel Inc.
 *   Author: Oleg Dzhimiev <oleg@elphel.com>
 *   Desctiption: x3d viewer
 *
 *   The JavaScript code in this page is free software: you can
 *   redistribute it and/or modify it under the terms of the GNU
 *   General Public License (GNU GPL) as published by the Free Software
 *   Foundation, either version 3 of the License, or (at your option)
 *   any later version.  The code is distributed WITHOUT ANY WARRANTY;
 *   without even the implied warranty of MERCHANTABILITY or FITNESS
 *   FOR A PARTICULAR PURPOSE.  See the GNU GPL for more details.
 *
 *   As additional permission under GNU GPL version 3 section 7, you
 *   may distribute non-source (e.g., minimized or compacted) forms of
 *   that code without the copy of the GNU GPL normally required by
 *   section 4, provided you include this license notice and a URL
 *   through which recipients can access the Corresponding Source.
 *
 *  @licend  The above is the entire license notice
 *  for the JavaScript code in this page.
 */

var model = "Undefined";
@@ -24,8 +40,13 @@ var zoom = 0.9;

var undo = Array();

$(function(){
  prerun();
  resize();
});

function resize(){
    console.log("resize");
    //console.log("resize");
    var w = $(window).width();
    var h = $(window).height();
    if (w>h){
@@ -109,7 +130,8 @@ function prerun(){
    //load x3dom.js
    //$.getScript("x3dom-1.7.0/x3dom.debug.js",function(){
    //$.getScript("http://x3dom.org/download/1.7.1/x3dom.js");
    $.getScript("http://x3dom.org/download/1.7/x3dom.js",function(){
    //$.getScript("http://x3dom.org/download/1.7/x3dom.js",function(){
    $.getScript("x3dom-1.7.0/x3dom-full.debug.js",function(){
        x3dom.runtime.ready = function() {
            //x3dom.caps.BACKEND
            if (x3dom.caps.BACKEND!="webgl"){
@@ -175,8 +197,8 @@ X3DOM Flash version is not available.<br/>\
                element.runtime.showAll("negY");
                if (showdefault) element.runtime.resetView();
                showall=0;
                place_camera();
                model_init();
                //place_camera();
                //model_init();
            }else{
                //console.log("Loaded "+load_counter);
                if (showall>=0){
@@ -557,7 +579,7 @@ function showBOM(){
        }else{
            bomtr_subcounter++;
            bomtr = $("#bomtr_"+bomtr_subcounter);
            console.log("Adding to tr #"+bomtr_subcounter);
            //console.log("Adding to tr #"+bomtr_subcounter);
            if (bomtr_subcounter==bomtr_counter){
                bomtr_subcounter=0;
            }
@@ -732,6 +754,9 @@ function mousemoved(event){
function mouseended(event){
        dragging = false;
        var last_state=getMoveState(event);

        if (move_history != undefined){

          console.log("mouse ended, history length="+move_history.length);
          // find history snapshot farher than minimal or local best or first
          var last_dist=0;
@@ -790,6 +815,9 @@ function mouseended(event){
          console.log("rotation axis:"+inertial_rot_axis_speed[0].toString()+", angular_velocity="+(1000*inertial_rot_axis_speed[1])+" rad/s");

          inertial_rotate();

        }

}

var animation_array;