UNPKG

playcanvas

Version:

Open-source WebGL/WebGPU 3D engine for the web

26 lines (19 loc) 591 B
var sharedGLSL = /* glsl */ ` // convert clip space position into texture coordinates to sample scene grab textures vec2 getGrabScreenPos(vec4 clipPos) { vec2 uv = (clipPos.xy / clipPos.w) * 0.5 + 0.5; #ifdef WEBGPU uv.y = 1.0 - uv.y; #endif return uv; } // convert uv coordinates to sample image effect texture (render target texture rendered without // forward renderer which does the flip in the projection matrix) vec2 getImageEffectUV(vec2 uv) { #ifdef WEBGPU uv.y = 1.0 - uv.y; #endif return uv; } `; export { sharedGLSL as default };