~ubuntu-branches/ubuntu/vivid/meshlab/vivid

« back to all changes in this revision

Viewing changes to meshlab/src/meshlabplugins/render_splatpyramid/shaders/shader_point_projection_color_er.frag

  • Committer: Bazaar Package Importer
  • Author(s): Teemu Ikonen
  • Date: 2009-10-08 16:40:41 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20091008164041-0c2ealqv8b8uc20c
Tags: 1.2.2-1
* New upstream version
* Do not build filter_isoparametrization because liblevmar dependency
  is not (yet) in Debian
* Fix compilation with gcc-4.4, thanks to Jonathan Liu for the patch
  (closes: #539544)
* rules: Add compiler variables to the qmake call (for testing with new
  GCC versions)
* io_3ds.pro: Make LIBS and INCLUDEPATH point to Debian version of lib3ds
* io_epoch.pro: Make LIBS point to Debian version of libbz2
* control:
  - Move Homepage URL to the source package section
  - Update to standards-version 3.8.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/// GLSL CODE
 
2
 
 
3
/// 1st Fragment Shader
 
4
 
 
5
// Projects points to screen space and rotates normal
 
6
// stores output on texture
 
7
#extension GL_ARB_draw_buffers : enable
 
8
 
 
9
uniform vec2 oo_fbo_size;
 
10
uniform float scale;
 
11
//uniform vec2 canvas_border;
 
12
//uniform float min_size;
 
13
 
 
14
uniform float reconstruction_filter_size;
 
15
uniform float canvas_width;
 
16
uniform int mask_size;
 
17
 
 
18
varying vec3 normal_vec;
 
19
varying vec3 radius_depth_w;
 
20
varying float dist_to_eye;
 
21
 
 
22
void main(void)
 
23
{
 
24
  if (radius_depth_w.x <= 0.0)
 
25
        discard;
 
26
 
 
27
  vec2 texCoord = vec2( floor(gl_FragCoord.st)*oo_fbo_size );
 
28
 
 
29
  float radius = radius_depth_w.x * scale / dist_to_eye;
 
30
  float unprojected_radius = radius;
 
31
 
 
32
  int log_level = int(floor(log2( ( 2.0 * radius * reconstruction_filter_size * canvas_width ) / float(mask_size*2 + 1) )));
 
33
 
 
34
  //  if (radius > min_size)
 
35
  if (log_level > 0)
 
36
        unprojected_radius *= -1.0;     
 
37
 
 
38
/*   if ((2.0*radius*(1.0/canvas_width)*reconstruction_filter_size) > float(mask_size*2 + 1)) */
 
39
/*      unprojected_radius *= -1.0; */
 
40
 
 
41
  gl_FragData[0] = vec4 ( normalize(normal_vec), radius_depth_w.y );
 
42
  //  gl_FragData[0] = vec4 ( normalize(normal_vec), gl_FragCoord.z);
 
43
  
 
44
  gl_FragData[1] = vec4 ( 4.0*unprojected_radius, radius, texCoord.st );
 
45
  gl_FragData[2] = gl_Color;
 
46
 
 
47
  // avoids sample with low quality overwritting sample with high quality in same pixel
 
48
  // during depth test
 
49
  //gl_FragDepth = gl_FragCoord.z - gl_Color.a*0.05;  
 
50
}