From: Mikko Rasa Date: Sun, 11 Sep 2016 10:36:04 +0000 (+0300) Subject: Consistently use the same spelling for diffuse_map and normal_map X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=437609f708f2918067ec64f6d02261d113b1cac0;p=libs%2Fgl.git Consistently use the same spelling for diffuse_map and normal_map It appears that spelling them as two separate words is more correct than a compound word. --- diff --git a/demos/desertpillars.cpp b/demos/desertpillars.cpp index be197828..2f141898 100644 --- a/demos/desertpillars.cpp +++ b/demos/desertpillars.cpp @@ -577,7 +577,7 @@ void DesertPillars::create_ground() features.lighting = true; features.shadow = true; features.texture = true; - features.normalmap = true; + features.normal_map = true; features.custom = ground_variables; GL::ProgramBuilder(features).add_shaders(ground_shprog); ground_shprog.bind_attribute(7, "ground_type"); diff --git a/demos/shaders.cpp b/demos/shaders.cpp index 6b7336fe..88ad06da 100644 --- a/demos/shaders.cpp +++ b/demos/shaders.cpp @@ -71,7 +71,7 @@ int main() feat.material = i/4>0; feat.texture = i/4>1; feat.lighting = i%4>0; - feat.normalmap = i%4>1; + feat.normal_map = i%4>1; feat.specular = i%4>2; programs.push_back(new GL::Program(feat)); } diff --git a/source/programbuilder.cpp b/source/programbuilder.cpp index 195d410f..829691b6 100644 --- a/source/programbuilder.cpp +++ b/source/programbuilder.cpp @@ -106,8 +106,8 @@ const ProgramBuilder::VariableDefinition ProgramBuilder::standard_variables[] = { FRAGMENT, "n_zzz_light_dir[i]", "vec3", "normalize(zzz_light_dir[i])", 0 }, { FRAGMENT, "n_tbn_normal", "vec3", "normal_sample*2.0-1.0", "n" }, { FRAGMENT, "n_eye_normal", "vec3", "normalize(eye_normal)", "!n" }, - { FRAGMENT, "normal_sample", "vec3", "texture2D(normalmap, texture_coord).xyz", 0 }, - { FRAGMENT, "diffuse_sample", "vec4", "texture2D(diffusemap, texture_coord)", 0 }, + { FRAGMENT, "normal_sample", "vec3", "texture2D(normal_map, texture_coord).xyz", 0 }, + { FRAGMENT, "diffuse_sample", "vec4", "texture2D(diffuse_map, texture_coord)", 0 }, { VERTEX, "gl_Position", "vec4", "projection_matrix*eye_vertex", 0 }, { VERTEX, "gl_ClipDistance[i]", "float", "dot(eye_vertex, clip_planes[i].equation)", "c" }, @@ -133,10 +133,10 @@ const ProgramBuilder::VariableDefinition ProgramBuilder::standard_variables[] = { ATTRIBUTE, "tangent", "vec3", 0, 0 }, { ATTRIBUTE, "binormal", "vec3", 0, 0 }, - { UNIFORM, "diffusemap", "sampler2D", 0, 0 }, + { UNIFORM, "diffuse_map", "sampler2D", 0, 0 }, { UNIFORM, "shadow", "sampler2DShadow", 0, 0 }, { UNIFORM, "ShadowMap::shadow_darkness", "float", 0, 0 }, - { UNIFORM, "normalmap", "sampler2D", 0, 0 }, + { UNIFORM, "normal_map", "sampler2D", 0, 0 }, { UNIFORM, "environment", "samplerCube", 0, 0 }, { UNIFORM, "EnvMap::env_eye_matrix", "mat3", 0, 0 }, { UNIFORM, "Material::reflectivity", "float", 0, 0 }, @@ -391,10 +391,10 @@ void ProgramBuilder::add_shaders(Program &prog) const prog.bind_attribute(NORMAL3, "normal"); else if(features.material) prog.bind_attribute(COLOR4_FLOAT, "color"); - if(features.texture || features.normalmap) + if(features.texture || features.normal_map) prog.bind_attribute(TEXCOORD4, "texcoord"); } - if(features.normalmap) + if(features.normal_map) { prog.bind_attribute(get_component_type(TANGENT3), "tangent"); prog.bind_attribute(get_component_type(BINORMAL3), "binormal"); @@ -758,7 +758,7 @@ ProgramBuilder::StandardFeatures::StandardFeatures(): skylight(false), fog(false), specular(false), - normalmap(false), + normal_map(false), shadow(false), reflection(false), clipping(false), @@ -784,7 +784,7 @@ string ProgramBuilder::StandardFeatures::create_flags() const flags += 'y'; if(specular) flags += 'p'; - if(normalmap) + if(normal_map) flags += 'n'; } if(fog) @@ -1132,12 +1132,15 @@ ProgramBuilder::StandardFeatures::Loader::Loader(StandardFeatures &f): add("material", &StandardFeatures::material); add("max_clip_planes", &StandardFeatures::max_clip_planes); add("max_lights", &StandardFeatures::max_lights); - add("normalmap", &StandardFeatures::normalmap); + add("normal_map", &StandardFeatures::normal_map); add("reflection", &StandardFeatures::reflection); add("shadow", &StandardFeatures::shadow); add("skylight", &StandardFeatures::skylight); add("specular", &StandardFeatures::specular); add("texture", &StandardFeatures::texture); + + // Deprecated + add("normalmap", &StandardFeatures::normal_map); } } // namespace GL diff --git a/source/programbuilder.h b/source/programbuilder.h index e61e9942..f2046e45 100644 --- a/source/programbuilder.h +++ b/source/programbuilder.h @@ -88,7 +88,7 @@ public: bool specular; /** Use a normal map texture. Only used if lighting is true. */ - bool normalmap; + bool normal_map; /** Use a shadow map. Requires a ShadowMap effect or equivalent in the pipeline. */ diff --git a/source/text.cpp b/source/text.cpp index 85647a83..cb39a695 100644 --- a/source/text.cpp +++ b/source/text.cpp @@ -23,7 +23,7 @@ void Text::set_technique(const Technique *tech) if(tech) { technique = *tech; - technique.replace_texture("diffusemap", font.get_texture()); + technique.replace_texture("diffuse_map", font.get_texture()); object.set_technique(&technique); } else