32 #include "../external/tristripper/tri_stripper.cpp" 33 #include "../external/tristripper/policy.cpp" 34 #include "../external/tristripper/connectivity_graph.cpp" 48 void fillIndices(std::vector<unsigned int>& indices,
const DrawCall* dc,
bool substitute_quads)
55 indices.reserve( 1000 );
73 void TriangleStripGenerator::stripfy(
Geometry* geom,
int cache_size,
bool merge_strips,
bool remove_doubles,
bool substitute_quads)
81 for(
int idraw=geom->
drawCalls().size(); idraw--; )
85 triangle_stripper::indices indices;
87 fillIndices(indices, dc, substitute_quads);
89 std::vector<unsigned int> algo2_strip;
90 std::vector<unsigned int> algo2_tris;
93 tri_stripper striper(indices);
94 striper.SetCacheSize(cache_size);
95 striper.SetMinStripSize(4);
103 algo2_strip.reserve(indices.size());
104 for(
unsigned s=0; s<out.size(); ++s)
106 if (out[s].Type == TRIANGLE_STRIP)
109 for(
unsigned p=0; p<out[s].Indices.size(); ++p)
110 algo2_strip.push_back(out[s].Indices[p]);
114 memcpy(draw_elems->
indexBuffer()->
ptr(), &algo2_strip[0],
sizeof(
unsigned int)*algo2_strip.size());
120 for(
unsigned p=0; p<out[s].Indices.size(); ++p)
121 algo2_tris.push_back(out[s].Indices[p]);
125 memcpy(draw_elems->
indexBuffer()->
ptr(), &algo2_tris[0],
sizeof(
unsigned int)*algo2_tris.size());
bool hasNext()
Returns false if the iterator has reached the end of the triangle list.
Removes from a Geometry the vertices with the same attributes.
void removeDoubles(Geometry *geom)
The Geometry class is a Renderable that implements a polygonal mesh made of polygons, lines and points.
Visualization Library main namespace.
const unsigned char * ptr() const
Returns the pointer to the first element of the local buffer. Equivalent to bufferObject()->ptr() ...
virtual TriangleIterator triangleIterator() const =0
Returns a TriangleIterator used to iterate through the triangles of a DrawCall.
Iterator used to extract the indices of every single triangle of a DrawCall regardless of the primiti...
DrawCall * mergeTriangleStrips()
Merges all the PT_TRIANGLE_STRIP DrawElementsUInt objects into one single PT_TRIANGLE_STRIP DrawEleme...
arr_type * indexBuffer()
The BufferObject containing the indices used to render.
The base class of DrawArrays, DrawElements, MultiDrawElements and DrawRangeElements.
The ref<> class is used to reference-count an Object.
EPrimitiveType primitiveType() const
Returns the draw call's primitive type.
Collection< DrawCall > & drawCalls()
Returns the list of DrawCall objects bound to a Geometry.