From d5c91dcfe4ac423984b99dccb12aee2d3606643b Mon Sep 17 00:00:00 2001 From: vlj Date: Sat, 28 Jun 2014 23:01:28 +0200 Subject: [PATCH] Remove Untextured material. --- data/shaders/object_pass2.frag | 10 +++------- data/shaders/rsm.frag | 3 ++- data/shaders/rsm.vert | 3 +++ src/graphics/render.cpp | 5 ----- src/graphics/stkanimatedmesh.cpp | 7 ------- src/graphics/stkmesh.cpp | 2 -- src/graphics/stkmesh.hpp | 1 - src/graphics/stkmeshscenenode.cpp | 7 ------- 8 files changed, 8 insertions(+), 30 deletions(-) diff --git a/data/shaders/object_pass2.frag b/data/shaders/object_pass2.frag index 3f802425b..c984c7f34 100644 --- a/data/shaders/object_pass2.frag +++ b/data/shaders/object_pass2.frag @@ -1,18 +1,14 @@ uniform sampler2D Albedo; -#if __VERSION__ >= 130 in vec2 uv; +in vec4 color; out vec4 FragColor; -#else -varying vec2 uv; -#define FragColor gl_FragColor -#endif vec3 getLightFactor(float specMapValue); void main(void) { - vec4 color = texture(Albedo, uv); + vec4 col = texture(Albedo, uv) * color; vec3 LightFactor = getLightFactor(1.); - FragColor = vec4(color.xyz * LightFactor, 1.); + FragColor = vec4(col.xyz * LightFactor, 1.); } diff --git a/data/shaders/rsm.frag b/data/shaders/rsm.frag index 8c1d0f077..05d9be685 100644 --- a/data/shaders/rsm.frag +++ b/data/shaders/rsm.frag @@ -2,11 +2,12 @@ uniform sampler2D tex; in vec2 uv; in vec3 nor; +in vec4 color; layout (location = 0) out vec3 RSMColor; layout (location = 1) out vec3 RSMNormals; void main() { - RSMColor = texture(tex, uv).xyz; + RSMColor = texture(tex, uv).xyz * color.rgb; RSMNormals = .5 * normalize(nor) + .5; } diff --git a/data/shaders/rsm.vert b/data/shaders/rsm.vert index 4b44144b2..5ed3b9ad4 100644 --- a/data/shaders/rsm.vert +++ b/data/shaders/rsm.vert @@ -11,10 +11,12 @@ uniform mat4 TextureMatrix = layout(location = 0) in vec3 Position; layout(location = 1) in vec3 Normal; +layout(location = 2) in vec4 Color; layout(location = 3) in vec2 Texcoord; out vec3 nor; out vec2 uv; +out vec4 color; void main(void) @@ -24,4 +26,5 @@ void main(void) gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.); nor = (vec4(Normal, 0.)).xyz; uv = (TextureMatrix * vec4(Texcoord, 1., 1.)).xy; + color = Color.zyxw; } diff --git a/src/graphics/render.cpp b/src/graphics/render.cpp index ac737f39d..a9fd70691 100644 --- a/src/graphics/render.cpp +++ b/src/graphics/render.cpp @@ -587,7 +587,6 @@ void IrrDriver::renderSolidSecondPass() GroupedSM::reset(); GroupedSM::reset(); GroupedSM::reset(); - GroupedSM::reset(); setTexture(0, m_rtts->getRenderTarget(RTT_TMP1), GL_NEAREST, GL_NEAREST); setTexture(1, m_rtts->getRenderTarget(RTT_TMP2), GL_NEAREST, GL_NEAREST); setTexture(2, m_rtts->getRenderTarget(RTT_HALF1_R), GL_LINEAR, GL_LINEAR); @@ -625,10 +624,6 @@ void IrrDriver::renderSolidSecondPass() glUseProgram(MeshShader::DetailledObjectPass2Shader::Program); for (unsigned i = 0; i < GroupedSM::MeshSet.size(); i++) drawDetailledObjectPass2(*GroupedSM::MeshSet[i], GroupedSM::MVPSet[i]); - - glUseProgram(MeshShader::UntexturedObjectShader::Program); - for (unsigned i = 0; i < GroupedSM::MeshSet.size(); i++) - drawUntexturedObject(*GroupedSM::MeshSet[i], GroupedSM::MVPSet[i]); } } diff --git a/src/graphics/stkanimatedmesh.cpp b/src/graphics/stkanimatedmesh.cpp index 793b0e621..544574162 100644 --- a/src/graphics/stkanimatedmesh.cpp +++ b/src/graphics/stkanimatedmesh.cpp @@ -199,13 +199,6 @@ void STKAnimatedMesh::render() GroupedSM::TIMVSet.push_back(invmodel); } - for_in(mesh, ShadedMesh[SM_UNTEXTURED]) - { - GroupedSM::MeshSet.push_back(mesh); - GroupedSM::MVPSet.push_back(AbsoluteTransformation); - GroupedSM::TIMVSet.push_back(invmodel); - } - return; } diff --git a/src/graphics/stkmesh.cpp b/src/graphics/stkmesh.cpp index ec44f1a9e..c6729be71 100644 --- a/src/graphics/stkmesh.cpp +++ b/src/graphics/stkmesh.cpp @@ -37,8 +37,6 @@ ShadedMaterial MaterialTypeToShadedMaterial(video::E_MATERIAL_TYPE type, video:: return SM_UNLIT; else if (textures[1] && type != irr_driver->getShader(ES_NORMAL_MAP)) return SM_DETAILS; - else if (!textures[0]) - return SM_UNTEXTURED; else return SM_DEFAULT; } diff --git a/src/graphics/stkmesh.hpp b/src/graphics/stkmesh.hpp index fef78a453..bb983694d 100644 --- a/src/graphics/stkmesh.hpp +++ b/src/graphics/stkmesh.hpp @@ -29,7 +29,6 @@ enum ShadedMaterial SM_GRASS, SM_UNLIT, SM_DETAILS, - SM_UNTEXTURED, SM_COUNT }; diff --git a/src/graphics/stkmeshscenenode.cpp b/src/graphics/stkmeshscenenode.cpp index f9a60888e..2b8ff8800 100644 --- a/src/graphics/stkmeshscenenode.cpp +++ b/src/graphics/stkmeshscenenode.cpp @@ -365,13 +365,6 @@ void STKMeshSceneNode::render() GroupedSM::TIMVSet.push_back(invmodel); } - for_in(mesh, ShadedMesh[SM_UNTEXTURED]) - { - GroupedSM::MeshSet.push_back(mesh); - GroupedSM::MVPSet.push_back(AbsoluteTransformation); - GroupedSM::TIMVSet.push_back(invmodel); - } - if (!ShadedMesh[SM_GRASS].empty()) glUseProgram(MeshShader::GrassPass2Shader::Program); for_in(mesh, ShadedMesh[SM_GRASS])