resolves #38
This commit is contained in:
+17
-13
@@ -40,7 +40,7 @@ class DashBoard {
|
|||||||
this.group = dash;
|
this.group = dash;
|
||||||
dash.add(hud);
|
dash.add(hud);
|
||||||
hud.add(hudTarget)
|
hud.add(hudTarget)
|
||||||
hudTarget.position.set(0,0,0.55);
|
hudTarget.position.set(0,0,0.52);
|
||||||
dash.visible = false;
|
dash.visible = false;
|
||||||
const k = 1.55;
|
const k = 1.55;
|
||||||
const dashWidth = engine.aspect * k, dashHeight = k;
|
const dashWidth = engine.aspect * k, dashHeight = k;
|
||||||
@@ -69,44 +69,47 @@ class DashBoard {
|
|||||||
dash.add(loadingPlane);
|
dash.add(loadingPlane);
|
||||||
|
|
||||||
(async()=>{
|
(async()=>{
|
||||||
|
let map = await engine.loadTexture('/static/textures/hud.png', '');
|
||||||
hudPlane = new Mesh(
|
hudPlane = new Mesh(
|
||||||
new PlaneGeometry(dashWidth, dashHeight),
|
new PlaneGeometry(dashWidth * 0.96, dashHeight * 0.9),
|
||||||
new MeshBasicMaterial({
|
new MeshBasicMaterial({
|
||||||
map: await engine.loadTexture('/static/textures/hud.png', ''),
|
map,
|
||||||
opacity: 0.37,
|
opacity: 0.37,
|
||||||
transparent:true
|
transparent:true
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
hudPlane.position.z = -0.07 * dashHeight;
|
hudPlane.position.z = -0.07 * dashHeight;
|
||||||
hudPlane.position.y = -0.05 * dashHeight
|
hudPlane.position.y = -0.011 * dashHeight
|
||||||
hud.add(hudPlane)
|
hud.add(hudPlane)
|
||||||
|
|
||||||
textPlane = new Mesh(
|
textPlane = new Mesh(
|
||||||
new PlaneGeometry(dashWidth, 0.17 * dashHeight),
|
new PlaneGeometry(dashWidth * 0.86, 0.15 * dashHeight),
|
||||||
new MeshBasicMaterial({
|
new MeshBasicMaterial({
|
||||||
map: await engine.loadTexture('/static/textures/hud.png', ''),
|
map,
|
||||||
opacity: 0.52,
|
opacity: 0.52,
|
||||||
transparent:true
|
transparent:true
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
textPlane.position.z = -0.002;
|
textPlane.position.z = -0.002;
|
||||||
textPlane.position.y = -0.41 * dashHeight
|
textPlane.position.y = -0.33 * dashHeight
|
||||||
textPlane.visible = false;
|
textPlane.visible = false;
|
||||||
dash.add(textPlane)
|
dash.add(textPlane)
|
||||||
// fix #44
|
// fix #44
|
||||||
textPlane.material.depthTest = false;
|
textPlane.material.depthTest = false;
|
||||||
|
//hudPlane.material.depthTest = false;
|
||||||
})()
|
})()
|
||||||
|
|
||||||
const text = new Text()
|
const text = new Text()
|
||||||
Object.assign(text, {
|
Object.assign(text, {
|
||||||
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',
|
textAlign: 'center', font: '/static/fonts/Montserrat-Regular.ttf',
|
||||||
anchorX: 'center', anchorY: 0.03 * dashHeight, depthOffset: 0.1, color: 0x000000,
|
anchorX: 'center', anchorY: 0.03 * dashHeight, depthOffset: 0.1, color: 0x000000,
|
||||||
clipRect: [-dashWidth * 0.4, -0.12 * dashHeight, dashWidth * 0.4, 0]
|
clipRect: [-dashWidth * 0.4, -0.12 * dashHeight, dashWidth * 0.4, 0]
|
||||||
})
|
})
|
||||||
text.sync();
|
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);
|
dash.add(text);
|
||||||
|
|
||||||
const pointsText = new Text()
|
const pointsText = new Text()
|
||||||
@@ -128,9 +131,10 @@ class DashBoard {
|
|||||||
textPlane.visible = !!t;
|
textPlane.visible = !!t;
|
||||||
engine.motionQueue.clear(text);
|
engine.motionQueue.clear(text);
|
||||||
text.text = t;
|
text.text = t;
|
||||||
text.anchorY = 0.03;
|
text.anchorY = 0.03 * dashHeight;
|
||||||
text.sync(()=>{
|
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){
|
if (dh > 0){
|
||||||
let updateFn = ()=>{
|
let updateFn = ()=>{
|
||||||
//text.sync();
|
//text.sync();
|
||||||
@@ -141,8 +145,8 @@ class DashBoard {
|
|||||||
}
|
}
|
||||||
engine.motionQueue.add({
|
engine.motionQueue.add({
|
||||||
o: text,
|
o: text,
|
||||||
a: { anchorY: text.textRenderInfo.blockBounds[1] + 0.03 },
|
a: { anchorY: - dMax },
|
||||||
t: dh*177 / dashHeight,
|
t: dMax*99 / dashHeight,
|
||||||
u: updateFn
|
u: updateFn
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
Reference in New Issue
Block a user