emacroh5lib 1.0.81 → 1.0.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/emacroh5lib.min.js +1 -1
- package/ob.rar +0 -0
- package/package.json +1 -1
- package/src/utilities/NumComp.js +0 -0
- package/src/views/ModelViewer/index.vue +63 -29
- package/src/views/TestView/index.vue +2 -2
- package//345/214/205/350/243/205/347/272/277.mtl +103 -0
- package//345/214/205/350/243/205/347/272/277.obj +450053 -0
package/ob.rar
ADDED
Binary file
|
package/package.json
CHANGED
File without changes
|
@@ -1,7 +1,9 @@
|
|
1
1
|
<template>
|
2
2
|
<div class="duo-viewer" v-if="show" ref="duoViewer" @click="clickAgent">
|
3
3
|
<div class="duo-viewer-mask">
|
4
|
-
<div id="WebGL-output" class="duo-viewer-mask__image" :style="viewerStyle()"
|
4
|
+
<div id="WebGL-output" class="duo-viewer-mask__image" :style="viewerStyle()" v-loading="loading"
|
5
|
+
element-loading-text="模型加载中" element-loading-spinner="el-icon-loading"
|
6
|
+
element-loading-background="rgba(0, 0, 0, 0.8)">
|
5
7
|
</div>
|
6
8
|
</div>
|
7
9
|
<div class="duo-viewer-footer" v-if="showThumbnail">
|
@@ -57,7 +59,7 @@
|
|
57
59
|
import { AsciiEffect } from "three/examples/jsm/effects/AsciiEffect.js";
|
58
60
|
import { BufferGeometryUtils } from 'three/examples/jsm/utils/BufferGeometryUtils.js';
|
59
61
|
|
60
|
-
import { Message } from 'element-ui'
|
62
|
+
import { Message, MessageBox } from 'element-ui'
|
61
63
|
|
62
64
|
// import TWEEN from "@tweenjs/tween.js";
|
63
65
|
// import Stats from "stats.js";
|
@@ -73,6 +75,7 @@
|
|
73
75
|
index: 0,
|
74
76
|
imgUrl: "",
|
75
77
|
isCreatePoster: false,
|
78
|
+
loading: true,
|
76
79
|
gl: {
|
77
80
|
scene: null,
|
78
81
|
renderer: null,
|
@@ -144,6 +147,7 @@
|
|
144
147
|
watch: {
|
145
148
|
show(val) {
|
146
149
|
if (val) {
|
150
|
+
this.loading = true
|
147
151
|
this.$emit("open");
|
148
152
|
this.index = this.currentIndex;
|
149
153
|
this.loadModel(this.currentModel)
|
@@ -154,6 +158,9 @@
|
|
154
158
|
},
|
155
159
|
mounted() {
|
156
160
|
|
161
|
+
// this.show = true
|
162
|
+
|
163
|
+
|
157
164
|
|
158
165
|
// Message.success("按键提示 ");
|
159
166
|
|
@@ -363,8 +370,6 @@
|
|
363
370
|
|
364
371
|
setObject() {
|
365
372
|
|
366
|
-
|
367
|
-
|
368
373
|
const materials = this.gl.materials
|
369
374
|
const geometry = this.gl.geometry
|
370
375
|
const camera = this.gl.camera
|
@@ -382,12 +387,11 @@
|
|
382
387
|
let box = new THREE.Box3().setFromObject(geometry);
|
383
388
|
let center = box.getCenter(geometry.position);
|
384
389
|
let size = box.getSize(new THREE.Vector3())
|
385
|
-
|
386
390
|
const ratio = Math.abs(200 / size.x);
|
387
391
|
geometry.scale.set(ratio, ratio, ratio);
|
388
392
|
|
389
393
|
|
390
|
-
|
394
|
+
// 设置旋转点
|
391
395
|
const boxHelper = new THREE.BoxHelper(geometry);
|
392
396
|
this.gl.boxHelper = boxHelper
|
393
397
|
boxHelper.geometry.computeBoundingBox()
|
@@ -400,6 +404,8 @@
|
|
400
404
|
this.gl.geometry = pivot
|
401
405
|
scene.add(pivot);
|
402
406
|
|
407
|
+
this.loading = false
|
408
|
+
|
403
409
|
|
404
410
|
|
405
411
|
|
@@ -630,8 +636,6 @@
|
|
630
636
|
|
631
637
|
|
632
638
|
|
633
|
-
|
634
|
-
|
635
639
|
// return
|
636
640
|
|
637
641
|
|
@@ -682,9 +686,6 @@
|
|
682
686
|
// );
|
683
687
|
|
684
688
|
|
685
|
-
|
686
|
-
|
687
|
-
|
688
689
|
// geometry.computeVertexNormals();
|
689
690
|
// geometry.center();
|
690
691
|
// let material = new THREE.MeshPhongMaterial({ color: 0xffff00, shading: THREE.SmoothShading });
|
@@ -692,23 +693,37 @@
|
|
692
693
|
|
693
694
|
// const box = new THREE.BoxHelper(mesh, 0xffff00);
|
694
695
|
|
695
|
-
// console.log("尺寸", box);
|
696
|
-
|
697
696
|
|
698
697
|
// var scale = this.computeScale(geometry);
|
699
698
|
// mesh.scale.multiplyScalar(scale);
|
700
699
|
// mesh.position.set(0, 0, 0);
|
701
700
|
// this.gl.scene.add(mesh);
|
702
|
-
|
703
701
|
}
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
702
|
+
}, progress => {
|
703
|
+
}, error => {
|
704
|
+
Message({
|
705
|
+
message: objPath + '加载出错',
|
706
|
+
type: 'error',
|
707
|
+
duration: 0,
|
708
|
+
showClose: true
|
709
|
+
})
|
710
|
+
|
711
|
+
setTimeout(() => {
|
712
|
+
this.show = false
|
713
|
+
}, 1000);
|
714
|
+
})
|
715
|
+
}, progress => {
|
716
|
+
}, error => {
|
717
|
+
Message({
|
718
|
+
message: mtlPath + '加载出错',
|
719
|
+
type: 'error',
|
720
|
+
duration: 0,
|
721
|
+
showClose: true
|
710
722
|
})
|
711
723
|
|
724
|
+
setTimeout(() => {
|
725
|
+
this.show = false
|
726
|
+
}, 1000);
|
712
727
|
})
|
713
728
|
|
714
729
|
}
|
@@ -865,8 +880,6 @@
|
|
865
880
|
// gl.geometry.rotateX(new THREE.Vector3(1, 0, 0), 90)
|
866
881
|
|
867
882
|
}
|
868
|
-
|
869
|
-
|
870
883
|
if (event.key == 'y') {
|
871
884
|
|
872
885
|
// gl.camera.position.set(0, 0, 0);
|
@@ -884,7 +897,6 @@
|
|
884
897
|
|
885
898
|
gl.axialDirection = yd > 0 ? 'y' : '-y';
|
886
899
|
}
|
887
|
-
|
888
900
|
if (event.key == 'z') {
|
889
901
|
|
890
902
|
const zd = gl.camera.position.z !== 0 ? -gl.camera.position.z : -d
|
@@ -897,7 +909,6 @@
|
|
897
909
|
|
898
910
|
gl.axialDirection = zd > 0 ? 'z' : '-z';
|
899
911
|
}
|
900
|
-
|
901
912
|
if (event.key == '=') {
|
902
913
|
gl.pointLight.intensity += 0.2
|
903
914
|
}
|
@@ -917,12 +928,17 @@
|
|
917
928
|
// const d = (0 * Math.PI) / 180;
|
918
929
|
// gl.axisHelper.rotation.set(d, 0, 0);
|
919
930
|
|
920
|
-
gl.camera.position.set(500, 300, 200); //设置相机位置
|
921
|
-
gl.camera.lookAt(new THREE.Vector3(0, 0, 0)); //设置相机方向(指向的场景对象)
|
922
|
-
gl.pointLight.position.set(200, 300, 100); //点光源位置,参数分别代表:
|
923
|
-
gl.ambient.position.set(200, 300, 100); //点光源位置,参数分别代表:
|
931
|
+
// gl.camera.position.set(500, 300, 200); //设置相机位置
|
932
|
+
// gl.camera.lookAt(new THREE.Vector3(0, 0, 0)); //设置相机方向(指向的场景对象)
|
933
|
+
// gl.pointLight.position.set(200, 300, 100); //点光源位置,参数分别代表:
|
934
|
+
// gl.ambient.position.set(200, 300, 100); //点光源位置,参数分别代表:
|
924
935
|
|
925
|
-
gl.scene.rotateX(THREE.Math.degToRad(90))
|
936
|
+
// gl.scene.rotateX(THREE.Math.degToRad(90))
|
937
|
+
|
938
|
+
gl.camera.position.set(d, d, d);
|
939
|
+
gl.camera.lookAt(new THREE.Vector3(0, 0, 0));
|
940
|
+
|
941
|
+
gl.axialDirection = 'o'
|
926
942
|
}
|
927
943
|
|
928
944
|
|
@@ -988,6 +1004,8 @@
|
|
988
1004
|
|
989
1005
|
if (gl.isRotate) {
|
990
1006
|
|
1007
|
+
// console.log("旋转", event);
|
1008
|
+
|
991
1009
|
const x = -(gl.startEvent.offsetX - event.offsetX)
|
992
1010
|
const y = -(gl.startEvent.offsetY - event.offsetY)
|
993
1011
|
|
@@ -1034,6 +1052,14 @@
|
|
1034
1052
|
}
|
1035
1053
|
}
|
1036
1054
|
|
1055
|
+
if (gl.axialDirection == 'o') {
|
1056
|
+
if (Math.abs(x) > Math.abs(y)) {
|
1057
|
+
gl.geometry.rotateOnWorldAxis(new THREE.Vector3(1, 1, 1), x * 0.001)
|
1058
|
+
} else {
|
1059
|
+
gl.geometry.rotateOnWorldAxis(new THREE.Vector3(1, 1, 1), y * 0.001)
|
1060
|
+
}
|
1061
|
+
}
|
1062
|
+
|
1037
1063
|
// gl.geometry.rotateX(x * 0.001)
|
1038
1064
|
// gl.geometry.rotateY(y * 0.001)
|
1039
1065
|
|
@@ -1094,6 +1120,14 @@
|
|
1094
1120
|
}
|
1095
1121
|
}
|
1096
1122
|
|
1123
|
+
if (gl.axialDirection == 'o') {
|
1124
|
+
if (Math.abs(x) > Math.abs(y)) {
|
1125
|
+
gl.geometry.position.set(gl.geometry.position.x + x, gl.geometry.position.y + x, gl.geometry.position.z + x)
|
1126
|
+
} else {
|
1127
|
+
gl.geometry.position.set(gl.geometry.position.x + y, gl.geometry.position.y + y, gl.geometry.position.z + y)
|
1128
|
+
}
|
1129
|
+
}
|
1130
|
+
|
1097
1131
|
}
|
1098
1132
|
|
1099
1133
|
|
@@ -83,8 +83,8 @@
|
|
83
83
|
name: "产品1",
|
84
84
|
// mtl: "http://www.emacrosys.cn:8019/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\test.mtl",
|
85
85
|
// obj: "http://www.emacrosys.cn:8019/H5/GetFile?type=0&path=C:/SOP/PCB001/test.obj"
|
86
|
-
mtl: "http://www.emacrosys.cn:8019/H5/GetFile?type=0&path=C:\\SOP\\File\\book\\
|
87
|
-
obj: "http://www.emacrosys.cn:8019/H5/GetFile?type=0&path=C:\\SOP\\File\\book\\
|
86
|
+
mtl: "http://www.emacrosys.cn:8019/H5/GetFile?type=0&path=C:\\SOP\\File\\book\\test7.mtl",
|
87
|
+
obj: "http://www.emacrosys.cn:8019/H5/GetFile?type=0&path=C:\\SOP\\File\\book\\test7.obj"
|
88
88
|
}, {
|
89
89
|
type: "obj",
|
90
90
|
name: "产品2",
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# WaveFront *.mtl file (generated by Cinema 4D)
|
2
|
+
|
3
|
+
newmtl default
|
4
|
+
Kd 1 1 1
|
5
|
+
|
6
|
+
newmtl 材质.1
|
7
|
+
Ka 1 1 1
|
8
|
+
Kd 0.12300000339746 0.12884999811649 0.15000000596046
|
9
|
+
Ks 1 1 1
|
10
|
+
Ns 50
|
11
|
+
illum 7
|
12
|
+
|
13
|
+
newmtl 材质.10
|
14
|
+
Ka 1 1 1
|
15
|
+
Kd 0.95999997854233 0.79295998811722 0.12479999661446
|
16
|
+
Ks 1 1 1
|
17
|
+
Ns 50
|
18
|
+
illum 7
|
19
|
+
|
20
|
+
newmtl 材质.7
|
21
|
+
Ka 1 1 1
|
22
|
+
Kd 1 1 1
|
23
|
+
Ks 1 1 1
|
24
|
+
Ns 90
|
25
|
+
illum 7
|
26
|
+
|
27
|
+
newmtl 材质.4
|
28
|
+
Ka 1 1 1
|
29
|
+
Kd 0.9200000166893 0.9200000166893 0.9200000166893
|
30
|
+
Ks 1 1 1
|
31
|
+
Ns 4
|
32
|
+
illum 7
|
33
|
+
|
34
|
+
newmtl 材质.2
|
35
|
+
Ka 1 1 1
|
36
|
+
Kd 0.87000000476837 0.21750000119209 0.21750000119209
|
37
|
+
Ks 1 1 1
|
38
|
+
Ns 50
|
39
|
+
illum 7
|
40
|
+
|
41
|
+
newmtl 材质.9
|
42
|
+
Ka 1 1 1
|
43
|
+
Kd 1 1 1
|
44
|
+
Ks 0.68000000715256 0.59273332357407 0.30599999427795
|
45
|
+
Ns 90
|
46
|
+
illum 7
|
47
|
+
|
48
|
+
newmtl 材质.5
|
49
|
+
Ka 1 1 1
|
50
|
+
Kd 0.23275999724865 0.200100004673 0.68999999761581
|
51
|
+
Ks 1 1 1
|
52
|
+
Ns 50
|
53
|
+
illum 7
|
54
|
+
|
55
|
+
newmtl 材质.6
|
56
|
+
Ka 1 1 1
|
57
|
+
Kd 1 1 1
|
58
|
+
Ks 1 1 1
|
59
|
+
Ns 50
|
60
|
+
illum 7
|
61
|
+
|
62
|
+
newmtl 材质.8
|
63
|
+
Ka 1 1 1
|
64
|
+
Kd 0.75999999046326 0.37873333692551 0.22800000011921
|
65
|
+
Ks 1 1 1
|
66
|
+
Ns 50
|
67
|
+
illum 7
|
68
|
+
|
69
|
+
newmtl 材质
|
70
|
+
Ka 1 1 1
|
71
|
+
Kd 0.62999999523163 0.62999999523163 0.62999999523163
|
72
|
+
Ks 1 1 1
|
73
|
+
Ns 50
|
74
|
+
illum 7
|
75
|
+
|
76
|
+
newmtl 材质.1
|
77
|
+
Ka 1 1 1
|
78
|
+
Kd 0.15639999508858 0.15934666991234 0.17000000178814
|
79
|
+
Ks 1 1 1
|
80
|
+
Ns 50
|
81
|
+
illum 7
|
82
|
+
|
83
|
+
newmtl 材质
|
84
|
+
Ka 1 1 1
|
85
|
+
Kd 0.78200000524521 0.79673331975937 0.85000002384186
|
86
|
+
Ks 1 1 1
|
87
|
+
Ns 50
|
88
|
+
illum 7
|
89
|
+
|
90
|
+
newmtl 材质.10
|
91
|
+
Ka 1 1 1
|
92
|
+
Kd 0.95999997854233 0.79295998811722 0.12479999661446
|
93
|
+
Ks 1 1 1
|
94
|
+
Ns 50
|
95
|
+
illum 7
|
96
|
+
|
97
|
+
newmtl 材质.3
|
98
|
+
Ka 1 1 1
|
99
|
+
Kd 0.88999998569489 0.82770001888275 0.14239999651909
|
100
|
+
Ks 1 1 1
|
101
|
+
Ns 50
|
102
|
+
illum 7
|
103
|
+
|