mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-14 02:55:43 +02:00
Tie the avatar LOD distance multiplier to the LOD parameter calculated for
voxels.
This commit is contained in:
parent
f5eaa330d8
commit
64c4e58160
6 changed files with 13 additions and 14 deletions
|
@ -1612,6 +1612,13 @@ bool Application::isLookingAtMyAvatar(Avatar* avatar) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::updateLOD() {
|
||||||
|
// adjust it unless we were asked to disable this feature
|
||||||
|
if (!Menu::getInstance()->isOptionChecked(MenuOption::DisableAutoAdjustLOD)) {
|
||||||
|
Menu::getInstance()->autoAdjustLOD(_fps);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Application::updateMouseRay() {
|
void Application::updateMouseRay() {
|
||||||
|
|
||||||
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
|
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
|
||||||
|
@ -1852,6 +1859,8 @@ void Application::update(float deltaTime) {
|
||||||
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
|
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
|
||||||
PerformanceWarning warn(showWarnings, "Application::update()");
|
PerformanceWarning warn(showWarnings, "Application::update()");
|
||||||
|
|
||||||
|
updateLOD();
|
||||||
|
|
||||||
// check what's under the mouse and update the mouse voxel
|
// check what's under the mouse and update the mouse voxel
|
||||||
updateMouseRay();
|
updateMouseRay();
|
||||||
|
|
||||||
|
@ -2325,14 +2334,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) {
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) {
|
||||||
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
|
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
|
||||||
"Application::displaySide() ... voxels...");
|
"Application::displaySide() ... voxels...");
|
||||||
|
|
||||||
_voxels.render();
|
_voxels.render();
|
||||||
|
|
||||||
// double check that our LOD doesn't need to be auto-adjusted
|
|
||||||
// adjust it unless we were asked to disable this feature
|
|
||||||
if (!Menu::getInstance()->isOptionChecked(MenuOption::DisableAutoAdjustLOD)) {
|
|
||||||
Menu::getInstance()->autoAdjustLOD(_fps);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// also, metavoxels
|
// also, metavoxels
|
||||||
|
|
|
@ -284,6 +284,7 @@ private:
|
||||||
void update(float deltaTime);
|
void update(float deltaTime);
|
||||||
|
|
||||||
// Various helper functions called during update()
|
// Various helper functions called during update()
|
||||||
|
void updateLOD();
|
||||||
void updateMouseRay();
|
void updateMouseRay();
|
||||||
void updateFaceshift();
|
void updateFaceshift();
|
||||||
void updateVisage();
|
void updateVisage();
|
||||||
|
|
|
@ -84,6 +84,7 @@ public:
|
||||||
void autoAdjustLOD(float currentFPS);
|
void autoAdjustLOD(float currentFPS);
|
||||||
void setVoxelSizeScale(float sizeScale);
|
void setVoxelSizeScale(float sizeScale);
|
||||||
float getVoxelSizeScale() const { return _voxelSizeScale; }
|
float getVoxelSizeScale() const { return _voxelSizeScale; }
|
||||||
|
float getAvatarLODDistanceMultiplier() const { return DEFAULT_OCTREE_SIZE_SCALE / _voxelSizeScale; }
|
||||||
void setBoundaryLevelAdjust(int boundaryLevelAdjust);
|
void setBoundaryLevelAdjust(int boundaryLevelAdjust);
|
||||||
int getBoundaryLevelAdjust() const { return _boundaryLevelAdjust; }
|
int getBoundaryLevelAdjust() const { return _boundaryLevelAdjust; }
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ glm::quat Avatar::getWorldAlignedOrientation () const {
|
||||||
}
|
}
|
||||||
|
|
||||||
float Avatar::getLODDistance() const {
|
float Avatar::getLODDistance() const {
|
||||||
return Application::getInstance()->getAvatarManager().getLODDistanceMultiplier() *
|
return Menu::getInstance()->getAvatarLODDistanceMultiplier() *
|
||||||
glm::distance(Application::getInstance()->getCamera()->getPosition(), _position) / _scale;
|
glm::distance(Application::getInstance()->getCamera()->getPosition(), _position) / _scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,7 @@
|
||||||
const QUuid MY_AVATAR_KEY; // NULL key
|
const QUuid MY_AVATAR_KEY; // NULL key
|
||||||
|
|
||||||
AvatarManager::AvatarManager(QObject* parent) :
|
AvatarManager::AvatarManager(QObject* parent) :
|
||||||
_avatarFades(),
|
_avatarFades() {
|
||||||
_lodDistanceMultiplier(1.0f) {
|
|
||||||
// register a meta type for the weak pointer we'll use for the owning avatar mixer for each avatar
|
// register a meta type for the weak pointer we'll use for the owning avatar mixer for each avatar
|
||||||
qRegisterMetaType<QWeakPointer<Node> >("NodeWeakPointer");
|
qRegisterMetaType<QWeakPointer<Node> >("NodeWeakPointer");
|
||||||
_myAvatar = QSharedPointer<MyAvatar>(new MyAvatar());
|
_myAvatar = QSharedPointer<MyAvatar>(new MyAvatar());
|
||||||
|
|
|
@ -33,8 +33,6 @@ public:
|
||||||
|
|
||||||
void clearOtherAvatars();
|
void clearOtherAvatars();
|
||||||
|
|
||||||
float getLODDistanceMultiplier() const { return _lodDistanceMultiplier; }
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void processAvatarMixerDatagram(const QByteArray& datagram, const QWeakPointer<Node>& mixerWeakPointer);
|
void processAvatarMixerDatagram(const QByteArray& datagram, const QWeakPointer<Node>& mixerWeakPointer);
|
||||||
|
|
||||||
|
@ -54,8 +52,6 @@ private:
|
||||||
|
|
||||||
QVector<AvatarSharedPointer> _avatarFades;
|
QVector<AvatarSharedPointer> _avatarFades;
|
||||||
QSharedPointer<MyAvatar> _myAvatar;
|
QSharedPointer<MyAvatar> _myAvatar;
|
||||||
|
|
||||||
float _lodDistanceMultiplier;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__hifi__AvatarManager__) */
|
#endif /* defined(__hifi__AvatarManager__) */
|
||||||
|
|
Loading…
Reference in a new issue