| 1 | // Copyright (C) 2017 The Qt Company Ltd and/or its subsidiary(-ies). |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef PLYGEOMETRYLOADER_H |
| 5 | #define PLYGEOMETRYLOADER_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists for the convenience |
| 12 | // of other Qt classes. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include "basegeometryloader_p.h" |
| 19 | |
| 20 | QT_BEGIN_NAMESPACE |
| 21 | |
| 22 | namespace Qt3DRender { |
| 23 | |
| 24 | #define PLYGEOMETRYLOADER_EXT QLatin1String("ply") |
| 25 | |
| 26 | class PlyGeometryLoader : public BaseGeometryLoader |
| 27 | { |
| 28 | public: |
| 29 | enum DataType { |
| 30 | Int8, |
| 31 | Uint8, |
| 32 | Int16, |
| 33 | Uint16, |
| 34 | Int32, |
| 35 | Uint32, |
| 36 | Float32, |
| 37 | Float64, |
| 38 | TypeList, |
| 39 | TypeUnknown |
| 40 | }; |
| 41 | |
| 42 | enum PropertyType { |
| 43 | PropertyVertexIndex, |
| 44 | PropertyX, |
| 45 | PropertyY, |
| 46 | PropertyZ, |
| 47 | PropertyNormalX, |
| 48 | PropertyNormalY, |
| 49 | PropertyNormalZ, |
| 50 | PropertyTextureU, |
| 51 | PropertyTextureV, |
| 52 | PropertyUnknown, |
| 53 | }; |
| 54 | |
| 55 | enum Format { |
| 56 | FormatAscii, |
| 57 | FormatBinaryLittleEndian, |
| 58 | FormatBinaryBigEndian, |
| 59 | FormatUnknown, |
| 60 | }; |
| 61 | |
| 62 | enum ElementType { |
| 63 | ElementVertex, |
| 64 | ElementFace, |
| 65 | ElementUnknown, |
| 66 | }; |
| 67 | |
| 68 | struct Property { |
| 69 | PropertyType type; |
| 70 | DataType dataType; |
| 71 | DataType listSizeType; |
| 72 | DataType listElementType; |
| 73 | }; |
| 74 | |
| 75 | struct Element { |
| 76 | ElementType type; |
| 77 | int count; |
| 78 | QList<Property> properties; |
| 79 | }; |
| 80 | |
| 81 | protected: |
| 82 | bool doLoad(QIODevice *ioDev, const QString &subMesh) final; |
| 83 | |
| 84 | private: |
| 85 | bool (QIODevice *ioDev); |
| 86 | bool parseMesh(QIODevice *ioDev); |
| 87 | |
| 88 | Format m_format; |
| 89 | QList<Element> m_elements; |
| 90 | |
| 91 | bool m_hasNormals; |
| 92 | bool m_hasTexCoords; |
| 93 | }; |
| 94 | |
| 95 | } // namespace Qt3DRender |
| 96 | |
| 97 | QT_END_NAMESPACE |
| 98 | |
| 99 | #endif // PLYGEOMETRYLOADER_H |
| 100 | |