So, a screenshot of the programmer-art test project:
This is using the SpriteSheet2D, but it would happen with any kind of Sprite that is using non-full texture. Apparently whoever designed the Urho2D system locks all UV coordinate to integers, which are then multiplied with 0.0999999… (0.1 not represented accurately due to floating point), which then causes issues with the side pixels leaking since they never actually shifted the inward a little to compensate for the floating point inaccuracy. This combined with the fact that Urho2D does nonsensical precision losing things like:
float invWidth = 1.0f / (float)texture_->GetWidth();
float invHeight = 1.0f / (float)texture_->GetHeight();
rect.min_.x_ = rectangle_.left_ * invWidth;
rect.max_.x_ = rectangle_.right_ * invWidth;
rect.min_.y_ = rectangle_.bottom_ * invHeight;
rect.max_.y_ = rectangle_.top_ * invHeight;
Causes it to slowly hemorrhage accuracy as far as I can tell.
So, first question, why is this bound to integers instead of floating for UV’s, and why is it scaling UV’s one way, then the other, losing accuracy? And why oh why does PIXEL_SIZE exist?!
The test image files are:
Image
Image-spritesheet-json
Image-xml
Of course no such issue if I render my own verts, but I would prefer not to rewrite Urho2D to fix what seems like a major design flaw if someone can explain how you are supposed to work around these integer rounding bugs to begin with?