Changeset 2715 for GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
- Timestamp:
- 05/27/08 10:57:05 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2714 r2715 1599 1599 } 1600 1600 1601 cout << " \**************\n******* new object hasid " << currentId << endl;1601 cout << "new object registered with id " << currentId << endl; 1602 1602 1603 1603 ++ sCurrentDynamicId; … … 1605 1605 // tell ray caster to update 1606 1606 ScheduleUpdateDynamicObjects(); 1607 1608 if (0)1609 {1610 // add to scene graph1611 mSceneGraph->GetRoot()->mChildren.push_back(leaf);1612 // add to ray caster1613 if (mRayCaster)1614 mRayCaster->AddDynamicObjecs(leaf->mGeometry, leaf->GetTransformation());1615 }1616 // $$ JB in order to compile1617 //return leaf;1618 1607 } 1619 1608 … … 1769 1758 preprocessor->mRayCaster->DeleteDynamicObjects(); 1770 1759 1771 #define MULTIPLE_OBJECTS 0 1772 #define CREATE_TRANSF_COPIES_OF_DYN_OBJECTS 1 1760 #define MULTIPLE_OBJECTS 1 1773 1761 1774 1762 #if MULTIPLE_OBJECTS 1775 #if CREATE_TRANSF_COPIES_OF_DYN_OBJECTS1776 1763 static ObjectContainer objects; 1777 1764 1778 if (objects.size()) { 1779 for (size_t i = 0; i < objects.size(); ++ i) { 1780 delete objects[i]; 1781 } 1782 objects.clear(); 1783 } 1765 CLEAR_CONTAINER(objects); 1784 1766 1785 1767 for (size_t i = 0; i < mDynamicObjects.size(); ++ i) { … … 1789 1771 Triangle3 t(((TriangleIntersectable *)l->mGeometry[j])->GetItem()); 1790 1772 t.ApplyTransformation(l->GetTransformation()); 1791 objects.push_back(new TriangleIntersectable(t)); 1773 TriangleIntersectable *to = new TriangleIntersectable(t); 1774 to->SetId(l->GetIntersectable()->GetId()); 1775 1776 objects.push_back(to); 1792 1777 } 1793 1778 } 1794 1779 } 1795 1780 mRayCaster->AddDynamicObjecs(objects, IdentityMatrix()); 1796 #else1797 mRayCaster->AddDynamicObjecs(objects, IdentityMatrix());1798 #endif1799 1781 #endif 1800 1782 … … 1802 1784 1803 1785 for (size_t i = 0; i < mDynamicObjects.size(); ++ i) 1804 1786 { 1805 1787 SceneGraphLeaf *l = mDynamicObjects[i]; 1806 1788 1807 1789 #if !MULTIPLE_OBJECTS 1808 UpdateObjectInRayCaster(l);1790 PrepareObjectsForRayCaster(l); 1809 1791 #endif 1810 1792 1811 1793 if (l->HasChanged()) 1812 { 1813 1794 { 1814 1795 cout<<"Updating affected PVSs..."<<endl; 1815 1796 preprocessor->ObjectMoved(l); 1816 1797 cout<<"done."<<endl; 1817 1798 l->SetHasChanged(false); 1818 } 1819 } 1820 1799 } 1800 } 1821 1801 1822 1802 mUpdateDynamicObjects = false; … … 1832 1812 1833 1813 1834 void Preprocessor:: UpdateObjectInRayCaster(SceneGraphLeaf *l)1814 void Preprocessor::PrepareObjectsForRayCaster(SceneGraphLeaf *l) 1835 1815 { 1836 1816 cout<<"Updating dynamic objects in ray caster..."<<endl;
Note: See TracChangeset
for help on using the changeset viewer.