mirror of https://github.com/axmolengine/axmol.git
Merge branch 'gles20' of git://github.com/cocos2d/cocos2d-x into gles20
This commit is contained in:
commit
539a524627
|
@ -622,6 +622,10 @@ void CCTexture2D::setTexParameters(ccTexParams *texParams)
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, texParams->magFilter );
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, texParams->wrapS );
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, texParams->wrapT );
|
||||
|
||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
||||
VolatileTexture::setTexParameters(this, texParams);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CCTexture2D::setAliasTexParameters()
|
||||
|
@ -638,6 +642,10 @@ void CCTexture2D::setAliasTexParameters()
|
|||
}
|
||||
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
|
||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
||||
ccTexParams texParams = {m_bHasMipmaps?GL_NEAREST_MIPMAP_NEAREST:GL_NEAREST,GL_NEAREST,GL_NONE,GL_NONE};
|
||||
VolatileTexture::setTexParameters(this, &texParams);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CCTexture2D::setAntiAliasTexParameters()
|
||||
|
@ -654,6 +662,10 @@ void CCTexture2D::setAntiAliasTexParameters()
|
|||
}
|
||||
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
||||
ccTexParams texParams = {m_bHasMipmaps?GL_LINEAR_MIPMAP_NEAREST:GL_LINEAR,GL_LINEAR,GL_NONE,GL_NONE};
|
||||
VolatileTexture::setTexParameters(this, &texParams);
|
||||
#endif
|
||||
}
|
||||
|
||||
const char* CCTexture2D::stringForFormat()
|
||||
|
|
|
@ -713,6 +713,10 @@ VolatileTexture::VolatileTexture(CCTexture2D *t)
|
|||
, m_fFontSize(0.0f)
|
||||
{
|
||||
m_size = CCSizeMake(0, 0);
|
||||
m_texParams.minFilter = GL_LINEAR;
|
||||
m_texParams.magFilter = GL_LINEAR;
|
||||
m_texParams.wrapS = GL_CLAMP_TO_EDGE;
|
||||
m_texParams.wrapT = GL_CLAMP_TO_EDGE;
|
||||
textures.push_back(this);
|
||||
}
|
||||
|
||||
|
@ -801,6 +805,20 @@ void VolatileTexture::addStringTexture(CCTexture2D *tt, const char* text, const
|
|||
vt->m_strText = text;
|
||||
}
|
||||
|
||||
void VolatileTexture::setTexParameters(CCTexture2D *t, ccTexParams *texParams)
|
||||
{
|
||||
VolatileTexture *vt = findVolotileTexture(t);
|
||||
|
||||
if (texParams->minFilter != GL_NONE)
|
||||
vt->m_texParams.minFilter = texParams->minFilter;
|
||||
if (texParams->magFilter != GL_NONE)
|
||||
vt->m_texParams.magFilter = texParams->magFilter;
|
||||
if (texParams->wrapS != GL_NONE)
|
||||
vt->m_texParams.wrapS = texParams->wrapS;
|
||||
if (texParams->wrapT != GL_NONE)
|
||||
vt->m_texParams.wrapT = texParams->wrapT;
|
||||
}
|
||||
|
||||
void VolatileTexture::removeTexture(CCTexture2D *t)
|
||||
{
|
||||
|
||||
|
@ -890,6 +908,7 @@ void VolatileTexture::reloadAllTextures()
|
|||
default:
|
||||
break;
|
||||
}
|
||||
vt->texture->setTexParameters(&vt->m_texParams);
|
||||
}
|
||||
|
||||
isReloading = false;
|
||||
|
|
|
@ -195,6 +195,7 @@ public:
|
|||
static void addDataTexture(CCTexture2D *tt, void* data, CCTexture2DPixelFormat pixelFormat, const CCSize& contentSize);
|
||||
static void addCCImage(CCTexture2D *tt, CCImage *image);
|
||||
|
||||
static void setTexParameters(CCTexture2D *t, ccTexParams *texParams);
|
||||
static void removeTexture(CCTexture2D *t);
|
||||
static void reloadAllTextures();
|
||||
|
||||
|
@ -221,6 +222,7 @@ protected:
|
|||
std::string m_strFileName;
|
||||
CCImage::EImageFormat m_FmtImage;
|
||||
|
||||
ccTexParams m_texParams;
|
||||
CCSize m_size;
|
||||
CCTextAlignment m_alignment;
|
||||
CCVerticalTextAlignment m_vAlignment;
|
||||
|
|
|
@ -32,8 +32,6 @@ THE SOFTWARE.
|
|||
#include "shaders/CCGLProgram.h"
|
||||
#include "support/CCPointExtension.h"
|
||||
#include "support/data_support/ccCArray.h"
|
||||
#include "support/CCNotificationCenter.h"
|
||||
#include "CCEventType.h"
|
||||
#include "CCDirector.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
@ -99,26 +97,11 @@ bool CCTMXLayer::initWithTilesetInfo(CCTMXTilesetInfo *tilesetInfo, CCTMXLayerIn
|
|||
m_bUseAutomaticVertexZ = false;
|
||||
m_nVertexZvalue = 0;
|
||||
|
||||
|
||||
// listen the event of "EVNET_COME_TO_FOREGROUND", this event only trigged on android
|
||||
CCNotificationCenter::sharedNotificationCenter()->addObserver(this,
|
||||
callfuncO_selector(CCTMXLayer::listenBackToForeground),
|
||||
EVNET_COME_TO_FOREGROUND,
|
||||
NULL);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CCTMXLayer::listenBackToForeground(CCObject *sender)
|
||||
{
|
||||
if (m_pobTextureAtlas)
|
||||
{
|
||||
m_pobTextureAtlas->getTexture()->setAliasTexParameters();
|
||||
}
|
||||
}
|
||||
|
||||
CCTMXLayer::CCTMXLayer()
|
||||
:m_tLayerSize(CCSizeZero)
|
||||
,m_tMapTileSize(CCSizeZero)
|
||||
|
@ -143,8 +126,6 @@ CCTMXLayer::~CCTMXLayer()
|
|||
}
|
||||
|
||||
CC_SAFE_DELETE_ARRAY(m_pTiles);
|
||||
|
||||
CCNotificationCenter::sharedNotificationCenter()->removeObserver(this, EVNET_COME_TO_FOREGROUND);
|
||||
}
|
||||
|
||||
CCTMXTilesetInfo * CCTMXLayer::getTileSet()
|
||||
|
|
|
@ -158,11 +158,6 @@ public:
|
|||
virtual void addChild(CCNode * child, int zOrder, int tag);
|
||||
// super method
|
||||
void removeChild(CCNode* child, bool cleanup);
|
||||
|
||||
/** listen the event to invoke CCTexture2D::setAliasTexParameters() after
|
||||
comming to foreground on android
|
||||
*/
|
||||
void listenBackToForeground(CCObject *sender);
|
||||
|
||||
inline const char* getLayerName(){ return m_sLayerName.c_str(); }
|
||||
inline void setLayerName(const char *layerName){ m_sLayerName = layerName; }
|
||||
|
|
Loading…
Reference in New Issue