Fix Texgen by doing skinning fixup later

This commit is contained in:
Jannik Vogel 2015-07-17 02:28:50 +02:00
parent 58411243d1
commit 8c445b5c69
1 changed files with 6 additions and 1 deletions

View File

@ -2682,7 +2682,7 @@ static ShaderBinding* generate_shaders(const ShaderState state)
qstring_append_fmt(vertex_shader_code, "/* Skinning mode %d */\n",
state.skinning);
if (count == 0) {
qstring_append(vertex_shader_code, "vec4 tPosition = position;\n");
qstring_append(vertex_shader_code, "vec4 tPosition = position * modelViewMat0;\n");
/* FIXME: Is the normal still transformed? */
qstring_append(vertex_shader_code, "vec3 tNormal = (vec4(normal, 0.0) * invModelViewMat0).xyz;\n");
} else {
@ -2771,6 +2771,11 @@ static ShaderBinding* generate_shaders(const ShaderState state)
}
}
/* If skinning is off the composite matrix already includes the MV matrix */
if (state.skinning == SKINNING_OFF) {
qstring_append(vertex_shader_code, "tPosition = position;\n");
}
qstring_append(vertex_shader_code,
" gl_Position = invViewport * (tPosition * compositeMat);\n"
/* temp hack: the composite matrix includes the view transform... */