Commit 2c62d5dc authored by Jan Möbius's avatar Jan Möbius

Request texcoords before using them!

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@8458 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b106a889
......@@ -115,13 +115,16 @@ void TextureControlPlugin::copyTexture ( Texture& _texture , MeshT& _mesh, OpenM
double max,min;
computeMinMaxScalar(_texture, _mesh, _texProp, min, max);
if ( !_mesh.has_vertex_texcoords2D() )
_mesh.request_vertex_texcoords2D();
for ( typename MeshT::VertexIter v_it = _mesh.vertices_begin(); v_it != _mesh.vertices_end(); ++v_it) {
// Get the value of the property
double value = _mesh.property(_texProp, v_it);
// Mangle it with the predefined user options
computeValue(_texture, min, max, value);
// Write result to the openmesh texture coordinates ( 2d accessing the diagonal of a 2d texture)
_mesh.set_texcoord2D( v_it, ACG::Vec2f(float(value), float(value) ) );
}
......@@ -134,6 +137,9 @@ void TextureControlPlugin::copyTexture ( Texture& _texture , MeshT& _mesh, OpenM
double max,min;
computeMinMaxScalar(_texture, _mesh, _texProp, min, max);
if ( !_mesh.has_vertex_texcoords2D() )
_mesh.request_vertex_texcoords2D();
for ( typename MeshT::HalfedgeIter h_it = _mesh.halfedges_begin(); h_it != _mesh.halfedges_end(); ++h_it) {
// Get the value of the property
......
......@@ -47,11 +47,14 @@
template< typename MeshT >
void TextureControlPlugin::copyTexture ( Texture& /*_texture*/, MeshT& _mesh, OpenMesh::VPropHandleT< OpenMesh::Vec2d > _texProp )
{
if ( !_mesh.has_vertex_texcoords2D() )
_mesh.request_vertex_texcoords2D();
for ( typename MeshT::VertexIter v_it = _mesh.vertices_begin(); v_it != _mesh.vertices_end(); ++v_it) {
// Get the value of the property
OpenMesh::Vec2d value = _mesh.property(_texProp, v_it);
// Write result to the openmesh texture coordinates
_mesh.set_texcoord2D( v_it, ACG::Vec2f(float(value[0]), float(value[1]) ) );
}
......@@ -60,6 +63,9 @@ void TextureControlPlugin::copyTexture ( Texture& /*_texture*/, MeshT& _mesh, Op
template< typename MeshT >
void TextureControlPlugin::copyTexture ( Texture& /*_texture*/, MeshT& _mesh, OpenMesh::HPropHandleT< OpenMesh::Vec2d > _texProp )
{
if ( !_mesh.has_vertex_texcoords2D() )
_mesh.request_vertex_texcoords2D();
for ( typename MeshT::HalfedgeIter h_it = _mesh.halfedges_begin(); h_it != _mesh.halfedges_end(); ++h_it) {
// Get the value of the property
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment