-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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] Add rlCullDistance variables/getters and rlSetClipPlanes function #3912
Conversation
@KotzaBoss Thanks for draft. Please, could you share some use case where clip planes need to be dynamically changed? I feel this functionality is very limited in scope, only useful for very specific circunstances. Still, I can consider adding a |
Even the #include <raylib.h>
#include <rlgl.h>
#define MY_CULL_DISTANCE_FAR 5000.0
rlSetClipPlanes(RL_CULL_DISTANCE_NEAR, MY_CULL_DISTANCE_FAR);
if (i_must_reset_cull_distance)
rlSetClipPlanes(RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR); Though internaly there may need to be some change from using the Is this acceptable? |
Yes, that would be perfect |
a976ac4
to
6f67458
Compare
6f67458
to
115314c
Compare
As of now the camera is just defining its own Are my changes therefore enough? |
i would have to change the far plane in my voxel game all the time for different render distances if i didn't just switch to a infinite projection matrix |
115314c
to
dbb8f3b
Compare
The `RL_CULL_DISTANCE_` definition remains as the initial value of the variables. Basic usage can be: ```c #include <raylib.h> #include <rlgl.h> rlSetClipPlanes(RL_CULL_DISTANCE_NEAR, MY_CULL_DISTANCE_FAR); if (must_reset_clip_planes) rlSetClipPlanes(RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR); ```
dbb8f3b
to
468d7ed
Compare
@KotzaBoss Thanks for the improvement, merging! |
Thanks for merging |
NOTE: The PR at the moment is just a proof-of-concept to show the scale of modifications necessary to make this happen. Should it be reviewed well i will add the utils for
rlClipDistanceNear
and fix any use ofRL_CULL_DISTANCE*
, for example in the camera. Also i am not too sure about the name, when "cull" when "clip"Reasoning
As discussed on discord here and then mentioned here the current
CULL_DISTANCE
s are hardcoded and require a full recompile to change.By adding static
rlCullDistance
globals and accessor function we can make this a runtime configurable value.Overview:
The current
RL_CULL_DISTANCE_
remain as configuration of the initial cull distances. New code may include:rlCullDistanceFar
rlCullDistanceNear
rlGetClipPlaneNear()
rlGetClipPlaneFar()
rlGetDefaultClipPlaneNear()
rlGetDefaultClipPlaneFar()
rlSetClipPlanes(double near, double far)
rlSetClipPlaneNear(double value)
rlSetClipPlaneFar(double value)
rlResetClipPlanes()
Example
Screencast.from.2024-04-11.11-11-42.webm