From 0972d9b6adce9de5a6a3c614d760a871ba28c8ad Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Mon, 30 Jun 2014 15:51:27 +0200 Subject: Renamed Material to QMaterial Change-Id: I6a3a980411a31ab26dd17a8bc2aa65f67a5209ea Reviewed-by: Sean Harmer --- src/render/backend/materialmanager.cpp | 2 +- src/render/backend/materialmanager.h | 12 +-- src/render/backend/renderer.cpp | 4 +- src/render/backend/renderer.h | 10 +-- src/render/backend/rendermaterial.cpp | 4 +- src/render/backend/rendermaterial.h | 8 +- src/render/backend/renderscenebuilder.cpp | 6 +- src/render/backend/renderview.cpp | 2 +- src/render/frontend/material.cpp | 127 ------------------------------ src/render/frontend/material.h | 89 --------------------- src/render/frontend/qmaterial.cpp | 126 +++++++++++++++++++++++++++++ src/render/frontend/qmaterial.h | 89 +++++++++++++++++++++ src/render/frontend/render-frontend.pri | 4 +- src/render/io/assimpparser.cpp | 18 ++--- src/render/io/assimpparser.h | 20 ++--- src/render/io/gltfparser.cpp | 6 +- src/render/io/gltfparser.h | 6 +- 17 files changed, 266 insertions(+), 267 deletions(-) delete mode 100644 src/render/frontend/material.cpp delete mode 100644 src/render/frontend/material.h create mode 100644 src/render/frontend/qmaterial.cpp create mode 100644 src/render/frontend/qmaterial.h (limited to 'src/render') diff --git a/src/render/backend/materialmanager.cpp b/src/render/backend/materialmanager.cpp index 91a982d96..d59f69469 100644 --- a/src/render/backend/materialmanager.cpp +++ b/src/render/backend/materialmanager.cpp @@ -48,7 +48,7 @@ namespace Qt3D { namespace Render { MaterialManager::MaterialManager() : - QResourcesManager() + QResourcesManager() { } diff --git a/src/render/backend/materialmanager.h b/src/render/backend/materialmanager.h index 3d6e4d69e..b4f817281 100644 --- a/src/render/backend/materialmanager.h +++ b/src/render/backend/materialmanager.h @@ -51,22 +51,22 @@ QT_BEGIN_NAMESPACE namespace Qt3D { -class Material; +class QMaterial; namespace Render { typedef QHandle HMaterial; -class MaterialManager : public QResourcesManager +class MaterialManager : public QResourcesManager { public: MaterialManager(); inline bool hasRenderMaterial(const QUuid &id) const { return m_materialByEntity.contains(id); } - inline bool hasRenderMaterial(Material *id) { return contains(id); } - inline RenderMaterial *getOrCreateRenderMaterial(Material *id) { return getOrCreateResource(id); } - inline RenderMaterial *renderMaterial(Material *id) { return lookupResource(id); } - inline void releaseRenderMaterial(Material *id) { releaseResource(id); } + inline bool hasRenderMaterial(QMaterial *id) { return contains(id); } + inline RenderMaterial *getOrCreateRenderMaterial(QMaterial *id) { return getOrCreateResource(id); } + inline RenderMaterial *renderMaterial(QMaterial *id) { return lookupResource(id); } + inline void releaseRenderMaterial(QMaterial *id) { releaseResource(id); } RenderMaterial *renderMaterial(const QUuid &id); void linkMaterialToEntity(const QUuid &id, HMaterial material); diff --git a/src/render/backend/renderer.cpp b/src/render/backend/renderer.cpp index 680e9ba74..67838bbd1 100644 --- a/src/render/backend/renderer.cpp +++ b/src/render/backend/renderer.cpp @@ -52,7 +52,7 @@ #include "jobs/renderviewjob.h" -#include +#include #include #include #include @@ -205,7 +205,7 @@ void Renderer::buildDefaultTechnique() void Renderer::buildDefaultMaterial() { - m_defaultMaterial = new Material(); + m_defaultMaterial = new QMaterial(); m_defaultMaterial->setObjectName(QStringLiteral("DefaultMaterial")); m_defaultMaterial->addParameter(new Parameter(m_defaultMaterial, QStringLiteral("lightPos"), QVector4D(10.0f, 10.0f, 0.0f, 1.0f))); m_defaultMaterial->addParameter(new Parameter(m_defaultMaterial, QStringLiteral("lightIntensity"), QVector3D(0.5f, 0.5f, 0.5f))); diff --git a/src/render/backend/renderer.h b/src/render/backend/renderer.h index 9a626a674..dca2b4076 100644 --- a/src/render/backend/renderer.h +++ b/src/render/backend/renderer.h @@ -67,7 +67,7 @@ namespace Qt3D { class Camera; class Entity; -class Material; +class QMaterial; class ShaderProgram; class QMesh; class RenderPass; @@ -157,7 +157,7 @@ public: inline int cachedFramesCount() const { return m_cachedFramesCount; } - void buildMeshes(QMesh *mesh, Material *mat, const QMatrix4x4& mm); + void buildMeshes(QMesh *mesh, QMaterial *mat, const QMatrix4x4& mm); void setSurface(QSurface *s); void enqueueRenderView(RenderView *renderView, int submitOrder); @@ -178,15 +178,15 @@ private: Qt3D::Node *m_sceneGraphRoot; RenderNode *m_renderSceneRoot; - QHash m_materialHash; + QHash m_materialHash; QHash m_techniqueHash; QHash m_shaderHash; RenderTechnique *createTechnique(Technique *tech); RenderShader *getOrCreateShader(ShaderProgram *sp); - RenderMaterial *getOrCreateMaterial(Material *mat); + RenderMaterial *getOrCreateMaterial(QMaterial *mat); - Material* m_defaultMaterial; + QMaterial* m_defaultMaterial; Technique* m_defaultTechnique; HMaterial m_defaultMaterialHandle; diff --git a/src/render/backend/rendermaterial.cpp b/src/render/backend/rendermaterial.cpp index 2fb97e23c..697cbbbec 100644 --- a/src/render/backend/rendermaterial.cpp +++ b/src/render/backend/rendermaterial.cpp @@ -47,7 +47,7 @@ #include "rendertextureprovider.h" #include "parameter.h" #include // for Parameter -#include +#include #include #include @@ -72,7 +72,7 @@ RenderMaterial::~RenderMaterial() m_rendererAspect->aspectManager()->changeArbiter()->unregisterObserver(this, m_peer); } -void RenderMaterial::setPeer(Material *mat) +void RenderMaterial::setPeer(QMaterial *mat) { if (m_peer != mat) { QChangeArbiter *arbiter = m_rendererAspect->aspectManager()->changeArbiter(); diff --git a/src/render/backend/rendermaterial.h b/src/render/backend/rendermaterial.h index 1c93d970d..f20dddfc1 100644 --- a/src/render/backend/rendermaterial.h +++ b/src/render/backend/rendermaterial.h @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE namespace Qt3D { -class Material; +class QMaterial; class RendererAspect; class Parameter; @@ -69,10 +69,10 @@ public: RenderMaterial(); ~RenderMaterial(); - void setPeer(Material* mat); + void setPeer(QMaterial* mat); void setRendererAspect(RendererAspect *rendererAspect); - Material *peer() const { return m_peer; } + QMaterial *peer() const { return m_peer; } void sceneChangeEvent(const QSceneChangePtr &e) Q_DECL_OVERRIDE; @@ -80,7 +80,7 @@ public: private: RendererAspect *m_rendererAspect; - Material* m_peer; + QMaterial* m_peer; QString m_effectName; RenderTechnique* m_technique; RenderTextureProvider* m_textureProvider; diff --git a/src/render/backend/renderscenebuilder.cpp b/src/render/backend/renderscenebuilder.cpp index 22826fee4..536f8b297 100644 --- a/src/render/backend/renderscenebuilder.cpp +++ b/src/render/backend/renderscenebuilder.cpp @@ -50,7 +50,7 @@ #include "renderlogging.h" #include "materialmanager.h" #include "qabstractscene.h" -#include +#include #include #include @@ -286,8 +286,8 @@ void RenderSceneBuilder::createRenderMaterial(Entity *entity) // Techniques // RenderPass // ShaderPrograms - QList materials = entity->componentsOfType(); - foreach (Material *material, materials) { + QList materials = entity->componentsOfType(); + foreach (QMaterial *material, materials) { HMaterial rMaterialHandle = m_renderer->materialManager()->getOrAcquireHandle(material); m_renderer->materialManager()->linkMaterialToEntity(entity->uuid(), rMaterialHandle); RenderMaterial *rMaterial = m_renderer->materialManager()->data(rMaterialHandle); diff --git a/src/render/backend/renderview.cpp b/src/render/backend/renderview.cpp index 3c61041a4..adb20bdf5 100644 --- a/src/render/backend/renderview.cpp +++ b/src/render/backend/renderview.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "renderview.h" -#include "material.h" +#include "qmaterial.h" #include "renderer.h" #include "rendercamera.h" #include "rendercommand.h" diff --git a/src/render/frontend/material.cpp b/src/render/frontend/material.cpp deleted file mode 100644 index 4e84d68c6..000000000 --- a/src/render/frontend/material.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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:LGPL$ -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 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 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "material.h" -//#include -#include -#include -#include "renderlogging.h" -#include "parameter.h" -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - -class MaterialPrivate -{ -public: - MaterialPrivate(Material *qq) - : q_ptr(qq) - {} - - QList m_parameters; - TextureDict m_textures; - Q_DECLARE_PUBLIC(Material) - Material *q_ptr; -}; - -Material::Material(Node *parent) - : QAbstractMaterial(parent) - , d_ptr(new MaterialPrivate(this)) -{ -} - -void Material::setEffect(QAbstractEffect *effect) -{ - if (effect == QAbstractMaterial::effect()) - return ; - QAbstractMaterial::setEffect(effect); - QScenePropertyChangePtr change(new QScenePropertyChange(ComponentUpdated, this)); - change->m_propertyName = QByteArrayLiteral("effect"); - change->m_value = QVariant::fromValue(QAbstractMaterial::effect()); - notifyObservers(change); -} - -void Material::addParameter(Parameter *parameter) -{ - Q_D(Material); - if (!d->m_parameters.contains(parameter)) { - d->m_parameters.append(parameter); - QScenePropertyChangePtr change(new QScenePropertyChange(ComponentAdded, this)); - change->m_propertyName = QByteArrayLiteral("parameter"); - change->m_value = QVariant::fromValue(parameter); - notifyObservers(change); - } -} - -void Material::removeParameter(Parameter *parameter) -{ - Q_D(Material); - d->m_parameters.removeOne(parameter); - QScenePropertyChangePtr change(new QScenePropertyChange(ComponentRemoved, this)); - change->m_propertyName = QByteArrayLiteral("parameter"); - change->m_value = QVariant::fromValue(parameter); - notifyObservers(change); -} - -QList Material::parameters() const -{ - Q_D(const Material); - return d->m_parameters; -} - -TextureDict Material::textureValues() const -{ - Q_D(const Material); - return d->m_textures; -} - -// TO DO: Check if this is really needed -void Material::setTextureParameter(QString name, Texture *tex) -{ - Q_D(Material); - d->m_textures[name] = tex; -} - -} // namespace Qt3D - -QT_END_NAMESPACE diff --git a/src/render/frontend/material.h b/src/render/frontend/material.h deleted file mode 100644 index 7d92fd760..000000000 --- a/src/render/frontend/material.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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:LGPL$ -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 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 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3D_MATERIAL_H -#define QT3D_MATERIAL_H - -#include - -#include -#include -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3D { - -class Texture; -class Parameter; -class MaterialPrivate; -typedef QMap TextureDict; - -class QT3DRENDERERSHARED_EXPORT Material : public QAbstractMaterial -{ - Q_OBJECT - -public: - explicit Material(Node *parent = 0); - - void setEffect(QAbstractEffect *effect) Q_DECL_OVERRIDE; - - void addParameter(Parameter *parameter); - void removeParameter(Parameter *parameter); - QList parameters() const; - - TextureDict textureValues() const; - - void setTextureParameter(QString name, Texture* tex); - -private: - Q_DECLARE_PRIVATE(Material) - MaterialPrivate *d_ptr; -}; - -} - -QT_END_NAMESPACE - -#endif // QT3D_MATERIAL_H diff --git a/src/render/frontend/qmaterial.cpp b/src/render/frontend/qmaterial.cpp new file mode 100644 index 000000000..8d6625f55 --- /dev/null +++ b/src/render/frontend/qmaterial.cpp @@ -0,0 +1,126 @@ +/**************************************************************************** +** +** Copyright (C) 2014 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:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmaterial.h" +#include +#include +#include "renderlogging.h" +#include "parameter.h" +#include + +QT_BEGIN_NAMESPACE + +namespace Qt3D { + +class QMaterialPrivate +{ +public: + QMaterialPrivate(QMaterial *qq) + : q_ptr(qq) + {} + + QList m_parameters; + TextureDict m_textures; + Q_DECLARE_PUBLIC(QMaterial) + QMaterial *q_ptr; +}; + +QMaterial::QMaterial(Node *parent) + : QAbstractMaterial(parent) + , d_ptr(new QMaterialPrivate(this)) +{ +} + +void QMaterial::setEffect(QAbstractEffect *effect) +{ + if (effect == QAbstractMaterial::effect()) + return ; + QAbstractMaterial::setEffect(effect); + QScenePropertyChangePtr change(new QScenePropertyChange(ComponentUpdated, this)); + change->m_propertyName = QByteArrayLiteral("effect"); + change->m_value = QVariant::fromValue(QAbstractMaterial::effect()); + notifyObservers(change); +} + +void QMaterial::addParameter(Parameter *parameter) +{ + Q_D(QMaterial); + if (!d->m_parameters.contains(parameter)) { + d->m_parameters.append(parameter); + QScenePropertyChangePtr change(new QScenePropertyChange(ComponentAdded, this)); + change->m_propertyName = QByteArrayLiteral("parameter"); + change->m_value = QVariant::fromValue(parameter); + notifyObservers(change); + } +} + +void QMaterial::removeParameter(Parameter *parameter) +{ + Q_D(QMaterial); + d->m_parameters.removeOne(parameter); + QScenePropertyChangePtr change(new QScenePropertyChange(ComponentRemoved, this)); + change->m_propertyName = QByteArrayLiteral("parameter"); + change->m_value = QVariant::fromValue(parameter); + notifyObservers(change); +} + +QList QMaterial::parameters() const +{ + Q_D(const QMaterial); + return d->m_parameters; +} + +TextureDict QMaterial::textureValues() const +{ + Q_D(const QMaterial); + return d->m_textures; +} + +// TO DO: Check if this is really needed +void QMaterial::setTextureParameter(QString name, Texture *tex) +{ + Q_D(QMaterial); + d->m_textures[name] = tex; +} + +} // namespace Qt3D + +QT_END_NAMESPACE diff --git a/src/render/frontend/qmaterial.h b/src/render/frontend/qmaterial.h new file mode 100644 index 000000000..c759c5790 --- /dev/null +++ b/src/render/frontend/qmaterial.h @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2014 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:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3D_QMATERIAL_H +#define QT3D_QMATERIAL_H + +#include + +#include +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +namespace Qt3D { + +class Texture; +class Parameter; +class QMaterialPrivate; +typedef QMap TextureDict; + +class QT3DRENDERERSHARED_EXPORT QMaterial : public QAbstractMaterial +{ + Q_OBJECT + +public: + explicit QMaterial(Node *parent = 0); + + void setEffect(QAbstractEffect *effect) Q_DECL_OVERRIDE; + + void addParameter(Parameter *parameter); + void removeParameter(Parameter *parameter); + QList parameters() const; + + TextureDict textureValues() const; + + void setTextureParameter(QString name, Texture* tex); + +private: + Q_DECLARE_PRIVATE(QMaterial) + QMaterialPrivate *d_ptr; +}; + +} + +QT_END_NAMESPACE + +#endif // QT3D_QMATERIAL_H diff --git a/src/render/frontend/render-frontend.pri b/src/render/frontend/render-frontend.pri index 83b15cd25..822d564ab 100644 --- a/src/render/frontend/render-frontend.pri +++ b/src/render/frontend/render-frontend.pri @@ -1,7 +1,7 @@ INCLUDEPATH += $$PWD HEADERS += \ - $$PWD/material.h \ + $$PWD/qmaterial.h \ $$PWD/qmesh.h \ $$PWD/renderpass.h \ $$PWD/renderpassfilter.h \ @@ -41,7 +41,7 @@ HEADERS += \ $$PWD/qpointlight_p.h SOURCES += \ - $$PWD/material.cpp \ + $$PWD/qmaterial.cpp \ $$PWD/qmesh.cpp \ $$PWD/renderpass.cpp \ $$PWD/shaderprogram.cpp \ diff --git a/src/render/io/assimpparser.cpp b/src/render/io/assimpparser.cpp index f1256e498..49a1a79fb 100644 --- a/src/render/io/assimpparser.cpp +++ b/src/render/io/assimpparser.cpp @@ -50,7 +50,7 @@ #include #include #include -#include +#include #include #include "renderlogging.h" @@ -403,7 +403,7 @@ void AssimpParser::parse() */ void AssimpParser::loadMaterial(uint materialIndex) { - Material *material = new Material(); + QMaterial *material = new QMaterial(); aiMaterial *assimpMaterial = m_aiScene->mMaterials[materialIndex]; // Material Name copyMaterialName(material, assimpMaterial); @@ -631,7 +631,7 @@ void AssimpParser::loadAnimation(uint animationIndex) /*! * Sets the object name of \a material to the name of \a assimpMaterial. */ -void AssimpParser::copyMaterialName(Material *material, aiMaterial *assimpMaterial) +void AssimpParser::copyMaterialName(QMaterial *material, aiMaterial *assimpMaterial) { aiString name; if (assimpMaterial->Get(AI_MATKEY_NAME, name) == aiReturn_SUCCESS) { @@ -645,7 +645,7 @@ void AssimpParser::copyMaterialName(Material *material, aiMaterial *assimpMateri /*! * Fills \a material color properties with \a assimpMaterial color properties; */ -void AssimpParser::copyMaterialColorProperties(Material *material, aiMaterial *assimpMaterial) +void AssimpParser::copyMaterialColorProperties(QMaterial *material, aiMaterial *assimpMaterial) { aiColor3D color; if (assimpMaterial->Get(AI_MATKEY_COLOR_DIFFUSE, color) == aiReturn_SUCCESS) @@ -665,7 +665,7 @@ void AssimpParser::copyMaterialColorProperties(Material *material, aiMaterial *a /*! * Retrieves a\a material bool property; */ -void AssimpParser::copyMaterialBoolProperties(Material *material, aiMaterial *assimpMaterial) +void AssimpParser::copyMaterialBoolProperties(QMaterial *material, aiMaterial *assimpMaterial) { int value; if (assimpMaterial->Get(AI_MATKEY_TWOSIDED, value) == aiReturn_SUCCESS) @@ -674,7 +674,7 @@ void AssimpParser::copyMaterialBoolProperties(Material *material, aiMaterial *as material->addParameter(new Parameter(material, ASSIMP_MATERIAL_IS_WIREFRAME, (value == 0) ? false : true)); } -void AssimpParser::copyMaterialShadingModel(Material *material, aiMaterial *assimpMaterial) +void AssimpParser::copyMaterialShadingModel(QMaterial *material, aiMaterial *assimpMaterial) { Q_UNUSED(material) Q_UNUSED(assimpMaterial) @@ -685,7 +685,7 @@ void AssimpParser::copyMaterialShadingModel(Material *material, aiMaterial *assi // AssimpParser::assimpMaterialAttributesMap[AI_MATKEY_BLEND_FUNC] = &AssimpParser::getMaterialBlendingFunction; } -void AssimpParser::copyMaterialBlendingFunction(Material *material, aiMaterial *assimpMaterial) +void AssimpParser::copyMaterialBlendingFunction(QMaterial *material, aiMaterial *assimpMaterial) { Q_UNUSED(material) Q_UNUSED(assimpMaterial) @@ -695,7 +695,7 @@ void AssimpParser::copyMaterialBlendingFunction(Material *material, aiMaterial * /*! * */ -void AssimpParser::copyMaterialTextures(Material *material, aiMaterial *assimpMaterial) +void AssimpParser::copyMaterialTextures(QMaterial *material, aiMaterial *assimpMaterial) { static const aiTextureType textureType[] = {aiTextureType_AMBIENT, aiTextureType_DIFFUSE, @@ -754,7 +754,7 @@ void AssimpParser::copyMaterialTextures(Material *material, aiMaterial *assimpMa /*! * Retrieves a\a material float property. */ -void AssimpParser::copyMaterialFloatProperties(Material *material, aiMaterial *assimpMaterial) +void AssimpParser::copyMaterialFloatProperties(QMaterial *material, aiMaterial *assimpMaterial) { float value = 0; if (assimpMaterial->Get(AI_MATKEY_OPACITY, value) == aiReturn_SUCCESS) diff --git a/src/render/io/assimpparser.h b/src/render/io/assimpparser.h index 30108488f..6ebed15b4 100644 --- a/src/render/io/assimpparser.h +++ b/src/render/io/assimpparser.h @@ -60,7 +60,7 @@ class QFile; namespace Qt3D { -class Material; +class QMaterial; class ShaderProgram; class Effect; class Camera; @@ -84,7 +84,7 @@ public: Entity *defaultScene(); MeshDataPtr mesh(QString id); - Material *material(QString id); + QMaterial *material(QString id); Camera *camera(QString id); private : @@ -105,13 +105,13 @@ private : void loadCamera(uint cameraIndex); void loadAnimation(uint animationIndex); - void copyMaterialName(Material *material, aiMaterial *assimpMaterial); - void copyMaterialColorProperties(Material *material, aiMaterial *assimpMaterial); - void copyMaterialFloatProperties(Material *material, aiMaterial *assimpMaterial); - void copyMaterialBoolProperties(Material *material, aiMaterial *assimpMaterial); - void copyMaterialShadingModel(Material *material, aiMaterial *assimpMaterial); - void copyMaterialBlendingFunction(Material *material, aiMaterial *assimpMaterial); - void copyMaterialTextures(Material *material, aiMaterial *assimpMaterial); + void copyMaterialName(QMaterial *material, aiMaterial *assimpMaterial); + void copyMaterialColorProperties(QMaterial *material, aiMaterial *assimpMaterial); + void copyMaterialFloatProperties(QMaterial *material, aiMaterial *assimpMaterial); + void copyMaterialBoolProperties(QMaterial *material, aiMaterial *assimpMaterial); + void copyMaterialShadingModel(QMaterial *material, aiMaterial *assimpMaterial); + void copyMaterialBlendingFunction(QMaterial *material, aiMaterial *assimpMaterial); + void copyMaterialTextures(QMaterial *material, aiMaterial *assimpMaterial); QScopedPointer m_aiScene; QDir m_sceneDir; @@ -119,7 +119,7 @@ private : static QStringList assimpSupportedFormatsList; QMap m_meshes; - QMap m_materials; + QMap m_materials; QMap m_effects; QMap m_embeddedTextures; QMap m_materialTextures; diff --git a/src/render/io/gltfparser.cpp b/src/render/io/gltfparser.cpp index 7d24a919d..daa78bc42 100644 --- a/src/render/io/gltfparser.cpp +++ b/src/render/io/gltfparser.cpp @@ -46,7 +46,7 @@ #include #include -#include +#include #include #include #include @@ -452,7 +452,7 @@ CameraLens* GLTFParser::camera(QString id) } } -Material* GLTFParser::material(QString id) +QMaterial* GLTFParser::material(QString id) { parse(); @@ -483,7 +483,7 @@ Material* GLTFParser::material(QString id) m_effectProxies[tname] = eff; } - Material* mat = new Material; + QMaterial* mat = new QMaterial; mat->setEffect(m_effectProxies[tname]); processName(jsonObj, mat); diff --git a/src/render/io/gltfparser.h b/src/render/io/gltfparser.h index 913a75671..421a5d0dd 100644 --- a/src/render/io/gltfparser.h +++ b/src/render/io/gltfparser.h @@ -59,7 +59,7 @@ class QFile; namespace Qt3D { -class Material; +class QMaterial; class ShaderProgram; class Effect; class Camera; @@ -90,7 +90,7 @@ public: Entity *defaultScene(); MeshDataPtr mesh(QString id); - Material *material(QString id); + QMaterial *material(QString id); CameraLens *camera(QString id); private: @@ -130,7 +130,7 @@ private: // type if ever useful }; - QMap m_materialCache; + QMap m_materialCache; QMap m_bufferDatas; QMap m_buffers; -- cgit v1.2.3