Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some primitives are drawn with an incorrect offset #968

Open
zommerfelds opened this issue Jun 18, 2021 · 2 comments
Open

Some primitives are drawn with an incorrect offset #968

zommerfelds opened this issue Jun 18, 2021 · 2 comments

Comments

@zommerfelds
Copy link
Contributor

When you setup a scene with high scale (where a difference of 0.1 is visible), some primitives have a small value added that distorts the position. Examples:

tmp[pos++] = sx + t.width + 0.1;

heaps/h2d/Graphics.hx

Lines 563 to 564 in 8f7f439

var e = 0.01; // see #776
tmpPoints[0].x += e;

I think a scale like that is very reasonable, given some people recommend 1 unit = 1 m (depending on your world). However, the code was probably written assuming 1 unit = 1 pixel.

Maybe this is a duplicate of #776 but I wanted to know if anybody knows the reason why we add 0.1. I can create a PR to remove those, but they were probably added for a reason :)

@ncannasse
Copy link
Member

I don't like hardcoded offsets as well :'( But there is definitely some reason for this, although I haven't played with 2D recently. Let's discuss first this in #776 for h2d.Graphics and see if it can be resolved for the sample I posted there, and then we can apply the same reasoning to SpriteBatch

@zommerfelds
Copy link
Contributor Author

For the SpriteBatch case: do you have an example to reproduce a problem? Since there are no lines there it feels like a different problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants