mx3d 0.0.31 → 0.0.34
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/core/mx3d.dazzle.min.js +1 -1
- package/docs/.nojekyll +0 -0
- package/docs/README.md +24 -0
- package/docs/_sidebar.md +18 -0
- package/docs/camera.md +24 -0
- package/docs/css/dark.css +979 -0
- package/docs/css/local.google.fonts.css +295 -0
- package/docs/css/vue.css +1025 -0
- package/docs/fonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qOK7l.woff2 +0 -0
- package/docs/fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwlxdu.woff2 +0 -0
- package/docs/fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwlxdu.woff2 +0 -0
- package/docs/gui/2D.md +53 -0
- package/docs/gui/3D.md +46 -0
- package/docs/gui/test1.png +0 -0
- package/docs/gui/test2.png +0 -0
- package/docs/gui/test3.png +0 -0
- package/docs/heatMap/heatMap.md +115 -0
- package/docs/heatMap/test1.png +0 -0
- package/docs/heatMap/test2.png +0 -0
- package/docs/index.html +50 -0
- package/docs/js/docsify@4.min.js +1 -0
- package/docs/models/modelmgr.md +251 -0
- package/docs/project/projectmgr.md +73 -0
- package/docs/project/scenetree.jpg +0 -0
- package/docs/started/environment.md +42 -0
- package/docs/started/quickstart.md +89 -0
- package/lib/components/ConduitObject.d.ts +1 -0
- package/mx3d.js +32 -14
- package/mx3d.min.js +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
## 获取对象
|
|
2
|
+
|
|
3
|
+
```javascript
|
|
4
|
+
/// <summary>
|
|
5
|
+
/// 全局查询
|
|
6
|
+
/// </summary>
|
|
7
|
+
/// <param name="_id">对象标识</param>
|
|
8
|
+
/// <param name="type">对象类型</param>
|
|
9
|
+
/// <param name="current">是否当前楼层</param>
|
|
10
|
+
query(_id?: string, type?: ObjectType, current?: boolean)
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 基础属性
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
id: string;//唯一id
|
|
17
|
+
name: string;//名称
|
|
18
|
+
objectType: string;//对象类型
|
|
19
|
+
isMonitor: boolean;//是否监听
|
|
20
|
+
parent: IObject;//父物体
|
|
21
|
+
children: ArrayEx<IObject>;//子物体
|
|
22
|
+
visible: boolean;//是否显示
|
|
23
|
+
visualAngle:VisualAngle;//视场角度
|
|
24
|
+
childNodes:Dictionary<BaseNode>;//附带物体
|
|
25
|
+
delete();//删除
|
|
26
|
+
dispose();//销毁
|
|
27
|
+
transparent: boolean;//是否透明
|
|
28
|
+
showBoundingBox: boolean;//显示边缘
|
|
29
|
+
setFlash(level:number)//设置闪烁
|
|
30
|
+
addEventListener(type: string, callback: Function);//添加对象事件
|
|
31
|
+
removeEventListener(type: string)//删除对象事件
|
|
32
|
+
play(isloop: boolean);//播放对象动画
|
|
33
|
+
stop();//暂停对象动画
|
|
34
|
+
flyTo();//相机飞向对象
|
|
35
|
+
focus();//聚焦当前
|
|
36
|
+
switch();//切换到当前
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## 特殊对象属性
|
|
40
|
+
|
|
41
|
+
### 暖气片
|
|
42
|
+
|
|
43
|
+
```javascript
|
|
44
|
+
airFlowDisplay((isDisplay: boolean = true)) //是否显示隐藏暖气片
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 事件
|
|
48
|
+
|
|
49
|
+
addEventListener() 方法为指定对象指定事件处理程序。
|
|
50
|
+
|
|
51
|
+
### 语法
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
54
|
+
obj.addEventListener(event, function);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
第一个参数是事件的类型(可选 "leftClick:左键点击" , "rightClick:右键点击" , "longPress:长按" , "doubleClick:双击" , "eover:经过" , "out:移出")。
|
|
58
|
+
|
|
59
|
+
第二个参数是当事件发生时我们需要调用的函数。
|
|
60
|
+
|
|
61
|
+
### 事件实例
|
|
62
|
+
|
|
63
|
+
当用户左键点击某个对象时浏览器控制台输出此对象:
|
|
64
|
+
|
|
65
|
+
```javascript
|
|
66
|
+
obj.addEventListener(Mviot.EventType.leftClick, function(e) {
|
|
67
|
+
console.log(e)
|
|
68
|
+
})
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## 事件删除
|
|
72
|
+
|
|
73
|
+
removeEventListener() 方法
|
|
74
|
+
|
|
75
|
+
removeEventListener() 方法会删除已通过 addEventListener() 方法附加的事件处理程序:
|
|
76
|
+
|
|
77
|
+
### 实例
|
|
78
|
+
|
|
79
|
+
```javascript
|
|
80
|
+
obj.removeEventListener(Mviot.EventType.leftClick)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## 对象类型
|
|
84
|
+
|
|
85
|
+
```javascript
|
|
86
|
+
//引用方式
|
|
87
|
+
Mviot.ObjectType.Cabinet
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
```javascript
|
|
91
|
+
/// <summary>
|
|
92
|
+
/// 园区
|
|
93
|
+
/// </summary>
|
|
94
|
+
Campus,
|
|
95
|
+
/// <summary>
|
|
96
|
+
/// 大楼
|
|
97
|
+
/// </summary>
|
|
98
|
+
Building,
|
|
99
|
+
/// <summary>
|
|
100
|
+
/// 楼层
|
|
101
|
+
/// </summary>
|
|
102
|
+
Scene,
|
|
103
|
+
/// <summary>
|
|
104
|
+
/// 温湿度
|
|
105
|
+
/// </summary>
|
|
106
|
+
Humiture,
|
|
107
|
+
/// <summary>
|
|
108
|
+
/// 电池
|
|
109
|
+
/// </summary>
|
|
110
|
+
Battery,
|
|
111
|
+
/// <summary>
|
|
112
|
+
/// 配电柜
|
|
113
|
+
/// </summary>
|
|
114
|
+
PowerCabinet,
|
|
115
|
+
/// <summary>
|
|
116
|
+
/// 机柜
|
|
117
|
+
/// </summary>
|
|
118
|
+
Cabinet,
|
|
119
|
+
/// <summary>
|
|
120
|
+
/// 空调
|
|
121
|
+
/// </summary>
|
|
122
|
+
AirCondition,
|
|
123
|
+
/// <summary>
|
|
124
|
+
/// UPS
|
|
125
|
+
/// </summary>
|
|
126
|
+
UPS,
|
|
127
|
+
/// <summary>
|
|
128
|
+
/// 摄像头
|
|
129
|
+
/// </summary>
|
|
130
|
+
Camera,
|
|
131
|
+
/// <summary>
|
|
132
|
+
/// 新风机
|
|
133
|
+
/// </summary>
|
|
134
|
+
NewWindMachine,
|
|
135
|
+
/// <summary>
|
|
136
|
+
/// 烟感
|
|
137
|
+
/// </summary>
|
|
138
|
+
SmokeDetector,
|
|
139
|
+
/// <summary>
|
|
140
|
+
/// 声光报警
|
|
141
|
+
/// </summary>
|
|
142
|
+
AudibleVisualAlarm,
|
|
143
|
+
/// <summary>
|
|
144
|
+
/// 漏水线
|
|
145
|
+
/// </summary>
|
|
146
|
+
LeakWater,
|
|
147
|
+
/// <summary>
|
|
148
|
+
/// 墙
|
|
149
|
+
/// </summary>
|
|
150
|
+
Wall,
|
|
151
|
+
/// <summary>
|
|
152
|
+
/// 地板
|
|
153
|
+
/// </summary>
|
|
154
|
+
Floor,
|
|
155
|
+
/// <summary>
|
|
156
|
+
/// 窗户
|
|
157
|
+
/// </summary>
|
|
158
|
+
Window,
|
|
159
|
+
/// <summary>
|
|
160
|
+
/// 门
|
|
161
|
+
/// </summary>
|
|
162
|
+
Door,
|
|
163
|
+
/// <summary>
|
|
164
|
+
/// 气流模拟
|
|
165
|
+
/// </summary>
|
|
166
|
+
AirFlow,
|
|
167
|
+
/// <summary>
|
|
168
|
+
/// 墙角
|
|
169
|
+
/// </summary>
|
|
170
|
+
Corner,
|
|
171
|
+
/// <summary>
|
|
172
|
+
/// 消防设备
|
|
173
|
+
/// </summary>
|
|
174
|
+
FireFighting,
|
|
175
|
+
/// <summary>
|
|
176
|
+
/// 照明设备
|
|
177
|
+
/// </summary>
|
|
178
|
+
Lighting,
|
|
179
|
+
/// <summary>
|
|
180
|
+
/// 电子围栏
|
|
181
|
+
/// </summary>
|
|
182
|
+
Enclosure,
|
|
183
|
+
/// <summary>
|
|
184
|
+
/// 车位
|
|
185
|
+
/// </summary>
|
|
186
|
+
ParkingLot,
|
|
187
|
+
/// <summary>
|
|
188
|
+
/// 电梯
|
|
189
|
+
/// </summary>
|
|
190
|
+
Elevator,
|
|
191
|
+
/// <summary>
|
|
192
|
+
/// 其他
|
|
193
|
+
/// </summary>
|
|
194
|
+
Other,
|
|
195
|
+
/// <summary>
|
|
196
|
+
/// 架式设备
|
|
197
|
+
/// </summary>
|
|
198
|
+
InrackAsset,
|
|
199
|
+
/// <summary>
|
|
200
|
+
/// 气体检测
|
|
201
|
+
/// </summary>
|
|
202
|
+
GasDetection,
|
|
203
|
+
/// <summary>
|
|
204
|
+
/// 安防设备
|
|
205
|
+
/// </summary>
|
|
206
|
+
Security,
|
|
207
|
+
/// <summary>
|
|
208
|
+
/// 外景
|
|
209
|
+
/// </summary>
|
|
210
|
+
OutDoorScene,
|
|
211
|
+
/// <summary>
|
|
212
|
+
/// 红外
|
|
213
|
+
/// </summary>
|
|
214
|
+
Infrared,
|
|
215
|
+
/// <summary>
|
|
216
|
+
/// 天空盒
|
|
217
|
+
/// </summary>
|
|
218
|
+
SkyBox,
|
|
219
|
+
/// <summary>
|
|
220
|
+
/// UI
|
|
221
|
+
/// </summary>
|
|
222
|
+
UI3D,
|
|
223
|
+
/// <summary>
|
|
224
|
+
/// 冷通道门
|
|
225
|
+
/// </summary>
|
|
226
|
+
ColdTongDoor,
|
|
227
|
+
/// <summary>
|
|
228
|
+
/// 虚拟盒子
|
|
229
|
+
/// </summary>
|
|
230
|
+
VirtualBox,
|
|
231
|
+
/// <summary>
|
|
232
|
+
/// 漫游盒子
|
|
233
|
+
/// </summary>
|
|
234
|
+
PathPint,
|
|
235
|
+
/// <summary>
|
|
236
|
+
/// 端口
|
|
237
|
+
/// </summary>
|
|
238
|
+
Port,
|
|
239
|
+
/// <summary>
|
|
240
|
+
/// 定位接收器
|
|
241
|
+
/// </summary>
|
|
242
|
+
Positioner,
|
|
243
|
+
/// <summary>
|
|
244
|
+
/// 自动动画
|
|
245
|
+
/// </summary>
|
|
246
|
+
AutoAnimation,
|
|
247
|
+
/// <summary>
|
|
248
|
+
/// 地图
|
|
249
|
+
/// </summary>
|
|
250
|
+
MapModel
|
|
251
|
+
```
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
## 加载场景
|
|
2
|
+
|
|
3
|
+
如下代码所示
|
|
4
|
+
|
|
5
|
+
```javascript
|
|
6
|
+
//加载内景
|
|
7
|
+
app
|
|
8
|
+
.create({
|
|
9
|
+
fileUrl: './mviotjs/Project.json', //场景文件 必须
|
|
10
|
+
libraryUrl: './mviotjs', //模型库路径 必须
|
|
11
|
+
rotation: null, //旋转 可选
|
|
12
|
+
parent: null, //父节点对象 可选(楼栋物体)
|
|
13
|
+
})
|
|
14
|
+
.then((_scenes: any) => {
|
|
15
|
+
_scenes[0].switch()
|
|
16
|
+
})
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```javascript
|
|
20
|
+
//园区,内景集成加载
|
|
21
|
+
app
|
|
22
|
+
.create({
|
|
23
|
+
fileUrl: './mviotjs/campus.json',
|
|
24
|
+
libraryUrl: './mviotjs',
|
|
25
|
+
})
|
|
26
|
+
.then((_campus: any) => {
|
|
27
|
+
app
|
|
28
|
+
.create({
|
|
29
|
+
fileUrl: './mviotjs/Project.json',
|
|
30
|
+
libraryUrl: './mviotjs',
|
|
31
|
+
rotation: { x: 0, y: Math.PI / 2, z: 0 }, //为弧度制
|
|
32
|
+
parent: _campus[0].children[8], //某一栋大楼
|
|
33
|
+
})
|
|
34
|
+
.then((_scenes: any) => {
|
|
35
|
+
console.log(_scenes)
|
|
36
|
+
})
|
|
37
|
+
_campus[0].switch() //聚焦
|
|
38
|
+
})
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 场景层级树
|
|
42
|
+
|
|
43
|
+
层级树如下图所示:
|
|
44
|
+
|
|
45
|
+

|
|
46
|
+
|
|
47
|
+
默认场景层级为:园区》楼栋》楼层》房间》物体
|
|
48
|
+
|
|
49
|
+
每层以 children 获取子物体,以 parent 获取父物体
|
|
50
|
+
|
|
51
|
+
## 销毁场景
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
54
|
+
app.root.delete()
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 销毁自身
|
|
58
|
+
|
|
59
|
+
```javascript
|
|
60
|
+
obj.delete()
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## 切换层级
|
|
64
|
+
|
|
65
|
+
```javascript
|
|
66
|
+
obj.focus()
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 层级回退
|
|
70
|
+
|
|
71
|
+
```javascript
|
|
72
|
+
app.root.goBack()
|
|
73
|
+
```
|
|
Binary file
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
在使用以下代码创建场景实例后即可进行 3d 场景的环境配置
|
|
2
|
+
|
|
3
|
+
```javascript
|
|
4
|
+
var app = new Mviot.App(container)
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
## 背景颜色
|
|
8
|
+
|
|
9
|
+
```javascript
|
|
10
|
+
//rgba(0-1);
|
|
11
|
+
app.environment.color = { r: 0, g: 0.0588, b: 0.1176, a: 1 }
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## 背景图片
|
|
15
|
+
|
|
16
|
+
```javascript
|
|
17
|
+
app.environment.setBackground('./res/bg.png')
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 场景反射
|
|
21
|
+
|
|
22
|
+
```javascript
|
|
23
|
+
app.environment.reflex('./res/environment.env', 0.5)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## 显示 fps(帧率)
|
|
27
|
+
|
|
28
|
+
```javascript
|
|
29
|
+
//cssText(可选):样式字符串,默认为:"position: fixed;left: 5px;bottom: 5px;z-index:999999999; font-size: 10px;color: rgb(0, 255, 0);text-shadow:rgba(0, 0, 0, 0.2) 1px 1px 0;"
|
|
30
|
+
app.environment.showFps()
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 节点材质
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
const nodeMats = [
|
|
37
|
+
{ id: 'B1', url: './mviotjs/ndoemats/B1.json' },
|
|
38
|
+
{ id: 'hLine', url: './mviotjs/ndoemats/hLine.json' },
|
|
39
|
+
{ id: 'vLine', url: './mviotjs/ndoemats/vLine.json' },
|
|
40
|
+
]
|
|
41
|
+
await app.environment.loadNodeMats(nodeMats) //必须使用await强制同步加载,防止不生效
|
|
42
|
+
```
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# npm 安装
|
|
2
|
+
|
|
3
|
+
推荐使用 npm 的方式安装,它能更好地和 webpack 打包工具配合使用。
|
|
4
|
+
|
|
5
|
+
``` js
|
|
6
|
+
npm i mx3d
|
|
7
|
+
```
|
|
8
|
+
采用 nodejs 开发时,需配置 webpack 排除 mx3d 打包进工程代码
|
|
9
|
+
|
|
10
|
+
# CDN
|
|
11
|
+
|
|
12
|
+
目前可以通过 [unpkg.com/mx3d](https://unpkg.com/mx3d/) 获取到最新版本的资源,在页面上引入 js文件即可开始使用。
|
|
13
|
+
|
|
14
|
+
``` js
|
|
15
|
+
<!-- 引入组件库 -->
|
|
16
|
+
<script src="https://www.unpkg.com/mx3d/core/mx3d.seat.min.js"></script>
|
|
17
|
+
<script src="https://www.unpkg.com/mx3d/core/mx3d.kernel.min.js"></script>
|
|
18
|
+
<script src="https://www.unpkg.com/mx3d/core/mx3d.loaders.min.js"></script>
|
|
19
|
+
<script src="https://www.unpkg.com/mx3d/core/mx3d.dazzle.min.js"></script>
|
|
20
|
+
<script src="https://www.unpkg.com/mx3d/mx3d.min.js"></script>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
我们建议使用 CDN 引入 mx3d 的用户在链接地址上锁定版本,以免将来 mx3d 升级时受到非兼容性更新的影响。锁定版本的方法请查看 [unpkg.com](https://unpkg.com/)。
|
|
24
|
+
|
|
25
|
+
# Hello mx3djs
|
|
26
|
+
|
|
27
|
+
通过 CDN 的方式我们可以很容易地使用 mx3d 写出一个 Hello mx3djs 页面。[在线演示](http://docs.wodashijie.com/script?scrId=5939cb6568424d7d8821ece31420966b)
|
|
28
|
+
|
|
29
|
+
``` html
|
|
30
|
+
<!DOCTYPE html>
|
|
31
|
+
<html lang="zh-CN" data-theme="dark">
|
|
32
|
+
<head>
|
|
33
|
+
<meta charset="utf-8">
|
|
34
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
35
|
+
<meta name="renderer" content="webkit">
|
|
36
|
+
<meta name="viewport" content="width=1920,user-scalable=no, viewport-fit=cover">
|
|
37
|
+
<style>
|
|
38
|
+
* {
|
|
39
|
+
margin: 0;
|
|
40
|
+
padding: 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
html,
|
|
44
|
+
body {
|
|
45
|
+
width: 100%;
|
|
46
|
+
height: 100%;
|
|
47
|
+
margin: 0;
|
|
48
|
+
padding: 0;
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
#container {
|
|
53
|
+
width: 100%;
|
|
54
|
+
height: 100%;
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
57
|
+
<script src="https://www.unpkg.com/mx3d/core/mx3d.seat.min.js"></script>
|
|
58
|
+
<script src="https://www.unpkg.com/mx3d/core/mx3d.kernel.min.js"></script>
|
|
59
|
+
<script src="https://www.unpkg.com/mx3d/core/mx3d.loaders.min.js"></script>
|
|
60
|
+
<script src="https://www.unpkg.com/mx3d/core/mx3d.dazzle.min.js"></script>
|
|
61
|
+
<script src="https://www.unpkg.com/mx3d/mx3d.min.js"></script>
|
|
62
|
+
<title>Hello world</title>
|
|
63
|
+
</head>
|
|
64
|
+
<body>
|
|
65
|
+
<div id="container"></div>
|
|
66
|
+
<!-- built files will be auto injected -->
|
|
67
|
+
</body>
|
|
68
|
+
<script>
|
|
69
|
+
var container = document.getElementById("container");
|
|
70
|
+
var app = new MX3D.App(container);
|
|
71
|
+
app.showFps();
|
|
72
|
+
var _t = new Date().getTime();
|
|
73
|
+
app.create({
|
|
74
|
+
fileUrl: "http://h5.wodashijie.com/api/OpenScene/GetProject?id=nLfqWnZyD5zAdSg9", //场景文件
|
|
75
|
+
libraryUrl: null, //模型库路径
|
|
76
|
+
complete: null,
|
|
77
|
+
progress: (_x) => {
|
|
78
|
+
//加载进度
|
|
79
|
+
console.log(_x)
|
|
80
|
+
}
|
|
81
|
+
}).then((data) => {
|
|
82
|
+
app.Project.show();
|
|
83
|
+
console.log(parseInt(new Date().getTime() - _t) / 1000);
|
|
84
|
+
})
|
|
85
|
+
</script>
|
|
86
|
+
</html>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
如果是通过 npm 安装,并希望配合 webpack 使用,请阅读下一节:快速上手。
|
package/mx3d.js
CHANGED
|
@@ -7840,12 +7840,15 @@ class DefaultObject_DefaultObject {
|
|
|
7840
7840
|
this.instance.setEnabled(_value);
|
|
7841
7841
|
this.isEnabled = _value;
|
|
7842
7842
|
if (this.isEnabled) {
|
|
7843
|
-
this.instance.isPickable = this.
|
|
7844
|
-
this.
|
|
7843
|
+
this.instance.isPickable = this.executes.count() > 0;
|
|
7844
|
+
if (this.executes.find(EventType.eover) || this.executes.find(EventType.out))
|
|
7845
|
+
this.instance.enablePointerMoveEvents = true;
|
|
7846
|
+
else
|
|
7847
|
+
this.instance.enablePointerMoveEvents = false;
|
|
7845
7848
|
}
|
|
7846
7849
|
else {
|
|
7847
|
-
this.instance.isPickable =
|
|
7848
|
-
this.instance.enablePointerMoveEvents =
|
|
7850
|
+
this.instance.isPickable = false;
|
|
7851
|
+
this.instance.enablePointerMoveEvents = false;
|
|
7849
7852
|
}
|
|
7850
7853
|
this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
|
|
7851
7854
|
}
|
|
@@ -7884,8 +7887,8 @@ class DefaultObject_DefaultObject {
|
|
|
7884
7887
|
_o.setBoundingInfo(bound);
|
|
7885
7888
|
this.instance = this.app.Resources.BOX.clone(this.id);
|
|
7886
7889
|
this.instance.id = this.id;
|
|
7887
|
-
this.instance.enablePointerMoveEvents =
|
|
7888
|
-
this.instance.isPickable =
|
|
7890
|
+
this.instance.enablePointerMoveEvents = false;
|
|
7891
|
+
this.instance.isPickable = false;
|
|
7889
7892
|
this.instance.scaling = new BABYLON.Vector3((bound.maximum.x - bound.minimum.x) * _o.scaling.x, (bound.maximum.y - bound.minimum.y) * _o.scaling.y, (bound.maximum.z - bound.minimum.z) * _o.scaling.z);
|
|
7890
7893
|
if (this.instance.scaling.y == 0)
|
|
7891
7894
|
this.instance.scaling.y = 0.01;
|
|
@@ -7932,6 +7935,7 @@ class DefaultObject_DefaultObject {
|
|
|
7932
7935
|
if (type == EventType.leftClick || type == EventType.rightClick) {
|
|
7933
7936
|
this.clickEvents.remove(type);
|
|
7934
7937
|
this.clickEvents.add(type, callback);
|
|
7938
|
+
this.instance.isPickable = true;
|
|
7935
7939
|
execut = new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickTrigger, (e) => {
|
|
7936
7940
|
let leftCall = this.clickEvents.find(EventType.leftClick);
|
|
7937
7941
|
if (leftCall && e.sourceEvent.button == 0)
|
|
@@ -7948,12 +7952,16 @@ class DefaultObject_DefaultObject {
|
|
|
7948
7952
|
}
|
|
7949
7953
|
else if (type == EventType.doubleClick)
|
|
7950
7954
|
execut = new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnDoublePickTrigger, (e) => callback(this, e));
|
|
7951
|
-
else if (type == EventType.eover)
|
|
7955
|
+
else if (type == EventType.eover) {
|
|
7952
7956
|
execut = new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOverTrigger, (e) => callback(this, e));
|
|
7957
|
+
this.instance.enablePointerMoveEvents = true;
|
|
7958
|
+
}
|
|
7953
7959
|
else if (type == EventType.longPress)
|
|
7954
7960
|
execut = new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnLongPressTrigger, (e) => callback(this, e));
|
|
7955
|
-
else if (type == EventType.out)
|
|
7961
|
+
else if (type == EventType.out) {
|
|
7956
7962
|
execut = new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOutTrigger, (e) => callback(this, e));
|
|
7963
|
+
this.instance.enablePointerMoveEvents = true;
|
|
7964
|
+
}
|
|
7957
7965
|
if (execut) {
|
|
7958
7966
|
if (!this.action) {
|
|
7959
7967
|
this.action = new BABYLON.ActionManager(this.app.scene);
|
|
@@ -8078,6 +8086,7 @@ class ConduitObject_ConduitObject extends DefaultObject_DefaultObject {
|
|
|
8078
8086
|
this.isMonitor = _m.isMonitor;
|
|
8079
8087
|
this.objectType = _m.objectType;
|
|
8080
8088
|
this.isVisible = true;
|
|
8089
|
+
this.color = _m.color;
|
|
8081
8090
|
let pists = Tools.ToARRVector3(_m.pints);
|
|
8082
8091
|
this.instance = Tools.createTube(_m.id, pists, _m.radius, this.app);
|
|
8083
8092
|
let mat = new BABYLON.StandardMaterial(_m.id, this.app.scene);
|
|
@@ -8102,7 +8111,9 @@ class ConduitObject_ConduitObject extends DefaultObject_DefaultObject {
|
|
|
8102
8111
|
if (this.effectType != EffectType.Opaque)
|
|
8103
8112
|
return;
|
|
8104
8113
|
this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
|
|
8114
|
+
this.optimization(false);
|
|
8105
8115
|
this.instance.material.emissiveColor = src.EffectMgr.colors[_level];
|
|
8116
|
+
this.app.Glow.addIncludedOnlyMesh(this.instance);
|
|
8106
8117
|
this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
|
|
8107
8118
|
this.effectType = EffectType.Flash;
|
|
8108
8119
|
}
|
|
@@ -8111,6 +8122,8 @@ class ConduitObject_ConduitObject extends DefaultObject_DefaultObject {
|
|
|
8111
8122
|
if (this.effectType == EffectType.Opaque)
|
|
8112
8123
|
return;
|
|
8113
8124
|
this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
|
|
8125
|
+
this.app.Glow.removeIncludedOnlyMesh(this.instance);
|
|
8126
|
+
this.optimization(true);
|
|
8114
8127
|
this.instance.material.alpha = this.alpha;
|
|
8115
8128
|
this.instance.material.emissiveColor = null;
|
|
8116
8129
|
this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
|
|
@@ -8121,6 +8134,8 @@ class ConduitObject_ConduitObject extends DefaultObject_DefaultObject {
|
|
|
8121
8134
|
if (this.effectType != EffectType.Opaque)
|
|
8122
8135
|
return;
|
|
8123
8136
|
this.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
|
|
8137
|
+
this.app.Glow.removeIncludedOnlyMesh(this.instance);
|
|
8138
|
+
this.optimization(false);
|
|
8124
8139
|
this.instance.material.alpha = alpha;
|
|
8125
8140
|
this.app.scene.blockfreeActiveMeshesAndRenderingGroups = false;
|
|
8126
8141
|
this.effectType = EffectType.Transparent;
|
|
@@ -9735,8 +9750,9 @@ class App_App {
|
|
|
9735
9750
|
// this.Glow.intensity = 5;
|
|
9736
9751
|
// this.gl.gl1 = new BABYLON.GlowLayer("glow", this.scene);
|
|
9737
9752
|
// this.gl.gl1.intensity = 0.25;
|
|
9738
|
-
// this.gl
|
|
9739
|
-
// this.gl
|
|
9753
|
+
// this.gl = new BABYLON.GlowLayer("glow2", this.scene);
|
|
9754
|
+
// console.log(this.gl)
|
|
9755
|
+
// this.gl.intensity = 1.0;
|
|
9740
9756
|
// gl.addIncludedOnlyMesh(this.ResourceMgr.transparentBox);
|
|
9741
9757
|
this.container = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("screenUI");
|
|
9742
9758
|
// this.toolTip = new ToolTip(this, this.container);
|
|
@@ -9794,8 +9810,10 @@ class App_App {
|
|
|
9794
9810
|
}
|
|
9795
9811
|
create(_config) {
|
|
9796
9812
|
this.highQualityMode = _config.highQualityMode;
|
|
9797
|
-
if (this.highQualityMode)
|
|
9813
|
+
if (this.highQualityMode) {
|
|
9798
9814
|
this.Glow = new BABYLON.GlowLayer("glow", this.scene); //自发光,有可能造成内存泄露;且性能要求较高
|
|
9815
|
+
this.Glow.addIncludedOnlyMesh(this.Resources.BOX);
|
|
9816
|
+
}
|
|
9799
9817
|
if (_config.libraryUrl)
|
|
9800
9818
|
this.Resources.resourcePath = _config.libraryUrl;
|
|
9801
9819
|
return new Promise(async (resolve, reject) => {
|
|
@@ -10091,11 +10109,11 @@ class UI_UI {
|
|
|
10091
10109
|
static createIcon(_id, _anchor, _size, _height) {
|
|
10092
10110
|
let icon;
|
|
10093
10111
|
_anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups = true;
|
|
10094
|
-
icon = new external_Dazzle_["Icon"](_id);
|
|
10112
|
+
icon = new external_Dazzle_["Icon"](_id, _anchor.app.scene);
|
|
10095
10113
|
icon.size = _size;
|
|
10096
10114
|
icon.height = _height;
|
|
10097
|
-
icon.pint = new BABYLON.Mesh(
|
|
10098
|
-
let pos = _anchor
|
|
10115
|
+
icon.pint = new BABYLON.Mesh(_id + '_pint');
|
|
10116
|
+
let pos = _anchor.visualAngle.focus.clone();
|
|
10099
10117
|
// if (_anchor[0].objectType == ObjectType.Floor) {
|
|
10100
10118
|
// pos = _anchor[0].instance.getAbsolutePivotPoint();
|
|
10101
10119
|
// }
|