0001-Fixed-reloading-of-the-textures-which-have-mipmaps.patch

dotsquid, 2013-10-03 19:31

Download (2.8 kB)

b/cocos2dx/textures/CCTexture2D.cpp
768 768
    ccGLBindTexture2D( m_uName );
769 769
    glGenerateMipmap(GL_TEXTURE_2D);
770 770
    m_bHasMipmaps = true;
771
#if CC_ENABLE_CACHE_TEXTURE_DATA
772
    // cache the texture file name
773
    VolatileTexture::setMipmap(this, m_bHasMipmaps);
774
#endif
771 775
}
772 776

  
773 777
bool CCTexture2D::hasMipmaps()
b/cocos2dx/textures/CCTextureCache.cpp
718 718
, m_strText("")
719 719
, uiImage(NULL)
720 720
, m_fFontSize(0.0f)
721
, m_bHasMipmap(false)
721 722
{
722 723
    m_size = CCSizeMake(0, 0);
723 724
    m_texParams.minFilter = GL_LINEAR;
......
882 883
                        CCTexture2D::setDefaultAlphaPixelFormat(vt->m_PixelFormat);
883 884
                        vt->texture->initWithImage(pImage);
884 885
                        CCTexture2D::setDefaultAlphaPixelFormat(oldPixelFormat);
886
                        if (vt->hasMipmap())
887
                            vt->texture->generateMipmap();
885 888
                    }
886 889

  
887 890
                    CC_SAFE_DELETE_ARRAY(pBuffer);
......
923 926
    isReloading = false;
924 927
}
925 928

  
929
void VolatileTexture::setMipmap(CCTexture2D *tt, bool hasMipmap)
930
{
931
    VolatileTexture* vt = findVolotileTexture(tt);
932
    if (vt)
933
        vt->m_bHasMipmap = hasMipmap;
934
}
935

  
936
bool VolatileTexture::hasMipmap()
937
{
938
    return m_bHasMipmap;
939
}
940

  
926 941
#endif // CC_ENABLE_CACHE_TEXTURE_DATA
927 942

  
928 943
NS_CC_END
b/cocos2dx/textures/CCTextureCache.h
209 209
    static void removeTexture(CCTexture2D *t);
210 210
    static void reloadAllTextures();
211 211

  
212
    static void setMipmap(CCTexture2D *tt, bool hasMipmap);
213
    bool hasMipmap();
214

  
212 215
public:
213 216
    static std::list<VolatileTexture*> textures;
214 217
    static bool isReloading;
......
239 242
    std::string     m_strFontName;
240 243
    std::string     m_strText;
241 244
    float           m_fFontSize;
245
    bool            m_bHasMipmap;
242 246
};
243 247

  
244 248
#endif
245
-