This patch adds support for selecting pointclouds.
Since pointclouds were not properly drawn to the selection buffer (as diagonsed by output from `glReadPixels` and Renderdoc), they were not able to be selectable by depth picking or occlusion queries. In `basic_engine`, objects were rendered with a shader which draws to a depth buffer but only assumes a single position vertex attribute. Pointclouds, though, require at least another vertex attribute `pos_inst` which provides the instance offsets. Thus, this patch adds another shader variant for pointclouds which supports these two attributes and renders the points appropriately.
{F11652666}
Addresses T92415
Reviewed By: fclem
Differential Revision: https://developer.blender.org/D13059
29 lines
458 B
GLSL
29 lines
458 B
GLSL
|
|
#ifdef CONSERVATIVE_RASTER
|
|
RESOURCE_ID_VARYING
|
|
#endif
|
|
|
|
#ifndef POINTCLOUD
|
|
in vec3 pos;
|
|
#endif
|
|
|
|
void main()
|
|
{
|
|
GPU_INTEL_VERTEX_SHADER_WORKAROUND
|
|
#ifdef CONSERVATIVE_RASTER
|
|
PASS_RESOURCE_ID
|
|
#endif
|
|
|
|
#ifdef POINTCLOUD
|
|
vec3 world_pos = pointcloud_get_pos();
|
|
#else
|
|
vec3 world_pos = point_object_to_world(pos);
|
|
#endif
|
|
|
|
gl_Position = point_world_to_ndc(world_pos);
|
|
|
|
#ifdef USE_WORLD_CLIP_PLANES
|
|
world_clip_planes_calc_clip_distance(world_pos);
|
|
#endif
|
|
}
|