Ejemplo n.º 1
0
bool
DotsShader::set_uniform_variables() const
{
   assert(_patch);   

   //tone map variables
   glUniform1i(_tone_tex_loc, ColorRefImage::lookup_raw_tex_unit(0));
   glUniform1i(_width_loc,  VIEW::peek()->width());
   glUniform1i(_height_loc, VIEW::peek()->height());

   if (_patch->get_use_visibility_test()) {
      _patch->update_dynamic_samples(IDVisibilityTest());
   } else {
      _patch->update_dynamic_samples();
   }
   
   glUniform2fv(_origin_loc, 1, float2(_patch->sample_origin()));
   glUniform1i (_style_loc, _style);

   if (_patch->get_do_lod()) {
      glUniform1f (_st_loc, float(_patch->lod_t()));
      glUniform2fv(_u_vec_loc,  1, float2(_patch->lod_u()));
      glUniform2fv(_v_vec_loc,  1, float2(_patch->lod_v()));
   } else {
      glUniform1f (_st_loc, float(0));
      glUniform2fv(_u_vec_loc,  1, float2(_patch->sample_u_vec()));
      glUniform2fv(_v_vec_loc,  1, float2(_patch->sample_v_vec()));
   }

   return true;
}
Ejemplo n.º 2
0
bool
Halftone_TX::set_uniform_variables() const
{
   if (!_patch) return 0;
   assert(_patch);

   glUniform1f(_opacity_remap_loc, (1.0/mesh()->get_blend_remap_value()));

   //tone map variables
   send_var(_tone_tex_loc, ColorRefImage::lookup_raw_tex_unit(0));
   send_var(_halo_tex_loc, HaloRefImage::lookup_raw_tex_unit());
   
   GLint dims[2];
   int w, h;
   VIEW::peek_size(w,h);
   dims[0] = w;
   dims[1] = h;
   glUniform2iv(_dims_loc, 1, dims);

   if (_patch->get_use_visibility_test()) {
      _patch->update_dynamic_samples(IDVisibilityTest());
   } else {
      _patch->update_dynamic_samples();
   }

   glUniform2fv(_origin_loc, 1, float2(_patch->sample_origin()));

   // XXX - hack for demoing alpha transitions.
   //       to save instructions in the shader this is normally
   //       not enabled
   if (enable_alpha_transitions)
      send_var(_use_alpha_loc, _use_alpha_transitions);

   if (_patch->get_do_lod()) {
      glUniform1f (_st_loc, float(_patch->lod_t()));
      glUniform1f (_timed_lod_hi, float(_patch->timed_lod_hi()));
      glUniform1f (_timed_lod_lo, float(_patch->timed_lod_lo()));
      glUniform2fv(_u_vec_loc,  1, float2(_patch->lod_u()));
      glUniform2fv(_v_vec_loc,  1, float2(_patch->lod_v()));
   } else {
      glUniform1f (_st_loc, float(0));
      glUniform2fv(_u_vec_loc,  1, float2(_patch->sample_u_vec()));
      glUniform2fv(_v_vec_loc,  1, float2(_patch->sample_v_vec()));
   }

   send_layers_variables();

   return true;
}