* added texCoord3d functions to objloader
* added unittest for texcoords3d * added texcoord3d support to baseimporter
This commit is contained in:
@@ -106,6 +106,9 @@ public:
|
||||
// add texture coordinates per face, _vh references the first texcoord
|
||||
virtual void add_face_texcoords( FaceHandle _fh, VertexHandle _vh, const std::vector<Vec2f>& _face_texcoords) = 0;
|
||||
|
||||
// add texture 3d coordinates per face, _vh references the first texcoord
|
||||
virtual void add_face_texcoords( FaceHandle _fh, VertexHandle _vh, const std::vector<Vec3f>& _face_texcoords) = 0;
|
||||
|
||||
// Set the texture index for a face
|
||||
virtual void set_face_texindex( FaceHandle _fh, int _texId ) = 0;
|
||||
|
||||
@@ -133,6 +136,12 @@ public:
|
||||
// set vertex texture coordinate
|
||||
virtual void set_texcoord(HalfedgeHandle _heh, const Vec2f& _texcoord) = 0;
|
||||
|
||||
// set 3d vertex texture coordinate
|
||||
virtual void set_texcoord(VertexHandle _vh, const Vec3f& _texcoord) = 0;
|
||||
|
||||
// set 3d vertex texture coordinate
|
||||
virtual void set_texcoord(HalfedgeHandle _heh, const Vec3f& _texcoord) = 0;
|
||||
|
||||
// set edge color
|
||||
virtual void set_color(EdgeHandle _eh, const Vec3uc& _color) = 0;
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@ public:
|
||||
typedef typename Mesh::Normal Normal;
|
||||
typedef typename Mesh::Color Color;
|
||||
typedef typename Mesh::TexCoord2D TexCoord2D;
|
||||
typedef typename Mesh::TexCoord3D TexCoord3D;
|
||||
typedef std::vector<VertexHandle> VHandles;
|
||||
|
||||
|
||||
@@ -217,6 +218,19 @@ public:
|
||||
mesh_.set_texcoord2D(_heh, vector_cast<TexCoord2D>(_texcoord));
|
||||
}
|
||||
|
||||
virtual void set_texcoord(VertexHandle _vh, const Vec3f& _texcoord)
|
||||
{
|
||||
if (mesh_.has_vertex_texcoords3D())
|
||||
mesh_.set_texcoord3D(_vh, vector_cast<TexCoord3D>(_texcoord));
|
||||
}
|
||||
|
||||
virtual void set_texcoord(HalfedgeHandle _heh, const Vec3f& _texcoord)
|
||||
{
|
||||
if (mesh_.has_halfedge_texcoords3D())
|
||||
mesh_.set_texcoord3D(_heh, vector_cast<TexCoord3D>(_texcoord));
|
||||
}
|
||||
|
||||
|
||||
// edge attributes
|
||||
|
||||
virtual void set_color(EdgeHandle _eh, const Vec4uc& _color)
|
||||
@@ -292,6 +306,23 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void add_face_texcoords( FaceHandle _fh, VertexHandle _vh, const std::vector<Vec3f>& _face_texcoords)
|
||||
{
|
||||
// get first halfedge handle
|
||||
HalfedgeHandle cur_heh = mesh_.halfedge_handle(_fh);
|
||||
HalfedgeHandle end_heh = mesh_.prev_halfedge_handle(cur_heh);
|
||||
|
||||
// find start heh
|
||||
while( mesh_.to_vertex_handle(cur_heh) != _vh && cur_heh != end_heh )
|
||||
cur_heh = mesh_.next_halfedge_handle( cur_heh);
|
||||
|
||||
for(unsigned int i=0; i<_face_texcoords.size(); ++i)
|
||||
{
|
||||
set_texcoord( cur_heh, _face_texcoords[i]);
|
||||
cur_heh = mesh_.next_halfedge_handle( cur_heh);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void set_face_texindex( FaceHandle _fh, int _texId ) {
|
||||
if ( mesh_.has_face_texture_index() ) {
|
||||
mesh_.set_texture_index(_fh , _texId);
|
||||
|
||||
Reference in New Issue
Block a user