@aibee/crc-bmap 0.0.134 → 0.0.135

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.esm.js CHANGED
@@ -3548,7 +3548,6 @@ var PoiLayer2 = class extends Layer {
3548
3548
  const { max, min } = floor.box;
3549
3549
  const baseScale = Math.min(width / (max.x - min.x), height / (max.y - min.y));
3550
3550
  const zoom = baseScale * (max.x - min.x) / 200;
3551
- console.log(zoom, this.context.camera.zoom);
3552
3551
  this.pois.filter((poi) => poi.userData.type === "parkingSpace").map((poi) => {
3553
3552
  const visible = this.context.camera.zoom >= zoom;
3554
3553
  poi.visible = visible;
@@ -3665,8 +3664,7 @@ var Floor = class extends Object3D8 {
3665
3664
  key = "";
3666
3665
  box = new Box35();
3667
3666
  getPosition() {
3668
- const box = new Box35().setFromObject(this);
3669
- return box.getCenter(new Vector39());
3667
+ return this.box.getCenter(new Vector39());
3670
3668
  }
3671
3669
  createGround(options) {
3672
3670
  const ground = new Graphic(this.context, options);
@@ -3737,6 +3735,9 @@ var Floor = class extends Object3D8 {
3737
3735
  }
3738
3736
  updateBox() {
3739
3737
  this.box.setFromObject(this);
3738
+ this.wallLayer.children.forEach((item) => {
3739
+ item.changeWorldPoint(this.box.max, this.box.min);
3740
+ });
3740
3741
  }
3741
3742
  dispose() {
3742
3743
  this.shadow.dispose();
@@ -4176,6 +4177,8 @@ var Wall = class extends Object3D9 {
4176
4177
  lineGeometry;
4177
4178
  Mesh;
4178
4179
  LineMesh;
4180
+ maxWorldPoint = new Vector311(100, 100, 5);
4181
+ minWorldPoint = new Vector311(-100, -100, 0);
4179
4182
  initGeometry() {
4180
4183
  const geometries = this.options.map((option) => {
4181
4184
  const shape = initShape(
@@ -4202,24 +4205,33 @@ var Wall = class extends Object3D9 {
4202
4205
  uniform float uOpacity;
4203
4206
 
4204
4207
  void main() {
4205
- vPosition = position; // \u5411\u7247\u6BB5\u7740\u8272\u5668\u4F20\u9012\u4F4D\u7F6E
4206
- gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
4208
+ vPosition = position; // \u5411\u7247\u6BB5\u7740\u8272\u5668\u4F20\u9012\u4F4D\u7F6E
4209
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
4207
4210
  }
4208
4211
  `;
4209
4212
  const fragmentShader = `
4210
4213
  varying vec3 vPosition; // \u63A5\u6536\u9876\u70B9\u4F4D\u7F6E
4211
4214
  uniform float maxZ;
4212
4215
  uniform vec3 uColor;
4213
- uniform vec3 uColor2;
4216
+ uniform vec3 uGradualColor1;
4217
+ uniform vec3 uGradualColor2;
4214
4218
  uniform float uOpacity;
4219
+ uniform vec3 uMax;
4220
+ uniform vec3 uMin;
4215
4221
 
4216
4222
  void main() {
4217
- // \u5224\u65AD\u5F53\u524D\u9876\u70B9\u662F\u5426\u4E3A\u9876\u9762
4218
- if (vPosition.z >= maxZ) {
4219
- gl_FragColor = vec4(uColor, uOpacity); //\uFF08\u9876\u9762\u989C\u8272\uFF09
4220
- } else {
4221
- gl_FragColor = vec4(uColor2, uOpacity); // \u5176\u4ED6\u9762\u989C\u8272\uFF09
4222
- }
4223
+ // \u5224\u65AD\u5F53\u524D\u9876\u70B9\u662F\u5426\u4E3A\u9876\u9762
4224
+ if (vPosition.z >= maxZ) {
4225
+ gl_FragColor = vec4(uColor, uOpacity); //\uFF08\u9876\u9762\u989C\u8272\uFF09
4226
+ } else {
4227
+ // \u8BA1\u7B97\u6E10\u53D8\u7684\u989C\u8272
4228
+ vec3 lineVec = uMax - uMin; // \u7EBF\u6BB5AB\u7684\u65B9\u5411\u5411\u91CF
4229
+ vec3 AP = vPosition - uMin; // \u5411\u91CFAP
4230
+ float t = dot(AP, lineVec) / dot(lineVec, lineVec); // \u53C2\u6570t
4231
+ // t = clamp(t, 0.0, 1.0); // \u9650\u5236t\u5728[0, 1]\u8303\u56F4\u5185\uFF0C\u786E\u4FDD\u6700\u77ED\u8DDD\u79BB\u5728\u7EBF\u6BB5AB\u4E0A
4232
+ vec3 vColor = mix(uGradualColor1, uGradualColor2, 1.0 - t);
4233
+ gl_FragColor = vec4(vColor, uOpacity); // \u5176\u4ED6\u9762\u989C\u8272\uFF09
4234
+ }
4223
4235
  }
4224
4236
  `;
4225
4237
  let maxZ = -Infinity;
@@ -4238,13 +4250,18 @@ var Wall = class extends Object3D9 {
4238
4250
  // 初始化maxZ的值
4239
4251
  uColor: { value: new Color3(this.options[0].fillColor) },
4240
4252
  // 顶面颜色
4241
- uColor2: { value: new Color3(darkenColor(this.options[0].fillColor)) },
4242
- // 侧面颜色
4243
- uOpacity: { value: this.options[0].fillOpacity }
4253
+ uGradualColor1: { value: new Color3(darkenColor(this.options[0].fillColor, 0.95)) },
4254
+ // 渐变颜色1
4255
+ uGradualColor2: { value: new Color3(darkenColor(this.options[0].fillColor, 0.7)) },
4256
+ // 渐变颜色2
4257
+ uOpacity: { value: this.options[0].fillOpacity },
4244
4258
  // 透明度
4259
+ uMax: { value: this.maxWorldPoint },
4260
+ uMin: { value: this.minWorldPoint }
4245
4261
  },
4246
4262
  vertexShader,
4247
- fragmentShader
4263
+ fragmentShader,
4264
+ transparent: true
4248
4265
  });
4249
4266
  this.material = shaderMaterial;
4250
4267
  }
@@ -4297,6 +4314,14 @@ var Wall = class extends Object3D9 {
4297
4314
  this.createBorder();
4298
4315
  }
4299
4316
  }
4317
+ changeWorldPoint(max, min) {
4318
+ this.maxWorldPoint = max;
4319
+ this.minWorldPoint = min;
4320
+ if (this.material) {
4321
+ this.material.uniforms.uMax.value = max;
4322
+ this.material.uniforms.uMin.value = min;
4323
+ }
4324
+ }
4300
4325
  dispose() {
4301
4326
  this.geometry?.dispose();
4302
4327
  this.material?.dispose();
@@ -4380,7 +4405,7 @@ var GroundTexture = class extends Object3D10 {
4380
4405
  };
4381
4406
 
4382
4407
  // src/elements/glb-model.ts
4383
- import { Box3 as Box37, Object3D as Object3D11, Vector3 as Vector312 } from "three";
4408
+ import { Box3 as Box37, Mesh as Mesh6, Object3D as Object3D11, Vector3 as Vector312 } from "three";
4384
4409
  var defaultGlbOptions = {
4385
4410
  url: "",
4386
4411
  geometry: { type: "polygon", cds: [], coords: [], curveCpt: [], curveIndex: [] },
@@ -4409,12 +4434,26 @@ var GlbModel = class extends Object3D11 {
4409
4434
  const max = Math.max(size.x, size.y);
4410
4435
  const scale = this.options.width / max;
4411
4436
  this.scale.set(scale, scale, scale);
4437
+ this.meshSetMaterial(object.scene);
4412
4438
  this.add(object.scene);
4413
4439
  this.position.set(this.options.center_x, this.options.center_y, 0);
4414
4440
  this.position.z += this.options.airHeight + this.options.deltaHeight;
4415
4441
  this.model = object;
4416
4442
  this.rotateZ(this.options.rotate);
4417
4443
  }
4444
+ meshSetMaterial(object) {
4445
+ if (object instanceof Mesh6) {
4446
+ object.frustumCulled = false;
4447
+ object.castShadow = true;
4448
+ object.material.emissiveIntensity *= 0.95;
4449
+ object.material.emissive = object.material.color;
4450
+ object.material.emissiveMap = object.material.map;
4451
+ }
4452
+ const children = object.children;
4453
+ children.forEach((child) => {
4454
+ this.meshSetMaterial(child);
4455
+ });
4456
+ }
4418
4457
  dispose() {
4419
4458
  dispose(this);
4420
4459
  this.model = null;
@@ -4422,7 +4461,7 @@ var GlbModel = class extends Object3D11 {
4422
4461
  };
4423
4462
 
4424
4463
  // src/elements/lane.ts
4425
- import { BufferGeometry as BufferGeometry3, LineSegments as LineSegments3, Mesh as Mesh6, Object3D as Object3D12, ShapeGeometry as ShapeGeometry2, Vector3 as Vector313 } from "three";
4464
+ import { BufferGeometry as BufferGeometry3, LineSegments as LineSegments3, Mesh as Mesh7, Object3D as Object3D12, ShapeGeometry as ShapeGeometry2, Vector3 as Vector313 } from "three";
4426
4465
  import { mergeGeometries as mergeGeometries3 } from "three/examples/jsm/utils/BufferGeometryUtils";
4427
4466
  import { Line2 } from "three/examples/jsm/lines/Line2";
4428
4467
  import { LineGeometry } from "three/examples/jsm/lines/LineGeometry";
@@ -4542,7 +4581,7 @@ var Lane = class extends Object3D12 {
4542
4581
  init() {
4543
4582
  this.initGeometry();
4544
4583
  this.initMaterial();
4545
- const mesh = new Mesh6(this.geometry, this.material);
4584
+ const mesh = new Mesh7(this.geometry, this.material);
4546
4585
  this.add(mesh);
4547
4586
  if (this.options[0].strokeOpacity !== 0) {
4548
4587
  this.initLineMaterial();
@@ -4564,7 +4603,7 @@ var Lane = class extends Object3D12 {
4564
4603
  import {
4565
4604
  Object3D as Object3D13,
4566
4605
  ExtrudeGeometry as ExtrudeGeometry3,
4567
- Mesh as Mesh7,
4606
+ Mesh as Mesh8,
4568
4607
  Vector3 as Vector314,
4569
4608
  BufferGeometry as BufferGeometry4,
4570
4609
  LineSegments as LineSegments4,
@@ -4666,7 +4705,8 @@ var MergeGraphic = class extends Object3D13 {
4666
4705
  // 透明度
4667
4706
  },
4668
4707
  vertexShader,
4669
- fragmentShader
4708
+ fragmentShader,
4709
+ transparent: true
4670
4710
  });
4671
4711
  this.material = shaderMaterial;
4672
4712
  }
@@ -4682,7 +4722,7 @@ var MergeGraphic = class extends Object3D13 {
4682
4722
  if (this.mesh) {
4683
4723
  this.remove(this.mesh);
4684
4724
  }
4685
- this.mesh = new Mesh7(this.geometry, this.material);
4725
+ this.mesh = new Mesh8(this.geometry, this.material);
4686
4726
  this.add(this.mesh);
4687
4727
  }
4688
4728
  getBorderPoints() {
@@ -5434,9 +5474,9 @@ var MaterialFactory = class {
5434
5474
  float distance = length(vecAP);
5435
5475
  float maxLen = length(lineVec);
5436
5476
 
5437
- vec3 direction = normalize(uDirection);
5438
- float gradient = dot(normalize(normal), normalize(uDirection));
5439
- vec3 currentPosition = position - center;
5477
+ // vec3 direction = normalize(uDirection);
5478
+ // float gradient = dot(normalize(normal), normalize(uDirection));
5479
+ // vec3 currentPosition = position - center;
5440
5480
  // float colorFactor = (dot(direction, currentPosition) / maxValue) * 0.5 + 0.5;
5441
5481
  float colorFactor = distance / maxLen;
5442
5482
 
@@ -6963,7 +7003,7 @@ function Worker2() {
6963
7003
 
6964
7004
  // src/plugins/navigation/path.ts
6965
7005
  import {
6966
- Mesh as Mesh8,
7006
+ Mesh as Mesh9,
6967
7007
  Object3D as Object3D17,
6968
7008
  TextureLoader as TextureLoader3,
6969
7009
  Color as Color8,
@@ -7748,7 +7788,7 @@ var Path2 = class extends Object3D17 {
7748
7788
  blending: NormalBlending,
7749
7789
  repeat: new Vector211(this.getRepeat(), 1)
7750
7790
  });
7751
- const mesh = this.mesh = new Mesh8(lineGeometry, material);
7791
+ const mesh = this.mesh = new Mesh9(lineGeometry, material);
7752
7792
  mesh.renderOrder = 9;
7753
7793
  this.add(mesh);
7754
7794
  return mesh;