Пример #1
0
//------------------------------------------------------------------------------
//!
void
CustomMaterial::updateSamplers()
{
   // Do we have samplers to update?
   if( _samplers.isNull() ) return;

   // TODO: try to optimized this code path.
   createSamplers();
}
Пример #2
0
    void assignTextureNamesImpl(GLuint tex_unit, const char *name,
                                SamplerTypeNew sampler_type, Args...args)
    {

        m_sampler_ids.push_back(createSamplers(sampler_type));

        assert(sampler_type >= ST_MIN && sampler_type <= ST_MAX);
        m_texture_type.push_back(m_all_texture_types[sampler_type]);

        GLuint location = this->getUniformLocation(name);
        m_texture_location.push_back(location);
        glUniform1i(location, tex_unit);
        m_texture_units.push_back(tex_unit);

        // Duplicated assert
        assert(sampler_type >= ST_MIN && sampler_type <= ST_MAX);
        m_bind_functions.push_back( m_all_bind_functions[sampler_type]);

        assignTextureNamesImpl<N + 1>(args...);
    }   // assignTextureNamesImpl
Пример #3
0
//------------------------------------------------------------------------------
//!
void
BaseMaterial::updateSamplers()
{
   // Do we have samplers to update?
   if( _samplers.isNull() ) return;

   if( _samplers->size() != _layers.size() )
   {
      createSamplers();
      return;
   }

   Gfx::TextureState state;
   state.maxAniso(16);
   auto& samplers = _samplers->samplers();
   for( size_t i = 1; i < samplers.size(); ++i )
   {
      state.clamp( (Gfx::TexClamp)_layers[i]._clamp );
      samplers[i]->state( state );
      samplers[i]->texture( _layers[i]._color->texture() );
   }
}
Пример #4
0
 /** For AZDO to remove the old texture handles, according to specification,
  *  they can only be removed when the underlying texture or sampler objects
  *  are finally deleted. This deletion will happen only when no handle
  *  using the texture or sampler object is resident on any context.
  */
 void recreateTrilinearSampler(int sampler_id)
 {
     glDeleteSamplers(1, &m_sampler_ids[sampler_id]);
     m_sampler_ids[sampler_id] =
         createSamplers(ST_TRILINEAR_ANISOTROPIC_FILTERED);
 }   // recreateTrilinearSampler