App::I static singleton to pointer
This commit is contained in:
@@ -41,7 +41,7 @@ void TextureManager::invalidate()
|
||||
|
||||
bool Texture2D::create(int width, int height, GLint internal_format, GLint format, const uint8_t* data)
|
||||
{
|
||||
App::I.render_task([=]
|
||||
App::I->render_task([=]
|
||||
{
|
||||
destroy();
|
||||
m_width = width;
|
||||
@@ -68,7 +68,7 @@ bool Texture2D::create(const Image& img)
|
||||
|
||||
void Texture2D::create_mipmaps()
|
||||
{
|
||||
App::I.render_task([this]
|
||||
App::I->render_task([this]
|
||||
{
|
||||
bind();
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
@@ -108,7 +108,7 @@ void Texture2D::destroy()
|
||||
{
|
||||
if (m_tex)
|
||||
{
|
||||
App::I.render_task_async([id = m_tex]
|
||||
App::I->render_task_async([id = m_tex]
|
||||
{
|
||||
glDeleteTextures(1, &id);
|
||||
});
|
||||
@@ -128,7 +128,7 @@ void Texture2D::unbind() const
|
||||
|
||||
void Texture2D::update(const uint8_t* data)
|
||||
{
|
||||
App::I.render_task([this, data]
|
||||
App::I->render_task([this, data]
|
||||
{
|
||||
bind();
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_width, m_height, m_format, GL_UNSIGNED_BYTE, data);
|
||||
@@ -152,7 +152,7 @@ Texture2D::~Texture2D()
|
||||
bool Sampler::create(GLint filter /*= GL_LINEAR*/, GLint wrap /*= GL_CLAMP_TO_EDGE*/)
|
||||
{
|
||||
bool ret = false;
|
||||
App::I.render_task([this, &ret, filter, wrap]
|
||||
App::I->render_task([this, &ret, filter, wrap]
|
||||
{
|
||||
#if USE_SAMPLER
|
||||
glGenSamplers(1, &id);
|
||||
@@ -169,7 +169,7 @@ bool Sampler::create(GLint filter /*= GL_LINEAR*/, GLint wrap /*= GL_CLAMP_TO_ED
|
||||
}
|
||||
void Sampler::set(GLint filter /*= GL_LINEAR*/, GLint wrap /*= GL_CLAMP_TO_EDGE*/)
|
||||
{
|
||||
App::I.render_task([=]
|
||||
App::I->render_task([=]
|
||||
{
|
||||
#if USE_SAMPLER
|
||||
glSamplerParameteri(id, GL_TEXTURE_WRAP_S, wrap);
|
||||
@@ -182,7 +182,7 @@ void Sampler::set(GLint filter /*= GL_LINEAR*/, GLint wrap /*= GL_CLAMP_TO_EDGE*
|
||||
}
|
||||
void Sampler::set_filter(GLint filter_min, GLint filter_mag)
|
||||
{
|
||||
App::I.render_task([=]
|
||||
App::I->render_task([=]
|
||||
{
|
||||
#if USE_SAMPLER
|
||||
glSamplerParameteri(id, GL_TEXTURE_MIN_FILTER, filter_min);
|
||||
@@ -192,7 +192,7 @@ void Sampler::set_filter(GLint filter_min, GLint filter_mag)
|
||||
}
|
||||
void Sampler::set_border(glm::vec4 rgba)
|
||||
{
|
||||
App::I.render_task([this, rgba]
|
||||
App::I->render_task([this, rgba]
|
||||
{
|
||||
#if USE_SAMPLER && !defined(__IOS__) && !defined(__ANDROID__)
|
||||
glSamplerParameterfv(id, GL_TEXTURE_BORDER_COLOR, glm::value_ptr(rgba));
|
||||
@@ -201,7 +201,7 @@ void Sampler::set_border(glm::vec4 rgba)
|
||||
}
|
||||
void Sampler::bind(int unit) const
|
||||
{
|
||||
App::I.render_task([=]
|
||||
App::I->render_task([=]
|
||||
{
|
||||
current_unit = unit;
|
||||
#if USE_SAMPLER
|
||||
@@ -211,7 +211,7 @@ void Sampler::bind(int unit) const
|
||||
}
|
||||
void Sampler::unbind()
|
||||
{
|
||||
App::I.render_task([=]
|
||||
App::I->render_task([=]
|
||||
{
|
||||
#if USE_SAMPLER
|
||||
glBindSampler(current_unit, 0);
|
||||
|
||||
Reference in New Issue
Block a user