From b2cf978ae316a90db6d28f1acb2943ef230bdb7d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 6 Dec 2010 10:35:02 +0000 Subject: [PATCH] Renamed YES and NO enums with more description names that don't overlap with iOS #define's --- include/osgUtil/Optimizer | 9 +++------ src/osgUtil/Optimizer.cpp | 42 +++++++++++++++++++-------------------- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/include/osgUtil/Optimizer b/include/osgUtil/Optimizer index 858405426..931f65e6c 100644 --- a/include/osgUtil/Optimizer +++ b/include/osgUtil/Optimizer @@ -760,14 +760,11 @@ class OSGUTIL_EXPORT Optimizer unsigned int _indexFirstOfRow; ///< Contain the index of the first element of the last row. enum FitsIn { - NO, - YES, + DOES_NOT_FIT_IN_ANY_ROW, + FITS_IN_CURRENT_ROW, IN_NEXT_ROW }; - //Return YES if it fits in the current row, - //NO if it can't fit in any row. - //IN_NEXT_ROW if it can't fin the the current row, but can fit in next row or atlas. - FitsIn doesSourceFit(Source* source); + FitsIn doesSourceFit(Source* source); bool addSource(Source* source); void clampToNearestPowerOfTwoSize(); void copySources(); diff --git a/src/osgUtil/Optimizer.cpp b/src/osgUtil/Optimizer.cpp index 68232cdfc..dd3594a2d 100644 --- a/src/osgUtil/Optimizer.cpp +++ b/src/osgUtil/Optimizer.cpp @@ -3525,7 +3525,7 @@ void Optimizer::TextureAtlasBuilder::buildAtlas() { OSG_INFO<<"checking source "<_image->getFileName()<<" to see it it'll fit in atlas "<get()<doesSourceFit(source); - if (fitsIn == Optimizer::TextureAtlasBuilder::Atlas::YES) + if (fitsIn == Optimizer::TextureAtlasBuilder::Atlas::FITS_IN_CURRENT_ROW) { addedSourceToAtlas = true; (*aitr)->addSource(source); // Add in the currentRow. @@ -3741,13 +3741,13 @@ Optimizer::TextureAtlasBuilder::Atlas::FitsIn Optimizer::TextureAtlasBuilder::At { // does the source have a valid image? const osg::Image* sourceImage = source->_image.get(); - if (!sourceImage) return NO; + if (!sourceImage) return DOES_NOT_FIT_IN_ANY_ROW; // does pixel format match? if (_image.valid()) { - if (_image->getPixelFormat() != sourceImage->getPixelFormat()) return NO; - if (_image->getDataType() != sourceImage->getDataType()) return NO; + if (_image->getPixelFormat() != sourceImage->getPixelFormat()) return DOES_NOT_FIT_IN_ANY_ROW; + if (_image->getDataType() != sourceImage->getDataType()) return DOES_NOT_FIT_IN_ANY_ROW; } const osg::Texture2D* sourceTexture = source->_texture.get(); @@ -3757,20 +3757,20 @@ Optimizer::TextureAtlasBuilder::Atlas::FitsIn Optimizer::TextureAtlasBuilder::At sourceTexture->getWrap(osg::Texture2D::WRAP_S)==osg::Texture2D::MIRROR) { // can't support repeating textures in texture atlas - return NO; + return DOES_NOT_FIT_IN_ANY_ROW; } if (sourceTexture->getWrap(osg::Texture2D::WRAP_T)==osg::Texture2D::REPEAT || sourceTexture->getWrap(osg::Texture2D::WRAP_T)==osg::Texture2D::MIRROR) { // can't support repeating textures in texture atlas - return NO; + return DOES_NOT_FIT_IN_ANY_ROW; } if (sourceTexture->getReadPBuffer()!=0) { // pbuffer textures not suitable - return NO; + return DOES_NOT_FIT_IN_ANY_ROW; } if (_texture.valid()) @@ -3785,55 +3785,55 @@ Optimizer::TextureAtlasBuilder::Atlas::FitsIn Optimizer::TextureAtlasBuilder::At if (sourceUsesBorder!=atlasUsesBorder) { // border wrapping does not match - return NO; + return DOES_NOT_FIT_IN_ANY_ROW; } if (sourceUsesBorder) { // border colours don't match - if (_texture->getBorderColor() != sourceTexture->getBorderColor()) return NO; + if (_texture->getBorderColor() != sourceTexture->getBorderColor()) return DOES_NOT_FIT_IN_ANY_ROW; } if (_texture->getFilter(osg::Texture2D::MIN_FILTER) != sourceTexture->getFilter(osg::Texture2D::MIN_FILTER)) { // inconsitent min filters - return NO; + return DOES_NOT_FIT_IN_ANY_ROW; } if (_texture->getFilter(osg::Texture2D::MAG_FILTER) != sourceTexture->getFilter(osg::Texture2D::MAG_FILTER)) { // inconsitent mag filters - return NO; + return DOES_NOT_FIT_IN_ANY_ROW; } if (_texture->getMaxAnisotropy() != sourceTexture->getMaxAnisotropy()) { // anisotropy different. - return NO; + return DOES_NOT_FIT_IN_ANY_ROW; } if (_texture->getInternalFormat() != sourceTexture->getInternalFormat()) { // internal formats inconistent - return NO; + return DOES_NOT_FIT_IN_ANY_ROW; } if (_texture->getShadowCompareFunc() != sourceTexture->getShadowCompareFunc()) { // shadow functions inconsitent - return NO; + return DOES_NOT_FIT_IN_ANY_ROW; } if (_texture->getShadowTextureMode() != sourceTexture->getShadowTextureMode()) { // shadow texture mode inconsitent - return NO; + return DOES_NOT_FIT_IN_ANY_ROW; } if (_texture->getShadowAmbient() != sourceTexture->getShadowAmbient()) { // shadow ambient inconsitent - return NO; + return DOES_NOT_FIT_IN_ANY_ROW; } } } @@ -3841,19 +3841,19 @@ Optimizer::TextureAtlasBuilder::Atlas::FitsIn Optimizer::TextureAtlasBuilder::At if (sourceImage->s() + 2*_margin > _maximumAtlasWidth) { // image too big for Atlas - return NO; + return DOES_NOT_FIT_IN_ANY_ROW; } if (sourceImage->t() + 2*_margin > _maximumAtlasHeight) { // image too big for Atlas - return NO; + return DOES_NOT_FIT_IN_ANY_ROW; } if ((_y + sourceImage->t() + 2*_margin) > _maximumAtlasHeight) { // image doesn't have up space in height axis. - return NO; + return DOES_NOT_FIT_IN_ANY_ROW; } // does the source fit in the current row? @@ -3861,7 +3861,7 @@ Optimizer::TextureAtlasBuilder::Atlas::FitsIn Optimizer::TextureAtlasBuilder::At { // yes it fits :-) OSG_INFO<<"Fits in current row"<