{"action":"created","issue":{"url":"https://api.github.com/repos/libgdx/libgdx/issues/3799","repository_url":"https://api.github.com/repos/libgdx/libgdx","labels_url":"https://api.github.com/repos/libgdx/libgdx/issues/3799/labels{/name}","comments_url":"https://api.github.com/repos/libgdx/libgdx/issues/3799/comments","events_url":"https://api.github.com/repos/libgdx/libgdx/issues/3799/events","html_url":"https://github.com/libgdx/libgdx/pull/3799","id":129852540,"number":3799,"title":"Polygon sprite with repeating TextureRegion by triangulating to a uniform grid","user":{"login":"azakhary","id":2115888,"avatar_url":"https://avatars.githubusercontent.com/u/2115888?v=3","gravatar_id":"","url":"https://api.github.com/users/azakhary","html_url":"https://github.com/azakhary","followers_url":"https://api.github.com/users/azakhary/followers","following_url":"https://api.github.com/users/azakhary/following{/other_user}","gists_url":"https://api.github.com/users/azakhary/gists{/gist_id}","starred_url":"https://api.github.com/users/azakhary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azakhary/subscriptions","organizations_url":"https://api.github.com/users/azakhary/orgs","repos_url":"https://api.github.com/users/azakhary/repos","events_url":"https://api.github.com/users/azakhary/events{/privacy}","received_events_url":"https://api.github.com/users/azakhary/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":26,"created_at":"2016-01-29T18:57:00Z","updated_at":"2016-04-09T14:42:53Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/libgdx/libgdx/pulls/3799","html_url":"https://github.com/libgdx/libgdx/pull/3799","diff_url":"https://github.com/libgdx/libgdx/pull/3799.diff","patch_url":"https://github.com/libgdx/libgdx/pull/3799.patch"},"body":"**Problem**\r\nI wanted to make a class, that will render a custom shaped polygon that is filled with repeating TextureRegion. This was possible to do with PolygonSprite class if \"Texture\" is used. But most use case require using TextureRegion instead. As a temporary solution, previously I was using PolygonSprite and a custom shader to which I was passing u/v data in order to render this. But this was bad too because it causes additional render call for each polygon, which sucks.\r\n\r\n**Solution**\r\nI propose using this class instead. In short it triangulates a polygon to a \"grid\" so that we can easily specify all u/v coordinates and pass this directly to PolygonSpriteBatch.\r\n\r\n![schmatic2](https://cloud.githubusercontent.com/assets/2115888/12684968/0462ef5c-c6db-11e5-8608-f7056757efb5.png)\r\n\r\nIn order to avoid being murdered by @xoppa , a density variable is passed to specify the \"grid\" density, thus eliminating any connection to actual pixel size of texture region.\r\n\r\nI did some testing and it seems to work fine, but at this stage it is not yet ready to merge, I would be happy if you guys can:\r\na) decide if you need this at all in libgdx - maybe many reasons why you do not\r\nb) see if initial idea looks well implemented, test and so on\r\n\r\nI will do some additional fixes/additions/pushes during the weekend."},"comment":{"url":"https://api.github.com/repos/libgdx/libgdx/issues/comments/207797796","html_url":"https://github.com/libgdx/libgdx/pull/3799#issuecomment-207797796","issue_url":"https://api.github.com/repos/libgdx/libgdx/issues/3799","id":207797796,"user":{"login":"azakhary","id":2115888,"avatar_url":"https://avatars.githubusercontent.com/u/2115888?v=3","gravatar_id":"","url":"https://api.github.com/users/azakhary","html_url":"https://github.com/azakhary","followers_url":"https://api.github.com/users/azakhary/followers","following_url":"https://api.github.com/users/azakhary/following{/other_user}","gists_url":"https://api.github.com/users/azakhary/gists{/gist_id}","starred_url":"https://api.github.com/users/azakhary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azakhary/subscriptions","organizations_url":"https://api.github.com/users/azakhary/orgs","repos_url":"https://api.github.com/users/azakhary/repos","events_url":"https://api.github.com/users/azakhary/events{/privacy}","received_events_url":"https://api.github.com/users/azakhary/received_events","type":"User","site_admin":false},"created_at":"2016-04-09T14:42:53Z","updated_at":"2016-04-09T14:42:53Z","body":"Here you go.\r\n<img width=\"593\" alt=\"screen shot 2016-04-09 at 6 41 52 pm\" src=\"https://cloud.githubusercontent.com/assets/2115888/14404275/cf8a2270-fe82-11e5-84c1-caa5898c9559.png\">\r\n"}}