Sha256: 70d0b47213de074acfbc6354f5100cfd8e4bbf64ee0598b9616ba5717d3b3c1d

Contents?: true

Size: 833 Bytes

Versions: 19

Compression:

Stored size: 833 Bytes

Contents

#include common
#include logdepthbuf_pars_fragment

vec4 pack_depth( const in float depth ) {
  const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );
  const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );
  vec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );
  // vec4 res = fract( depth * bit_shift );
  res -= res.xxyz * bit_mask;
  return res;
}

void main() {
  #include logdepthbuf_fragment

  #ifdef USE_LOGDEPTHBUF_EXT
    fragColor   = pack_depth( gl_FragDepthEXT );
  #else
    fragColor = pack_depth( gl_FragCoord.z );
  #endif

  // fragColor = pack_depth( gl_FragCoord.z / gl_FragCoord.w );
  // float z = ( ( gl_FragCoord.z / gl_FragCoord.w ) - 3.0 ) / ( 4000.0 - 3.0 );
  // fragColor = pack_depth( z );
  // fragColor = vec4( z, z, z, 1.0 );
}

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
mittsu-opengl-0.5.1 lib/mittsu/opengl/shader/lib/depth_rgba/depth_rgba_fragment.rbsl
mittsu-0.4.1 lib/mittsu/renderers/shaders/shader_lib/depth_rgba/depth_rgba_fragment.rbsl
mittsu-opengl-0.5.0 lib/mittsu/opengl/shader/lib/depth_rgba/depth_rgba_fragment.rbsl
mittsu-0.4.0 lib/mittsu/renderers/shaders/shader_lib/depth_rgba/depth_rgba_fragment.rbsl
mittsu-0.3.3 lib/mittsu/renderers/shaders/shader_lib/depth_rgba/depth_rgba_fragment.rbsl
mittsu-0.3.2 lib/mittsu/renderers/shaders/shader_lib/depth_rgba/depth_rgba_fragment.rbsl
mittsu-0.3.1 lib/mittsu/renderers/shaders/shader_lib/depth_rgba/depth_rgba_fragment.rbsl
mittsu-0.3.0 lib/mittsu/renderers/shaders/shader_lib/depth_rgba/depth_rgba_fragment.rbsl
mittsu-0.2.4 lib/mittsu/renderers/shaders/shader_lib/depth_rgba/depth_rgba_fragment.rbsl
mittsu-0.2.3 lib/mittsu/renderers/shaders/shader_lib/depth_rgba/depth_rgba_fragment.rbsl
mittsu-0.2.2 lib/mittsu/renderers/shaders/shader_lib/depth_rgba/depth_rgba_fragment.rbsl
mittsu-0.2.1 lib/mittsu/renderers/shaders/shader_lib/depth_rgba/depth_rgba_fragment.rbsl
mittsu-0.2.0 lib/mittsu/renderers/shaders/shader_lib/depth_rgba/depth_rgba_fragment.rbsl
mittsu-0.1.7 lib/mittsu/renderers/shaders/shader_lib/depth_rgba/depth_rgba_fragment.rbsl
mittsu-0.1.6 lib/mittsu/renderers/shaders/shader_lib/depth_rgba/depth_rgba_fragment.rbsl
mittsu-0.1.5 lib/mittsu/renderers/shaders/shader_lib/depth_rgba/depth_rgba_fragment.rbsl
mittsu-0.1.4 lib/mittsu/renderers/shaders/shader_lib/depth_rgba/depth_rgba_fragment.rbsl
mittsu-0.1.3 lib/mittsu/renderers/shaders/shader_lib/depth_rgba/depth_rgba_fragment.rbsl
mittsu-0.1.2 lib/mittsu/renderers/shaders/shader_lib/depth_rgba/depth_rgba_fragment.rbsl