mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 13:00:50 +02:00
Only render display names in front of camera
This commit is contained in:
parent
5a67865d74
commit
2b17eafef4
1 changed files with 4 additions and 2 deletions
|
@ -784,8 +784,10 @@ Transform Avatar::calculateDisplayNameTransform(const ViewFrustum& frustum, floa
|
||||||
void Avatar::renderDisplayName(gpu::Batch& batch, const ViewFrustum& frustum, const glm::ivec4& viewport) const {
|
void Avatar::renderDisplayName(gpu::Batch& batch, const ViewFrustum& frustum, const glm::ivec4& viewport) const {
|
||||||
bool shouldShowReceiveStats = DependencyManager::get<AvatarManager>()->shouldShowReceiveStats() && !isMyAvatar();
|
bool shouldShowReceiveStats = DependencyManager::get<AvatarManager>()->shouldShowReceiveStats() && !isMyAvatar();
|
||||||
|
|
||||||
// If we have nothing to draw, or it's tottaly transparent, return
|
// If we have nothing to draw, or it's totally transparent, or it's too close or behind the camera, return
|
||||||
if ((_displayName.isEmpty() && !shouldShowReceiveStats) || _displayNameAlpha == 0.0f) {
|
const float CLIP_DISTANCE = 0.2f;
|
||||||
|
if ((_displayName.isEmpty() && !shouldShowReceiveStats) || _displayNameAlpha == 0.0f
|
||||||
|
|| (glm::dot(frustum.getDirection(), getDisplayNamePosition() - frustum.getPosition()) <= CLIP_DISTANCE)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto renderer = textRenderer(DISPLAYNAME);
|
auto renderer = textRenderer(DISPLAYNAME);
|
||||||
|
|
Loading…
Reference in a new issue