Changeset 10894
 Timestamp:
 12/15/09 13:37:49 (7 years ago)
 Location:
 OpenSceneGraph/trunk/src/osgUtil
 Files:

 15 added
 4 removed
 2 modified
Legend:
 Unmodified
 Added
 Removed

OpenSceneGraph/trunk/src/osgUtil/CMakeLists.txt
r9949 r10894 88 88 TransformAttributeFunctor.cpp 89 89 TransformCallback.cpp 90 TriStrip_graph_array.h 91 TriStrip_heap_array.h 92 TriStrip_tri_stripper.cpp 93 TriStrip_tri_stripper.h 90 91 tristripper/include/detail/graph_array.h 92 tristripper/include/detail/types.h 93 tristripper/include/detail/cache_simulator.h 94 tristripper/include/detail/policy.h 95 tristripper/include/detail/heap_array.h 96 tristripper/include/detail/connectivity_graph.h 97 tristripper/include/tri_stripper.h 98 tristripper/include/public_types.h 99 tristripper/src/tri_stripper.cpp 100 tristripper/src/policy.cpp 101 tristripper/src/connectivity_graph.cpp 102 94 103 TriStripVisitor.cpp 95 104 UpdateVisitor.cpp … … 97 106 ${OPENSCENEGRAPH_VERSIONINFO_RC} 98 107 ) 108 109 INCLUDE_DIRECTORIES("tristripper/include") 99 110 100 111 LINK_INTERNAL(${LIB_NAME} 
OpenSceneGraph/trunk/src/osgUtil/TriStripVisitor.cpp
r10764 r10894 23 23 #include <iterator> 24 24 25 #include " TriStrip_tri_stripper.h"25 #include "tristripper/include/tri_stripper.h" 26 26 27 27 using namespace osg; … … 183 183 184 184 IndexList _remapIndices; 185 triangle_stripper:: tri_stripper::indices _in_indices;185 triangle_stripper::indices _in_indices; 186 186 187 187 inline void operator()(unsigned int p1, unsigned int p2, unsigned int p3) … … 391 391 392 392 unsigned int in_numVertices = 0; 393 for(triangle_stripper:: tri_stripper::indices::iterator itr=taf._in_indices.begin();393 for(triangle_stripper::indices::iterator itr=taf._in_indices.begin(); 394 394 itr!=taf._in_indices.end(); 395 395 ++itr) … … 409 409 stripifier.SetMinStripSize(_minStripSize); 410 410 411 triangle_stripper::tri_stripper::primitives_vector outPrimitives; 412 if (!stripifier.Strip(&outPrimitives)) 411 triangle_stripper::primitive_vector outPrimitives; 412 stripifier.Strip(&outPrimitives); 413 if (outPrimitives.empty()) 413 414 { 414 415 osg::notify(osg::WARN)<<"Error: TriStripVisitor::stripify(Geometry& geom) failed."<<std::endl; … … 416 417 } 417 418 418 triangle_stripper:: tri_stripper::primitives_vector::iterator pitr;419 triangle_stripper::primitive_vector::iterator pitr; 419 420 if (_generateFourPointPrimitivesQuads) 420 421 { 421 422 osg::notify(osg::INFO)<<"Collecting all quads"<<std::endl; 422 423 423 typedef triangle_stripper:: tri_stripper::primitives_vector::iterator prim_iterator;424 typedef triangle_stripper::primitive_vector::iterator prim_iterator; 424 425 typedef std::multimap<unsigned int,prim_iterator> QuadMap; 425 426 QuadMap quadMap; … … 430 431 ++pitr) 431 432 { 432 if (pitr> m_Indices.size()==4)433 { 434 std::swap(pitr> m_Indices[2],pitr>m_Indices[3]);435 unsigned int minValue = *(std::max_element(pitr> m_Indices.begin(),pitr>m_Indices.end()));433 if (pitr>Indices.size()==4) 434 { 435 std::swap(pitr>Indices[2],pitr>Indices[3]); 436 unsigned int minValue = *(std::max_element(pitr>Indices.begin(),pitr>Indices.end())); 436 437 quadMap.insert(QuadMap::value_type(minValue,pitr)); 437 438 } … … 456 457 for(i=1;i<4;++i) 457 458 { 458 if (pitr> m_Indices[min_pos]>pitr>m_Indices[i])459 if (pitr>Indices[min_pos]>pitr>Indices[i]) 459 460 min_pos = i; 460 461 } 461 indices.push_back(pitr> m_Indices[min_pos]);462 indices.push_back(pitr> m_Indices[(min_pos+1)%4]);463 indices.push_back(pitr> m_Indices[(min_pos+2)%4]);464 indices.push_back(pitr> m_Indices[(min_pos+3)%4]);462 indices.push_back(pitr>Indices[min_pos]); 463 indices.push_back(pitr>Indices[(min_pos+1)%4]); 464 indices.push_back(pitr>Indices[(min_pos+2)%4]); 465 indices.push_back(pitr>Indices[(min_pos+3)%4]); 465 466 } 466 467 … … 505 506 ++pitr) 506 507 { 507 if (!_generateFourPointPrimitivesQuads  pitr> m_Indices.size()!=4)508 if (!_generateFourPointPrimitivesQuads  pitr>Indices.size()!=4) 508 509 { 509 510 bool inOrder = true; 510 unsigned int previousValue = pitr> m_Indices.front();511 for(triangle_stripper:: tri_stripper::indices::iterator qi_itr=pitr>m_Indices.begin()+1;512 qi_itr!=pitr> m_Indices.end() && inOrder;511 unsigned int previousValue = pitr>Indices.front(); 512 for(triangle_stripper::indices::iterator qi_itr=pitr>Indices.begin()+1; 513 qi_itr!=pitr>Indices.end() && inOrder; 513 514 ++qi_itr) 514 515 { … … 519 520 if (inOrder) 520 521 { 521 new_primitives.push_back(new osg::DrawArrays(pitr> m_Type,pitr>m_Indices.front(),pitr>m_Indices.size()));522 new_primitives.push_back(new osg::DrawArrays(pitr>Type,pitr>Indices.front(),pitr>Indices.size())); 522 523 } 523 524 else 524 525 { 525 unsigned int maxValue = *(std::max_element(pitr> m_Indices.begin(),pitr>m_Indices.end()));526 unsigned int maxValue = *(std::max_element(pitr>Indices.begin(),pitr>Indices.end())); 526 527 if (maxValue>=65536) 527 528 { 528 osg::DrawElementsUInt* elements = new osg::DrawElementsUInt(pitr> m_Type);529 elements>reserve(pitr> m_Indices.size());530 std::copy(pitr> m_Indices.begin(),pitr>m_Indices.end(),std::back_inserter(*elements));529 osg::DrawElementsUInt* elements = new osg::DrawElementsUInt(pitr>Type); 530 elements>reserve(pitr>Indices.size()); 531 std::copy(pitr>Indices.begin(),pitr>Indices.end(),std::back_inserter(*elements)); 531 532 new_primitives.push_back(elements); 532 533 } 533 534 else 534 535 { 535 osg::DrawElementsUShort* elements = new osg::DrawElementsUShort(pitr> m_Type);536 elements>reserve(pitr> m_Indices.size());537 std::copy(pitr> m_Indices.begin(),pitr>m_Indices.end(),std::back_inserter(*elements));536 osg::DrawElementsUShort* elements = new osg::DrawElementsUShort(pitr>Type); 537 elements>reserve(pitr>Indices.size()); 538 std::copy(pitr>Indices.begin(),pitr>Indices.end(),std::back_inserter(*elements)); 538 539 new_primitives.push_back(elements); 539 540 }