{ FRAGMENT, "l_specular", "float", "pow(max(dot(n_zzz_half_vec, n_zzz_normal), 0.0), gl_FrontMaterial.shininess)", 0 },
{ FRAGMENT, "n_zzz_half_vec", "vec3", "normalize(zzz_light_dir-zzz_incident_dir)", 0 },
{ FRAGMENT, "n_zzz_light_dir", "vec3", "normalize(zzz_light_dir)", 0 },
- { FRAGMENT, "n_tbn_normal", "vec3", "texture2D(normalmap, texture_coord).xyz*2.0-1.0", "n" },
+ { FRAGMENT, "n_tbn_normal", "vec3", "normal_sample*2.0-1.0", "n" },
{ FRAGMENT, "n_eye_normal", "vec3", "normalize(eye_normal)", "!n" },
- { FRAGMENT, "tex_sample", "vec4", "texture2D(texture, texture_coord)", 0 },
+ { FRAGMENT, "normal_sample", "vec3", "texture2D(normalmap, texture_coord).xyz", "!c" },
+ { FRAGMENT, "normal_sample", "vec3", "sample_normalmap(texture_coord)", "c" },
+ { FRAGMENT, "tex_sample", "vec4", "texture2D(texture, texture_coord)", "!c" },
+ { FRAGMENT, "tex_sample", "vec4", "sample_texture(texture_coord)", "c" },
{ VERTEX, "gl_Position", 0, "gl_ProjectionMatrix*eye_vertex", 0 },
{ VERTEX, "shd_vertex", "vec3", "(eye_vertex*eye_shd_rmatrix).xyz", 0 },
source += "vec4 transform_vertex(vec4);\n";
source += "vec3 transform_normal(vec3);\n";
}
+ else if(scope==FRAGMENT && features.colorify)
+ {
+ if(features.texture)
+ source += "vec4 sample_texture(vec2);\n";
+ if(features.normalmap)
+ source += "vec3 sample_normalmap(vec2);\n";
+ }
source += "void main()\n{\n";
normalmap(false),
shadow(false),
reflection(false),
- transform(false)
+ transform(false),
+ colorify(false)
{ }
string ProgramBuilder::StandardFeatures::create_flags() const
flags += 'e';
if(transform)
flags += 'r';
+ if(colorify)
+ flags += 'c';
return flags;
}
ProgramBuilder::StandardFeatures::Loader::Loader(StandardFeatures &f):
DataFile::ObjectLoader<StandardFeatures>(f)
{
+ add("colorify", &StandardFeatures::colorify);
add("lighting", &StandardFeatures::lighting);
add("material", &StandardFeatures::material);
add("normalmap", &StandardFeatures::normalmap);