remove texture2d::setSamplerDescriptor

This commit is contained in:
Arnold 2019-03-12 18:59:12 +08:00
parent 70b9031714
commit fb87eec3f5
No known key found for this signature in database
GPG Key ID: 2008D1CC4BD1AE60
2 changed files with 7 additions and 15 deletions

View File

@ -707,21 +707,20 @@ void Texture2D::setAliasTexParameters()
backend::SamplerAddressMode::DONT_CARE, backend::SamplerAddressMode::DONT_CARE,
backend::SamplerAddressMode::DONT_CARE backend::SamplerAddressMode::DONT_CARE
); );
_texture->updateSamplerDescriptor(descriptor);
setSamplerDescriptor(descriptor);
} }
void Texture2D::setAntiAliasTexParameters() void Texture2D::setAntiAliasTexParameters()
{ {
backend::SamplerDescriptor descriptor(false, backend::SamplerDescriptor descriptor(true,
backend::SamplerFilter::LINEAR, backend::SamplerFilter::LINEAR,
backend::SamplerFilter::LINEAR, backend::SamplerFilter::LINEAR,
backend::SamplerFilter::LINEAR, backend::SamplerFilter::LINEAR,
backend::SamplerAddressMode::DONT_CARE, backend::SamplerAddressMode::DONT_CARE,
backend::SamplerAddressMode::DONT_CARE backend::SamplerAddressMode::DONT_CARE
); );
setSamplerDescriptor(descriptor); _texture->updateSamplerDescriptor(descriptor);
} }
const char* Texture2D::getStringForFormat() const const char* Texture2D::getStringForFormat() const
@ -909,12 +908,6 @@ Texture2D* Texture2D::getAlphaTexture() const
return _alphaTexture; return _alphaTexture;
} }
void Texture2D::setSamplerDescriptor(const backend::SamplerDescriptor &texParams)
{
_texture->updateSamplerDescriptor(texParams);
}
//TODO: should be reform later
void Texture2D::setTexParameters(const Texture2D::TexParams &params) void Texture2D::setTexParameters(const Texture2D::TexParams &params)
{ {
backend::SamplerDescriptor sd; backend::SamplerDescriptor sd;
@ -924,7 +917,7 @@ void Texture2D::setTexParameters(const Texture2D::TexParams &params)
sd.magFilter = params.magFilter; sd.magFilter = params.magFilter;
sd.sAddressMode = params.wrapS; sd.sAddressMode = params.wrapS;
sd.tAddressMode = params.wrapT; sd.tAddressMode = params.wrapT;
setSamplerDescriptor(sd); _texture->updateSamplerDescriptor(sd);
} }
// TODO coulsonwang // TODO coulsonwang

View File

@ -160,8 +160,10 @@ public:
backend::SamplerFilter magFilter; backend::SamplerFilter magFilter;
backend::SamplerAddressMode wrapS; backend::SamplerAddressMode wrapS;
backend::SamplerAddressMode wrapT; backend::SamplerAddressMode wrapT;
bool mipmapEnabled = true;
backend::SamplerFilter mipmapFilter = backend::SamplerFilter::LINEAR;
}TexParams; }TexParams;
public: public:
/** sets the default pixel format for UIImagescontains alpha channel. /** sets the default pixel format for UIImagescontains alpha channel.
@ -300,9 +302,6 @@ public:
//TODO: minggo: is it resaonable? //TODO: minggo: is it resaonable?
bool initWithBackendTexture(backend::Texture* texture); bool initWithBackendTexture(backend::Texture* texture);
/** Set sampler properties
*/
void setSamplerDescriptor(const backend::SamplerDescriptor& texParams);
void setTexParameters(const TexParams &params); void setTexParameters(const TexParams &params);