remove scale uniform from shaders
This commit is contained in:
parent
a1a81d66e1
commit
932b0b55f6
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
uniform float scale;
|
|
||||||
uniform mat4 projection;
|
uniform mat4 projection;
|
||||||
uniform mat4 modelview;
|
uniform mat4 modelview;
|
||||||
|
|
||||||
@ -11,7 +10,7 @@ varying vec3 normal_i;
|
|||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
gl_Position = projection * modelview * vec4(scale * pos, 1);
|
gl_Position = projection * modelview * vec4(pos, 1);
|
||||||
pos_i = gl_Position.xyz;
|
pos_i = gl_Position.xyz;
|
||||||
normal_i = modelview * vec4(normal, 0);
|
normal_i = modelview * vec4(normal, 0);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
uniform float scale;
|
|
||||||
uniform mat4 projection;
|
uniform mat4 projection;
|
||||||
uniform mat4 modelview;
|
uniform mat4 modelview;
|
||||||
|
|
||||||
@ -13,7 +12,7 @@ varying vec2 tex_coord_i;
|
|||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
gl_Position = projection * modelview * vec4(scale * pos, 1);
|
gl_Position = projection * modelview * vec4(pos, 1);
|
||||||
pos_i = gl_Position.xyz;
|
pos_i = gl_Position.xyz;
|
||||||
tex_coord_i = tex_coord;
|
tex_coord_i = tex_coord;
|
||||||
normal_i = modelview * vec4(normal, 0);
|
normal_i = modelview * vec4(normal, 0);
|
||||||
|
@ -82,7 +82,6 @@ bool Client::initgl()
|
|||||||
"diffuse",
|
"diffuse",
|
||||||
"specular",
|
"specular",
|
||||||
"shininess",
|
"shininess",
|
||||||
"scale",
|
|
||||||
"projection",
|
"projection",
|
||||||
"modelview"
|
"modelview"
|
||||||
};
|
};
|
||||||
@ -161,6 +160,7 @@ void Client::draw_players()
|
|||||||
m_modelview.push();
|
m_modelview.push();
|
||||||
m_modelview.translate(m_player->x, m_player->y, 4);
|
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.rotate(m_player->direction * 180.0 / M_PI, 0, 0, 1);
|
||||||
|
m_modelview.scale(2, 2, 2);
|
||||||
m_tank_obj.bindBuffers();
|
m_tank_obj.bindBuffers();
|
||||||
glEnableVertexAttribArray(0);
|
glEnableVertexAttribArray(0);
|
||||||
glEnableVertexAttribArray(1);
|
glEnableVertexAttribArray(1);
|
||||||
@ -169,7 +169,6 @@ void Client::draw_players()
|
|||||||
stride, (GLvoid *) m_tank_obj.getVertexOffset());
|
stride, (GLvoid *) m_tank_obj.getVertexOffset());
|
||||||
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE,
|
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE,
|
||||||
stride, (GLvoid *) m_tank_obj.getNormalOffset());
|
stride, (GLvoid *) m_tank_obj.getNormalOffset());
|
||||||
glUniform1f(m_obj_program.uniform("scale"), 2.0f);
|
|
||||||
m_projection.to_uniform(m_obj_program.uniform("projection"));
|
m_projection.to_uniform(m_obj_program.uniform("projection"));
|
||||||
m_modelview.to_uniform(m_obj_program.uniform("modelview"));
|
m_modelview.to_uniform(m_obj_program.uniform("modelview"));
|
||||||
for (map<string, WFObj::Material>::iterator it =
|
for (map<string, WFObj::Material>::iterator it =
|
||||||
@ -227,8 +226,8 @@ void Client::draw_map()
|
|||||||
float cy = tile->get_y();
|
float cy = tile->get_y();
|
||||||
m_modelview.push();
|
m_modelview.push();
|
||||||
m_modelview.translate(cx, cy, 0);
|
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"));
|
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 =
|
for (map<string, WFObj::Material>::iterator it =
|
||||||
m_tile_obj.getMaterials().begin();
|
m_tile_obj.getMaterials().begin();
|
||||||
it != m_tile_obj.getMaterials().end();
|
it != m_tile_obj.getMaterials().end();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user