add methods to export the check if positions or normals are double and get them as doubles

This commit is contained in:
Max Lyon
2020-02-05 22:11:10 +01:00
parent c92a666658
commit 2356364085
3 changed files with 31 additions and 5 deletions

View File

@@ -289,7 +289,7 @@ namespace OMFormat {
inline size_t chunk_header_size( void ) { return sizeof(uint16); } inline size_t chunk_header_size( void ) { return sizeof(uint16); }
/// Return the size of a scale in bytes. /// Return the size of a scaler in bytes.
inline size_t scalar_size( const Chunk::Header& _hdr ) inline size_t scalar_size( const Chunk::Header& _hdr )
{ {
return _hdr.float_ ? (0x01 << _hdr.bits_) : (0x04 << _hdr.bits_); return _hdr.float_ ? (0x01 << _hdr.bits_) : (0x04 << _hdr.bits_);

View File

@@ -90,11 +90,15 @@ public:
// get vertex data // get vertex data
virtual Vec3f point(VertexHandle _vh) const = 0; virtual Vec3f point(VertexHandle _vh) const = 0;
virtual Vec3d pointd(VertexHandle _vh) const = 0;
virtual bool is_point_double() const = 0;
virtual Vec3f normal(VertexHandle _vh) const = 0; virtual Vec3f normal(VertexHandle _vh) const = 0;
virtual Vec3d normald(VertexHandle _vh) const = 0;
virtual bool is_normal_double() const = 0;
virtual Vec3uc color(VertexHandle _vh) const = 0; virtual Vec3uc color(VertexHandle _vh) const = 0;
virtual Vec4uc colorA(VertexHandle _vh) const = 0; virtual Vec4uc colorA(VertexHandle _vh) const = 0;
virtual Vec3ui colori(VertexHandle _vh) const = 0; virtual Vec3ui colori(VertexHandle _vh) const = 0;
virtual Vec4ui colorAi(VertexHandle _vh) const = 0; virtual Vec4ui colorAi(VertexHandle _vh) const = 0;
virtual Vec3f colorf(VertexHandle _vh) const = 0; virtual Vec3f colorf(VertexHandle _vh) const = 0;
virtual Vec4f colorAf(VertexHandle _vh) const = 0; virtual Vec4f colorAf(VertexHandle _vh) const = 0;
virtual Vec2f texcoord(VertexHandle _vh) const = 0; virtual Vec2f texcoord(VertexHandle _vh) const = 0;

View File

@@ -94,11 +94,33 @@ public:
return vector_cast<Vec3f>(mesh_.point(_vh)); return vector_cast<Vec3f>(mesh_.point(_vh));
} }
Vec3d pointd(VertexHandle _vh) const override
{
return vector_cast<Vec3d>(mesh_.point(_vh));
}
bool is_point_double() const override
{
return OMFormat::is_double(typename Mesh::Point()[0]);
}
bool is_normal_double() const override
{
return OMFormat::is_double(typename Mesh::Normal()[0]);
}
Vec3f normal(VertexHandle _vh) const override Vec3f normal(VertexHandle _vh) const override
{ {
return (mesh_.has_vertex_normals() return (mesh_.has_vertex_normals()
? vector_cast<Vec3f>(mesh_.normal(_vh)) ? vector_cast<Vec3f>(mesh_.normal(_vh))
: Vec3f(0.0f, 0.0f, 0.0f)); : Vec3f(0.0f, 0.0f, 0.0f));
}
Vec3d normald(VertexHandle _vh) const override
{
return (mesh_.has_vertex_normals()
? vector_cast<Vec3d>(mesh_.normal(_vh))
: Vec3d(0.0f, 0.0f, 0.0f));
} }
Vec3uc color(VertexHandle _vh) const override Vec3uc color(VertexHandle _vh) const override