diff options
author | Louai Al-Khanji <louai.al-khanji@digia.com> | 2014-08-15 13:39:14 +0300 |
---|---|---|
committer | Louai Al-Khanji <louai.al-khanji@digia.com> | 2014-08-15 14:57:35 +0200 |
commit | 35e00094cefd43200df96ba09f548486a86bdef4 (patch) | |
tree | 69d677aff4995fab76cb16e3836ad909f462e24d /src/render | |
parent | 37b1b13ef5f7f0b8c8ab712d57d681ef5f0c45d5 (diff) |
Avoid naming classes DrawState
Since winuser.h contains a DrawState #define, this tends to wreck havoc on
Windows. This patch respectively renames QDrawState, Qt3D::Render::DrawState
and Qt3D::Render::DrawStateSet to QRenderState, Qt3D::Render::RenderState and
Qt3D::Render::RenderStateSet. While this is more invasive than just
undefining DrawState, it should be more foolproof too.
Change-Id: I9fa86e5bf1fe41fb4839bd146822cc43e26019e6
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render')
45 files changed, 230 insertions, 196 deletions
diff --git a/src/render/backend/genericstate.h b/src/render/backend/genericstate.h index bbea065a4..340f289cf 100644 --- a/src/render/backend/genericstate.h +++ b/src/render/backend/genericstate.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -44,12 +45,7 @@ #include <QList> -#include <Qt3DRenderer/drawstate.h> - -// winuser.h has a #define called DrawState. Let's get rid of it -#if defined(DrawState) -#undef DrawState -#endif +#include <Qt3DRenderer/renderstate.h> QT_BEGIN_NAMESPACE @@ -57,7 +53,7 @@ namespace Qt3D { namespace Render { template <typename Derived, typename T> -class GenericState1 : public DrawState +class GenericState1 : public RenderState { public: @@ -75,7 +71,7 @@ protected: }; template <typename Derived, typename T, typename S> -class GenericState2 : public DrawState +class GenericState2 : public RenderState { public: bool isEqual(const Derived& i) const @@ -92,7 +88,7 @@ protected: }; template <typename Derived, typename T, typename S, typename U> -class GenericState3 : public DrawState +class GenericState3 : public RenderState { public: bool isEqual(const Derived& i) const @@ -111,7 +107,7 @@ protected: }; template <typename Derived, typename T, typename S, typename U, typename Z> -class GenericState4 : public DrawState +class GenericState4 : public RenderState { public: bool isEqual(const Derived& i) const diff --git a/src/render/backend/qgraphicscontext.cpp b/src/render/backend/qgraphicscontext.cpp index ca59c1ef5..ae091331d 100644 --- a/src/render/backend/qgraphicscontext.cpp +++ b/src/render/backend/qgraphicscontext.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -46,7 +47,7 @@ #include "rendertexture.h" #include "rendercommand.h" #include "qparameter.h" -#include "drawstate.h" +#include "renderstate.h" #include "qgraphicshelperinterface.h" #include "qopenglfilter.h" #include "renderer.h" @@ -340,7 +341,7 @@ void QGraphicsContext::deactivateTexture(RenderTexture* tex) qCWarning(Backend) << Q_FUNC_INFO << "texture not active:" << tex; } -void QGraphicsContext::setCurrentStateSet(DrawStateSet *ss) +void QGraphicsContext::setCurrentStateSet(RenderStateSet *ss) { if (ss == m_stateSet) return; @@ -349,7 +350,7 @@ void QGraphicsContext::setCurrentStateSet(DrawStateSet *ss) m_stateSet = ss; } -DrawStateSet *QGraphicsContext::currentStateSet() const +RenderStateSet *QGraphicsContext::currentStateSet() const { return m_stateSet; } diff --git a/src/render/backend/qgraphicscontext.h b/src/render/backend/qgraphicscontext.h index 750e7d78d..eafd669cb 100644 --- a/src/render/backend/qgraphicscontext.h +++ b/src/render/backend/qgraphicscontext.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -67,7 +68,7 @@ namespace Render { class Renderer; class QGraphicsHelperInterface; -class DrawStateSet; +class RenderStateSet; class RenderShader; class RenderMaterial; class RenderTexture; @@ -148,8 +149,8 @@ public: void deactivateTexture(RenderTexture *tex); - void setCurrentStateSet(DrawStateSet* ss); - DrawStateSet *currentStateSet() const; + void setCurrentStateSet(RenderStateSet* ss); + RenderStateSet *currentStateSet() const; QOpenGLFilter *contextInfo() const; // Wrapper methods @@ -201,7 +202,7 @@ private: RenderMaterial* m_material; QRectF m_viewport; - DrawStateSet* m_stateSet; + RenderStateSet* m_stateSet; Renderer *m_renderer; QOpenGLFilter *m_contextInfo; diff --git a/src/render/backend/render-backend.pri b/src/render/backend/render-backend.pri index e58b81f35..5fff3d00d 100644 --- a/src/render/backend/render-backend.pri +++ b/src/render/backend/render-backend.pri @@ -20,7 +20,6 @@ HEADERS += \ $$PWD/rendertexture.h \ $$PWD/rendertextureprovider.h \ $$PWD/meshdatamanager.h \ - $$PWD/drawstate.h \ $$PWD/states/blendstate.h \ $$PWD/genericstate.h \ $$PWD/qgraphicshelperinterface.h \ @@ -55,7 +54,8 @@ HEADERS += \ $$PWD/rendersceneobserver.h \ $$PWD/framegraphmanager.h \ $$PWD/rendertransform.h \ - $$PWD/transformmanager.h + $$PWD/transformmanager.h \ + $$PWD/renderstate.h SOURCES += \ $$PWD/rendereraspect.cpp \ @@ -74,7 +74,6 @@ SOURCES += \ $$PWD/rendertexture.cpp \ $$PWD/rendertextureprovider.cpp \ $$PWD/meshdatamanager.cpp \ - $$PWD/drawstate.cpp \ $$PWD/states/blendstate.cpp \ $$PWD/qgraphicshelpergl3.cpp \ $$PWD/qgraphicshelperes2.cpp \ @@ -107,4 +106,5 @@ SOURCES += \ $$PWD/rendersceneobserver.cpp \ $$PWD/framegraphmanager.cpp \ $$PWD/rendertransform.cpp \ - $$PWD/transformmanager.cpp + $$PWD/transformmanager.cpp \ + $$PWD/renderstate.cpp diff --git a/src/render/backend/rendercommand.h b/src/render/backend/rendercommand.h index e97f6e3a7..ac7065973 100644 --- a/src/render/backend/rendercommand.h +++ b/src/render/backend/rendercommand.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -63,7 +64,7 @@ class RenderMaterial; class RenderMesh; class RenderShader; class RenderTechnique; -class DrawStateSet; +class RenderStateSet; typedef QHandle<QOpenGLVertexArrayObject*, 16> HVao; typedef QHandle<RenderMaterial, 16> HMaterial; @@ -91,7 +92,7 @@ public: QUniformPack m_uniforms; // Might need to be reworked so as to be able to destroy the // RenderTexture while submission is happening. GLint m_instancesCount; // Number of instances of the mesh, if 0 regular draw otherwise glDrawArraysInstanced or glDrawElementsInstanced - DrawStateSet *m_stateSet; + RenderStateSet *m_stateSet; // A QAttribute pack might be interesting // This is a temporary fix in the meantime, to remove the hacked methods in RenderTechnique diff --git a/src/render/backend/renderer.cpp b/src/render/backend/renderer.cpp index b54533ebc..5e452b20d 100644 --- a/src/render/backend/renderer.cpp +++ b/src/render/backend/renderer.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -72,7 +73,7 @@ #include <qgraphicscontext.h> #include <rendercameralens.h> #include <rendertextureprovider.h> -#include <drawstate.h> +#include <renderstate.h> #include <states/blendstate.h> #include <entitymanager.h> #include <renderview.h> @@ -173,10 +174,10 @@ void Renderer::buildDefaultTechnique() QRenderPass* basicPass = new QRenderPass; basicPass->setShaderProgram(defaultShader); - m_defaultDrawStateSet = new DrawStateSet; - m_defaultDrawStateSet->addState(DepthTest::getOrCreate(GL_LESS)); - m_defaultDrawStateSet->addState(CullFace::getOrCreate(GL_BACK)); - basicPass->setStateSet(m_defaultDrawStateSet); + m_defaultRenderStateSet = new RenderStateSet; + m_defaultRenderStateSet->addState(DepthTest::getOrCreate(GL_LESS)); + m_defaultRenderStateSet->addState(CullFace::getOrCreate(GL_BACK)); + basicPass->setStateSet(m_defaultRenderStateSet); m_defaultTechnique->addPass(basicPass); @@ -553,7 +554,7 @@ void Renderer::executeCommands(const QVector<RenderCommand *> &commands) if (command->m_stateSet != Q_NULLPTR) m_graphicsContext->setCurrentStateSet(command->m_stateSet); else - m_graphicsContext->setCurrentStateSet(m_defaultDrawStateSet); + m_graphicsContext->setCurrentStateSet(m_defaultRenderStateSet); // All Uniforms for a pass are stored in the QUniformPack of the command // Uniforms for Effect, Material and Technique should already have been correctly resolved diff --git a/src/render/backend/renderer.h b/src/render/backend/renderer.h index e52dcdbeb..aeccf4691 100644 --- a/src/render/backend/renderer.h +++ b/src/render/backend/renderer.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -113,6 +114,7 @@ class CriterionManager; class RenderSceneBuilder; class FrameGraphManager; class TransformManager; +class RenderStateSet; typedef QHandle<RenderMaterial, 16> HMaterial; typedef QHandle<RenderEffect, 16> HEffect; @@ -212,7 +214,7 @@ private: // Fail safe values that we can use if a RenderCommand // is missing a shader RenderShader *m_defaultRenderShader; - DrawStateSet *m_defaultDrawStateSet; + RenderStateSet *m_defaultRenderStateSet; QHash<QString, QString> m_defaultParameterToGLSLAttributeNames; QUniformPack m_defaultUniformPack; diff --git a/src/render/backend/rendermesh.cpp b/src/render/backend/rendermesh.cpp index 4162dfe1f..e00a1fa74 100644 --- a/src/render/backend/rendermesh.cpp +++ b/src/render/backend/rendermesh.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -144,7 +145,7 @@ void RenderMesh::setMeshFunctor(QAbstractMeshFunctorPtr functor) } } -//DrawStateSet *RenderMesh::stateSet() +//RenderStateSet *RenderMesh::stateSet() //{ // return m_technique->stateSetForPass(m_pass); //} diff --git a/src/render/backend/renderrenderpass.cpp b/src/render/backend/renderrenderpass.cpp index 751351c94..afae98a18 100644 --- a/src/render/backend/renderrenderpass.cpp +++ b/src/render/backend/renderrenderpass.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -49,7 +50,7 @@ #include <Qt3DCore/qscenepropertychange.h> #include <Qt3DCore/qabstractshader.h> #include <Qt3DRenderer/qparametermapper.h> -#include <Qt3DRenderer/qdrawstate.h> +#include <Qt3DRenderer/qrenderstate.h> QT_BEGIN_NAMESPACE @@ -101,8 +102,8 @@ void RenderRenderPass::setPeer(QRenderPass *peer) appendBinding(qobject_cast<QParameterMapper *>(binding->clone())); Q_FOREACH (QCriterion *c, peer->criteria()) appendCriterion(c); - Q_FOREACH (QDrawState *drawState, peer->drawStates()) - appendDrawState(drawState); + Q_FOREACH (QRenderState *renderState, peer->renderStates()) + appendRenderState(renderState); } } } @@ -122,8 +123,8 @@ void RenderRenderPass::sceneChangeEvent(const QSceneChangePtr &e) else if (propertyChange->propertyName() == QByteArrayLiteral("binding")) { appendBinding(propertyChange->value().value<QParameterMapper *>()); } - else if (propertyChange->propertyName() == QByteArrayLiteral("drawState")) { - appendDrawState(propertyChange->value().value<QDrawState *>()); + else if (propertyChange->propertyName() == QByteArrayLiteral("renderState")) { + appendRenderState(propertyChange->value().value<QRenderState *>()); } break; } @@ -138,8 +139,8 @@ void RenderRenderPass::sceneChangeEvent(const QSceneChangePtr &e) else if (propertyChange->propertyName() == QByteArrayLiteral("binding")) { removeBinding(propertyChange->value().toUuid()); } - else if (propertyChange->propertyName() == QByteArrayLiteral("drawState")) { - removeDrawState(propertyChange->value().toUuid()); + else if (propertyChange->propertyName() == QByteArrayLiteral("renderState")) { + removeRenderState(propertyChange->value().toUuid()); } break; } @@ -169,9 +170,9 @@ QUuid RenderRenderPass::renderPassUuid() const return m_passUuid; } -QList<QDrawState *> RenderRenderPass::drawStates() const +QList<QRenderState *> RenderRenderPass::renderStates() const { - return m_drawStates.values(); + return m_renderStates.values(); } void RenderRenderPass::appendCriterion(QCriterion *criterion) @@ -196,15 +197,15 @@ void RenderRenderPass::removeBinding(const QUuid &bindingId) m_bindings.remove(bindingId); } -void RenderRenderPass::appendDrawState(QDrawState *drawState) +void RenderRenderPass::appendRenderState(QRenderState *renderState) { - if (!m_drawStates.contains(drawState->uuid())) - m_drawStates[drawState->uuid()] = drawState; + if (!m_renderStates.contains(renderState->uuid())) + m_renderStates[renderState->uuid()] = renderState; } -void RenderRenderPass::removeDrawState(const QUuid &drawStateId) +void RenderRenderPass::removeRenderState(const QUuid &renderStateId) { - m_drawStates.remove(drawStateId); + m_renderStates.remove(renderStateId); } } // Render diff --git a/src/render/backend/renderrenderpass.h b/src/render/backend/renderrenderpass.h index 9071aca54..beb31b90a 100644 --- a/src/render/backend/renderrenderpass.h +++ b/src/render/backend/renderrenderpass.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -54,7 +55,7 @@ class QRenderPass; class QAbstractShader; class QParameterMapper; class QCriterion; -class QDrawState; +class QRenderState; namespace Render { @@ -74,7 +75,7 @@ public: QList<QParameterMapper *> bindings() const; QList<QUuid> criteria() const; QUuid renderPassUuid() const; - QList<QDrawState *> drawStates() const; + QList<QRenderState *> renderStates() const; void appendCriterion(QCriterion *criterion); void removeCriterion(const QUuid &criterionId); @@ -82,15 +83,15 @@ public: void appendBinding(QParameterMapper *binding); void removeBinding(const QUuid &bindingId); - void appendDrawState(QDrawState *drawState); - void removeDrawState(const QUuid &drawStateId); + void appendRenderState(QRenderState *renderState); + void removeRenderState(const QUuid &renderStateId); private: Renderer *m_renderer; QUuid m_passUuid; QUuid m_shaderUuid; QHash<QUuid, QParameterMapper *> m_bindings; - QHash<QUuid, QDrawState *> m_drawStates; + QHash<QUuid, QRenderState *> m_renderStates; QList<QUuid> m_criteriaList; }; diff --git a/src/render/backend/drawstate.cpp b/src/render/backend/renderstate.cpp index 968fce061..1f9fc7992 100644 --- a/src/render/backend/drawstate.cpp +++ b/src/render/backend/renderstate.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -39,7 +40,7 @@ ** ****************************************************************************/ -#include "drawstate.h" +#include "renderstate.h" #include <bitset> @@ -55,21 +56,21 @@ QT_BEGIN_NAMESPACE namespace Qt3D { namespace Render { -DrawStateSet::DrawStateSet() +RenderStateSet::RenderStateSet() : m_stateMask(0) , m_cachedPrevious(0) { } -void DrawStateSet::addState(DrawState *ds) +void RenderStateSet::addState(RenderState *ds) { Q_ASSERT(ds); m_states.insert(ds); m_stateMask |= ds->mask(); } -int DrawStateSet::changeCost(DrawStateSet *previousState) +int RenderStateSet::changeCost(RenderStateSet *previousState) { if (previousState == this) return 0; @@ -84,7 +85,7 @@ int DrawStateSet::changeCost(DrawStateSet *previousState) cost += bs.count(); // now, find out how many states we're changing - foreach (DrawState* ds, m_states) { + foreach (RenderState* ds, m_states) { // if the other state contains matching, then doesn't // contribute to cost at all if (previousState->contains(ds)) { @@ -92,16 +93,16 @@ int DrawStateSet::changeCost(DrawStateSet *previousState) } // flat cost for now; could be replaced with a cost() method on - // DrawState + // RenderState cost += 2; } return cost; } -void DrawStateSet::apply(QGraphicsContext *gc) +void RenderStateSet::apply(QGraphicsContext *gc) { - DrawStateSet* previousStates = gc->currentStateSet(); + RenderStateSet* previousStates = gc->currentStateSet(); StateMaskSet invOurState = ~stateMask(); // generate a mask for each set bit in previous, where we do not have @@ -114,7 +115,7 @@ void DrawStateSet::apply(QGraphicsContext *gc) if (m_cachedPrevious && previousStates == m_cachedPrevious) { // state-change cache hit - foreach (DrawState* ds, m_cachedDeltaStates) { + foreach (RenderState* ds, m_cachedDeltaStates) { ds->apply(gc); } } else { @@ -122,7 +123,7 @@ void DrawStateSet::apply(QGraphicsContext *gc) m_cachedDeltaStates.clear(); m_cachedPrevious = previousStates; - foreach (DrawState* ds, m_states) { + foreach (RenderState* ds, m_states) { if (previousStates && previousStates->contains(ds)) { continue; } @@ -133,12 +134,12 @@ void DrawStateSet::apply(QGraphicsContext *gc) } } -StateMaskSet DrawStateSet::stateMask() const +StateMaskSet RenderStateSet::stateMask() const { return m_stateMask; } -void DrawStateSet::resetMasked(StateMaskSet maskOfStatesToReset, QGraphicsContext *gc) +void RenderStateSet::resetMasked(StateMaskSet maskOfStatesToReset, QGraphicsContext *gc) { Q_UNUSED(gc); // TO DO -> Call gcHelper methods instead of raw GL @@ -180,7 +181,7 @@ void DrawStateSet::resetMasked(StateMaskSet maskOfStatesToReset, QGraphicsContex } } -bool DrawStateSet::contains(DrawState *ds) const +bool RenderStateSet::contains(RenderState *ds) const { // trivial reject using the state mask bits if (!(ds->mask() & stateMask())) diff --git a/src/render/backend/drawstate.h b/src/render/backend/renderstate.h index 5a172ce90..4bbf46a68 100644 --- a/src/render/backend/drawstate.h +++ b/src/render/backend/renderstate.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -39,8 +40,8 @@ ** ****************************************************************************/ -#ifndef QT3D_RENDER_DRAWSTATE_H -#define QT3D_RENDER_DRAWSTATE_H +#ifndef QT3D_RENDER_RENDERSTATE_H +#define QT3D_RENDER_RENDERSTATE_H #include <QList> #include <QSet> @@ -68,12 +69,7 @@ enum StateMask typedef quint64 StateMaskSet; -// winuser.h has a #define called DrawState. Let's get rid of it -#if defined(DrawState) -#undef DrawState -#endif - -class DrawState +class RenderState { public: virtual void apply(QGraphicsContext* gc) const = 0; @@ -83,12 +79,12 @@ public: protected: }; -class DrawStateSet +class RenderStateSet { public: - DrawStateSet(); + RenderStateSet(); - void addState(DrawState* ds); + void addState(RenderState* ds); /** * @brief changeCost - metric of cost to change to this state-set from @@ -97,7 +93,7 @@ public: * @param previousState * @return */ - int changeCost(DrawStateSet* previousState); + int changeCost(RenderStateSet* previousState); void apply(QGraphicsContext* gc); @@ -110,14 +106,14 @@ private: * @param ds * @return */ - bool contains(DrawState* ds) const; + bool contains(RenderState* ds) const; - QSet<DrawState*> m_states; + QSet<RenderState*> m_states; StateMaskSet m_stateMask; - DrawStateSet* m_cachedPrevious; - QList<DrawState*> m_cachedDeltaStates; + RenderStateSet* m_cachedPrevious; + QList<RenderState*> m_cachedDeltaStates; }; } // Render @@ -125,4 +121,4 @@ private: QT_END_NAMESPACE -#endif // QT3D_RENDER_DRAWSTATE_H +#endif // QT3D_RENDER_RENDERSTATE_H diff --git a/src/render/backend/rendertechnique.h b/src/render/backend/rendertechnique.h index 5a65db208..040071031 100644 --- a/src/render/backend/rendertechnique.h +++ b/src/render/backend/rendertechnique.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -61,7 +62,7 @@ class QAbstractRenderPass; namespace Render { class RenderBin; -class DrawStateSet; +class RenderStateSet; class RenderShader; class Renderer; @@ -76,7 +77,7 @@ public: void setPeer(QTechnique* peer); - DrawStateSet* stateSetForPass(unsigned int pass) const; + RenderStateSet* stateSetForPass(unsigned int pass) const; QString glslNameForMeshAttribute(unsigned int pass, QString meshAttributeName); diff --git a/src/render/backend/renderview.cpp b/src/render/backend/renderview.cpp index aa4d4c5f2..378a14a6b 100644 --- a/src/render/backend/renderview.cpp +++ b/src/render/backend/renderview.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -241,8 +242,8 @@ RenderView::~RenderView() // Deallocate all uniform values of the QUniformPack of each RenderCommand Q_FOREACH (const QUniformValue *v, command->m_uniforms.uniforms().values()) m_allocator->deallocate<QUniformValue>(const_cast<QUniformValue *>(v)); - if (command->m_stateSet != Q_NULLPTR) // We do not delete the DrawState as there are stored statically - m_allocator->deallocate<DrawStateSet>(command->m_stateSet); + if (command->m_stateSet != Q_NULLPTR) // We do not delete the RenderState as there are stored statically + m_allocator->deallocate<RenderStateSet>(command->m_stateSet); // Deallocate RenderCommand m_allocator->deallocate<RenderCommand>(command); } @@ -320,7 +321,7 @@ void RenderView::sort() // The goal here is to sort RenderCommand by : // 1) Shader - // 2) DrawStateSet + // 2) RenderStateSet // 2) Texture std::sort(m_commands.begin(), m_commands.end()); @@ -384,7 +385,7 @@ void RenderView::buildRenderCommands(RenderEntity *node) command->m_meshData = mesh->meshData(); command->m_instancesCount = 0; command->m_worldMatrix = *(node->worldTransform()); - command->m_stateSet = buildDrawStateSet(pass); + command->m_stateSet = buildRenderStateSet(pass); setShaderAndUniforms(command, pass, parameters); m_commands.append(command); } @@ -492,54 +493,54 @@ QHash<QString, QVariant> RenderView::parametersFromMaterialEffectTechnique(Rende return params; } -// Build a DrawStateSet from the QDrawState stored in the RenderRenderPass -DrawStateSet *RenderView::buildDrawStateSet(RenderRenderPass *pass) +// Build a RenderStateSet from the QRenderState stored in the RenderRenderPass +RenderStateSet *RenderView::buildRenderStateSet(RenderRenderPass *pass) { - if (pass != Q_NULLPTR && pass->drawStates().count() > 0) { - DrawStateSet *stateSet = m_allocator->allocate<DrawStateSet>(); + if (pass != Q_NULLPTR && pass->renderStates().count() > 0) { + RenderStateSet *stateSet = m_allocator->allocate<RenderStateSet>(); - Q_FOREACH (QDrawState *drawState, pass->drawStates()) { - if (qobject_cast<QAlphaTest *>(drawState) != Q_NULLPTR) { - QAlphaTest *alphaTest = qobject_cast<QAlphaTest *>(drawState); + Q_FOREACH (QRenderState *renderState, pass->renderStates()) { + if (qobject_cast<QAlphaTest *>(renderState) != Q_NULLPTR) { + QAlphaTest *alphaTest = qobject_cast<QAlphaTest *>(renderState); stateSet->addState(AlphaFunc::getOrCreate(alphaTest->func(), alphaTest->clamp())); } - else if (qobject_cast<QBlendEquation *>(drawState) != Q_NULLPTR) { - QBlendEquation *blendEquation = qobject_cast<QBlendEquation *>(drawState); + else if (qobject_cast<QBlendEquation *>(renderState) != Q_NULLPTR) { + QBlendEquation *blendEquation = qobject_cast<QBlendEquation *>(renderState); stateSet->addState(BlendEquation::getOrCreate(blendEquation->mode())); } - else if (qobject_cast<QBlendState *>(drawState) != Q_NULLPTR) { - QBlendState *blendState = qobject_cast<QBlendState *>(drawState); + else if (qobject_cast<QBlendState *>(renderState) != Q_NULLPTR) { + QBlendState *blendState = qobject_cast<QBlendState *>(renderState); // TO DO : Handle Alpha here as weel stateSet->addState(BlendState::getOrCreate(blendState->srcRGB(), blendState->dstRGB())); } - else if (qobject_cast<QCullFace *>(drawState) != Q_NULLPTR) { - QCullFace *cullFace = qobject_cast<QCullFace *>(drawState); + else if (qobject_cast<QCullFace *>(renderState) != Q_NULLPTR) { + QCullFace *cullFace = qobject_cast<QCullFace *>(renderState); stateSet->addState(CullFace::getOrCreate(cullFace->mode())); } - else if (qobject_cast<QDepthMask *>(drawState) != Q_NULLPTR) { - QDepthMask *depthMask = qobject_cast<QDepthMask *>(drawState); + else if (qobject_cast<QDepthMask *>(renderState) != Q_NULLPTR) { + QDepthMask *depthMask = qobject_cast<QDepthMask *>(renderState); stateSet->addState(DepthMask::getOrCreate(depthMask->mask())); } - else if (qobject_cast<QDepthTest *>(drawState) != Q_NULLPTR) { - QDepthTest *depthTest = qobject_cast<QDepthTest *>(drawState); + else if (qobject_cast<QDepthTest *>(renderState) != Q_NULLPTR) { + QDepthTest *depthTest = qobject_cast<QDepthTest *>(renderState); stateSet->addState(DepthTest::getOrCreate(depthTest->func())); } - else if (qobject_cast<QDithering *>(drawState) != Q_NULLPTR) { + else if (qobject_cast<QDithering *>(renderState) != Q_NULLPTR) { stateSet->addState(Dithering::getOrCreate()); } - else if (qobject_cast<QFrontFace *>(drawState) != Q_NULLPTR) { - QFrontFace *frontFace = qobject_cast<QFrontFace *>(drawState); + else if (qobject_cast<QFrontFace *>(renderState) != Q_NULLPTR) { + QFrontFace *frontFace = qobject_cast<QFrontFace *>(renderState); stateSet->addState(FrontFace::getOrCreate(frontFace->direction())); } - else if (qobject_cast<QScissorTest *>(drawState) != Q_NULLPTR) { - QScissorTest *scissorTest = qobject_cast<QScissorTest *>(drawState); + else if (qobject_cast<QScissorTest *>(renderState) != Q_NULLPTR) { + QScissorTest *scissorTest = qobject_cast<QScissorTest *>(renderState); stateSet->addState(ScissorTest::getOrCreate(scissorTest->left(), scissorTest->bottom(), scissorTest->width(), scissorTest->height())); } - else if (qobject_cast<QStencilTest *>(drawState) != Q_NULLPTR) { - QStencilTest *stencilTest = qobject_cast<QStencilTest*>(drawState); + else if (qobject_cast<QStencilTest *>(renderState) != Q_NULLPTR) { + QStencilTest *stencilTest = qobject_cast<QStencilTest*>(renderState); stateSet->addState(StencilTest::getOrCreate(stencilTest->mask(), stencilTest->func(), stencilTest->faceMode())); diff --git a/src/render/backend/renderview.h b/src/render/backend/renderview.h index 30aacdebd..a732c1b06 100644 --- a/src/render/backend/renderview.h +++ b/src/render/backend/renderview.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -123,7 +124,7 @@ private: void createRenderTexture(Texture *tex); void setShaderAndUniforms(RenderCommand *command, RenderRenderPass *pass, QHash<QString, QVariant> ¶meters); QHash<QString, QVariant> parametersFromMaterialEffectTechnique(RenderMaterial *material, RenderEffect *effect, RenderTechnique *technique); - DrawStateSet *buildDrawStateSet(RenderRenderPass *pass); + RenderStateSet *buildRenderStateSet(RenderRenderPass *pass); Renderer *m_renderer; QFrameAllocator *m_allocator; diff --git a/src/render/backend/states/blendstate.cpp b/src/render/backend/states/blendstate.cpp index 2cde86898..dc87dc750 100644 --- a/src/render/backend/states/blendstate.cpp +++ b/src/render/backend/states/blendstate.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -181,7 +182,7 @@ DepthMask::DepthMask(GLboolean flag) : } Dithering::Dithering() - : DrawState() + : RenderState() { } diff --git a/src/render/backend/states/blendstate.h b/src/render/backend/states/blendstate.h index 52ffa08f1..86019d8b1 100644 --- a/src/render/backend/states/blendstate.h +++ b/src/render/backend/states/blendstate.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -42,7 +43,7 @@ #ifndef BLENDSTATE_H #define BLENDSTATE_H -#include <Qt3DRenderer/drawstate.h> +#include <Qt3DRenderer/renderstate.h> #include <Qt3DRenderer/genericstate.h> #include <QOpenGLContext> @@ -146,7 +147,7 @@ private: FrontFace(GLenum func); }; -class Dithering : public DrawState +class Dithering : public Qt3D::Render::RenderState { public: virtual void apply(QGraphicsContext *gc) const Q_DECL_OVERRIDE; diff --git a/src/render/frontend/qalphatest.cpp b/src/render/frontend/qalphatest.cpp index 7404760d3..c979881ca 100644 --- a/src/render/frontend/qalphatest.cpp +++ b/src/render/frontend/qalphatest.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -63,13 +64,13 @@ public: }; QAlphaTest::QAlphaTest(QNode *parent) - : QDrawState(*new QAlphaTestPrivate(this), parent) + : QRenderState(*new QAlphaTestPrivate(this), parent) { } void QAlphaTest::copy(const QNode *ref) { - QDrawState::copy(ref); + QRenderState::copy(ref); Q_D(QAlphaTest); const QAlphaTest *refState = qobject_cast<const QAlphaTest *>(ref); if (refState != Q_NULLPTR) { diff --git a/src/render/frontend/qalphatest.h b/src/render/frontend/qalphatest.h index 7892bf1f8..f630d38da 100644 --- a/src/render/frontend/qalphatest.h +++ b/src/render/frontend/qalphatest.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -42,7 +43,7 @@ #ifndef QT3D_QALPHATEST_H #define QT3D_QALPHATEST_H -#include <Qt3DRenderer/qdrawstate.h> +#include <Qt3DRenderer/qrenderstate.h> QT_BEGIN_NAMESPACE @@ -50,7 +51,7 @@ namespace Qt3D { class QAlphaTestPrivate; -class QT3DRENDERERSHARED_EXPORT QAlphaTest : public QDrawState +class QT3DRENDERERSHARED_EXPORT QAlphaTest : public QRenderState { Q_OBJECT Q_ENUMS(AlphaFunc) diff --git a/src/render/frontend/qblendequation.cpp b/src/render/frontend/qblendequation.cpp index 546c5c406..86cc18280 100644 --- a/src/render/frontend/qblendequation.cpp +++ b/src/render/frontend/qblendequation.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -60,14 +61,14 @@ public: }; QBlendEquation::QBlendEquation(QNode *parent) - : QDrawState(*new QBlendEquationPrivate(this), parent) + : QRenderState(*new QBlendEquationPrivate(this), parent) { } void QBlendEquation::copy(const QNode *ref) { Q_D(QBlendEquation); - QDrawState::copy(ref); + QRenderState::copy(ref); const QBlendEquation *refState = qobject_cast<const QBlendEquation *>(ref); if (refState != Q_NULLPTR) { d->m_mode = refState->mode(); diff --git a/src/render/frontend/qblendequation.h b/src/render/frontend/qblendequation.h index 2145783b8..dd3eaff93 100644 --- a/src/render/frontend/qblendequation.h +++ b/src/render/frontend/qblendequation.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -42,7 +43,7 @@ #ifndef QT3D_QBLENDEQUATION_H #define QT3D_QBLENDEQUATION_H -#include <Qt3DRenderer/qdrawstate.h> +#include <Qt3DRenderer/qrenderstate.h> QT_BEGIN_NAMESPACE @@ -50,7 +51,7 @@ namespace Qt3D { class QBlendEquationPrivate; -class QT3DRENDERERSHARED_EXPORT QBlendEquation : public QDrawState +class QT3DRENDERERSHARED_EXPORT QBlendEquation : public QRenderState { Q_OBJECT Q_ENUMS(BlendMode) diff --git a/src/render/frontend/qblendstate.cpp b/src/render/frontend/qblendstate.cpp index 65b894910..bc6e76d2e 100644 --- a/src/render/frontend/qblendstate.cpp +++ b/src/render/frontend/qblendstate.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -68,13 +69,13 @@ public: }; QBlendState::QBlendState(QNode *parent) - : QDrawState(*new QBlendStatePrivate(this), parent) + : QRenderState(*new QBlendStatePrivate(this), parent) { } void QBlendState::copy(const QNode *ref) { - QDrawState::copy(ref); + QRenderState::copy(ref); Q_D(QBlendState); const QBlendState *refState = qobject_cast<const QBlendState *>(ref); if (refState != Q_NULLPTR) { diff --git a/src/render/frontend/qblendstate.h b/src/render/frontend/qblendstate.h index 9392110dc..232316572 100644 --- a/src/render/frontend/qblendstate.h +++ b/src/render/frontend/qblendstate.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -42,7 +43,7 @@ #ifndef QT3D_QBLENDSTATE_H #define QT3D_QBLENDSTATE_H -#include <Qt3DRenderer/qdrawstate.h> +#include <Qt3DRenderer/qrenderstate.h> QT_BEGIN_NAMESPACE @@ -50,7 +51,7 @@ namespace Qt3D { class QBlendStatePrivate; -class QT3DRENDERERSHARED_EXPORT QBlendState : public QDrawState +class QT3DRENDERERSHARED_EXPORT QBlendState : public QRenderState { Q_OBJECT Q_ENUMS(Blending) diff --git a/src/render/frontend/qcullface.cpp b/src/render/frontend/qcullface.cpp index e9b98892e..a4fee6efa 100644 --- a/src/render/frontend/qcullface.cpp +++ b/src/render/frontend/qcullface.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -61,13 +62,13 @@ public: }; QCullFace::QCullFace(QNode *parent) - : QDrawState(*new QCullFacePrivate(this), parent) + : QRenderState(*new QCullFacePrivate(this), parent) { } void QCullFace::copy(const QNode *ref) { - QDrawState::copy(ref); + QRenderState::copy(ref); Q_D(QCullFace); const QCullFace *refState = qobject_cast<const QCullFace *>(ref); if (refState != Q_NULLPTR) { diff --git a/src/render/frontend/qcullface.h b/src/render/frontend/qcullface.h index 5e97a9a65..2d94bdcf9 100644 --- a/src/render/frontend/qcullface.h +++ b/src/render/frontend/qcullface.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -43,7 +44,7 @@ #ifndef QT3D_QCULLFACE_H #define QT3D_QCULLFACE_H -#include <Qt3DRenderer/qdrawstate.h> +#include <Qt3DRenderer/qrenderstate.h> QT_BEGIN_NAMESPACE @@ -51,7 +52,7 @@ namespace Qt3D { class QCullFacePrivate; -class QT3DRENDERERSHARED_EXPORT QCullFace : public QDrawState +class QT3DRENDERERSHARED_EXPORT QCullFace : public QRenderState { Q_OBJECT Q_ENUMS(CullingMode) diff --git a/src/render/frontend/qdepthmask.cpp b/src/render/frontend/qdepthmask.cpp index d003eb429..12cc12c88 100644 --- a/src/render/frontend/qdepthmask.cpp +++ b/src/render/frontend/qdepthmask.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -61,13 +62,13 @@ public: }; QDepthMask::QDepthMask(QNode *parent) - : QDrawState(*new QDepthMaskPrivate(this), parent) + : QRenderState(*new QDepthMaskPrivate(this), parent) { } void QDepthMask::copy(const QNode *ref) { - QDrawState::copy(ref); + QRenderState::copy(ref); Q_D(QDepthMask); const QDepthMask *refState = qobject_cast<const QDepthMask *>(ref); if (refState != Q_NULLPTR) { diff --git a/src/render/frontend/qdepthmask.h b/src/render/frontend/qdepthmask.h index 7559fa696..c1a955968 100644 --- a/src/render/frontend/qdepthmask.h +++ b/src/render/frontend/qdepthmask.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -42,7 +43,7 @@ #ifndef QT3D_QDEPTHMASK_H #define QT3D_QDEPTHMASK_H -#include <Qt3DRenderer/qdrawstate.h> +#include <Qt3DRenderer/qrenderstate.h> QT_BEGIN_NAMESPACE @@ -50,7 +51,7 @@ namespace Qt3D { class QDepthMaskPrivate; -class QT3DRENDERERSHARED_EXPORT QDepthMask : public QDrawState +class QT3DRENDERERSHARED_EXPORT QDepthMask : public QRenderState { Q_OBJECT Q_PROPERTY (bool mask READ mask WRITE setMask NOTIFY maskChanged) diff --git a/src/render/frontend/qdepthtest.cpp b/src/render/frontend/qdepthtest.cpp index a6a5440c3..99e7eb120 100644 --- a/src/render/frontend/qdepthtest.cpp +++ b/src/render/frontend/qdepthtest.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -61,13 +62,13 @@ public : }; QDepthTest::QDepthTest(QNode *parent) - : QDrawState(*new QDepthTestPrivate(this), parent) + : QRenderState(*new QDepthTestPrivate(this), parent) { } void QDepthTest::copy(const QNode *ref) { - QDrawState::copy(ref); + QRenderState::copy(ref); Q_D(QDepthTest); const QDepthTest *refState = qobject_cast<const QDepthTest *>(ref); if (refState != Q_NULLPTR) { diff --git a/src/render/frontend/qdepthtest.h b/src/render/frontend/qdepthtest.h index a986f3f1f..5a9c6cc02 100644 --- a/src/render/frontend/qdepthtest.h +++ b/src/render/frontend/qdepthtest.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -42,7 +43,7 @@ #ifndef QT3D_QDEPTHTEST_H #define QT3D_QDEPTHTEST_H -#include <Qt3DRenderer/qdrawstate.h> +#include <Qt3DRenderer/qrenderstate.h> QT_BEGIN_NAMESPACE @@ -50,7 +51,7 @@ namespace Qt3D { class QDepthTestPrivate; -class QT3DRENDERERSHARED_EXPORT QDepthTest : public QDrawState +class QT3DRENDERERSHARED_EXPORT QDepthTest : public QRenderState { Q_OBJECT Q_ENUMS(DepthFunc) diff --git a/src/render/frontend/qdithering.cpp b/src/render/frontend/qdithering.cpp index 3e81a0f02..3b0bcc341 100644 --- a/src/render/frontend/qdithering.cpp +++ b/src/render/frontend/qdithering.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -58,7 +59,7 @@ public: }; QDithering::QDithering(QNode *parent) - : QDrawState(*new QDitheringPrivate(this), parent) + : QRenderState(*new QDitheringPrivate(this), parent) { } diff --git a/src/render/frontend/qdithering.h b/src/render/frontend/qdithering.h index a6c329995..82d7d62c9 100644 --- a/src/render/frontend/qdithering.h +++ b/src/render/frontend/qdithering.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -42,7 +43,7 @@ #ifndef QT3D_QDITHERING_H #define QT3D_QDITHERING_H -#include <Qt3DRenderer/qdrawstate.h> +#include <Qt3DRenderer/qrenderstate.h> QT_BEGIN_NAMESPACE @@ -50,7 +51,7 @@ namespace Qt3D { class QDitheringPrivate; -class QT3DRENDERERSHARED_EXPORT QDithering : public QDrawState +class QT3DRENDERERSHARED_EXPORT QDithering : public QRenderState { Q_OBJECT public: diff --git a/src/render/frontend/qfrontface.cpp b/src/render/frontend/qfrontface.cpp index b4724966a..e4c830c18 100644 --- a/src/render/frontend/qfrontface.cpp +++ b/src/render/frontend/qfrontface.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -61,13 +62,13 @@ public: }; QFrontFace::QFrontFace(QNode *parent) - : QDrawState(*new QFrontFacePrivate(this), parent) + : QRenderState(*new QFrontFacePrivate(this), parent) { } void QFrontFace::copy(const QNode *ref) { - QDrawState::copy(ref); + QRenderState::copy(ref); Q_D(QFrontFace); const QFrontFace *refState = qobject_cast<const QFrontFace *>(ref); if (refState != Q_NULLPTR) { diff --git a/src/render/frontend/qfrontface.h b/src/render/frontend/qfrontface.h index eab57f0d7..7ca54644a 100644 --- a/src/render/frontend/qfrontface.h +++ b/src/render/frontend/qfrontface.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -42,7 +43,7 @@ #ifndef QT3D_QFRONTFACE_H #define QT3D_QFRONTFACE_H -#include <Qt3DRenderer/qdrawstate.h> +#include <Qt3DRenderer/qrenderstate.h> QT_BEGIN_NAMESPACE @@ -50,7 +51,7 @@ namespace Qt3D { class QFrontFacePrivate; -class QT3DRENDERERSHARED_EXPORT QFrontFace : public QDrawState +class QT3DRENDERERSHARED_EXPORT QFrontFace : public QRenderState { Q_OBJECT Q_ENUMS(FaceDir) diff --git a/src/render/frontend/qrenderpass.cpp b/src/render/frontend/qrenderpass.cpp index acbbe5bed..65f091a45 100644 --- a/src/render/frontend/qrenderpass.cpp +++ b/src/render/frontend/qrenderpass.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -45,7 +46,7 @@ #include "qcriterion.h" #include "qparametermapper.h" #include "qscenepropertychange.h" -#include "qdrawstate.h" +#include "qrenderstate.h" QT_BEGIN_NAMESPACE @@ -76,8 +77,8 @@ QRenderPass *QRenderPass::doClone(QNode *clonedParent) const pass->addCriterion(qobject_cast<QCriterion *>(crit->clone(pass))); Q_FOREACH (QParameterMapper *binding, d->m_bindings) pass->addBinding(qobject_cast<QParameterMapper *>(binding->clone(pass))); - Q_FOREACH (QDrawState *drawState, d->m_drawStates) - pass->addDrawState(qobject_cast<QDrawState *>(drawState->clone(pass))); + Q_FOREACH (QRenderState *renderState, d->m_renderStates) + pass->addRenderState(qobject_cast<QRenderState *>(renderState->clone(pass))); pass->d_func()->m_shader = qobject_cast<QShaderProgram *>(d->m_shader->clone(pass)); return pass; @@ -95,13 +96,13 @@ ParameterList QRenderPass::uniforms() const return d->m_uniforms; } -void QRenderPass::setStateSet(Render::DrawStateSet *ss) +void QRenderPass::setStateSet(Render::RenderStateSet *ss) { Q_D(QRenderPass); d->m_stateSet = ss; } -Render::DrawStateSet *QRenderPass::stateSet() const +Render::RenderStateSet *QRenderPass::stateSet() const { Q_D(const QRenderPass); return d->m_stateSet; @@ -190,41 +191,41 @@ QList<QParameterMapper *> QRenderPass::bindings() const return d->m_bindings; } -void QRenderPass::addDrawState(QDrawState *state) +void QRenderPass::addRenderState(QRenderState *state) { Q_D(QRenderPass); - if (!d->m_drawStates.contains(state)) { - d->m_drawStates.append(state); + if (!d->m_renderStates.contains(state)) { + d->m_renderStates.append(state); if (!state->parent() || state->parent() == this) QNode::addChild(state); if (d->m_changeArbiter != Q_NULLPTR) { QScenePropertyChangePtr change(new QScenePropertyChange(NodeAdded, this)); - change->setPropertyName(QByteArrayLiteral("drawState")); + change->setPropertyName(QByteArrayLiteral("renderState")); change->setValue(QVariant::fromValue(state->clone())); notifyObservers(change); } } } -void QRenderPass::removeDrawState(QDrawState *state) +void QRenderPass::removeRenderState(QRenderState *state) { Q_D(QRenderPass); if (d->m_changeArbiter != Q_NULLPTR) { QScenePropertyChangePtr change(new QScenePropertyChange(NodeRemoved, this)); - change->setPropertyName(QByteArrayLiteral("drawState")); + change->setPropertyName(QByteArrayLiteral("renderState")); change->setValue(QVariant::fromValue(state->uuid())); notifyObservers(change); } - d->m_drawStates.removeOne(state); + d->m_renderStates.removeOne(state); } -QList<QDrawState *> QRenderPass::drawStates() const +QList<QRenderState *> QRenderPass::renderStates() const { Q_D(const QRenderPass); - return d->m_drawStates; + return d->m_renderStates; } } // namespace Qt3D diff --git a/src/render/frontend/qrenderpass.h b/src/render/frontend/qrenderpass.h index 63ded4db0..fbcc5120e 100644 --- a/src/render/frontend/qrenderpass.h +++ b/src/render/frontend/qrenderpass.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -46,7 +47,7 @@ #include <Qt3DRenderer/qt3drenderer_global.h> #include <Qt3DRenderer/qshaderprogram.h> -#include <Qt3DRenderer/drawstate.h> +#include <Qt3DRenderer/renderstate.h> #include <Qt3DRenderer/qcriterion.h> #include <QHash> @@ -57,7 +58,7 @@ QT_BEGIN_NAMESPACE namespace Qt3D { class QParameter; -class QDrawState; +class QRenderState; class QParameterMapper; typedef QList<QParameter*> ParameterList; @@ -79,8 +80,8 @@ public: ParameterList attributes() const; ParameterList uniforms() const; - void setStateSet(Render::DrawStateSet* ss); - Render::DrawStateSet* stateSet() const; + void setStateSet(Render::RenderStateSet* ss); + Render::RenderStateSet* stateSet() const; void addCriterion(QCriterion *criterion); void removeCriterion(QCriterion *criterion); @@ -91,9 +92,9 @@ public: void removeBinding(QParameterMapper *binding); QList<QParameterMapper *> bindings() const; - void addDrawState(QDrawState *state); - void removeDrawState(QDrawState *state); - QList<QDrawState *> drawStates() const; + void addRenderState(QRenderState *state); + void removeRenderState(QRenderState *state); + QList<QRenderState *> renderStates() const; protected: Q_DECLARE_PRIVATE(QRenderPass) diff --git a/src/render/frontend/qrenderpass_p.h b/src/render/frontend/qrenderpass_p.h index fbdec7f62..d19964e87 100644 --- a/src/render/frontend/qrenderpass_p.h +++ b/src/render/frontend/qrenderpass_p.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -52,12 +53,12 @@ namespace Qt3D { class QRenderPass; class QParameter; class QParameterMapper; -class QDrawState; +class QRenderState; typedef QList<QParameter*> ParameterList; namespace Render { -class DrawStateSet; +class RenderStateSet; } class QT3DRENDERERSHARED_EXPORT QRenderPassPrivate : public QAbstractRenderPassPrivate @@ -73,9 +74,9 @@ public: QHash<QString, QString> m_parameterNameDict; QList<QCriterion *> m_criteriaList; QList<QParameterMapper *> m_bindings; - QList<QDrawState *> m_drawStates; + QList<QRenderState *> m_renderStates; - Render::DrawStateSet* m_stateSet; + Render::RenderStateSet* m_stateSet; }; } // Qt3D diff --git a/src/render/frontend/qdrawstate.cpp b/src/render/frontend/qrenderstate.cpp index 2465c4118..2c0be478c 100644 --- a/src/render/frontend/qdrawstate.cpp +++ b/src/render/frontend/qrenderstate.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -39,18 +40,18 @@ ** ****************************************************************************/ -#include "qdrawstate.h" +#include "qrenderstate.h" QT_BEGIN_NAMESPACE namespace Qt3D { -QDrawState::QDrawState(QNode *parent) +QRenderState::QRenderState(QNode *parent) : QNode(parent) { } -QDrawState::QDrawState(QNodePrivate &dd, QNode *parent) +QRenderState::QRenderState(QNodePrivate &dd, QNode *parent) : QNode(dd, parent) { } diff --git a/src/render/frontend/qdrawstate.h b/src/render/frontend/qrenderstate.h index 75394ed7f..f6081ed21 100644 --- a/src/render/frontend/qdrawstate.h +++ b/src/render/frontend/qrenderstate.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -39,8 +40,8 @@ ** ****************************************************************************/ -#ifndef QT3D_QDRAWSTATE_H -#define QT3D_QDRAWSTATE_H +#ifndef QT3D_QRENDERSTATE_H +#define QT3D_QRENDERSTATE_H #include <Qt3DCore/QNode> #include <Qt3DRenderer/qt3drenderer_global.h> @@ -49,18 +50,18 @@ QT_BEGIN_NAMESPACE namespace Qt3D { -class QT3DRENDERERSHARED_EXPORT QDrawState : public QNode +class QT3DRENDERERSHARED_EXPORT QRenderState : public QNode { Q_OBJECT public: - explicit QDrawState(QNode *parent = 0); + explicit QRenderState(QNode *parent = 0); protected: - QDrawState(QNodePrivate &dd, QNode *parent = 0); + QRenderState(QNodePrivate &dd, QNode *parent = 0); }; } // Qt3D QT_END_NAMESPACE -#endif // QT3D_QDRAWSTATE_H +#endif // QT3D_QRENDERSTATE_H diff --git a/src/render/frontend/qscissortest.cpp b/src/render/frontend/qscissortest.cpp index 056fe5bbe..cd9378915 100644 --- a/src/render/frontend/qscissortest.cpp +++ b/src/render/frontend/qscissortest.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -68,13 +69,13 @@ public: }; QScissorTest::QScissorTest(QNode *parent) - : QDrawState(*new QScissorTestPrivate(this), parent) + : QRenderState(*new QScissorTestPrivate(this), parent) { } void QScissorTest::copy(const QNode *ref) { - QDrawState::copy(ref); + QRenderState::copy(ref); Q_D(QScissorTest); const QScissorTest *refState = qobject_cast<const QScissorTest *>(ref); if (refState != Q_NULLPTR) { diff --git a/src/render/frontend/qscissortest.h b/src/render/frontend/qscissortest.h index 26cdcf01f..6d4849260 100644 --- a/src/render/frontend/qscissortest.h +++ b/src/render/frontend/qscissortest.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -42,7 +43,7 @@ #ifndef QT3D_QSCISSORTEST_H #define QT3D_QSCISSORTEST_H -#include <Qt3DRenderer/qdrawstate.h> +#include <Qt3DRenderer/qrenderstate.h> QT_BEGIN_NAMESPACE @@ -50,7 +51,7 @@ namespace Qt3D { class QScissorTestPrivate; -class QT3DRENDERERSHARED_EXPORT QScissorTest : public QDrawState +class QT3DRENDERERSHARED_EXPORT QScissorTest : public QRenderState { Q_OBJECT Q_PROPERTY(int left READ left WRITE setLeft NOTIFY leftChanged) diff --git a/src/render/frontend/qstenciltest.cpp b/src/render/frontend/qstenciltest.cpp index dff00dd15..bad509c27 100644 --- a/src/render/frontend/qstenciltest.cpp +++ b/src/render/frontend/qstenciltest.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -66,13 +67,13 @@ public: }; QStencilTest::QStencilTest(QNode *parent) - : QDrawState(*new QStencilTestPrivate(this), parent) + : QRenderState(*new QStencilTestPrivate(this), parent) { } void QStencilTest::copy(const QNode *ref) { - QDrawState::copy(ref); + QRenderState::copy(ref); Q_D(QStencilTest); const QStencilTest *refState = qobject_cast<const QStencilTest *>(ref); if (refState != Q_NULLPTR) { diff --git a/src/render/frontend/qstenciltest.h b/src/render/frontend/qstenciltest.h index 8ea75a7b0..14c7be8cb 100644 --- a/src/render/frontend/qstenciltest.h +++ b/src/render/frontend/qstenciltest.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -42,7 +43,7 @@ #ifndef QT3D_QSTENCILTEST_H #define QT3D_QSTENCILTEST_H -#include <Qt3DRenderer/qdrawstate.h> +#include <Qt3DRenderer/qrenderstate.h> QT_BEGIN_NAMESPACE @@ -50,7 +51,7 @@ namespace Qt3D { class QStencilTestPrivate; -class QT3DRENDERERSHARED_EXPORT QStencilTest : public QDrawState +class QT3DRENDERERSHARED_EXPORT QStencilTest : public QRenderState { Q_OBJECT Q_ENUMS(StencilFaceMode) diff --git a/src/render/frontend/render-frontend.pri b/src/render/frontend/render-frontend.pri index 9e2463673..601e3aebe 100644 --- a/src/render/frontend/render-frontend.pri +++ b/src/render/frontend/render-frontend.pri @@ -46,7 +46,6 @@ HEADERS += \ $$PWD/qplanemesh_p.h \ $$PWD/qcuboidmesh.h \ $$PWD/qcuboidmesh_p.h \ - $$PWD/qdrawstate.h \ $$PWD/qblendstate.h \ $$PWD/qblendequation.h \ $$PWD/qalphatest.h \ @@ -56,7 +55,8 @@ HEADERS += \ $$PWD/qfrontface.h \ $$PWD/qstenciltest.h \ $$PWD/qscissortest.h \ - $$PWD/qdithering.h + $$PWD/qdithering.h \ + $$PWD/qrenderstate.h SOURCES += \ $$PWD/qmaterial.cpp \ @@ -84,7 +84,6 @@ SOURCES += \ $$PWD/qopenglfilter.cpp \ $$PWD/qplanemesh.cpp \ $$PWD/qcuboidmesh.cpp \ - $$PWD/qdrawstate.cpp \ $$PWD/qblendstate.cpp \ $$PWD/qblendequation.cpp \ $$PWD/qalphatest.cpp \ @@ -94,4 +93,5 @@ SOURCES += \ $$PWD/qfrontface.cpp \ $$PWD/qstenciltest.cpp \ $$PWD/qscissortest.cpp \ - $$PWD/qdithering.cpp + $$PWD/qdithering.cpp \ + $$PWD/qrenderstate.cpp diff --git a/src/render/io/gltfparser.cpp b/src/render/io/gltfparser.cpp index 4464ef335..76c7ba27d 100644 --- a/src/render/io/gltfparser.cpp +++ b/src/render/io/gltfparser.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -70,7 +71,7 @@ #include <QVector3D> // need to move these to somewhere common? -#include <drawstate.h> +#include <renderstate.h> #include <states/blendstate.h> QT_BEGIN_NAMESPACE @@ -869,10 +870,10 @@ void GLTFParser::processJSONTechnique( QString id, QJsonObject jsonObj ) } // of program-instance attributes QJsonObject states = po.value(KEY_STATES).toObject(); - Render::DrawStateSet* ss = new Render::DrawStateSet; + Render::RenderStateSet* ss = new Render::RenderStateSet; Q_FOREACH (QString stateName, states.keys()) { - Render::DrawState* s= buildState(stateName.toUtf8(), states.value(stateName)); + Render::RenderState* s= buildState(stateName.toUtf8(), states.value(stateName)); if (!s) continue; @@ -886,7 +887,7 @@ void GLTFParser::processJSONTechnique( QString id, QJsonObject jsonObj ) m_techniques[id] = t; } -Render::DrawState* GLTFParser::buildState(const QByteArray& nm, QJsonValue v) +Render::RenderState* GLTFParser::buildState(const QByteArray& nm, QJsonValue v) { if (nm == "blendEnable") { return NULL; // will see a blendEquation spec too diff --git a/src/render/io/gltfparser.h b/src/render/io/gltfparser.h index 4f94ee393..f61496abf 100644 --- a/src/render/io/gltfparser.h +++ b/src/render/io/gltfparser.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt3D module of the Qt Toolkit. @@ -159,7 +160,7 @@ private: QVariant parameterValueFromJSON(QParameter *p, QJsonValue val); - Render::DrawState *buildState(const QByteArray& nm, QJsonValue obj); + Render::RenderState *buildState(const QByteArray& nm, QJsonValue obj); }; } |