@@ -75,7 +75,7 @@
|
|
75
75
|
|
76
76
|
|
77
77
|
let level = results.mesh_lod;
|
78
|
-
const changed = results.mesh_lod != state.lastLodLevel_Mesh || results.texture_lod != state.
|
78
|
+
const changed = results.mesh_lod != state.lastLodLevel_Mesh || results.texture_lod != state.lastLodLevel_Texture;
|
79
79
|
|
80
80
|
if (debug && mesh.geometry.boundingSphere) {
|
81
81
|
const bounds = mesh.geometry.boundingSphere;
|
@@ -139,21 +139,23 @@
|
|
139
139
|
// helper?.setText(text);
|
140
140
|
// continue;
|
141
141
|
// }
|
142
|
-
|
143
|
-
|
144
|
-
|
142
|
+
if (state.lastScreenCoverage > .1) {
|
143
|
+
const cam = camera as any as IGameObject;
|
144
|
+
const camForward = cam.worldForward;
|
145
|
+
const camWorld = cam.worldPosition;
|
145
146
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
147
|
+
const fwd = getTempVector(camForward);
|
148
|
+
// for debugging very close LDOs, we need to flip the radius...
|
149
|
+
const pos = fwd.multiplyScalar(radius * .7).add(boundsCenter);
|
150
|
+
const distance = pos.distanceTo(camWorld);
|
151
|
+
// const vertexCount = mesh.geometry.index!.count / 3;
|
152
|
+
// const vertexCountFactor = Math.min(1, vertexCount / 1000);
|
153
|
+
const col = colors[Math.min(colors.length - 1, level)] + "88";
|
154
|
+
// const size = Math.min(10, radius);
|
155
|
+
const windowScale = this.context.domHeight > 0 ? screen.height / this.context.domHeight : 1;
|
156
|
+
const fieldOfViewScale = (camera as PerspectiveCamera).isPerspectiveCamera ? Math.tan((camera as PerspectiveCamera).fov * Math.PI / 180 / 2) : 1;
|
157
|
+
Gizmos.DrawLabel(pos, text, distance * .012 * windowScale * fieldOfViewScale, undefined, 0xffffff, col);
|
158
|
+
}
|
157
159
|
}
|
158
160
|
|
159
161
|
}
|
@@ -224,6 +224,7 @@
|
|
224
224
|
this.setOptions({ backgroundImage: tex, borderRadius: 0, backgroundOpacity: this.color.alpha, backgroundSize: "stretch" });
|
225
225
|
NEEDLE_progressive.assignTextureLOD(tex, 0).then(res => {
|
226
226
|
if (res instanceof Texture) {
|
227
|
+
if (tex) Graphic.textureCache.set(tex, res);
|
227
228
|
this.setOptions({ backgroundImage: res });
|
228
229
|
this.markDirty();
|
229
230
|
}
|
@@ -536,7 +536,11 @@
|
|
536
536
|
if (debugCameraFit)
|
537
537
|
console.log("OrbitControls hits", ...hits);
|
538
538
|
}
|
539
|
-
if (this.autoFit)
|
539
|
+
if (this.autoFit)
|
540
|
+
this.fitCamera(this.scene.children, {
|
541
|
+
centerCamera: "y",
|
542
|
+
immediate: true,
|
543
|
+
})
|
540
544
|
}
|
541
545
|
}
|
542
546
|
|
@@ -698,7 +702,8 @@
|
|
698
702
|
return;
|
699
703
|
}
|
700
704
|
|
701
|
-
|
705
|
+
const { immediate, centerCamera } = options;
|
706
|
+
let { fitOffset } = options;
|
702
707
|
|
703
708
|
if (fitOffset == undefined) {
|
704
709
|
fitOffset = 1.1;
|