diff options
author | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2017-09-02 10:26:56 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2017-09-02 10:26:56 +0200 |
commit | b8f309338ceb7c24834bb1a41084fa8f85d6659b (patch) | |
tree | 6a43f6dc73a8ecd3dabc6fefaf5a65742b553d17 /src/render | |
parent | 4cb940c170a5df68893e333b70212a6073ee6294 (diff) | |
parent | 409a879f3617a7db7f3abfb3408f2530c139b24b (diff) |
Merge dev into 5.10
Change-Id: I1bef655947a7176f7931c7f1b8ed4c4176395451
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/backend/openglvertexarrayobject.cpp | 6 | ||||
-rw-r--r-- | src/render/frontend/qcamera_p.h | 2 | ||||
-rw-r--r-- | src/render/geometry/qgeometry.cpp | 18 | ||||
-rw-r--r-- | src/render/graphicshelpers/graphicscontext.cpp | 9 | ||||
-rw-r--r-- | src/render/lights/qabstractlight.cpp | 25 | ||||
-rw-r--r-- | src/render/lights/qspotlight.cpp | 6 | ||||
-rw-r--r-- | src/render/materialsystem/qshaderprogram.cpp | 8 | ||||
-rw-r--r-- | src/render/picking/pickeventfilter.cpp | 11 | ||||
-rw-r--r-- | src/render/picking/qpicktriangleevent.cpp | 7 | ||||
-rw-r--r-- | src/render/texture/gltexture.cpp | 4 |
10 files changed, 77 insertions, 19 deletions
diff --git a/src/render/backend/openglvertexarrayobject.cpp b/src/render/backend/openglvertexarrayobject.cpp index eefc208d5..c0fdd8e65 100644 --- a/src/render/backend/openglvertexarrayobject.cpp +++ b/src/render/backend/openglvertexarrayobject.cpp @@ -101,8 +101,10 @@ void OpenGLVertexArrayObject::create(GraphicsContext *ctx, const VAOIdentifier & m_ctx = ctx; m_supportsVao = m_ctx->supportsVAO(); - m_vao.reset(m_supportsVao ? new QOpenGLVertexArrayObject() : nullptr); - m_vao->create(); + if (m_supportsVao) { + m_vao.reset(new QOpenGLVertexArrayObject()); + m_vao->create(); + } m_owners = key; } diff --git a/src/render/frontend/qcamera_p.h b/src/render/frontend/qcamera_p.h index a310fc765..2ef53818c 100644 --- a/src/render/frontend/qcamera_p.h +++ b/src/render/frontend/qcamera_p.h @@ -69,8 +69,6 @@ public: void updateViewMatrix() { - if (m_upVector.isNull() || QVector3D::crossProduct(m_cameraToCenter, m_upVector).normalized().isNull()) - qWarning() << "Camera up vector must not be colinear with the view vector"; QMatrix4x4 m; m.lookAt(m_position, m_viewCenter, m_upVector); m_transform->setMatrix(m); diff --git a/src/render/geometry/qgeometry.cpp b/src/render/geometry/qgeometry.cpp index 3d281866d..cf5ae70ef 100644 --- a/src/render/geometry/qgeometry.cpp +++ b/src/render/geometry/qgeometry.cpp @@ -128,6 +128,17 @@ QGeometry::QGeometry(QNode *parent) : QGeometry(*new QGeometryPrivate(), parent) {} /*! + \fn QGeometryFactory::operator()() + + Returns the generated geometry. +*/ +/*! + \fn bool QGeometryFactory::operator==(const QGeometryFactory &other) const = 0 + + Compares the factory with the factory specified in \a other. + Returns true if they are equal. +*/ +/*! \internal */ QGeometry::~QGeometry() @@ -143,6 +154,7 @@ QGeometry::QGeometry(QGeometryPrivate &dd, QNode *parent) } /*! + \fn void Qt3DRender::QGeometry::addAttribute(Qt3DRender::QAttribute *attribute) Adds an \a attribute to this geometry. */ void QGeometry::addAttribute(QAttribute *attribute) @@ -171,6 +183,12 @@ void QGeometry::addAttribute(QAttribute *attribute) } /*! + \fn Qt3DRender::QGeometry(QGeometryPrivate &dd, Qt3DCore::QNode *parent) + + \internal +*/ +/*! + \fn void Qt3DRender::QGeometry::removeAttribute(Qt3DRender::QAttribute *attribute) Removes the given \a attribute from this geometry. */ void QGeometry::removeAttribute(QAttribute *attribute) diff --git a/src/render/graphicshelpers/graphicscontext.cpp b/src/render/graphicshelpers/graphicscontext.cpp index 59b2155d1..37182a0ba 100644 --- a/src/render/graphicshelpers/graphicscontext.cpp +++ b/src/render/graphicshelpers/graphicscontext.cpp @@ -1261,7 +1261,14 @@ void GraphicsContext::setParameters(ShaderParameterPack ¶meterPack) for (const ShaderUniform &uniform : activeUniforms) { // We can use [] as we are sure the the uniform wouldn't // be un activeUniforms if there wasn't a matching value - applyUniform(uniform, values[uniform.m_nameId]); + const auto &v = values[uniform.m_nameId]; + + // skip invalid textures + if (v.valueType() == UniformValue::TextureValue && + v.constData<UniformValue::Texture>()->textureId == -1) + continue; + + applyUniform(uniform, v); } } diff --git a/src/render/lights/qabstractlight.cpp b/src/render/lights/qabstractlight.cpp index a826654c7..e5376f712 100644 --- a/src/render/lights/qabstractlight.cpp +++ b/src/render/lights/qabstractlight.cpp @@ -53,15 +53,6 @@ namespace Qt3DRender * \since 5.6 */ -/*! - \enum QAbstractLight::Type - - This enum type identifies the particular type of light. - \value PointLight - \value DirectionalLight - \value SpotLight -*/ - QAbstractLightPrivate::QAbstractLightPrivate(QAbstractLight::Type type) : m_type(type) , m_shaderData(new QShaderData) @@ -75,6 +66,20 @@ QAbstractLightPrivate::~QAbstractLightPrivate() { } +/*! + \property Qt3DRender::QAbstractLight::type + + Contains the type of light. +*/ +/*! + \enum Qt3DRender::QAbstractLight::Type + + Identifies the particular type of light. + + \value PointLight + \value DirectionalLight + \value SpotLight +*/ Qt3DCore::QNodeCreatedChangeBasePtr QAbstractLight::createNodeCreationChange() const { auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QAbstractLightData>::create(this); @@ -104,8 +109,6 @@ QAbstractLight::~QAbstractLight() } /*! - \property Qt3DRender::QAbstractLight::type - Holds the current QAbstractLight type. */ QAbstractLight::Type QAbstractLight::type() const diff --git a/src/render/lights/qspotlight.cpp b/src/render/lights/qspotlight.cpp index 81c18387b..09335d432 100644 --- a/src/render/lights/qspotlight.cpp +++ b/src/render/lights/qspotlight.cpp @@ -116,6 +116,12 @@ QSpotLight::QSpotLight(QSpotLightPrivate &dd, QNode *parent) } /*! + \fn QVector3D Qt3DRender::QSpotLight::attenuation() const + + Returns the attenuation of the spot light. +*/ + +/*! \qmlproperty float Qt3D.Render::SpotLight::constantAttenuation Specifies the constant attenuation of the spot light */ diff --git a/src/render/materialsystem/qshaderprogram.cpp b/src/render/materialsystem/qshaderprogram.cpp index 2a65d257c..e6f9631d0 100644 --- a/src/render/materialsystem/qshaderprogram.cpp +++ b/src/render/materialsystem/qshaderprogram.cpp @@ -81,7 +81,7 @@ */ /*! - \enum QShaderProgram::ShaderStatus + \enum QShaderProgram::Status This enum identifies the status of shader used. @@ -137,6 +137,9 @@ QShaderProgram::QShaderProgram(QShaderProgramPrivate &dd, QNode *parent) { } +/*! + Posts a scene change with parameter \a change. +*/ void QShaderProgram::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) { Q_D(QShaderProgram); @@ -381,6 +384,9 @@ QString QShaderProgram::log() const Holds the status of the current shader program. */ +/*! + Returns the status of the current shader program. +*/ QShaderProgram::Status QShaderProgram::status() const { Q_D(const QShaderProgram); diff --git a/src/render/picking/pickeventfilter.cpp b/src/render/picking/pickeventfilter.cpp index 19d3b6b6e..297911e45 100644 --- a/src/render/picking/pickeventfilter.cpp +++ b/src/render/picking/pickeventfilter.cpp @@ -40,6 +40,7 @@ #include "pickeventfilter_p.h" #include <QtCore/QMutexLocker> +#include <QtGui/QHoverEvent> QT_BEGIN_NAMESPACE @@ -87,11 +88,17 @@ bool PickEventFilter::eventFilter(QObject *obj, QEvent *e) switch (e->type()) { case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: - case QEvent::MouseMove: - case QEvent::HoverMove: { + case QEvent::MouseMove: { QMutexLocker locker(&m_mutex); m_pendingMouseEvents.push_back(QMouseEvent(*static_cast<QMouseEvent *>(e))); } break; + case QEvent::HoverMove: { + QMutexLocker locker(&m_mutex); + QHoverEvent *he = static_cast<QHoverEvent *>(e); + m_pendingMouseEvents.push_back(QMouseEvent(QEvent::MouseMove, + he->pos(), Qt::NoButton, Qt::NoButton, + he->modifiers())); + } break; case QEvent::KeyPress: case QEvent::KeyRelease: { QMutexLocker locker(&m_mutex); diff --git a/src/render/picking/qpicktriangleevent.cpp b/src/render/picking/qpicktriangleevent.cpp index 2a4cdfea2..cde7a4952 100644 --- a/src/render/picking/qpicktriangleevent.cpp +++ b/src/render/picking/qpicktriangleevent.cpp @@ -236,6 +236,13 @@ uint QPickTriangleEvent::vertex3Index() const return d->m_vertex3Index; } +/*! + \property Qt3DRender::QPickTriangleEvent::uvw + +*/ +/*! + Returns the 3D coordinates u,v, and w. +*/ QVector3D QPickTriangleEvent::uvw() const { Q_D(const QPickTriangleEvent); diff --git a/src/render/texture/gltexture.cpp b/src/render/texture/gltexture.cpp index 340034dcb..fae7fb487 100644 --- a/src/render/texture/gltexture.cpp +++ b/src/render/texture/gltexture.cpp @@ -182,6 +182,10 @@ QOpenGLTexture* GLTexture::getOrCreateGLTexture() } } + // don't try to create the texture if the format was not set + if (m_properties.format == QAbstractTexture::Automatic) + return nullptr; + if (texturedDataInvalid) return nullptr; |