more hacking

This commit is contained in:
Brad Hefta-Gaub 2016-12-13 20:56:41 -08:00
parent a7750501c6
commit 7189f766a2
4 changed files with 17 additions and 6 deletions

View file

@ -281,9 +281,12 @@ void AvatarMixer::broadcastAvatarData() {
// Also check to see if the other node is in our view
glm::vec3 otherNodeBoxScale = (otherData->getPosition() - otherData->getGlobalBoundingBoxCorner()) * 2.0f;
AABox otherNodeBox(otherData->getGlobalBoundingBoxCorner(), otherNodeBoxScale);
if (!nodeData->otherAvatarInView(otherNodeBox)) {
qDebug() << "Avatar out of view!";
//qDebug() << "Avatar out of view!";
return false;
} else {
//qDebug() << "Avatar in view!";
}
return true;

View file

@ -60,10 +60,17 @@ void AvatarMixerClientData::ignoreOther(SharedNodePointer self, SharedNodePointe
void AvatarMixerClientData::readViewFrustumPacket(const QByteArray& message) {
_currentViewFrustumIsValid = true;
_currentViewFrustum.fromByteArray(message);
qDebug() << __FUNCTION__;
_currentViewFrustum.printDebugDetails();
}
bool AvatarMixerClientData::otherAvatarInView(const glm::vec3& otherAvatar) {
return !_currentViewFrustumIsValid || _currentViewFrustum.pointIntersectsFrustum(otherAvatar);
}
bool AvatarMixerClientData::otherAvatarInView(const AABox& otherAvatarBox) {
return !_currentViewFrustumIsValid || _currentViewFrustum.boxIntersectsKeyhole(otherAvatarBox);
}
void AvatarMixerClientData::loadJSONStats(QJsonObject& jsonObject) const {
jsonObject["display_name"] = _avatar->getDisplayName();
jsonObject["full_rate_distance"] = _fullRateDistance;

View file

@ -90,9 +90,8 @@ public:
void readViewFrustumPacket(const QByteArray& message);
bool otherAvatarInView(const AABox& otherAvatarBox) {
return !_currentViewFrustumIsValid || _currentViewFrustum.boxIntersectsKeyhole(otherAvatarBox);
}
bool otherAvatarInView(const AABox& otherAvatarBox);
bool otherAvatarInView(const glm::vec3& otherAvatar);
private:
AvatarSharedPointer _avatar { new AvatarData() };

View file

@ -173,6 +173,8 @@ void ViewFrustum::fromByteArray(const QByteArray& input) {
cameraAspectRatio,
cameraNearClip,
cameraFarClip));
calculate();
}
}