Some more conversion
This commit is contained in:
parent
3a55bbe796
commit
42482e0c41
@ -1,6 +1,14 @@
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 TransposeInverseModelView;
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
mat4 ViewMatrix;
|
||||
mat4 ProjectionMatrix;
|
||||
mat4 InverseViewMatrix;
|
||||
mat4 InverseProjectionMatrix;
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
};
|
||||
|
||||
uniform mat4 ModelMatrix;
|
||||
uniform mat4 InverseModelMatrix;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec3 Position;
|
||||
@ -23,6 +31,8 @@ varying vec2 uv;
|
||||
|
||||
void main()
|
||||
{
|
||||
mat4 ModelViewProjectionMatrix = ProjectionMatrix * ViewMatrix * ModelMatrix;
|
||||
mat4 TransposeInverseModelView = transpose(InverseModelMatrix * InverseViewMatrix);
|
||||
uv = Texcoord;
|
||||
tangent = (TransposeInverseModelView * vec4(Tangent, 1.)).xyz;
|
||||
bitangent = (TransposeInverseModelView * vec4(Bitangent, 1.)).xyz;
|
||||
|
@ -1,5 +1,15 @@
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 TransposeInverseModelView;
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
mat4 ViewMatrix;
|
||||
mat4 ProjectionMatrix;
|
||||
mat4 InverseViewMatrix;
|
||||
mat4 InverseProjectionMatrix;
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
};
|
||||
|
||||
uniform mat4 ModelMatrix;
|
||||
uniform mat4 InverseModelMatrix;
|
||||
|
||||
uniform mat4 TextureMatrix =
|
||||
mat4(1., 0., 0., 0.,
|
||||
0., 1., 0., 0.,
|
||||
@ -11,9 +21,11 @@ in vec3 Position;
|
||||
in vec2 Texcoord;
|
||||
in vec2 SecondTexcoord;
|
||||
in vec3 Normal;
|
||||
in vec4 Color;
|
||||
out vec3 nor;
|
||||
out vec2 uv;
|
||||
out vec2 uv_bis;
|
||||
out vec4 color;
|
||||
#else
|
||||
attribute vec3 Position;
|
||||
attribute vec3 Normal;
|
||||
@ -27,6 +39,9 @@ varying vec2 uv_bis;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
color = Color.zyxw;
|
||||
mat4 ModelViewProjectionMatrix = ProjectionMatrix * ViewMatrix * ModelMatrix;
|
||||
mat4 TransposeInverseModelView = transpose(InverseModelMatrix * InverseViewMatrix);
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
|
||||
nor = (TransposeInverseModelView * vec4(Normal, 0.)).xyz;
|
||||
uv = (TextureMatrix * vec4(Texcoord, 1., 1.)).xy;
|
||||
|
@ -6,17 +6,17 @@ uniform vec2 screen;
|
||||
uniform vec3 ambient;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec3 normal;
|
||||
in vec3 nor;
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec3 normal;
|
||||
varying vec3 nor;
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
float rim = 1.0 - dot(normal, vec3(0., 0., -1));
|
||||
float rim = 1.0 - dot(nor, vec3(0., 0., -1));
|
||||
rim = smoothstep(0.5, 1.5, rim) * 0.35;
|
||||
|
||||
vec4 color = texture(Albedo, uv);
|
||||
|
@ -1,25 +0,0 @@
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 TransposeInverseModelView;
|
||||
uniform mat4 TextureMatrix;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec3 Position;
|
||||
in vec3 Normal;
|
||||
in vec2 Texcoord;
|
||||
in vec4 Color;
|
||||
out vec2 uv;
|
||||
out vec3 normal;
|
||||
#else
|
||||
attribute vec3 Position;
|
||||
attribute vec3 Normal;
|
||||
attribute vec2 Texcoord;
|
||||
attribute vec4 Color;
|
||||
varying vec2 uv;
|
||||
varying vec3 normal;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
normal = (TransposeInverseModelView * vec4(Normal, 0)).xyz;
|
||||
uv = (TextureMatrix * vec4(Texcoord, 1., 1.)).xy;
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
|
||||
}
|
@ -1,7 +1,14 @@
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
mat4 ViewMatrix;
|
||||
mat4 ProjectionMatrix;
|
||||
mat4 InverseViewMatrix;
|
||||
mat4 InverseProjectionMatrix;
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
};
|
||||
|
||||
uniform samplerCube tex;
|
||||
uniform mat4 invproj;
|
||||
uniform vec2 screen;
|
||||
uniform mat4 TransposeViewMatrix;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec3 nor;
|
||||
@ -15,12 +22,12 @@ varying vec3 nor;
|
||||
void main() {
|
||||
vec3 fpos = gl_FragCoord.xyz / vec3(screen, 1.);
|
||||
vec4 xpos = 2.0 * vec4(fpos, 1.0) - 1.0;
|
||||
xpos = invproj * xpos;
|
||||
xpos = InverseProjectionMatrix * xpos;
|
||||
|
||||
xpos.xyz /= xpos.w;
|
||||
vec3 viewSampleDir = reflect(xpos.xyz, nor);
|
||||
// Convert sampleDir in world space (where tex was generated)
|
||||
vec4 sampleDir = TransposeViewMatrix * vec4(viewSampleDir, 0.);
|
||||
vec4 sampleDir = transpose(InverseViewMatrix) * vec4(viewSampleDir, 0.);
|
||||
vec4 detail0 = texture(tex, sampleDir.xyz);
|
||||
|
||||
FragColor = vec4(detail0.xyz, 1.);
|
||||
|
@ -1,5 +1,13 @@
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
mat4 ViewMatrix;
|
||||
mat4 ProjectionMatrix;
|
||||
mat4 InverseViewMatrix;
|
||||
mat4 InverseProjectionMatrix;
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
};
|
||||
|
||||
uniform samplerCube tex;
|
||||
uniform mat4 InvProjView;
|
||||
uniform vec2 screen;
|
||||
|
||||
|
||||
@ -14,7 +22,7 @@ void main(void)
|
||||
{
|
||||
vec3 eyedir = gl_FragCoord.xyz / vec3(screen, 1.);
|
||||
eyedir = 2.0 * eyedir - 1.0;
|
||||
vec4 tmp = (InvProjView * vec4(eyedir, 1.));
|
||||
vec4 tmp = (InverseViewMatrix * InverseProjectionMatrix * vec4(eyedir, 1.));
|
||||
eyedir = tmp.xyz / tmp.w;
|
||||
vec4 color = texture(tex, eyedir);
|
||||
FragColor = vec4(color.xyz, 1.);
|
||||
|
@ -1,41 +0,0 @@
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2013 the SuperTuxKart team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 TransposeInverseModelView;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec3 Position;
|
||||
in vec2 Texcoord;
|
||||
in vec2 SecondTexcoord;
|
||||
out vec2 uv;
|
||||
out vec2 uv_bis;
|
||||
#else
|
||||
attribute vec3 Position;
|
||||
attribute vec2 Texcoord;
|
||||
attribute vec2 SecondTexcoord;
|
||||
varying vec2 uv;
|
||||
varying vec2 uv_bis;
|
||||
#endif
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
uv = Texcoord;
|
||||
uv_bis = SecondTexcoord;
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
|
||||
}
|
@ -1,4 +1,13 @@
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
mat4 ViewMatrix;
|
||||
mat4 ProjectionMatrix;
|
||||
mat4 InverseViewMatrix;
|
||||
mat4 InverseProjectionMatrix;
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
};
|
||||
|
||||
uniform mat4 ModelMatrix;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec3 Position;
|
||||
@ -14,5 +23,5 @@ varying vec4 color;
|
||||
void main(void)
|
||||
{
|
||||
color = Color.zyxw;
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
|
||||
gl_Position = ProjectionMatrix * ViewMatrix * ModelMatrix * vec4(Position, 1.);
|
||||
}
|
||||
|
@ -464,6 +464,7 @@ void IrrDriver::renderSolidSecondPass()
|
||||
GroupedSM<SM_SPLATTING>::reset();
|
||||
GroupedSM<SM_UNLIT>::reset();
|
||||
GroupedSM<SM_DETAILS>::reset();
|
||||
GroupedSM<SM_UNTEXTURED>::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_SSAO), GL_NEAREST, GL_NEAREST);
|
||||
@ -497,6 +498,10 @@ void IrrDriver::renderSolidSecondPass()
|
||||
for (unsigned i = 0; i < GroupedSM<SM_DETAILS>::MeshSet.size(); i++)
|
||||
drawDetailledObjectPass2(*GroupedSM<SM_DETAILS>::MeshSet[i], GroupedSM<SM_DETAILS>::MVPSet[i]);
|
||||
|
||||
glUseProgram(MeshShader::UntexturedObjectShader::Program);
|
||||
for (unsigned i = 0; i < GroupedSM<SM_UNTEXTURED>::MeshSet.size(); i++)
|
||||
drawUntexturedObject(*GroupedSM<SM_UNTEXTURED>::MeshSet[i], GroupedSM<SM_UNTEXTURED>::MVPSet[i]);
|
||||
|
||||
}
|
||||
|
||||
void IrrDriver::renderTransparent()
|
||||
@ -1328,7 +1333,7 @@ void IrrDriver::renderSkybox()
|
||||
glBindVertexArray(MeshShader::SkyboxShader::cubevao);
|
||||
glDisable(GL_CULL_FACE);
|
||||
assert(SkyboxTextures.size() == 6);
|
||||
core::matrix4 transform = irr_driver->getProjViewMatrix();
|
||||
|
||||
core::matrix4 translate;
|
||||
translate.setTranslation(camera->getAbsolutePosition());
|
||||
|
||||
@ -1336,7 +1341,7 @@ void IrrDriver::renderSkybox()
|
||||
const f32 viewDistance = (camera->getNearValue() + camera->getFarValue()) * 0.5f;
|
||||
core::matrix4 scale;
|
||||
scale.setScale(core::vector3df(viewDistance, viewDistance, viewDistance));
|
||||
transform *= translate * scale;
|
||||
core::matrix4 transform = translate * scale;
|
||||
core::matrix4 invtransform;
|
||||
transform.getInverse(invtransform);
|
||||
|
||||
@ -1345,7 +1350,7 @@ void IrrDriver::renderSkybox()
|
||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glUseProgram(MeshShader::SkyboxShader::Program);
|
||||
MeshShader::SkyboxShader::setUniforms(transform, invtransform, core::vector2df(UserConfigParams::m_width, UserConfigParams::m_height), 0);
|
||||
MeshShader::SkyboxShader::setUniforms(transform, core::vector2df(UserConfigParams::m_width, UserConfigParams::m_height), 0);
|
||||
glDrawElements(GL_TRIANGLES, 6 * 6, GL_UNSIGNED_INT, 0);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
@ -397,8 +397,8 @@ namespace MeshShader
|
||||
GLuint ObjectPass1Shader::attrib_position;
|
||||
GLuint ObjectPass1Shader::attrib_normal;
|
||||
GLuint ObjectPass1Shader::attrib_texcoord;
|
||||
GLuint ObjectPass1Shader::uniform_MVP;
|
||||
GLuint ObjectPass1Shader::uniform_TIMV;
|
||||
GLuint ObjectPass1Shader::uniform_MM;
|
||||
GLuint ObjectPass1Shader::uniform_IMM;
|
||||
GLuint ObjectPass1Shader::uniform_tex;
|
||||
|
||||
void ObjectPass1Shader::init()
|
||||
@ -410,15 +410,17 @@ namespace MeshShader
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_normal = glGetAttribLocation(Program, "Normal");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
|
||||
uniform_TIMV = glGetUniformLocation(Program, "TransposeInverseModelView");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
uniform_IMM = glGetUniformLocation(Program, "InverseModelMatrix");
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
}
|
||||
|
||||
void ObjectPass1Shader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView, unsigned TU_tex)
|
||||
void ObjectPass1Shader::setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &InverseModelMatrix, unsigned TU_tex)
|
||||
{
|
||||
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_TIMV, 1, GL_FALSE, TransposeInverseModelView.pointer());
|
||||
glUniformMatrix4fv(uniform_MM, 1, GL_FALSE, ModelMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_IMM, 1, GL_FALSE, InverseModelMatrix.pointer());
|
||||
glUniform1i(uniform_tex, TU_tex);
|
||||
}
|
||||
|
||||
@ -426,8 +428,8 @@ namespace MeshShader
|
||||
GLuint ObjectRefPass1Shader::attrib_position;
|
||||
GLuint ObjectRefPass1Shader::attrib_normal;
|
||||
GLuint ObjectRefPass1Shader::attrib_texcoord;
|
||||
GLuint ObjectRefPass1Shader::uniform_MVP;
|
||||
GLuint ObjectRefPass1Shader::uniform_TIMV;
|
||||
GLuint ObjectRefPass1Shader::uniform_MM;
|
||||
GLuint ObjectRefPass1Shader::uniform_IMM;
|
||||
GLuint ObjectRefPass1Shader::uniform_TM;
|
||||
GLuint ObjectRefPass1Shader::uniform_tex;
|
||||
|
||||
@ -440,17 +442,19 @@ namespace MeshShader
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_normal = glGetAttribLocation(Program, "Normal");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
|
||||
uniform_TIMV = glGetUniformLocation(Program, "TransposeInverseModelView");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
uniform_IMM = glGetUniformLocation(Program, "InverseModelMatrix");
|
||||
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
}
|
||||
|
||||
void ObjectRefPass1Shader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView, const core::matrix4 &TextureMatrix, unsigned TU_tex)
|
||||
void ObjectRefPass1Shader::setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &InverseModelMatrix, const core::matrix4 &TextureMatrix, unsigned TU_tex)
|
||||
{
|
||||
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_MM, 1, GL_FALSE, ModelMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_TM, 1, GL_FALSE, TextureMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_TIMV, 1, GL_FALSE, TransposeInverseModelView.pointer());
|
||||
glUniformMatrix4fv(uniform_IMM, 1, GL_FALSE, InverseModelMatrix.pointer());
|
||||
glUniform1i(uniform_tex, TU_tex);
|
||||
}
|
||||
|
||||
@ -493,8 +497,8 @@ namespace MeshShader
|
||||
GLuint NormalMapShader::attrib_texcoord;
|
||||
GLuint NormalMapShader::attrib_tangent;
|
||||
GLuint NormalMapShader::attrib_bitangent;
|
||||
GLuint NormalMapShader::uniform_MVP;
|
||||
GLuint NormalMapShader::uniform_TIMV;
|
||||
GLuint NormalMapShader::uniform_MM;
|
||||
GLuint NormalMapShader::uniform_IMM;
|
||||
GLuint NormalMapShader::uniform_normalMap;
|
||||
|
||||
void NormalMapShader::init()
|
||||
@ -507,15 +511,17 @@ namespace MeshShader
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
attrib_tangent = glGetAttribLocation(Program, "Tangent");
|
||||
attrib_bitangent = glGetAttribLocation(Program, "Bitangent");
|
||||
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
|
||||
uniform_TIMV = glGetUniformLocation(Program, "TransposeInverseModelView");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
uniform_IMM = glGetUniformLocation(Program, "InverseModelMatrix");
|
||||
uniform_normalMap = glGetUniformLocation(Program, "normalMap");
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
}
|
||||
|
||||
void NormalMapShader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView, unsigned TU_normalMap)
|
||||
void NormalMapShader::setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &InverseModelMatrix, unsigned TU_normalMap)
|
||||
{
|
||||
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_TIMV, 1, GL_FALSE, TransposeInverseModelView.pointer());
|
||||
glUniformMatrix4fv(uniform_MM, 1, GL_FALSE, ModelMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_IMM, 1, GL_FALSE, InverseModelMatrix.pointer());
|
||||
glUniform1i(uniform_normalMap, TU_normalMap);
|
||||
}
|
||||
|
||||
@ -623,7 +629,7 @@ namespace MeshShader
|
||||
GLuint ObjectPass2Shader::Program;
|
||||
GLuint ObjectPass2Shader::attrib_position;
|
||||
GLuint ObjectPass2Shader::attrib_texcoord;
|
||||
GLuint ObjectPass2Shader::uniform_MVP;
|
||||
GLuint ObjectPass2Shader::uniform_MM;
|
||||
GLuint ObjectPass2Shader::uniform_TM;
|
||||
GLuint ObjectPass2Shader::uniform_screen;
|
||||
GLuint ObjectPass2Shader::uniform_ambient;
|
||||
@ -637,7 +643,7 @@ namespace MeshShader
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/object_pass2.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
|
||||
GLuint uniform_Albedo = glGetUniformLocation(Program, "Albedo");
|
||||
GLuint uniform_DiffuseMap = glGetUniformLocation(Program, "DiffuseMap");
|
||||
@ -645,6 +651,8 @@ namespace MeshShader
|
||||
GLuint uniform_SSAO = glGetUniformLocation(Program, "SSAO");
|
||||
uniform_screen = glGetUniformLocation(Program, "screen");
|
||||
uniform_ambient = glGetUniformLocation(Program, "ambient");
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
TU_Albedo = 3;
|
||||
|
||||
glUseProgram(Program);
|
||||
@ -655,9 +663,9 @@ namespace MeshShader
|
||||
glUseProgram(0);
|
||||
}
|
||||
|
||||
void ObjectPass2Shader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix)
|
||||
void ObjectPass2Shader::setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &TextureMatrix)
|
||||
{
|
||||
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_MM, 1, GL_FALSE, ModelMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_TM, 1, GL_FALSE, TextureMatrix.pointer());
|
||||
glUniform2f(uniform_screen, UserConfigParams::m_width, UserConfigParams::m_height);
|
||||
const video::SColorf s = irr_driver->getSceneManager()->getAmbientLight();
|
||||
@ -776,7 +784,7 @@ namespace MeshShader
|
||||
GLuint DetailledObjectPass2Shader::attrib_position;
|
||||
GLuint DetailledObjectPass2Shader::attrib_texcoord;
|
||||
GLuint DetailledObjectPass2Shader::attrib_second_texcoord;
|
||||
GLuint DetailledObjectPass2Shader::uniform_MVP;
|
||||
GLuint DetailledObjectPass2Shader::uniform_MM;
|
||||
GLuint DetailledObjectPass2Shader::uniform_screen;
|
||||
GLuint DetailledObjectPass2Shader::uniform_ambient;
|
||||
GLuint DetailledObjectPass2Shader::TU_Albedo;
|
||||
@ -791,7 +799,7 @@ namespace MeshShader
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
attrib_second_texcoord = glGetAttribLocation(Program, "SecondTexcoord");
|
||||
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
GLuint uniform_Albedo = glGetUniformLocation(Program, "Albedo");
|
||||
GLuint uniform_Detail = glGetUniformLocation(Program, "Detail");
|
||||
GLuint uniform_DiffuseMap = glGetUniformLocation(Program, "DiffuseMap");
|
||||
@ -799,6 +807,8 @@ namespace MeshShader
|
||||
GLuint uniform_SSAO = glGetUniformLocation(Program, "SSAO");
|
||||
uniform_screen = glGetUniformLocation(Program, "screen");
|
||||
uniform_ambient = glGetUniformLocation(Program, "ambient");
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
TU_Albedo = 3;
|
||||
TU_detail = 4;
|
||||
|
||||
@ -811,9 +821,9 @@ namespace MeshShader
|
||||
glUseProgram(0);
|
||||
}
|
||||
|
||||
void DetailledObjectPass2Shader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix)
|
||||
void DetailledObjectPass2Shader::setUniforms(const core::matrix4 &ModelMatrix)
|
||||
{
|
||||
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_MM, 1, GL_FALSE, ModelMatrix.pointer());
|
||||
glUniform2f(uniform_screen, UserConfigParams::m_width, UserConfigParams::m_height);
|
||||
const video::SColorf s = irr_driver->getSceneManager()->getAmbientLight();
|
||||
glUniform3f(uniform_ambient, s.r, s.g, s.b);
|
||||
@ -822,7 +832,7 @@ namespace MeshShader
|
||||
GLuint ObjectUnlitShader::Program;
|
||||
GLuint ObjectUnlitShader::attrib_position;
|
||||
GLuint ObjectUnlitShader::attrib_texcoord;
|
||||
GLuint ObjectUnlitShader::uniform_MVP;
|
||||
GLuint ObjectUnlitShader::uniform_MM;
|
||||
GLuint ObjectUnlitShader::TU_tex;
|
||||
|
||||
void ObjectUnlitShader::init()
|
||||
@ -832,8 +842,10 @@ namespace MeshShader
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/object_unlit.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
GLuint uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
TU_tex = 3;
|
||||
|
||||
glUseProgram(Program);
|
||||
@ -841,17 +853,17 @@ namespace MeshShader
|
||||
glUseProgram(0);
|
||||
}
|
||||
|
||||
void ObjectUnlitShader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix)
|
||||
void ObjectUnlitShader::setUniforms(const core::matrix4 &ModelMatrix)
|
||||
{
|
||||
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_MM, 1, GL_FALSE, ModelMatrix.pointer());
|
||||
}
|
||||
|
||||
GLuint ObjectRimLimitShader::Program;
|
||||
GLuint ObjectRimLimitShader::attrib_position;
|
||||
GLuint ObjectRimLimitShader::attrib_texcoord;
|
||||
GLuint ObjectRimLimitShader::attrib_normal;
|
||||
GLuint ObjectRimLimitShader::uniform_MVP;
|
||||
GLuint ObjectRimLimitShader::uniform_TIMV;
|
||||
GLuint ObjectRimLimitShader::uniform_MM;
|
||||
GLuint ObjectRimLimitShader::uniform_IMM;
|
||||
GLuint ObjectRimLimitShader::uniform_TM;
|
||||
GLuint ObjectRimLimitShader::uniform_screen;
|
||||
GLuint ObjectRimLimitShader::uniform_ambient;
|
||||
@ -860,13 +872,13 @@ namespace MeshShader
|
||||
void ObjectRimLimitShader::init()
|
||||
{
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/objectpass_rimlit.vert").c_str(),
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/objectpass_rimlit.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
attrib_normal = glGetAttribLocation(Program, "Normal");
|
||||
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
|
||||
uniform_TIMV = glGetUniformLocation(Program, "TransposeInverseModelView");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
uniform_IMM = glGetUniformLocation(Program, "InverseModelMatrix");
|
||||
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
|
||||
GLuint uniform_Albedo = glGetUniformLocation(Program, "Albedo");
|
||||
GLuint uniform_DiffuseMap = glGetUniformLocation(Program, "DiffuseMap");
|
||||
@ -874,6 +886,9 @@ namespace MeshShader
|
||||
GLuint uniform_SSAO = glGetUniformLocation(Program, "SSAO");
|
||||
uniform_screen = glGetUniformLocation(Program, "screen");
|
||||
uniform_ambient = glGetUniformLocation(Program, "ambient");
|
||||
GLuint uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
TU_Albedo = 3;
|
||||
|
||||
glUseProgram(Program);
|
||||
@ -884,10 +899,10 @@ namespace MeshShader
|
||||
glUseProgram(0);
|
||||
}
|
||||
|
||||
void ObjectRimLimitShader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView, const core::matrix4 &TextureMatrix)
|
||||
void ObjectRimLimitShader::setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &InverseModelMatrix, const core::matrix4 &TextureMatrix)
|
||||
{
|
||||
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_TIMV, 1, GL_FALSE, TransposeInverseModelView.pointer());
|
||||
glUniformMatrix4fv(uniform_MM, 1, GL_FALSE, ModelMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_IMM, 1, GL_FALSE, InverseModelMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_TM, 1, GL_FALSE, TextureMatrix.pointer());
|
||||
glUniform2f(uniform_screen, UserConfigParams::m_width, UserConfigParams::m_height);
|
||||
const video::SColorf s = irr_driver->getSceneManager()->getAmbientLight();
|
||||
@ -897,24 +912,26 @@ namespace MeshShader
|
||||
GLuint UntexturedObjectShader::Program;
|
||||
GLuint UntexturedObjectShader::attrib_position;
|
||||
GLuint UntexturedObjectShader::attrib_color;
|
||||
GLuint UntexturedObjectShader::uniform_MVP;
|
||||
GLuint UntexturedObjectShader::uniform_MM;
|
||||
GLuint UntexturedObjectShader::uniform_screen;
|
||||
GLuint UntexturedObjectShader::uniform_ambient;
|
||||
|
||||
void UntexturedObjectShader::init()
|
||||
{
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/untextured_object.vert").c_str(),
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/untextured_object.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_color = glGetAttribLocation(Program, "Color");
|
||||
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
GLuint uniform_DiffuseMap = glGetUniformLocation(Program, "DiffuseMap");
|
||||
GLuint uniform_SpecularMap = glGetUniformLocation(Program, "SpecularMap");
|
||||
GLuint uniform_SSAO = glGetUniformLocation(Program, "SSAO");
|
||||
uniform_screen = glGetUniformLocation(Program, "screen");
|
||||
uniform_ambient = glGetUniformLocation(Program, "ambient");
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
|
||||
glUseProgram(Program);
|
||||
glUniform1i(uniform_DiffuseMap, 0);
|
||||
@ -923,9 +940,9 @@ namespace MeshShader
|
||||
glUseProgram(0);
|
||||
}
|
||||
|
||||
void UntexturedObjectShader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix)
|
||||
void UntexturedObjectShader::setUniforms(const core::matrix4 &ModelMatrix)
|
||||
{
|
||||
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_MM, 1, GL_FALSE, ModelMatrix.pointer());
|
||||
glUniform2f(uniform_screen, UserConfigParams::m_width, UserConfigParams::m_height);
|
||||
const video::SColorf s = irr_driver->getSceneManager()->getAmbientLight();
|
||||
glUniform3f(uniform_ambient, s.r, s.g, s.b);
|
||||
@ -935,7 +952,7 @@ namespace MeshShader
|
||||
GLuint ObjectRefPass2Shader::Program;
|
||||
GLuint ObjectRefPass2Shader::attrib_position;
|
||||
GLuint ObjectRefPass2Shader::attrib_texcoord;
|
||||
GLuint ObjectRefPass2Shader::uniform_MVP;
|
||||
GLuint ObjectRefPass2Shader::uniform_MM;
|
||||
GLuint ObjectRefPass2Shader::uniform_TM;
|
||||
GLuint ObjectRefPass2Shader::uniform_screen;
|
||||
GLuint ObjectRefPass2Shader::uniform_ambient;
|
||||
@ -950,7 +967,7 @@ namespace MeshShader
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/objectref_pass2.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
|
||||
GLuint uniform_Albedo = glGetUniformLocation(Program, "Albedo");
|
||||
GLuint uniform_DiffuseMap = glGetUniformLocation(Program, "DiffuseMap");
|
||||
@ -958,6 +975,8 @@ namespace MeshShader
|
||||
GLuint uniform_SSAO = glGetUniformLocation(Program, "SSAO");
|
||||
uniform_screen = glGetUniformLocation(Program, "screen");
|
||||
uniform_ambient = glGetUniformLocation(Program, "ambient");
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
TU_Albedo = 3;
|
||||
|
||||
glUseProgram(Program);
|
||||
@ -968,9 +987,9 @@ namespace MeshShader
|
||||
glUseProgram(0);
|
||||
}
|
||||
|
||||
void ObjectRefPass2Shader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix)
|
||||
void ObjectRefPass2Shader::setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &TextureMatrix)
|
||||
{
|
||||
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_MM, 1, GL_FALSE, ModelMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_TM, 1, GL_FALSE, TextureMatrix.pointer());
|
||||
glUniform2f(uniform_screen, UserConfigParams::m_width, UserConfigParams::m_height);
|
||||
const video::SColorf s = irr_driver->getSceneManager()->getAmbientLight();
|
||||
@ -1097,10 +1116,8 @@ namespace MeshShader
|
||||
GLuint SphereMapShader::Program;
|
||||
GLuint SphereMapShader::attrib_position;
|
||||
GLuint SphereMapShader::attrib_normal;
|
||||
GLuint SphereMapShader::uniform_MVP;
|
||||
GLuint SphereMapShader::uniform_TIMV;
|
||||
GLuint SphereMapShader::uniform_TVM;
|
||||
GLuint SphereMapShader::uniform_invproj;
|
||||
GLuint SphereMapShader::uniform_MM;
|
||||
GLuint SphereMapShader::uniform_IMM;
|
||||
GLuint SphereMapShader::uniform_screen;
|
||||
GLuint SphereMapShader::TU_tex;
|
||||
|
||||
@ -1111,11 +1128,9 @@ namespace MeshShader
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/objectpass_spheremap.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_normal = glGetAttribLocation(Program, "Normal");
|
||||
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
|
||||
uniform_TIMV = glGetUniformLocation(Program, "TransposeInverseModelView");
|
||||
uniform_TVM = glGetUniformLocation(Program, "TransposeViewMatrix");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
uniform_IMM = glGetUniformLocation(Program, "InverseModelMatrix");
|
||||
GLuint uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
uniform_invproj = glGetUniformLocation(Program, "invproj");
|
||||
uniform_screen = glGetUniformLocation(Program, "screen");
|
||||
TU_tex = 3;
|
||||
|
||||
@ -1124,12 +1139,10 @@ namespace MeshShader
|
||||
glUseProgram(0);
|
||||
}
|
||||
|
||||
void SphereMapShader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TransposeViewMatrix, const core::matrix4 &TransposeInverseModelView, const core::matrix4 &InvProj, const core::vector2df& screen)
|
||||
void SphereMapShader::setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &InverseModelMatrix, const core::vector2df& screen)
|
||||
{
|
||||
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_TIMV, 1, GL_FALSE, TransposeInverseModelView.pointer());
|
||||
glUniformMatrix4fv(uniform_TVM, 1, GL_FALSE, TransposeViewMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_invproj, 1, GL_FALSE, InvProj.pointer());
|
||||
glUniformMatrix4fv(uniform_MM, 1, GL_FALSE, ModelMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_IMM, 1, GL_FALSE, InverseModelMatrix.pointer());
|
||||
glUniform2f(uniform_screen, screen.X, screen.Y);
|
||||
}
|
||||
|
||||
@ -1137,7 +1150,7 @@ namespace MeshShader
|
||||
GLuint SplattingShader::attrib_position;
|
||||
GLuint SplattingShader::attrib_texcoord;
|
||||
GLuint SplattingShader::attrib_second_texcoord;
|
||||
GLuint SplattingShader::uniform_MVP;
|
||||
GLuint SplattingShader::uniform_MM;
|
||||
GLuint SplattingShader::uniform_screen;
|
||||
GLuint SplattingShader::uniform_ambient;
|
||||
GLuint SplattingShader::TU_tex_layout;
|
||||
@ -1149,12 +1162,12 @@ namespace MeshShader
|
||||
void SplattingShader::init()
|
||||
{
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/splatting.vert").c_str(),
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/splatting.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
attrib_second_texcoord = glGetAttribLocation(Program, "SecondTexcoord");
|
||||
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
GLuint uniform_tex_layout = glGetUniformLocation(Program, "tex_layout");
|
||||
GLuint uniform_tex_detail0 = glGetUniformLocation(Program, "tex_detail0");
|
||||
GLuint uniform_tex_detail1 = glGetUniformLocation(Program, "tex_detail1");
|
||||
@ -1183,9 +1196,9 @@ namespace MeshShader
|
||||
glUseProgram(0);
|
||||
}
|
||||
|
||||
void SplattingShader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix)
|
||||
void SplattingShader::setUniforms(const core::matrix4 &ModelMatrix)
|
||||
{
|
||||
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_MM, 1, GL_FALSE, ModelMatrix.pointer());
|
||||
glUniform2f(uniform_screen, UserConfigParams::m_width, UserConfigParams::m_height);
|
||||
const video::SColorf s = irr_driver->getSceneManager()->getAmbientLight();
|
||||
glUniform3f(uniform_ambient, s.r, s.g, s.b);
|
||||
@ -1623,10 +1636,9 @@ namespace MeshShader
|
||||
|
||||
GLuint SkyboxShader::Program;
|
||||
GLuint SkyboxShader::attrib_position;
|
||||
GLuint SkyboxShader::uniform_MVP;
|
||||
GLuint SkyboxShader::uniform_MM;
|
||||
GLuint SkyboxShader::uniform_tex;
|
||||
GLuint SkyboxShader::uniform_screen;
|
||||
GLuint SkyboxShader::uniform_InvProjView;
|
||||
GLuint SkyboxShader::cubevao;
|
||||
|
||||
void SkyboxShader::init()
|
||||
@ -1635,10 +1647,11 @@ namespace MeshShader
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/sky.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
|
||||
uniform_InvProjView = glGetUniformLocation(Program, "InvProjView");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
uniform_screen = glGetUniformLocation(Program, "screen");
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
|
||||
glGenVertexArrays(1, &cubevao);
|
||||
glBindVertexArray(cubevao);
|
||||
@ -1649,10 +1662,9 @@ namespace MeshShader
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
void SkyboxShader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &InvProjView, const core::vector2df &screen, unsigned TU_tex)
|
||||
void SkyboxShader::setUniforms(const core::matrix4 &ModelMatrix, const core::vector2df &screen, unsigned TU_tex)
|
||||
{
|
||||
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_InvProjView, 1, GL_FALSE, InvProjView.pointer());
|
||||
glUniformMatrix4fv(uniform_MM, 1, GL_FALSE, ModelMatrix.pointer());
|
||||
glUniform1i(uniform_tex, TU_tex);
|
||||
glUniform2f(uniform_screen, screen.X, screen.Y);
|
||||
}
|
||||
|
@ -39,10 +39,10 @@ class ObjectPass1Shader
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord, attrib_normal;
|
||||
static GLuint uniform_MVP, uniform_TIMV, uniform_tex;
|
||||
static GLuint uniform_MM, uniform_IMM, uniform_tex;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView, unsigned TU_tex);
|
||||
static void setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &InverseModelMatrix, unsigned TU_tex);
|
||||
};
|
||||
|
||||
class ObjectRefPass1Shader
|
||||
@ -50,10 +50,10 @@ class ObjectRefPass1Shader
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_normal, attrib_texcoord;
|
||||
static GLuint uniform_MVP, uniform_TM, uniform_TIMV, uniform_tex;
|
||||
static GLuint uniform_MM, uniform_TM, uniform_IMM, uniform_tex;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView, const core::matrix4 &TextureMatrix, unsigned TU_texture);
|
||||
static void setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &InverseModelMatrix, const core::matrix4 &TextureMatrix, unsigned TU_texture);
|
||||
};
|
||||
|
||||
class GrassPass1Shader
|
||||
@ -72,10 +72,10 @@ class NormalMapShader
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord, attrib_tangent, attrib_bitangent;
|
||||
static GLuint uniform_MVP, uniform_TIMV, uniform_normalMap;
|
||||
static GLuint uniform_MM, uniform_IMM, uniform_normalMap;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView, unsigned TU_normalMap);
|
||||
static void setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &InverseModelMatrix, unsigned TU_normalMap);
|
||||
};
|
||||
|
||||
class InstancedObjectPass1Shader
|
||||
@ -116,11 +116,11 @@ class ObjectPass2Shader
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord;
|
||||
static GLuint uniform_MVP, uniform_TM, uniform_screen, uniform_ambient;
|
||||
static GLuint uniform_MM, uniform_TM, uniform_screen, uniform_ambient;
|
||||
static GLuint TU_Albedo;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix);
|
||||
static void setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &TextureMatrix);
|
||||
};
|
||||
|
||||
class InstancedObjectPass2Shader
|
||||
@ -152,11 +152,11 @@ class DetailledObjectPass2Shader
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord, attrib_second_texcoord;
|
||||
static GLuint uniform_MVP, uniform_screen, uniform_ambient;
|
||||
static GLuint uniform_MM, uniform_screen, uniform_ambient;
|
||||
static GLuint TU_Albedo, TU_detail;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix);
|
||||
static void setUniforms(const core::matrix4 &ModelMatrix);
|
||||
};
|
||||
|
||||
class ObjectRimLimitShader
|
||||
@ -164,11 +164,11 @@ class ObjectRimLimitShader
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_normal, attrib_texcoord;
|
||||
static GLuint uniform_MVP, uniform_TIMV, uniform_TM, uniform_screen, uniform_ambient;
|
||||
static GLuint uniform_MM, uniform_IMM, uniform_TM, uniform_screen, uniform_ambient;
|
||||
static GLuint TU_Albedo;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView, const core::matrix4 &TextureMatrix);
|
||||
static void setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &InverseModelMatrix, const core::matrix4 &TextureMatrix);
|
||||
};
|
||||
|
||||
class UntexturedObjectShader
|
||||
@ -176,10 +176,10 @@ class UntexturedObjectShader
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_color;
|
||||
static GLuint uniform_MVP, uniform_screen, uniform_ambient;
|
||||
static GLuint uniform_MM, uniform_screen, uniform_ambient;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix);
|
||||
static void setUniforms(const core::matrix4 &ModelMatrix);
|
||||
};
|
||||
|
||||
class ObjectUnlitShader
|
||||
@ -187,11 +187,11 @@ class ObjectUnlitShader
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord;
|
||||
static GLuint uniform_MVP;
|
||||
static GLuint uniform_MM;
|
||||
static GLuint TU_tex;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix);
|
||||
static void setUniforms(const core::matrix4 &ModelMatrix);
|
||||
};
|
||||
|
||||
class ObjectRefPass2Shader
|
||||
@ -199,11 +199,11 @@ class ObjectRefPass2Shader
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord;
|
||||
static GLuint uniform_MVP, uniform_TM, uniform_screen, uniform_ambient;
|
||||
static GLuint uniform_MM, uniform_TM, uniform_screen, uniform_ambient;
|
||||
static GLuint TU_Albedo;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix);
|
||||
static void setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &TextureMatrix);
|
||||
};
|
||||
|
||||
class GrassPass2Shader
|
||||
@ -235,11 +235,11 @@ class SphereMapShader
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_normal;
|
||||
static GLuint uniform_MVP, uniform_TIMV, uniform_TVM, uniform_invproj, uniform_screen;
|
||||
static GLuint uniform_MM, uniform_IMM, uniform_screen;
|
||||
static GLuint TU_tex;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TransposeViewMatrix, const core::matrix4 &TransposeInverseModelView, const core::matrix4 &InvProj, const core::vector2df& screen);
|
||||
static void setUniforms(const core::matrix4 &ModelMatrix, const core::matrix4 &InverseModelMatrix, const core::vector2df& screen);
|
||||
};
|
||||
|
||||
class SplattingShader
|
||||
@ -247,11 +247,11 @@ class SplattingShader
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord, attrib_second_texcoord;
|
||||
static GLuint uniform_MVP, uniform_screen, uniform_ambient;
|
||||
static GLuint uniform_MM, uniform_screen, uniform_ambient;
|
||||
static GLuint TU_tex_layout, TU_tex_detail0, TU_tex_detail1, TU_tex_detail2, TU_tex_detail3;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix);
|
||||
static void setUniforms(const core::matrix4 &ModelMatrix);
|
||||
};
|
||||
|
||||
class CausticsShader
|
||||
@ -403,11 +403,11 @@ class SkyboxShader
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position;
|
||||
static GLuint uniform_MVP, uniform_InvProjView, uniform_tex, uniform_screen;
|
||||
static GLuint uniform_MM, uniform_tex, uniform_screen;
|
||||
static GLuint cubevao;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &InvProjView, const core::vector2df &screen, unsigned TU_tex);
|
||||
static void setUniforms(const core::matrix4 &ModelMatrix, const core::vector2df &screen, unsigned TU_tex);
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -145,19 +145,21 @@ void STKAnimatedMesh::render()
|
||||
{
|
||||
ModelViewProjectionMatrix = computeMVP(AbsoluteTransformation);
|
||||
TransposeInverseModelView = computeTIMV(AbsoluteTransformation);
|
||||
core::matrix4 invmodel;
|
||||
AbsoluteTransformation.getInverse(invmodel);
|
||||
|
||||
for (unsigned i = 0; i < GeometricMesh[FPSM_DEFAULT].size(); i++)
|
||||
{
|
||||
GroupedFPSM<FPSM_DEFAULT>::MeshSet.push_back(GeometricMesh[FPSM_DEFAULT][i]);
|
||||
GroupedFPSM<FPSM_DEFAULT>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedFPSM<FPSM_DEFAULT>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
GroupedFPSM<FPSM_DEFAULT>::MVPSet.push_back(AbsoluteTransformation);
|
||||
GroupedFPSM<FPSM_DEFAULT>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < GeometricMesh[FPSM_ALPHA_REF_TEXTURE].size(); i++)
|
||||
{
|
||||
GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MeshSet.push_back(GeometricMesh[FPSM_ALPHA_REF_TEXTURE][i]);
|
||||
GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MVPSet.push_back(AbsoluteTransformation);
|
||||
GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -165,39 +167,42 @@ void STKAnimatedMesh::render()
|
||||
|
||||
if (irr_driver->getPhase() == SOLID_LIT_PASS)
|
||||
{
|
||||
core::matrix4 invmodel;
|
||||
AbsoluteTransformation.getInverse(invmodel);
|
||||
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_DEFAULT].size(); i++)
|
||||
{
|
||||
GroupedSM<SM_DEFAULT>::MeshSet.push_back(ShadedMesh[SM_DEFAULT][i]);
|
||||
GroupedSM<SM_DEFAULT>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_DEFAULT>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
GroupedSM<SM_DEFAULT>::MVPSet.push_back(AbsoluteTransformation);
|
||||
GroupedSM<SM_DEFAULT>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_ALPHA_REF_TEXTURE].size(); i++)
|
||||
{
|
||||
GroupedSM<SM_ALPHA_REF_TEXTURE>::MeshSet.push_back(ShadedMesh[SM_ALPHA_REF_TEXTURE][i]);
|
||||
GroupedSM<SM_ALPHA_REF_TEXTURE>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_ALPHA_REF_TEXTURE>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
GroupedSM<SM_ALPHA_REF_TEXTURE>::MVPSet.push_back(AbsoluteTransformation);
|
||||
GroupedSM<SM_ALPHA_REF_TEXTURE>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_RIMLIT].size(); i++)
|
||||
{
|
||||
GroupedSM<SM_RIMLIT>::MeshSet.push_back(ShadedMesh[SM_RIMLIT][i]);
|
||||
GroupedSM<SM_RIMLIT>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_RIMLIT>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
GroupedSM<SM_RIMLIT>::MVPSet.push_back(AbsoluteTransformation);
|
||||
GroupedSM<SM_RIMLIT>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
for (GLMesh *mesh : ShadedMesh[SM_UNLIT])
|
||||
{
|
||||
GroupedSM<SM_UNLIT>::MeshSet.push_back(mesh);
|
||||
GroupedSM<SM_UNLIT>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_UNLIT>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
GroupedSM<SM_UNLIT>::MVPSet.push_back(AbsoluteTransformation);
|
||||
GroupedSM<SM_UNLIT>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
for (GLMesh *mesh : ShadedMesh[SM_DETAILS])
|
||||
{
|
||||
GroupedSM<SM_DETAILS>::MeshSet.push_back(mesh);
|
||||
GroupedSM<SM_DETAILS>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_DETAILS>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
GroupedSM<SM_DETAILS>::MVPSet.push_back(AbsoluteTransformation);
|
||||
GroupedSM<SM_DETAILS>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -269,7 +269,7 @@ void drawGrassPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProjectio
|
||||
glDrawElements(ptype, count, itype, 0);
|
||||
}
|
||||
|
||||
void drawNormalPass(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView)
|
||||
void drawNormalPass(const GLMesh &mesh, const core::matrix4 & ModelMatrix, const core::matrix4 &InverseModelMatrix)
|
||||
{
|
||||
irr_driver->IncreaseObjectCount();
|
||||
GLenum ptype = mesh.PrimitiveType;
|
||||
@ -279,14 +279,14 @@ void drawNormalPass(const GLMesh &mesh, const core::matrix4 & ModelViewProjectio
|
||||
assert(mesh.textures[1]);
|
||||
setTexture(0, mesh.textures[1], GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
|
||||
MeshShader::NormalMapShader::setUniforms(ModelViewProjectionMatrix, TransposeInverseModelView, 0);
|
||||
MeshShader::NormalMapShader::setUniforms(ModelMatrix, InverseModelMatrix, 0);
|
||||
|
||||
assert(mesh.vao_first_pass);
|
||||
glBindVertexArray(mesh.vao_first_pass);
|
||||
glDrawElements(ptype, count, itype, 0);
|
||||
}
|
||||
|
||||
void drawSphereMap(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView)
|
||||
void drawSphereMap(const GLMesh &mesh, const core::matrix4 &ModelMatrix, const core::matrix4 &InverseModelMatrix)
|
||||
{
|
||||
irr_driver->IncreaseObjectCount();
|
||||
GLenum ptype = mesh.PrimitiveType;
|
||||
@ -306,7 +306,7 @@ void drawSphereMap(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionM
|
||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
}
|
||||
|
||||
MeshShader::SphereMapShader::setUniforms(ModelViewProjectionMatrix, irr_driver->getViewMatrix().getTransposed(), TransposeInverseModelView, irr_driver->getInvProjMatrix(), core::vector2df(UserConfigParams::m_width, UserConfigParams::m_height));
|
||||
MeshShader::SphereMapShader::setUniforms(ModelMatrix, InverseModelMatrix, core::vector2df(UserConfigParams::m_width, UserConfigParams::m_height));
|
||||
|
||||
assert(mesh.vao_second_pass);
|
||||
glBindVertexArray(mesh.vao_second_pass);
|
||||
@ -476,14 +476,14 @@ void drawGrassPass2(const GLMesh &mesh, const core::matrix4 & ModelViewProjectio
|
||||
glDrawElements(ptype, count, itype, 0);
|
||||
}
|
||||
|
||||
void drawUntexturedObject(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix)
|
||||
void drawUntexturedObject(const GLMesh &mesh, const core::matrix4 &ModelMatrix)
|
||||
{
|
||||
irr_driver->IncreaseObjectCount();
|
||||
GLenum ptype = mesh.PrimitiveType;
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
MeshShader::UntexturedObjectShader::setUniforms(ModelViewProjectionMatrix);
|
||||
MeshShader::UntexturedObjectShader::setUniforms(ModelMatrix);
|
||||
|
||||
assert(mesh.vao_second_pass);
|
||||
glBindVertexArray(mesh.vao_second_pass);
|
||||
|
@ -90,7 +90,7 @@ template<enum GeometricMaterial T>
|
||||
std::vector<core::matrix4> GroupedFPSM<T>::TIMVSet;
|
||||
|
||||
void drawObjectPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView);
|
||||
void drawNormalPass(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView);
|
||||
void drawNormalPass(const GLMesh &mesh, const core::matrix4 & ModelMatrix, const core::matrix4 &InverseModelMatrix);
|
||||
void drawObjectRefPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView, const core::matrix4 &TextureMatrix);
|
||||
void drawGrassPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView, core::vector3df windDir);
|
||||
|
||||
|
@ -336,26 +336,28 @@ void STKMeshSceneNode::render()
|
||||
glDisable(GL_CULL_FACE);
|
||||
ModelViewProjectionMatrix = computeMVP(AbsoluteTransformation);
|
||||
TransposeInverseModelView = computeTIMV(AbsoluteTransformation);
|
||||
core::matrix4 invmodel;
|
||||
AbsoluteTransformation.getInverse(invmodel);
|
||||
for (unsigned i = 0; i < GeometricMesh[FPSM_DEFAULT].size(); i++)
|
||||
{
|
||||
|
||||
GroupedFPSM<FPSM_DEFAULT>::MeshSet.push_back(GeometricMesh[FPSM_DEFAULT][i]);
|
||||
GroupedFPSM<FPSM_DEFAULT>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedFPSM<FPSM_DEFAULT>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
GroupedFPSM<FPSM_DEFAULT>::MVPSet.push_back(AbsoluteTransformation);
|
||||
GroupedFPSM<FPSM_DEFAULT>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < GeometricMesh[FPSM_ALPHA_REF_TEXTURE].size(); i++)
|
||||
{
|
||||
GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MeshSet.push_back(GeometricMesh[FPSM_ALPHA_REF_TEXTURE][i]);
|
||||
GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MVPSet.push_back(AbsoluteTransformation);
|
||||
GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < GeometricMesh[FPSM_NORMAL_MAP].size(); i++)
|
||||
{
|
||||
GroupedFPSM<FPSM_NORMAL_MAP>::MeshSet.push_back(GeometricMesh[FPSM_NORMAL_MAP][i]);
|
||||
GroupedFPSM<FPSM_NORMAL_MAP>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedFPSM<FPSM_NORMAL_MAP>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
GroupedFPSM<FPSM_NORMAL_MAP>::MVPSet.push_back(AbsoluteTransformation);
|
||||
GroupedFPSM<FPSM_NORMAL_MAP>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
if (!GeometricMesh[FPSM_GRASS].empty())
|
||||
@ -373,54 +375,64 @@ void STKMeshSceneNode::render()
|
||||
if (reload_each_frame)
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
core::matrix4 invmodel;
|
||||
AbsoluteTransformation.getInverse(invmodel);
|
||||
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_DEFAULT].size(); i++)
|
||||
{
|
||||
GroupedSM<SM_DEFAULT>::MeshSet.push_back(ShadedMesh[SM_DEFAULT][i]);
|
||||
GroupedSM<SM_DEFAULT>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_DEFAULT>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
GroupedSM<SM_DEFAULT>::MVPSet.push_back(AbsoluteTransformation);
|
||||
GroupedSM<SM_DEFAULT>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_ALPHA_REF_TEXTURE].size(); i++)
|
||||
{
|
||||
GroupedSM<SM_ALPHA_REF_TEXTURE>::MeshSet.push_back(ShadedMesh[SM_ALPHA_REF_TEXTURE][i]);
|
||||
GroupedSM<SM_ALPHA_REF_TEXTURE>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_ALPHA_REF_TEXTURE>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
GroupedSM<SM_ALPHA_REF_TEXTURE>::MVPSet.push_back(AbsoluteTransformation);
|
||||
GroupedSM<SM_ALPHA_REF_TEXTURE>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_RIMLIT].size(); i++)
|
||||
{
|
||||
GroupedSM<SM_RIMLIT>::MeshSet.push_back(ShadedMesh[SM_RIMLIT][i]);
|
||||
GroupedSM<SM_RIMLIT>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_RIMLIT>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
GroupedSM<SM_RIMLIT>::MVPSet.push_back(AbsoluteTransformation);
|
||||
GroupedSM<SM_RIMLIT>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_SPHEREMAP].size(); i++)
|
||||
{
|
||||
GroupedSM<SM_SPHEREMAP>::MeshSet.push_back(ShadedMesh[SM_SPHEREMAP][i]);
|
||||
GroupedSM<SM_SPHEREMAP>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_SPHEREMAP>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
GroupedSM<SM_SPHEREMAP>::MVPSet.push_back(AbsoluteTransformation);
|
||||
GroupedSM<SM_SPHEREMAP>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
for (GLMesh *mesh : ShadedMesh[SM_SPLATTING])
|
||||
{
|
||||
GroupedSM<SM_SPLATTING>::MeshSet.push_back(mesh);
|
||||
GroupedSM<SM_SPLATTING>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_SPLATTING>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
GroupedSM<SM_SPLATTING>::MVPSet.push_back(AbsoluteTransformation);
|
||||
GroupedSM<SM_SPLATTING>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
for (GLMesh *mesh : ShadedMesh[SM_UNLIT])
|
||||
{
|
||||
GroupedSM<SM_UNLIT>::MeshSet.push_back(mesh);
|
||||
GroupedSM<SM_UNLIT>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_UNLIT>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
GroupedSM<SM_UNLIT>::MVPSet.push_back(AbsoluteTransformation);
|
||||
GroupedSM<SM_UNLIT>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
for (GLMesh *mesh : ShadedMesh[SM_DETAILS])
|
||||
{
|
||||
GroupedSM<SM_DETAILS>::MeshSet.push_back(mesh);
|
||||
GroupedSM<SM_DETAILS>::MVPSet.push_back(ModelViewProjectionMatrix);
|
||||
GroupedSM<SM_DETAILS>::TIMVSet.push_back(TransposeInverseModelView);
|
||||
GroupedSM<SM_DETAILS>::MVPSet.push_back(AbsoluteTransformation);
|
||||
GroupedSM<SM_DETAILS>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
for (GLMesh *mesh : ShadedMesh[SM_UNTEXTURED])
|
||||
{
|
||||
GroupedSM<SM_UNTEXTURED>::MeshSet.push_back(mesh);
|
||||
GroupedSM<SM_UNTEXTURED>::MVPSet.push_back(AbsoluteTransformation);
|
||||
GroupedSM<SM_UNTEXTURED>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
if (!ShadedMesh[SM_GRASS].empty())
|
||||
@ -433,11 +445,6 @@ void STKMeshSceneNode::render()
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_CAUSTICS].size(); i++)
|
||||
drawSolidPass2(*ShadedMesh[SM_CAUSTICS][i], SM_CAUSTICS);
|
||||
|
||||
if (!ShadedMesh[SM_UNTEXTURED].empty())
|
||||
glUseProgram(MeshShader::UntexturedObjectShader::Program);
|
||||
for (unsigned i = 0; i < ShadedMesh[SM_UNTEXTURED].size(); i++)
|
||||
drawSolidPass2(*ShadedMesh[SM_UNTEXTURED][i], SM_UNTEXTURED);
|
||||
|
||||
if (reload_each_frame)
|
||||
glEnable(GL_CULL_FACE);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user