home *** CD-ROM | disk | FTP | other *** search
/ Xentax forum attachments archive / xentax.7z / 18759 / ROE.7z / QSSHADER_QSShaderQuery.h < prev    next >
Encoding:
C/C++ Source or Header  |  2020-09-17  |  687 b   |  34 lines

  1. #ifndef QSSHADER_QSShaderQuery_H
  2. #define QSSHADER_QSShaderQuery_H
  3.  
  4. #if SCENE_QUERY
  5.     const float4 QueryId; 
  6.     const float4 QueryViewPortInfo;    //xy: const f32 x = query->mX*2.0f-sizeX;const f32 y = sizeY-query->mY*2.0f; zw:screen size 
  7.  
  8.     void ExtendHomoPos(inout float4 pos)
  9.     {
  10.         pos.xy = pos.xy*QueryViewPortInfo.zw-pos.w*QueryViewPortInfo.xy;
  11.     }
  12.  
  13.     float4 EncodingId(float v)
  14.     {
  15.         float d = fmod(v,256.0f);
  16.         v-=d;
  17.         v/=256.0f;
  18.  
  19.         float c = fmod(v,256.0f);
  20.         v-=c;
  21.         v/=256.0f;
  22.  
  23.         float b = fmod(v,256.0f);
  24.         v-=b;
  25.         v/=256.0f;
  26.  
  27.         float a = v;
  28.  
  29.         //return float4(a,b,c,d)/255.0f;
  30.         return float4(b,c,d,a)/255.0f;
  31.     }
  32. #endif
  33.  
  34. #endif//QSSHADER_QSShaderQuery_H