mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 10:29:01 +02:00
added sanitization for invalid line points data. Fixed bug where occasionally wrong view frustum would be sent to script"
This commit is contained in:
parent
a12fd5c3d0
commit
5e15c14539
3 changed files with 21 additions and 4 deletions
|
@ -3093,8 +3093,11 @@ PickRay Application::computePickRay(float x, float y) const {
|
||||||
if (isHMDMode()) {
|
if (isHMDMode()) {
|
||||||
getApplicationOverlay().computeHmdPickRay(glm::vec2(x, y), result.origin, result.direction);
|
getApplicationOverlay().computeHmdPickRay(glm::vec2(x, y), result.origin, result.direction);
|
||||||
} else {
|
} else {
|
||||||
auto frustum = activeRenderingThread ? getDisplayViewFrustum() : getViewFrustum();
|
if (QThread::currentThread() == activeRenderingThread) {
|
||||||
frustum->computePickRay(x, y, result.origin, result.direction);
|
getDisplayViewFrustum()->computePickRay(x, y, result.origin, result.direction);
|
||||||
|
} else {
|
||||||
|
getViewFrustum()->computePickRay(x, y, result.origin, result.direction);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,10 @@ void RenderableLineEntityItem::render(RenderArgs* args) {
|
||||||
geometryCache->updateVertices(_lineVerticesID, getLinePoints(), lineColor);
|
geometryCache->updateVertices(_lineVerticesID, getLinePoints(), lineColor);
|
||||||
_pointsChanged = false;
|
_pointsChanged = false;
|
||||||
}
|
}
|
||||||
geometryCache->renderVertices(gpu::LINE_STRIP, _lineVerticesID);
|
if (getLinePoints().size() > 1) {
|
||||||
|
geometryCache->renderVertices(gpu::LINE_STRIP, _lineVerticesID);
|
||||||
|
}
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
RenderableDebugableEntityItem::render(this, args);
|
RenderableDebugableEntityItem::render(this, args);
|
||||||
|
|
|
@ -85,7 +85,18 @@ bool LineEntityItem::setProperties(const EntityItemProperties& properties) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LineEntityItem::setLinePoints(const QVector<glm::vec3>& points) {
|
void LineEntityItem::setLinePoints(const QVector<glm::vec3>& points) {
|
||||||
_points = points;
|
QVector<glm::vec3> sanitizedPoints;
|
||||||
|
for (int i = 0; i < points.size(); i++) {
|
||||||
|
glm::vec3 point = points.at(i);
|
||||||
|
// Make sure all of our points are valid numbers.
|
||||||
|
// Must be greater than 0 because vector component is set to 0 if it is invalid data
|
||||||
|
if (point.x > 0 && point.y > 0 && point.z > 0){
|
||||||
|
sanitizedPoints << point;
|
||||||
|
} else {
|
||||||
|
qDebug() << "INVALID POINT";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_points = sanitizedPoints;
|
||||||
_pointsChanged = true;
|
_pointsChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue