aligning
This commit is contained in:
@@ -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;
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user