change picking to use floats (#6747)

floats can have up to 16.7M unique integers which is enough for encoding
an Entity. 
This change will help a later one that adds support for ES2
This commit is contained in:
Mathias Agopian
2023-04-19 13:53:45 -07:00
committed by GitHub
parent 29d5ae621a
commit ebb07520c0
4 changed files with 11 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
#if defined(VARIANT_HAS_VSM)
layout(location = 0) out vec4 fragColor;
#elif defined(VARIANT_HAS_PICKING)
layout(location = 0) out highp uint2 outPicking;
layout(location = 0) out highp vec2 outPicking;
#else
// not color output
#endif
@@ -49,8 +49,8 @@ void main() {
fragColor.xy = computeDepthMomentsVSM(depth);
fragColor.zw = computeDepthMomentsVSM(-1.0 / depth); // requires at least RGBA16F
#elif defined(VARIANT_HAS_PICKING)
outPicking.x = uint(object_uniforms.objectId);
outPicking.y = floatBitsToUint(vertex_position.z / vertex_position.w);
outPicking.x = float(object_uniforms.objectId);
outPicking.y = vertex_position.z / vertex_position.w;
#else
// that's it
#endif