mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 23:09:52 +02:00
fix crash mode for empty LineEntityItem
This commit is contained in:
parent
6eb177091b
commit
e8e965d548
1 changed files with 7 additions and 6 deletions
|
@ -122,13 +122,19 @@ void RenderablePolyLineEntityItem::updateVertices() {
|
||||||
glm::vec3 v1, v2, tangent, binormal, point;
|
glm::vec3 v1, v2, tangent, binormal, point;
|
||||||
|
|
||||||
int finalIndex = minVectorSize - 1;
|
int finalIndex = minVectorSize - 1;
|
||||||
|
|
||||||
|
// Guard against an empty polyline
|
||||||
|
if (finalIndex < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < finalIndex; i++) {
|
for (int i = 0; i < finalIndex; i++) {
|
||||||
float width = _strokeWidths.at(i);
|
float width = _strokeWidths.at(i);
|
||||||
point = _points.at(i);
|
point = _points.at(i);
|
||||||
|
|
||||||
tangent = _points.at(i);
|
tangent = _points.at(i);
|
||||||
|
|
||||||
tangent = _points.at(i + 1) - point;
|
tangent = _points.at(i + 1) - point;
|
||||||
glm::vec3 normal = _normals.at(i);
|
glm::vec3 normal = _normals.at(i);
|
||||||
binormal = glm::normalize(glm::cross(tangent, normal)) * width;
|
binormal = glm::normalize(glm::cross(tangent, normal)) * width;
|
||||||
|
|
||||||
|
@ -141,11 +147,6 @@ void RenderablePolyLineEntityItem::updateVertices() {
|
||||||
_vertices << v1 << v2;
|
_vertices << v1 << v2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Guard against an empty polyline
|
|
||||||
if (finalIndex < 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// For last point we can assume binormals are the same since it represents the last two vertices of quad
|
// For last point we can assume binormals are the same since it represents the last two vertices of quad
|
||||||
point = _points.at(finalIndex);
|
point = _points.at(finalIndex);
|
||||||
v1 = point + binormal;
|
v1 = point + binormal;
|
||||||
|
|
Loading…
Reference in a new issue