mirror of
https://github.com/overte-org/overte.git
synced 2025-04-11 01:42:11 +02:00
fixed a case where _widths = 0 and widths-1 is not valid.
This commit is contained in:
parent
009bc19c5d
commit
4c6bea48b2
1 changed files with 9 additions and 3 deletions
|
@ -184,8 +184,11 @@ void PolyLineEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPo
|
|||
void PolyLineEntityRenderer::updateGeometry() {
|
||||
int maxNumVertices = std::min(_points.length(), _normals.length());
|
||||
|
||||
qDebug()<<"QQQ_ widths size: "<< _widths.size();
|
||||
qDebug()<<"QQQ_ MaxNumbVertices: "<<maxNumVertices;
|
||||
|
||||
bool doesStrokeWidthVary = false;
|
||||
if (_widths.size() >= 0) {
|
||||
if (_widths.size() > 0) {
|
||||
for (int i = 1; i < maxNumVertices; i++) {
|
||||
float width = PolyLineEntityItem::DEFAULT_LINE_WIDTH;
|
||||
if (i < _widths.length()) {
|
||||
|
@ -206,12 +209,15 @@ void PolyLineEntityRenderer::updateGeometry() {
|
|||
|
||||
std::vector<PolylineVertex> vertices;
|
||||
vertices.reserve(maxNumVertices);
|
||||
|
||||
for (int i = 0; i < maxNumVertices; i++) {
|
||||
// Position
|
||||
glm::vec3 point = _points[i];
|
||||
|
||||
// uCoord
|
||||
float width = i < _widths.size() ? _widths[i] : PolyLineEntityItem::DEFAULT_LINE_WIDTH;
|
||||
float width=PolyLineEntityItem::DEFAULT_LINE_WIDTH;
|
||||
if(_widths.size()>0 && i < _widths.size())
|
||||
width = _widths[i];
|
||||
|
||||
if (i > 0) { // First uCoord is 0.0f
|
||||
if (!_isUVModeStretch) {
|
||||
accumulatedDistance += glm::distance(point, _points[i - 1]);
|
||||
|
|
Loading…
Reference in a new issue