summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2015-08-31 15:14:17 +0100
committerSean Harmer <sean.harmer@kdab.com>2015-10-13 07:15:15 +0000
commitaf40840eedf35404ba4b39e890c158e2328ff6ec (patch)
treece4ac1f925c34b56704c99bd332e0436e68dbecc /src/plugins
parent0269afd106da5d4d999585b3bdb1332a2c01af12 (diff)
Move Render aspect into the Qt3DRender namespace
Updated examples and tests accordingly. Change-Id: I8848a88472de2302aa072fa11f21ea934672b7e6 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/sceneparsers/assimp/assimphelpers.cpp8
-rw-r--r--src/plugins/sceneparsers/assimp/assimphelpers_p.h6
-rw-r--r--src/plugins/sceneparsers/assimp/assimpparser.cpp26
-rw-r--r--src/plugins/sceneparsers/assimp/assimpparser_p.h15
-rw-r--r--src/plugins/sceneparsers/gltf/gltfparser.cpp22
-rw-r--r--src/plugins/sceneparsers/gltf/gltfparser_p.h21
6 files changed, 54 insertions, 44 deletions
diff --git a/src/plugins/sceneparsers/assimp/assimphelpers.cpp b/src/plugins/sceneparsers/assimp/assimphelpers.cpp
index 345bb79bc..7d7c93266 100644
--- a/src/plugins/sceneparsers/assimp/assimphelpers.cpp
+++ b/src/plugins/sceneparsers/assimp/assimphelpers.cpp
@@ -44,10 +44,10 @@
QT_BEGIN_NAMESPACE
-namespace Qt3D {
+namespace Qt3DRender {
namespace AssimpHelper {
/*!
- * \class Qt3D::AssimpHelper::AssimpIOStream
+ * \class Qt3DRender::AssimpHelper::AssimpIOStream
*
* \internal
*
@@ -222,7 +222,7 @@ void AssimpIOSystem::Close(Assimp::IOStream *pFile)
delete pFile;
}
-} // AssimpHelper namespace
-} // Qt3D namespace
+} // namespace AssimpHelper
+} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/plugins/sceneparsers/assimp/assimphelpers_p.h b/src/plugins/sceneparsers/assimp/assimphelpers_p.h
index 53f6d22ef..5ac1019e4 100644
--- a/src/plugins/sceneparsers/assimp/assimphelpers_p.h
+++ b/src/plugins/sceneparsers/assimp/assimphelpers_p.h
@@ -46,7 +46,7 @@
QT_BEGIN_NAMESPACE
-namespace Qt3D {
+namespace Qt3DRender {
namespace AssimpHelper {
//CUSTOM FILE STREAM
@@ -82,8 +82,8 @@ private:
QMap<QByteArray, QIODevice::OpenMode> m_openModeMaps;
};
-} // AssimpHelper namespace
-} // Qt3D namespace
+} // namespace AssimpHelper
+} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/plugins/sceneparsers/assimp/assimpparser.cpp b/src/plugins/sceneparsers/assimp/assimpparser.cpp
index 50feb4b83..63a4f0b32 100644
--- a/src/plugins/sceneparsers/assimp/assimpparser.cpp
+++ b/src/plugins/sceneparsers/assimp/assimpparser.cpp
@@ -61,10 +61,12 @@
QT_BEGIN_NAMESPACE
-namespace Qt3D {
+using namespace Qt3D;
+
+namespace Qt3DRender {
/*!
- \class Qt3D::AssimpParser
+ \class Qt3DRender::AssimpParser
\since 5.5
\brief Provides a generic way of loading various 3D assets
@@ -156,9 +158,9 @@ QString texturePath(const aiString &path)
}
/*!
- * Returns the Qt3D::QParameter with named \a name if contained by the material
+ * Returns the Qt3DRender::QParameter with named \a name if contained by the material
* \a material. If the material doesn't contain the named parameter, a new
- * Qt3D::QParameter is created and inserted into the material.
+ * Qt3DRender::QParameter is created and inserted into the material.
*/
QParameter *findNamedParameter(const QString &name, QMaterial *material)
{
@@ -318,7 +320,7 @@ bool AssimpParser::isAssimpPath(const QString &path)
*/
void AssimpParser::setSource(const QUrl &source)
{
- const QString path = QUrlHelper::urlToLocalFileOrQrc(source);
+ const QString path = Qt3D::QUrlHelper::urlToLocalFileOrQrc(source);
QFileInfo file(path);
m_sceneDir = file.absoluteDir();
if (!file.exists()) {
@@ -334,7 +336,7 @@ void AssimpParser::setSource(const QUrl &source)
*/
bool AssimpParser::isExtensionSupported(const QUrl &source) const
{
- const QString path = QUrlHelper::urlToLocalFileOrQrc(source);
+ const QString path = Qt3D::QUrlHelper::urlToLocalFileOrQrc(source);
return AssimpParser::isAssimpPath(path);
}
@@ -345,7 +347,7 @@ bool AssimpParser::isExtensionSupported(const QUrl &source) const
*
* Returns \c Q_NULLPTR if \a id was specified but no node matching it was found.
*/
-QEntity *AssimpParser::scene(const QString &id)
+Qt3D::QEntity *AssimpParser::scene(const QString &id)
{
// m_aiScene shouldn't be null.
// If it is either, the file failed to be imported or
@@ -370,7 +372,7 @@ QEntity *AssimpParser::scene(const QString &id)
* Returns a Node from the scene identified by \a id.
* Returns \c Q_NULLPTR if the node was not found.
*/
-QEntity *AssimpParser::node(const QString &id)
+Qt3D::QEntity *AssimpParser::node(const QString &id)
{
if (m_scene == Q_NULLPTR || m_scene->m_aiScene == Q_NULLPTR)
return Q_NULLPTR;
@@ -382,7 +384,7 @@ QEntity *AssimpParser::node(const QString &id)
/*!
* Returns a Node from an Assimp aiNode \a node.
*/
-QEntity *AssimpParser::node(aiNode *node)
+Qt3D::QEntity *AssimpParser::node(aiNode *node)
{
if (node == Q_NULLPTR)
return Q_NULLPTR;
@@ -413,7 +415,7 @@ QEntity *AssimpParser::node(aiNode *node)
// Add Transformations
const QMatrix4x4 qTransformMatrix = aiMatrix4x4ToQMatrix4x4(node->mTransformation);
- QTransform *transform = new QTransform(new QMatrixTransform(qTransformMatrix));
+ Qt3D::QTransform *transform = new Qt3D::QTransform(new QMatrixTransform(qTransformMatrix));
entityNode->addComponent(transform);
// Add Camera
@@ -722,7 +724,7 @@ void AssimpParser::loadCamera(uint cameraIndex)
assimpCamera->mClipPlaneFar);
camera->addComponent(lens);
- QTransform *transform = new QTransform();
+ Qt3D::QTransform *transform = new Qt3D::QTransform();
QLookAtTransform *lookAt = new QLookAtTransform();
lookAt->setPosition(QVector3D(assimpCamera->mPosition.x, assimpCamera->mPosition.y, assimpCamera->mPosition.z));
lookAt->setViewCenter(QVector3D(assimpCamera->mLookAt.x, assimpCamera->mLookAt.y, assimpCamera->mLookAt.z));
@@ -920,7 +922,7 @@ AssimpParser::SceneImporter::~SceneImporter()
delete m_importer;
}
-} // namespace Qt3D
+} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/plugins/sceneparsers/assimp/assimpparser_p.h b/src/plugins/sceneparsers/assimp/assimpparser_p.h
index 250cb9ec3..89fbb5c89 100644
--- a/src/plugins/sceneparsers/assimp/assimpparser_p.h
+++ b/src/plugins/sceneparsers/assimp/assimpparser_p.h
@@ -54,11 +54,14 @@ QT_BEGIN_NAMESPACE
class QFile;
namespace Qt3D {
+class QCamera;
+}
+
+namespace Qt3DRender {
class QMaterial;
class QShaderProgram;
class QEffect;
-class QCamera;
class QAbstractTextureProvider;
class QMesh;
class QGeometryRenderer;
@@ -77,14 +80,14 @@ public:
// SceneParserInterface interface
void setSource(const QUrl& source) Q_DECL_OVERRIDE;
bool isExtensionSupported(const QUrl &source) const Q_DECL_OVERRIDE;
- QEntity *scene(const QString &id = QString()) Q_DECL_OVERRIDE;
- QEntity *node(const QString &id) Q_DECL_OVERRIDE;
+ Qt3D::QEntity *scene(const QString &id = QString()) Q_DECL_OVERRIDE;
+ Qt3D::QEntity *node(const QString &id) Q_DECL_OVERRIDE;
private:
static bool isAssimpPath(const QString &path);
static QStringList assimpSupportedFormats();
- QEntity *node(aiNode *node);
+ Qt3D::QEntity *node(aiNode *node);
void readSceneFile(const QString &file);
@@ -120,7 +123,7 @@ private:
QMap<uint, QEffect *> m_effects;
QMap<uint, QAbstractTextureProvider *> m_embeddedTextures;
QMap<QString, QAbstractTextureProvider *> m_materialTextures;
- QMap<aiNode*, QEntity*> m_cameras;
+ QMap<aiNode*, Qt3D::QEntity*> m_cameras;
QHash<aiTextureType, QString> m_textureToParameterName;
// QMap<aiNode*, Light*> m_lights;
};
@@ -131,7 +134,7 @@ private:
static QStringList assimpSupportedFormatsList;
};
-} // namespace Qt3D
+} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/plugins/sceneparsers/gltf/gltfparser.cpp b/src/plugins/sceneparsers/gltf/gltfparser.cpp
index 762760a77..a32dd7f45 100644
--- a/src/plugins/sceneparsers/gltf/gltfparser.cpp
+++ b/src/plugins/sceneparsers/gltf/gltfparser.cpp
@@ -75,7 +75,9 @@
QT_BEGIN_NAMESPACE
-namespace Qt3D {
+using namespace Qt3D;
+
+namespace Qt3DRender {
Q_LOGGING_CATEGORY(GLTFParserLog, "Qt3D.GLTFParser")
@@ -183,7 +185,7 @@ bool GLTFParser::setJSON(const QJsonDocument &json )
*/
void GLTFParser::setSource(const QUrl &source)
{
- const QString path = QUrlHelper::urlToLocalFileOrQrc(source);
+ const QString path = Qt3D::QUrlHelper::urlToLocalFileOrQrc(source);
QFileInfo finfo(path);
if (!finfo.exists()) {
qCWarning(GLTFParserLog) << "missing file:" << path;
@@ -211,11 +213,11 @@ void GLTFParser::setSource(const QUrl &source)
*/
bool GLTFParser::isExtensionSupported(const QUrl &source) const
{
- const QString path = QUrlHelper::urlToLocalFileOrQrc(source);
+ const QString path = Qt3D::QUrlHelper::urlToLocalFileOrQrc(source);
return GLTFParser::isGLTFPath(path);
}
-QEntity* GLTFParser::node(const QString &id)
+Qt3D::QEntity* GLTFParser::node(const QString &id)
{
QJsonObject nodes = m_json.object().value(KEY_NODES).toObject();
if (!nodes.contains(id)) {
@@ -282,7 +284,7 @@ QEntity* GLTFParser::node(const QString &id)
}
// ADD MATRIX TRANSFORM COMPONENT TO ENTITY
- QTransform *trans = new QTransform();
+ Qt3D::QTransform *trans = new Qt3D::QTransform();
trans->addTransform(new QMatrixTransform(m));
result->addComponent(trans);
}
@@ -300,7 +302,7 @@ QEntity* GLTFParser::node(const QString &id)
return result;
}
-QEntity* GLTFParser::scene(const QString &id)
+Qt3D::QEntity* GLTFParser::scene(const QString &id)
{
parse();
@@ -457,7 +459,7 @@ QParameter *GLTFParser::parameterFromTechnique(QTechnique *technique, const QStr
return Q_NULLPTR;
}
-QEntity* GLTFParser::defaultScene()
+Qt3D::QEntity* GLTFParser::defaultScene()
{
if (m_defaultScene.isEmpty()) {
qCWarning(GLTFParserLog) << Q_FUNC_INFO << "no default scene";
@@ -776,8 +778,8 @@ void GLTFParser::processJSONProgram(const QString &id, const QJsonObject &jsonOb
return;
}
- prog->setFragmentShaderCode(Qt3D::QShaderProgram::loadSource(QUrl::fromLocalFile(m_shaderPaths[fragName])));
- prog->setVertexShaderCode(Qt3D::QShaderProgram::loadSource(QUrl::fromLocalFile(m_shaderPaths[vertName])));
+ prog->setFragmentShaderCode(QShaderProgram::loadSource(QUrl::fromLocalFile(m_shaderPaths[fragName])));
+ prog->setVertexShaderCode(QShaderProgram::loadSource(QUrl::fromLocalFile(m_shaderPaths[vertName])));
m_programs[id] = prog;
}
@@ -1407,6 +1409,6 @@ QRenderState* GLTFParser::buildState(const QString& functionName, const QJsonVal
return Q_NULLPTR;
}
-} // namespace Qt3D
+} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/plugins/sceneparsers/gltf/gltfparser_p.h b/src/plugins/sceneparsers/gltf/gltfparser_p.h
index 73048bebd..4b9c238c0 100644
--- a/src/plugins/sceneparsers/gltf/gltfparser_p.h
+++ b/src/plugins/sceneparsers/gltf/gltfparser_p.h
@@ -51,17 +51,20 @@ QT_BEGIN_NAMESPACE
class QFile;
namespace Qt3D {
+class QCamera;
+class QCameraLens;
+class QEntity;
+}
+
+namespace Qt3DRender {
class QMaterial;
class QShaderProgram;
class QEffect;
-class QCamera;
-class QCameraLens;
class QAbstractTextureProvider;
class QRenderState;
class QTechnique;
class QParameter;
-class QEntity;
class QGeometryRenderer;
Q_DECLARE_LOGGING_CATEGORY(GLTFParserLog)
@@ -81,8 +84,8 @@ public:
// SceneParserInterface interface
void setSource(const QUrl &source) Q_DECL_FINAL;
bool isExtensionSupported(const QUrl &source) const Q_DECL_FINAL;
- QEntity *node(const QString &id) Q_DECL_FINAL;
- QEntity *scene(const QString &id = QString()) Q_DECL_FINAL;
+ Qt3D::QEntity *node(const QString &id) Q_DECL_FINAL;
+ Qt3D::QEntity *scene(const QString &id = QString()) Q_DECL_FINAL;
private:
class BufferData
@@ -128,9 +131,9 @@ private:
static QString standardAttributeNameFromSemantic(const QString &semantic);
static QParameter *parameterFromTechnique(QTechnique *technique, const QString &parameterName);
- QEntity *defaultScene();
+ Qt3D::QEntity *defaultScene();
QMaterial *material(const QString &id);
- QCameraLens *camera(const QString &id) const;
+ Qt3D::QCameraLens *camera(const QString &id) const;
void parse();
void cleanup();
@@ -151,7 +154,7 @@ private:
QFile* resolveLocalData(QString path) const;
QVariant parameterValueFromJSON(int type, const QJsonValue &value) const;
- static QAbstractAttribute::DataType accessorTypeFromJSON(int componentType);
+ static Qt3D::QAbstractAttribute::DataType accessorTypeFromJSON(int componentType);
static uint accessorDataSizeFromJson(const QString &type);
static QRenderState *buildStateEnable(int state);
@@ -187,7 +190,7 @@ private:
QMap<QString, QString> m_imagePaths;
};
-} // namespace Qt3D
+} // namespace Qt3DRender
QT_END_NAMESPACE