/src/assimp/contrib/Open3DGC/o3dgcSC3DMCDecoder.h
Line | Count | Source |
1 | | /* |
2 | | Copyright (c) 2013 Khaled Mammou - Advanced Micro Devices, Inc. |
3 | | |
4 | | Permission is hereby granted, free of charge, to any person obtaining a copy |
5 | | of this software and associated documentation files (the "Software"), to deal |
6 | | in the Software without restriction, including without limitation the rights |
7 | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
8 | | copies of the Software, and to permit persons to whom the Software is |
9 | | furnished to do so, subject to the following conditions: |
10 | | |
11 | | The above copyright notice and this permission notice shall be included in |
12 | | all copies or substantial portions of the Software. |
13 | | |
14 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
15 | | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
16 | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
17 | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
18 | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
19 | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
20 | | THE SOFTWARE. |
21 | | */ |
22 | | |
23 | | |
24 | | #pragma once |
25 | | #ifndef O3DGC_SC3DMC_DECODER_H |
26 | | #define O3DGC_SC3DMC_DECODER_H |
27 | | |
28 | | #include "o3dgcCommon.h" |
29 | | #include "o3dgcBinaryStream.h" |
30 | | #include "o3dgcIndexedFaceSet.h" |
31 | | #include "o3dgcSC3DMCEncodeParams.h" |
32 | | #include "o3dgcTriangleListDecoder.h" |
33 | | |
34 | | namespace o3dgc |
35 | | { |
36 | | //! |
37 | | template <class T> |
38 | | class SC3DMCDecoder |
39 | | { |
40 | | public: |
41 | | //! Constructor. |
42 | | SC3DMCDecoder(void) |
43 | 0 | { |
44 | 0 | m_iterator = 0; |
45 | 0 | m_streamSize = 0; |
46 | 0 | m_quantFloatArray = 0; |
47 | 0 | m_quantFloatArraySize = 0; |
48 | 0 | m_normals = 0; |
49 | 0 | m_normalsSize = 0; |
50 | 0 | m_streamType = O3DGC_STREAM_TYPE_UNKOWN; |
51 | 0 | }; |
52 | | //! Destructor. |
53 | | ~SC3DMCDecoder(void) |
54 | 0 | { |
55 | 0 | delete [] m_normals; |
56 | 0 | delete [] m_quantFloatArray; |
57 | 0 | } |
58 | | //! |
59 | | O3DGCErrorCode DecodeHeader(IndexedFaceSet<T> & ifs, |
60 | | const BinaryStream & bstream); |
61 | | //! |
62 | | O3DGCErrorCode DecodePayload(IndexedFaceSet<T> & ifs, |
63 | | const BinaryStream & bstream); |
64 | | const SC3DMCStats & GetStats() const { return m_stats;} |
65 | | unsigned long GetIterator() const { return m_iterator;} |
66 | | O3DGCErrorCode SetIterator(unsigned long iterator) { m_iterator = iterator; return O3DGC_OK; } |
67 | | |
68 | | |
69 | | private: |
70 | | O3DGCErrorCode DecodeFloatArray(Real * const floatArray, |
71 | | unsigned long numfloatArraySize, |
72 | | unsigned long dimfloatArraySize, |
73 | | unsigned long stride, |
74 | | const Real * const minfloatArray, |
75 | | const Real * const maxfloatArray, |
76 | | unsigned long nQBits, |
77 | | const IndexedFaceSet<T> & ifs, |
78 | | O3DGCSC3DMCPredictionMode & predMode, |
79 | | const BinaryStream & bstream); |
80 | | O3DGCErrorCode IQuantizeFloatArray(Real * const floatArray, |
81 | | unsigned long numfloatArraySize, |
82 | | unsigned long dimfloatArraySize, |
83 | | unsigned long stride, |
84 | | const Real * const minfloatArray, |
85 | | const Real * const maxfloatArray, |
86 | | unsigned long nQBits); |
87 | | O3DGCErrorCode DecodeIntArray(long * const intArray, |
88 | | unsigned long numIntArraySize, |
89 | | unsigned long dimIntArraySize, |
90 | | unsigned long stride, |
91 | | const IndexedFaceSet<T> & ifs, |
92 | | O3DGCSC3DMCPredictionMode & predMode, |
93 | | const BinaryStream & bstream); |
94 | | O3DGCErrorCode ProcessNormals(const IndexedFaceSet<T> & ifs); |
95 | | |
96 | | unsigned long m_iterator; |
97 | | unsigned long m_streamSize; |
98 | | SC3DMCEncodeParams m_params; |
99 | | TriangleListDecoder<T> m_triangleListDecoder; |
100 | | long * m_quantFloatArray; |
101 | | unsigned long m_quantFloatArraySize; |
102 | | Vector<char> m_orientation; |
103 | | Real * m_normals; |
104 | | unsigned long m_normalsSize; |
105 | | SC3DMCStats m_stats; |
106 | | O3DGCStreamType m_streamType; |
107 | | }; |
108 | | } |
109 | | #include "o3dgcSC3DMCDecoder.inl" // template implementation |
110 | | #endif // O3DGC_SC3DMC_DECODER_H |
111 | | |