Ejemplo n.º 1
0
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));
        }
    }
}
bool PolyLineEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const {
    return (
        entity->pointsChanged() ||
        entity->strokeWidthsChanged() ||
        entity->normalsChanged() ||
        entity->texturesChanged() ||
        entity->strokeColorsChanged()
    );
}
Ejemplo n.º 3
0
bool LineEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const {
    return entity->pointsChanged();
}