Commit e2a1fc21 authored by Max Lyon's avatar Max Lyon

Added (single) texture support for OpenVolumeMesh

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@17042 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 09bcb32d
......@@ -8,3 +8,13 @@ if(Qwt5_Qt4_FOUND)
else()
openflipper_plugin()
endif()
if (EXISTS ${CMAKE_SOURCE_DIR}/ObjectTypes/PolyhedralMesh)
add_definitions (-DENABLE_OPENVOLUMEMESH_SUPPORT)
add_definitions (-DENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT)
endif()
if (EXISTS ${CMAKE_SOURCE_DIR}/ObjectTypes/HexahedralMesh)
add_definitions (-DENABLE_OPENVOLUMEMESH_SUPPORT)
add_definitions (-DENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT)
endif()
This diff is collapsed.
......@@ -61,6 +61,13 @@
#include <ObjectTypes/PolyMesh/PolyMesh.hh>
#include <ObjectTypes/TriangleMesh/TriangleMesh.hh>
#ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
#include <ObjectTypes/PolyhedralMesh/PolyhedralMesh.hh>
#endif
#ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT
#include <ObjectTypes/HexahedralMesh/HexahedralMesh.hh>
#endif
#include <OpenFlipper/common/Types.hh>
#include "textureProperties.hh"
......@@ -178,6 +185,12 @@ class TextureControlPlugin : public QObject, BaseInterface, BackupInterface, Tex
template< typename MeshT >
void doUpdateTexture ( Texture& _texture , MeshT& _mesh);
#ifdef ENABLE_OPENVOLUMEMESH_SUPPORT
/// Calls the correct \a copyTexture() function to copy the texture property into the displayed OVM property
template< typename VolumeMeshT, typename VolumeMeshObjectT >
void doUpdateTextureOVM ( Texture& _texture , VolumeMeshT& _mesh, VolumeMeshObjectT& meshObj);
#endif
template< typename MeshT >
void getOriginalHistogram(std::vector< double>& _x, std::vector< double>& _y,
int _textureid, MeshT& _mesh,
......@@ -187,6 +200,12 @@ class TextureControlPlugin : public QObject, BaseInterface, BackupInterface, Tex
template< typename MeshT >
void handleFileOpenTextures( MeshT*& _mesh , int _objectId );
#ifdef ENABLE_OPENVOLUMEMESH_SUPPORT
/// Handles data stored in new opened files ( e.g. Texture Information )
template< typename VolumeMeshObjectT >
void handleFileOpenTexturesOVM( VolumeMeshObjectT* _obj, int _id );
#endif
/** \brief parse texture mode settings
* Parses the string _mode and changes the settings in _texture according to the string.
* If the setting changes, it will return true.
......@@ -206,6 +225,12 @@ class TextureControlPlugin : public QObject, BaseInterface, BackupInterface, Tex
template< typename MeshT >
void copyTexture(Texture& _texture , MeshT& _mesh, OpenMesh::HPropHandleT< double > _texProp );
#ifdef ENABLE_OPENVOLUMEMESH_SUPPORT
/// Copy the supplied 1D vertex property to both coordinates of the 2D vertex OVM texture property
template< typename VolumeMeshT, typename VolumeMeshObjectT >
void copyTexture(Texture& _texture , VolumeMeshT& _mesh, VolumeMeshObjectT& _obj, OpenVolumeMesh::VertexPropertyT< double > _texProp );
#endif
/** @} */
//===========================================================================
......@@ -221,6 +246,12 @@ class TextureControlPlugin : public QObject, BaseInterface, BackupInterface, Tex
template< typename MeshT >
void copyTexture(Texture& _texture, MeshT& _mesh, OpenMesh::HPropHandleT< ACG::Vec2d > _texProp );
#ifdef ENABLE_OPENVOLUMEMESH_SUPPORT
/// Copy the supplied 2D vertex property to the 2D vertex OVM property
template< typename VolumeMeshT, typename VolumeMeshObjectT >
void copyTexture(Texture& _texture, VolumeMeshT& _mesh, VolumeMeshObjectT& _obj, OpenVolumeMesh::VertexPropertyT< ACG::Vec2d > _texProp );
#endif
/** @} */
//===========================================================================
......@@ -283,6 +314,18 @@ class TextureControlPlugin : public QObject, BaseInterface, BackupInterface, Tex
#include "TextureControl2DTextureHandlingT.cc"
#endif
#ifdef ENABLE_OPENVOLUMEMESH_SUPPORT
#if defined(INCLUDE_TEMPLATES) && !defined(TEXTURECONTROL_1D_TEXTURE_HANDLING_OVM_C)
#define TEXTURECONTROL_1D_TEXTURE_HANDLING_OVM_TEMPLATES
#include "TextureControl1DTextureHandlingOVMT.cc"
#endif
#if defined(INCLUDE_TEMPLATES) && !defined(TEXTURECONTROL_2D_TEXTURE_HANDLING_OVM_C)
#define TEXTURECONTROL_2D_TEXTURE_HANDLING_OVM_TEMPLATES
#include "TextureControl2DTextureHandlingOVMT.cc"
#endif
#endif
#if defined(INCLUDE_TEMPLATES) && !defined(TEXTURECONTROL_HISTOGRAMS_C)
#define TEXTURECONTROL_HISTOGRAMS_TEMPLATES
#include "TextureControlHistogramsT.cc"
......
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org *
* *
*--------------------------------------------------------------------------- *
* This file is part of OpenFlipper. *
* *
* 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 with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* 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 LesserGeneral Public *
* License along with OpenFlipper. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
#ifdef ENABLE_OPENVOLUMEMESH_SUPPORT
#define TEXTURECONTROL_1D_TEXTURE_HANDLING_OVM_C
#include "TextureControl.hh"
#include "TextureMath.hh"
template< typename VolumeMeshT, typename VolumeMeshObjectT >
void TextureControlPlugin::copyTexture( Texture& _texture , VolumeMeshT& _mesh, VolumeMeshObjectT& _obj, OpenVolumeMesh::VertexPropertyT< double > _texProp )
{
// Compute the minimal and maximal values for this texture
double max = -FLT_MIN;
double min = FLT_MAX;;
// Compute minimal and maximal value of the coordinates
// Keep track of absolute values!
for ( OpenVolumeMesh::VertexIter v_it = _mesh.vertices_begin() ; v_it != _mesh.vertices_end(); ++v_it) {
max = std::max( _texProp[*v_it] , max);
min = std::min( _texProp[*v_it] , min);
}
OpenVolumeMesh::TexCoordAttrib<ACG::Vec2f>& texcoord = _obj.texcoords();
TextureMath convert(_texture.parameters,min,max);
for ( OpenVolumeMesh::VertexIter v_it = _mesh.vertices_begin(); v_it != _mesh.vertices_end(); ++v_it) {
// Get the value of the property
double value = _texProp[*v_it];
// Mangle it with the predefined user options (including absolute, clamping, ...)
value = convert.transform(value);
// Write result to the OpenMesh texture coordinates ( 2d accessing the diagonal of a 2d texture)
texcoord[*v_it] = ACG::Vec2f(float(value), float(value) );
}
}
#endif
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org *
* *
*--------------------------------------------------------------------------- *
* This file is part of OpenFlipper. *
* *
* 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 with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* 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 LesserGeneral Public *
* License along with OpenFlipper. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
#ifdef ENABLE_OPENVOLUMEMESH_SUPPORT
#define TEXTURECONTROL_2D_TEXTURE_HANDLING_OVM_C
#include "TextureControl.hh"
template< typename VolumeMeshT, typename VolumeMeshObjectT >
void TextureControlPlugin::copyTexture ( Texture& /*_texture*/, VolumeMeshT& _mesh, VolumeMeshObjectT& _obj, OpenVolumeMesh::VertexPropertyT< ACG::Vec2d > _texProp )
{
OpenVolumeMesh::TexCoordAttrib<ACG::Vec2f>& texcoord = _obj.texcoords();
for ( OpenVolumeMesh::VertexIter v_it = _mesh.vertices_begin(); v_it != _mesh.vertices_end(); ++v_it)
texcoord[*v_it] = _texProp[*v_it];
}
#endif
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