52 #ifndef __PLYREADER_HH__
53 #define __PLYREADER_HH__
65 #include <OpenMesh/Core/System/config.h>
66 #include <OpenMesh/Core/Utils/SingletonT.hh>
67 #include <OpenMesh/Core/IO/reader/BaseReader.hh>
68 #include <OpenMesh/Core/Utils/GenProg.hh>
102 std::string
get_magic()
const override {
return "PLY"; }
104 bool read(
const std::string& _filename,
108 bool read(std::istream& _is,
112 bool can_u_read(
const std::string& _filename)
const override;
116 ValueTypeINT8, ValueTypeCHAR,
117 ValueTypeUINT8, ValueTypeUCHAR,
118 ValueTypeINT16, ValueTypeSHORT,
119 ValueTypeUINT16, ValueTypeUSHORT,
120 ValueTypeINT32, ValueTypeINT,
121 ValueTypeUINT32, ValueTypeUINT,
122 ValueTypeFLOAT32, ValueTypeFLOAT,
123 ValueTypeFLOAT64, ValueTypeDOUBLE
128 bool can_u_read(std::istream& _is)
const;
130 bool read_ascii(std::istream& _in, BaseImporter& _bi,
const Options& _opt)
const;
131 bool read_binary(std::istream& _in, BaseImporter& _bi,
bool swap,
const Options& _opt)
const;
133 void readValue(ValueType _type , std::istream& _in,
float& _value)
const;
134 void readValue(ValueType _type , std::istream& _in,
double& _value)
const;
135 void readValue(ValueType _type , std::istream& _in,
unsigned int& _value)
const;
136 void readValue(ValueType _type , std::istream& _in,
unsigned short& _value)
const;
137 void readValue(ValueType _type , std::istream& _in,
unsigned char& _value)
const;
138 void readValue(ValueType _type , std::istream& _in,
int& _value)
const;
139 void readValue(ValueType _type , std::istream& _in,
short& _value)
const;
140 void readValue(ValueType _type , std::istream& _in,
signed char& _value)
const;
143 void readInteger(ValueType _type, std::istream& _in, T& _value)
const;
146 void consume_input(std::istream& _in,
int _count)
const {
147 _in.read(
reinterpret_cast<char*
>(&buff[0]), _count);
150 mutable unsigned char buff[8];
153 mutable Options options_;
156 mutable Options userOptions_;
158 mutable unsigned int vertexCount_;
159 mutable unsigned int faceCount_;
161 mutable uint vertexDimension_;
164 XCOORD,YCOORD,ZCOORD,
166 COLORRED,COLORGREEN,COLORBLUE,COLORALPHA,
167 XNORM,YNORM,ZNORM, CUSTOM_PROP, VERTEX_INDICES,
172 mutable std::map<ValueType, int> scalar_size_;
180 ValueType listIndexType;
181 PropertyInfo():property(UNSUPPORTED),value(Unsupported),name(
""),listIndexType(Unsupported){}
182 PropertyInfo(Property _p, ValueType _v):property(_p),value(_v),name(
""),listIndexType(Unsupported){}
183 PropertyInfo(Property _p, ValueType _v,
const std::string& _n):property(_p),value(_v),name(_n),listIndexType(Unsupported){}
198 std::vector< PropertyInfo > properties_;
201 mutable std::vector< ElementInfo > elements_;
204 inline void read(_PLYReader_::ValueType _type, std::istream& _in, T& _value, OpenMesh::GenProg::TrueType )
const
206 readValue(_type, _in, _value);
210 inline void read(_PLYReader_::ValueType _type, std::istream& _in, T& _value, OpenMesh::GenProg::FalseType )
const
216 inline void readInteger(_PLYReader_::ValueType _type, std::istream& _in, T& _value, OpenMesh::GenProg::TrueType )
const
218 readInteger(_type, _in, _value);
222 inline void readInteger(_PLYReader_::ValueType _type, std::istream& _in, T& _value, OpenMesh::GenProg::FalseType )
const
228 template<
bool binary,
typename T,
typename Handle>
229 void readCreateCustomProperty(std::istream& _in, BaseImporter& _bi, Handle _h,
const std::string& _propName,
const ValueType _valueType,
const ValueType _listType)
const;
231 template<
bool binary,
typename Handle>
232 void readCustomProperty(std::istream& _in, BaseImporter& _bi, Handle _h,
const std::string& _propName,
const _PLYReader_::ValueType _valueType,
const _PLYReader_::ValueType _listIndexType)
const;
241 OPENMESHDLLEXPORT _PLYReader_& PLYReader();
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
_PLYReader_ __PLYReaderInstance
Declare the single entity of the PLY reader.
Definition: PLYReader.cc:73
Base class for importer modules.
Definition: BaseImporter.hh:84
Set options for reader/writer modules.
Definition: Options.hh:91
Base class for reader modules.
Definition: BaseReader.hh:87
Implementation of the PLY format reader.
Definition: PLYReader.hh:95
std::string get_description() const override
Returns a brief description of the file type that can be parsed.
Definition: PLYReader.hh:100
std::string get_magic() const override
Return magic bits used to determine file format.
Definition: PLYReader.hh:102
std::string get_extensions() const override
Returns a string with the accepted file extensions separated by a whitespace and in small caps.
Definition: PLYReader.hh:101