mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 18:26:26 +02:00
Rename 2D -> HUD, 3D -> World in Overlays
This commit is contained in:
parent
468c564566
commit
2b835e621c
8 changed files with 86 additions and 88 deletions
|
@ -461,7 +461,7 @@ CameraTool = function(cameraManager) {
|
||||||
color: { red: 255, green: 0, blue: 0 },
|
color: { red: 255, green: 0, blue: 0 },
|
||||||
solid: true,
|
solid: true,
|
||||||
visible: true,
|
visible: true,
|
||||||
drawOnApplicationOverlay: true,
|
drawOnHUD: true,
|
||||||
};
|
};
|
||||||
var defaultLineProps = {
|
var defaultLineProps = {
|
||||||
lineWidth: 1.5,
|
lineWidth: 1.5,
|
||||||
|
@ -471,7 +471,7 @@ CameraTool = function(cameraManager) {
|
||||||
end: { x: 0, y: 0, z: 0 },
|
end: { x: 0, y: 0, z: 0 },
|
||||||
color: { red: 255, green: 0, blue: 0 },
|
color: { red: 255, green: 0, blue: 0 },
|
||||||
visible: true,
|
visible: true,
|
||||||
drawOnApplicationOverlay: true,
|
drawOnHUD: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
var orientationOverlay = OverlayGroup({
|
var orientationOverlay = OverlayGroup({
|
||||||
|
|
|
@ -2896,12 +2896,12 @@ void Application::updateShadowMap() {
|
||||||
// render JS/scriptable overlays
|
// render JS/scriptable overlays
|
||||||
{
|
{
|
||||||
PerformanceTimer perfTimer("3dOverlays");
|
PerformanceTimer perfTimer("3dOverlays");
|
||||||
_overlays.render3D(false, RenderArgs::SHADOW_RENDER_MODE);
|
_overlays.renderWorld(false, RenderArgs::SHADOW_RENDER_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
PerformanceTimer perfTimer("3dOverlaysFront");
|
PerformanceTimer perfTimer("3dOverlaysFront");
|
||||||
_overlays.render3D(true, RenderArgs::SHADOW_RENDER_MODE);
|
_overlays.renderWorld(true, RenderArgs::SHADOW_RENDER_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
glDisable(GL_POLYGON_OFFSET_FILL);
|
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||||
|
@ -3129,7 +3129,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly, RenderAr
|
||||||
// render JS/scriptable overlays
|
// render JS/scriptable overlays
|
||||||
{
|
{
|
||||||
PerformanceTimer perfTimer("3dOverlays");
|
PerformanceTimer perfTimer("3dOverlays");
|
||||||
_overlays.render3D(false);
|
_overlays.renderWorld(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// render the ambient occlusion effect if enabled
|
// render the ambient occlusion effect if enabled
|
||||||
|
@ -3218,7 +3218,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly, RenderAr
|
||||||
{
|
{
|
||||||
PerformanceTimer perfTimer("3dOverlaysFront");
|
PerformanceTimer perfTimer("3dOverlaysFront");
|
||||||
glClear(GL_DEPTH_BUFFER_BIT);
|
glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
_overlays.render3D(true);
|
_overlays.renderWorld(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,7 @@ void ApplicationOverlay::renderOverlay(bool renderToTexture) {
|
||||||
// give external parties a change to hook in
|
// give external parties a change to hook in
|
||||||
emit application->renderingOverlay();
|
emit application->renderingOverlay();
|
||||||
|
|
||||||
overlays.render2D();
|
overlays.renderHUD();
|
||||||
|
|
||||||
renderPointers();
|
renderPointers();
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ Base3DOverlay::Base3DOverlay() :
|
||||||
_isDashedLine(DEFAULT_IS_DASHED_LINE),
|
_isDashedLine(DEFAULT_IS_DASHED_LINE),
|
||||||
_ignoreRayIntersection(false),
|
_ignoreRayIntersection(false),
|
||||||
_drawInFront(false),
|
_drawInFront(false),
|
||||||
_drawOnApplicationOverlay(false)
|
_drawOnHUD(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,11 +57,11 @@ void Base3DOverlay::setProperties(const QScriptValue& properties) {
|
||||||
setDrawInFront(value);
|
setDrawInFront(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
QScriptValue drawOnApplicationOverlay = properties.property("drawOnApplicationOverlay");
|
QScriptValue drawOnHUD = properties.property("drawOnHUD");
|
||||||
|
|
||||||
if (drawOnApplicationOverlay.isValid()) {
|
if (drawOnHUD.isValid()) {
|
||||||
bool value = drawOnApplicationOverlay.toVariant().toBool();
|
bool value = drawOnHUD.toVariant().toBool();
|
||||||
setDrawOnApplicationOverlay(value);
|
setDrawOnHUD(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
QScriptValue position = properties.property("position");
|
QScriptValue position = properties.property("position");
|
||||||
|
@ -167,8 +167,8 @@ QScriptValue Base3DOverlay::getProperty(const QString& property) {
|
||||||
if (property == "drawInFront") {
|
if (property == "drawInFront") {
|
||||||
return _drawInFront;
|
return _drawInFront;
|
||||||
}
|
}
|
||||||
if (property == "drawOnApplicationOverlay") {
|
if (property == "drawOnHUD") {
|
||||||
return _drawOnApplicationOverlay;
|
return _drawOnHUD;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Overlay::getProperty(property);
|
return Overlay::getProperty(property);
|
||||||
|
|
|
@ -37,7 +37,7 @@ public:
|
||||||
const glm::quat& getRotation() const { return _rotation; }
|
const glm::quat& getRotation() const { return _rotation; }
|
||||||
bool getIgnoreRayIntersection() const { return _ignoreRayIntersection; }
|
bool getIgnoreRayIntersection() const { return _ignoreRayIntersection; }
|
||||||
bool getDrawInFront() const { return _drawInFront; }
|
bool getDrawInFront() const { return _drawInFront; }
|
||||||
bool getDrawOnApplicationOverlay() const { return _drawOnApplicationOverlay; }
|
bool getDrawOnHUD() const { return _drawOnHUD; }
|
||||||
|
|
||||||
// setters
|
// setters
|
||||||
void setPosition(const glm::vec3& position) { _position = position; }
|
void setPosition(const glm::vec3& position) { _position = position; }
|
||||||
|
@ -47,7 +47,7 @@ public:
|
||||||
void setRotation(const glm::quat& value) { _rotation = value; }
|
void setRotation(const glm::quat& value) { _rotation = value; }
|
||||||
void setIgnoreRayIntersection(bool value) { _ignoreRayIntersection = value; }
|
void setIgnoreRayIntersection(bool value) { _ignoreRayIntersection = value; }
|
||||||
void setDrawInFront(bool value) { _drawInFront = value; }
|
void setDrawInFront(bool value) { _drawInFront = value; }
|
||||||
void setDrawOnApplicationOverlay(bool value) { _drawOnApplicationOverlay = value; }
|
void setDrawOnHUD(bool value) { _drawOnHUD = value; }
|
||||||
|
|
||||||
virtual void setProperties(const QScriptValue& properties);
|
virtual void setProperties(const QScriptValue& properties);
|
||||||
virtual QScriptValue getProperty(const QString& property);
|
virtual QScriptValue getProperty(const QString& property);
|
||||||
|
@ -69,7 +69,7 @@ protected:
|
||||||
bool _isDashedLine;
|
bool _isDashedLine;
|
||||||
bool _ignoreRayIntersection;
|
bool _ignoreRayIntersection;
|
||||||
bool _drawInFront;
|
bool _drawInFront;
|
||||||
bool _drawOnApplicationOverlay;
|
bool _drawOnHUD;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_Base3DOverlay_h
|
#endif // hifi_Base3DOverlay_h
|
||||||
|
|
|
@ -77,7 +77,7 @@ void Cube3DOverlay::render(RenderArgs* args) {
|
||||||
glColor4f(1.0f, 1.0f, 1.0f, alpha);
|
glColor4f(1.0f, 1.0f, 1.0f, alpha);
|
||||||
glScalef(dimensions.x * _borderSize, dimensions.y * _borderSize, dimensions.z * _borderSize);
|
glScalef(dimensions.x * _borderSize, dimensions.y * _borderSize, dimensions.z * _borderSize);
|
||||||
|
|
||||||
if (_drawOnApplicationOverlay) {
|
if (_drawOnHUD) {
|
||||||
DependencyManager::get<GeometryCache>()->renderSolidCube(1.0f);
|
DependencyManager::get<GeometryCache>()->renderSolidCube(1.0f);
|
||||||
} else {
|
} else {
|
||||||
DependencyManager::get<DeferredLightingEffect>()->renderSolidCube(1.0f);
|
DependencyManager::get<DeferredLightingEffect>()->renderSolidCube(1.0f);
|
||||||
|
@ -90,7 +90,7 @@ void Cube3DOverlay::render(RenderArgs* args) {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glColor4f(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha);
|
glColor4f(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha);
|
||||||
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
glScalef(dimensions.x, dimensions.y, dimensions.z);
|
||||||
if (_drawOnApplicationOverlay) {
|
if (_drawOnHUD) {
|
||||||
DependencyManager::get<GeometryCache>()->renderSolidCube(1.0f);
|
DependencyManager::get<GeometryCache>()->renderSolidCube(1.0f);
|
||||||
} else {
|
} else {
|
||||||
DependencyManager::get<DeferredLightingEffect>()->renderSolidCube(1.0f);
|
DependencyManager::get<DeferredLightingEffect>()->renderSolidCube(1.0f);
|
||||||
|
|
|
@ -37,14 +37,14 @@ Overlays::~Overlays() {
|
||||||
|
|
||||||
{
|
{
|
||||||
QWriteLocker lock(&_lock);
|
QWriteLocker lock(&_lock);
|
||||||
foreach(Overlay* thisOverlay, _overlays2D) {
|
foreach(Overlay* thisOverlay, _overlaysHUD) {
|
||||||
delete thisOverlay;
|
delete thisOverlay;
|
||||||
}
|
}
|
||||||
_overlays2D.clear();
|
_overlaysHUD.clear();
|
||||||
foreach(Overlay* thisOverlay, _overlays3D) {
|
foreach(Overlay* thisOverlay, _overlaysWorld) {
|
||||||
delete thisOverlay;
|
delete thisOverlay;
|
||||||
}
|
}
|
||||||
_overlays3D.clear();
|
_overlaysWorld.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_overlaysToDelete.isEmpty()) {
|
if (!_overlaysToDelete.isEmpty()) {
|
||||||
|
@ -65,10 +65,10 @@ void Overlays::update(float deltatime) {
|
||||||
|
|
||||||
{
|
{
|
||||||
QWriteLocker lock(&_lock);
|
QWriteLocker lock(&_lock);
|
||||||
foreach(Overlay* thisOverlay, _overlays2D) {
|
foreach(Overlay* thisOverlay, _overlaysHUD) {
|
||||||
thisOverlay->update(deltatime);
|
thisOverlay->update(deltatime);
|
||||||
}
|
}
|
||||||
foreach(Overlay* thisOverlay, _overlays3D) {
|
foreach(Overlay* thisOverlay, _overlaysWorld) {
|
||||||
thisOverlay->update(deltatime);
|
thisOverlay->update(deltatime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,32 +82,32 @@ void Overlays::update(float deltatime) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Overlays::render2D() {
|
void Overlays::renderHUD() {
|
||||||
QReadLocker lock(&_lock);
|
QReadLocker lock(&_lock);
|
||||||
|
|
||||||
RenderArgs args = { NULL, Application::getInstance()->getViewFrustum(),
|
RenderArgs args = { NULL, Application::getInstance()->getViewFrustum(),
|
||||||
Menu::getInstance()->getVoxelSizeScale(), Menu::getInstance()->getBoundaryLevelAdjust(),
|
Menu::getInstance()->getVoxelSizeScale(), Menu::getInstance()->getBoundaryLevelAdjust(),
|
||||||
RenderArgs::DEFAULT_RENDER_MODE, RenderArgs::MONO, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
RenderArgs::DEFAULT_RENDER_MODE, RenderArgs::MONO, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
|
|
||||||
foreach(Overlay* thisOverlay, _overlays2D) {
|
foreach(Overlay* thisOverlay, _overlaysHUD) {
|
||||||
thisOverlay->render(&args);
|
if (thisOverlay->is3D()) {
|
||||||
}
|
qDebug() << "Rendering 3d HUD!";
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
glEnable(GL_LIGHTING);
|
||||||
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
thisOverlay->render(&args);
|
||||||
glEnable(GL_LIGHTING);
|
|
||||||
foreach(Overlay* thisOverlay, _overlays3D) {
|
glDisable(GL_LIGHTING);
|
||||||
Base3DOverlay* overlay3D = static_cast<Base3DOverlay*>(thisOverlay);
|
glDisable(GL_DEPTH_TEST);
|
||||||
if (overlay3D->getDrawOnApplicationOverlay()) {
|
} else{
|
||||||
thisOverlay->render(&args);
|
thisOverlay->render(&args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glDisable(GL_LIGHTING);
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Overlays::render3D(bool drawFront, RenderArgs::RenderMode renderMode, RenderArgs::RenderSide renderSide) {
|
void Overlays::renderWorld(bool drawFront, RenderArgs::RenderMode renderMode, RenderArgs::RenderSide renderSide) {
|
||||||
QReadLocker lock(&_lock);
|
QReadLocker lock(&_lock);
|
||||||
if (_overlays3D.size() == 0) {
|
if (_overlaysWorld.size() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool myAvatarComputed = false;
|
bool myAvatarComputed = false;
|
||||||
|
@ -123,9 +123,9 @@ void Overlays::render3D(bool drawFront, RenderArgs::RenderMode renderMode, Rende
|
||||||
renderMode, renderSide, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
renderMode, renderSide, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
|
|
||||||
|
|
||||||
foreach(Overlay* thisOverlay, _overlays3D) {
|
foreach(Overlay* thisOverlay, _overlaysWorld) {
|
||||||
Base3DOverlay* overlay3D = static_cast<Base3DOverlay*>(thisOverlay);
|
Base3DOverlay* overlay3D = static_cast<Base3DOverlay*>(thisOverlay);
|
||||||
if (overlay3D->getDrawInFront() != drawFront || overlay3D->getDrawOnApplicationOverlay()) {
|
if (overlay3D->getDrawInFront() != drawFront) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
@ -204,9 +204,14 @@ unsigned int Overlays::addOverlay(Overlay* overlay) {
|
||||||
unsigned int thisID = _nextOverlayID;
|
unsigned int thisID = _nextOverlayID;
|
||||||
_nextOverlayID++;
|
_nextOverlayID++;
|
||||||
if (overlay->is3D()) {
|
if (overlay->is3D()) {
|
||||||
_overlays3D[thisID] = overlay;
|
Base3DOverlay* overlay3D = static_cast<Base3DOverlay*>(overlay);
|
||||||
|
if (overlay3D->getDrawOnHUD()) {
|
||||||
|
_overlaysHUD[thisID] = overlay;
|
||||||
|
} else {
|
||||||
|
_overlaysWorld[thisID] = overlay;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
_overlays2D[thisID] = overlay;
|
_overlaysHUD[thisID] = overlay;
|
||||||
}
|
}
|
||||||
|
|
||||||
return thisID;
|
return thisID;
|
||||||
|
@ -214,10 +219,10 @@ unsigned int Overlays::addOverlay(Overlay* overlay) {
|
||||||
|
|
||||||
unsigned int Overlays::cloneOverlay(unsigned int id) {
|
unsigned int Overlays::cloneOverlay(unsigned int id) {
|
||||||
Overlay* thisOverlay = NULL;
|
Overlay* thisOverlay = NULL;
|
||||||
if (_overlays2D.contains(id)) {
|
if (_overlaysHUD.contains(id)) {
|
||||||
thisOverlay = _overlays2D[id];
|
thisOverlay = _overlaysHUD[id];
|
||||||
} else if (_overlays3D.contains(id)) {
|
} else if (_overlaysWorld.contains(id)) {
|
||||||
thisOverlay = _overlays3D[id];
|
thisOverlay = _overlaysWorld[id];
|
||||||
}
|
}
|
||||||
return addOverlay(thisOverlay->createClone());
|
return addOverlay(thisOverlay->createClone());
|
||||||
}
|
}
|
||||||
|
@ -225,10 +230,10 @@ unsigned int Overlays::cloneOverlay(unsigned int id) {
|
||||||
bool Overlays::editOverlay(unsigned int id, const QScriptValue& properties) {
|
bool Overlays::editOverlay(unsigned int id, const QScriptValue& properties) {
|
||||||
Overlay* thisOverlay = NULL;
|
Overlay* thisOverlay = NULL;
|
||||||
QWriteLocker lock(&_lock);
|
QWriteLocker lock(&_lock);
|
||||||
if (_overlays2D.contains(id)) {
|
if (_overlaysHUD.contains(id)) {
|
||||||
thisOverlay = _overlays2D[id];
|
thisOverlay = _overlaysHUD[id];
|
||||||
} else if (_overlays3D.contains(id)) {
|
} else if (_overlaysWorld.contains(id)) {
|
||||||
thisOverlay = _overlays3D[id];
|
thisOverlay = _overlaysWorld[id];
|
||||||
}
|
}
|
||||||
if (thisOverlay) {
|
if (thisOverlay) {
|
||||||
thisOverlay->setProperties(properties);
|
thisOverlay->setProperties(properties);
|
||||||
|
@ -242,10 +247,10 @@ void Overlays::deleteOverlay(unsigned int id) {
|
||||||
|
|
||||||
{
|
{
|
||||||
QWriteLocker lock(&_lock);
|
QWriteLocker lock(&_lock);
|
||||||
if (_overlays2D.contains(id)) {
|
if (_overlaysHUD.contains(id)) {
|
||||||
overlayToDelete = _overlays2D.take(id);
|
overlayToDelete = _overlaysHUD.take(id);
|
||||||
} else if (_overlays3D.contains(id)) {
|
} else if (_overlaysWorld.contains(id)) {
|
||||||
overlayToDelete = _overlays3D.take(id);
|
overlayToDelete = _overlaysWorld.take(id);
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -262,7 +267,7 @@ unsigned int Overlays::getOverlayAtPoint(const glm::vec2& point) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QReadLocker lock(&_lock);
|
QReadLocker lock(&_lock);
|
||||||
QMapIterator<unsigned int, Overlay*> i(_overlays3D);
|
QMapIterator<unsigned int, Overlay*> i(_overlaysHUD);
|
||||||
i.toBack();
|
i.toBack();
|
||||||
|
|
||||||
const float LARGE_NEGATIVE_FLOAT = -9999999;
|
const float LARGE_NEGATIVE_FLOAT = -9999999;
|
||||||
|
@ -274,26 +279,22 @@ unsigned int Overlays::getOverlayAtPoint(const glm::vec2& point) {
|
||||||
while (i.hasPrevious()) {
|
while (i.hasPrevious()) {
|
||||||
i.previous();
|
i.previous();
|
||||||
unsigned int thisID = i.key();
|
unsigned int thisID = i.key();
|
||||||
Base3DOverlay* thisOverlay = static_cast<Base3DOverlay*>(i.value());
|
if (i.value()->is3D()) {
|
||||||
if (thisOverlay->getDrawOnApplicationOverlay() && !thisOverlay->getIgnoreRayIntersection()) {
|
Base3DOverlay* thisOverlay = static_cast<Base3DOverlay*>(i.value());
|
||||||
if (thisOverlay->findRayIntersection(origin, direction, distance, thisFace)) {
|
if (thisOverlay->getDrawOnHUD() && !thisOverlay->getIgnoreRayIntersection()) {
|
||||||
|
if (thisOverlay->findRayIntersection(origin, direction, distance, thisFace)) {
|
||||||
|
return thisID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Overlay2D* thisOverlay = static_cast<Overlay2D*>(i.value());
|
||||||
|
if (thisOverlay->getVisible() && thisOverlay->isLoaded() &&
|
||||||
|
thisOverlay->getBounds().contains(pointCopy.x, pointCopy.y, false)) {
|
||||||
return thisID;
|
return thisID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i = QMapIterator<unsigned int, Overlay*>(_overlays2D);
|
|
||||||
i.toBack();
|
|
||||||
while (i.hasPrevious()) {
|
|
||||||
i.previous();
|
|
||||||
unsigned int thisID = i.key();
|
|
||||||
Overlay2D* thisOverlay = static_cast<Overlay2D*>(i.value());
|
|
||||||
if (thisOverlay->getVisible() && thisOverlay->isLoaded() &&
|
|
||||||
thisOverlay->getBounds().contains(pointCopy.x, pointCopy.y, false)) {
|
|
||||||
return thisID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0; // not found
|
return 0; // not found
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,10 +302,10 @@ OverlayPropertyResult Overlays::getProperty(unsigned int id, const QString& prop
|
||||||
OverlayPropertyResult result;
|
OverlayPropertyResult result;
|
||||||
Overlay* thisOverlay = NULL;
|
Overlay* thisOverlay = NULL;
|
||||||
QReadLocker lock(&_lock);
|
QReadLocker lock(&_lock);
|
||||||
if (_overlays2D.contains(id)) {
|
if (_overlaysHUD.contains(id)) {
|
||||||
thisOverlay = _overlays2D[id];
|
thisOverlay = _overlaysHUD[id];
|
||||||
} else if (_overlays3D.contains(id)) {
|
} else if (_overlaysWorld.contains(id)) {
|
||||||
thisOverlay = _overlays3D[id];
|
thisOverlay = _overlaysWorld[id];
|
||||||
}
|
}
|
||||||
if (thisOverlay) {
|
if (thisOverlay) {
|
||||||
result.value = thisOverlay->getProperty(property);
|
result.value = thisOverlay->getProperty(property);
|
||||||
|
@ -346,15 +347,12 @@ RayToOverlayIntersectionResult Overlays::findRayIntersection(const PickRay& ray)
|
||||||
float bestDistance = std::numeric_limits<float>::max();
|
float bestDistance = std::numeric_limits<float>::max();
|
||||||
bool bestIsFront = false;
|
bool bestIsFront = false;
|
||||||
RayToOverlayIntersectionResult result;
|
RayToOverlayIntersectionResult result;
|
||||||
QMapIterator<unsigned int, Overlay*> i(_overlays3D);
|
QMapIterator<unsigned int, Overlay*> i(_overlaysWorld);
|
||||||
i.toBack();
|
i.toBack();
|
||||||
while (i.hasPrevious()) {
|
while (i.hasPrevious()) {
|
||||||
i.previous();
|
i.previous();
|
||||||
unsigned int thisID = i.key();
|
unsigned int thisID = i.key();
|
||||||
Base3DOverlay* thisOverlay = static_cast<Base3DOverlay*>(i.value());
|
Base3DOverlay* thisOverlay = static_cast<Base3DOverlay*>(i.value());
|
||||||
if (thisOverlay->getDrawOnApplicationOverlay()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (thisOverlay->getVisible() && !thisOverlay->getIgnoreRayIntersection() && thisOverlay->isLoaded()) {
|
if (thisOverlay->getVisible() && !thisOverlay->getIgnoreRayIntersection() && thisOverlay->isLoaded()) {
|
||||||
float thisDistance;
|
float thisDistance;
|
||||||
BoxFace thisFace;
|
BoxFace thisFace;
|
||||||
|
@ -457,10 +455,10 @@ void RayToOverlayIntersectionResultFromScriptValue(const QScriptValue& object, R
|
||||||
bool Overlays::isLoaded(unsigned int id) {
|
bool Overlays::isLoaded(unsigned int id) {
|
||||||
QReadLocker lock(&_lock);
|
QReadLocker lock(&_lock);
|
||||||
Overlay* thisOverlay = NULL;
|
Overlay* thisOverlay = NULL;
|
||||||
if (_overlays2D.contains(id)) {
|
if (_overlaysHUD.contains(id)) {
|
||||||
thisOverlay = _overlays2D[id];
|
thisOverlay = _overlaysHUD[id];
|
||||||
} else if (_overlays3D.contains(id)) {
|
} else if (_overlaysWorld.contains(id)) {
|
||||||
thisOverlay = _overlays3D[id];
|
thisOverlay = _overlaysWorld[id];
|
||||||
} else {
|
} else {
|
||||||
return false; // not found
|
return false; // not found
|
||||||
}
|
}
|
||||||
|
@ -468,13 +466,13 @@ bool Overlays::isLoaded(unsigned int id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QSizeF Overlays::textSize(unsigned int id, const QString& text) const {
|
QSizeF Overlays::textSize(unsigned int id, const QString& text) const {
|
||||||
Overlay* thisOverlay = _overlays2D[id];
|
Overlay* thisOverlay = _overlaysHUD[id];
|
||||||
if (thisOverlay) {
|
if (thisOverlay) {
|
||||||
if (typeid(*thisOverlay) == typeid(TextOverlay)) {
|
if (typeid(*thisOverlay) == typeid(TextOverlay)) {
|
||||||
return static_cast<TextOverlay*>(thisOverlay)->textSize(text);
|
return static_cast<TextOverlay*>(thisOverlay)->textSize(text);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
thisOverlay = _overlays3D[id];
|
thisOverlay = _overlaysWorld[id];
|
||||||
if (thisOverlay) {
|
if (thisOverlay) {
|
||||||
if (typeid(*thisOverlay) == typeid(Text3DOverlay)) {
|
if (typeid(*thisOverlay) == typeid(Text3DOverlay)) {
|
||||||
return static_cast<Text3DOverlay*>(thisOverlay)->textSize(text);
|
return static_cast<Text3DOverlay*>(thisOverlay)->textSize(text);
|
||||||
|
|
|
@ -52,9 +52,9 @@ public:
|
||||||
~Overlays();
|
~Overlays();
|
||||||
void init(QGLWidget* parent);
|
void init(QGLWidget* parent);
|
||||||
void update(float deltatime);
|
void update(float deltatime);
|
||||||
void render3D(bool drawFront, RenderArgs::RenderMode renderMode = RenderArgs::DEFAULT_RENDER_MODE,
|
void renderWorld(bool drawFront, RenderArgs::RenderMode renderMode = RenderArgs::DEFAULT_RENDER_MODE,
|
||||||
RenderArgs::RenderSide renderSide = RenderArgs::MONO);
|
RenderArgs::RenderSide renderSide = RenderArgs::MONO);
|
||||||
void render2D();
|
void renderHUD();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/// adds an overlay with the specific properties
|
/// adds an overlay with the specific properties
|
||||||
|
@ -90,8 +90,8 @@ public slots:
|
||||||
QSizeF textSize(unsigned int id, const QString& text) const;
|
QSizeF textSize(unsigned int id, const QString& text) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMap<unsigned int, Overlay*> _overlays2D;
|
QMap<unsigned int, Overlay*> _overlaysHUD;
|
||||||
QMap<unsigned int, Overlay*> _overlays3D;
|
QMap<unsigned int, Overlay*> _overlaysWorld;
|
||||||
QList<Overlay*> _overlaysToDelete;
|
QList<Overlay*> _overlaysToDelete;
|
||||||
unsigned int _nextOverlayID;
|
unsigned int _nextOverlayID;
|
||||||
QGLWidget* _parent;
|
QGLWidget* _parent;
|
||||||
|
|
Loading…
Reference in a new issue