void PolyLineEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) { auto pointsChanged = entity->pointsChanged(); auto strokeWidthsChanged = entity->strokeWidthsChanged(); auto normalsChanged = entity->normalsChanged(); auto strokeColorsChanged = entity->strokeColorsChanged(); bool isUVModeStretch = entity->getIsUVModeStretch(); entity->resetPolyLineChanged(); _polylineTransform = Transform(); _polylineTransform.setTranslation(entity->getWorldPosition()); _polylineTransform.setRotation(entity->getWorldOrientation()); if (pointsChanged) { _lastPoints = entity->getLinePoints(); } if (strokeWidthsChanged) { _lastStrokeWidths = entity->getStrokeWidths(); } if (normalsChanged) { _lastNormals = entity->getNormals(); } if (strokeColorsChanged) { _lastStrokeColors = entity->getStrokeColors(); _lastStrokeColors = _lastNormals.size() == _lastStrokeColors.size() ? _lastStrokeColors : QVector<glm::vec3>({ toGlm(entity->getColor()) }); } if (pointsChanged || strokeWidthsChanged || normalsChanged || strokeColorsChanged) { _empty = std::min(_lastPoints.size(), std::min(_lastNormals.size(), _lastStrokeWidths.size())) < 2; if (!_empty) { updateGeometry(updateVertices(_lastPoints, _lastNormals, _lastStrokeWidths, _lastStrokeColors, isUVModeStretch, _textureAspectRatio)); } } }
void LineEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) { entity->resetPointsChanged(); _linePoints = entity->getLinePoints(); auto geometryCache = DependencyManager::get<GeometryCache>(); if (_lineVerticesID == GeometryCache::UNKNOWN_ID) { _lineVerticesID = geometryCache->allocateID(); } glm::vec4 lineColor(toGlm(entity->getColor()), entity->getLocalRenderAlpha()); geometryCache->updateVertices(_lineVerticesID, _linePoints, lineColor); }