Use object_pass.vert for transparent objects.
This commit is contained in:
parent
69e342490e
commit
edc38c9933
@ -1,22 +0,0 @@
|
|||||||
uniform mat4 ModelViewProjectionMatrix;
|
|
||||||
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;
|
|
||||||
varying vec2 uv;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
uv = (TextureMatrix * vec4(Texcoord, 1., 1.)).xy;
|
|
||||||
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
|
|
||||||
color = Color;
|
|
||||||
}
|
|
@ -1360,19 +1360,24 @@ namespace MeshShader
|
|||||||
void TransparentShader::init()
|
void TransparentShader::init()
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/transparent.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/transparent.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/transparent.frag").c_str());
|
||||||
attrib_position = glGetAttribLocation(Program, "Position");
|
attrib_position = glGetAttribLocation(Program, "Position");
|
||||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||||
attrib_color = glGetAttribLocation(Program, "Color");
|
attrib_color = glGetAttribLocation(Program, "Color");
|
||||||
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
|
uniform_MVP = glGetUniformLocation(Program, "ModelMatrix");
|
||||||
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
|
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
|
||||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||||
|
if (!UserConfigParams::m_ubo_disabled)
|
||||||
|
{
|
||||||
|
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||||
|
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransparentShader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix, unsigned TU_tex)
|
void TransparentShader::setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &TextureMatrix, unsigned TU_tex)
|
||||||
{
|
{
|
||||||
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
|
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelMatrix.pointer());
|
||||||
glUniformMatrix4fv(uniform_TM, 1, GL_FALSE, TextureMatrix.pointer());
|
glUniformMatrix4fv(uniform_TM, 1, GL_FALSE, TextureMatrix.pointer());
|
||||||
glUniform1i(uniform_tex, TU_tex);
|
glUniform1i(uniform_tex, TU_tex);
|
||||||
}
|
}
|
||||||
@ -1394,12 +1399,12 @@ namespace MeshShader
|
|||||||
void TransparentFogShader::init()
|
void TransparentFogShader::init()
|
||||||
{
|
{
|
||||||
Program = LoadProgram(
|
Program = LoadProgram(
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/transparent.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/transparentfog.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/transparentfog.frag").c_str());
|
||||||
attrib_position = glGetAttribLocation(Program, "Position");
|
attrib_position = glGetAttribLocation(Program, "Position");
|
||||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||||
attrib_color = glGetAttribLocation(Program, "Color");
|
attrib_color = glGetAttribLocation(Program, "Color");
|
||||||
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
|
uniform_MVP = glGetUniformLocation(Program, "ModelMatrix");
|
||||||
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
|
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
|
||||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||||
uniform_fogmax = glGetUniformLocation(Program, "fogmax");
|
uniform_fogmax = glGetUniformLocation(Program, "fogmax");
|
||||||
@ -1415,9 +1420,9 @@ namespace MeshShader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransparentFogShader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix, float fogmax, float startH, float endH, float start, float end, const core::vector3df &col, const core::vector3df &campos, unsigned TU_tex)
|
void TransparentFogShader::setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &TextureMatrix, float fogmax, float startH, float endH, float start, float end, const core::vector3df &col, const core::vector3df &campos, unsigned TU_tex)
|
||||||
{
|
{
|
||||||
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
|
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelMatrix.pointer());
|
||||||
glUniformMatrix4fv(uniform_TM, 1, GL_FALSE, TextureMatrix.pointer());
|
glUniformMatrix4fv(uniform_TM, 1, GL_FALSE, TextureMatrix.pointer());
|
||||||
glUniform1f(uniform_fogmax, fogmax);
|
glUniform1f(uniform_fogmax, fogmax);
|
||||||
glUniform1f(uniform_startH, startH);
|
glUniform1f(uniform_startH, startH);
|
||||||
|
@ -288,7 +288,7 @@ public:
|
|||||||
static GLuint uniform_MVP, uniform_TM, uniform_tex;
|
static GLuint uniform_MVP, uniform_TM, uniform_tex;
|
||||||
|
|
||||||
static void init();
|
static void init();
|
||||||
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix, unsigned TU_tex);
|
static void setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &TextureMatrix, unsigned TU_tex);
|
||||||
};
|
};
|
||||||
|
|
||||||
class TransparentFogShader
|
class TransparentFogShader
|
||||||
@ -299,7 +299,7 @@ public:
|
|||||||
static GLuint uniform_MVP, uniform_TM, uniform_tex, uniform_fogmax, uniform_startH, uniform_endH, uniform_start, uniform_end, uniform_col;
|
static GLuint uniform_MVP, uniform_TM, uniform_tex, uniform_fogmax, uniform_startH, uniform_endH, uniform_start, uniform_end, uniform_col;
|
||||||
|
|
||||||
static void init();
|
static void init();
|
||||||
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix, float fogmax, float startH, float endH, float start, float end, const core::vector3df &col, const core::vector3df &campos, unsigned TU_tex);
|
static void setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &TextureMatrix, float fogmax, float startH, float endH, float start, float end, const core::vector3df &col, const core::vector3df &campos, unsigned TU_tex);
|
||||||
};
|
};
|
||||||
|
|
||||||
class BillboardShader
|
class BillboardShader
|
||||||
|
@ -230,13 +230,13 @@ void STKAnimatedMesh::render()
|
|||||||
for_in(mesh, TransparentMesh[TM_DEFAULT])
|
for_in(mesh, TransparentMesh[TM_DEFAULT])
|
||||||
{
|
{
|
||||||
TransparentMeshes<TM_DEFAULT>::MeshSet.push_back(mesh);
|
TransparentMeshes<TM_DEFAULT>::MeshSet.push_back(mesh);
|
||||||
TransparentMeshes<TM_DEFAULT>::MVPSet.push_back(ModelViewProjectionMatrix);
|
TransparentMeshes<TM_DEFAULT>::MVPSet.push_back(AbsoluteTransformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
for_in(mesh, TransparentMesh[TM_ADDITIVE])
|
for_in(mesh, TransparentMesh[TM_ADDITIVE])
|
||||||
{
|
{
|
||||||
TransparentMeshes<TM_ADDITIVE>::MeshSet.push_back(mesh);
|
TransparentMeshes<TM_ADDITIVE>::MeshSet.push_back(mesh);
|
||||||
TransparentMeshes<TM_ADDITIVE>::MVPSet.push_back(ModelViewProjectionMatrix);
|
TransparentMeshes<TM_ADDITIVE>::MVPSet.push_back(AbsoluteTransformation);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -420,13 +420,13 @@ void STKMeshSceneNode::render()
|
|||||||
for_in(mesh, TransparentMesh[TM_DEFAULT])
|
for_in(mesh, TransparentMesh[TM_DEFAULT])
|
||||||
{
|
{
|
||||||
TransparentMeshes<TM_DEFAULT>::MeshSet.push_back(mesh);
|
TransparentMeshes<TM_DEFAULT>::MeshSet.push_back(mesh);
|
||||||
TransparentMeshes<TM_DEFAULT>::MVPSet.push_back(ModelViewProjectionMatrix);
|
TransparentMeshes<TM_DEFAULT>::MVPSet.push_back(AbsoluteTransformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
for_in(mesh, TransparentMesh[TM_ADDITIVE])
|
for_in(mesh, TransparentMesh[TM_ADDITIVE])
|
||||||
{
|
{
|
||||||
TransparentMeshes<TM_ADDITIVE>::MeshSet.push_back(mesh);
|
TransparentMeshes<TM_ADDITIVE>::MeshSet.push_back(mesh);
|
||||||
TransparentMeshes<TM_ADDITIVE>::MVPSet.push_back(ModelViewProjectionMatrix);
|
TransparentMeshes<TM_ADDITIVE>::MVPSet.push_back(AbsoluteTransformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TransparentMesh[TM_BUBBLE].empty())
|
if (!TransparentMesh[TM_BUBBLE].empty())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user