- textures[get_texture_index(slot)]=tex;
-}
-
-void RenderPass::bind() const
-{
- if(this==current)
- return;
-
- const RenderPass *old=current;
- current=this;
-
- if(shprog)
- {
- shprog->bind();
- shdata->apply();
- }
- else if(old && !old->shprog)
- GL::Program::unbind();
-
- if(material)
- material->bind();
- else if(old && !old->material)
- GL::Material::unbind();
-
- for(unsigned i=0; i<textures.size(); ++i)
- if(textures[i].texture)
- textures[i].texture->bind_to(i);
- if(old)
- {
- for(unsigned i=textures.size(); i<old->textures.size(); ++i)
- GL::Texture::unbind_from(i);
- }
-}
-
-void RenderPass::unbind()
-{
- if(current)
- {
- if(current->shprog)
- GL::Program::unbind();
-
- if(current->material)
- GL::Material::unbind();
-
- for(unsigned i=current->textures.size(); i--; )
- GL::Texture::unbind_from(i);
-
- current=0;
- }