X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fprogrambuilder.cpp;h=4043fc4471648f6dec62d611c7cf07479548c545;hb=ab59f5a9e66b3fc7872ad96ec7949940189f0819;hp=05e801c72b8cc3cbbd77821a6e0dcdf84670955f;hpb=83bfb4bc26cf20cada1fcda47064b75d8e49fa08;p=libs%2Fgl.git diff --git a/source/programbuilder.cpp b/source/programbuilder.cpp index 05e801c7..4043fc44 100644 --- a/source/programbuilder.cpp +++ b/source/programbuilder.cpp @@ -3,6 +3,7 @@ #include "program.h" #include "programbuilder.h" #include "shader.h" +#include "vertexformat.h" using namespace std; @@ -81,7 +82,7 @@ const ProgramBuilder::StandardVariable ProgramBuilder::standard_variables[] = { VERTEX, "eye_binormal", "vec3", "gl_NormalMatrix*binormal", "!r" }, { VERTEX, "eye_binormal", "vec3", "transform_normal(binormal)", "r" }, { VERTEX, "color", "vec4", "gl_Color", 0 }, - { VERTEX, "texture_coord", "vec2", "gl_MultiTexCoord0", 0 }, + { VERTEX, "texture_coord", "vec2", "gl_MultiTexCoord0.xy", 0 }, { ATTRIBUTE, "tangent", "vec3", 0, 0 }, { ATTRIBUTE, "binormal", "vec3", 0, 0 }, @@ -182,6 +183,12 @@ void ProgramBuilder::add_shaders(Program &prog) const prog.attach_shader_owned(new VertexShader(create_source(resolved_vars, VERTEX))); prog.attach_shader_owned(new FragmentShader(create_source(resolved_vars, FRAGMENT))); + + if(features.normalmap) + { + prog.bind_attribute(get_component_type(TANGENT3), "tangent"); + prog.bind_attribute(get_component_type(BINORMAL3), "binormal"); + } } string ProgramBuilder::create_source(const list &variables, VariableScope scope) const