@aibee/crc-bmap 0.0.127 → 0.0.129
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/lib/bmap.cjs.min.js +7 -7
- package/lib/bmap.cjs.min.js.map +3 -3
- package/lib/bmap.esm.js +116 -85
- package/lib/bmap.esm.js.map +3 -3
- package/lib/bmap.esm.min.js +6 -6
- package/lib/bmap.esm.min.js.map +3 -3
- package/lib/bmap.min.js +7 -7
- package/lib/bmap.min.js.map +3 -3
- package/lib/src/elements/glb-model.d.ts +2 -0
- package/lib/src/elements/ground-texture.d.ts +2 -3
- package/lib/src/elements/lane.d.ts +2 -0
- package/lib/src/factory/texture.d.ts +1 -1
- package/lib/src/loader/AibeeLoader/type.d.ts +2 -0
- package/package.json +1 -1
package/lib/bmap.esm.js
CHANGED
|
@@ -454,7 +454,7 @@ var require_Graph = __commonJS({
|
|
|
454
454
|
});
|
|
455
455
|
|
|
456
456
|
// src/bmap.ts
|
|
457
|
-
import { EventDispatcher as EventDispatcher7, Vector3 as
|
|
457
|
+
import { EventDispatcher as EventDispatcher7, Vector3 as Vector318 } from "three";
|
|
458
458
|
|
|
459
459
|
// src/utils/timer.ts
|
|
460
460
|
var Timer = class {
|
|
@@ -2013,7 +2013,7 @@ function toWebWorker(obj) {
|
|
|
2013
2013
|
import {
|
|
2014
2014
|
EventDispatcher as EventDispatcher6,
|
|
2015
2015
|
Box2,
|
|
2016
|
-
Vector3 as
|
|
2016
|
+
Vector3 as Vector317,
|
|
2017
2017
|
Vector2 as Vector26,
|
|
2018
2018
|
Raycaster as Raycaster3,
|
|
2019
2019
|
Box3 as Box39,
|
|
@@ -4015,16 +4015,29 @@ var Wall = class extends Object3D9 {
|
|
|
4015
4015
|
};
|
|
4016
4016
|
|
|
4017
4017
|
// src/elements/ground-texture.ts
|
|
4018
|
-
import {
|
|
4018
|
+
import {
|
|
4019
|
+
DoubleSide as DoubleSide3,
|
|
4020
|
+
Float32BufferAttribute,
|
|
4021
|
+
Mesh as Mesh5,
|
|
4022
|
+
MeshBasicMaterial as MeshBasicMaterial3,
|
|
4023
|
+
Object3D as Object3D10,
|
|
4024
|
+
ShapeGeometry
|
|
4025
|
+
} from "three";
|
|
4026
|
+
import { mergeGeometries as mergeGeometries2 } from "three/examples/jsm/utils/BufferGeometryUtils";
|
|
4019
4027
|
var defaultOptions3 = {
|
|
4020
4028
|
uuid: "",
|
|
4021
4029
|
iconUrl: "",
|
|
4022
4030
|
name: "",
|
|
4023
|
-
secondRotate: 0,
|
|
4024
4031
|
airHeight: 0,
|
|
4025
4032
|
deltaHeight: 0,
|
|
4026
4033
|
height: 0,
|
|
4027
|
-
geometry: {
|
|
4034
|
+
geometry: {
|
|
4035
|
+
cds: [],
|
|
4036
|
+
type: "polygon",
|
|
4037
|
+
coords: [],
|
|
4038
|
+
curveCpt: [],
|
|
4039
|
+
curveIndex: []
|
|
4040
|
+
},
|
|
4028
4041
|
opacity: 1,
|
|
4029
4042
|
visible: true
|
|
4030
4043
|
};
|
|
@@ -4032,43 +4045,46 @@ var GroundTexture = class extends Object3D10 {
|
|
|
4032
4045
|
constructor(context, options) {
|
|
4033
4046
|
super();
|
|
4034
4047
|
this.context = context;
|
|
4035
|
-
this.options =
|
|
4036
|
-
{ ...defaultOptions3, ...options },
|
|
4037
|
-
this
|
|
4038
|
-
);
|
|
4048
|
+
this.options = options.map((item) => ({ ...defaultOptions3, ...item }));
|
|
4039
4049
|
this.init();
|
|
4040
4050
|
}
|
|
4041
4051
|
options;
|
|
4042
4052
|
mesh;
|
|
4043
4053
|
async init() {
|
|
4044
|
-
const
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
bevelEnabled: false,
|
|
4052
|
-
depth: 0,
|
|
4053
|
-
curveSegments: 4
|
|
4054
|
+
const geometries = this.options.map((options) => {
|
|
4055
|
+
const { geometry: geometry2 } = options;
|
|
4056
|
+
const shape = initShape(geometry2.coords[0], geometry2.coords.slice(1));
|
|
4057
|
+
const shapeGeometry = new ShapeGeometry(shape, 4);
|
|
4058
|
+
const uvs = [1, 1, 0, 1, 0, 0, 1, 0];
|
|
4059
|
+
shapeGeometry.setAttribute("uv", new Float32BufferAttribute(uvs, 2));
|
|
4060
|
+
return shapeGeometry;
|
|
4054
4061
|
});
|
|
4055
|
-
const
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4062
|
+
const geometry = mergeGeometries2(geometries, true);
|
|
4063
|
+
geometries.forEach((geometry2) => geometry2.dispose());
|
|
4064
|
+
const materials = await Promise.all(this.options.map(async (option) => {
|
|
4065
|
+
const { iconUrl } = option;
|
|
4066
|
+
const texture = await this.context.textureFactory.getTexture(iconUrl);
|
|
4067
|
+
const material = new MeshBasicMaterial3({
|
|
4068
|
+
map: texture,
|
|
4069
|
+
alphaTest: 0.2,
|
|
4070
|
+
side: DoubleSide3
|
|
4071
|
+
});
|
|
4072
|
+
return material;
|
|
4073
|
+
}));
|
|
4074
|
+
const mesh = new Mesh5(geometry, materials);
|
|
4060
4075
|
this.mesh = mesh;
|
|
4061
|
-
this.
|
|
4076
|
+
this.position.z += 4e-3;
|
|
4062
4077
|
this.add(mesh);
|
|
4063
4078
|
}
|
|
4064
4079
|
dispose() {
|
|
4065
4080
|
this.mesh?.geometry.dispose();
|
|
4081
|
+
(this.mesh?.material).forEach((item) => item.dispose());
|
|
4066
4082
|
this.clear();
|
|
4067
4083
|
}
|
|
4068
4084
|
};
|
|
4069
4085
|
|
|
4070
4086
|
// src/elements/glb-model.ts
|
|
4071
|
-
import { Box3 as Box37, Object3D as Object3D11, Vector3 as
|
|
4087
|
+
import { Box3 as Box37, Object3D as Object3D11, Vector3 as Vector311 } from "three";
|
|
4072
4088
|
var defaultGlbOptions = {
|
|
4073
4089
|
url: "",
|
|
4074
4090
|
geometry: { type: "polygon", cds: [], coords: [], curveCpt: [], curveIndex: [] },
|
|
@@ -4076,7 +4092,9 @@ var defaultGlbOptions = {
|
|
|
4076
4092
|
width: 0,
|
|
4077
4093
|
rotate: 1,
|
|
4078
4094
|
airHeight: 1,
|
|
4079
|
-
deltaHeight: 0
|
|
4095
|
+
deltaHeight: 0,
|
|
4096
|
+
center_x: 0,
|
|
4097
|
+
center_y: 0
|
|
4080
4098
|
};
|
|
4081
4099
|
var GlbModel = class extends Object3D11 {
|
|
4082
4100
|
constructor(context, options) {
|
|
@@ -4089,16 +4107,17 @@ var GlbModel = class extends Object3D11 {
|
|
|
4089
4107
|
options;
|
|
4090
4108
|
async loadModel() {
|
|
4091
4109
|
const object = await loadModel(this.options.url);
|
|
4092
|
-
object.scene.rotation.set(Math.PI / 2,
|
|
4110
|
+
object.scene.rotation.set(Math.PI / 2, 0, 0);
|
|
4093
4111
|
const box = new Box37().setFromObject(object.scene);
|
|
4094
|
-
const size = box.getSize(new
|
|
4112
|
+
const size = box.getSize(new Vector311());
|
|
4095
4113
|
const max = Math.max(size.x, size.y);
|
|
4096
4114
|
const scale = this.options.width / max;
|
|
4097
4115
|
this.scale.set(scale, scale, scale);
|
|
4098
4116
|
this.add(object.scene);
|
|
4099
|
-
this.position.
|
|
4117
|
+
this.position.set(this.options.center_x, this.options.center_y, 0);
|
|
4100
4118
|
this.position.z += this.options.airHeight + this.options.deltaHeight;
|
|
4101
4119
|
this.model = object;
|
|
4120
|
+
this.rotateZ(this.options.rotate);
|
|
4102
4121
|
}
|
|
4103
4122
|
dispose() {
|
|
4104
4123
|
dispose(this);
|
|
@@ -4107,8 +4126,8 @@ var GlbModel = class extends Object3D11 {
|
|
|
4107
4126
|
};
|
|
4108
4127
|
|
|
4109
4128
|
// src/elements/lane.ts
|
|
4110
|
-
import { BufferGeometry as BufferGeometry3, LineSegments as LineSegments3, Mesh as Mesh6, Object3D as Object3D12, ShapeGeometry, Vector3 as
|
|
4111
|
-
import { mergeGeometries as
|
|
4129
|
+
import { BufferGeometry as BufferGeometry3, LineSegments as LineSegments3, Mesh as Mesh6, Object3D as Object3D12, ShapeGeometry as ShapeGeometry2, Vector3 as Vector312 } from "three";
|
|
4130
|
+
import { mergeGeometries as mergeGeometries3 } from "three/examples/jsm/utils/BufferGeometryUtils";
|
|
4112
4131
|
import { Line2 } from "three/examples/jsm/lines/Line2";
|
|
4113
4132
|
import { LineGeometry } from "three/examples/jsm/lines/LineGeometry";
|
|
4114
4133
|
var Lane = class extends Object3D12 {
|
|
@@ -4127,16 +4146,17 @@ var Lane = class extends Object3D12 {
|
|
|
4127
4146
|
lineGeometry;
|
|
4128
4147
|
Mesh;
|
|
4129
4148
|
LineMesh;
|
|
4149
|
+
doubleLines = [];
|
|
4130
4150
|
initGeometry() {
|
|
4131
4151
|
const geometries = this.options.map((option) => {
|
|
4132
4152
|
const shape = initShape(
|
|
4133
4153
|
option.geometry.coords[0].slice(0, -1),
|
|
4134
4154
|
option.geometry.coords.slice(1)
|
|
4135
4155
|
);
|
|
4136
|
-
const geometry = new
|
|
4156
|
+
const geometry = new ShapeGeometry2(shape, 4);
|
|
4137
4157
|
return geometry;
|
|
4138
4158
|
});
|
|
4139
|
-
this.geometry =
|
|
4159
|
+
this.geometry = mergeGeometries3(geometries);
|
|
4140
4160
|
geometries.forEach((item) => item.dispose());
|
|
4141
4161
|
}
|
|
4142
4162
|
initMaterial() {
|
|
@@ -4167,8 +4187,8 @@ var Lane = class extends Object3D12 {
|
|
|
4167
4187
|
for (let i = 0; i < curCds.length; i++) {
|
|
4168
4188
|
const cur = curCds[i];
|
|
4169
4189
|
const next = i + 1 === curCds.length ? curCds[0] : curCds[i + 1];
|
|
4170
|
-
points.push(new
|
|
4171
|
-
points.push(new
|
|
4190
|
+
points.push(new Vector312(cur[0], cur[1], _height));
|
|
4191
|
+
points.push(new Vector312(next[0], next[1], _height));
|
|
4172
4192
|
}
|
|
4173
4193
|
}
|
|
4174
4194
|
return points;
|
|
@@ -4188,13 +4208,13 @@ var Lane = class extends Object3D12 {
|
|
|
4188
4208
|
}
|
|
4189
4209
|
return obj;
|
|
4190
4210
|
}, {});
|
|
4191
|
-
Object.values(group).map((options2) => {
|
|
4211
|
+
this.doubleLines = Object.values(group).map((options2) => {
|
|
4192
4212
|
const material = this.context.materialFactory.createLine2MaterialMap({
|
|
4193
4213
|
color: options2[0].secondColor,
|
|
4194
4214
|
width: 0.2,
|
|
4195
4215
|
dashed: options2[0].dashed
|
|
4196
4216
|
});
|
|
4197
|
-
options2.map((option) => {
|
|
4217
|
+
return options2.map((option) => {
|
|
4198
4218
|
const geometry = new LineGeometry();
|
|
4199
4219
|
const vec = option.geometry.otherCoords[1].map((item) => [...item, 0]).flat(2);
|
|
4200
4220
|
geometry.setPositions(vec);
|
|
@@ -4202,15 +4222,16 @@ var Lane = class extends Object3D12 {
|
|
|
4202
4222
|
line.computeLineDistances();
|
|
4203
4223
|
line.position.z += 1e-3;
|
|
4204
4224
|
this.add(line);
|
|
4225
|
+
return line;
|
|
4205
4226
|
});
|
|
4206
|
-
});
|
|
4227
|
+
}).flat(2);
|
|
4207
4228
|
}
|
|
4208
4229
|
initLineGeometry() {
|
|
4209
4230
|
const geometries = this.options.map((option) => {
|
|
4210
4231
|
const points = this.getBorderPoints(option);
|
|
4211
4232
|
return new BufferGeometry3().setFromPoints(points);
|
|
4212
4233
|
});
|
|
4213
|
-
this.lineGeometry =
|
|
4234
|
+
this.lineGeometry = mergeGeometries3(geometries);
|
|
4214
4235
|
}
|
|
4215
4236
|
createBorder() {
|
|
4216
4237
|
const line = new LineSegments3(this.lineGeometry, this.lineMaterial);
|
|
@@ -4232,6 +4253,7 @@ var Lane = class extends Object3D12 {
|
|
|
4232
4253
|
dispose() {
|
|
4233
4254
|
this.geometry?.dispose();
|
|
4234
4255
|
this.lineGeometry?.dispose();
|
|
4256
|
+
this.doubleLines.map((item) => item.geometry.dispose());
|
|
4235
4257
|
this.clear();
|
|
4236
4258
|
}
|
|
4237
4259
|
};
|
|
@@ -4239,15 +4261,15 @@ var Lane = class extends Object3D12 {
|
|
|
4239
4261
|
// src/elements/merge-graphic.ts
|
|
4240
4262
|
import {
|
|
4241
4263
|
Object3D as Object3D13,
|
|
4242
|
-
ExtrudeGeometry as
|
|
4264
|
+
ExtrudeGeometry as ExtrudeGeometry3,
|
|
4243
4265
|
Mesh as Mesh7,
|
|
4244
|
-
Vector3 as
|
|
4266
|
+
Vector3 as Vector313,
|
|
4245
4267
|
BufferGeometry as BufferGeometry4,
|
|
4246
4268
|
LineSegments as LineSegments4,
|
|
4247
4269
|
ShaderMaterial as ShaderMaterial3,
|
|
4248
4270
|
Color as Color4
|
|
4249
4271
|
} from "three";
|
|
4250
|
-
import { mergeGeometries as
|
|
4272
|
+
import { mergeGeometries as mergeGeometries4 } from "three/examples/jsm/utils/BufferGeometryUtils";
|
|
4251
4273
|
var MergeGraphic = class extends Object3D13 {
|
|
4252
4274
|
constructor(context, options) {
|
|
4253
4275
|
super();
|
|
@@ -4277,7 +4299,7 @@ var MergeGraphic = class extends Object3D13 {
|
|
|
4277
4299
|
option.geometry.coords[0],
|
|
4278
4300
|
option.geometry.coords.slice(1)
|
|
4279
4301
|
);
|
|
4280
|
-
const geometry2 = new
|
|
4302
|
+
const geometry2 = new ExtrudeGeometry3(shape, {
|
|
4281
4303
|
steps: 1,
|
|
4282
4304
|
bevelEnabled: false,
|
|
4283
4305
|
depth: option.height,
|
|
@@ -4285,7 +4307,7 @@ var MergeGraphic = class extends Object3D13 {
|
|
|
4285
4307
|
});
|
|
4286
4308
|
return geometry2;
|
|
4287
4309
|
});
|
|
4288
|
-
const geometry =
|
|
4310
|
+
const geometry = mergeGeometries4(geometries);
|
|
4289
4311
|
geometries.forEach((geometry2) => geometry2.dispose());
|
|
4290
4312
|
return geometry;
|
|
4291
4313
|
}
|
|
@@ -4369,8 +4391,8 @@ var MergeGraphic = class extends Object3D13 {
|
|
|
4369
4391
|
for (let i = 0; i < curCds.length; i++) {
|
|
4370
4392
|
const cur = curCds[i];
|
|
4371
4393
|
const next = i + 1 === curCds.length ? curCds[0] : curCds[i + 1];
|
|
4372
|
-
points.push(new
|
|
4373
|
-
points.push(new
|
|
4394
|
+
points.push(new Vector313(cur[0], cur[1], height));
|
|
4395
|
+
points.push(new Vector313(next[0], next[1], height));
|
|
4374
4396
|
}
|
|
4375
4397
|
}
|
|
4376
4398
|
});
|
|
@@ -4767,7 +4789,7 @@ import {
|
|
|
4767
4789
|
MeshStandardMaterial as MeshStandardMaterial2,
|
|
4768
4790
|
MeshBasicMaterial as MeshBasicMaterial5,
|
|
4769
4791
|
ShaderMaterial as ShaderMaterial4,
|
|
4770
|
-
DoubleSide as
|
|
4792
|
+
DoubleSide as DoubleSide4,
|
|
4771
4793
|
Vector2 as Vector25
|
|
4772
4794
|
} from "three";
|
|
4773
4795
|
function vectorToString(vector) {
|
|
@@ -4911,7 +4933,7 @@ var MaterialFactory = class {
|
|
|
4911
4933
|
},
|
|
4912
4934
|
vertexShader,
|
|
4913
4935
|
fragmentShader,
|
|
4914
|
-
side:
|
|
4936
|
+
side: DoubleSide4
|
|
4915
4937
|
});
|
|
4916
4938
|
this.shaderMaterialMap.set(key, material);
|
|
4917
4939
|
return material;
|
|
@@ -4924,9 +4946,10 @@ var MaterialFactory = class {
|
|
|
4924
4946
|
const texture = await this.context.textureFactory.getTexture(url);
|
|
4925
4947
|
const material = new MeshBasicMaterial5({
|
|
4926
4948
|
map: texture,
|
|
4927
|
-
|
|
4928
|
-
|
|
4949
|
+
alphaTest: 0.2,
|
|
4950
|
+
side: DoubleSide4
|
|
4929
4951
|
});
|
|
4952
|
+
texture.needsUpdate = true;
|
|
4930
4953
|
this.groundTextureMaterialMap.set(key, material);
|
|
4931
4954
|
return material;
|
|
4932
4955
|
}
|
|
@@ -4978,7 +5001,7 @@ var MaterialFactory = class {
|
|
|
4978
5001
|
};
|
|
4979
5002
|
|
|
4980
5003
|
// src/utils/camera-bound.ts
|
|
4981
|
-
import { Box3 as Box38, Vector3 as
|
|
5004
|
+
import { Box3 as Box38, Vector3 as Vector316 } from "three";
|
|
4982
5005
|
var CameraBound = class {
|
|
4983
5006
|
constructor(context) {
|
|
4984
5007
|
this.context = context;
|
|
@@ -4986,9 +5009,9 @@ var CameraBound = class {
|
|
|
4986
5009
|
this.changePrevCamera();
|
|
4987
5010
|
}
|
|
4988
5011
|
prevCamera = {
|
|
4989
|
-
position: new
|
|
5012
|
+
position: new Vector316(),
|
|
4990
5013
|
zoom: 1,
|
|
4991
|
-
target: new
|
|
5014
|
+
target: new Vector316()
|
|
4992
5015
|
};
|
|
4993
5016
|
enable = true;
|
|
4994
5017
|
setEnable(enable) {
|
|
@@ -5030,8 +5053,8 @@ var CameraBound = class {
|
|
|
5030
5053
|
const { min, max } = box;
|
|
5031
5054
|
const lb = vector3ToDevice(min, camera, w, h);
|
|
5032
5055
|
const rt = vector3ToDevice(max, camera, w, h);
|
|
5033
|
-
const lt = vector3ToDevice(new
|
|
5034
|
-
const rb = vector3ToDevice(new
|
|
5056
|
+
const lt = vector3ToDevice(new Vector316(min.x, max.y, max.z), camera, w, h);
|
|
5057
|
+
const rb = vector3ToDevice(new Vector316(max.x, min.y, min.z), camera, w, h);
|
|
5035
5058
|
const left = Math.min(lb.x, rt.x, lt.x, rb.x);
|
|
5036
5059
|
const right = Math.max(lb.x, rt.x, lt.x, rb.x);
|
|
5037
5060
|
const top = Math.min(lb.y, rt.y, lt.y, rb.y);
|
|
@@ -5081,13 +5104,20 @@ var TextureFactory = class {
|
|
|
5081
5104
|
if (this.textureMap.has(url)) {
|
|
5082
5105
|
return this.textureMap.get(url);
|
|
5083
5106
|
}
|
|
5084
|
-
const
|
|
5085
|
-
|
|
5086
|
-
|
|
5107
|
+
const texturePromise = this.loader.loadAsync(url).then((texture) => {
|
|
5108
|
+
this.textureMap.set(url, texture);
|
|
5109
|
+
return texture;
|
|
5110
|
+
});
|
|
5111
|
+
this.textureMap.set(url, texturePromise);
|
|
5112
|
+
return texturePromise;
|
|
5087
5113
|
}
|
|
5088
5114
|
dispose() {
|
|
5089
5115
|
this.textureMap.forEach((texture) => {
|
|
5090
|
-
texture
|
|
5116
|
+
if (texture instanceof Promise) {
|
|
5117
|
+
texture.then((res) => res.dispose());
|
|
5118
|
+
} else {
|
|
5119
|
+
texture.dispose();
|
|
5120
|
+
}
|
|
5091
5121
|
});
|
|
5092
5122
|
this.textureMap.clear();
|
|
5093
5123
|
}
|
|
@@ -5161,7 +5191,7 @@ var Context = class extends EventDispatcher6 {
|
|
|
5161
5191
|
/**
|
|
5162
5192
|
* 获取两个点之间的像素数
|
|
5163
5193
|
*/
|
|
5164
|
-
getRatio(point1 = new
|
|
5194
|
+
getRatio(point1 = new Vector317(0, 0, 0), point22 = new Vector317(100, 0, 0)) {
|
|
5165
5195
|
const { clientWidth, clientHeight } = this.container;
|
|
5166
5196
|
const device1 = vector3ToDevice(point1, this.camera, clientWidth, clientHeight);
|
|
5167
5197
|
const device2 = vector3ToDevice(point22, this.camera, clientWidth, clientHeight);
|
|
@@ -5362,7 +5392,7 @@ var Context = class extends EventDispatcher6 {
|
|
|
5362
5392
|
);
|
|
5363
5393
|
}
|
|
5364
5394
|
getCameraLookAt() {
|
|
5365
|
-
return new
|
|
5395
|
+
return new Vector317().subVectors(this.control.target, this.camera.position);
|
|
5366
5396
|
}
|
|
5367
5397
|
/**
|
|
5368
5398
|
* 按照一个中心点设置相机的放大缩小
|
|
@@ -5417,10 +5447,10 @@ var Context = class extends EventDispatcher6 {
|
|
|
5417
5447
|
const boundingBox = new Box39().setFromObject(object);
|
|
5418
5448
|
this.setPolarAngle(polar, 0);
|
|
5419
5449
|
const { max, min } = boundingBox;
|
|
5420
|
-
const leftTop = new
|
|
5421
|
-
const rightTop = new
|
|
5422
|
-
const rightBottom = new
|
|
5423
|
-
const leftBottom = new
|
|
5450
|
+
const leftTop = new Vector317(min.x, max.y, max.z);
|
|
5451
|
+
const rightTop = new Vector317(max.x, max.y, max.z);
|
|
5452
|
+
const rightBottom = new Vector317(max.x, min.y, min.z);
|
|
5453
|
+
const leftBottom = new Vector317(min.x, min.y, min.z);
|
|
5424
5454
|
const leftTop2d = vector3ToDevice(leftTop, this.camera, width, height);
|
|
5425
5455
|
const rightTop2d = vector3ToDevice(rightTop, this.camera, width, height);
|
|
5426
5456
|
const leftBottom2d = vector3ToDevice(leftBottom, this.camera, width, height);
|
|
@@ -5435,7 +5465,7 @@ var Context = class extends EventDispatcher6 {
|
|
|
5435
5465
|
const xScale = (width - right - left) / size.x;
|
|
5436
5466
|
const yScale = (height - top - bottom) / size.y;
|
|
5437
5467
|
const scale = Math.min(xScale, yScale);
|
|
5438
|
-
const center2 = new
|
|
5468
|
+
const center2 = new Vector317((max.x + min.x) / 2, (max.y + min.y) / 2, (max.z + min.z) / 2);
|
|
5439
5469
|
return { zoom: scale * this.camera.zoom, center: center2 };
|
|
5440
5470
|
}
|
|
5441
5471
|
/**
|
|
@@ -5986,7 +6016,7 @@ var BMap = class extends EventDispatcher7 {
|
|
|
5986
6016
|
} = this.context;
|
|
5987
6017
|
const device = vector3ToDevice(position, camera, width, height);
|
|
5988
6018
|
const offsetX = device.x - width / 2;
|
|
5989
|
-
const v3 = new
|
|
6019
|
+
const v3 = new Vector318();
|
|
5990
6020
|
v3.setFromMatrixColumn(this.context.camera.matrix, 0);
|
|
5991
6021
|
v3.normalize();
|
|
5992
6022
|
v3.multiplyScalar(offsetX / this.context.camera.zoom);
|
|
@@ -6364,7 +6394,7 @@ import {
|
|
|
6364
6394
|
TextureLoader as TextureLoader2,
|
|
6365
6395
|
Color as Color8,
|
|
6366
6396
|
Vector2 as Vector28,
|
|
6367
|
-
Vector3 as
|
|
6397
|
+
Vector3 as Vector320,
|
|
6368
6398
|
NormalBlending,
|
|
6369
6399
|
RepeatWrapping
|
|
6370
6400
|
} from "three";
|
|
@@ -6373,7 +6403,7 @@ import {
|
|
|
6373
6403
|
import {
|
|
6374
6404
|
BufferGeometry as BufferGeometry5,
|
|
6375
6405
|
Matrix4,
|
|
6376
|
-
Vector3 as
|
|
6406
|
+
Vector3 as Vector319,
|
|
6377
6407
|
Ray as Ray2,
|
|
6378
6408
|
Sphere,
|
|
6379
6409
|
LineSegments as LineSegments5,
|
|
@@ -6453,7 +6483,7 @@ MeshLine.prototype.setPoints = function(points, wcb) {
|
|
|
6453
6483
|
this.widthCallback = wcb;
|
|
6454
6484
|
this.positions = [];
|
|
6455
6485
|
this.counters = [];
|
|
6456
|
-
if (points.length && points[0] instanceof
|
|
6486
|
+
if (points.length && points[0] instanceof Vector319) {
|
|
6457
6487
|
for (var j = 0; j < points.length; j++) {
|
|
6458
6488
|
var p = points[j];
|
|
6459
6489
|
var c = j / points.length;
|
|
@@ -6477,7 +6507,7 @@ function MeshLineRaycast(raycaster, intersects) {
|
|
|
6477
6507
|
var inverseMatrix = new Matrix4();
|
|
6478
6508
|
var ray = new Ray2();
|
|
6479
6509
|
var sphere = new Sphere();
|
|
6480
|
-
var interRay = new
|
|
6510
|
+
var interRay = new Vector319();
|
|
6481
6511
|
var geometry = this.geometry;
|
|
6482
6512
|
if (!geometry.boundingSphere) geometry.computeBoundingSphere();
|
|
6483
6513
|
sphere.copy(geometry.boundingSphere);
|
|
@@ -6487,9 +6517,9 @@ function MeshLineRaycast(raycaster, intersects) {
|
|
|
6487
6517
|
}
|
|
6488
6518
|
inverseMatrix.copy(this.matrixWorld).invert();
|
|
6489
6519
|
ray.copy(raycaster.ray).applyMatrix4(inverseMatrix);
|
|
6490
|
-
var vStart = new
|
|
6491
|
-
var vEnd = new
|
|
6492
|
-
var interSegment = new
|
|
6520
|
+
var vStart = new Vector319();
|
|
6521
|
+
var vEnd = new Vector319();
|
|
6522
|
+
var interSegment = new Vector319();
|
|
6493
6523
|
var step = this instanceof LineSegments5 ? 2 : 1;
|
|
6494
6524
|
var index = geometry.index;
|
|
6495
6525
|
var attributes = geometry.attributes;
|
|
@@ -6543,8 +6573,8 @@ MeshLine.prototype.getDistance = function(i) {
|
|
|
6543
6573
|
let maxLength = 0;
|
|
6544
6574
|
for (let k = 0; k < i; k++) {
|
|
6545
6575
|
const index = 6 * k;
|
|
6546
|
-
const p0 = new
|
|
6547
|
-
const p1 = new
|
|
6576
|
+
const p0 = new Vector319(this.positions[index], this.positions[index + 1], this.positions[index + 2]);
|
|
6577
|
+
const p1 = new Vector319(this.positions[index + 6], this.positions[index + 7], this.positions[index + 8]);
|
|
6548
6578
|
const distance = p0.distanceTo(p1);
|
|
6549
6579
|
maxLength += distance;
|
|
6550
6580
|
}
|
|
@@ -7056,7 +7086,7 @@ var Path2 = class extends Object3D16 {
|
|
|
7056
7086
|
}
|
|
7057
7087
|
} = this;
|
|
7058
7088
|
const screenPoints = points.map(
|
|
7059
|
-
([x, y]) => vector3ToDevice(new
|
|
7089
|
+
([x, y]) => vector3ToDevice(new Vector320(x, y, 0), camera, width, height)
|
|
7060
7090
|
).map(({ x, y }) => [x, y]);
|
|
7061
7091
|
const pointLength = getPathLength(screenPoints);
|
|
7062
7092
|
return pointLength / 32;
|
|
@@ -7829,8 +7859,8 @@ var AibeeLoader = class {
|
|
|
7829
7859
|
return obj;
|
|
7830
7860
|
}, {});
|
|
7831
7861
|
Object.values(group).forEach((options) => {
|
|
7832
|
-
const
|
|
7833
|
-
floor.mergeGraphicLayer.add(
|
|
7862
|
+
const mergeGeometries5 = new MergeGraphic(this.bmap.context, options);
|
|
7863
|
+
floor.mergeGraphicLayer.add(mergeGeometries5);
|
|
7834
7864
|
});
|
|
7835
7865
|
break;
|
|
7836
7866
|
case "ground":
|
|
@@ -7875,19 +7905,20 @@ var AibeeLoader = class {
|
|
|
7875
7905
|
case "texture2d":
|
|
7876
7906
|
case "texture3d":
|
|
7877
7907
|
transformGraphicData(layer.elements, center2);
|
|
7878
|
-
layer.elements
|
|
7879
|
-
|
|
7880
|
-
floor.textureLayer.add(texture);
|
|
7881
|
-
});
|
|
7908
|
+
const texture = new GroundTexture(this.bmap.context, layer.elements);
|
|
7909
|
+
floor.textureLayer.add(texture);
|
|
7882
7910
|
break;
|
|
7883
7911
|
case "glb":
|
|
7884
7912
|
transformGraphicData(layer.elements, center2);
|
|
7885
7913
|
layer.elements.forEach((options) => {
|
|
7914
|
+
const pos = translatePosToCenter([options.center_x, options.center_y], center2);
|
|
7886
7915
|
const model = new GlbModel(this.bmap.context, {
|
|
7887
7916
|
...options,
|
|
7888
7917
|
url: options.secondUrl,
|
|
7889
7918
|
rotate: options.secondRotate,
|
|
7890
|
-
width: options.secondWidth
|
|
7919
|
+
width: options.secondWidth,
|
|
7920
|
+
center_x: pos[0],
|
|
7921
|
+
center_y: pos[1]
|
|
7891
7922
|
});
|
|
7892
7923
|
floor.glbModelLayer.add(model);
|
|
7893
7924
|
});
|