Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
c272d39d09
@ -2,16 +2,15 @@ uniform mat4 ModelViewMatrix;
|
||||
uniform vec3 Position;
|
||||
uniform vec2 Size;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
#if __VERSION__ >= 330
|
||||
layout(location = 0) in vec2 Corner;
|
||||
layout(location = 3) in vec2 Texcoord;
|
||||
#else
|
||||
in vec2 Corner;
|
||||
in vec2 Texcoord;
|
||||
out vec2 uv;
|
||||
#else
|
||||
attribute vec2 Corner;
|
||||
attribute vec2 Texcoord;
|
||||
varying vec2 uv;
|
||||
#endif
|
||||
|
||||
out vec2 uv;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -1,17 +1,13 @@
|
||||
uniform sampler2D tex;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
in vec4 color;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec4 color = texture(tex, uv);
|
||||
if (color.a < 0.5) discard;
|
||||
FragColor = vec4(color.xyz, 1.);
|
||||
vec4 col = texture(tex, uv);
|
||||
col.xyz *= pow(color.xyz, vec3(2.2));
|
||||
if (col.a < 0.5) discard;
|
||||
FragColor = vec4(col.xyz, 1.);
|
||||
}
|
||||
|
@ -1,19 +1,16 @@
|
||||
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);
|
||||
if (color.a < 0.5) discard;
|
||||
vec4 col = texture(Albedo, uv);
|
||||
col.xyz *= pow(color.xyz, vec3(2.2));
|
||||
if (col.a * color.a < 0.5) discard;
|
||||
vec3 LightFactor = getLightFactor(1.);
|
||||
FragColor = vec4(color.xyz * LightFactor, 1.);
|
||||
FragColor = vec4(col.xyz * LightFactor, 1.);
|
||||
}
|
||||
|
@ -383,6 +383,8 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
|
||||
if (!UserConfigParams::m_dynamic_lights && !forceRTT)
|
||||
{
|
||||
glDisable(GL_FRAMEBUFFER_SRGB);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -212,9 +212,9 @@ void IrrDriver::renderSolidFirstPass()
|
||||
std::vector<TexUnit> object_pass1_texunits = TexUnits(TexUnit(MeshShader::ObjectPass1Shader::getInstance()->TU_tex, true) );
|
||||
renderMeshes1stPass<MeshShader::ObjectPass1Shader, video::EVT_STANDARD, 2, 1>(object_pass1_texunits, ListMatDefault::Arguments);
|
||||
renderMeshes1stPass<MeshShader::ObjectPass1Shader, video::EVT_STANDARD, 2, 1>(object_pass1_texunits, ListMatSphereMap::Arguments);
|
||||
renderMeshes1stPass<MeshShader::ObjectPass1Shader, video::EVT_STANDARD, 2, 1>(object_pass1_texunits, ListMatUnlit::Arguments);
|
||||
renderMeshes1stPass<MeshShader::ObjectPass1Shader, video::EVT_2TCOORDS, 2, 1>(object_pass1_texunits, ListMatDetails::Arguments);
|
||||
renderMeshes1stPass<MeshShader::ObjectPass1Shader, video::EVT_2TCOORDS, 2, 1>(object_pass1_texunits, ListMatSplatting::Arguments);
|
||||
renderMeshes1stPass<MeshShader::ObjectRefPass1Shader, video::EVT_STANDARD, 3, 2, 1>(object_pass1_texunits, ListMatUnlit::Arguments);
|
||||
renderMeshes1stPass<MeshShader::ObjectRefPass1Shader, video::EVT_STANDARD, 3, 2, 1>(TexUnits(TexUnit(MeshShader::ObjectRefPass1Shader::getInstance()->TU_tex, true)), ListMatAlphaRef::Arguments);
|
||||
renderMeshes1stPass<MeshShader::GrassPass1Shader, video::EVT_STANDARD, 3, 2, 1>(TexUnits(TexUnit(MeshShader::GrassPass1Shader::getInstance()->TU_tex, true)), ListMatGrass::Arguments);
|
||||
renderMeshes1stPass<MeshShader::NormalMapShader, video::EVT_TANGENTS, 2, 1>(TexUnits(
|
||||
@ -416,8 +416,8 @@ void IrrDriver::renderTransparent()
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
glUseProgram(MeshShader::DisplaceMaskShaderInstance->Program);
|
||||
MeshShader::DisplaceMaskShaderInstance->setUniforms(AbsoluteTransformation);
|
||||
glUseProgram(MeshShader::DisplaceMaskShader::getInstance()->Program);
|
||||
MeshShader::DisplaceMaskShader::getInstance()->setUniforms(AbsoluteTransformation);
|
||||
glDrawElementsBaseVertex(ptype, count, itype, (GLvoid *)mesh.vaoOffset, mesh.vaoBaseVertex);
|
||||
}
|
||||
|
||||
@ -435,12 +435,12 @@ void IrrDriver::renderTransparent()
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
// Render the effect
|
||||
setTexture(MeshShader::DisplaceShaderInstance->TU_displacement_tex, getTextureGLuint(displaceTex), GL_LINEAR, GL_LINEAR, true);
|
||||
setTexture(MeshShader::DisplaceShaderInstance->TU_mask_tex, irr_driver->getRenderTargetTexture(RTT_TMP1), GL_LINEAR, GL_LINEAR, true);
|
||||
setTexture(MeshShader::DisplaceShaderInstance->TU_color_tex, irr_driver->getRenderTargetTexture(RTT_COLOR), GL_LINEAR, GL_LINEAR, true);
|
||||
setTexture(MeshShader::DisplaceShaderInstance->TU_tex, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR, true);
|
||||
glUseProgram(MeshShader::DisplaceShaderInstance->Program);
|
||||
MeshShader::DisplaceShaderInstance->setUniforms(AbsoluteTransformation,
|
||||
setTexture(MeshShader::DisplaceShader::getInstance()->TU_displacement_tex, getTextureGLuint(displaceTex), GL_LINEAR, GL_LINEAR, true);
|
||||
setTexture(MeshShader::DisplaceShader::getInstance()->TU_mask_tex, irr_driver->getRenderTargetTexture(RTT_TMP1), GL_LINEAR, GL_LINEAR, true);
|
||||
setTexture(MeshShader::DisplaceShader::getInstance()->TU_color_tex, irr_driver->getRenderTargetTexture(RTT_COLOR), GL_LINEAR, GL_LINEAR, true);
|
||||
setTexture(MeshShader::DisplaceShader::getInstance()->TU_tex, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR, true);
|
||||
glUseProgram(MeshShader::DisplaceShader::getInstance()->Program);
|
||||
MeshShader::DisplaceShader::getInstance()->setUniforms(AbsoluteTransformation,
|
||||
core::vector2df(cb->getDirX(), cb->getDirY()),
|
||||
core::vector2df(cb->getDir2X(), cb->getDir2Y()));
|
||||
|
||||
@ -490,9 +490,9 @@ struct shadow_custom_unroll_args<N, List...>
|
||||
};
|
||||
|
||||
template<typename T, enum E_VERTEX_TYPE VertexType, int...List, typename... Args>
|
||||
void renderShadow(const T *Shader, const std::vector<GLuint> TextureUnits, const std::vector<STK::Tuple<GLMesh *, core::matrix4, Args...> >&t)
|
||||
void renderShadow(const std::vector<GLuint> TextureUnits, const std::vector<STK::Tuple<GLMesh *, core::matrix4, Args...> >&t)
|
||||
{
|
||||
glUseProgram(Shader->Program);
|
||||
glUseProgram(T::getInstance()->Program);
|
||||
glBindVertexArray(getVAO(VertexType));
|
||||
for (unsigned i = 0; i < t.size(); i++)
|
||||
{
|
||||
@ -503,7 +503,7 @@ void renderShadow(const T *Shader, const std::vector<GLuint> TextureUnits, const
|
||||
setTexture(TextureUnits[j], getTextureGLuint(mesh->textures[j]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
}
|
||||
|
||||
shadow_custom_unroll_args<List...>::template exec<T>(Shader, t[i]);
|
||||
shadow_custom_unroll_args<List...>::template exec<T>(T::getInstance(), t[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -551,14 +551,14 @@ void IrrDriver::renderShadows()
|
||||
m_scene_manager->drawAll(scene::ESNRP_SOLID);
|
||||
|
||||
std::vector<GLuint> noTexUnits;
|
||||
renderShadow<MeshShader::ShadowShader, EVT_STANDARD, 1>(MeshShader::ShadowShaderInstance, noTexUnits, ListMatDefault::Arguments);
|
||||
renderShadow<MeshShader::ShadowShader, EVT_STANDARD, 1>(MeshShader::ShadowShaderInstance, noTexUnits, ListMatSphereMap::Arguments);
|
||||
renderShadow<MeshShader::ShadowShader, EVT_STANDARD, 1>(MeshShader::ShadowShaderInstance, noTexUnits, ListMatUnlit::Arguments);
|
||||
renderShadow<MeshShader::ShadowShader, EVT_2TCOORDS, 1>(MeshShader::ShadowShaderInstance, noTexUnits, ListMatDetails::Arguments);
|
||||
renderShadow<MeshShader::ShadowShader, EVT_2TCOORDS, 1>(MeshShader::ShadowShaderInstance, noTexUnits, ListMatSplatting::Arguments);
|
||||
renderShadow<MeshShader::ShadowShader, EVT_TANGENTS, 1>(MeshShader::ShadowShaderInstance, noTexUnits, ListMatNormalMap::Arguments);
|
||||
renderShadow<MeshShader::RefShadowShader, EVT_STANDARD, 1>(MeshShader::RefShadowShaderInstance, std::vector<GLuint>{ MeshShader::RefShadowShaderInstance->TU_tex }, ListMatAlphaRef::Arguments);
|
||||
renderShadow<MeshShader::GrassShadowShader, EVT_STANDARD, 3, 1>(MeshShader::GrassShadowShaderInstance, std::vector<GLuint>{ MeshShader::GrassShadowShaderInstance->TU_tex }, ListMatGrass::Arguments);
|
||||
renderShadow<MeshShader::ShadowShader, EVT_STANDARD, 1>(noTexUnits, ListMatDefault::Arguments);
|
||||
renderShadow<MeshShader::ShadowShader, EVT_STANDARD, 1>(noTexUnits, ListMatSphereMap::Arguments);
|
||||
renderShadow<MeshShader::ShadowShader, EVT_2TCOORDS, 1>(noTexUnits, ListMatDetails::Arguments);
|
||||
renderShadow<MeshShader::ShadowShader, EVT_2TCOORDS, 1>(noTexUnits, ListMatSplatting::Arguments);
|
||||
renderShadow<MeshShader::ShadowShader, EVT_TANGENTS, 1>(noTexUnits, ListMatNormalMap::Arguments);
|
||||
renderShadow<MeshShader::RefShadowShader, EVT_STANDARD, 1>(std::vector<GLuint>{ MeshShader::RefShadowShader::getInstance()->TU_tex }, ListMatAlphaRef::Arguments);
|
||||
renderShadow<MeshShader::RefShadowShader, EVT_STANDARD, 1>(std::vector<GLuint>{ MeshShader::RefShadowShader::getInstance()->TU_tex }, ListMatUnlit::Arguments);
|
||||
renderShadow<MeshShader::GrassShadowShader, EVT_STANDARD, 3, 1>(std::vector<GLuint>{ MeshShader::GrassShadowShader::getInstance()->TU_tex }, ListMatGrass::Arguments);
|
||||
|
||||
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||
|
||||
|
@ -504,6 +504,14 @@ void IrrDriver::generateDiffuseCoefficients()
|
||||
|
||||
testSH(sh_rgba, sh_w, sh_h, blueSHCoeff, greenSHCoeff, redSHCoeff);
|
||||
|
||||
// Diffuse env map is x 0.25, compensate
|
||||
for (unsigned i = 0; i < 9; i++)
|
||||
{
|
||||
blueSHCoeff[i] *= 4;
|
||||
greenSHCoeff[i] *= 4;
|
||||
redSHCoeff[i] *= 4;
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < 6; i++)
|
||||
delete[] sh_rgba[i];
|
||||
}
|
||||
|
@ -404,19 +404,9 @@ void Shaders::loadShaders()
|
||||
FullScreenShader::MLAAColorEdgeDetectionSHader::init();
|
||||
FullScreenShader::MLAABlendWeightSHader::init();
|
||||
FullScreenShader::MLAAGatherSHader::init();
|
||||
MeshShader::ColorizeShader::init();
|
||||
MeshShader::BubbleShader::init();
|
||||
MeshShader::BillboardShader::init();
|
||||
LightShader::PointLightShader::init();
|
||||
MeshShader::DisplaceShaderInstance = new MeshShader::DisplaceShader();
|
||||
MeshShader::DisplaceMaskShaderInstance = new MeshShader::DisplaceMaskShader();
|
||||
MeshShader::ShadowShaderInstance = new MeshShader::ShadowShader();
|
||||
MeshShader::RSMShader::init();
|
||||
MeshShader::InstancedShadowShaderInstance = new MeshShader::InstancedShadowShader();
|
||||
MeshShader::RefShadowShaderInstance = new MeshShader::RefShadowShader();
|
||||
MeshShader::InstancedRefShadowShaderInstance = new MeshShader::InstancedRefShadowShader();
|
||||
MeshShader::GrassShadowShaderInstance = new MeshShader::GrassShadowShader();
|
||||
MeshShader::InstancedGrassShadowShaderInstance = new MeshShader::InstancedGrassShadowShader();
|
||||
MeshShader::SkyboxShader::init();
|
||||
MeshShader::ViewFrustrumShader::init();
|
||||
ParticleShader::FlipParticleRender::init();
|
||||
@ -713,7 +703,7 @@ namespace MeshShader
|
||||
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/object_pass2.frag").c_str());
|
||||
AssignUniforms("ModelMatrix", "TextureMatrix", "ambient");
|
||||
AssignUniforms("ModelMatrix", "TextureMatrix");
|
||||
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
@ -735,7 +725,7 @@ namespace MeshShader
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/instanced_object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/object_pass2.frag").c_str());
|
||||
AssignUniforms("ambient");
|
||||
AssignUniforms();
|
||||
TU_Albedo = 3;
|
||||
|
||||
AssignTextureUnit(Program,
|
||||
@ -757,7 +747,7 @@ namespace MeshShader
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/instanced_object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/objectref_pass2.frag").c_str());
|
||||
AssignUniforms("ambient");
|
||||
AssignUniforms();
|
||||
TU_Albedo = 3;
|
||||
|
||||
AssignTextureUnit(Program,
|
||||
@ -777,7 +767,7 @@ namespace MeshShader
|
||||
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/detailledobject_pass2.frag").c_str());
|
||||
AssignUniforms("ModelMatrix", "ambient");
|
||||
AssignUniforms("ModelMatrix");
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
TU_Albedo = 3;
|
||||
@ -813,7 +803,7 @@ namespace MeshShader
|
||||
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/objectref_pass2.frag").c_str());
|
||||
AssignUniforms("ModelMatrix", "TextureMatrix", "ambient");
|
||||
AssignUniforms("ModelMatrix", "TextureMatrix");
|
||||
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
@ -834,7 +824,7 @@ namespace MeshShader
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/grass_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/grass_pass2.frag").c_str());
|
||||
AssignUniforms("ModelMatrix", "windDir", "ambient");
|
||||
AssignUniforms("ModelMatrix", "windDir");
|
||||
TU_Albedo = 3;
|
||||
|
||||
AssignTextureUnit(Program,
|
||||
@ -852,7 +842,7 @@ namespace MeshShader
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/instanced_grass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/grass_pass2.frag").c_str());
|
||||
AssignUniforms("windDir", "SunDir", "ambient");
|
||||
AssignUniforms("windDir", "SunDir");
|
||||
TU_Albedo = 3;
|
||||
TU_dtex = 4;
|
||||
|
||||
@ -875,7 +865,7 @@ namespace MeshShader
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getPosFromUVDepth.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/objectpass_spheremap.frag").c_str());
|
||||
AssignUniforms("ModelMatrix", "InverseModelMatrix", "ambient");
|
||||
AssignUniforms("ModelMatrix", "InverseModelMatrix");
|
||||
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
@ -895,7 +885,7 @@ namespace MeshShader
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/splatting.frag").c_str());
|
||||
AssignUniforms("ModelMatrix", "ambient");
|
||||
AssignUniforms("ModelMatrix");
|
||||
TU_tex_layout = 3;
|
||||
TU_tex_detail0 = 4;
|
||||
TU_tex_detail1 = 5;
|
||||
@ -968,66 +958,32 @@ namespace MeshShader
|
||||
AssignTextureUnit(Program, TexUnit(TU_tex, "tex"));
|
||||
}
|
||||
|
||||
GLuint BillboardShader::Program;
|
||||
GLuint BillboardShader::attrib_corner;
|
||||
GLuint BillboardShader::attrib_texcoord;
|
||||
GLuint BillboardShader::uniform_MV;
|
||||
GLuint BillboardShader::uniform_P;
|
||||
GLuint BillboardShader::uniform_tex;
|
||||
GLuint BillboardShader::uniform_Position;
|
||||
GLuint BillboardShader::uniform_Size;
|
||||
|
||||
void BillboardShader::init()
|
||||
BillboardShader::BillboardShader()
|
||||
{
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/billboard.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/billboard.frag").c_str());
|
||||
attrib_corner = glGetAttribLocation(Program, "Corner");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
uniform_MV = glGetUniformLocation(Program, "ModelViewMatrix");
|
||||
uniform_P = glGetUniformLocation(Program, "ProjectionMatrix");
|
||||
uniform_Position = glGetUniformLocation(Program, "Position");
|
||||
uniform_Size = glGetUniformLocation(Program, "Size");
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
AssignUniforms("ModelViewMatrix", "ProjectionMatrix", "Position", "Size");
|
||||
|
||||
TU_tex = 0;
|
||||
|
||||
AssignTextureUnit(Program, TexUnit(TU_tex, "tex"));
|
||||
}
|
||||
|
||||
void BillboardShader::setUniforms(const core::matrix4 &ModelViewMatrix,
|
||||
const core::matrix4 &ProjectionMatrix,
|
||||
const core::vector3df &Position,
|
||||
const core::dimension2d<float> &size,
|
||||
unsigned TU_tex)
|
||||
{
|
||||
glUniformMatrix4fv(uniform_MV, 1, GL_FALSE, ModelViewMatrix.pointer());
|
||||
glUniformMatrix4fv(uniform_P, 1, GL_FALSE, ProjectionMatrix.pointer());
|
||||
glUniform3f(uniform_Position, Position.X, Position.Y, Position.Z);
|
||||
glUniform2f(uniform_Size, size.Width, size.Height);
|
||||
glUniform1i(uniform_tex, TU_tex);
|
||||
}
|
||||
|
||||
GLuint ColorizeShader::Program;
|
||||
GLuint ColorizeShader::uniform_MM;
|
||||
GLuint ColorizeShader::uniform_col;
|
||||
|
||||
void ColorizeShader::init()
|
||||
ColorizeShader::ColorizeShader()
|
||||
{
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/colorize.frag").c_str());
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
uniform_col = glGetUniformLocation(Program, "col");
|
||||
AssignUniforms("ModelMatrix", "col");
|
||||
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
}
|
||||
|
||||
void ColorizeShader::setUniforms(const core::matrix4 &ModelMatrix, float r, float g, float b)
|
||||
{
|
||||
if (irr_driver->needUBOWorkaround())
|
||||
bypassUBO(Program);
|
||||
glUniformMatrix4fv(uniform_MM, 1, GL_FALSE, ModelMatrix.pointer());
|
||||
glUniform3f(uniform_col, r, g, b);
|
||||
}
|
||||
|
||||
ShadowShader::ShadowShader()
|
||||
{
|
||||
// Geometry shader needed
|
||||
@ -1051,8 +1007,6 @@ namespace MeshShader
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
}
|
||||
|
||||
ShadowShader *ShadowShaderInstance;
|
||||
|
||||
GLuint RSMShader::Program;
|
||||
GLuint RSMShader::uniform_MM;
|
||||
GLuint RSMShader::uniform_RSMMatrix;
|
||||
@ -1100,8 +1054,6 @@ namespace MeshShader
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
}
|
||||
|
||||
InstancedShadowShader *InstancedShadowShaderInstance;
|
||||
|
||||
RefShadowShader::RefShadowShader()
|
||||
{
|
||||
// Geometry shader needed
|
||||
@ -1128,8 +1080,6 @@ namespace MeshShader
|
||||
AssignTextureUnit(Program, { TexUnit(TU_tex, "tex") });
|
||||
}
|
||||
|
||||
RefShadowShader *RefShadowShaderInstance;
|
||||
|
||||
InstancedRefShadowShader::InstancedRefShadowShader()
|
||||
{
|
||||
// Geometry shader needed
|
||||
@ -1156,8 +1106,6 @@ namespace MeshShader
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
}
|
||||
|
||||
InstancedRefShadowShader *InstancedRefShadowShaderInstance;
|
||||
|
||||
GrassShadowShader::GrassShadowShader()
|
||||
{
|
||||
// Geometry shader needed
|
||||
@ -1184,8 +1132,6 @@ namespace MeshShader
|
||||
AssignTextureUnit(Program, { TexUnit(TU_tex, "tex") });
|
||||
}
|
||||
|
||||
GrassShadowShader *GrassShadowShaderInstance;
|
||||
|
||||
InstancedGrassShadowShader::InstancedGrassShadowShader()
|
||||
{
|
||||
// Geometry shader needed
|
||||
@ -1214,8 +1160,6 @@ namespace MeshShader
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
}
|
||||
|
||||
InstancedGrassShadowShader *InstancedGrassShadowShaderInstance;
|
||||
|
||||
DisplaceMaskShader::DisplaceMaskShader()
|
||||
{
|
||||
Program = LoadProgram(
|
||||
@ -1227,8 +1171,6 @@ namespace MeshShader
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
}
|
||||
|
||||
DisplaceMaskShader *DisplaceMaskShaderInstance;
|
||||
|
||||
|
||||
DisplaceShader::DisplaceShader()
|
||||
{
|
||||
@ -1250,8 +1192,6 @@ namespace MeshShader
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
}
|
||||
|
||||
DisplaceShader *DisplaceShaderInstance;
|
||||
|
||||
GLuint SkyboxShader::Program;
|
||||
GLuint SkyboxShader::attrib_position;
|
||||
GLuint SkyboxShader::uniform_MM;
|
||||
|
@ -94,6 +94,13 @@ struct UniformHelper
|
||||
setUniformsHelper<N + 1>(uniforms, arg...);
|
||||
}
|
||||
|
||||
template<unsigned N = 0, typename... Args>
|
||||
static void setUniformsHelper(const std::vector<GLuint> &uniforms, const core::dimension2df &v, Args... arg)
|
||||
{
|
||||
glUniform2fWraper(uniforms[N], v.Width, v.Height);
|
||||
setUniformsHelper<N + 1>(uniforms, arg...);
|
||||
}
|
||||
|
||||
template<unsigned N = 0, typename... Args>
|
||||
static void setUniformsHelper(const std::vector<GLuint> &uniforms, float f, Args... arg)
|
||||
{
|
||||
@ -106,51 +113,28 @@ struct UniformHelper
|
||||
void bypassUBO(GLuint Program);
|
||||
GLuint getUniformLocation(GLuint program, const char* name);
|
||||
|
||||
template<typename... Args>
|
||||
class ShaderHelper
|
||||
{
|
||||
protected:
|
||||
std::vector<GLuint> uniforms;
|
||||
|
||||
void AssignUniforms(const char* name)
|
||||
{
|
||||
uniforms.push_back(getUniformLocation(Program, name));
|
||||
}
|
||||
|
||||
template<typename... T>
|
||||
void AssignUniforms(const char* name, T... rest)
|
||||
{
|
||||
uniforms.push_back(getUniformLocation(Program, name));
|
||||
AssignUniforms(rest...);
|
||||
}
|
||||
|
||||
public:
|
||||
GLuint Program;
|
||||
|
||||
void setUniforms(const Args & ... args) const
|
||||
{
|
||||
if (needsUBO())
|
||||
bypassUBO(Program);
|
||||
UniformHelper::setUniformsHelper(uniforms, args...);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, typename... Args>
|
||||
class ShaderHelperSingleton : public Singleton<T>
|
||||
{
|
||||
protected:
|
||||
std::vector<GLuint> uniforms;
|
||||
|
||||
void AssignUniforms(const char* name)
|
||||
void AssignUniforms_impl()
|
||||
{
|
||||
uniforms.push_back(getUniformLocation(Program, name));
|
||||
}
|
||||
|
||||
template<typename... U>
|
||||
void AssignUniforms(const char* name, U... rest)
|
||||
void AssignUniforms_impl(const char* name, U... rest)
|
||||
{
|
||||
uniforms.push_back(getUniformLocation(Program, name));
|
||||
AssignUniforms(rest...);
|
||||
AssignUniforms_impl(rest...);
|
||||
}
|
||||
|
||||
template<typename... U>
|
||||
void AssignUniforms(U... rest)
|
||||
{
|
||||
static_assert(sizeof...(rest) == sizeof...(Args), "Count of Uniform's name mismatch");
|
||||
AssignUniforms_impl(rest...);
|
||||
}
|
||||
|
||||
public:
|
||||
@ -326,36 +310,27 @@ public:
|
||||
TransparentFogShader();
|
||||
};
|
||||
|
||||
class BillboardShader
|
||||
class BillboardShader : public ShaderHelperSingleton<BillboardShader, core::matrix4, core::matrix4, core::vector3df, core::dimension2df>
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_corner, attrib_texcoord;
|
||||
static GLuint uniform_MV, uniform_P, uniform_tex, uniform_Position, uniform_Size;
|
||||
GLuint TU_tex;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(const core::matrix4 &ModelViewMatrix, const core::matrix4 &ProjectionMatrix, const core::vector3df &Position, const core::dimension2d<float> &size, unsigned TU_tex);
|
||||
BillboardShader();
|
||||
};
|
||||
|
||||
|
||||
class ColorizeShader
|
||||
class ColorizeShader : public ShaderHelperSingleton<ColorizeShader, core::matrix4, video::SColorf>
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint uniform_MM, uniform_col;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(const core::matrix4 &ModelMatrix, float r, float g, float b);
|
||||
ColorizeShader();
|
||||
};
|
||||
|
||||
class ShadowShader : public ShaderHelper<core::matrix4>
|
||||
class ShadowShader : public ShaderHelperSingleton<ShadowShader, core::matrix4>
|
||||
{
|
||||
public:
|
||||
ShadowShader();
|
||||
};
|
||||
|
||||
extern ShadowShader *ShadowShaderInstance;
|
||||
|
||||
class RSMShader
|
||||
{
|
||||
public:
|
||||
@ -367,61 +342,47 @@ public:
|
||||
static void setUniforms(const core::matrix4 &RSMMatrix, const core::matrix4 &ModelMatrix);
|
||||
};
|
||||
|
||||
class InstancedShadowShader : public ShaderHelper<>
|
||||
class InstancedShadowShader : public ShaderHelperSingleton<InstancedShadowShader>
|
||||
{
|
||||
public:
|
||||
InstancedShadowShader();
|
||||
};
|
||||
|
||||
extern InstancedShadowShader *InstancedShadowShaderInstance;
|
||||
|
||||
class RefShadowShader : public ShaderHelper<core::matrix4>
|
||||
class RefShadowShader : public ShaderHelperSingleton<RefShadowShader, core::matrix4>
|
||||
{
|
||||
public:
|
||||
GLuint TU_tex;
|
||||
|
||||
RefShadowShader();
|
||||
};
|
||||
|
||||
extern RefShadowShader *RefShadowShaderInstance;
|
||||
|
||||
class InstancedRefShadowShader : public ShaderHelper<>
|
||||
class InstancedRefShadowShader : public ShaderHelperSingleton<InstancedRefShadowShader>
|
||||
{
|
||||
public:
|
||||
GLuint TU_tex;
|
||||
|
||||
InstancedRefShadowShader();
|
||||
};
|
||||
|
||||
extern InstancedRefShadowShader *InstancedRefShadowShaderInstance;
|
||||
|
||||
class GrassShadowShader : public ShaderHelper<core::matrix4, core::vector3df>
|
||||
class GrassShadowShader : public ShaderHelperSingleton<GrassShadowShader, core::matrix4, core::vector3df>
|
||||
{
|
||||
public:
|
||||
GLuint TU_tex;
|
||||
GrassShadowShader();
|
||||
};
|
||||
|
||||
extern GrassShadowShader *GrassShadowShaderInstance;
|
||||
|
||||
class InstancedGrassShadowShader : public ShaderHelper<core::vector3df>
|
||||
class InstancedGrassShadowShader : public ShaderHelperSingleton<InstancedGrassShadowShader, core::vector3df>
|
||||
{
|
||||
public:
|
||||
GLuint TU_tex;
|
||||
InstancedGrassShadowShader();
|
||||
};
|
||||
|
||||
extern InstancedGrassShadowShader *InstancedGrassShadowShaderInstance;
|
||||
|
||||
class DisplaceMaskShader : public ShaderHelper<core::matrix4>
|
||||
class DisplaceMaskShader : public ShaderHelperSingleton<DisplaceMaskShader, core::matrix4>
|
||||
{
|
||||
public:
|
||||
DisplaceMaskShader();
|
||||
};
|
||||
|
||||
extern DisplaceMaskShader *DisplaceMaskShaderInstance;
|
||||
|
||||
class DisplaceShader : public ShaderHelper<core::matrix4, core::vector2df, core::vector2df>
|
||||
class DisplaceShader : public ShaderHelperSingleton<DisplaceShader, core::matrix4, core::vector2df, core::vector2df>
|
||||
{
|
||||
public:
|
||||
GLuint TU_displacement_tex, TU_mask_tex, TU_color_tex, TU_tex;
|
||||
@ -429,8 +390,6 @@ public:
|
||||
DisplaceShader();
|
||||
};
|
||||
|
||||
extern DisplaceShader *DisplaceShaderInstance;
|
||||
|
||||
class SkyboxShader
|
||||
{
|
||||
public:
|
||||
|
@ -29,7 +29,6 @@ STKTextBillboard::STKTextBillboard(core::stringw text, gui::ScalableFont* font,
|
||||
createGLMeshes();
|
||||
Mesh->drop();
|
||||
//setAutomaticCulling(0);
|
||||
setReloadEachFrame(true); // FIXME: should not need that!!
|
||||
updateAbsolutePosition();
|
||||
}
|
||||
|
||||
@ -93,7 +92,7 @@ scene::IMesh* STKTextBillboard::getTextMesh(core::stringw text, gui::ScalableFon
|
||||
{
|
||||
buffer = new scene::SMeshBuffer();
|
||||
buffer->getMaterial().setTexture(0, m_chars[i].m_texture);
|
||||
buffer->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
|
||||
buffer->getMaterial().MaterialType = irr_driver->getShader(ES_OBJECT_UNLIT);
|
||||
buffers[m_chars[i].m_texture] = buffer;
|
||||
}
|
||||
else
|
||||
@ -148,7 +147,7 @@ scene::IMesh* STKTextBillboard::getTextMesh(core::stringw text, gui::ScalableFon
|
||||
map_itr->second->drop();
|
||||
}
|
||||
|
||||
getMaterial(0).MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
|
||||
getMaterial(0).MaterialType = irr_driver->getShader(ES_OBJECT_UNLIT);
|
||||
|
||||
return Mesh;
|
||||
}
|
||||
@ -157,13 +156,14 @@ void STKTextBillboard::OnRegisterSceneNode()
|
||||
{
|
||||
if (IsVisible)
|
||||
{
|
||||
SceneManager->registerNodeForRendering(this, scene::ESNRP_TRANSPARENT);
|
||||
SceneManager->registerNodeForRendering(this, scene::ESNRP_SOLID);
|
||||
|
||||
scene::ICameraSceneNode* curr_cam = irr_driver->getSceneManager()->getActiveCamera();
|
||||
core::vector3df cam_pos = curr_cam->getPosition();
|
||||
core::vector3df text_pos = this->getAbsolutePosition();
|
||||
float angle = atan2(text_pos.X - cam_pos.X, text_pos.Z - cam_pos.Z);
|
||||
this->setRotation(core::vector3df(0.0f, angle * 180.0f / M_PI, 0.0f));
|
||||
updateAbsolutePosition();
|
||||
}
|
||||
|
||||
ISceneNode::OnRegisterSceneNode();
|
||||
|
@ -151,7 +151,7 @@ void STKAnimatedMesh::render()
|
||||
pushVector(ListMatDetails::Arguments, mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix);
|
||||
|
||||
for_in(mesh, MeshSolidMaterial[MAT_UNLIT])
|
||||
pushVector(ListMatUnlit::Arguments, mesh, AbsoluteTransformation, core::matrix4::EM4CONST_IDENTITY);
|
||||
pushVector(ListMatUnlit::Arguments, mesh, AbsoluteTransformation, core::matrix4::EM4CONST_IDENTITY, mesh->TextureMatrix);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -13,10 +13,10 @@ static void createbillboardvao()
|
||||
glGenVertexArrays(1, &billboardvao);
|
||||
glBindVertexArray(billboardvao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, SharedObject::billboardvbo);
|
||||
glEnableVertexAttribArray(MeshShader::BillboardShader::attrib_corner);
|
||||
glEnableVertexAttribArray(MeshShader::BillboardShader::attrib_texcoord);
|
||||
glVertexAttribPointer(MeshShader::BillboardShader::attrib_corner, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), 0);
|
||||
glVertexAttribPointer(MeshShader::BillboardShader::attrib_texcoord, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (GLvoid*) (2 * sizeof(float)));
|
||||
glEnableVertexAttribArray(0);
|
||||
glEnableVertexAttribArray(3);
|
||||
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), 0);
|
||||
glVertexAttribPointer(3, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (GLvoid*) (2 * sizeof(float)));
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
@ -50,8 +50,8 @@ void STKBillboard::render()
|
||||
compressTexture(tex, true, true);
|
||||
GLuint texid = getTextureGLuint(tex);
|
||||
setTexture(0, texid, GL_LINEAR, GL_LINEAR);
|
||||
glUseProgram(MeshShader::BillboardShader::Program);
|
||||
MeshShader::BillboardShader::setUniforms(irr_driver->getViewMatrix(), irr_driver->getProjMatrix(), pos, Size, 0);
|
||||
glUseProgram(MeshShader::BillboardShader::getInstance()->Program);
|
||||
MeshShader::BillboardShader::getInstance()->setUniforms(irr_driver->getViewMatrix(), irr_driver->getProjMatrix(), pos, Size);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
glBindVertexArray(0);
|
||||
return;
|
||||
|
@ -156,7 +156,7 @@ static void drawShadowDefault(GLMesh &mesh, size_t instance_count)
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
MeshShader::InstancedShadowShaderInstance->setUniforms();
|
||||
MeshShader::InstancedShadowShader::getInstance()->setUniforms();
|
||||
|
||||
glBindVertexArray(mesh.vao_shadow_pass);
|
||||
glDrawElementsInstanced(ptype, count, itype, 0, 4 * instance_count);
|
||||
@ -185,8 +185,8 @@ static void drawShadowAlphaRefTexture(GLMesh &mesh, size_t instance_count)
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
compressTexture(mesh.textures[0], true);
|
||||
setTexture(MeshShader::InstancedRefShadowShaderInstance->TU_tex, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
MeshShader::InstancedRefShadowShaderInstance->setUniforms();
|
||||
setTexture(MeshShader::InstancedRefShadowShader::getInstance()->TU_tex, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
MeshShader::InstancedRefShadowShader::getInstance()->setUniforms();
|
||||
|
||||
glBindVertexArray(mesh.vao_shadow_pass);
|
||||
glDrawElementsInstanced(ptype, count, itype, 0, 4 * instance_count);
|
||||
@ -200,8 +200,8 @@ static void drawShadowGrass(GLMesh &mesh, const core::vector3df &windDir, size_t
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
compressTexture(mesh.textures[0], true);
|
||||
setTexture(MeshShader::InstancedGrassShadowShaderInstance->TU_tex, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
MeshShader::InstancedGrassShadowShaderInstance->setUniforms(windDir);
|
||||
setTexture(MeshShader::InstancedGrassShadowShader::getInstance()->TU_tex, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
MeshShader::InstancedGrassShadowShader::getInstance()->setUniforms(windDir);
|
||||
|
||||
glBindVertexArray(mesh.vao_shadow_pass);
|
||||
glDrawElementsInstanced(ptype, count, itype, 0, 4 * instance_count);
|
||||
@ -356,17 +356,17 @@ void STKInstancedSceneNode::render()
|
||||
if (irr_driver->getPhase() == SHADOW_PASS)
|
||||
{
|
||||
if (!MeshSolidMaterial[MAT_DEFAULT].empty())
|
||||
glUseProgram(MeshShader::InstancedShadowShaderInstance->Program);
|
||||
glUseProgram(MeshShader::InstancedShadowShader::getInstance()->Program);
|
||||
for (unsigned i = 0; i < MeshSolidMaterial[MAT_DEFAULT].size(); i++)
|
||||
drawShadowDefault(*MeshSolidMaterial[MAT_DEFAULT][i], instance_pos.size() / 9);
|
||||
|
||||
if (!MeshSolidMaterial[MAT_ALPHA_REF].empty())
|
||||
glUseProgram(MeshShader::InstancedRefShadowShaderInstance->Program);
|
||||
glUseProgram(MeshShader::InstancedRefShadowShader::getInstance()->Program);
|
||||
for (unsigned i = 0; i < MeshSolidMaterial[MAT_ALPHA_REF].size(); i++)
|
||||
drawShadowAlphaRefTexture(*MeshSolidMaterial[MAT_ALPHA_REF][i], instance_pos.size() / 9);
|
||||
|
||||
if (!MeshSolidMaterial[MAT_GRASS].empty())
|
||||
glUseProgram(MeshShader::InstancedGrassShadowShaderInstance->Program);
|
||||
glUseProgram(MeshShader::InstancedGrassShadowShader::getInstance()->Program);
|
||||
for (unsigned i = 0; i < MeshSolidMaterial[MAT_GRASS].size(); i++)
|
||||
drawShadowGrass(*MeshSolidMaterial[MAT_GRASS][i], windDir, instance_pos.size() / 9);
|
||||
return;
|
||||
|
@ -298,7 +298,7 @@ std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4> >
|
||||
std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4> > ListMatSphereMap::Arguments;
|
||||
std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4> > ListMatDetails::Arguments;
|
||||
std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, core::vector3df> > ListMatGrass::Arguments;
|
||||
std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4> > ListMatUnlit::Arguments;
|
||||
std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4> > ListMatUnlit::Arguments;
|
||||
std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4> > ListMatSplatting::Arguments;
|
||||
std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4> > ListMatNormalMap::Arguments;
|
||||
|
||||
|
@ -98,7 +98,7 @@ public:
|
||||
class ListMatUnlit
|
||||
{
|
||||
public:
|
||||
static std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4> > Arguments;
|
||||
static std::vector<STK::Tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4> > Arguments;
|
||||
};
|
||||
|
||||
class ListMatDetails
|
||||
|
@ -142,7 +142,7 @@ void STKMeshSceneNode::drawGlow(const GLMesh &mesh)
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
MeshShader::ColorizeShader::setUniforms(AbsoluteTransformation, cb->getRed(), cb->getGreen(), cb->getBlue());
|
||||
MeshShader::ColorizeShader::getInstance()->setUniforms(AbsoluteTransformation, video::SColorf(cb->getRed(), cb->getGreen(), cb->getBlue()));
|
||||
glDrawElementsBaseVertex(ptype, count, itype, (GLvoid *)mesh.vaoOffset, mesh.vaoBaseVertex);
|
||||
}
|
||||
|
||||
@ -265,7 +265,7 @@ void STKMeshSceneNode::render()
|
||||
pushVector(ListMatGrass::Arguments, mesh, AbsoluteTransformation, invmodel, windDir);
|
||||
|
||||
for_in(mesh, MeshSolidMaterials[MAT_UNLIT])
|
||||
pushVector(ListMatUnlit::Arguments, mesh, AbsoluteTransformation, core::matrix4::EM4CONST_IDENTITY);
|
||||
pushVector(ListMatUnlit::Arguments, mesh, AbsoluteTransformation, core::matrix4::EM4CONST_IDENTITY, mesh->TextureMatrix);
|
||||
|
||||
for_in(mesh, MeshSolidMaterials[MAT_SPLATTING])
|
||||
pushVector(ListMatSplatting::Arguments, mesh, AbsoluteTransformation, invmodel);
|
||||
@ -312,7 +312,7 @@ void STKMeshSceneNode::render()
|
||||
|
||||
if (irr_driver->getPhase() == GLOW_PASS)
|
||||
{
|
||||
glUseProgram(MeshShader::ColorizeShader::Program);
|
||||
glUseProgram(MeshShader::ColorizeShader::getInstance()->Program);
|
||||
for (u32 i = 0; i < Mesh->getMeshBufferCount(); ++i)
|
||||
{
|
||||
scene::IMeshBuffer* mb = Mesh->getMeshBuffer(i);
|
||||
|
Loading…
Reference in New Issue
Block a user