-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Modify shader example to show using build in includes #1086
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
base: master
Are you sure you want to change the base?
Modify shader example to show using build in includes #1086
Conversation
be084c3
to
574ee8b
Compare
574ee8b
to
1ce1aa2
Compare
1ce1aa2
to
aa2133d
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
The upstream PR this showcases functionality for was merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good to me!
@@ -115,7 +134,8 @@ func _render_callback(p_effect_callback_type: EffectCallbackType, p_render_data: | |||
# Get our render scene buffers object, this gives us access to our render buffers. | |||
# Note that implementation differs per renderer hence the need for the cast. | |||
var render_scene_buffers := p_render_data.get_render_scene_buffers() | |||
if render_scene_buffers: | |||
var scene_data := p_render_data.get_render_scene_data() | |||
if render_scene_buffers && scene_data: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if render_scene_buffers && scene_data: | |
if render_scene_buffers and scene_data: |
depth_uniform.add_id(depth_image) | ||
var uniform_set := UniformSetCacheRD.get_cache(shader, 0, [scene_data_uniform, color_uniform, depth_uniform]) | ||
|
||
# Set our view |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Set our view | |
# Set our view. |
# Loop through views just in case we're doing stereo rendering. No extra cost if this is mono. | ||
var view_count: int = render_scene_buffers.get_view_count() | ||
for view in view_count: | ||
# Get the RID for our scene data buffer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Get the RID for our scene data buffer | |
# Get the RID for our scene data buffer. |
@@ -137,18 +157,43 @@ func _render_callback(p_effect_callback_type: EffectCallbackType, p_render_data: | |||
0.0, | |||
]) | |||
|
|||
# Make sure we have a sampler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Make sure we have a sampler | |
# Make sure we have a sampler. |
This enhancement of the post_shader demo adds in logic that brings in build in defines for our scene data uniform, so we have access to projection matrices and other information.
Requires godotengine/godot#94193