mirror of https://github.com/axmolengine/axmol.git
fix android error
This commit is contained in:
parent
fb87eec3f5
commit
53975ee428
|
@ -920,6 +920,11 @@ void Texture2D::setTexParameters(const Texture2D::TexParams ¶ms)
|
|||
_texture->updateSamplerDescriptor(sd);
|
||||
}
|
||||
|
||||
void Texture2D::setTexParameters(const backend::SamplerDescriptor &desc)
|
||||
{
|
||||
_texture->updateSamplerDescriptor(desc);
|
||||
}
|
||||
|
||||
// TODO coulsonwang
|
||||
//// implementation Texture2D (GLFilter)
|
||||
void Texture2D::generateMipmap()
|
||||
|
|
|
@ -155,14 +155,21 @@ public:
|
|||
/**
|
||||
Extension to set the Min / Mag filter
|
||||
*/
|
||||
typedef struct _TexParams {
|
||||
struct TexParams {
|
||||
backend::SamplerFilter minFilter;
|
||||
backend::SamplerFilter magFilter;
|
||||
backend::SamplerAddressMode wrapS;
|
||||
backend::SamplerAddressMode wrapT;
|
||||
bool mipmapEnabled = true;
|
||||
backend::SamplerFilter mipmapFilter = backend::SamplerFilter::LINEAR;
|
||||
}TexParams;
|
||||
|
||||
TexParams(backend::SamplerFilter _minFilter, backend::SamplerFilter _magFilter,
|
||||
backend::SamplerAddressMode _wrapS, backend::SamplerAddressMode _wrapT)
|
||||
:minFilter(_minFilter), magFilter(_magFilter), wrapS(_wrapS), wrapT(_wrapT)
|
||||
{}
|
||||
|
||||
TexParams() = default;
|
||||
};
|
||||
|
||||
public:
|
||||
/** sets the default pixel format for UIImagescontains alpha channel.
|
||||
|
@ -304,7 +311,8 @@ public:
|
|||
|
||||
|
||||
void setTexParameters(const TexParams ¶ms);
|
||||
|
||||
void setTexParameters(const backend::SamplerDescriptor &desc);
|
||||
|
||||
/** Generates mipmap images for the texture.
|
||||
It only works if the texture size is POT (power of 2).
|
||||
@since v0.99.0
|
||||
|
|
|
@ -887,7 +887,7 @@ void VolatileTextureMgr::reloadAllTextures()
|
|||
if (vt->_hasMipmaps) {
|
||||
vt->_texture->generateMipmap();
|
||||
}
|
||||
vt->_texture->setSamplerDescriptor(vt->_samplerDescriptor);
|
||||
vt->_texture->setTexParameters(vt->_samplerDescriptor);
|
||||
}
|
||||
|
||||
_isReloading = false;
|
||||
|
|
|
@ -1592,12 +1592,12 @@ void TextureGlClamp::onEnter()
|
|||
auto sprite = Sprite::create("Images/pattern1.png", Rect(0,0,512,256));
|
||||
addChild(sprite, -1, kTagSprite1);
|
||||
sprite->setPosition(Vec2(size.width/2,size.height/2));
|
||||
Texture2D::TexParams texParams= {
|
||||
Texture2D::TexParams texParams(
|
||||
backend::SamplerFilter::LINEAR,
|
||||
backend::SamplerFilter::LINEAR,
|
||||
backend::SamplerAddressMode::CLAMP_TO_EDGE,
|
||||
backend::SamplerAddressMode::CLAMP_TO_EDGE,
|
||||
};
|
||||
backend::SamplerAddressMode::CLAMP_TO_EDGE
|
||||
);
|
||||
sprite->getTexture()->setTexParameters(texParams);
|
||||
auto rotate = RotateBy::create(4, 360);
|
||||
sprite->runAction(rotate);
|
||||
|
|
Loading…
Reference in New Issue