mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-07 12:12:39 +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()) {
|
||||
getApplicationOverlay().computeHmdPickRay(glm::vec2(x, y), result.origin, result.direction);
|
||||
} else {
|
||||
auto frustum = activeRenderingThread ? getDisplayViewFrustum() : getViewFrustum();
|
||||
frustum->computePickRay(x, y, result.origin, result.direction);
|
||||
if (QThread::currentThread() == activeRenderingThread) {
|
||||
getDisplayViewFrustum()->computePickRay(x, y, result.origin, result.direction);
|
||||
} else {
|
||||
getViewFrustum()->computePickRay(x, y, result.origin, result.direction);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,10 @@ void RenderableLineEntityItem::render(RenderArgs* args) {
|
|||
geometryCache->updateVertices(_lineVerticesID, getLinePoints(), lineColor);
|
||||
_pointsChanged = false;
|
||||
}
|
||||
geometryCache->renderVertices(gpu::LINE_STRIP, _lineVerticesID);
|
||||
if (getLinePoints().size() > 1) {
|
||||
geometryCache->renderVertices(gpu::LINE_STRIP, _lineVerticesID);
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
RenderableDebugableEntityItem::render(this, args);
|
||||
|
|
|
@ -85,7 +85,18 @@ bool LineEntityItem::setProperties(const EntityItemProperties& properties) {
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue