summaryrefslogtreecommitdiffstats
path: root/src/extras
diff options
context:
space:
mode:
Diffstat (limited to 'src/extras')
-rw-r--r--src/extras/defaults/qfirstpersoncameracontroller.cpp4
-rw-r--r--src/extras/defaults/qforwardrenderer.cpp22
-rw-r--r--src/extras/defaults/qforwardrenderer.h4
-rw-r--r--src/extras/defaults/qorbitcameracontroller.cpp4
-rw-r--r--src/extras/defaults/qskyboxentity.cpp25
-rw-r--r--src/extras/defaults/qskyboxentity.h4
-rw-r--r--src/extras/defaults/qskyboxentity_p.h5
-rw-r--r--src/extras/geometries/qconegeometry.cpp14
-rw-r--r--src/extras/geometries/qcuboidgeometry.cpp18
-rw-r--r--src/extras/geometries/qcylindergeometry.cpp14
-rw-r--r--src/extras/geometries/qplanegeometry.cpp18
-rw-r--r--src/extras/geometries/qspheregeometry.cpp18
-rw-r--r--src/extras/geometries/qtorusgeometry.cpp14
-rw-r--r--src/extras/shaders/es2/skybox.vert10
-rw-r--r--src/extras/shaders/gl3/skybox.vert10
15 files changed, 90 insertions, 94 deletions
diff --git a/src/extras/defaults/qfirstpersoncameracontroller.cpp b/src/extras/defaults/qfirstpersoncameracontroller.cpp
index 973566a3c..19446d3ba 100644
--- a/src/extras/defaults/qfirstpersoncameracontroller.cpp
+++ b/src/extras/defaults/qfirstpersoncameracontroller.cpp
@@ -173,6 +173,10 @@ void QFirstPersonCameraControllerPrivate::init()
QObject::connect(m_frameAction, SIGNAL(triggered(float)),
q, SLOT(_q_onTriggered(float)));
+ // Disable the logical device when the entity is disabled
+ QObject::connect(q, &Qt3DCore::QEntity::enabledChanged,
+ m_logicalDevice, &Qt3DInput::QLogicalDevice::setEnabled);
+
q->addComponent(m_frameAction);
q->addComponent(m_logicalDevice);
}
diff --git a/src/extras/defaults/qforwardrenderer.cpp b/src/extras/defaults/qforwardrenderer.cpp
index 32c4a2968..d556b58d3 100644
--- a/src/extras/defaults/qforwardrenderer.cpp
+++ b/src/extras/defaults/qforwardrenderer.cpp
@@ -40,6 +40,7 @@
#include "qforwardrenderer.h"
#include "qforwardrenderer_p.h"
+#include <Qt3DCore/qentity.h>
#include <Qt3DRender/qviewport.h>
#include <Qt3DRender/qcameraselector.h>
#include <Qt3DRender/qclearbuffers.h>
@@ -128,10 +129,11 @@ QForwardRenderer::QForwardRenderer(QNode *parent)
: QTechniqueFilter(*new QForwardRendererPrivate, parent)
{
Q_D(QForwardRenderer);
- QObject::connect(d->m_clearBuffer, SIGNAL(clearColorChanged(const QColor &)), this, SIGNAL(clearColorChanged(const QColor &)));
- QObject::connect(d->m_viewport, SIGNAL(normalizedRectChanged(const QRectF &)), this, SIGNAL(viewportRectChanged(const QRectF &)));
- QObject::connect(d->m_cameraSelector, SIGNAL(cameraChanged(Qt3DCore::QEntity *)), this, SIGNAL(cameraChanged(Qt3DCore::QEntity *)));
- QObject::connect(d->m_surfaceSelector, SIGNAL(surfaceChanged(QObject *)), this, SIGNAL(surfaceChanged(QObject *)));
+ QObject::connect(d->m_clearBuffer, &QClearBuffers::clearColorChanged, this, &QForwardRenderer::clearColorChanged);
+ QObject::connect(d->m_viewport, &QViewport::normalizedRectChanged, this, &QForwardRenderer::viewportRectChanged);
+ QObject::connect(d->m_cameraSelector, &QCameraSelector::cameraChanged, this, &QForwardRenderer::cameraChanged);
+ QObject::connect(d->m_surfaceSelector, &QRenderSurfaceSelector::surfaceChanged, this, &QForwardRenderer::surfaceChanged);
+ QObject::connect(d->m_surfaceSelector, &QRenderSurfaceSelector::externalRenderTargetSizeChanged, this, &QForwardRenderer::externalRenderTargetSizeChanged);
d->init();
}
@@ -163,6 +165,12 @@ void QForwardRenderer::setSurface(QObject *surface)
d->m_surfaceSelector->setSurface(surface);
}
+void QForwardRenderer::setExternalRenderTargetSize(const QSize &size)
+{
+ Q_D(QForwardRenderer);
+ d->m_surfaceSelector->setExternalRenderTargetSize(size);
+}
+
/*!
\qmlproperty rect ForwardRenderer::viewportRect
@@ -233,6 +241,12 @@ QObject *QForwardRenderer::surface() const
return d->m_surfaceSelector->surface();
}
+QSize QForwardRenderer::externalRenderTargetSize() const
+{
+ Q_D(const QForwardRenderer);
+ return d->m_surfaceSelector->externalRenderTargetSize();
+}
+
} // namespace Qt3DExtras
QT_END_NAMESPACE
diff --git a/src/extras/defaults/qforwardrenderer.h b/src/extras/defaults/qforwardrenderer.h
index a744b3caf..01f50f452 100644
--- a/src/extras/defaults/qforwardrenderer.h
+++ b/src/extras/defaults/qforwardrenderer.h
@@ -60,6 +60,7 @@ class QT3DEXTRASSHARED_EXPORT QForwardRenderer : public Qt3DRender::QTechniqueFi
Q_PROPERTY(QRectF viewportRect READ viewportRect WRITE setViewportRect NOTIFY viewportRectChanged)
Q_PROPERTY(QColor clearColor READ clearColor WRITE setClearColor NOTIFY clearColorChanged)
Q_PROPERTY(Qt3DCore::QEntity *camera READ camera WRITE setCamera NOTIFY cameraChanged)
+ Q_PROPERTY(QSize externalRenderTargetSize READ externalRenderTargetSize WRITE setExternalRenderTargetSize NOTIFY externalRenderTargetSizeChanged)
public:
explicit QForwardRenderer(Qt3DCore::QNode *parent = nullptr);
~QForwardRenderer();
@@ -68,18 +69,21 @@ public:
QColor clearColor() const;
Qt3DCore::QEntity *camera() const;
QObject *surface() const;
+ QSize externalRenderTargetSize() const;
public Q_SLOTS:
void setViewportRect(const QRectF &viewportRect);
void setClearColor(const QColor &clearColor);
void setCamera(Qt3DCore::QEntity *camera);
void setSurface(QObject * surface);
+ void setExternalRenderTargetSize(const QSize &size);
Q_SIGNALS:
void viewportRectChanged(const QRectF &viewportRect);
void clearColorChanged(const QColor &clearColor);
void cameraChanged(Qt3DCore::QEntity *camera);
void surfaceChanged(QObject *surface);
+ void externalRenderTargetSizeChanged(const QSize &size);
private:
Q_DECLARE_PRIVATE(QForwardRenderer)
diff --git a/src/extras/defaults/qorbitcameracontroller.cpp b/src/extras/defaults/qorbitcameracontroller.cpp
index d8f468ed0..e340941a8 100644
--- a/src/extras/defaults/qorbitcameracontroller.cpp
+++ b/src/extras/defaults/qorbitcameracontroller.cpp
@@ -219,6 +219,10 @@ void QOrbitCameraControllerPrivate::init()
QObject::connect(m_frameAction, SIGNAL(triggered(float)),
q, SLOT(_q_onTriggered(float)));
+ // Disable the logical device when the entity is disabled
+ QObject::connect(q, &Qt3DCore::QEntity::enabledChanged,
+ m_logicalDevice, &Qt3DInput::QLogicalDevice::setEnabled);
+
q->addComponent(m_frameAction);
q->addComponent(m_logicalDevice);
}
diff --git a/src/extras/defaults/qskyboxentity.cpp b/src/extras/defaults/qskyboxentity.cpp
index 2e755f385..f4b26ae9e 100644
--- a/src/extras/defaults/qskyboxentity.cpp
+++ b/src/extras/defaults/qskyboxentity.cpp
@@ -40,7 +40,6 @@
#include "qskyboxentity.h"
#include "qskyboxentity_p.h"
-#include <Qt3DCore/qtransform.h>
#include <Qt3DRender/qfilterkey.h>
#include <Qt3DRender/qeffect.h>
#include <Qt3DRender/qtexture.h>
@@ -76,7 +75,6 @@ QSkyboxEntityPrivate::QSkyboxEntityPrivate()
, m_es2RenderPass(new QRenderPass())
, m_gl3RenderPass(new QRenderPass())
, m_mesh(new QCuboidMesh())
- , m_transform(new Qt3DCore::QTransform())
, m_textureParameter(new QParameter(QStringLiteral("skyboxTexture"), m_skyboxTexture))
, m_posXImage(new QTextureImage())
, m_posYImage(new QTextureImage())
@@ -173,7 +171,6 @@ void QSkyboxEntityPrivate::init()
q_func()->addComponent(m_mesh);
q_func()->addComponent(m_material);
- q_func()->addComponent(m_transform);
}
/*!
@@ -266,28 +263,6 @@ QString QSkyboxEntity::extension() const
return d->m_extension;
}
-/*!
- * Sets the camera position to \a cameraPosition.
- */
-void QSkyboxEntity::setCameraPosition(const QVector3D &cameraPosition)
-{
- Q_D(QSkyboxEntity);
- if (cameraPosition != d->m_position) {
- d->m_position = cameraPosition;
- d->m_transform->setTranslation(d->m_position);
- emit cameraPositionChanged(cameraPosition);
- }
-}
-
-/*!
- * Returns the camera position.
- */
-QVector3D QSkyboxEntity::cameraPosition() const
-{
- Q_D(const QSkyboxEntity);
- return d->m_position;
-}
-
} // namespace Qt3DExtras
QT_END_NAMESPACE
diff --git a/src/extras/defaults/qskyboxentity.h b/src/extras/defaults/qskyboxentity.h
index 8cb279e1a..a11d2f0a0 100644
--- a/src/extras/defaults/qskyboxentity.h
+++ b/src/extras/defaults/qskyboxentity.h
@@ -62,13 +62,9 @@ public:
void setExtension(const QString &extension);
QString extension() const;
- void setCameraPosition(const QVector3D &cameraPosition);
- QVector3D cameraPosition() const;
-
Q_SIGNALS:
void sourceDirectoryChanged(const QString &path);
void extensionChanged(const QString &extension);
- void cameraPositionChanged(const QVector3D &cameraPosition);
private:
Q_DECLARE_PRIVATE(QSkyboxEntity)
diff --git a/src/extras/defaults/qskyboxentity_p.h b/src/extras/defaults/qskyboxentity_p.h
index 565caa66d..effe97fce 100644
--- a/src/extras/defaults/qskyboxentity_p.h
+++ b/src/extras/defaults/qskyboxentity_p.h
@@ -56,10 +56,6 @@
QT_BEGIN_NAMESPACE
-namespace Qt3DCore {
-class QTransform;
-}
-
namespace Qt3DRender {
class QFilterKey;
@@ -101,7 +97,6 @@ class QSkyboxEntityPrivate : public Qt3DCore::QEntityPrivate
Qt3DRender::QRenderPass *m_es2RenderPass;
Qt3DRender::QRenderPass *m_gl3RenderPass;
QCuboidMesh *m_mesh;
- Qt3DCore::QTransform *m_transform;
Qt3DRender::QParameter *m_textureParameter;
Qt3DRender::QTextureImage *m_posXImage;
Qt3DRender:: QTextureImage *m_posYImage;
diff --git a/src/extras/geometries/qconegeometry.cpp b/src/extras/geometries/qconegeometry.cpp
index 6e6cceda3..9db7e2b46 100644
--- a/src/extras/geometries/qconegeometry.cpp
+++ b/src/extras/geometries/qconegeometry.cpp
@@ -373,16 +373,16 @@ void QConeGeometryPrivate::init()
+ m_slices * (m_hasTopEndcap + m_hasBottomEndcap); // endcaps
m_positionAttribute->setName(QAttribute::defaultPositionAttributeName());
- m_positionAttribute->setDataType(QAttribute::Float);
- m_positionAttribute->setDataSize(3);
+ m_positionAttribute->setVertexBaseType(QAttribute::Float);
+ m_positionAttribute->setVertexSize(3);
m_positionAttribute->setAttributeType(QAttribute::VertexAttribute);
m_positionAttribute->setBuffer(m_vertexBuffer);
m_positionAttribute->setByteStride(stride);
m_positionAttribute->setCount(nVerts);
m_texCoordAttribute->setName(QAttribute::defaultTextureCoordinateAttributeName());
- m_texCoordAttribute->setDataType(QAttribute::Float);
- m_texCoordAttribute->setDataSize(2);
+ m_texCoordAttribute->setVertexBaseType(QAttribute::Float);
+ m_texCoordAttribute->setVertexSize(2);
m_texCoordAttribute->setAttributeType(QAttribute::VertexAttribute);
m_texCoordAttribute->setBuffer(m_vertexBuffer);
m_texCoordAttribute->setByteStride(stride);
@@ -390,8 +390,8 @@ void QConeGeometryPrivate::init()
m_texCoordAttribute->setCount(nVerts);
m_normalAttribute->setName(QAttribute::defaultNormalAttributeName());
- m_normalAttribute->setDataType(QAttribute::Float);
- m_normalAttribute->setDataSize(3);
+ m_normalAttribute->setVertexBaseType(QAttribute::Float);
+ m_normalAttribute->setVertexSize(3);
m_normalAttribute->setAttributeType(QAttribute::VertexAttribute);
m_normalAttribute->setBuffer(m_vertexBuffer);
m_normalAttribute->setByteStride(stride);
@@ -399,7 +399,7 @@ void QConeGeometryPrivate::init()
m_normalAttribute->setCount(nVerts);
m_indexAttribute->setAttributeType(QAttribute::IndexAttribute);
- m_indexAttribute->setDataType(QAttribute::UnsignedShort);
+ m_indexAttribute->setVertexBaseType(QAttribute::UnsignedShort);
m_indexAttribute->setBuffer(m_indexBuffer);
m_indexAttribute->setCount(faces * 3);
diff --git a/src/extras/geometries/qcuboidgeometry.cpp b/src/extras/geometries/qcuboidgeometry.cpp
index 4e644b24a..0f7b5220f 100644
--- a/src/extras/geometries/qcuboidgeometry.cpp
+++ b/src/extras/geometries/qcuboidgeometry.cpp
@@ -510,16 +510,16 @@ void QCuboidGeometryPrivate::init()
const int indexCount = 2 * (yzIndices + xzIndices + xyIndices);
m_positionAttribute->setName(QAttribute::defaultPositionAttributeName());
- m_positionAttribute->setDataType(QAttribute::Float);
- m_positionAttribute->setDataSize(3);
+ m_positionAttribute->setVertexBaseType(QAttribute::Float);
+ m_positionAttribute->setVertexSize(3);
m_positionAttribute->setAttributeType(QAttribute::VertexAttribute);
m_positionAttribute->setBuffer(m_vertexBuffer);
m_positionAttribute->setByteStride(stride);
m_positionAttribute->setCount(nVerts);
m_texCoordAttribute->setName(QAttribute::defaultTextureCoordinateAttributeName());
- m_texCoordAttribute->setDataType(QAttribute::Float);
- m_texCoordAttribute->setDataSize(2);
+ m_texCoordAttribute->setVertexBaseType(QAttribute::Float);
+ m_texCoordAttribute->setVertexSize(2);
m_texCoordAttribute->setAttributeType(QAttribute::VertexAttribute);
m_texCoordAttribute->setBuffer(m_vertexBuffer);
m_texCoordAttribute->setByteStride(stride);
@@ -527,8 +527,8 @@ void QCuboidGeometryPrivate::init()
m_texCoordAttribute->setCount(nVerts);
m_normalAttribute->setName(QAttribute::defaultNormalAttributeName());
- m_normalAttribute->setDataType(QAttribute::Float);
- m_normalAttribute->setDataSize(3);
+ m_normalAttribute->setVertexBaseType(QAttribute::Float);
+ m_normalAttribute->setVertexSize(3);
m_normalAttribute->setAttributeType(QAttribute::VertexAttribute);
m_normalAttribute->setBuffer(m_vertexBuffer);
m_normalAttribute->setByteStride(stride);
@@ -536,8 +536,8 @@ void QCuboidGeometryPrivate::init()
m_normalAttribute->setCount(nVerts);
m_tangentAttribute->setName(QAttribute::defaultTangentAttributeName());
- m_tangentAttribute->setDataType(QAttribute::Float);
- m_tangentAttribute->setDataSize(4);
+ m_tangentAttribute->setVertexBaseType(QAttribute::Float);
+ m_tangentAttribute->setVertexSize(4);
m_tangentAttribute->setAttributeType(QAttribute::VertexAttribute);
m_tangentAttribute->setBuffer(m_vertexBuffer);
m_tangentAttribute->setByteStride(stride);
@@ -545,7 +545,7 @@ void QCuboidGeometryPrivate::init()
m_tangentAttribute->setCount(nVerts);
m_indexAttribute->setAttributeType(QAttribute::IndexAttribute);
- m_indexAttribute->setDataType(QAttribute::UnsignedShort);
+ m_indexAttribute->setVertexBaseType(QAttribute::UnsignedShort);
m_indexAttribute->setBuffer(m_indexBuffer);
m_indexAttribute->setCount(indexCount);
diff --git a/src/extras/geometries/qcylindergeometry.cpp b/src/extras/geometries/qcylindergeometry.cpp
index c80b45dfa..136258162 100644
--- a/src/extras/geometries/qcylindergeometry.cpp
+++ b/src/extras/geometries/qcylindergeometry.cpp
@@ -296,16 +296,16 @@ void QCylinderGeometryPrivate::init()
const int faces = (m_slices * 2) * (m_rings - 1) + (m_slices * 2);
m_positionAttribute->setName(QAttribute::defaultPositionAttributeName());
- m_positionAttribute->setDataType(QAttribute::Float);
- m_positionAttribute->setDataSize(3);
+ m_positionAttribute->setVertexBaseType(QAttribute::Float);
+ m_positionAttribute->setVertexSize(3);
m_positionAttribute->setAttributeType(QAttribute::VertexAttribute);
m_positionAttribute->setBuffer(m_vertexBuffer);
m_positionAttribute->setByteStride(stride);
m_positionAttribute->setCount(nVerts);
m_texCoordAttribute->setName(QAttribute::defaultTextureCoordinateAttributeName());
- m_texCoordAttribute->setDataType(QAttribute::Float);
- m_texCoordAttribute->setDataSize(2);
+ m_texCoordAttribute->setVertexBaseType(QAttribute::Float);
+ m_texCoordAttribute->setVertexSize(2);
m_texCoordAttribute->setAttributeType(QAttribute::VertexAttribute);
m_texCoordAttribute->setBuffer(m_vertexBuffer);
m_texCoordAttribute->setByteStride(stride);
@@ -313,8 +313,8 @@ void QCylinderGeometryPrivate::init()
m_texCoordAttribute->setCount(nVerts);
m_normalAttribute->setName(QAttribute::defaultNormalAttributeName());
- m_normalAttribute->setDataType(QAttribute::Float);
- m_normalAttribute->setDataSize(3);
+ m_normalAttribute->setVertexBaseType(QAttribute::Float);
+ m_normalAttribute->setVertexSize(3);
m_normalAttribute->setAttributeType(QAttribute::VertexAttribute);
m_normalAttribute->setBuffer(m_vertexBuffer);
m_normalAttribute->setByteStride(stride);
@@ -322,7 +322,7 @@ void QCylinderGeometryPrivate::init()
m_normalAttribute->setCount(nVerts);
m_indexAttribute->setAttributeType(QAttribute::IndexAttribute);
- m_indexAttribute->setDataType(QAttribute::UnsignedShort);
+ m_indexAttribute->setVertexBaseType(QAttribute::UnsignedShort);
m_indexAttribute->setBuffer(m_indexBuffer);
m_indexAttribute->setCount(faces * 3);
diff --git a/src/extras/geometries/qplanegeometry.cpp b/src/extras/geometries/qplanegeometry.cpp
index b7395b67e..74c90cf1b 100644
--- a/src/extras/geometries/qplanegeometry.cpp
+++ b/src/extras/geometries/qplanegeometry.cpp
@@ -481,16 +481,16 @@ void QPlaneGeometryPrivate::init()
const int faces = 2 * (m_meshResolution.width() - 1) * (m_meshResolution.height() - 1);
m_positionAttribute->setName(QAttribute::defaultPositionAttributeName());
- m_positionAttribute->setDataType(QAttribute::Float);
- m_positionAttribute->setDataSize(3);
+ m_positionAttribute->setVertexBaseType(QAttribute::Float);
+ m_positionAttribute->setVertexSize(3);
m_positionAttribute->setAttributeType(QAttribute::VertexAttribute);
m_positionAttribute->setBuffer(m_vertexBuffer);
m_positionAttribute->setByteStride(stride);
m_positionAttribute->setCount(nVerts);
m_texCoordAttribute->setName(QAttribute::defaultTextureCoordinateAttributeName());
- m_texCoordAttribute->setDataType(QAttribute::Float);
- m_texCoordAttribute->setDataSize(2);
+ m_texCoordAttribute->setVertexBaseType(QAttribute::Float);
+ m_texCoordAttribute->setVertexSize(2);
m_texCoordAttribute->setAttributeType(QAttribute::VertexAttribute);
m_texCoordAttribute->setBuffer(m_vertexBuffer);
m_texCoordAttribute->setByteStride(stride);
@@ -498,8 +498,8 @@ void QPlaneGeometryPrivate::init()
m_texCoordAttribute->setCount(nVerts);
m_normalAttribute->setName(QAttribute::defaultNormalAttributeName());
- m_normalAttribute->setDataType(QAttribute::Float);
- m_normalAttribute->setDataSize(3);
+ m_normalAttribute->setVertexBaseType(QAttribute::Float);
+ m_normalAttribute->setVertexSize(3);
m_normalAttribute->setAttributeType(QAttribute::VertexAttribute);
m_normalAttribute->setBuffer(m_vertexBuffer);
m_normalAttribute->setByteStride(stride);
@@ -507,8 +507,8 @@ void QPlaneGeometryPrivate::init()
m_normalAttribute->setCount(nVerts);
m_tangentAttribute->setName(QAttribute::defaultTangentAttributeName());
- m_tangentAttribute->setDataType(QAttribute::Float);
- m_tangentAttribute->setDataSize(4);
+ m_tangentAttribute->setVertexBaseType(QAttribute::Float);
+ m_tangentAttribute->setVertexSize(4);
m_tangentAttribute->setAttributeType(QAttribute::VertexAttribute);
m_tangentAttribute->setBuffer(m_vertexBuffer);
m_tangentAttribute->setByteStride(stride);
@@ -516,7 +516,7 @@ void QPlaneGeometryPrivate::init()
m_tangentAttribute->setCount(nVerts);
m_indexAttribute->setAttributeType(QAttribute::IndexAttribute);
- m_indexAttribute->setDataType(QAttribute::UnsignedShort);
+ m_indexAttribute->setVertexBaseType(QAttribute::UnsignedShort);
m_indexAttribute->setBuffer(m_indexBuffer);
// Each primitive has 3 vertives
diff --git a/src/extras/geometries/qspheregeometry.cpp b/src/extras/geometries/qspheregeometry.cpp
index 5d64d0f35..277d4fcb9 100644
--- a/src/extras/geometries/qspheregeometry.cpp
+++ b/src/extras/geometries/qspheregeometry.cpp
@@ -262,16 +262,16 @@ void QSphereGeometryPrivate::init()
const int faces = (m_slices * 2) * (m_rings - 2) + (2 * m_slices);
m_positionAttribute->setName(QAttribute::defaultPositionAttributeName());
- m_positionAttribute->setDataType(QAttribute::Float);
- m_positionAttribute->setDataSize(3);
+ m_positionAttribute->setVertexBaseType(QAttribute::Float);
+ m_positionAttribute->setVertexSize(3);
m_positionAttribute->setAttributeType(QAttribute::VertexAttribute);
m_positionAttribute->setBuffer(m_vertexBuffer);
m_positionAttribute->setByteStride(stride);
m_positionAttribute->setCount(nVerts);
m_texCoordAttribute->setName(QAttribute::defaultTextureCoordinateAttributeName());
- m_texCoordAttribute->setDataType(QAttribute::Float);
- m_texCoordAttribute->setDataSize(2);
+ m_texCoordAttribute->setVertexBaseType(QAttribute::Float);
+ m_texCoordAttribute->setVertexSize(2);
m_texCoordAttribute->setAttributeType(QAttribute::VertexAttribute);
m_texCoordAttribute->setBuffer(m_vertexBuffer);
m_texCoordAttribute->setByteStride(stride);
@@ -279,8 +279,8 @@ void QSphereGeometryPrivate::init()
m_texCoordAttribute->setCount(nVerts);
m_normalAttribute->setName(QAttribute::defaultNormalAttributeName());
- m_normalAttribute->setDataType(QAttribute::Float);
- m_normalAttribute->setDataSize(3);
+ m_normalAttribute->setVertexBaseType(QAttribute::Float);
+ m_normalAttribute->setVertexSize(3);
m_normalAttribute->setAttributeType(QAttribute::VertexAttribute);
m_normalAttribute->setBuffer(m_vertexBuffer);
m_normalAttribute->setByteStride(stride);
@@ -288,8 +288,8 @@ void QSphereGeometryPrivate::init()
m_normalAttribute->setCount(nVerts);
m_tangentAttribute->setName(QAttribute::defaultTangentAttributeName());
- m_tangentAttribute->setDataType(QAttribute::Float);
- m_tangentAttribute->setDataSize(4);
+ m_tangentAttribute->setVertexBaseType(QAttribute::Float);
+ m_tangentAttribute->setVertexSize(4);
m_tangentAttribute->setAttributeType(QAttribute::VertexAttribute);
m_tangentAttribute->setBuffer(m_vertexBuffer);
m_tangentAttribute->setByteStride(stride);
@@ -297,7 +297,7 @@ void QSphereGeometryPrivate::init()
m_tangentAttribute->setCount(nVerts);
m_indexAttribute->setAttributeType(QAttribute::IndexAttribute);
- m_indexAttribute->setDataType(QAttribute::UnsignedShort);
+ m_indexAttribute->setVertexBaseType(QAttribute::UnsignedShort);
m_indexAttribute->setBuffer(m_indexBuffer);
m_indexAttribute->setCount(faces * 3);
diff --git a/src/extras/geometries/qtorusgeometry.cpp b/src/extras/geometries/qtorusgeometry.cpp
index 09a69a45a..801281110 100644
--- a/src/extras/geometries/qtorusgeometry.cpp
+++ b/src/extras/geometries/qtorusgeometry.cpp
@@ -222,16 +222,16 @@ void QTorusGeometryPrivate::init()
const int faces = (m_slices * 2) * m_rings;
m_positionAttribute->setName(QAttribute::defaultPositionAttributeName());
- m_positionAttribute->setDataType(QAttribute::Float);
- m_positionAttribute->setDataSize(3);
+ m_positionAttribute->setVertexBaseType(QAttribute::Float);
+ m_positionAttribute->setVertexSize(3);
m_positionAttribute->setAttributeType(QAttribute::VertexAttribute);
m_positionAttribute->setBuffer(m_vertexBuffer);
m_positionAttribute->setByteStride(stride);
m_positionAttribute->setCount(nVerts);
m_texCoordAttribute->setName(QAttribute::defaultTextureCoordinateAttributeName());
- m_texCoordAttribute->setDataType(QAttribute::Float);
- m_texCoordAttribute->setDataSize(2);
+ m_texCoordAttribute->setVertexBaseType(QAttribute::Float);
+ m_texCoordAttribute->setVertexSize(2);
m_texCoordAttribute->setAttributeType(QAttribute::VertexAttribute);
m_texCoordAttribute->setBuffer(m_vertexBuffer);
m_texCoordAttribute->setByteStride(stride);
@@ -239,8 +239,8 @@ void QTorusGeometryPrivate::init()
m_texCoordAttribute->setCount(nVerts);
m_normalAttribute->setName(QAttribute::defaultNormalAttributeName());
- m_normalAttribute->setDataType(QAttribute::Float);
- m_normalAttribute->setDataSize(3);
+ m_normalAttribute->setVertexBaseType(QAttribute::Float);
+ m_normalAttribute->setVertexSize(3);
m_normalAttribute->setAttributeType(QAttribute::VertexAttribute);
m_normalAttribute->setBuffer(m_vertexBuffer);
m_normalAttribute->setByteStride(stride);
@@ -248,7 +248,7 @@ void QTorusGeometryPrivate::init()
m_normalAttribute->setCount(nVerts);
m_indexAttribute->setAttributeType(QAttribute::IndexAttribute);
- m_indexAttribute->setDataType(QAttribute::UnsignedShort);
+ m_indexAttribute->setVertexBaseType(QAttribute::UnsignedShort);
m_indexAttribute->setBuffer(m_indexBuffer);
m_indexAttribute->setCount(faces * 3);
diff --git a/src/extras/shaders/es2/skybox.vert b/src/extras/shaders/es2/skybox.vert
index e2de1d88b..3a9fb1beb 100644
--- a/src/extras/shaders/es2/skybox.vert
+++ b/src/extras/shaders/es2/skybox.vert
@@ -1,12 +1,14 @@
attribute vec3 vertexPosition;
varying vec3 texCoord0;
-uniform mat4 mvp;
-uniform mat4 inverseProjectionMatrix;
-uniform mat4 inverseModelView;
+uniform mat4 modelMatrix;
+uniform mat4 viewMatrix;
+uniform mat4 projectionMatrix;
void main()
{
texCoord0 = vertexPosition.xyz;
- gl_Position = vec4(mvp * vec4(vertexPosition, 1.0)).xyww;
+ // Converting the viewMatrix to a mat3, then back to a mat4
+ // removes the translation component from it
+ gl_Position = vec4(projectionMatrix * mat4(mat3(viewMatrix)) * modelMatrix * vec4(vertexPosition, 1.0)).xyww;
}
diff --git a/src/extras/shaders/gl3/skybox.vert b/src/extras/shaders/gl3/skybox.vert
index 17bb2b00b..b5b0c0617 100644
--- a/src/extras/shaders/gl3/skybox.vert
+++ b/src/extras/shaders/gl3/skybox.vert
@@ -3,12 +3,14 @@
in vec3 vertexPosition;
out vec3 texCoord0;
-uniform mat4 mvp;
-uniform mat4 inverseProjectionMatrix;
-uniform mat4 inverseModelView;
+uniform mat4 modelMatrix;
+uniform mat4 viewMatrix;
+uniform mat4 projectionMatrix;
void main()
{
texCoord0 = vertexPosition.xyz;
- gl_Position = vec4(mvp * vec4(vertexPosition, 1.0)).xyww;
+ // Converting the viewMatrix to a mat3, then back to a mat4
+ // removes the translation component from it
+ gl_Position = vec4(projectionMatrix * mat4(mat3(viewMatrix)) * modelMatrix * vec4(vertexPosition, 1.0)).xyww;
}