Skip to content
Snippets Groups Projects
Commit ffef61d2 authored by Jan Möbius's avatar Jan Möbius
Browse files

Split out 1D and 2D Texture copy functions into seperate file

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@3719 383ad7c9-94d9-4d36-a494-682f7c89f535
parent e4b74494
No related branches found
No related tags found
No related merge requests found
......@@ -155,12 +155,28 @@ class TextureControlPlugin : public QObject, BaseInterface, TextureInterface, Me
template< typename MeshT >
void doUpdateTexture ( int _textureid, MeshT& _mesh);
//===========================================================================
/** @name 1D Texture copy functions( copy 1D input textures to target texture coordinates and transform values )
* @{ */
//===========================================================================
/// Copy the supplied 1D vertex property to both coordinates of the 2D vertex OM texture property
template< typename MeshT >
void copyTexture(int _textureid, MeshT& _mesh, OpenMesh::VPropHandleT< double > _texProp );
/// Copy the supplied 1D halfedge property to both coordinates of the 2D halfedge OM texture property
template< typename MeshT >
void copyTexture(int _textureid, MeshT& _mesh, OpenMesh::HPropHandleT< double > _texProp );
/** @} */
//===========================================================================
/** @name 2D Texture copy functions( copy 2D input textures to target texture coordinates and transform values )
* @{ */
//===========================================================================
/// Copy the supplied 2D vertex property to the 2D vertex OM property
template< typename MeshT >
void copyTexture(int _textureid, MeshT& _mesh, OpenMesh::VPropHandleT< ACG::Vec2d > _texProp );
......@@ -168,8 +184,22 @@ class TextureControlPlugin : public QObject, BaseInterface, TextureInterface, Me
template< typename MeshT >
void copyTexture(int _textureid, MeshT& _mesh, OpenMesh::HPropHandleT< ACG::Vec2d > _texProp );
/** @} */
public slots:
QString version() { return QString("1.0"); };
};
//=============================================================================
#if defined(INCLUDE_TEMPLATES) && !defined(TEXTURECONTROL_1D_TEXTURE_HANDLING_C)
#define TEXTURECONTROL_1D_TEXTURE_HANDLING_TEMPLATES
#include "TextureControl1DTextureHandlingT.cc"
#endif
#if defined(INCLUDE_TEMPLATES) && !defined(TEXTURECONTROL_2D_TEXTURE_HANDLING_C)
#define TEXTURECONTROL_2D_TEXTURE_HANDLING_TEMPLATES
#include "TextureControl2DTextureHandlingT.cc"
#endif
#endif //TEXTURECONTROLPLUGIN_HH
//=============================================================================
//
// OpenFlipper
// Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
// www.openflipper.org
//
//-----------------------------------------------------------------------------
//
// License
//
// OpenFlipper is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenFlipper is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenFlipper. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
// $Revision: 3583 $
// $Author: moebius $
// $Date: 2008-10-27 17:23:38 +0100 (Mo, 27. Okt 2008) $
//
//=============================================================================
#define TEXTURECONTROL_1D_TEXTURE_HANDLING_C
#include "TextureControl.hh"
template< typename MeshT >
void TextureControlPlugin::copyTexture ( int _textureid, MeshT& _mesh, OpenMesh::VPropHandleT< double > _texProp )
{
double max,min;
computeMinMaxScalar(_textureid, _mesh, _texProp, min, max);
for ( typename MeshT::VertexIter v_it = _mesh.vertices_begin(); v_it != _mesh.vertices_end(); ++v_it) {
double value = _mesh.property(_texProp, v_it);
computeValue(_textureid, min, max, value);
_mesh.set_texcoord2D( v_it, ACG::Vec2f(float(value), float(value) ) );
}
}
template< typename MeshT >
void TextureControlPlugin::copyTexture ( int _textureid, MeshT& _mesh, OpenMesh::HPropHandleT< double > _texProp )
{
double max,min;
computeMinMaxScalar(_textureid, _mesh, _texProp, min, max);
for ( typename MeshT::HalfedgeIter h_it = _mesh.halfedges_begin(); h_it != _mesh.halfedges_end(); ++h_it) {
double value = _mesh.property(_texProp, h_it);
computeValue(_textureid, min, max, value);
_mesh.set_texcoord2D( h_it, ACG::Vec2f(float(value), float(value) ) );
}
}
//=============================================================================
//
// OpenFlipper
// Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
// www.openflipper.org
//
//-----------------------------------------------------------------------------
//
// License
//
// OpenFlipper is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenFlipper is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenFlipper. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
// $Revision: 3583 $
// $Author: moebius $
// $Date: 2008-10-27 17:23:38 +0100 (Mo, 27. Okt 2008) $
//
//=============================================================================
#define TEXTURECONTROL_2D_TEXTURE_HANDLING_C
#include "TextureControl.hh"
template< typename MeshT >
void TextureControlPlugin::copyTexture ( int /*_textureid*/, MeshT& _mesh, OpenMesh::VPropHandleT< OpenMesh::Vec2d > _texProp )
{
for ( typename MeshT::VertexIter v_it = _mesh.vertices_begin(); v_it != _mesh.vertices_end(); ++v_it) {
OpenMesh::Vec2d value = _mesh.property(_texProp, v_it);
_mesh.set_texcoord2D( v_it, ACG::Vec2f(float(value[0]), float(value[1]) ) );
}
}
template< typename MeshT >
void TextureControlPlugin::copyTexture ( int /*_textureid*/, MeshT& _mesh, OpenMesh::HPropHandleT< OpenMesh::Vec2d > _texProp )
{
for ( typename MeshT::HalfedgeIter h_it = _mesh.halfedges_begin(); h_it != _mesh.halfedges_end(); ++h_it) {
OpenMesh::Vec2d value = _mesh.property(_texProp, h_it);
_mesh.set_texcoord2D( h_it, ACG::Vec2f(float(value[0]), float(value[1]) ) );
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment