@aibee/crc-bmap 0.0.128 → 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 +114 -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
|
-
});
|
|
4055
|
-
const planeMaterial = await this.context.materialFactory.createGroundTextureMaterial({
|
|
4056
|
-
url: iconUrl,
|
|
4057
|
-
opacity
|
|
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;
|
|
4058
4061
|
});
|
|
4059
|
-
const
|
|
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) {
|
|
@@ -4091,13 +4109,12 @@ var GlbModel = class extends Object3D11 {
|
|
|
4091
4109
|
const object = await loadModel(this.options.url);
|
|
4092
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
|
-
|
|
4100
|
-
this.position.set(center2[0], center2[1], 0);
|
|
4117
|
+
this.position.set(this.options.center_x, this.options.center_y, 0);
|
|
4101
4118
|
this.position.z += this.options.airHeight + this.options.deltaHeight;
|
|
4102
4119
|
this.model = object;
|
|
4103
4120
|
this.rotateZ(this.options.rotate);
|
|
@@ -4109,8 +4126,8 @@ var GlbModel = class extends Object3D11 {
|
|
|
4109
4126
|
};
|
|
4110
4127
|
|
|
4111
4128
|
// src/elements/lane.ts
|
|
4112
|
-
import { BufferGeometry as BufferGeometry3, LineSegments as LineSegments3, Mesh as Mesh6, Object3D as Object3D12, ShapeGeometry, Vector3 as
|
|
4113
|
-
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";
|
|
4114
4131
|
import { Line2 } from "three/examples/jsm/lines/Line2";
|
|
4115
4132
|
import { LineGeometry } from "three/examples/jsm/lines/LineGeometry";
|
|
4116
4133
|
var Lane = class extends Object3D12 {
|
|
@@ -4129,16 +4146,17 @@ var Lane = class extends Object3D12 {
|
|
|
4129
4146
|
lineGeometry;
|
|
4130
4147
|
Mesh;
|
|
4131
4148
|
LineMesh;
|
|
4149
|
+
doubleLines = [];
|
|
4132
4150
|
initGeometry() {
|
|
4133
4151
|
const geometries = this.options.map((option) => {
|
|
4134
4152
|
const shape = initShape(
|
|
4135
4153
|
option.geometry.coords[0].slice(0, -1),
|
|
4136
4154
|
option.geometry.coords.slice(1)
|
|
4137
4155
|
);
|
|
4138
|
-
const geometry = new
|
|
4156
|
+
const geometry = new ShapeGeometry2(shape, 4);
|
|
4139
4157
|
return geometry;
|
|
4140
4158
|
});
|
|
4141
|
-
this.geometry =
|
|
4159
|
+
this.geometry = mergeGeometries3(geometries);
|
|
4142
4160
|
geometries.forEach((item) => item.dispose());
|
|
4143
4161
|
}
|
|
4144
4162
|
initMaterial() {
|
|
@@ -4169,8 +4187,8 @@ var Lane = class extends Object3D12 {
|
|
|
4169
4187
|
for (let i = 0; i < curCds.length; i++) {
|
|
4170
4188
|
const cur = curCds[i];
|
|
4171
4189
|
const next = i + 1 === curCds.length ? curCds[0] : curCds[i + 1];
|
|
4172
|
-
points.push(new
|
|
4173
|
-
points.push(new
|
|
4190
|
+
points.push(new Vector312(cur[0], cur[1], _height));
|
|
4191
|
+
points.push(new Vector312(next[0], next[1], _height));
|
|
4174
4192
|
}
|
|
4175
4193
|
}
|
|
4176
4194
|
return points;
|
|
@@ -4190,13 +4208,13 @@ var Lane = class extends Object3D12 {
|
|
|
4190
4208
|
}
|
|
4191
4209
|
return obj;
|
|
4192
4210
|
}, {});
|
|
4193
|
-
Object.values(group).map((options2) => {
|
|
4211
|
+
this.doubleLines = Object.values(group).map((options2) => {
|
|
4194
4212
|
const material = this.context.materialFactory.createLine2MaterialMap({
|
|
4195
4213
|
color: options2[0].secondColor,
|
|
4196
4214
|
width: 0.2,
|
|
4197
4215
|
dashed: options2[0].dashed
|
|
4198
4216
|
});
|
|
4199
|
-
options2.map((option) => {
|
|
4217
|
+
return options2.map((option) => {
|
|
4200
4218
|
const geometry = new LineGeometry();
|
|
4201
4219
|
const vec = option.geometry.otherCoords[1].map((item) => [...item, 0]).flat(2);
|
|
4202
4220
|
geometry.setPositions(vec);
|
|
@@ -4204,15 +4222,16 @@ var Lane = class extends Object3D12 {
|
|
|
4204
4222
|
line.computeLineDistances();
|
|
4205
4223
|
line.position.z += 1e-3;
|
|
4206
4224
|
this.add(line);
|
|
4225
|
+
return line;
|
|
4207
4226
|
});
|
|
4208
|
-
});
|
|
4227
|
+
}).flat(2);
|
|
4209
4228
|
}
|
|
4210
4229
|
initLineGeometry() {
|
|
4211
4230
|
const geometries = this.options.map((option) => {
|
|
4212
4231
|
const points = this.getBorderPoints(option);
|
|
4213
4232
|
return new BufferGeometry3().setFromPoints(points);
|
|
4214
4233
|
});
|
|
4215
|
-
this.lineGeometry =
|
|
4234
|
+
this.lineGeometry = mergeGeometries3(geometries);
|
|
4216
4235
|
}
|
|
4217
4236
|
createBorder() {
|
|
4218
4237
|
const line = new LineSegments3(this.lineGeometry, this.lineMaterial);
|
|
@@ -4234,6 +4253,7 @@ var Lane = class extends Object3D12 {
|
|
|
4234
4253
|
dispose() {
|
|
4235
4254
|
this.geometry?.dispose();
|
|
4236
4255
|
this.lineGeometry?.dispose();
|
|
4256
|
+
this.doubleLines.map((item) => item.geometry.dispose());
|
|
4237
4257
|
this.clear();
|
|
4238
4258
|
}
|
|
4239
4259
|
};
|
|
@@ -4241,15 +4261,15 @@ var Lane = class extends Object3D12 {
|
|
|
4241
4261
|
// src/elements/merge-graphic.ts
|
|
4242
4262
|
import {
|
|
4243
4263
|
Object3D as Object3D13,
|
|
4244
|
-
ExtrudeGeometry as
|
|
4264
|
+
ExtrudeGeometry as ExtrudeGeometry3,
|
|
4245
4265
|
Mesh as Mesh7,
|
|
4246
|
-
Vector3 as
|
|
4266
|
+
Vector3 as Vector313,
|
|
4247
4267
|
BufferGeometry as BufferGeometry4,
|
|
4248
4268
|
LineSegments as LineSegments4,
|
|
4249
4269
|
ShaderMaterial as ShaderMaterial3,
|
|
4250
4270
|
Color as Color4
|
|
4251
4271
|
} from "three";
|
|
4252
|
-
import { mergeGeometries as
|
|
4272
|
+
import { mergeGeometries as mergeGeometries4 } from "three/examples/jsm/utils/BufferGeometryUtils";
|
|
4253
4273
|
var MergeGraphic = class extends Object3D13 {
|
|
4254
4274
|
constructor(context, options) {
|
|
4255
4275
|
super();
|
|
@@ -4279,7 +4299,7 @@ var MergeGraphic = class extends Object3D13 {
|
|
|
4279
4299
|
option.geometry.coords[0],
|
|
4280
4300
|
option.geometry.coords.slice(1)
|
|
4281
4301
|
);
|
|
4282
|
-
const geometry2 = new
|
|
4302
|
+
const geometry2 = new ExtrudeGeometry3(shape, {
|
|
4283
4303
|
steps: 1,
|
|
4284
4304
|
bevelEnabled: false,
|
|
4285
4305
|
depth: option.height,
|
|
@@ -4287,7 +4307,7 @@ var MergeGraphic = class extends Object3D13 {
|
|
|
4287
4307
|
});
|
|
4288
4308
|
return geometry2;
|
|
4289
4309
|
});
|
|
4290
|
-
const geometry =
|
|
4310
|
+
const geometry = mergeGeometries4(geometries);
|
|
4291
4311
|
geometries.forEach((geometry2) => geometry2.dispose());
|
|
4292
4312
|
return geometry;
|
|
4293
4313
|
}
|
|
@@ -4371,8 +4391,8 @@ var MergeGraphic = class extends Object3D13 {
|
|
|
4371
4391
|
for (let i = 0; i < curCds.length; i++) {
|
|
4372
4392
|
const cur = curCds[i];
|
|
4373
4393
|
const next = i + 1 === curCds.length ? curCds[0] : curCds[i + 1];
|
|
4374
|
-
points.push(new
|
|
4375
|
-
points.push(new
|
|
4394
|
+
points.push(new Vector313(cur[0], cur[1], height));
|
|
4395
|
+
points.push(new Vector313(next[0], next[1], height));
|
|
4376
4396
|
}
|
|
4377
4397
|
}
|
|
4378
4398
|
});
|
|
@@ -4769,7 +4789,7 @@ import {
|
|
|
4769
4789
|
MeshStandardMaterial as MeshStandardMaterial2,
|
|
4770
4790
|
MeshBasicMaterial as MeshBasicMaterial5,
|
|
4771
4791
|
ShaderMaterial as ShaderMaterial4,
|
|
4772
|
-
DoubleSide as
|
|
4792
|
+
DoubleSide as DoubleSide4,
|
|
4773
4793
|
Vector2 as Vector25
|
|
4774
4794
|
} from "three";
|
|
4775
4795
|
function vectorToString(vector) {
|
|
@@ -4913,7 +4933,7 @@ var MaterialFactory = class {
|
|
|
4913
4933
|
},
|
|
4914
4934
|
vertexShader,
|
|
4915
4935
|
fragmentShader,
|
|
4916
|
-
side:
|
|
4936
|
+
side: DoubleSide4
|
|
4917
4937
|
});
|
|
4918
4938
|
this.shaderMaterialMap.set(key, material);
|
|
4919
4939
|
return material;
|
|
@@ -4926,9 +4946,10 @@ var MaterialFactory = class {
|
|
|
4926
4946
|
const texture = await this.context.textureFactory.getTexture(url);
|
|
4927
4947
|
const material = new MeshBasicMaterial5({
|
|
4928
4948
|
map: texture,
|
|
4929
|
-
|
|
4930
|
-
|
|
4949
|
+
alphaTest: 0.2,
|
|
4950
|
+
side: DoubleSide4
|
|
4931
4951
|
});
|
|
4952
|
+
texture.needsUpdate = true;
|
|
4932
4953
|
this.groundTextureMaterialMap.set(key, material);
|
|
4933
4954
|
return material;
|
|
4934
4955
|
}
|
|
@@ -4980,7 +5001,7 @@ var MaterialFactory = class {
|
|
|
4980
5001
|
};
|
|
4981
5002
|
|
|
4982
5003
|
// src/utils/camera-bound.ts
|
|
4983
|
-
import { Box3 as Box38, Vector3 as
|
|
5004
|
+
import { Box3 as Box38, Vector3 as Vector316 } from "three";
|
|
4984
5005
|
var CameraBound = class {
|
|
4985
5006
|
constructor(context) {
|
|
4986
5007
|
this.context = context;
|
|
@@ -4988,9 +5009,9 @@ var CameraBound = class {
|
|
|
4988
5009
|
this.changePrevCamera();
|
|
4989
5010
|
}
|
|
4990
5011
|
prevCamera = {
|
|
4991
|
-
position: new
|
|
5012
|
+
position: new Vector316(),
|
|
4992
5013
|
zoom: 1,
|
|
4993
|
-
target: new
|
|
5014
|
+
target: new Vector316()
|
|
4994
5015
|
};
|
|
4995
5016
|
enable = true;
|
|
4996
5017
|
setEnable(enable) {
|
|
@@ -5032,8 +5053,8 @@ var CameraBound = class {
|
|
|
5032
5053
|
const { min, max } = box;
|
|
5033
5054
|
const lb = vector3ToDevice(min, camera, w, h);
|
|
5034
5055
|
const rt = vector3ToDevice(max, camera, w, h);
|
|
5035
|
-
const lt = vector3ToDevice(new
|
|
5036
|
-
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);
|
|
5037
5058
|
const left = Math.min(lb.x, rt.x, lt.x, rb.x);
|
|
5038
5059
|
const right = Math.max(lb.x, rt.x, lt.x, rb.x);
|
|
5039
5060
|
const top = Math.min(lb.y, rt.y, lt.y, rb.y);
|
|
@@ -5083,13 +5104,20 @@ var TextureFactory = class {
|
|
|
5083
5104
|
if (this.textureMap.has(url)) {
|
|
5084
5105
|
return this.textureMap.get(url);
|
|
5085
5106
|
}
|
|
5086
|
-
const
|
|
5087
|
-
|
|
5088
|
-
|
|
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;
|
|
5089
5113
|
}
|
|
5090
5114
|
dispose() {
|
|
5091
5115
|
this.textureMap.forEach((texture) => {
|
|
5092
|
-
texture
|
|
5116
|
+
if (texture instanceof Promise) {
|
|
5117
|
+
texture.then((res) => res.dispose());
|
|
5118
|
+
} else {
|
|
5119
|
+
texture.dispose();
|
|
5120
|
+
}
|
|
5093
5121
|
});
|
|
5094
5122
|
this.textureMap.clear();
|
|
5095
5123
|
}
|
|
@@ -5163,7 +5191,7 @@ var Context = class extends EventDispatcher6 {
|
|
|
5163
5191
|
/**
|
|
5164
5192
|
* 获取两个点之间的像素数
|
|
5165
5193
|
*/
|
|
5166
|
-
getRatio(point1 = new
|
|
5194
|
+
getRatio(point1 = new Vector317(0, 0, 0), point22 = new Vector317(100, 0, 0)) {
|
|
5167
5195
|
const { clientWidth, clientHeight } = this.container;
|
|
5168
5196
|
const device1 = vector3ToDevice(point1, this.camera, clientWidth, clientHeight);
|
|
5169
5197
|
const device2 = vector3ToDevice(point22, this.camera, clientWidth, clientHeight);
|
|
@@ -5364,7 +5392,7 @@ var Context = class extends EventDispatcher6 {
|
|
|
5364
5392
|
);
|
|
5365
5393
|
}
|
|
5366
5394
|
getCameraLookAt() {
|
|
5367
|
-
return new
|
|
5395
|
+
return new Vector317().subVectors(this.control.target, this.camera.position);
|
|
5368
5396
|
}
|
|
5369
5397
|
/**
|
|
5370
5398
|
* 按照一个中心点设置相机的放大缩小
|
|
@@ -5419,10 +5447,10 @@ var Context = class extends EventDispatcher6 {
|
|
|
5419
5447
|
const boundingBox = new Box39().setFromObject(object);
|
|
5420
5448
|
this.setPolarAngle(polar, 0);
|
|
5421
5449
|
const { max, min } = boundingBox;
|
|
5422
|
-
const leftTop = new
|
|
5423
|
-
const rightTop = new
|
|
5424
|
-
const rightBottom = new
|
|
5425
|
-
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);
|
|
5426
5454
|
const leftTop2d = vector3ToDevice(leftTop, this.camera, width, height);
|
|
5427
5455
|
const rightTop2d = vector3ToDevice(rightTop, this.camera, width, height);
|
|
5428
5456
|
const leftBottom2d = vector3ToDevice(leftBottom, this.camera, width, height);
|
|
@@ -5437,7 +5465,7 @@ var Context = class extends EventDispatcher6 {
|
|
|
5437
5465
|
const xScale = (width - right - left) / size.x;
|
|
5438
5466
|
const yScale = (height - top - bottom) / size.y;
|
|
5439
5467
|
const scale = Math.min(xScale, yScale);
|
|
5440
|
-
const center2 = new
|
|
5468
|
+
const center2 = new Vector317((max.x + min.x) / 2, (max.y + min.y) / 2, (max.z + min.z) / 2);
|
|
5441
5469
|
return { zoom: scale * this.camera.zoom, center: center2 };
|
|
5442
5470
|
}
|
|
5443
5471
|
/**
|
|
@@ -5988,7 +6016,7 @@ var BMap = class extends EventDispatcher7 {
|
|
|
5988
6016
|
} = this.context;
|
|
5989
6017
|
const device = vector3ToDevice(position, camera, width, height);
|
|
5990
6018
|
const offsetX = device.x - width / 2;
|
|
5991
|
-
const v3 = new
|
|
6019
|
+
const v3 = new Vector318();
|
|
5992
6020
|
v3.setFromMatrixColumn(this.context.camera.matrix, 0);
|
|
5993
6021
|
v3.normalize();
|
|
5994
6022
|
v3.multiplyScalar(offsetX / this.context.camera.zoom);
|
|
@@ -6366,7 +6394,7 @@ import {
|
|
|
6366
6394
|
TextureLoader as TextureLoader2,
|
|
6367
6395
|
Color as Color8,
|
|
6368
6396
|
Vector2 as Vector28,
|
|
6369
|
-
Vector3 as
|
|
6397
|
+
Vector3 as Vector320,
|
|
6370
6398
|
NormalBlending,
|
|
6371
6399
|
RepeatWrapping
|
|
6372
6400
|
} from "three";
|
|
@@ -6375,7 +6403,7 @@ import {
|
|
|
6375
6403
|
import {
|
|
6376
6404
|
BufferGeometry as BufferGeometry5,
|
|
6377
6405
|
Matrix4,
|
|
6378
|
-
Vector3 as
|
|
6406
|
+
Vector3 as Vector319,
|
|
6379
6407
|
Ray as Ray2,
|
|
6380
6408
|
Sphere,
|
|
6381
6409
|
LineSegments as LineSegments5,
|
|
@@ -6455,7 +6483,7 @@ MeshLine.prototype.setPoints = function(points, wcb) {
|
|
|
6455
6483
|
this.widthCallback = wcb;
|
|
6456
6484
|
this.positions = [];
|
|
6457
6485
|
this.counters = [];
|
|
6458
|
-
if (points.length && points[0] instanceof
|
|
6486
|
+
if (points.length && points[0] instanceof Vector319) {
|
|
6459
6487
|
for (var j = 0; j < points.length; j++) {
|
|
6460
6488
|
var p = points[j];
|
|
6461
6489
|
var c = j / points.length;
|
|
@@ -6479,7 +6507,7 @@ function MeshLineRaycast(raycaster, intersects) {
|
|
|
6479
6507
|
var inverseMatrix = new Matrix4();
|
|
6480
6508
|
var ray = new Ray2();
|
|
6481
6509
|
var sphere = new Sphere();
|
|
6482
|
-
var interRay = new
|
|
6510
|
+
var interRay = new Vector319();
|
|
6483
6511
|
var geometry = this.geometry;
|
|
6484
6512
|
if (!geometry.boundingSphere) geometry.computeBoundingSphere();
|
|
6485
6513
|
sphere.copy(geometry.boundingSphere);
|
|
@@ -6489,9 +6517,9 @@ function MeshLineRaycast(raycaster, intersects) {
|
|
|
6489
6517
|
}
|
|
6490
6518
|
inverseMatrix.copy(this.matrixWorld).invert();
|
|
6491
6519
|
ray.copy(raycaster.ray).applyMatrix4(inverseMatrix);
|
|
6492
|
-
var vStart = new
|
|
6493
|
-
var vEnd = new
|
|
6494
|
-
var interSegment = new
|
|
6520
|
+
var vStart = new Vector319();
|
|
6521
|
+
var vEnd = new Vector319();
|
|
6522
|
+
var interSegment = new Vector319();
|
|
6495
6523
|
var step = this instanceof LineSegments5 ? 2 : 1;
|
|
6496
6524
|
var index = geometry.index;
|
|
6497
6525
|
var attributes = geometry.attributes;
|
|
@@ -6545,8 +6573,8 @@ MeshLine.prototype.getDistance = function(i) {
|
|
|
6545
6573
|
let maxLength = 0;
|
|
6546
6574
|
for (let k = 0; k < i; k++) {
|
|
6547
6575
|
const index = 6 * k;
|
|
6548
|
-
const p0 = new
|
|
6549
|
-
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]);
|
|
6550
6578
|
const distance = p0.distanceTo(p1);
|
|
6551
6579
|
maxLength += distance;
|
|
6552
6580
|
}
|
|
@@ -7058,7 +7086,7 @@ var Path2 = class extends Object3D16 {
|
|
|
7058
7086
|
}
|
|
7059
7087
|
} = this;
|
|
7060
7088
|
const screenPoints = points.map(
|
|
7061
|
-
([x, y]) => vector3ToDevice(new
|
|
7089
|
+
([x, y]) => vector3ToDevice(new Vector320(x, y, 0), camera, width, height)
|
|
7062
7090
|
).map(({ x, y }) => [x, y]);
|
|
7063
7091
|
const pointLength = getPathLength(screenPoints);
|
|
7064
7092
|
return pointLength / 32;
|
|
@@ -7831,8 +7859,8 @@ var AibeeLoader = class {
|
|
|
7831
7859
|
return obj;
|
|
7832
7860
|
}, {});
|
|
7833
7861
|
Object.values(group).forEach((options) => {
|
|
7834
|
-
const
|
|
7835
|
-
floor.mergeGraphicLayer.add(
|
|
7862
|
+
const mergeGeometries5 = new MergeGraphic(this.bmap.context, options);
|
|
7863
|
+
floor.mergeGraphicLayer.add(mergeGeometries5);
|
|
7836
7864
|
});
|
|
7837
7865
|
break;
|
|
7838
7866
|
case "ground":
|
|
@@ -7877,19 +7905,20 @@ var AibeeLoader = class {
|
|
|
7877
7905
|
case "texture2d":
|
|
7878
7906
|
case "texture3d":
|
|
7879
7907
|
transformGraphicData(layer.elements, center2);
|
|
7880
|
-
layer.elements
|
|
7881
|
-
|
|
7882
|
-
floor.textureLayer.add(texture);
|
|
7883
|
-
});
|
|
7908
|
+
const texture = new GroundTexture(this.bmap.context, layer.elements);
|
|
7909
|
+
floor.textureLayer.add(texture);
|
|
7884
7910
|
break;
|
|
7885
7911
|
case "glb":
|
|
7886
7912
|
transformGraphicData(layer.elements, center2);
|
|
7887
7913
|
layer.elements.forEach((options) => {
|
|
7914
|
+
const pos = translatePosToCenter([options.center_x, options.center_y], center2);
|
|
7888
7915
|
const model = new GlbModel(this.bmap.context, {
|
|
7889
7916
|
...options,
|
|
7890
7917
|
url: options.secondUrl,
|
|
7891
7918
|
rotate: options.secondRotate,
|
|
7892
|
-
width: options.secondWidth
|
|
7919
|
+
width: options.secondWidth,
|
|
7920
|
+
center_x: pos[0],
|
|
7921
|
+
center_y: pos[1]
|
|
7893
7922
|
});
|
|
7894
7923
|
floor.glbModelLayer.add(model);
|
|
7895
7924
|
});
|