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

Added function to set an indexProperty name in stripprocessor and new mesh node

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@8438 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 8e2d13d9
......@@ -93,7 +93,8 @@ TriStripNodeT(Mesh& _mesh,
facePickingList_(0),
updateAnyPickingList_(true),
anyPickingBaseIndex_(0),
anyPickingList_(0)
anyPickingList_(0),
indexPropertyName_("f:textureindex")
{
/// \todo : Handle vbo not supported
......@@ -1242,6 +1243,14 @@ update_topology() {
// Unbind the buffer after the work has been done
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
}
template<class Mesh>
void
TriStripNodeT<Mesh>::
setIndexPropertyName( std::string _index_property_name ) {
indexPropertyName_ = _index_property_name;
stripProcessor_.setIndexPropertyName(indexPropertyName_);
};
//=============================================================================
} // namespace SceneGraph
......
......@@ -82,70 +82,6 @@ template <class Mesh>
class TriStripNodeT : public BaseNode
{
public:
// typedef OpenMesh::StripifierT<Mesh> MyStripifier;
// typedef MeshNodeT<Mesh> Base;
// typedef typename Base::FaceMode FaceMode;
//
//
// /// Default constructor
// TriStripNodeT(Mesh& _mesh,
// BaseNode* _parent=0,
// std::string _name="<TriStripNodeT>" )
// : Base(_mesh, _parent, _name),
// strips_(_mesh)
// {}
//
//
// /// Destructor
// ~TriStripNodeT() {}
//
//
// ACG_CLASSNAME(TriStripNodeT);
//
//
// /// build triangle strips, delete face indices
// void update_strips()
// {
// std::vector<unsigned int>().swap(Base::indices_);
// strips_.stripify();
// }
//
//
// /// build face indices, delete strips
// virtual void update_topology()
// {
// strips_.clear();
// Base::update_topology();
// }
//
//
//
// private:
//
// virtual void draw_faces(FaceMode _mode)
// {
// if (Base::mesh_.is_trimesh() &&
// _mode == Base::PER_VERTEX &&
// strips_.is_valid())
// {
// typename MyStripifier::StripsIterator strip_it = strips_.begin();
// typename MyStripifier::StripsIterator strip_last = strips_.end();
//
// for (; strip_it!=strip_last; ++strip_it)
// glDrawElements(GL_TRIANGLE_STRIP,
// strip_it->size(),
// GL_UNSIGNED_INT,
// &(*strip_it)[0] );
// }
// else Base::draw_faces(_mode);
// }
//
//
// MyStripifier strips_;
ACG_CLASSNAME(MeshNode);
/** \brief Default constructor
......@@ -508,6 +444,33 @@ private:
/** @} */
//===========================================================================
/** @name Texture handling
* @{ */
//===========================================================================
public:
/** \brief set the name of the property used for texture index specification
*
* The given property name will define a texture index. This index is used to make
* a lookup in the texture correspondence map containing for each index the gluint
* for the texture to be used. A zero in the property means, that no texture will be bound for the
* face.
* If you define a non existing name here, texture switching will be disabled and it
* is assumed that a texture is bound already.
*
*\todo Remove the external texture loading and do it here.
*
*/
void setIndexPropertyName( std::string _index_property_name );
private:
std::string indexPropertyName_;
/** @} */
/// \todo Remove all these functions afterwards!
......@@ -515,7 +478,7 @@ private:
void set_texture_map( std::map< int, GLuint>* _map){ };
void set_property_map( std::map< int, std::string>* _map){ };
void set_default_halfedge_textcoord_property( std::string _default_halfedge_textcoord_property ) {};
void set_index_property_name( std::string _index_property_name) { };
};
......
......@@ -125,15 +125,6 @@ public:
void set_default_halfedge_textcoord_property( std::string _default_halfedge_textcoord_property )
{ default_halfedge_textcoord_property_ = _default_halfedge_textcoord_property; };
/** \brief Property to use when switching between multiple textures
*
* The given mesh property has to contain an int index of textures to use per face.
* If it is not given, the default face_texture_index property of OpenMesh will be used.
* If there is no texture map given via set_texture_map, texture switching will be disabled and
* only the currently bound texture will be used.
*/
void set_index_property_name( std::string _index_property_name) { indexPropertyName_ = _index_property_name; };
protected:
......
......@@ -83,7 +83,6 @@ MeshNodeT(const Mesh& _mesh,
textureMap_(0),
propertyMap_(0),
default_halfedge_textcoord_property_("h:texcoords2D"),
indexPropertyName_("f:textureindex"),
bbMin_(FLT_MAX, FLT_MAX, FLT_MAX),
bbMax_(-FLT_MAX, -FLT_MAX, -FLT_MAX)
{
......
......@@ -261,6 +261,8 @@ buildStripsTriMesh()
processed(f_it) = used(f_it) = false;
}
/// \todo check for texture index here
for (f_it=mesh_.faces_begin(); true; )
{
// find start face
......@@ -932,6 +934,18 @@ perFaceColorBuffer() {
return &(perFaceColorBuffer_)[0];
};
template <class Mesh>
void
StripProcessorT<Mesh>::
setIndexPropertyName( std::string _index_property_name ) {
indexPropertyName_ = _index_property_name;
std::cerr << "setIndexPropertyName " << _index_property_name << std::endl;
// mark the buffers as invalid as we have a new per face index array
invalidatePerFaceBuffers();
};
//=============================================================================
} // namespace SceneGraph
} // namespace ACG
......
......@@ -401,6 +401,15 @@ private:
* @{ */
//===========================================================================
public:
/** \brief set the name of the property used for texture index specification
*
* The given property name will define a texture index. The strip processor checks this
* property and generates strips which contain only the same index. If the property is not
* found, strips will be independend of this property
*/
void setIndexPropertyName( std::string _index_property_name );
private:
/** \brief Property name of the per face texture index.
*
......
Supports Markdown
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