|
|
|
@ -1,78 +1,105 @@
|
|
|
|
import * as THREE from './lib/three.module.js';
|
|
|
|
import * as THREE from "./lib/three.module.js";
|
|
|
|
import { OrbitControls } from './lib/OrbitControls.js';
|
|
|
|
import { OrbitControls } from "./lib/OrbitControls.js";
|
|
|
|
//import { OrthographicTrackballControls } from './lib/OrthographicTrackballControls.js';
|
|
|
|
//import { OrthographicTrackballControls } from './lib/OrthographicTrackballControls.js';
|
|
|
|
import { TransformControls } from './lib/TransformControls.js';
|
|
|
|
import { TransformControls } from "./lib/TransformControls.js";
|
|
|
|
import {matmul2, euler_angle_to_rotate_matrix} from "./util.js"
|
|
|
|
import { matmul2, euler_angle_to_rotate_matrix } from "./util.js";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function ViewManager(
|
|
|
|
function ViewManager(mainViewContainer, webglScene, webglMainScene, renderer, globalRenderFunc, on_box_changed, cfg){
|
|
|
|
mainViewContainer,
|
|
|
|
|
|
|
|
webglScene,
|
|
|
|
|
|
|
|
webglMainScene,
|
|
|
|
|
|
|
|
renderer,
|
|
|
|
|
|
|
|
globalRenderFunc,
|
|
|
|
|
|
|
|
on_box_changed,
|
|
|
|
|
|
|
|
cfg
|
|
|
|
|
|
|
|
) {
|
|
|
|
this.mainViewContainer = mainViewContainer;
|
|
|
|
this.mainViewContainer = mainViewContainer;
|
|
|
|
this.globalRenderFunc = globalRenderFunc;
|
|
|
|
this.globalRenderFunc = globalRenderFunc;
|
|
|
|
this.webglScene = webglScene;
|
|
|
|
this.webglScene = webglScene;
|
|
|
|
this.webglMainScene = webglMainScene;
|
|
|
|
this.webglMainScene = webglMainScene;
|
|
|
|
this.renderer = renderer;
|
|
|
|
this.renderer = renderer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.mainView = cfg.disableMainView
|
|
|
|
this.mainView = cfg.disableMainView?null:create_main_view(webglMainScene, renderer, this.globalRenderFunc, this.mainViewContainer, on_box_changed);
|
|
|
|
? null
|
|
|
|
|
|
|
|
: create_main_view(
|
|
|
|
|
|
|
|
webglMainScene,
|
|
|
|
|
|
|
|
renderer,
|
|
|
|
|
|
|
|
this.globalRenderFunc,
|
|
|
|
|
|
|
|
this.mainViewContainer,
|
|
|
|
|
|
|
|
on_box_changed
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
this.boxViewList = [];
|
|
|
|
this.boxViewList = [];
|
|
|
|
|
|
|
|
|
|
|
|
this.addBoxView = function (subviewsUi) {
|
|
|
|
this.addBoxView = function (subviewsUi) {
|
|
|
|
let boxview = new BoxView(subviewsUi, this.mainViewContainer, this.webglScene, this.renderer, this);
|
|
|
|
let boxview = new BoxView(
|
|
|
|
|
|
|
|
subviewsUi,
|
|
|
|
|
|
|
|
this.mainViewContainer,
|
|
|
|
|
|
|
|
this.webglScene,
|
|
|
|
|
|
|
|
this.renderer,
|
|
|
|
|
|
|
|
this
|
|
|
|
|
|
|
|
);
|
|
|
|
this.boxViewList.push(boxview);
|
|
|
|
this.boxViewList.push(boxview);
|
|
|
|
return boxview;
|
|
|
|
return boxview;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
this.onWindowResize = function () {
|
|
|
|
this.onWindowResize = function () {
|
|
|
|
if (this.mainView)
|
|
|
|
if (this.mainView) this.mainView.onWindowResize();
|
|
|
|
this.mainView.onWindowResize();
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
this.render = function () {
|
|
|
|
this.render = function () {
|
|
|
|
console.log("render verything");
|
|
|
|
console.log("render verything");
|
|
|
|
if (this.mainView)
|
|
|
|
if (this.mainView) this.mainView.renderAll();
|
|
|
|
this.mainView.renderAll();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.boxViewList.forEach(v=>{
|
|
|
|
this.boxViewList.forEach((v) => {
|
|
|
|
//if (v.ui.style.display != 'none') //we have pseudo box now. render as commanded.
|
|
|
|
//if (v.ui.style.display != 'none') //we have pseudo box now. render as commanded.
|
|
|
|
v.render()
|
|
|
|
v.render();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setColorScheme = function () {
|
|
|
|
this.setColorScheme = function () {
|
|
|
|
let scheme = document.documentElement.className;
|
|
|
|
let scheme = document.documentElement.className;
|
|
|
|
if (scheme == "theme-dark")
|
|
|
|
if (scheme == "theme-dark") {
|
|
|
|
{
|
|
|
|
|
|
|
|
this.mainView.backgroundColor = new THREE.Color(0.0, 0.0, 0.0);
|
|
|
|
this.mainView.backgroundColor = new THREE.Color(0.0, 0.0, 0.0);
|
|
|
|
this.boxViewList.forEach(v=>{
|
|
|
|
this.boxViewList.forEach((v) => {
|
|
|
|
v.views[0].backgroundColor = new THREE.Color(0.1, 0.05, 0.05);
|
|
|
|
v.views[0].backgroundColor = new THREE.Color(0.1, 0.05, 0.05);
|
|
|
|
v.views[1].backgroundColor = new THREE.Color(0.05, 0.1, 0.05);
|
|
|
|
v.views[1].backgroundColor = new THREE.Color(0.05, 0.1, 0.05);
|
|
|
|
v.views[2].backgroundColor = new THREE.Color(0.05, 0.05, 0.1);
|
|
|
|
v.views[2].backgroundColor = new THREE.Color(0.05, 0.05, 0.1);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else{
|
|
|
|
|
|
|
|
this.mainView.backgroundColor = new THREE.Color(1.0, 1.0, 1.0);
|
|
|
|
this.mainView.backgroundColor = new THREE.Color(1.0, 1.0, 1.0);
|
|
|
|
this.boxViewList.forEach(v=>{
|
|
|
|
this.boxViewList.forEach((v) => {
|
|
|
|
v.views[0].backgroundColor = new THREE.Color(0.95, 0.9, 0.9);
|
|
|
|
v.views[0].backgroundColor = new THREE.Color(0.95, 0.9, 0.9);
|
|
|
|
v.views[1].backgroundColor = new THREE.Color(0.9, 0.95, 0.9);
|
|
|
|
v.views[1].backgroundColor = new THREE.Color(0.9, 0.95, 0.9);
|
|
|
|
v.views[2].backgroundColor = new THREE.Color(0.9, 0.9, 0.95);
|
|
|
|
v.views[2].backgroundColor = new THREE.Color(0.9, 0.9, 0.95);
|
|
|
|
})
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//this.setColorScheme();
|
|
|
|
//this.setColorScheme();
|
|
|
|
|
|
|
|
|
|
|
|
// no public funcs below
|
|
|
|
// no public funcs below
|
|
|
|
function create_main_view(scene, renderer, globalRenderFunc, container, on_box_changed){
|
|
|
|
function create_main_view(
|
|
|
|
|
|
|
|
scene,
|
|
|
|
|
|
|
|
renderer,
|
|
|
|
|
|
|
|
globalRenderFunc,
|
|
|
|
|
|
|
|
container,
|
|
|
|
|
|
|
|
on_box_changed
|
|
|
|
|
|
|
|
) {
|
|
|
|
var view = {};
|
|
|
|
var view = {};
|
|
|
|
|
|
|
|
|
|
|
|
view.backgroundColor= (document.documentElement.className == "theme-dark") ? new THREE.Color( 0.0, 0.0, 0.0 ) : new THREE.Color( 1.0, 1.0, 1.0 );
|
|
|
|
view.backgroundColor =
|
|
|
|
|
|
|
|
document.documentElement.className == "theme-dark"
|
|
|
|
|
|
|
|
? new THREE.Color(0.0, 0.0, 0.0)
|
|
|
|
|
|
|
|
: new THREE.Color(1.0, 1.0, 1.0);
|
|
|
|
view.zoom_ratio = 1.0; //useless for mainview
|
|
|
|
view.zoom_ratio = 1.0; //useless for mainview
|
|
|
|
|
|
|
|
|
|
|
|
let camera = new THREE.PerspectiveCamera( 65, container.clientWidth / container.clientHeight, 1, 500 );
|
|
|
|
let camera = new THREE.PerspectiveCamera(
|
|
|
|
|
|
|
|
65,
|
|
|
|
|
|
|
|
container.clientWidth / container.clientHeight,
|
|
|
|
|
|
|
|
1,
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
|
);
|
|
|
|
camera.position.x = 0;
|
|
|
|
camera.position.x = 0;
|
|
|
|
camera.position.z = 50;
|
|
|
|
camera.position.z = 50;
|
|
|
|
camera.position.y = 0;
|
|
|
|
camera.position.y = 0;
|
|
|
|
@ -83,7 +110,12 @@ function ViewManager(mainViewContainer, webglScene, webglMainScene, renderer, gl
|
|
|
|
view.camera = camera;
|
|
|
|
view.camera = camera;
|
|
|
|
|
|
|
|
|
|
|
|
// make a blind camera to clean background when batch editing is enabled.
|
|
|
|
// make a blind camera to clean background when batch editing is enabled.
|
|
|
|
camera = new THREE.PerspectiveCamera( 65, container.clientWidth / container.clientHeight, 1, 500 );
|
|
|
|
camera = new THREE.PerspectiveCamera(
|
|
|
|
|
|
|
|
65,
|
|
|
|
|
|
|
|
container.clientWidth / container.clientHeight,
|
|
|
|
|
|
|
|
1,
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
|
);
|
|
|
|
camera.position.x = -1000;
|
|
|
|
camera.position.x = -1000;
|
|
|
|
camera.position.z = -1000;
|
|
|
|
camera.position.z = -1000;
|
|
|
|
camera.position.y = -1000;
|
|
|
|
camera.position.y = -1000;
|
|
|
|
@ -91,7 +123,6 @@ function ViewManager(mainViewContainer, webglScene, webglMainScene, renderer, gl
|
|
|
|
camera.lookAt(0, 0, 0);
|
|
|
|
camera.lookAt(0, 0, 0);
|
|
|
|
view.blind_camera = camera;
|
|
|
|
view.blind_camera = camera;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
view.container = container;
|
|
|
|
view.container = container;
|
|
|
|
view.renderer = renderer;
|
|
|
|
view.renderer = renderer;
|
|
|
|
view.scene = scene;
|
|
|
|
view.scene = scene;
|
|
|
|
@ -103,8 +134,7 @@ function ViewManager(mainViewContainer, webglScene, webglMainScene, renderer, gl
|
|
|
|
this.renderWithCamera(this.blind_camera);
|
|
|
|
this.renderWithCamera(this.blind_camera);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
view.dumpPose = function()
|
|
|
|
view.dumpPose = function () {
|
|
|
|
{
|
|
|
|
|
|
|
|
console.log(this.camera.position, this.camera.rotation);
|
|
|
|
console.log(this.camera.position, this.camera.rotation);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
@ -134,12 +164,10 @@ function ViewManager(mainViewContainer, webglScene, webglMainScene, renderer, gl
|
|
|
|
if (this.active) {
|
|
|
|
if (this.active) {
|
|
|
|
//this.switch_camera(false);
|
|
|
|
//this.switch_camera(false);
|
|
|
|
this.renderWithCamera(this.camera);
|
|
|
|
this.renderWithCamera(this.camera);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
this.renderWithCamera(this.blind_camera);
|
|
|
|
this.renderWithCamera(this.blind_camera);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
view.clearView = function () {
|
|
|
|
view.clearView = function () {
|
|
|
|
this.renderWithCamera(this.blind_camera);
|
|
|
|
this.renderWithCamera(this.blind_camera);
|
|
|
|
@ -154,7 +182,6 @@ function ViewManager(mainViewContainer, webglScene, webglMainScene, renderer, gl
|
|
|
|
// update viewport, so the operating lines over these views
|
|
|
|
// update viewport, so the operating lines over these views
|
|
|
|
// will be updated in time.
|
|
|
|
// will be updated in time.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//console.log(left,bottom, width, height);
|
|
|
|
//console.log(left,bottom, width, height);
|
|
|
|
|
|
|
|
|
|
|
|
this.renderer.setViewport(left, bottom, width, height);
|
|
|
|
this.renderer.setViewport(left, bottom, width, height);
|
|
|
|
@ -165,20 +192,26 @@ function ViewManager(mainViewContainer, webglScene, webglMainScene, renderer, gl
|
|
|
|
this.renderer.render(this.scene, camera);
|
|
|
|
this.renderer.render(this.scene, camera);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var orbit_perspective = new OrbitControls(
|
|
|
|
var orbit_perspective = new OrbitControls( view.camera_perspective, view.container );
|
|
|
|
view.camera_perspective,
|
|
|
|
|
|
|
|
view.container
|
|
|
|
|
|
|
|
);
|
|
|
|
orbit_perspective.update();
|
|
|
|
orbit_perspective.update();
|
|
|
|
orbit_perspective.addEventListener( 'change', globalRenderFunc );
|
|
|
|
orbit_perspective.addEventListener("change", globalRenderFunc);
|
|
|
|
//orbit_perspective.enabled = true;
|
|
|
|
//orbit_perspective.enabled = true;
|
|
|
|
view.orbit_perspective = orbit_perspective;
|
|
|
|
view.orbit_perspective = orbit_perspective;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var transform_control = new TransformControls(
|
|
|
|
var transform_control = new TransformControls(view.camera_perspective , view.container );
|
|
|
|
view.camera_perspective,
|
|
|
|
|
|
|
|
view.container
|
|
|
|
|
|
|
|
);
|
|
|
|
transform_control.setSpace("local");
|
|
|
|
transform_control.setSpace("local");
|
|
|
|
transform_control.addEventListener( 'change', globalRenderFunc );
|
|
|
|
transform_control.addEventListener("change", globalRenderFunc);
|
|
|
|
transform_control.addEventListener( 'objectChange', function(e){on_box_changed(e.target.object);});
|
|
|
|
transform_control.addEventListener("objectChange", function (e) {
|
|
|
|
|
|
|
|
on_box_changed(e.target.object);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
transform_control.addEventListener( 'dragging-changed', function ( event ) {
|
|
|
|
transform_control.addEventListener("dragging-changed", function (event) {
|
|
|
|
view.orbit_perspective.enabled = !event.value;
|
|
|
|
view.orbit_perspective.enabled = !event.value;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
transform_control.visible = false;
|
|
|
|
transform_control.visible = false;
|
|
|
|
@ -186,9 +219,6 @@ function ViewManager(mainViewContainer, webglScene, webglMainScene, renderer, gl
|
|
|
|
scene.add(transform_control);
|
|
|
|
scene.add(transform_control);
|
|
|
|
view.transform_control_perspective = transform_control;
|
|
|
|
view.transform_control_perspective = transform_control;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var width = container.clientWidth;
|
|
|
|
var width = container.clientWidth;
|
|
|
|
var height = container.clientHeight;
|
|
|
|
var height = container.clientHeight;
|
|
|
|
var asp = width / height;
|
|
|
|
var asp = width / height;
|
|
|
|
@ -205,12 +235,10 @@ function ViewManager(mainViewContainer, webglScene, webglMainScene, renderer, gl
|
|
|
|
// camera = new THREE.OrthographicCamera(-asp*200, asp*200, 200, -200, -200, 200 );
|
|
|
|
// camera = new THREE.OrthographicCamera(-asp*200, asp*200, 200, -200, -200, 200 );
|
|
|
|
// camera.position.z = 50;
|
|
|
|
// camera.position.z = 50;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// var cameraOrthoHelper = new THREE.CameraHelper( camera );
|
|
|
|
// var cameraOrthoHelper = new THREE.CameraHelper( camera );
|
|
|
|
// cameraOrthoHelper.visible=true;
|
|
|
|
// cameraOrthoHelper.visible=true;
|
|
|
|
// scene.add( cameraOrthoHelper );
|
|
|
|
// scene.add( cameraOrthoHelper );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//view.camera_orth = camera;
|
|
|
|
//view.camera_orth = camera;
|
|
|
|
|
|
|
|
|
|
|
|
// var orbit_orth = new OrbitControls( view.camera_orth, view.container );
|
|
|
|
// var orbit_orth = new OrbitControls( view.camera_orth, view.container );
|
|
|
|
@ -238,35 +266,27 @@ function ViewManager(mainViewContainer, webglScene, webglMainScene, renderer, gl
|
|
|
|
// transform_control.addEventListener( 'change', globalRenderFunc );
|
|
|
|
// transform_control.addEventListener( 'change', globalRenderFunc );
|
|
|
|
// transform_control.addEventListener( 'objectChange', function(e){on_box_changed(e.target.object);} );
|
|
|
|
// transform_control.addEventListener( 'objectChange', function(e){on_box_changed(e.target.object);} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// transform_control.addEventListener( 'dragging-changed', function ( event ) {
|
|
|
|
// transform_control.addEventListener( 'dragging-changed', function ( event ) {
|
|
|
|
// view.orbit_orth.enabled = ! event.value;
|
|
|
|
// view.orbit_orth.enabled = ! event.value;
|
|
|
|
// } );
|
|
|
|
// } );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// transform_control.visible = false;
|
|
|
|
// transform_control.visible = false;
|
|
|
|
// //transform_control.enabled = true;
|
|
|
|
// //transform_control.enabled = true;
|
|
|
|
// //scene.add( transform_control );
|
|
|
|
// //scene.add( transform_control );
|
|
|
|
|
|
|
|
|
|
|
|
// view.transform_control_orth = transform_control;
|
|
|
|
// view.transform_control_orth = transform_control;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
view.camera = view.camera_perspective;
|
|
|
|
view.camera = view.camera_perspective;
|
|
|
|
view.orbit = view.orbit_perspective;
|
|
|
|
view.orbit = view.orbit_perspective;
|
|
|
|
view.transform_control = view.transform_control_perspective;
|
|
|
|
view.transform_control = view.transform_control_perspective;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
view.switch_camera = function (birdseye) {
|
|
|
|
view.switch_camera = function(birdseye)
|
|
|
|
if (!birdseye && this.camera === this.camera_orth) {
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!birdseye && (this.camera === this.camera_orth)){
|
|
|
|
|
|
|
|
this.camera = this.camera_perspective;
|
|
|
|
this.camera = this.camera_perspective;
|
|
|
|
this.orbit_orth.enabled = false;
|
|
|
|
this.orbit_orth.enabled = false;
|
|
|
|
this.orbit_perspective.enabled = true;
|
|
|
|
this.orbit_perspective.enabled = true;
|
|
|
|
this.orbit = this.orbit_perspective;
|
|
|
|
this.orbit = this.orbit_perspective;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.transform_control_perspective.detach();
|
|
|
|
this.transform_control_perspective.detach();
|
|
|
|
this.transform_control_orth.detach();
|
|
|
|
this.transform_control_orth.detach();
|
|
|
|
|
|
|
|
|
|
|
|
@ -275,9 +295,7 @@ function ViewManager(mainViewContainer, webglScene, webglMainScene, renderer, gl
|
|
|
|
//this.transform_control_perspective.visible = false;
|
|
|
|
//this.transform_control_perspective.visible = false;
|
|
|
|
//this.transform_control_orth.visible = false;
|
|
|
|
//this.transform_control_orth.visible = false;
|
|
|
|
this.transform_control = this.transform_control_perspective;
|
|
|
|
this.transform_control = this.transform_control_perspective;
|
|
|
|
}
|
|
|
|
} else if (birdseye && this.camera === this.camera_perspective) {
|
|
|
|
else if (birdseye && (this.camera === this.camera_perspective))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
this.camera = this.camera_orth;
|
|
|
|
this.camera = this.camera_orth;
|
|
|
|
this.orbit_orth.enabled = true;
|
|
|
|
this.orbit_orth.enabled = true;
|
|
|
|
this.orbit_perspective.enabled = false;
|
|
|
|
this.orbit_perspective.enabled = false;
|
|
|
|
@ -315,8 +333,6 @@ function ViewManager(mainViewContainer, webglScene, webglMainScene, renderer, gl
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
view.onWindowResize = function () {
|
|
|
|
view.onWindowResize = function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var asp = container.clientWidth / container.clientHeight;
|
|
|
|
var asp = container.clientWidth / container.clientHeight;
|
|
|
|
// this.camera_orth.left = -asp*200;
|
|
|
|
// this.camera_orth.left = -asp*200;
|
|
|
|
// this.camera_orth.right = asp*200;
|
|
|
|
// this.camera_orth.right = asp*200;
|
|
|
|
@ -327,9 +343,9 @@ function ViewManager(mainViewContainer, webglScene, webglMainScene, renderer, gl
|
|
|
|
// this.orbit_orth.handleResize();
|
|
|
|
// this.orbit_orth.handleResize();
|
|
|
|
// this.orbit_orth.update();
|
|
|
|
// this.orbit_orth.update();
|
|
|
|
|
|
|
|
|
|
|
|
this.camera_perspective.aspect = container.clientWidth / container.clientHeight;
|
|
|
|
this.camera_perspective.aspect =
|
|
|
|
|
|
|
|
container.clientWidth / container.clientHeight;
|
|
|
|
this.camera_perspective.updateProjectionMatrix();
|
|
|
|
this.camera_perspective.updateProjectionMatrix();
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
view.reset_birdseye = function () {
|
|
|
|
view.reset_birdseye = function () {
|
|
|
|
@ -338,10 +354,10 @@ function ViewManager(mainViewContainer, webglScene, webglMainScene, renderer, gl
|
|
|
|
view.rotate_birdseye = function () {
|
|
|
|
view.rotate_birdseye = function () {
|
|
|
|
//this.camera_orth.up.set( 1, 0, 0);
|
|
|
|
//this.camera_orth.up.set( 1, 0, 0);
|
|
|
|
//this.orbit_orth.update();
|
|
|
|
//this.orbit_orth.update();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
view.detach_control = function () {
|
|
|
|
view.detach_control = function () {
|
|
|
|
this.transform_control.detach();
|
|
|
|
this.transform_control.detach();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
view.target0 = view.orbit.target.clone();
|
|
|
|
view.target0 = view.orbit.target.clone();
|
|
|
|
view.position0 = view.camera.position.clone();
|
|
|
|
view.position0 = view.camera.position.clone();
|
|
|
|
@ -352,22 +368,35 @@ function ViewManager(mainViewContainer, webglScene, webglMainScene, renderer, gl
|
|
|
|
this.target0.copy(this.orbit.target);
|
|
|
|
this.target0.copy(this.orbit.target);
|
|
|
|
this.position0.copy(this.camera.position);
|
|
|
|
this.position0.copy(this.camera.position);
|
|
|
|
this.zoom0 = this.camera.zoom;
|
|
|
|
this.zoom0 = this.camera.zoom;
|
|
|
|
this.scale0 = {x: highlight_obj_scale.x, y: highlight_obj_scale.y, z: highlight_obj_scale.z};
|
|
|
|
this.scale0 = {
|
|
|
|
}
|
|
|
|
x: highlight_obj_scale.x,
|
|
|
|
|
|
|
|
y: highlight_obj_scale.y,
|
|
|
|
|
|
|
|
z: highlight_obj_scale.z,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
view.restore_relative_orbit_state = function (highlight_obj_scale) {
|
|
|
|
view.restore_relative_orbit_state = function (highlight_obj_scale) {
|
|
|
|
|
|
|
|
|
|
|
|
if (view.scale0) {
|
|
|
|
if (view.scale0) {
|
|
|
|
// restore last viewpoint
|
|
|
|
// restore last viewpoint
|
|
|
|
|
|
|
|
|
|
|
|
var obj_size = Math.sqrt(view.scale0.x*view.scale0.x + view.scale0.y*view.scale0.y + view.scale0.z*view.scale0.z);
|
|
|
|
var obj_size = Math.sqrt(
|
|
|
|
var target_obj_size = Math.sqrt(highlight_obj_scale.x*highlight_obj_scale.x + highlight_obj_scale.y*highlight_obj_scale.y + highlight_obj_scale.z*highlight_obj_scale.z);
|
|
|
|
view.scale0.x * view.scale0.x +
|
|
|
|
|
|
|
|
view.scale0.y * view.scale0.y +
|
|
|
|
|
|
|
|
view.scale0.z * view.scale0.z
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
var target_obj_size = Math.sqrt(
|
|
|
|
|
|
|
|
highlight_obj_scale.x * highlight_obj_scale.x +
|
|
|
|
|
|
|
|
highlight_obj_scale.y * highlight_obj_scale.y +
|
|
|
|
|
|
|
|
highlight_obj_scale.z * highlight_obj_scale.z
|
|
|
|
|
|
|
|
);
|
|
|
|
var ratio = target_obj_size / obj_size;
|
|
|
|
var ratio = target_obj_size / obj_size;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.camera.position.x =
|
|
|
|
this.camera.position.x = this.orbit.target.x + (this.position0.x - this.target0.x)*ratio;
|
|
|
|
this.orbit.target.x + (this.position0.x - this.target0.x) * ratio;
|
|
|
|
this.camera.position.y = this.orbit.target.y + (this.position0.y - this.target0.y)*ratio;
|
|
|
|
this.camera.position.y =
|
|
|
|
this.camera.position.z = this.orbit.target.z + (this.position0.z - this.target0.z)*ratio;
|
|
|
|
this.orbit.target.y + (this.position0.y - this.target0.y) * ratio;
|
|
|
|
|
|
|
|
this.camera.position.z =
|
|
|
|
|
|
|
|
this.orbit.target.z + (this.position0.z - this.target0.z) * ratio;
|
|
|
|
|
|
|
|
|
|
|
|
this.camera.zoom = this.zoom0;
|
|
|
|
this.camera.zoom = this.zoom0;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -375,19 +404,17 @@ function ViewManager(mainViewContainer, webglScene, webglMainScene, renderer, gl
|
|
|
|
this.camera.position.set(
|
|
|
|
this.camera.position.set(
|
|
|
|
this.orbit.target.x + highlight_obj_scale.x * 3,
|
|
|
|
this.orbit.target.x + highlight_obj_scale.x * 3,
|
|
|
|
this.orbit.target.y + highlight_obj_scale.y * 3,
|
|
|
|
this.orbit.target.y + highlight_obj_scale.y * 3,
|
|
|
|
this.orbit.target.z + highlight_obj_scale.z*3);
|
|
|
|
this.orbit.target.z + highlight_obj_scale.z * 3
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// target is set
|
|
|
|
// target is set
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return view;
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function BoxView(ui, mainViewContainer, scene, renderer, viewManager) {
|
|
|
|
function BoxView(ui, mainViewContainer, scene, renderer, viewManager) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.viewManager = viewManager;
|
|
|
|
this.viewManager = viewManager;
|
|
|
|
this.mainViewContainer = mainViewContainer;
|
|
|
|
this.mainViewContainer = mainViewContainer;
|
|
|
|
this.ui = ui; //sub-views
|
|
|
|
this.ui = ui; //sub-views
|
|
|
|
@ -395,10 +422,9 @@ function BoxView(ui, mainViewContainer, scene, renderer, viewManager){
|
|
|
|
// ui offset
|
|
|
|
// ui offset
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
top: this.ui.offsetTop,
|
|
|
|
top: this.ui.offsetTop,
|
|
|
|
left: this.ui.offsetLeft
|
|
|
|
left: this.ui.offsetLeft,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.defaultBox = {
|
|
|
|
this.defaultBox = {
|
|
|
|
position: { x: -100, y: -100, z: 0 },
|
|
|
|
position: { x: -100, y: -100, z: 0 },
|
|
|
|
@ -409,10 +435,9 @@ function BoxView(ui, mainViewContainer, scene, renderer, viewManager){
|
|
|
|
this.box = this.defaultBox;
|
|
|
|
this.box = this.defaultBox;
|
|
|
|
|
|
|
|
|
|
|
|
this.attachBox = function (box) {
|
|
|
|
this.attachBox = function (box) {
|
|
|
|
|
|
|
|
|
|
|
|
this.box = box;
|
|
|
|
this.box = box;
|
|
|
|
|
|
|
|
|
|
|
|
this.views.forEach(v=>{
|
|
|
|
this.views.forEach((v) => {
|
|
|
|
//this.box.world.webglGroup.add(v.camera);
|
|
|
|
//this.box.world.webglGroup.add(v.camera);
|
|
|
|
//this.box.world.webglGroup.add(v.cameraHelper);
|
|
|
|
//this.box.world.webglGroup.add(v.cameraHelper);
|
|
|
|
|
|
|
|
|
|
|
|
@ -431,8 +456,7 @@ function BoxView(ui, mainViewContainer, scene, renderer, viewManager){
|
|
|
|
this.updateCameraPose(this.box);
|
|
|
|
this.updateCameraPose(this.box);
|
|
|
|
this.updateCameraRange(this.box);
|
|
|
|
this.updateCameraRange(this.box);
|
|
|
|
|
|
|
|
|
|
|
|
if (!dontRender)
|
|
|
|
if (!dontRender) this.render();
|
|
|
|
this.render();
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
this.updateCameraPose = function (box) {
|
|
|
|
this.updateCameraPose = function (box) {
|
|
|
|
@ -444,17 +468,15 @@ function BoxView(ui, mainViewContainer, scene, renderer, viewManager){
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
this.hidden = function () {
|
|
|
|
this.hidden = function () {
|
|
|
|
return this.ui.style.display == 'none';
|
|
|
|
return this.ui.style.display == "none";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
this.render = function () {
|
|
|
|
this.render = function () {
|
|
|
|
if (!this.hidden())
|
|
|
|
if (!this.hidden()) this.views.forEach((v) => v.render());
|
|
|
|
this.views.forEach((v)=>v.render());
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var scope = this;
|
|
|
|
var scope = this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scope.projViewProto = {
|
|
|
|
scope.projViewProto = {
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
let vp = this.getViewPort();
|
|
|
|
let vp = this.getViewPort();
|
|
|
|
@ -469,14 +491,16 @@ function BoxView(ui, mainViewContainer, scene, renderer, viewManager){
|
|
|
|
getViewPort() {
|
|
|
|
getViewPort() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
left: this.placeHolderUi.offsetLeft + scope.baseOffset().left,
|
|
|
|
left: this.placeHolderUi.offsetLeft + scope.baseOffset().left,
|
|
|
|
bottom : this.container.scrollHeight - (scope.baseOffset().top + this.placeHolderUi.offsetTop + this.placeHolderUi.clientHeight),
|
|
|
|
bottom:
|
|
|
|
|
|
|
|
this.container.scrollHeight -
|
|
|
|
|
|
|
|
(scope.baseOffset().top +
|
|
|
|
|
|
|
|
this.placeHolderUi.offsetTop +
|
|
|
|
|
|
|
|
this.placeHolderUi.clientHeight),
|
|
|
|
width: this.placeHolderUi.clientWidth,
|
|
|
|
width: this.placeHolderUi.clientWidth,
|
|
|
|
height: this.placeHolderUi.clientHeight,
|
|
|
|
height: this.placeHolderUi.clientHeight,
|
|
|
|
zoom_ratio: this.zoom_ratio,
|
|
|
|
zoom_ratio: this.zoom_ratio,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
this.views = [
|
|
|
|
this.views = [
|
|
|
|
@ -490,7 +514,10 @@ function BoxView(ui, mainViewContainer, scene, renderer, viewManager){
|
|
|
|
view.name = "topview";
|
|
|
|
view.name = "topview";
|
|
|
|
view.zoom_ratio = 1.0;
|
|
|
|
view.zoom_ratio = 1.0;
|
|
|
|
|
|
|
|
|
|
|
|
view.backgroundColor = (document.documentElement.className == "theme-dark") ? new THREE.Color( 0.1, 0.05, 0.05 ) : new THREE.Color( 0.95, 0.9, 0.9 );
|
|
|
|
view.backgroundColor =
|
|
|
|
|
|
|
|
document.documentElement.className == "theme-dark"
|
|
|
|
|
|
|
|
? new THREE.Color(0.1, 0.05, 0.05)
|
|
|
|
|
|
|
|
: new THREE.Color(0.95, 0.9, 0.9);
|
|
|
|
view.container = container;
|
|
|
|
view.container = container;
|
|
|
|
view.scene = scene;
|
|
|
|
view.scene = scene;
|
|
|
|
view.renderer = renderer;
|
|
|
|
view.renderer = renderer;
|
|
|
|
@ -517,7 +544,6 @@ function BoxView(ui, mainViewContainer, scene, renderer, viewManager){
|
|
|
|
view.cameraContainer.name = "topview-camera";
|
|
|
|
view.cameraContainer.name = "topview-camera";
|
|
|
|
view.cameraContainer.add(camera);
|
|
|
|
view.cameraContainer.add(camera);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
view.updateCameraPose = function (box) {
|
|
|
|
view.updateCameraPose = function (box) {
|
|
|
|
var p = box.position;
|
|
|
|
var p = box.position;
|
|
|
|
var r = box.rotation;
|
|
|
|
var r = box.rotation;
|
|
|
|
@ -528,7 +554,6 @@ function BoxView(ui, mainViewContainer, scene, renderer, viewManager){
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
view.updateCameraRange = function (box) {
|
|
|
|
view.updateCameraRange = function (box) {
|
|
|
|
|
|
|
|
|
|
|
|
var exp_camera_width, exp_camera_height, exp_camera_clip;
|
|
|
|
var exp_camera_width, exp_camera_height, exp_camera_clip;
|
|
|
|
|
|
|
|
|
|
|
|
//view.width = 0.2;//params["side view width"];
|
|
|
|
//view.width = 0.2;//params["side view width"];
|
|
|
|
@ -542,11 +567,9 @@ function BoxView(ui, mainViewContainer, scene, renderer, viewManager){
|
|
|
|
|
|
|
|
|
|
|
|
if (exp_camera_width / exp_camera_height > view_width / view_height) {
|
|
|
|
if (exp_camera_width / exp_camera_height > view_width / view_height) {
|
|
|
|
//increase height
|
|
|
|
//increase height
|
|
|
|
exp_camera_height = exp_camera_width * view_height/view_width;
|
|
|
|
exp_camera_height = (exp_camera_width * view_height) / view_width;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else
|
|
|
|
exp_camera_width = (exp_camera_height * view_width) / view_height;
|
|
|
|
{
|
|
|
|
|
|
|
|
exp_camera_width = exp_camera_height * view_width/view_height;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.camera.top = exp_camera_height / 2;
|
|
|
|
this.camera.top = exp_camera_height / 2;
|
|
|
|
@ -568,13 +591,15 @@ function BoxView(ui, mainViewContainer, scene, renderer, viewManager){
|
|
|
|
return view;
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function createSideView(scene, renderer, container) {
|
|
|
|
function createSideView(scene, renderer, container) {
|
|
|
|
let view = Object.create(scope.projViewProto);
|
|
|
|
let view = Object.create(scope.projViewProto);
|
|
|
|
view.name = "sideview";
|
|
|
|
view.name = "sideview";
|
|
|
|
view.zoom_ratio = 1.0;
|
|
|
|
view.zoom_ratio = 1.0;
|
|
|
|
//view.backgroundColor=new THREE.Color( 0.1, 0.2, 0.1 );
|
|
|
|
//view.backgroundColor=new THREE.Color( 0.1, 0.2, 0.1 );
|
|
|
|
view.backgroundColor=(document.documentElement.className == "theme-dark") ? new THREE.Color( 0.05, 0.1, 0.05 ) : new THREE.Color( 0.9, 0.95, 0.9 );
|
|
|
|
view.backgroundColor =
|
|
|
|
|
|
|
|
document.documentElement.className == "theme-dark"
|
|
|
|
|
|
|
|
? new THREE.Color(0.05, 0.1, 0.05)
|
|
|
|
|
|
|
|
: new THREE.Color(0.9, 0.95, 0.9);
|
|
|
|
view.container = container;
|
|
|
|
view.container = container;
|
|
|
|
view.scene = scene;
|
|
|
|
view.scene = scene;
|
|
|
|
view.renderer = renderer;
|
|
|
|
view.renderer = renderer;
|
|
|
|
@ -614,7 +639,6 @@ function BoxView(ui, mainViewContainer, scene, renderer, viewManager){
|
|
|
|
//camera.up.set( 0, 1, 0);
|
|
|
|
//camera.up.set( 0, 1, 0);
|
|
|
|
//camera.lookAt( 0, 0, -3 );
|
|
|
|
//camera.lookAt( 0, 0, -3 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// camera should not be changed again?
|
|
|
|
// camera should not be changed again?
|
|
|
|
view.camera = camera;
|
|
|
|
view.camera = camera;
|
|
|
|
|
|
|
|
|
|
|
|
@ -626,7 +650,6 @@ function BoxView(ui, mainViewContainer, scene, renderer, viewManager){
|
|
|
|
view.cameraContainer.position.y = p.y;
|
|
|
|
view.cameraContainer.position.y = p.y;
|
|
|
|
view.cameraContainer.position.z = p.z;
|
|
|
|
view.cameraContainer.position.z = p.z;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
view.cameraContainer.rotation.x = r.x;
|
|
|
|
view.cameraContainer.rotation.x = r.x;
|
|
|
|
view.cameraContainer.rotation.y = r.y;
|
|
|
|
view.cameraContainer.rotation.y = r.y;
|
|
|
|
view.cameraContainer.rotation.z = r.z;
|
|
|
|
view.cameraContainer.rotation.z = r.z;
|
|
|
|
@ -634,26 +657,20 @@ function BoxView(ui, mainViewContainer, scene, renderer, viewManager){
|
|
|
|
|
|
|
|
|
|
|
|
// var trans_matrix = euler_angle_to_rotate_matrix(r, p);
|
|
|
|
// var trans_matrix = euler_angle_to_rotate_matrix(r, p);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this.camera.position.x= p.x;
|
|
|
|
// this.camera.position.x= p.x;
|
|
|
|
// this.camera.position.y= p.y;
|
|
|
|
// this.camera.position.y= p.y;
|
|
|
|
// this.camera.position.z= p.z;
|
|
|
|
// this.camera.position.z= p.z;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// var up = matmul2(trans_matrix, [0, 0, 1, 0], 4);
|
|
|
|
// var up = matmul2(trans_matrix, [0, 0, 1, 0], 4);
|
|
|
|
// this.camera.up.set( up[0], up[1], up[2]);
|
|
|
|
// this.camera.up.set( up[0], up[1], up[2]);
|
|
|
|
// var at = matmul2(trans_matrix, [0, 1, 0, 1], 4);
|
|
|
|
// var at = matmul2(trans_matrix, [0, 1, 0, 1], 4);
|
|
|
|
// this.camera.lookAt( at[0], at[1], at[2] );
|
|
|
|
// this.camera.lookAt( at[0], at[1], at[2] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this.camera.updateProjectionMatrix();
|
|
|
|
// this.camera.updateProjectionMatrix();
|
|
|
|
// this.cameraHelper.update();
|
|
|
|
// this.cameraHelper.update();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
view.updateCameraRange = function (box) {
|
|
|
|
view.updateCameraRange = function (box) {
|
|
|
|
|
|
|
|
|
|
|
|
var exp_camera_width, exp_camera_height, exp_camera_clip;
|
|
|
|
var exp_camera_width, exp_camera_height, exp_camera_clip;
|
|
|
|
|
|
|
|
|
|
|
|
//view.width = 0.2;//params["side view width"];
|
|
|
|
//view.width = 0.2;//params["side view width"];
|
|
|
|
@ -668,11 +685,9 @@ function BoxView(ui, mainViewContainer, scene, renderer, viewManager){
|
|
|
|
|
|
|
|
|
|
|
|
if (exp_camera_width / exp_camera_height > view_width / view_height) {
|
|
|
|
if (exp_camera_width / exp_camera_height > view_width / view_height) {
|
|
|
|
//increase height
|
|
|
|
//increase height
|
|
|
|
exp_camera_height = exp_camera_width * view_height/view_width;
|
|
|
|
exp_camera_height = (exp_camera_width * view_height) / view_width;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else
|
|
|
|
exp_camera_width = (exp_camera_height * view_width) / view_height;
|
|
|
|
{
|
|
|
|
|
|
|
|
exp_camera_width = exp_camera_height * view_width/view_height;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.camera.top = exp_camera_height / 2;
|
|
|
|
this.camera.top = exp_camera_height / 2;
|
|
|
|
@ -696,7 +711,10 @@ function BoxView(ui, mainViewContainer, scene, renderer, viewManager){
|
|
|
|
view.name = "backview";
|
|
|
|
view.name = "backview";
|
|
|
|
view.zoom_ratio = 1.0;
|
|
|
|
view.zoom_ratio = 1.0;
|
|
|
|
//view.backgroundColor=new THREE.Color( 0.2, 0.1, 0.1 );
|
|
|
|
//view.backgroundColor=new THREE.Color( 0.2, 0.1, 0.1 );
|
|
|
|
view.backgroundColor= (document.documentElement.className == "theme-dark") ? new THREE.Color( 0.05, 0.05, 0.1 ) : new THREE.Color( 0.9, 0.9, 0.95 );
|
|
|
|
view.backgroundColor =
|
|
|
|
|
|
|
|
document.documentElement.className == "theme-dark"
|
|
|
|
|
|
|
|
? new THREE.Color(0.05, 0.05, 0.1)
|
|
|
|
|
|
|
|
: new THREE.Color(0.9, 0.9, 0.95);
|
|
|
|
view.container = container;
|
|
|
|
view.container = container;
|
|
|
|
view.scene = scene;
|
|
|
|
view.scene = scene;
|
|
|
|
view.renderer = renderer;
|
|
|
|
view.renderer = renderer;
|
|
|
|
@ -727,7 +745,6 @@ function BoxView(ui, mainViewContainer, scene, renderer, viewManager){
|
|
|
|
view.cameraContainer.add(camera);
|
|
|
|
view.cameraContainer.add(camera);
|
|
|
|
|
|
|
|
|
|
|
|
view.updateCameraPose = function (box) {
|
|
|
|
view.updateCameraPose = function (box) {
|
|
|
|
|
|
|
|
|
|
|
|
let p = box.position;
|
|
|
|
let p = box.position;
|
|
|
|
let r = box.rotation;
|
|
|
|
let r = box.rotation;
|
|
|
|
|
|
|
|
|
|
|
|
@ -742,7 +759,6 @@ function BoxView(ui, mainViewContainer, scene, renderer, viewManager){
|
|
|
|
// var at3 = matmul2(trans_matrix, [1, 0, 0, 1], 4);
|
|
|
|
// var at3 = matmul2(trans_matrix, [1, 0, 0, 1], 4);
|
|
|
|
// this.camera.lookAt( at3[0], at3[1], at3[2] );
|
|
|
|
// this.camera.lookAt( at3[0], at3[1], at3[2] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this.camera.updateProjectionMatrix();
|
|
|
|
// this.camera.updateProjectionMatrix();
|
|
|
|
// this.cameraHelper.update();
|
|
|
|
// this.cameraHelper.update();
|
|
|
|
|
|
|
|
|
|
|
|
@ -751,7 +767,6 @@ function BoxView(ui, mainViewContainer, scene, renderer, viewManager){
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
view.updateCameraRange = function (box) {
|
|
|
|
view.updateCameraRange = function (box) {
|
|
|
|
|
|
|
|
|
|
|
|
var exp_camera_width, exp_camera_height, exp_camera_clip;
|
|
|
|
var exp_camera_width, exp_camera_height, exp_camera_clip;
|
|
|
|
|
|
|
|
|
|
|
|
//view.width = 0.2;//params["side view width"];
|
|
|
|
//view.width = 0.2;//params["side view width"];
|
|
|
|
@ -765,11 +780,9 @@ function BoxView(ui, mainViewContainer, scene, renderer, viewManager){
|
|
|
|
|
|
|
|
|
|
|
|
if (exp_camera_width / exp_camera_height > view_width / view_height) {
|
|
|
|
if (exp_camera_width / exp_camera_height > view_width / view_height) {
|
|
|
|
//increase height
|
|
|
|
//increase height
|
|
|
|
exp_camera_height = exp_camera_width * view_height/view_width;
|
|
|
|
exp_camera_height = (exp_camera_width * view_height) / view_width;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else
|
|
|
|
exp_camera_width = (exp_camera_height * view_width) / view_height;
|
|
|
|
{
|
|
|
|
|
|
|
|
exp_camera_width = exp_camera_height * view_width/view_height;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.camera.top = exp_camera_height / 2;
|
|
|
|
this.camera.top = exp_camera_height / 2;
|
|
|
|
@ -789,4 +802,4 @@ function BoxView(ui, mainViewContainer, scene, renderer, viewManager){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export {ViewManager}
|
|
|
|
export { ViewManager };
|
|
|
|
|