// Copyright (C) 2015 Paul Lemire paul.lemire350@gmail.com // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QT3DCORE_BUFFERUTILS_P_H #define QT3DCORE_BUFFERUTILS_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists for the convenience // of other Qt classes. This header file may change from version to // version without notice, or even be removed. // // We mean it. // #include #include #include QT_BEGIN_NAMESPACE namespace Qt3DCore { class QGeometryView; class QBuffer; struct BufferInfo { BufferInfo() : type(Qt3DCore::QAttribute::VertexBaseType::Float) , dataSize(0) , count(0) , byteStride(0) , byteOffset(0) , restartEnabled(false) , restartIndexValue(-1) {} QByteArray data; Qt3DCore::QAttribute::VertexBaseType type; uint dataSize; uint count; uint byteStride; uint byteOffset; bool restartEnabled; int restartIndexValue; }; namespace BufferTypeInfo { template struct EnumToType; template <> struct EnumToType { typedef const char type; }; template <> struct EnumToType { typedef const uchar type; }; template <> struct EnumToType { typedef const short type; }; template <> struct EnumToType { typedef const ushort type; }; template <> struct EnumToType { typedef const int type; }; template <> struct EnumToType { typedef const uint type; }; template <> struct EnumToType { typedef const float type; }; template <> struct EnumToType { typedef const double type; }; template typename EnumToType::type *castToType(const QByteArray &u, uint byteOffset) { return reinterpret_cast< typename EnumToType::type *>(u.constData() + byteOffset); } } // namespace BufferTypeInfo } // namespace Qt3DCore QT_END_NAMESPACE #endif // QT3DCORE_BUFFERUTILS_P_H