This commit is contained in:
2025-10-19 19:19:00 +03:00
parent 953a7c22f7
commit 192a900a96
7 changed files with 113 additions and 137 deletions
+17 -17
View File
@@ -28,23 +28,23 @@ class TextObject {
txt.sync();
this.txt = txt;
this.mesh = txt;
if (obj.effect == 'distance') {
let dstm = .8;
var oldBR = txt.onBeforeRender;
txt.material[1].opacity = 0.01;
txt.onBeforeRender = function (renderer, scene, camera) {
oldBR && oldBR.apply(this, arguments);
var v = new Vector3();
txt.getWorldPosition(v);
var dst = camera.position.distanceTo(v);
if (dst < dstm * 2 && dst > dstm * 1) {
txt.material[1].opacity = dstm * 1 - (dst - dstm * 1);
}
if (dst < .5 * dstm) {
txt.material[1].opacity = dstm * dst * 2;
}
};
}
// if (obj.effect == 'distance') {
// let dstm = .8;
// var oldBR = txt.onBeforeRender;
// txt.material[1].opacity = 0.01;
// txt.onBeforeRender = function (renderer, scene, camera) {
// oldBR && oldBR.apply(this, arguments);
// var v = new Vector3();
// txt.getWorldPosition(v);
// var dst = camera.position.distanceTo(v);
// if (dst < dstm * 2 && dst > dstm * 1) {
// txt.material[1].opacity = dstm * 1 - (dst - dstm * 1);
// }
// if (dst < .5 * dstm) {
// txt.material[1].opacity = dstm * dst * 2;
// }
// };
// }
}
}