-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[rlgl] Implement vertex normals for RLGL immediate drawing mode #3866
Conversation
e71ae3b
to
3acbe2d
Compare
3acbe2d
to
39cf899
Compare
@bohonghuang Thanks for the addition. I'm still considering it. It adds performance cost and I don't know if many raylib users could benefit of vertex normals, considering that |
I'm not sure how many people have the same needs as me, which is to dynamically generate and modify vertices in real-time without managing context, which is really convenient and one of the main reasons I love Raylib.
In my tests, these overheads are really small in applications where I heavily use the RLGL immediate mode, unless there is a very large number of vertices being drawn, which could potentially show I/O bottlenecks. However, I don't think this kind of extreme case belongs to the use case of RLGL immediate mode, as the overhead caused by other immediate APIs could also be significant. |
@bohonghuang Thank you very much for the detailed explanation. I agree with your points. |
@bohonghuang Could it be added a custom |
This is certainly feasible, but I have a few questions:
|
@bohonghuang Your questions are legit. I would enable it by default and just let disable it for special cases where it could impact performance... but let me think about it a bit more before adding that flag... |
@raysan5 Is there anything I can do to help the progress of this PR? |
Thanks but I'm afraid I need some more time to think about it before merging, I'm working on other things at the moment. |
@bohonghuang I'm merging this change, thanks for the implementation! |
@raysan5 With pleasure. Thanks for your time and effort in reviewing and merging this PR as well, which saves me the effort of maintaining a separate branch. |
Before this PR,
rlNormal3f
was not functional becauserlVertexBuffer
had no buffer for normals. This PR implements the addition of this buffer and binds it to the default render batch, allowing it to be used in custom shaders. A simplified version of the basic lighting example is provided as a demonstration, which usesDrawCube
andDrawPlane
functions instead ofDrawModel
.