mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 01:24:36 +02:00
added Sams suggestions to the logic
This commit is contained in:
parent
f5852139f7
commit
19d584f0af
1 changed files with 8 additions and 5 deletions
|
@ -185,15 +185,17 @@ void PolyLineEntityRenderer::updateGeometry() {
|
||||||
int maxNumVertices = std::min(_points.length(), _normals.length());
|
int maxNumVertices = std::min(_points.length(), _normals.length());
|
||||||
bool doesStrokeWidthVary = false;
|
bool doesStrokeWidthVary = false;
|
||||||
if (_widths.size() > 0) {
|
if (_widths.size() > 0) {
|
||||||
|
float prevWidth = _widths[0];
|
||||||
for (int i = 1; i < maxNumVertices; i++) {
|
for (int i = 1; i < maxNumVertices; i++) {
|
||||||
float width = PolyLineEntityItem::DEFAULT_LINE_WIDTH;
|
float width = i < _widths.length() ? _widths[i] : PolyLineEntityItem::DEFAULT_LINE_WIDTH;
|
||||||
if (i < _widths.length()) {
|
if (width != prevWidth) {
|
||||||
width = _widths[i];
|
|
||||||
}
|
|
||||||
if (width != _widths[i - 1]) {
|
|
||||||
doesStrokeWidthVary = true;
|
doesStrokeWidthVary = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (i > _widths.length() + 1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
prevWidth = width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,6 +211,7 @@ void PolyLineEntityRenderer::updateGeometry() {
|
||||||
for (int i = 0; i < maxNumVertices; i++) {
|
for (int i = 0; i < maxNumVertices; i++) {
|
||||||
// Position
|
// Position
|
||||||
glm::vec3 point = _points[i];
|
glm::vec3 point = _points[i];
|
||||||
|
// uCoord
|
||||||
float width = i < _widths.size() ? _widths[i] : PolyLineEntityItem::DEFAULT_LINE_WIDTH;
|
float width = i < _widths.size() ? _widths[i] : PolyLineEntityItem::DEFAULT_LINE_WIDTH;
|
||||||
|
|
||||||
if (i > 0) { // First uCoord is 0.0f
|
if (i > 0) { // First uCoord is 0.0f
|
||||||
|
|
Loading…
Reference in a new issue