Commit b1f66b66 authored by Jan Möbius's avatar Jan Möbius
Browse files

Created infrastructure for index property processing

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@8439 383ad7c9-94d9-4d36-a494-682f7c89f535
parent bcebb092
...@@ -69,7 +69,7 @@ mesh_(_mesh), ...@@ -69,7 +69,7 @@ mesh_(_mesh),
triangulated_(false), triangulated_(false),
updatePerEdgeBuffers_(true), updatePerEdgeBuffers_(true),
updatePerFaceBuffers_(true), updatePerFaceBuffers_(true),
indexPropertyName_("f:textureindex") textureIndexProperty_(-1)
{ {
} }
...@@ -261,7 +261,18 @@ buildStripsTriMesh() ...@@ -261,7 +261,18 @@ buildStripsTriMesh()
processed(f_it) = used(f_it) = false; processed(f_it) = used(f_it) = false;
} }
/// \todo check for texture index here // Check if we have to take care of textures
// If this property is not available, we do not have texture info and will therefore
// skip texture handling in strip generation
bool textureHandling = false;
if ( textureIndexProperty_.is_valid() ) {
std::cerr << "Stripprocessor ; Handle Textures trimesh" << std::endl;
textureHandling = true;
} else {
std::cerr << "Stripprocessor ; No Textures trimesh" << std::endl;
}
/// \todo Implement texture processing here
for (f_it=mesh_.faces_begin(); true; ) for (f_it=mesh_.faces_begin(); true; )
{ {
...@@ -331,20 +342,18 @@ buildStripPolyMesh(typename Mesh::HalfedgeHandle _start_hh, ...@@ -331,20 +342,18 @@ buildStripPolyMesh(typename Mesh::HalfedgeHandle _start_hh,
strip.push_back(mesh_.from_vertex_handle(_start_hh).idx()); strip.push_back(mesh_.from_vertex_handle(_start_hh).idx());
strip.push_back(mesh_.to_vertex_handle(_start_hh).idx()); strip.push_back(mesh_.to_vertex_handle(_start_hh).idx());
// Don't update face map here! See below why
// Check if we have to take care of textures // Check if we have to take care of textures
// If this property is not available, we do not have texture info and will therefore // If this property is not available, we do not have texture info and will therefore
// skip texture handling in strip generation // skip texture handling in strip generation
bool textureHandling = false; bool textureHandling = false;
OpenMesh::FPropHandleT< int > texture_index_property; if ( textureIndexProperty_.is_valid() ) {
if ( mesh_.get_property_handle(texture_index_property,indexPropertyName_) ) { std::cerr << "Stripprocessor ; Handle Textures polymesh" << std::endl;
std::cerr << "Texture index property found!" << std::endl;
textureHandling = true; textureHandling = true;
} else { } else {
std::cerr << "No textures" << std::endl; std::cerr << "Stripprocessor ; No Textures polymesh" << std::endl;
} }
/// \todo Implement texture processing here
// Walk along the strip: 1st direction // Walk along the strip: 1st direction
// We construct the strip by using alternating vertices // We construct the strip by using alternating vertices
...@@ -937,10 +946,12 @@ perFaceColorBuffer() { ...@@ -937,10 +946,12 @@ perFaceColorBuffer() {
template <class Mesh> template <class Mesh>
void void
StripProcessorT<Mesh>:: StripProcessorT<Mesh>::
setIndexPropertyName( std::string _index_property_name ) { setIndexPropertyName( std::string _indexPropertyName ) {
indexPropertyName_ = _index_property_name;
std::cerr << "setIndexPropertyName " << _index_property_name << std::endl; if ( !mesh_.get_property_handle(textureIndexProperty_,_indexPropertyName) ) {
textureIndexProperty_.invalidate();
std::cerr << "StripProcessor: Unable to get per face texture Index property named " << _indexPropertyName << std::endl;
}
// mark the buffers as invalid as we have a new per face index array // mark the buffers as invalid as we have a new per face index array
invalidatePerFaceBuffers(); invalidatePerFaceBuffers();
......
...@@ -408,17 +408,18 @@ public: ...@@ -408,17 +408,18 @@ public:
* property and generates strips which contain only the same index. If the property is not * property and generates strips which contain only the same index. If the property is not
* found, strips will be independend of this property * found, strips will be independend of this property
*/ */
void setIndexPropertyName( std::string _index_property_name ); void setIndexPropertyName( std::string _indexPropertyName );
private: private:
/** \brief Property name of the per face texture index.
/** \brief Property for the per face texture index.
* *
* This name is used by the mesh for texture index specification. * This property is used by the mesh for texture index specification.
* If this is empty, Then it is assumed that there is one or no active * If this is invalid, then it is assumed that there is one or no active
* texture. This means that the generated strips will be independent of texture * texture. This means that the generated strips will be independent of texture
* information. * information.
*/ */
std::string indexPropertyName_; OpenMesh::FPropHandleT< int > textureIndexProperty_;
/** @} */ /** @} */
......
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