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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rmodels] Fix aspect ratio calculation in DrawBillboardPro
#3806
base: master
Are you sure you want to change the base?
Conversation
DrawBillboardPro
DrawBillboardPro
@jmrico01 Please, could you show some screenshots with the issue and the fix? |
If we scale the original |
Sorry it took me a while, but here's an example of the issue with screenshots. What I am doing here is using the following square texture (16x16) I am calling Size
|
DrawBillboardPro
DrawBillboardPro
After spending some time playing with |
@bohonghuang I reviewed this issue and I agree with your comment. Still, I'm wondering if Vector2 sizeRatio = { size.x*fabsf((float)source.width/source.height), size.y }; What do you think? |
@raysan5 That would make sense. The |
@bohonghuang Thanks, good points. If we want to keep full consistency with |
Thanks for the clarifications and suggestions! I agree with making this API more consistent with |
@raysan5 Certainly. It might be easier to uncover the potential issues by migrating my application that heavily uses |
Hello! Not sure if I misunderstood the code/API, but I believe the aspect ratio correction in
DrawBillboardPro
is incorrect. I would expect it to calculatesizeRatio
such thatsizeRatio.x / sizeRatio.y == source.width / source.height
, or in other words match the aspect ratio ofsource
. The current code is definitely not doing that. I was writing some custom 3D text rendering using the billboard functions and the sizing was very confusing and unexpected.Hehe, I see this was brought up in #2494 before but still seems off. I think the suggested fix was incorrect.
NOTE - I am also concerned people are relying on incorrect behavior currently and this change will affect them. I actually have some code that would be affected, and I can't think of an alternative. Basically, I would like to draw billboards that are a flat color, without any texture. What I was doing is using a texture that was a 1x1 white pixel, but if the aspect ratio is forced to match the texture, I won't be able to draw anything flatter than a square 馃槩 maybe a new API is in order? Will think about specific suggestions...
EDIT: tbh, I think there should just be a version of this API that doesn't modify
size
behind the scenes and will stretch the texture, if that's what you want.