Modified Files:
model.cxx: Leave it to osg when to do mipmapping.
This commit is contained in:
@@ -37,18 +37,6 @@
|
|||||||
SG_USING_STD(vector);
|
SG_USING_STD(vector);
|
||||||
SG_USING_STD(set);
|
SG_USING_STD(set);
|
||||||
|
|
||||||
static inline
|
|
||||||
int nMipMaps(int s)
|
|
||||||
{
|
|
||||||
s = s >> 2;
|
|
||||||
int n = 0;
|
|
||||||
do {
|
|
||||||
++n;
|
|
||||||
s = s >> 1;
|
|
||||||
} while(s);
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Little helper class that holds an extra reference to a
|
// Little helper class that holds an extra reference to a
|
||||||
// loaded 3d model.
|
// loaded 3d model.
|
||||||
// Since we clone all structural nodes from our 3d models,
|
// Since we clone all structural nodes from our 3d models,
|
||||||
@@ -154,15 +142,6 @@ public:
|
|||||||
|
|
||||||
int s = image->s();
|
int s = image->s();
|
||||||
int t = image->t();
|
int t = image->t();
|
||||||
|
|
||||||
int mipmaplevels = 0;
|
|
||||||
if (s < t) {
|
|
||||||
mipmaplevels = nMipMaps(s);
|
|
||||||
} else {
|
|
||||||
mipmaplevels = nMipMaps(t);
|
|
||||||
}
|
|
||||||
texture->setNumMipmapLevels(mipmaplevels);
|
|
||||||
|
|
||||||
if (s <= t && 32 <= s) {
|
if (s <= t && 32 <= s) {
|
||||||
texture->setInternalFormatMode(mFormatMode);
|
texture->setInternalFormatMode(mFormatMode);
|
||||||
} else if (t < s && 32 <= t) {
|
} else if (t < s && 32 <= t) {
|
||||||
@@ -344,8 +323,7 @@ public:
|
|||||||
static SGReadCallbackInstaller readCallbackInstaller;
|
static SGReadCallbackInstaller readCallbackInstaller;
|
||||||
|
|
||||||
osg::Texture2D*
|
osg::Texture2D*
|
||||||
SGLoadTexture2D(const std::string& path, bool wrapu, bool wrapv,
|
SGLoadTexture2D(const std::string& path, bool wrapu, bool wrapv, int)
|
||||||
int mipmaplevels)
|
|
||||||
{
|
{
|
||||||
osg::Image* image = osgDB::readImageFile(path);
|
osg::Image* image = osgDB::readImageFile(path);
|
||||||
osg::Texture2D* texture = new osg::Texture2D;
|
osg::Texture2D* texture = new osg::Texture2D;
|
||||||
@@ -363,15 +341,6 @@ SGLoadTexture2D(const std::string& path, bool wrapu, bool wrapv,
|
|||||||
int s = image->s();
|
int s = image->s();
|
||||||
int t = image->t();
|
int t = image->t();
|
||||||
|
|
||||||
if (mipmaplevels < 0) {
|
|
||||||
if (s < t) {
|
|
||||||
mipmaplevels = nMipMaps(s);
|
|
||||||
} else {
|
|
||||||
mipmaplevels = nMipMaps(t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
texture->setNumMipmapLevels(mipmaplevels);
|
|
||||||
|
|
||||||
// OSGFIXME: guard with a flag
|
// OSGFIXME: guard with a flag
|
||||||
if (osg::Texture::getExtensions(0, true)->isTextureCompressionARBSupported()) {
|
if (osg::Texture::getExtensions(0, true)->isTextureCompressionARBSupported()) {
|
||||||
if (s <= t && 32 <= s) {
|
if (s <= t && 32 <= s) {
|
||||||
|
|||||||
Reference in New Issue
Block a user