remove scale uniform from shaders

This commit is contained in:
Josh Holtrop 2012-09-15 20:53:14 -04:00
parent a1a81d66e1
commit 932b0b55f6
3 changed files with 4 additions and 7 deletions

View File

@ -1,5 +1,4 @@
uniform float scale;
uniform mat4 projection;
uniform mat4 modelview;
@ -11,7 +10,7 @@ varying vec3 normal_i;
void main(void)
{
gl_Position = projection * modelview * vec4(scale * pos, 1);
gl_Position = projection * modelview * vec4(pos, 1);
pos_i = gl_Position.xyz;
normal_i = modelview * vec4(normal, 0);
}

View File

@ -1,5 +1,4 @@
uniform float scale;
uniform mat4 projection;
uniform mat4 modelview;
@ -13,7 +12,7 @@ varying vec2 tex_coord_i;
void main(void)
{
gl_Position = projection * modelview * vec4(scale * pos, 1);
gl_Position = projection * modelview * vec4(pos, 1);
pos_i = gl_Position.xyz;
tex_coord_i = tex_coord;
normal_i = modelview * vec4(normal, 0);

View File

@ -82,7 +82,6 @@ bool Client::initgl()
"diffuse",
"specular",
"shininess",
"scale",
"projection",
"modelview"
};
@ -161,6 +160,7 @@ void Client::draw_players()
m_modelview.push();
m_modelview.translate(m_player->x, m_player->y, 4);
m_modelview.rotate(m_player->direction * 180.0 / M_PI, 0, 0, 1);
m_modelview.scale(2, 2, 2);
m_tank_obj.bindBuffers();
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
@ -169,7 +169,6 @@ void Client::draw_players()
stride, (GLvoid *) m_tank_obj.getVertexOffset());
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE,
stride, (GLvoid *) m_tank_obj.getNormalOffset());
glUniform1f(m_obj_program.uniform("scale"), 2.0f);
m_projection.to_uniform(m_obj_program.uniform("projection"));
m_modelview.to_uniform(m_obj_program.uniform("modelview"));
for (map<string, WFObj::Material>::iterator it =
@ -227,8 +226,8 @@ void Client::draw_map()
float cy = tile->get_y();
m_modelview.push();
m_modelview.translate(cx, cy, 0);
m_modelview.scale(tile->get_size(), tile->get_size(), tile->get_size());
m_modelview.to_uniform(m_obj_program.uniform("modelview"));
glUniform1f(m_obj_program.uniform("scale"), tile->get_size());
for (map<string, WFObj::Material>::iterator it =
m_tile_obj.getMaterials().begin();
it != m_tile_obj.getMaterials().end();