refactor & fix random deleting texture

This commit is contained in:
MihailRis 2025-05-10 16:13:06 +03:00
parent e158b384fa
commit 8bb03a004f
7 changed files with 65 additions and 64 deletions

View file

@ -60,17 +60,17 @@ void Batch2D::vertex(
index++;
}
void Batch2D::texture(const Texture* new_texture){
if (currentTexture == new_texture) {
void Batch2D::texture(const Texture* newTexture){
if (currentTexture == newTexture) {
return;
}
flush();
currentTexture = new_texture;
if (new_texture == nullptr) {
currentTexture = newTexture;
if (newTexture == nullptr) {
blank->bind();
region = blank->getUVRegion();
} else {
new_texture->bind();
newTexture->bind();
region = currentTexture->getUVRegion();
}
}