mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 22:39:18 +02:00
Add isLoaded to Overlays
This commit is contained in:
parent
28d4efbad6
commit
0bad10b09c
3 changed files with 30 additions and 12 deletions
|
@ -255,10 +255,21 @@ function update(deltaTime){
|
||||||
}
|
}
|
||||||
frame++;
|
frame++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var locationChanged = false;
|
||||||
|
if (location.hostname != oldHost) {
|
||||||
|
print("Changed domain");
|
||||||
|
for (model in models) {
|
||||||
|
removeIndicators(models[model]);
|
||||||
|
}
|
||||||
|
oldHost = location.hostname;
|
||||||
|
locationChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (MyAvatar.position.x != avatarOldPosition.x &&
|
if (MyAvatar.position.x != avatarOldPosition.x ||
|
||||||
MyAvatar.position.y != avatarOldPosition.y &&
|
MyAvatar.position.y != avatarOldPosition.y ||
|
||||||
MyAvatar.position.z != avatarOldPosition.z) {
|
MyAvatar.position.z != avatarOldPosition.z ||
|
||||||
|
locationChanged) {
|
||||||
avatarOldPosition = MyAvatar.position;
|
avatarOldPosition = MyAvatar.position;
|
||||||
|
|
||||||
var SEARCH_RADIUS = 50;
|
var SEARCH_RADIUS = 50;
|
||||||
|
@ -285,14 +296,6 @@ function update(deltaTime){
|
||||||
showIndicators(true);
|
showIndicators(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (location.hostname != oldHost) {
|
|
||||||
print("Changed domain");
|
|
||||||
for (model in models) {
|
|
||||||
removeIndicators(models[model]);
|
|
||||||
}
|
|
||||||
oldHost = location.hostname;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
var oldHost = location.hostname;
|
var oldHost = location.hostname;
|
||||||
|
|
||||||
|
|
|
@ -227,11 +227,23 @@ unsigned int Overlays::getOverlayAtPoint(const glm::vec2& point) {
|
||||||
i.previous();
|
i.previous();
|
||||||
unsigned int thisID = i.key();
|
unsigned int thisID = i.key();
|
||||||
Overlay2D* thisOverlay = static_cast<Overlay2D*>(i.value());
|
Overlay2D* thisOverlay = static_cast<Overlay2D*>(i.value());
|
||||||
if (thisOverlay->getVisible() && thisOverlay->getBounds().contains(point.x, point.y, false)) {
|
if (thisOverlay->getVisible() && thisOverlay->isLoaded() && thisOverlay->getBounds().contains(point.x, point.y, false)) {
|
||||||
return thisID;
|
return thisID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0; // not found
|
return 0; // not found
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Overlays::isLoaded(unsigned int id) {
|
||||||
|
QReadLocker lock(&_lock);
|
||||||
|
Overlay* overlay = _overlays2D.value(id);
|
||||||
|
if (!overlay) {
|
||||||
|
_overlays3D.value(id);
|
||||||
|
}
|
||||||
|
if (!overlay) {
|
||||||
|
return false; // not found
|
||||||
|
}
|
||||||
|
|
||||||
|
return overlay->isLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,9 @@ public slots:
|
||||||
|
|
||||||
/// returns the top most overlay at the screen point, or 0 if not overlay at that point
|
/// returns the top most overlay at the screen point, or 0 if not overlay at that point
|
||||||
unsigned int getOverlayAtPoint(const glm::vec2& point);
|
unsigned int getOverlayAtPoint(const glm::vec2& point);
|
||||||
|
|
||||||
|
/// returns whether the overlay's assets are loaded or not
|
||||||
|
bool isLoaded(unsigned int id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMap<unsigned int, Overlay*> _overlays2D;
|
QMap<unsigned int, Overlay*> _overlays2D;
|
||||||
|
|
Loading…
Reference in a new issue