This commit is contained in:
2025-12-08 10:12:05 +02:00
parent 14c9aff342
commit 080fffdd7e
+17 -13
View File
@@ -40,7 +40,7 @@ class DashBoard {
this.group = dash;
dash.add(hud);
hud.add(hudTarget)
hudTarget.position.set(0,0,0.55);
hudTarget.position.set(0,0,0.52);
dash.visible = false;
const k = 1.55;
const dashWidth = engine.aspect * k, dashHeight = k;
@@ -69,44 +69,47 @@ class DashBoard {
dash.add(loadingPlane);
(async()=>{
let map = await engine.loadTexture('/static/textures/hud.png', '');
hudPlane = new Mesh(
new PlaneGeometry(dashWidth, dashHeight),
new PlaneGeometry(dashWidth * 0.96, dashHeight * 0.9),
new MeshBasicMaterial({
map: await engine.loadTexture('/static/textures/hud.png', ''),
map,
opacity: 0.37,
transparent:true
})
);
hudPlane.position.z = -0.07 * dashHeight;
hudPlane.position.y = -0.05 * dashHeight
hudPlane.position.y = -0.011 * dashHeight
hud.add(hudPlane)
textPlane = new Mesh(
new PlaneGeometry(dashWidth, 0.17 * dashHeight),
new PlaneGeometry(dashWidth * 0.86, 0.15 * dashHeight),
new MeshBasicMaterial({
map: await engine.loadTexture('/static/textures/hud.png', ''),
map,
opacity: 0.52,
transparent:true
})
);
textPlane.position.z = -0.002;
textPlane.position.y = -0.41 * dashHeight
textPlane.position.y = -0.33 * dashHeight
textPlane.visible = false;
dash.add(textPlane)
// fix #44
textPlane.material.depthTest = false;
//hudPlane.material.depthTest = false;
})()
const text = new Text()
Object.assign(text, {
text:``,
fontSize: 0.033 * dashHeight, lineHeight: 1.1 * dashHeight, maxWidth: dashWidth * 0.8,
fontSize: 0.033 * dashHeight, lineHeight: 1 * dashHeight, maxWidth: dashWidth * 0.8,
textAlign: 'center', font: '/static/fonts/Montserrat-Regular.ttf',
anchorX: 'center', anchorY: 0.03 * dashHeight, depthOffset: 0.1, color: 0x000000,
clipRect: [-dashWidth * 0.4, -0.12 * dashHeight, dashWidth * 0.4, 0]
})
text.sync();
text.position.set(0, -0.33 * dashHeight, 0.001);
text.position.set(0, -0.27 * dashHeight, 0.001);
text.material.depthTest = false;
dash.add(text);
const pointsText = new Text()
@@ -128,9 +131,10 @@ class DashBoard {
textPlane.visible = !!t;
engine.motionQueue.clear(text);
text.text = t;
text.anchorY = 0.03;
text.anchorY = 0.03 * dashHeight;
text.sync(()=>{
let dh = text.clipRect[1] - text.textRenderInfo.blockBounds[1];
let dMax = text.textRenderInfo.blockBounds[3] - text.textRenderInfo.blockBounds[1];
let dh = dMax + text.clipRect[1];
if (dh > 0){
let updateFn = ()=>{
//text.sync();
@@ -141,8 +145,8 @@ class DashBoard {
}
engine.motionQueue.add({
o: text,
a: { anchorY: text.textRenderInfo.blockBounds[1] + 0.03 },
t: dh*177 / dashHeight,
a: { anchorY: - dMax },
t: dMax*99 / dashHeight,
u: updateFn
})
}else{