assign-color-varying.glsl.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. export const assign_color_varying = `
  2. #if defined(dRenderVariant_color)
  3. #if defined(dColorType_attribute)
  4. vColor.rgb = aColor;
  5. #elif defined(dColorType_instance)
  6. vColor.rgb = readFromTexture(tColor, aInstance, uColorTexDim).rgb;
  7. #elif defined(dColorType_group)
  8. vColor.rgb = readFromTexture(tColor, group, uColorTexDim).rgb;
  9. #elif defined(dColorType_groupInstance)
  10. vColor.rgb = readFromTexture(tColor, aInstance * float(uGroupCount) + group, uColorTexDim).rgb;
  11. #elif defined(dColorType_vertex)
  12. vColor.rgb = readFromTexture(tColor, VertexID, uColorTexDim).rgb;
  13. #elif defined(dColorType_vertexInstance)
  14. vColor.rgb = readFromTexture(tColor, int(aInstance) * uVertexCount + VertexID, uColorTexDim).rgb;
  15. #endif
  16. #ifdef dOverpaint
  17. vOverpaint = readFromTexture(tOverpaint, aInstance * float(uGroupCount) + group, uOverpaintTexDim);
  18. #endif
  19. #elif defined(dRenderVariant_pick)
  20. #if defined(dRenderVariant_pickObject)
  21. vColor = vec4(encodeFloatRGB(float(uObjectId)), 1.0);
  22. #elif defined(dRenderVariant_pickInstance)
  23. vColor = vec4(encodeFloatRGB(aInstance), 1.0);
  24. #elif defined(dRenderVariant_pickGroup)
  25. vColor = vec4(encodeFloatRGB(group), 1.0);
  26. #endif
  27. #endif
  28. #ifdef dTransparency
  29. vGroup = group;
  30. vTransparency = readFromTexture(tTransparency, aInstance * float(uGroupCount) + group, uTransparencyTexDim).a;
  31. #endif
  32. `;