Attempt to fix skidding mark's color

This commit is contained in:
Vincent Lejeune 2014-03-19 01:25:44 +01:00
parent d9c5d415cd
commit 9a6d15a865
5 changed files with 9 additions and 3 deletions

View File

@ -2,6 +2,7 @@ uniform sampler2D tex;
#if __VERSION__ >= 130
in vec2 uv;
in vec4 color;
out vec4 FragColor;
#else
varying vec2 uv;
@ -11,5 +12,5 @@ varying vec2 uv;
void main()
{
FragColor = texture(tex, uv);
FragColor = texture(tex, uv) * color;
}

View File

@ -4,7 +4,9 @@ uniform mat4 TextureMatrix;
#if __VERSION__ >= 130
in vec3 Position;
in vec2 Texcoord;
in vec4 Color;
out vec2 uv;
out vec4 color;
#else
attribute vec3 Position;
attribute vec2 Texcoord;
@ -16,4 +18,5 @@ void main()
{
uv = (TextureMatrix * vec4(Texcoord, 1., 1.)).xy;
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
color = Color;
}

View File

@ -873,6 +873,7 @@ namespace MeshShader
GLuint TransparentShader::Program;
GLuint TransparentShader::attrib_position;
GLuint TransparentShader::attrib_texcoord;
GLuint TransparentShader::attrib_color;
GLuint TransparentShader::uniform_MVP;
GLuint TransparentShader::uniform_TM;
GLuint TransparentShader::uniform_tex;
@ -882,6 +883,7 @@ namespace MeshShader
Program = LoadProgram(file_manager->getAsset("shaders/transparent.vert").c_str(), file_manager->getAsset("shaders/transparent.frag").c_str());
attrib_position = glGetAttribLocation(Program, "Position");
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
attrib_color = glGetAttribLocation(Program, "Color");
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
uniform_tex = glGetUniformLocation(Program, "tex");

View File

@ -210,7 +210,7 @@ class TransparentShader
{
public:
static GLuint Program;
static GLuint attrib_position, attrib_texcoord;
static GLuint attrib_position, attrib_texcoord, attrib_color;
static GLuint uniform_MVP, uniform_TM, uniform_tex;
static void init();

View File

@ -815,7 +815,7 @@ void initvaostate(GLMesh &mesh, TransparentMaterial TranspMat)
break;
case TM_DEFAULT:
mesh.vao_first_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
MeshShader::TransparentShader::attrib_position, MeshShader::TransparentShader::attrib_texcoord, -1, -1, -1, -1, -1, mesh.Stride);
MeshShader::TransparentShader::attrib_position, MeshShader::TransparentShader::attrib_texcoord, -1, -1, -1, -1, MeshShader::TransparentShader::attrib_color, mesh.Stride);
break;
}
mesh.vao_glow_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, MeshShader::ColorizeShader::attrib_position, -1, -1, -1, -1, -1, -1, mesh.Stride);