diff --git a/spine-cocos2dx/2/src/spine/spine-cocos2dx.cpp b/spine-cocos2dx/2/src/spine/spine-cocos2dx.cpp index b91068a4e..97535db5a 100644 --- a/spine-cocos2dx/2/src/spine/spine-cocos2dx.cpp +++ b/spine-cocos2dx/2/src/spine/spine-cocos2dx.cpp @@ -34,9 +34,37 @@ USING_NS_CC; +GLuint wrap (spAtlasWrap wrap) { + return wrap == SP_ATLAS_CLAMPTOEDGE ? GL_CLAMP_TO_EDGE : GL_REPEAT; +} + +GLuint filter (spAtlasFilter filter) { + switch (filter) { + case SP_ATLAS_NEAREST: + return GL_NEAREST; + case SP_ATLAS_LINEAR: + return GL_LINEAR; + case SP_ATLAS_MIPMAP: + return GL_LINEAR_MIPMAP_LINEAR; + case SP_ATLAS_MIPMAP_NEAREST_NEAREST: + return GL_NEAREST_MIPMAP_NEAREST; + case SP_ATLAS_MIPMAP_LINEAR_NEAREST: + return GL_LINEAR_MIPMAP_NEAREST; + case SP_ATLAS_MIPMAP_NEAREST_LINEAR: + return GL_NEAREST_MIPMAP_LINEAR; + case SP_ATLAS_MIPMAP_LINEAR_LINEAR: + return GL_LINEAR_MIPMAP_LINEAR; + } + return GL_LINEAR; +} + void _spAtlasPage_createTexture (spAtlasPage* self, const char* path) { CCTexture2D* texture = CCTextureCache::sharedTextureCache()->addImage(path); texture->retain(); + + ccTexParams textureParams = {filter(self->minFilter), filter(self->magFilter), wrap(self->uWrap), wrap(self->vWrap)}; + texture->setTexParameters(&textureParams); + self->rendererObject = texture; self->width = texture->getPixelsWide(); self->height = texture->getPixelsHigh(); diff --git a/spine-cocos2dx/3/src/spine/spine-cocos2dx.cpp b/spine-cocos2dx/3/src/spine/spine-cocos2dx.cpp index 2efd39b2b..8bc8fc105 100644 --- a/spine-cocos2dx/3/src/spine/spine-cocos2dx.cpp +++ b/spine-cocos2dx/3/src/spine/spine-cocos2dx.cpp @@ -34,9 +34,37 @@ USING_NS_CC; +GLuint wrap (spAtlasWrap wrap) { + return wrap == SP_ATLAS_CLAMPTOEDGE ? GL_CLAMP_TO_EDGE : GL_REPEAT; +} + +GLuint filter (spAtlasFilter filter) { + switch (filter) { + case SP_ATLAS_NEAREST: + return GL_NEAREST; + case SP_ATLAS_LINEAR: + return GL_LINEAR; + case SP_ATLAS_MIPMAP: + return GL_LINEAR_MIPMAP_LINEAR; + case SP_ATLAS_MIPMAP_NEAREST_NEAREST: + return GL_NEAREST_MIPMAP_NEAREST; + case SP_ATLAS_MIPMAP_LINEAR_NEAREST: + return GL_LINEAR_MIPMAP_NEAREST; + case SP_ATLAS_MIPMAP_NEAREST_LINEAR: + return GL_NEAREST_MIPMAP_LINEAR; + case SP_ATLAS_MIPMAP_LINEAR_LINEAR: + return GL_LINEAR_MIPMAP_LINEAR; + } + return GL_LINEAR; +} + void _spAtlasPage_createTexture (spAtlasPage* self, const char* path) { Texture2D* texture = Director::getInstance()->getTextureCache()->addImage(path); texture->retain(); + + Texture2D::TexParams textureParams = {filter(self->minFilter), filter(self->magFilter), wrap(self->uWrap), wrap(self->vWrap)}; + texture->setTexParameters(&textureParams); + self->rendererObject = texture; self->width = texture->getPixelsWide(); self->height = texture->getPixelsHigh(); diff --git a/spine-sfml/src/spine/spine-sfml.cpp b/spine-sfml/src/spine/spine-sfml.cpp index 37689683d..c40da9441 100644 --- a/spine-sfml/src/spine/spine-sfml.cpp +++ b/spine-sfml/src/spine/spine-sfml.cpp @@ -40,7 +40,10 @@ using namespace sf; void _AtlasPage_createTexture (AtlasPage* self, const char* path){ Texture* texture = new Texture(); if (!texture->loadFromFile(path)) return; - texture->setSmooth(true); + + if (self->magFilter == SP_ATLAS_LINEAR) texture->setSmooth(true); + if (self->uWrap == SP_ATLAS_REPEAT && self->vWrap == SP_ATLAS_REPEAT) texture->setRepeated(true); + self->rendererObject = texture; Vector2u size = texture->getSize(); self->width = size.x;