diff --git a/src/osg/Group.cpp b/src/osg/Group.cpp index a349db02b..8a390d1a9 100644 --- a/src/osg/Group.cpp +++ b/src/osg/Group.cpp @@ -1,3 +1,4 @@ + #include #include #include @@ -53,7 +54,17 @@ void Group::traverse(NodeVisitor& nv) bool Group::addChild( Node *child ) { - if (child && !containsNode(child)) + if (!child) return false; + +#if ENSURE_CHILD_IS_UNIQUE + if (containsNode(child)) + { + notify(WARN)<<"Adding non unique child to osg::Group, ignoring call"< automatically handles incrementing child's reference count. _children.push_back(child); diff --git a/src/osgPlugins/flt/ReaderWriterATTR.cpp b/src/osgPlugins/flt/ReaderWriterATTR.cpp index 8e7162b92..273a58db6 100644 --- a/src/osgPlugins/flt/ReaderWriterATTR.cpp +++ b/src/osgPlugins/flt/ReaderWriterATTR.cpp @@ -603,6 +603,42 @@ StateSet* Attr::createOsgStateSet() break; } +/* An email on ATTR mappings to OpenGL : "[osg-news] OpenFlight Texture Filter Modes" + from Joseph Steel: + + + I posted a query on a forum on the Multigen web site re. the OpenFlight + texture filer modes. This is the reply: + + Here are the mappings used by Creator under OpenGL: + For Minification: + Point (0): GL_NEAREST + Bilinear (1): GL_LINEAR + Mipmap Point (3): GL_NEAREST_MIPMAP_NEAREST + Mipmap Linear (4): GL_NEAREST_MIPMAP_LINEAR + Mipmap Bilinear (5): GL_LINEAR_MIPMAP_NEAREST + Mipmap Trilinear (6): GL_LINEAR_MIPMAP_LINEAR + Bicubic (8): GL_LINEAR_MIPMAP_NEAREST + Bilinear Greater/Equal (9): GL_LINEAR_MIPMAP_NEAREST + Bilinear Less/Equal (10): GL_LINEAR_MIPMAP_NEAREST + Bicubic Greater/Equal (11): GL_LINEAR_MIPMAP_NEAREST + Bicubic Less/Equal (12): GL_LINEAR_MIPMAP_NEAREST + For Magnification: + Point (0): GL_NEAREST + Bilinear (1): GL_LINEAR + Bicubic (3): GL_LINEAR + Sharpen (4): GL_LINEAR + Add Detail (5): GL_LINEAR + Modulate Detail (6): GL_LINEAR + Bilinear Greater/Equal (7): GL_LINEAR + Bilinear Less/Equal (8): GL_LINEAR + Bicubic Greater/Equal (9): GL_LINEAR + Bicubic Less/Equal (10): GL_LINEAR + + Note that mode 2 for both minification & magnification are no longer + supported. +*/ + // ----------- // Min filter // ----------- @@ -613,11 +649,7 @@ StateSet* Attr::createOsgStateSet() osgTexture->setFilter(osg::Texture2D::MIN_FILTER, Texture2D::NEAREST); break; case MIN_FILTER_BILINEAR: - // TX_BILINEAR is an old IrisGL mode which should map to OpenGL's LINEAR - // osgTexture->setFilter(osg::Texture2D::MIN_FILTER, Texture2D::LINEAR); - // but we're getting awful quality so we'll use LINEAR_MIP_MAP_LINEAR instead. - osg::notify(osg::INFO) << "texture mode MIN_FILTER_BILINEAR encountered, remapping to LINEAR_MIPMAP_LINEAR"<setFilter(osg::Texture2D::MIN_FILTER, Texture2D::LINEAR_MIPMAP_LINEAR); + osgTexture->setFilter(osg::Texture2D::MIN_FILTER, Texture2D::LINEAR); break; case MIN_FILTER_MIPMAP_POINT: osgTexture->setFilter(osg::Texture2D::MIN_FILTER, Texture2D::NEAREST_MIPMAP_NEAREST); @@ -632,23 +664,15 @@ StateSet* Attr::createOsgStateSet() osgTexture->setFilter(osg::Texture2D::MIN_FILTER, Texture2D::LINEAR_MIPMAP_LINEAR); break; case MIN_FILTER_BICUBIC: - osg::notify(osg::INFO) << "MIN_FILTER_BICUBIC"<< std::endl; - osgTexture->setFilter(osg::Texture2D::MIN_FILTER, Texture2D::LINEAR); - break; case MIN_FILTER_BILINEAR_GEQUAL: case MIN_FILTER_BILINEAR_LEQUAL: - // from IrisGL->OpenGL doc its looks like this is old IrisGL mdoe for shadowing support. - // should probably look - osg::notify(osg::INFO) << "texture mode MIN_FILTER_BILINEAR_*EQUAL encountered, remapping to LINEAR"<setFilter(osg::Texture2D::MIN_FILTER, Texture2D::LINEAR); - break; case MIN_FILTER_BICUBIC_GEQUAL: case MIN_FILTER_BICUBIC_LEQUAL: + osgTexture->setFilter(osg::Texture2D::MIN_FILTER, Texture2D::LINEAR_MIPMAP_NEAREST); + break; default: - // from IrisGL->OpenGL doc its looks like this is old IrisGL mdoe for shadowing support. - // should probably look - osg::notify(osg::INFO) << "texture mode MIN_FILTER_BICUBIC_*EQUAL encountered, remapping to LINEAR"<setFilter(osg::Texture2D::MIN_FILTER, Texture2D::LINEAR); + osgTexture->setFilter(osg::Texture2D::MIN_FILTER, Texture2D::LINEAR_MIPMAP_LINEAR); + break; break; } @@ -666,19 +690,13 @@ StateSet* Attr::createOsgStateSet() case MAG_FILTER_BILINEAR_GEQUAL: case MAG_FILTER_BILINEAR_LEQUAL: case MAG_FILTER_SHARPEN: - osgTexture->setFilter(osg::Texture2D::MAG_FILTER, Texture2D::LINEAR); - break; case MAG_FILTER_BICUBIC: case MAG_FILTER_BICUBIC_GEQUAL: case MAG_FILTER_BICUBIC_LEQUAL: + case MAG_FILTER_ADD_DETAIL: + case MAG_FILTER_MODULATE_DETAIL: osgTexture->setFilter(osg::Texture2D::MAG_FILTER, Texture2D::LINEAR); - osgTexture->setMaxAnisotropy(2.0f); break; - -// case MAG_FILTER_ADD_DETAIL: -// case MAG_FILTER_MODULATE_DETAIL: -// osgTexture->setFilter(osg::Texture2D::MAG_FILTER, Texture2D::LINEAR); -// break; } // I have just ported the two below set*Attribute lines to use the new diff --git a/src/osgPlugins/flt/Record.cpp b/src/osgPlugins/flt/Record.cpp index 4e42c95c4..cdd8e74a5 100644 --- a/src/osgPlugins/flt/Record.cpp +++ b/src/osgPlugins/flt/Record.cpp @@ -132,13 +132,22 @@ void PrimNodeRecord::addChild( Record *child ) { if (child==NULL) return; +#if ENSURE_CHILD_IS_UNIQUE ChildList::iterator itr = std::find(_children.begin(),_children.end(),child); if (itr==_children.end()) { +#endif // note ref_ptr<> automatically handles incrementing child's reference count. _children.push_back(child); child->_pParent = this; + +#if ENSURE_CHILD_IS_UNIQUE } + else + { + std::cout<<"Trying to add non unique child, ignoring"<