diff options
Diffstat (limited to 'src/render/backend')
-rw-r--r-- | src/render/backend/bufferutils_p.h | 28 | ||||
-rw-r--r-- | src/render/backend/buffervisitor_p.h | 18 | ||||
-rw-r--r-- | src/render/backend/trianglesvisitor.cpp | 2 | ||||
-rw-r--r-- | src/render/backend/trianglesvisitor_p.h | 1 | ||||
-rw-r--r-- | src/render/backend/visitorutils_p.h | 42 |
5 files changed, 46 insertions, 45 deletions
diff --git a/src/render/backend/bufferutils_p.h b/src/render/backend/bufferutils_p.h index ea783df0d..83787b6bc 100644 --- a/src/render/backend/bufferutils_p.h +++ b/src/render/backend/bufferutils_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <Qt3DRender/QAttribute> +#include <Qt3DCore/QAttribute> #include <QByteArray> QT_BEGIN_NAMESPACE @@ -69,7 +69,7 @@ class Buffer; struct BufferInfo { BufferInfo() - : type(QAttribute::VertexBaseType::Float) + : type(Qt3DCore::QAttribute::VertexBaseType::Float) , dataSize(0) , count(0) , byteStride(0) @@ -79,7 +79,7 @@ struct BufferInfo {} QByteArray data; - QAttribute::VertexBaseType type; + Qt3DCore::QAttribute::VertexBaseType type; uint dataSize; uint count; uint byteStride; @@ -91,17 +91,17 @@ struct BufferInfo namespace BufferTypeInfo { - template <QAttribute::VertexBaseType> struct EnumToType; - template <> struct EnumToType<QAttribute::Byte> { typedef const char type; }; - template <> struct EnumToType<QAttribute::UnsignedByte> { typedef const uchar type; }; - template <> struct EnumToType<QAttribute::Short> { typedef const short type; }; - template <> struct EnumToType<QAttribute::UnsignedShort> { typedef const ushort type; }; - template <> struct EnumToType<QAttribute::Int> { typedef const int type; }; - template <> struct EnumToType<QAttribute::UnsignedInt> { typedef const uint type; }; - template <> struct EnumToType<QAttribute::Float> { typedef const float type; }; - template <> struct EnumToType<QAttribute::Double> { typedef const double type; }; - - template<QAttribute::VertexBaseType v> + template <Qt3DCore::QAttribute::VertexBaseType> struct EnumToType; + template <> struct EnumToType<Qt3DCore::QAttribute::Byte> { typedef const char type; }; + template <> struct EnumToType<Qt3DCore::QAttribute::UnsignedByte> { typedef const uchar type; }; + template <> struct EnumToType<Qt3DCore::QAttribute::Short> { typedef const short type; }; + template <> struct EnumToType<Qt3DCore::QAttribute::UnsignedShort> { typedef const ushort type; }; + template <> struct EnumToType<Qt3DCore::QAttribute::Int> { typedef const int type; }; + template <> struct EnumToType<Qt3DCore::QAttribute::UnsignedInt> { typedef const uint type; }; + template <> struct EnumToType<Qt3DCore::QAttribute::Float> { typedef const float type; }; + template <> struct EnumToType<Qt3DCore::QAttribute::Double> { typedef const double type; }; + + template<Qt3DCore::QAttribute::VertexBaseType v> typename EnumToType<v>::type *castToType(const QByteArray &u, uint byteOffset) { return reinterpret_cast< typename EnumToType<v>::type *>(u.constData() + byteOffset); diff --git a/src/render/backend/buffervisitor_p.h b/src/render/backend/buffervisitor_p.h index f3863f0a3..6d916208b 100644 --- a/src/render/backend/buffervisitor_p.h +++ b/src/render/backend/buffervisitor_p.h @@ -52,7 +52,7 @@ // #include <Qt3DCore/qnodeid.h> -#include <Qt3DRender/QAttribute> +#include <Qt3DCore/qattribute.h> #include <Qt3DRender/private/trianglesvisitor_p.h> #include <Qt3DRender/private/attribute_p.h> #include <Qt3DRender/private/buffer_p.h> @@ -72,7 +72,7 @@ namespace Qt3DRender { namespace Render { -template <typename ValueType, QAttribute::VertexBaseType VertexBaseType, uint dataSize> +template <typename ValueType, Qt3DCore::QAttribute::VertexBaseType VertexBaseType, uint dataSize> class Q_AUTOTEST_EXPORT BufferVisitor { public: @@ -137,20 +137,20 @@ public: if (indexAttribute) { auto indexData = m_manager->lookupResource<Buffer, BufferManager>(indexAttribute->bufferId())->data(); switch (indexAttribute->vertexBaseType()) { - case QAttribute::UnsignedShort: { - auto indexBuffer = BufferTypeInfo::castToType<QAttribute::UnsignedShort>(indexData, indexAttribute->byteOffset()); + case Qt3DCore::QAttribute::UnsignedShort: { + auto indexBuffer = BufferTypeInfo::castToType<Qt3DCore::QAttribute::UnsignedShort>(indexData, indexAttribute->byteOffset()); traverseCoordinateIndexed(vertexBuffer, indexBuffer, attribute->byteStride(), drawVertexCount, primitiveRestartEnabled, primitiveRestartIndex); break; } - case QAttribute::UnsignedInt: { - auto indexBuffer = BufferTypeInfo::castToType<QAttribute::UnsignedInt>(indexData, indexAttribute->byteOffset()); + case Qt3DCore::QAttribute::UnsignedInt: { + auto indexBuffer = BufferTypeInfo::castToType<Qt3DCore::QAttribute::UnsignedInt>(indexData, indexAttribute->byteOffset()); traverseCoordinateIndexed(vertexBuffer, indexBuffer, attribute->byteStride(), drawVertexCount, primitiveRestartEnabled, primitiveRestartIndex); break; } - case QAttribute::UnsignedByte: { - auto indexBuffer = BufferTypeInfo::castToType<QAttribute::UnsignedByte>(indexData, indexAttribute->byteOffset()); + case Qt3DCore::QAttribute::UnsignedByte: { + auto indexBuffer = BufferTypeInfo::castToType<Qt3DCore::QAttribute::UnsignedByte>(indexData, indexAttribute->byteOffset()); traverseCoordinateIndexed(vertexBuffer, indexBuffer, attribute->byteStride(), drawVertexCount, primitiveRestartEnabled, primitiveRestartIndex); break; @@ -292,7 +292,7 @@ protected: NodeManagers *m_manager; }; -typedef BufferVisitor<float, QAttribute::Float, 3> Buffer3fVisitor; +typedef BufferVisitor<float, Qt3DCore::QAttribute::Float, 3> Buffer3fVisitor; } // namespace Render diff --git a/src/render/backend/trianglesvisitor.cpp b/src/render/backend/trianglesvisitor.cpp index a58f2d20b..4cdf8a2bf 100644 --- a/src/render/backend/trianglesvisitor.cpp +++ b/src/render/backend/trianglesvisitor.cpp @@ -53,6 +53,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt3DCore; + namespace Qt3DRender { namespace Render { diff --git a/src/render/backend/trianglesvisitor_p.h b/src/render/backend/trianglesvisitor_p.h index d05eaef09..e8ac9bf27 100644 --- a/src/render/backend/trianglesvisitor_p.h +++ b/src/render/backend/trianglesvisitor_p.h @@ -52,7 +52,6 @@ // #include <Qt3DCore/qnodeid.h> -#include <Qt3DRender/QAttribute> #include <Qt3DRender/private/bufferutils_p.h> #include <Qt3DCore/private/vector3d_p.h> #include <Qt3DCore/private/vector4d_p.h> diff --git a/src/render/backend/visitorutils_p.h b/src/render/backend/visitorutils_p.h index 14183e11b..3ea848c6b 100644 --- a/src/render/backend/visitorutils_p.h +++ b/src/render/backend/visitorutils_p.h @@ -61,17 +61,17 @@ namespace Render { namespace Visitor { -template <QAttribute::VertexBaseType> struct EnumToType; -template <> struct EnumToType<QAttribute::Byte> { typedef const char type; }; -template <> struct EnumToType<QAttribute::UnsignedByte> { typedef const uchar type; }; -template <> struct EnumToType<QAttribute::Short> { typedef const short type; }; -template <> struct EnumToType<QAttribute::UnsignedShort> { typedef const ushort type; }; -template <> struct EnumToType<QAttribute::Int> { typedef const int type; }; -template <> struct EnumToType<QAttribute::UnsignedInt> { typedef const uint type; }; -template <> struct EnumToType<QAttribute::Float> { typedef const float type; }; -template <> struct EnumToType<QAttribute::Double> { typedef const double type; }; - -template<QAttribute::VertexBaseType v> +template <Qt3DCore::QAttribute::VertexBaseType> struct EnumToType; +template <> struct EnumToType<Qt3DCore::QAttribute::Byte> { typedef const char type; }; +template <> struct EnumToType<Qt3DCore::QAttribute::UnsignedByte> { typedef const uchar type; }; +template <> struct EnumToType<Qt3DCore::QAttribute::Short> { typedef const short type; }; +template <> struct EnumToType<Qt3DCore::QAttribute::UnsignedShort> { typedef const ushort type; }; +template <> struct EnumToType<Qt3DCore::QAttribute::Int> { typedef const int type; }; +template <> struct EnumToType<Qt3DCore::QAttribute::UnsignedInt> { typedef const uint type; }; +template <> struct EnumToType<Qt3DCore::QAttribute::Float> { typedef const float type; }; +template <> struct EnumToType<Qt3DCore::QAttribute::Double> { typedef const double type; }; + +template<Qt3DCore::QAttribute::VertexBaseType v> inline typename EnumToType<v>::type *castToType(const QByteArray &u, uint byteOffset) { return reinterpret_cast< typename EnumToType<v>::type *>(u.constData() + byteOffset); @@ -81,21 +81,21 @@ template<typename Func> void processBuffer(const BufferInfo &info, Func &f) { switch (info.type) { - case QAttribute::Byte: f(info, castToType<QAttribute::Byte>(info.data, info.byteOffset)); + case Qt3DCore::QAttribute::Byte: f(info, castToType<Qt3DCore::QAttribute::Byte>(info.data, info.byteOffset)); return; - case QAttribute::UnsignedByte: f(info, castToType<QAttribute::UnsignedByte>(info.data, info.byteOffset)); + case Qt3DCore::QAttribute::UnsignedByte: f(info, castToType<Qt3DCore::QAttribute::UnsignedByte>(info.data, info.byteOffset)); return; - case QAttribute::Short: f(info, castToType<QAttribute::Short>(info.data, info.byteOffset)); + case Qt3DCore::QAttribute::Short: f(info, castToType<Qt3DCore::QAttribute::Short>(info.data, info.byteOffset)); return; - case QAttribute::UnsignedShort: f(info, castToType<QAttribute::UnsignedShort>(info.data, info.byteOffset)); + case Qt3DCore::QAttribute::UnsignedShort: f(info, castToType<Qt3DCore::QAttribute::UnsignedShort>(info.data, info.byteOffset)); return; - case QAttribute::Int: f(info, castToType<QAttribute::Int>(info.data, info.byteOffset)); + case Qt3DCore::QAttribute::Int: f(info, castToType<Qt3DCore::QAttribute::Int>(info.data, info.byteOffset)); return; - case QAttribute::UnsignedInt: f(info, castToType<QAttribute::UnsignedInt>(info.data, info.byteOffset)); + case Qt3DCore::QAttribute::UnsignedInt: f(info, castToType<Qt3DCore::QAttribute::UnsignedInt>(info.data, info.byteOffset)); return; - case QAttribute::Float: f(info, castToType<QAttribute::Float>(info.data, info.byteOffset)); + case Qt3DCore::QAttribute::Float: f(info, castToType<Qt3DCore::QAttribute::Float>(info.data, info.byteOffset)); return; - case QAttribute::Double: f(info, castToType<QAttribute::Double>(info.data, info.byteOffset)); + case Qt3DCore::QAttribute::Double: f(info, castToType<Qt3DCore::QAttribute::Double>(info.data, info.byteOffset)); return; default: return; @@ -119,9 +119,9 @@ void visitPrimitives(NodeManagers *manager, const GeometryRenderer *renderer, Vi for (const Qt3DCore::QNodeId attrId : attrIds) { attribute = manager->lookupResource<Attribute, AttributeManager>(attrId); if (attribute){ - if (!positionAttribute && attribute->name() == QAttribute::defaultPositionAttributeName()) + if (!positionAttribute && attribute->name() == Qt3DCore::QAttribute::defaultPositionAttributeName()) positionAttribute = attribute; - else if (attribute->attributeType() == QAttribute::IndexAttribute) + else if (attribute->attributeType() == Qt3DCore::QAttribute::IndexAttribute) indexAttribute = attribute; } } |