|
@@ -63,7 +63,7 @@ export default {
|
|
},
|
|
},
|
|
|
|
|
|
computed: {
|
|
computed: {
|
|
- ...mapState(["scale"]),
|
|
|
|
|
|
+ ...mapState(["scale", "scaleRate"]),
|
|
// 坐标换算倍数
|
|
// 坐标换算倍数
|
|
rate() {
|
|
rate() {
|
|
return 40 / this.scale;
|
|
return 40 / this.scale;
|
|
@@ -104,7 +104,11 @@ export default {
|
|
default: false,
|
|
default: false,
|
|
},
|
|
},
|
|
configList: {
|
|
configList: {
|
|
- default: {},
|
|
|
|
|
|
+ // default: {},
|
|
|
|
+ // type: Object,
|
|
|
|
+ default: function () {
|
|
|
|
+ return {};
|
|
|
|
+ },
|
|
type: Object,
|
|
type: Object,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
@@ -196,6 +200,8 @@ export default {
|
|
gridHelper.material.transparent = true;
|
|
gridHelper.material.transparent = true;
|
|
this.scene.add(gridHelper);
|
|
this.scene.add(gridHelper);
|
|
|
|
|
|
|
|
+ return;
|
|
|
|
+
|
|
/* var cubeGeometry = new THREE.ConeGeometry(75, 150, 6, 1, false);
|
|
/* var cubeGeometry = new THREE.ConeGeometry(75, 150, 6, 1, false);
|
|
cubeGeometry.translate(0, -75, 0);
|
|
cubeGeometry.translate(0, -75, 0);
|
|
|
|
|
|
@@ -214,10 +220,10 @@ export default {
|
|
|
|
|
|
this.scene2 = new THREE.Scene();
|
|
this.scene2 = new THREE.Scene();
|
|
let cube = new CoordinateAxes();
|
|
let cube = new CoordinateAxes();
|
|
|
|
+ // this.scene2.background = null;
|
|
|
|
+ // this.scene2.background = new THREE.Color(0x00000, 1.0);
|
|
this.scene2.add(cube);
|
|
this.scene2.add(cube);
|
|
|
|
|
|
- return;
|
|
|
|
-
|
|
|
|
// const geometry = new THREE.BoxGeometry(100, 100, 100);
|
|
// const geometry = new THREE.BoxGeometry(100, 100, 100);
|
|
// const material = new THREE.MeshBasicMaterial({
|
|
// const material = new THREE.MeshBasicMaterial({
|
|
// color: 0xffffff,
|
|
// color: 0xffffff,
|
|
@@ -385,9 +391,11 @@ export default {
|
|
});
|
|
});
|
|
this.transformControls.addEventListener("mouseDown", (e) => {
|
|
this.transformControls.addEventListener("mouseDown", (e) => {
|
|
this.controls.enabled = false;
|
|
this.controls.enabled = false;
|
|
|
|
+ this.$emit("controlsEnabled", false);
|
|
});
|
|
});
|
|
this.transformControls.addEventListener("mouseUp", (e) => {
|
|
this.transformControls.addEventListener("mouseUp", (e) => {
|
|
this.controls.enabled = true;
|
|
this.controls.enabled = true;
|
|
|
|
+ this.$emit("controlsEnabled", true);
|
|
});
|
|
});
|
|
this.scene.add(this.transformControls);
|
|
this.scene.add(this.transformControls);
|
|
},
|
|
},
|
|
@@ -486,6 +494,7 @@ export default {
|
|
// });
|
|
// });
|
|
|
|
|
|
this.dragControls.addEventListener("drag", (e) => {
|
|
this.dragControls.addEventListener("drag", (e) => {
|
|
|
|
+ console.log(e);
|
|
if (!this.canDrag) return;
|
|
if (!this.canDrag) return;
|
|
// this.$emit("posChange", (e.object.position.x + 0.5) >> 0, "x");
|
|
// this.$emit("posChange", (e.object.position.x + 0.5) >> 0, "x");
|
|
// this.$emit("posChange", (e.object.position.y + 0.5) >> 0, "y");
|
|
// this.$emit("posChange", (e.object.position.y + 0.5) >> 0, "y");
|
|
@@ -548,7 +557,14 @@ export default {
|
|
(-180 * Math.PI) / 180
|
|
(-180 * Math.PI) / 180
|
|
);
|
|
);
|
|
|
|
|
|
- let scale = 30 * that.scale;
|
|
|
|
|
|
+ let s = 0;
|
|
|
|
+ if (model.includes("928.glb")) {
|
|
|
|
+ s = that.scale / that.scaleRate;
|
|
|
|
+ } else {
|
|
|
|
+ s = that.scale;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let scale = 30 * s;
|
|
obj.scene.scale.set(scale, scale, scale);
|
|
obj.scene.scale.set(scale, scale, scale);
|
|
// obj.scene.scale.set(30, 30, 30);
|
|
// obj.scene.scale.set(30, 30, 30);
|
|
|
|
|
|
@@ -846,12 +862,20 @@ export default {
|
|
|
|
|
|
this.controls = new OrbitControls(
|
|
this.controls = new OrbitControls(
|
|
this.camera,
|
|
this.camera,
|
|
- this.renderer.domElement
|
|
|
|
|
|
+ // this.renderer.domElement
|
|
|
|
+ document.getElementById("container")
|
|
); //创建控件对象
|
|
); //创建控件对象
|
|
this.controls.minDistance = 30;
|
|
this.controls.minDistance = 30;
|
|
this.controls.maxDistance = 600;
|
|
this.controls.maxDistance = 600;
|
|
this.controls.update();
|
|
this.controls.update();
|
|
// this.controls.target = this.cube.position
|
|
// this.controls.target = this.cube.position
|
|
|
|
+ // this.controls.addEventListener("change", (e) => {
|
|
|
|
+ // // console.log(document.getElementById("container"));
|
|
|
|
+
|
|
|
|
+ // console.log(this.renderer.domElement);
|
|
|
|
+ // console.log(document.querySelector('#container canvas'));
|
|
|
|
+ // // console.log(this.controls.getAzimuthalAngle(),this.controls.getPolarAngle());
|
|
|
|
+ // });
|
|
},
|
|
},
|
|
animate() {
|
|
animate() {
|
|
this.raf = requestAnimationFrame(this.animate);
|
|
this.raf = requestAnimationFrame(this.animate);
|
|
@@ -864,35 +888,49 @@ export default {
|
|
|
|
|
|
// this.renderer.setClearColor("#272727");
|
|
// this.renderer.setClearColor("#272727");
|
|
|
|
|
|
- this.renderer.setViewport(
|
|
|
|
- 0,
|
|
|
|
- 0,
|
|
|
|
- this.container.clientWidth,
|
|
|
|
- this.container.clientHeight
|
|
|
|
- );
|
|
|
|
|
|
+ // this.renderer.setViewport(
|
|
|
|
+ // 0,
|
|
|
|
+ // 0,
|
|
|
|
+ // this.container.clientWidth,
|
|
|
|
+ // this.container.clientHeight
|
|
|
|
+ // );
|
|
|
|
|
|
this.renderer.render(this.scene, this.camera);
|
|
this.renderer.render(this.scene, this.camera);
|
|
|
|
+ return;
|
|
|
|
|
|
// inset scene
|
|
// inset scene
|
|
|
|
|
|
// this.renderer.setClearColor(0xdddddd, 1);
|
|
// this.renderer.setClearColor(0xdddddd, 1);
|
|
|
|
+ // this.renderer.setClearColor(0xffffff, 0);
|
|
|
|
+ // this.renderer.setClearAlpha(0);
|
|
|
|
|
|
this.renderer.clearDepth(); // important!
|
|
this.renderer.clearDepth(); // important!
|
|
|
|
+ // this.scene2.background = new THREE.Color('hsla(100%, 100%, 100%, 0)');
|
|
|
|
+ // this.scene2.background = new THREE.Color('rgba(255, 255, 255, 0)');
|
|
|
|
+ // this.scene2.background = new THREE.Color('transparent');
|
|
|
|
+ // this.scene2.background = 0xffffff;
|
|
|
|
|
|
this.renderer.setScissorTest(true);
|
|
this.renderer.setScissorTest(true);
|
|
|
|
+ // this.renderer.setClearColor(0xffffff, 0.3);
|
|
|
|
+ // this.renderer.clearColor();
|
|
|
|
+ // this.renderer.setClearAlpha(0);
|
|
|
|
|
|
- let insetWidth = this.container.clientWidth / 4; // square
|
|
|
|
- let insetHeight = this.container.clientHeight / 4;
|
|
|
|
|
|
+ let insetWidth = this.container.clientWidth / 6; // square
|
|
|
|
+ let insetHeight = this.container.clientHeight / 6;
|
|
|
|
|
|
- this.renderer.setScissor(2, 350, insetWidth, insetHeight);
|
|
|
|
|
|
+ let x = insetHeight / 45;
|
|
|
|
+ let y = insetHeight * 4.2;
|
|
|
|
|
|
- this.renderer.setViewport(2, 350, insetWidth, insetHeight);
|
|
|
|
|
|
+ this.renderer.setScissor(x, y, insetWidth, insetHeight);
|
|
|
|
+
|
|
|
|
+ this.renderer.setViewport(x, y, insetWidth, insetHeight);
|
|
|
|
|
|
this.camera2.position.copy(this.camera.position);
|
|
this.camera2.position.copy(this.camera.position);
|
|
this.camera2.quaternion.copy(this.camera.quaternion);
|
|
this.camera2.quaternion.copy(this.camera.quaternion);
|
|
|
|
|
|
this.renderer.render(this.scene2, this.camera2);
|
|
this.renderer.render(this.scene2, this.camera2);
|
|
-
|
|
|
|
|
|
+ // this.renderer.setClearAlpha(0);
|
|
|
|
+ // this.scene2.background = null;
|
|
this.renderer.setScissorTest(false);
|
|
this.renderer.setScissorTest(false);
|
|
},
|
|
},
|
|
onWindowResize() {
|
|
onWindowResize() {
|
|
@@ -905,8 +943,8 @@ export default {
|
|
this.container.clientHeight
|
|
this.container.clientHeight
|
|
);
|
|
);
|
|
|
|
|
|
- let insetWidth = this.container.clientWidth / 4; // square
|
|
|
|
- let insetHeight = this.container.clientHeight / 4;
|
|
|
|
|
|
+ let insetWidth = this.container.clientWidth / 6; // square
|
|
|
|
+ let insetHeight = this.container.clientHeight / 6;
|
|
|
|
|
|
this.camera2.aspect = insetWidth / insetHeight;
|
|
this.camera2.aspect = insetWidth / insetHeight;
|
|
this.camera2.updateProjectionMatrix();
|
|
this.camera2.updateProjectionMatrix();
|
|
@@ -1625,8 +1663,8 @@ export default {
|
|
|
|
|
|
renderer.setSize(container.clientWidth, container.clientHeight);
|
|
renderer.setSize(container.clientWidth, container.clientHeight);
|
|
|
|
|
|
- insetWidth = container.clientHeight / 4; // square
|
|
|
|
- insetHeight = container.clientHeight / 4;
|
|
|
|
|
|
+ insetWidth = container.clientHeight / 6; // square
|
|
|
|
+ insetHeight = container.clientHeight / 6;
|
|
|
|
|
|
camera2.aspect = insetWidth / insetHeight;
|
|
camera2.aspect = insetWidth / insetHeight;
|
|
camera2.updateProjectionMatrix();
|
|
camera2.updateProjectionMatrix();
|