From fddcebd479d78081b22c3e1009c9c92f194e8771 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sun, 16 Dec 2007 13:25:40 +0000 Subject: [PATCH] Added StateSetManipulator for testing purposes, and fixed typo --- examples/osgforest/osgforest.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/osgforest/osgforest.cpp b/examples/osgforest/osgforest.cpp index 71d999964..c05ad3a5e 100644 --- a/examples/osgforest/osgforest.cpp +++ b/examples/osgforest/osgforest.cpp @@ -42,6 +42,7 @@ #include #include +#include #include @@ -101,7 +102,7 @@ public: bool divide(unsigned int maxNumTreesPerCell=10); - bool devide(bool xAxis, bool yAxis, bool zAxis); + bool divide(bool xAxis, bool yAxis, bool zAxis); void bin(); @@ -243,7 +244,7 @@ bool ForestTechniqueManager::Cell::divide(unsigned int maxNumTreesPerCell) float radius = _bb.radius(); float divide_distance = radius*0.7f; - if (devide((_bb.xMax()-_bb.xMin())>divide_distance,(_bb.yMax()-_bb.yMin())>divide_distance,(_bb.zMax()-_bb.zMin())>divide_distance)) + if (divide((_bb.xMax()-_bb.xMin())>divide_distance,(_bb.yMax()-_bb.yMin())>divide_distance,(_bb.zMax()-_bb.zMin())>divide_distance)) { // recusively divide the new cells till maxNumTreesPerCell is met. for(CellList::iterator citr=_cells.begin(); @@ -260,7 +261,7 @@ bool ForestTechniqueManager::Cell::divide(unsigned int maxNumTreesPerCell) } } -bool ForestTechniqueManager::Cell::devide(bool xAxis, bool yAxis, bool zAxis) +bool ForestTechniqueManager::Cell::divide(bool xAxis, bool yAxis, bool zAxis) { if (!(xAxis || yAxis || zAxis)) return false; @@ -1099,6 +1100,7 @@ int main( int argc, char **argv ) osg::ref_ptr ttm = new ForestTechniqueManager; viewer.addEventHandler(new TechniqueEventHandler(ttm.get())); + viewer.addEventHandler(new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet())); // add model to viewer. viewer.setSceneData( ttm->createScene((unsigned int)numTreesToCreates) );