PLY: add support for unsigned custom property length

This commit is contained in:
Jan Möbius
2019-09-03 08:15:16 +02:00
parent b15e09d1d3
commit d91986fc30
2 changed files with 15 additions and 3 deletions

View File

@@ -219,11 +219,11 @@ void _PLYReader_::readCreateCustomProperty(std::istream& _in, BaseImporter& _bi,
} }
//init vector //init vector
int numberOfValues; unsigned int numberOfValues;
read(_listType, _in, numberOfValues, OpenMesh::GenProg::Bool2Type<binary>()); readInteger(_listType, _in, numberOfValues, OpenMesh::GenProg::Bool2Type<binary>());
std::vector<T> vec(numberOfValues); std::vector<T> vec(numberOfValues);
//read and assign //read and assign
for (int i = 0; i < numberOfValues; ++i) for (unsigned int i = 0; i < numberOfValues; ++i)
{ {
read(_valueType, _in, vec[i], OpenMesh::GenProg::Bool2Type<binary>()); read(_valueType, _in, vec[i], OpenMesh::GenProg::Bool2Type<binary>());
} }

View File

@@ -212,6 +212,18 @@ private:
_in >> _value; _in >> _value;
} }
template<typename T>
inline void readInteger(_PLYReader_::ValueType _type, std::istream& _in, T& _value, OpenMesh::GenProg::TrueType /*_binary*/) const
{
readInteger(_type, _in, _value);
}
template<typename T>
inline void readInteger(_PLYReader_::ValueType _type, std::istream& _in, T& _value, OpenMesh::GenProg::FalseType /*_binary*/) const
{
_in >> _value;
}
//read and assign custom properties with the given type. Also creates property, if not exist //read and assign custom properties with the given type. Also creates property, if not exist
template<bool binary, typename T, typename Handle> template<bool binary, typename T, typename Handle>
void readCreateCustomProperty(std::istream& _in, BaseImporter& _bi, Handle _h, const std::string& _propName, const ValueType _valueType, const ValueType _listType) const; void readCreateCustomProperty(std::istream& _in, BaseImporter& _bi, Handle _h, const std::string& _propName, const ValueType _valueType, const ValueType _listType) const;