Right now in our engine we use a scheme like this to name texture samplers in a shader:
uniform sampler2D texture0;//diffuse map
uniform sampler2D texture1;//normal map
uniform sampler2D texture2;//specular map
uniform sampler2D texture3;//emissive map
The engine automatically sets the uniforms texture0...texturen to 0,1,2, etc., and each material has slots 0 to maxtexture-1 where textures can be assigned:
Material::SetTexture( Texture* texture, int index )
This works well, but people are complaining about having to use these names for texture sampler variables in the shader. I propose the following solution.
An integer can be used as a default value for sampler uniforms:
uniform sampler2D diffusemap=0;
uniform sampler2D normalmap=1;
uniform sampler2D specularmap=2;
uniform sampler2D emissivemap=3;



