summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qt-license-check.exclude1
-rw-r--r--src/input/frontend/qmouseevent.cpp34
-rw-r--r--src/input/frontend/qmouseevent.h20
-rw-r--r--src/plugins/sceneparsers/gltf/gltf.pro2
-rw-r--r--src/quick3d/imports/render/qt3dquick3drenderplugin.cpp2
-rw-r--r--src/quick3d/quick3d/items/quick3dentityloader.cpp4
-rw-r--r--src/render/graphicshelpers/graphicscontext.cpp5
-rw-r--r--src/render/graphicshelpers/graphicscontext_p.h1
-rw-r--r--src/render/graphicshelpers/graphicshelperes2.cpp12
-rw-r--r--src/render/graphicshelpers/graphicshelperes2_p.h1
-rw-r--r--src/render/graphicshelpers/graphicshelpergl2.cpp13
-rw-r--r--src/render/graphicshelpers/graphicshelpergl2_p.h1
-rw-r--r--src/render/graphicshelpers/graphicshelpergl3.cpp10
-rw-r--r--src/render/graphicshelpers/graphicshelpergl3_3.cpp10
-rw-r--r--src/render/graphicshelpers/graphicshelpergl3_3_p.h1
-rw-r--r--src/render/graphicshelpers/graphicshelpergl3_p.h1
-rw-r--r--src/render/graphicshelpers/graphicshelpergl4.cpp10
-rw-r--r--src/render/graphicshelpers/graphicshelpergl4_p.h1
-rw-r--r--src/render/graphicshelpers/graphicshelperinterface_p.h1
-rw-r--r--src/render/renderstates/genericstate_p.h3
-rw-r--r--src/render/renderstates/qpointsize.cpp124
-rw-r--r--src/render/renderstates/qpointsize.h87
-rw-r--r--src/render/renderstates/qrenderstate.h1
-rw-r--r--src/render/renderstates/renderstates.cpp15
-rw-r--r--src/render/renderstates/renderstates.pri6
-rw-r--r--src/render/renderstates/renderstates_p.h13
-rw-r--r--src/render/renderstates/renderstateset.cpp9
-rw-r--r--tools/utils/qtcreator/README5
-rw-r--r--tools/utils/qtcreator/templates/wizards/classes/qt3d/file.cpp42
-rw-r--r--tools/utils/qtcreator/templates/wizards/classes/qt3d/file.h54
-rw-r--r--tools/utils/qtcreator/templates/wizards/classes/qt3d/file_p.h39
-rw-r--r--tools/utils/qtcreator/templates/wizards/classes/qt3d/wizard.json138
32 files changed, 633 insertions, 33 deletions
diff --git a/.qt-license-check.exclude b/.qt-license-check.exclude
new file mode 100644
index 000000000..a03d29ef2
--- /dev/null
+++ b/.qt-license-check.exclude
@@ -0,0 +1 @@
+^tools/utils/qtcreator/
diff --git a/src/input/frontend/qmouseevent.cpp b/src/input/frontend/qmouseevent.cpp
index 41a12a08b..d94925f94 100644
--- a/src/input/frontend/qmouseevent.cpp
+++ b/src/input/frontend/qmouseevent.cpp
@@ -116,15 +116,15 @@ QMouseEvent::Buttons QMouseEvent::button() const
{
switch (m_event.button()) {
case Qt::MouseButton::LeftButton:
- return QMouseEvent::Buttons::LeftButton;
+ return QMouseEvent::LeftButton;
case Qt::MouseButton::RightButton:
- return QMouseEvent::Buttons::RightButton;
+ return QMouseEvent::RightButton;
case Qt::MouseButton::MiddleButton:
- return QMouseEvent::Buttons::MiddleButton;
+ return QMouseEvent::MiddleButton;
case Qt::MouseButton::BackButton:
- return QMouseEvent::Buttons::BackButton;
+ return QMouseEvent::BackButton;
default:
- return QMouseEvent::Buttons::NoButton;
+ return QMouseEvent::NoButton;
}
}
@@ -144,17 +144,17 @@ QMouseEvent::Modifiers QMouseEvent::modifier() const
{
switch (m_event.modifiers()) {
case Qt::ShiftModifier:
- return QMouseEvent::Modifiers::ShiftModifier;
+ return QMouseEvent::ShiftModifier;
case Qt::ControlModifier:
- return QMouseEvent::Modifiers::ControlModifier;
+ return QMouseEvent::ControlModifier;
case Qt::AltModifier:
- return QMouseEvent::Modifiers::AltModifier;
+ return QMouseEvent::AltModifier;
case Qt::MetaModifier:
- return QMouseEvent::Modifiers::MetaModifier;
+ return QMouseEvent::MetaModifier;
case Qt::KeypadModifier:
- return QMouseEvent::Modifiers::KeypadModifier;
+ return QMouseEvent::KeypadModifier;
default:
- return QMouseEvent::Modifiers::NoModifier;
+ return QMouseEvent::NoModifier;
}
}
@@ -244,17 +244,17 @@ QWheelEvent::Modifiers QWheelEvent::modifier() const
{
switch (m_event.modifiers()) {
case Qt::ShiftModifier:
- return QWheelEvent::Modifiers::ShiftModifier;
+ return QWheelEvent::ShiftModifier;
case Qt::ControlModifier:
- return QWheelEvent::Modifiers::ControlModifier;
+ return QWheelEvent::ControlModifier;
case Qt::AltModifier:
- return QWheelEvent::Modifiers::AltModifier;
+ return QWheelEvent::AltModifier;
case Qt::MetaModifier:
- return QWheelEvent::Modifiers::MetaModifier;
+ return QWheelEvent::MetaModifier;
case Qt::KeypadModifier:
- return QWheelEvent::Modifiers::KeypadModifier;
+ return QWheelEvent::KeypadModifier;
default:
- return QWheelEvent::Modifiers::NoModifier;
+ return QWheelEvent::NoModifier;
}
}
diff --git a/src/input/frontend/qmouseevent.h b/src/input/frontend/qmouseevent.h
index 109875d38..1b5f41798 100644
--- a/src/input/frontend/qmouseevent.h
+++ b/src/input/frontend/qmouseevent.h
@@ -59,11 +59,11 @@ class QT3DINPUTSHARED_EXPORT QMouseEvent : public QObject
public:
enum Buttons {
- LeftButton = Qt::MouseButton::LeftButton,
- RightButton = Qt::MouseButton::RightButton,
- MiddleButton = Qt::MouseButton::MiddleButton,
- BackButton = Qt::MouseButton::BackButton,
- NoButton = Qt::MouseButton::NoButton
+ LeftButton = Qt::LeftButton,
+ RightButton = Qt::RightButton,
+ MiddleButton = Qt::MiddleButton,
+ BackButton = Qt::BackButton,
+ NoButton = Qt::NoButton
};
Q_ENUM(Buttons)
@@ -109,11 +109,11 @@ class QT3DINPUTSHARED_EXPORT QWheelEvent : public QObject
public:
enum Buttons {
- LeftButton = Qt::MouseButton::LeftButton,
- RightButton = Qt::MouseButton::RightButton,
- MiddleButton = Qt::MouseButton::MiddleButton,
- BackButton = Qt::MouseButton::BackButton,
- NoButton = Qt::MouseButton::NoButton
+ LeftButton = Qt::LeftButton,
+ RightButton = Qt::RightButton,
+ MiddleButton = Qt::MiddleButton,
+ BackButton = Qt::BackButton,
+ NoButton = Qt::NoButton
};
Q_ENUM(Buttons)
diff --git a/src/plugins/sceneparsers/gltf/gltf.pro b/src/plugins/sceneparsers/gltf/gltf.pro
index 84f4a173e..be219fa9f 100644
--- a/src/plugins/sceneparsers/gltf/gltf.pro
+++ b/src/plugins/sceneparsers/gltf/gltf.pro
@@ -2,7 +2,7 @@ TARGET = gltfsceneparser
QT += core-private 3dcore 3dcore-private 3drender 3drender-private
PLUGIN_TYPE = sceneparsers
-PLUGIN_CLASS_NAME = GLTFParser
+PLUGIN_CLASS_NAME = GLTFSceneParserPlugin
load(qt_plugin)
HEADERS += \
diff --git a/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp b/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp
index c9944d38b..4382a1bf6 100644
--- a/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp
+++ b/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp
@@ -81,6 +81,7 @@
#include <Qt3DRender/qclearbuffer.h>
#include <Qt3DRender/qsortcriterion.h>
#include <Qt3DRender/qalphacoverage.h>
+#include <Qt3DRender/qpointsize.h>
#include <Qt3DRender/qpolygonoffset.h>
#include <Qt3DRender/qcolormask.h>
#include <Qt3DRender/qshaderdata.h>
@@ -282,6 +283,7 @@ void Qt3DQuick3DRenderPlugin::registerTypes(const char *uri)
qmlRegisterType<Qt3DRender::QScissorTest>(uri, 2, 0, "ScissorTest");
qmlRegisterType<Qt3DRender::QDithering>(uri, 2, 0, "Dithering");
qmlRegisterType<Qt3DRender::QAlphaCoverage>(uri, 2, 0, "AlphaCoverage");
+ qmlRegisterType<Qt3DRender::QPointSize>(uri, 2, 0, "PointSize");
qmlRegisterType<Qt3DRender::QPolygonOffset>(uri, 2, 0, "PolygonOffset");
qmlRegisterType<Qt3DRender::QColorMask>(uri, 2, 0, "ColorMask");
qmlRegisterType<Qt3DRender::QClipPlane>(uri, 2, 0, "ClipPlane");
diff --git a/src/quick3d/quick3d/items/quick3dentityloader.cpp b/src/quick3d/quick3d/items/quick3dentityloader.cpp
index f9a3ea7e4..6770fb2a6 100644
--- a/src/quick3d/quick3d/items/quick3dentityloader.cpp
+++ b/src/quick3d/quick3d/items/quick3dentityloader.cpp
@@ -62,7 +62,7 @@ protected:
Quick3DEntityLoaderPrivate *priv = Quick3DEntityLoaderPrivate::get(m_loader);
switch (status) {
- case Status::Ready: {
+ case Ready: {
Q_ASSERT(priv->m_entity == Q_NULLPTR);
priv->m_entity = qobject_cast<QEntity *>(object());
Q_ASSERT(priv->m_entity != Q_NULLPTR);
@@ -71,7 +71,7 @@ protected:
break;
}
- case Status::Error: {
+ case Error: {
QQmlEnginePrivate::warning(qmlEngine(m_loader), errors());
priv->clear();
emit m_loader->entityChanged();
diff --git a/src/render/graphicshelpers/graphicscontext.cpp b/src/render/graphicshelpers/graphicscontext.cpp
index 41b354c23..92f5abbf4 100644
--- a/src/render/graphicshelpers/graphicscontext.cpp
+++ b/src/render/graphicshelpers/graphicscontext.cpp
@@ -786,6 +786,11 @@ void GraphicsContext::disablePrimitiveRestart()
m_glHelper->disablePrimitiveRestart();
}
+void GraphicsContext::pointSize(bool programmable, GLfloat value)
+{
+ m_glHelper->pointSize(programmable, value);
+}
+
/*!
\internal
Returns a texture unit for a texture, -1 if all texture units are assigned.
diff --git a/src/render/graphicshelpers/graphicscontext_p.h b/src/render/graphicshelpers/graphicscontext_p.h
index cf34806b7..8436166f4 100644
--- a/src/render/graphicshelpers/graphicscontext_p.h
+++ b/src/render/graphicshelpers/graphicscontext_p.h
@@ -194,6 +194,7 @@ public:
GLint maxClipPlaneCount();
void enablePrimitiveRestart(int restartIndex);
void disablePrimitiveRestart();
+ void pointSize(bool programmable, GLfloat value);
// Helper methods
static GLint elementType(GLint type);
diff --git a/src/render/graphicshelpers/graphicshelperes2.cpp b/src/render/graphicshelpers/graphicshelperes2.cpp
index 8d1df2253..2072df3f4 100644
--- a/src/render/graphicshelpers/graphicshelperes2.cpp
+++ b/src/render/graphicshelpers/graphicshelperes2.cpp
@@ -542,6 +542,18 @@ void GraphicsHelperES2::disablePrimitiveRestart()
{
}
+void GraphicsHelperES2::pointSize(bool programmable, GLfloat value)
+{
+ // If this is not a reset to default values, print a warning
+ if (programmable || !qFuzzyCompare(value, 1.0f)) {
+ static bool warned = false;
+ if (!warned) {
+ qWarning() << "glPointSize() and GL_PROGRAM_POINT_SIZE are not supported by ES 2.0";
+ warned = true;
+ }
+ }
+}
+
QSize GraphicsHelperES2::getRenderBufferDimensions(GLuint renderBufferId)
{
GLint width = 0;
diff --git a/src/render/graphicshelpers/graphicshelperes2_p.h b/src/render/graphicshelpers/graphicshelperes2_p.h
index 6d0fc1993..f7d675b82 100644
--- a/src/render/graphicshelpers/graphicshelperes2_p.h
+++ b/src/render/graphicshelpers/graphicshelperes2_p.h
@@ -102,6 +102,7 @@ public:
GLint maxClipPlaneCount() Q_DECL_OVERRIDE;
void enablePrimitiveRestart(int primitiveRestartIndex) Q_DECL_OVERRIDE;
void disablePrimitiveRestart() Q_DECL_OVERRIDE;
+ void pointSize(bool programmable, GLfloat value) Q_DECL_OVERRIDE;
QSize getRenderBufferDimensions(GLuint renderBufferId) Q_DECL_OVERRIDE;
QSize getTextureDimensions(GLuint textureId, GLenum target, uint level = 0) Q_DECL_OVERRIDE;
diff --git a/src/render/graphicshelpers/graphicshelpergl2.cpp b/src/render/graphicshelpers/graphicshelpergl2.cpp
index 972d93ffe..c21a6eeba 100644
--- a/src/render/graphicshelpers/graphicshelpergl2.cpp
+++ b/src/render/graphicshelpers/graphicshelpergl2.cpp
@@ -540,6 +540,19 @@ void GraphicsHelperGL2::disablePrimitiveRestart()
{
}
+void GraphicsHelperGL2::pointSize(bool programmable, GLfloat value)
+{
+ // Print a warning once for trying to set GL_PROGRAM_POINT_SIZE
+ if (programmable) {
+ static bool warned = false;
+ if (!warned) {
+ qWarning() << "GL_PROGRAM_POINT_SIZE is not supported by OpenGL 2.0 (since 3.2)";
+ warned = true;
+ }
+ }
+ m_funcs->glPointSize(value);
+}
+
QSize GraphicsHelperGL2::getRenderBufferDimensions(GLuint renderBufferId)
{
Q_UNUSED(renderBufferId);
diff --git a/src/render/graphicshelpers/graphicshelpergl2_p.h b/src/render/graphicshelpers/graphicshelpergl2_p.h
index 5f86c0d67..6d7a7e8f6 100644
--- a/src/render/graphicshelpers/graphicshelpergl2_p.h
+++ b/src/render/graphicshelpers/graphicshelpergl2_p.h
@@ -104,6 +104,7 @@ public:
GLint maxClipPlaneCount() Q_DECL_OVERRIDE;
void enablePrimitiveRestart(int primitiveRestartIndex) Q_DECL_OVERRIDE;
void disablePrimitiveRestart() Q_DECL_OVERRIDE;
+ void pointSize(bool programmable, GLfloat value) Q_DECL_OVERRIDE;
QSize getRenderBufferDimensions(GLuint renderBufferId) Q_DECL_OVERRIDE;
QSize getTextureDimensions(GLuint textureId, GLenum target, uint level = 0) Q_DECL_OVERRIDE;
diff --git a/src/render/graphicshelpers/graphicshelpergl3.cpp b/src/render/graphicshelpers/graphicshelpergl3.cpp
index f4a296c30..0f48348e4 100644
--- a/src/render/graphicshelpers/graphicshelpergl3.cpp
+++ b/src/render/graphicshelpers/graphicshelpergl3.cpp
@@ -896,6 +896,16 @@ void GraphicsHelperGL3::disablePrimitiveRestart()
m_funcs->glDisable(GL_PRIMITIVE_RESTART);
}
+void GraphicsHelperGL3::pointSize(bool programmable, GLfloat value)
+{
+ if (programmable) {
+ m_funcs->glEnable(GL_PROGRAM_POINT_SIZE);
+ } else {
+ m_funcs->glDisable(GL_PROGRAM_POINT_SIZE);
+ m_funcs->glPointSize(value);
+ }
+}
+
QSize GraphicsHelperGL3::getRenderBufferDimensions(GLuint renderBufferId)
{
GLint width = 0;
diff --git a/src/render/graphicshelpers/graphicshelpergl3_3.cpp b/src/render/graphicshelpers/graphicshelpergl3_3.cpp
index 9000889b9..3cc06482f 100644
--- a/src/render/graphicshelpers/graphicshelpergl3_3.cpp
+++ b/src/render/graphicshelpers/graphicshelpergl3_3.cpp
@@ -893,6 +893,16 @@ void GraphicsHelperGL3_3::disablePrimitiveRestart()
m_funcs->glDisable(GL_PRIMITIVE_RESTART);
}
+void GraphicsHelperGL3_3::pointSize(bool programmable, GLfloat value)
+{
+ if (programmable) {
+ m_funcs->glEnable(GL_PROGRAM_POINT_SIZE);
+ } else {
+ m_funcs->glDisable(GL_PROGRAM_POINT_SIZE);
+ m_funcs->glPointSize(value);
+ }
+}
+
QSize GraphicsHelperGL3_3::getRenderBufferDimensions(GLuint renderBufferId)
{
GLint width = 0;
diff --git a/src/render/graphicshelpers/graphicshelpergl3_3_p.h b/src/render/graphicshelpers/graphicshelpergl3_3_p.h
index 8dc0749a9..11344db63 100644
--- a/src/render/graphicshelpers/graphicshelpergl3_3_p.h
+++ b/src/render/graphicshelpers/graphicshelpergl3_3_p.h
@@ -105,6 +105,7 @@ public:
GLint maxClipPlaneCount() Q_DECL_OVERRIDE;
void enablePrimitiveRestart(int primitiveRestartIndex) Q_DECL_OVERRIDE;
void disablePrimitiveRestart() Q_DECL_OVERRIDE;
+ void pointSize(bool programmable, GLfloat value) Q_DECL_OVERRIDE;
QSize getRenderBufferDimensions(GLuint renderBufferId) Q_DECL_OVERRIDE;
QSize getTextureDimensions(GLuint textureId, GLenum target, uint level = 0) Q_DECL_OVERRIDE;
diff --git a/src/render/graphicshelpers/graphicshelpergl3_p.h b/src/render/graphicshelpers/graphicshelpergl3_p.h
index 92e921cfc..9297998fa 100644
--- a/src/render/graphicshelpers/graphicshelpergl3_p.h
+++ b/src/render/graphicshelpers/graphicshelpergl3_p.h
@@ -105,6 +105,7 @@ public:
GLint maxClipPlaneCount() Q_DECL_OVERRIDE;
void enablePrimitiveRestart(int primitiveRestartIndex) Q_DECL_OVERRIDE;
void disablePrimitiveRestart() Q_DECL_OVERRIDE;
+ void pointSize(bool programmable, GLfloat value) Q_DECL_OVERRIDE;
QSize getRenderBufferDimensions(GLuint renderBufferId) Q_DECL_OVERRIDE;
QSize getTextureDimensions(GLuint textureId, GLenum target, uint level = 0) Q_DECL_OVERRIDE;
diff --git a/src/render/graphicshelpers/graphicshelpergl4.cpp b/src/render/graphicshelpers/graphicshelpergl4.cpp
index fa95bfc8f..dfd09cafd 100644
--- a/src/render/graphicshelpers/graphicshelpergl4.cpp
+++ b/src/render/graphicshelpers/graphicshelpergl4.cpp
@@ -880,6 +880,16 @@ void GraphicsHelperGL4::disablePrimitiveRestart()
m_funcs->glDisable(GL_PRIMITIVE_RESTART);
}
+void GraphicsHelperGL4::pointSize(bool programmable, GLfloat value)
+{
+ if (programmable) {
+ m_funcs->glEnable(GL_PROGRAM_POINT_SIZE);
+ } else {
+ m_funcs->glDisable(GL_PROGRAM_POINT_SIZE);
+ m_funcs->glPointSize(value);
+ }
+}
+
QSize GraphicsHelperGL4::getRenderBufferDimensions(GLuint renderBufferId)
{
GLint width = 0;
diff --git a/src/render/graphicshelpers/graphicshelpergl4_p.h b/src/render/graphicshelpers/graphicshelpergl4_p.h
index 13c806629..b91653775 100644
--- a/src/render/graphicshelpers/graphicshelpergl4_p.h
+++ b/src/render/graphicshelpers/graphicshelpergl4_p.h
@@ -104,6 +104,7 @@ public:
GLint maxClipPlaneCount() Q_DECL_OVERRIDE;
void enablePrimitiveRestart(int primitiveRestartIndex) Q_DECL_OVERRIDE;
void disablePrimitiveRestart() Q_DECL_OVERRIDE;
+ void pointSize(bool programmable, GLfloat value) Q_DECL_OVERRIDE;
QSize getRenderBufferDimensions(GLuint renderBufferId) Q_DECL_OVERRIDE;
QSize getTextureDimensions(GLuint textureId, GLenum target, uint level = 0) Q_DECL_OVERRIDE;
diff --git a/src/render/graphicshelpers/graphicshelperinterface_p.h b/src/render/graphicshelpers/graphicshelperinterface_p.h
index 4a538274e..6fca95516 100644
--- a/src/render/graphicshelpers/graphicshelperinterface_p.h
+++ b/src/render/graphicshelpers/graphicshelperinterface_p.h
@@ -112,6 +112,7 @@ public:
virtual GLint maxClipPlaneCount() = 0;
virtual void enablePrimitiveRestart(int primitiveRestartIndex) = 0;
virtual void disablePrimitiveRestart() = 0;
+ virtual void pointSize(bool programmable, GLfloat value) = 0;
virtual QSize getRenderBufferDimensions(GLuint renderBufferId) = 0;
virtual QSize getTextureDimensions(GLuint textureId, GLenum target, uint level = 0) = 0;
};
diff --git a/src/render/renderstates/genericstate_p.h b/src/render/renderstates/genericstate_p.h
index 2f494b561..0b5c20433 100644
--- a/src/render/renderstates/genericstate_p.h
+++ b/src/render/renderstates/genericstate_p.h
@@ -77,7 +77,8 @@ enum StateMask
PolygonOffsetStateMask = 1 << 11,
ColorStateMask = 1 << 12,
ClipPlaneMask = 1 << 13,
- StencilOpMask = 1 << 14
+ StencilOpMask = 1 << 14,
+ PointSizeMask = 1 << 15
};
typedef quint64 StateMaskSet;
diff --git a/src/render/renderstates/qpointsize.cpp b/src/render/renderstates/qpointsize.cpp
new file mode 100644
index 000000000..69bb8c8e6
--- /dev/null
+++ b/src/render/renderstates/qpointsize.cpp
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qpointsize.h"
+#include "qrenderstate_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QPointSizePrivate : public QRenderStatePrivate
+{
+public:
+ QPointSizePrivate(QPointSize::Specification spec, float value)
+ : QRenderStatePrivate(QRenderState::PointSize)
+ , m_specification(spec)
+ , m_value(value)
+ {}
+
+ QPointSize::Specification m_specification;
+ float m_value;
+
+ Q_DECLARE_PUBLIC(QPointSize)
+};
+
+/*!
+ \class Qt3DRender::QPointSize
+ \inmodule Qt3DRender
+ \brief Specifies the size of rasterized points. May either be set statically
+ or by shader programs.
+
+ When using StaticValue, the value is set using glPointSize(), if available.
+ When using Programmable, gl_PointSize must be set within shader programs,
+ the value provided to this RenderState is ignored in that case.
+ */
+
+QPointSize::QPointSize(Qt3DCore::QNode *parent)
+ : QRenderState(*new QPointSizePrivate(Specification::Programmable, 0.f), parent)
+{
+}
+
+QPointSize::~QPointSize()
+{
+ QNode::cleanup();
+}
+
+QPointSize::Specification QPointSize::specification() const
+{
+ Q_D(const QPointSize);
+ return d->m_specification;
+}
+
+float QPointSize::value() const
+{
+ Q_D(const QPointSize);
+ return d->m_value;
+}
+
+bool QPointSize::isProgrammable() const
+{
+ return (specification() == QPointSize::Specification::Programmable);
+}
+
+void QPointSize::setSpecification(Specification spec)
+{
+ Q_D(QPointSize);
+ d->m_specification = spec;
+ emit specificationChanged(spec);
+}
+
+void QPointSize::setValue(float size)
+{
+ Q_D(QPointSize);
+ d->m_value = size;
+ emit valueChanged(size);
+}
+
+void QPointSize::copy(const Qt3DCore::QNode *ref)
+{
+ const QPointSize *refState = static_cast<const QPointSize *>(ref);
+
+ QRenderState::copy(ref);
+
+ Q_D(QPointSize);
+ d->m_value = refState->d_func()->m_value;
+ d->m_specification = refState->d_func()->m_specification;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
diff --git a/src/render/renderstates/qpointsize.h b/src/render/renderstates/qpointsize.h
new file mode 100644
index 000000000..716e61d54
--- /dev/null
+++ b/src/render/renderstates/qpointsize.h
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QT3DRENDER_QPOINTSIZE_H
+#define QT3DRENDER_QPOINTSIZE_H
+
+#include <Qt3DRender/qrenderstate.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QPointSizePrivate;
+
+class QT3DRENDERSHARED_EXPORT QPointSize : public QRenderState
+{
+ Q_OBJECT
+ Q_PROPERTY(Specification specification READ specification WRITE setSpecification NOTIFY specificationChanged)
+ Q_PROPERTY(float value READ value WRITE setValue NOTIFY valueChanged)
+
+public:
+ enum Specification {
+ StaticValue = 0,
+ Programmable = 1
+ };
+ Q_ENUM(Specification)
+
+ explicit QPointSize(Qt3DCore::QNode *parent = 0);
+ ~QPointSize();
+
+ Specification specification() const;
+ float value() const;
+ bool isProgrammable() const;
+
+public Q_SLOTS:
+ void setSpecification(Specification spec);
+ void setValue(float value);
+
+Q_SIGNALS:
+ void specificationChanged(Specification spec);
+ void valueChanged(float value);
+
+protected:
+ void copy(const Qt3DCore::QNode *ref) Q_DECL_FINAL;
+
+private:
+ Q_DECLARE_PRIVATE(QPointSize)
+ QT3D_CLONEABLE(QPointSize)
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QPOINTSIZE_H
diff --git a/src/render/renderstates/qrenderstate.h b/src/render/renderstates/qrenderstate.h
index dfe69c021..c40a11318 100644
--- a/src/render/renderstates/qrenderstate.h
+++ b/src/render/renderstates/qrenderstate.h
@@ -64,6 +64,7 @@ public:
DepthTest,
Dithering,
FrontFace,
+ PointSize,
PolygonOffset,
ScissorTest,
StencilTest,
diff --git a/src/render/renderstates/renderstates.cpp b/src/render/renderstates/renderstates.cpp
index 6016e590d..204803dc6 100644
--- a/src/render/renderstates/renderstates.cpp
+++ b/src/render/renderstates/renderstates.cpp
@@ -233,6 +233,21 @@ AlphaCoverage *AlphaCoverage::getOrCreate()
return getOrCreateImpl(AlphaCoverage());
}
+void PointSize::apply(GraphicsContext *gc) const
+{
+ gc->pointSize(m_1, m_2);
+}
+
+PointSize *PointSize::getOrCreate(bool programmable, GLfloat value)
+{
+ return getOrCreateImpl(PointSize(programmable, value));
+}
+
+PointSize::PointSize(bool programmable, GLfloat value)
+ : GenericState2<PointSize, bool, GLfloat>(programmable, value)
+{
+}
+
void PolygonOffset::apply(GraphicsContext *gc) const
{
gc->openGLContext()->functions()->glEnable(GL_POLYGON_OFFSET_FILL);
diff --git a/src/render/renderstates/renderstates.pri b/src/render/renderstates/renderstates.pri
index dc5684230..554a0e666 100644
--- a/src/render/renderstates/renderstates.pri
+++ b/src/render/renderstates/renderstates.pri
@@ -23,7 +23,8 @@ HEADERS += \
$$PWD/qstenciltest.h \
$$PWD/qstenciltestseparate.h \
$$PWD/renderstates_p.h \
- $$PWD/renderstateset_p.h
+ $$PWD/renderstateset_p.h \
+ $$PWD/qpointsize.h
SOURCES += \
@@ -47,4 +48,5 @@ SOURCES += \
$$PWD/qstenciltest.cpp \
$$PWD/qstenciltestseparate.cpp \
$$PWD/renderstates.cpp \
- $$PWD/renderstateset.cpp
+ $$PWD/renderstateset.cpp \
+ $$PWD/qpointsize.cpp
diff --git a/src/render/renderstates/renderstates_p.h b/src/render/renderstates/renderstates_p.h
index 055f0cb11..e2fada4ea 100644
--- a/src/render/renderstates/renderstates_p.h
+++ b/src/render/renderstates/renderstates_p.h
@@ -219,6 +219,19 @@ private:
AlphaCoverage();
};
+class Q_AUTOTEST_EXPORT PointSize : public GenericState2<PointSize, bool, GLfloat>
+{
+public:
+ void apply(GraphicsContext *gc) const Q_DECL_OVERRIDE;
+ StateMaskSet mask() const Q_DECL_OVERRIDE
+ { return PointSizeMask; }
+
+ static PointSize *getOrCreate(bool programmable, GLfloat value);
+
+private:
+ PointSize(bool programmable, GLfloat value);
+};
+
class Q_AUTOTEST_EXPORT PolygonOffset : public GenericState2<PolygonOffset, GLfloat, GLfloat>
{
public:
diff --git a/src/render/renderstates/renderstateset.cpp b/src/render/renderstates/renderstateset.cpp
index faf40302d..1d2520177 100644
--- a/src/render/renderstates/renderstateset.cpp
+++ b/src/render/renderstates/renderstateset.cpp
@@ -55,6 +55,7 @@
#include <Qt3DRender/qdepthtest.h>
#include <Qt3DRender/qdithering.h>
#include <Qt3DRender/qfrontface.h>
+#include <Qt3DRender/qpointsize.h>
#include <Qt3DRender/qpolygonoffset.h>
#include <Qt3DRender/qscissortest.h>
#include <Qt3DRender/qstenciltest.h>
@@ -210,6 +211,10 @@ void RenderStateSet::resetMasked(StateMaskSet maskOfStatesToReset, GraphicsConte
gc->disableAlphaCoverage();
}
+ if (maskOfStatesToReset & PointSizeMask) {
+ gc->pointSize(false, 1.0f); // reset to default
+ }
+
if (maskOfStatesToReset & PolygonOffsetStateMask) {
funcs->glDisable(GL_POLYGON_OFFSET_FILL);
}
@@ -295,6 +300,10 @@ RenderState *RenderState::getOrCreateBackendState(QRenderState *renderState)
case QRenderState::AlphaCoverage: {
return AlphaCoverage::getOrCreate();
}
+ case QRenderState::PointSize: {
+ QPointSize *pointSize = static_cast<QPointSize *>(renderState);
+ return PointSize::getOrCreate(pointSize->isProgrammable(), pointSize->value());
+ }
case QRenderState::PolygonOffset: {
QPolygonOffset *polygonOffset = static_cast<QPolygonOffset *>(renderState);
return PolygonOffset::getOrCreate(polygonOffset->factor(),
diff --git a/tools/utils/qtcreator/README b/tools/utils/qtcreator/README
new file mode 100644
index 000000000..d732f30f5
--- /dev/null
+++ b/tools/utils/qtcreator/README
@@ -0,0 +1,5 @@
+This directory contains some templates for use with QtCreator. Install them
+into your QtCreator's respective directory by symlinking or copying into
+place. E.g.:
+
+ln -s templates/wizards/classes/qt3d $QTCREATOR/share/qtcreator/templates/wizards/classes/qt3d
diff --git a/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.cpp b/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.cpp
new file mode 100644
index 000000000..03d99bdbc
--- /dev/null
+++ b/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.cpp
@@ -0,0 +1,42 @@
+%{Cpp:LicenseTemplate}\
+#include "%{HdrFileName}"
+#include "%{PrivateHdrFileName}"
+
+QT_BEGIN_NAMESPACE
+%{JS: Cpp.openNamespaces('%{Class}')}
+@if '%{Base}' === 'QNode' || '%{Base}' === 'QComponent' || '%{Base}' === 'QEntity'
+%{CN}Private::%{CN}Private()
+ : Qt3DCore::%{Base}Private()
+{
+}
+
+%{CN}::%{CN}(Qt3DCore::QNode *parent)
+ : Qt3DCore::%{Base}(*new %{CN}Private, parent)
+{
+}
+
+%{CN}::%{CN}(%{CN}Private &dd, Qt3DCore::QNode *parent)
+ : Qt3DCore::%{Base}(dd, parent)
+{
+}
+
+%{CN}::~%{CN}()
+{
+ QNode::cleanup();
+}
+@else
+// TODO: Implement QBackendNode template
+@endif
+
+@if '%{Base}' === 'QNode' || '%{Base}' === 'QComponent' || '%{Base}' === 'QEntity'
+void %{CN}::copy(const QNode *ref)
+{
+ %{Base}::copy(ref);
+ const %{CN} *object = static_cast<const %{CN} *>(ref);
+
+ // TODO: Copy the objects's members
+}
+@endif
+%{JS: Cpp.closeNamespaces('%{Class}')}\
+
+QT_END_NAMESPACE
diff --git a/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.h b/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.h
new file mode 100644
index 000000000..050e58ce5
--- /dev/null
+++ b/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.h
@@ -0,0 +1,54 @@
+%{Cpp:LicenseTemplate}\
+#ifndef %{GUARD}
+#define %{GUARD}
+
+@if '%{Base}' === 'QNode'
+#include <Qt3DCore/qnode.h>
+@elsif '%{Base}' === 'QComponent'
+#include <Qt3DCore/qcomponent.h>
+@elsif '%{Base}' === 'QEntity'
+#include <Qt3DCore/qentity.h>
+@elsif '%{Base}' === 'QBackendNode'
+#include <Qt3DCore/qbackendnode.h>
+@endif
+
+QT_BEGIN_NAMESPACE
+%{JS: Cpp.openNamespaces('%{Class}')}
+class %{CN}Private;
+
+@if '%{Base}'
+class %{CN} : public Qt3DCore::%{Base}
+@else
+class %{CN}
+@endif
+{
+@if %{isQObject}
+ Q_OBJECT
+ // TODO: Add property declarations
+@endif
+public:
+@if '%{Base}' === 'QNode' || '%{Base}' === 'QComponent' || '%{Base}' === 'QEntity'
+ explicit %{CN}(Qt3DCore::QNode *parent = 0);
+@else
+ %{CN}();
+@endif
+ ~%{CN}();
+
+public Q_SLOTS:
+
+Q_SIGNALS:
+
+@if '%{Base}' === 'QNode' || '%{Base}' === 'QComponent' || '%{Base}' === 'QEntity'
+protected:
+ Q_DECLARE_PRIVATE(%{CN})
+ %{CN}(%{CN}Private &dd, Qt3DCore::QNode *parent = 0);
+ void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+
+private:
+ QT3D_CLONEABLE(%{CN})
+@endif
+};
+%{JS: Cpp.closeNamespaces('%{Class}')}
+QT_END_NAMESPACE
+
+#endif // %{GUARD}\
diff --git a/tools/utils/qtcreator/templates/wizards/classes/qt3d/file_p.h b/tools/utils/qtcreator/templates/wizards/classes/qt3d/file_p.h
new file mode 100644
index 000000000..420f2edef
--- /dev/null
+++ b/tools/utils/qtcreator/templates/wizards/classes/qt3d/file_p.h
@@ -0,0 +1,39 @@
+%{Cpp:LicenseTemplate}\
+#ifndef %{PRIVATEGUARD}
+#define %{PRIVATEGUARD}
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+@if '%{Base}' === 'QNode'
+#include <Qt3DCore/private/qnode_p.h>
+@elsif '%{Base}' === 'QComponent'
+#include <Qt3DCore/private/qcomponent_p.h>
+@elsif '%{Base}' === 'QEntity'
+#include <Qt3DCore/private/qentity_p.h>
+@elsif '%{Base}' === 'QBackendNode'
+#include <Qt3DCore/private/qbackendnode_p.h>
+@endif
+
+QT_BEGIN_NAMESPACE
+%{JS: Cpp.openNamespaces('%{Class}')}
+class %{CN}Private : public Qt3DCore::%{Base}Private
+{
+public:
+ %{CN}Private();
+
+
+};
+%{JS: Cpp.closeNamespaces('%{Class}')}
+
+QT_END_NAMESPACE
+
+#endif // %{PRIVATEGUARD}\
diff --git a/tools/utils/qtcreator/templates/wizards/classes/qt3d/wizard.json b/tools/utils/qtcreator/templates/wizards/classes/qt3d/wizard.json
new file mode 100644
index 000000000..de7053d08
--- /dev/null
+++ b/tools/utils/qtcreator/templates/wizards/classes/qt3d/wizard.json
@@ -0,0 +1,138 @@
+{
+ "version": 1,
+ "kind": "file",
+ "id": "D.Qt3DClass",
+ "category": "O.C++",
+ "trDescription": "Creates a Qt3D class consisting of a C++ header, source file and private header for a new component that you can add to a C++ project.",
+ "trDisplayName": "Qt3D Class",
+ "trDisplayCategory": "C++",
+ "icon": "../../global/genericfilewizard.png",
+ "enabled": "%{JS: [ %{Plugins} ].indexOf('CppEditor') >= 0}",
+
+ "options":
+ [
+ { "key": "TargetPath", "value": "%{Path}" },
+ { "key": "HdrPath", "value": "%{Path}/%{HdrFileName}" },
+ { "key": "PrivateHdrPath", "value": "%{Path}/%{PrivateHdrFileName}" },
+ { "key": "SrcPath", "value": "%{Path}/%{SrcFileName}" },
+ { "key": "CN", "value": "%{JS: Cpp.className('%{Class}')}" },
+ { "key": "Base", "value": "%{JS: ( '%{BaseCB}' === '' ) ? '%{BaseEdit}' : '%{BaseCB}'}" },
+ { "key": "isQObject", "value": "%{JS: [ 'QNode', 'QComponent', 'QEntity'].indexOf('%{Base}') >= 0 }" },
+ { "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}" },
+ { "key": "PRIVATEGUARD", "value": "%{JS: Cpp.classToHeaderGuard('%{Class}' + '_P', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}" },
+ { "key": "SharedDataInit", "value": "%{JS: ('%{IncludeQSharedData}') ? 'data(new %{CN}Data)' : '' }" },
+ { "key": "IncludeQNode", "value": "%{JS: '%{BaseCB}' === 'QNode'}" },
+ { "key": "IncludeQComponent", "value": "%{JS: '%{BaseCB}' === 'QComponent'}" },
+ { "key": "IncludeQEntity", "value": "%{JS: '%{BaseCB}' === 'QEntity'}" },
+ { "key": "IncludeQBackendNode", "value": "%{JS: '%{BaseCB}' === 'QBackendNode'}" }
+ ],
+
+ "pages":
+ [
+ {
+ "trDisplayName": "Define Qt3D Class",
+ "trShortTitle": "Details",
+ "typeId": "Fields",
+ "data" :
+ [
+ {
+ "name": "Class",
+ "trDisplayName": "Class name:",
+ "mandatory": true,
+ "type": "LineEdit",
+ "data": { "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)+[a-zA-Z_][a-zA-Z_0-9]*|)" }
+ },
+ {
+ "name": "BaseCB",
+ "trDisplayName": "Base class:",
+ "type": "ComboBox",
+ "data":
+ {
+ "items": [ { "trKey": "<Custom>", "value": "" },
+ "QQNode", "QComponent", "QEntity", "QBackendNode" ]
+ }
+ },
+ {
+ "name": "BaseEdit",
+ "type": "LineEdit",
+ "enabled": "%{JS: '%{BaseCB}' === ''}",
+ "mandatory": false,
+ "data":
+ {
+ "trText": "%{BaseCB}",
+ "trDisabledText": "%{BaseCB}"
+ }
+ },
+
+ {
+ "name": "Sp1",
+ "type": "Spacer",
+ "data": { "factor": 2 }
+ },
+ {
+ "name": "HdrFileName",
+ "type": "LineEdit",
+ "trDisplayName": "Header file:",
+ "mandatory": true,
+ "data": { "trText": "%{JS: Cpp.classToFileName('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}" }
+ },
+ {
+ "name": "PrivateHdrFileName",
+ "type": "LineEdit",
+ "trDisplayName": "Private header file:",
+ "mandatory": true,
+ "data": { "trText": "%{JS: Cpp.classToFileName('%{Class}' + '_p', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}" }
+ },
+ {
+ "name": "SrcFileName",
+ "type": "LineEdit",
+ "trDisplayName": "Source file:",
+ "mandatory": true,
+ "data": { "trText": "%{JS: Cpp.classToFileName('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++src')}')}" }
+ },
+ {
+ "name": "Path",
+ "type": "PathChooser",
+ "trDisplayName": "Path:",
+ "mandatory": true,
+ "data":
+ {
+ "kind": "existingDirectory",
+ "basePath": "%{InitialPath}",
+ "path": "%{InitialPath}"
+ }
+ }
+ ]
+ },
+ {
+ "trDisplayName": "Project Management",
+ "trShortTitle": "Summary",
+ "typeId": "Summary"
+ }
+ ],
+
+ "generators":
+ [
+ {
+ "typeId": "File",
+ "data":
+ [
+ {
+ "source": "file.h",
+ "target": "%{HdrPath}",
+ "openInEditor": true
+ },
+ {
+ "source": "file_p.h",
+ "target": "%{PrivateHdrPath}",
+ "openInEditor": true
+ },
+ {
+ "source": "file.cpp",
+ "target": "%{SrcPath}",
+ "openInEditor": true
+ }
+ ]
+ }
+ ]
+}