#include #include /** * A_bit_more_deferred_-_CryEngine3 Normal to GBufffer: G=normalize(N.xy)*sqrt(-N.z*0.5+0.5) GBuffer to Normal: N.z=length2(G.xy)*2-1 N.xy=normalize(G.xy)*sqrt(1-N.z*N.z) */ namespace hgl { void normal_compress(uint8 *x,uint8 *y,const uint8 *rgb,const uint count) { Vector3f in; float f; Vector2f out; for(uint i=0;i