Compress/convert to srgb per material basis.
This allows to remove manual conversion in normalmap shader.
This commit is contained in:
parent
1f14e26bde
commit
3cd85a829e
@ -19,7 +19,7 @@ vec2 EncodeNormal(vec3 n);
|
|||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
// normal in Tangent Space
|
// normal in Tangent Space
|
||||||
vec3 TS_normal = 2.0 * pow(texture(normalMap, uv).rgb, vec3(1./2.2)) - 1.0;
|
vec3 TS_normal = 2.0 * texture(normalMap, uv).rgb - 1.0;
|
||||||
// Because of interpolation, we need to renormalize
|
// Because of interpolation, we need to renormalize
|
||||||
vec3 Frag_tangent = normalize(tangent);
|
vec3 Frag_tangent = normalize(tangent);
|
||||||
vec3 Frag_normal = normalize(cross(Frag_tangent, bitangent));
|
vec3 Frag_normal = normalize(cross(Frag_tangent, bitangent));
|
||||||
|
@ -308,7 +308,7 @@ GLuint getDepthTexture(irr::video::ITexture *tex)
|
|||||||
|
|
||||||
std::set<irr::video::ITexture *> AlreadyTransformedTexture;
|
std::set<irr::video::ITexture *> AlreadyTransformedTexture;
|
||||||
|
|
||||||
void transformTexturesTosRGB(irr::video::ITexture *tex)
|
void compressTexture(irr::video::ITexture *tex, bool srgb)
|
||||||
{
|
{
|
||||||
if (AlreadyTransformedTexture.find(tex) != AlreadyTransformedTexture.end())
|
if (AlreadyTransformedTexture.find(tex) != AlreadyTransformedTexture.end())
|
||||||
return;
|
return;
|
||||||
@ -318,20 +318,27 @@ void transformTexturesTosRGB(irr::video::ITexture *tex)
|
|||||||
memcpy(data, tex->lock(), w * h * 4);
|
memcpy(data, tex->lock(), w * h * 4);
|
||||||
tex->unlock();
|
tex->unlock();
|
||||||
glBindTexture(GL_TEXTURE_2D, getTextureGLuint(tex));
|
glBindTexture(GL_TEXTURE_2D, getTextureGLuint(tex));
|
||||||
|
unsigned internalFormat, Format;
|
||||||
|
if (tex->hasAlpha())
|
||||||
|
Format = GL_BGRA;
|
||||||
|
else
|
||||||
|
Format = GL_BGR;
|
||||||
|
|
||||||
if (irr_driver->getGLSLVersion() < 150)
|
if (irr_driver->getGLSLVersion() < 150)
|
||||||
{
|
{
|
||||||
if (tex->hasAlpha())
|
if (srgb)
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB_ALPHA, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, (GLvoid *)data);
|
internalFormat = (tex->hasAlpha()) ? GL_SRGB_ALPHA : GL_SRGB;
|
||||||
else
|
else
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB, w, h, 0, GL_BGR, GL_UNSIGNED_BYTE, (GLvoid *)data);
|
internalFormat = (tex->hasAlpha()) ? GL_RGBA : GL_RGB;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (tex->hasAlpha())
|
if (srgb)
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB_ALPHA, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, (GLvoid *)data);
|
internalFormat = (tex->hasAlpha()) ? GL_COMPRESSED_SRGB_ALPHA : GL_COMPRESSED_SRGB;
|
||||||
else
|
else
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB, w, h, 0, GL_BGR, GL_UNSIGNED_BYTE, (GLvoid *)data);
|
internalFormat = (tex->hasAlpha()) ? GL_COMPRESSED_RGBA : GL_COMPRESSED_RGB;
|
||||||
}
|
}
|
||||||
|
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, w, h, 0, Format, GL_UNSIGNED_BYTE, (GLvoid *)data);
|
||||||
glGenerateMipmap(GL_TEXTURE_2D);
|
glGenerateMipmap(GL_TEXTURE_2D);
|
||||||
delete[] data;
|
delete[] data;
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ GLint LoadProgram(Types ... args)
|
|||||||
|
|
||||||
GLuint getTextureGLuint(irr::video::ITexture *tex);
|
GLuint getTextureGLuint(irr::video::ITexture *tex);
|
||||||
GLuint getDepthTexture(irr::video::ITexture *tex);
|
GLuint getDepthTexture(irr::video::ITexture *tex);
|
||||||
void transformTexturesTosRGB(irr::video::ITexture *tex);
|
void compressTexture(irr::video::ITexture *tex, bool srgb);
|
||||||
void blitFBO(GLuint Src, GLuint Dst, size_t width, size_t height);
|
void blitFBO(GLuint Src, GLuint Dst, size_t width, size_t height);
|
||||||
|
|
||||||
void draw2DImage(const irr::video::ITexture* texture, const irr::core::rect<s32>& destRect,
|
void draw2DImage(const irr::video::ITexture* texture, const irr::core::rect<s32>& destRect,
|
||||||
|
@ -360,7 +360,7 @@ void ParticleSystemProxy::setEmitter(scene::IParticleEmitter* emitter)
|
|||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
video::ITexture *tex = getMaterial(0).getTexture(0);
|
video::ITexture *tex = getMaterial(0).getTexture(0);
|
||||||
transformTexturesTosRGB(tex);
|
compressTexture(tex, true);
|
||||||
texture = getTextureGLuint(getMaterial(0).getTexture(0));
|
texture = getTextureGLuint(getMaterial(0).getTexture(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ void STKBillboard::render()
|
|||||||
core::vector3df pos = getAbsolutePosition();
|
core::vector3df pos = getAbsolutePosition();
|
||||||
glBindVertexArray(billboardvao);
|
glBindVertexArray(billboardvao);
|
||||||
video::ITexture *tex = Material.getTexture(0);
|
video::ITexture *tex = Material.getTexture(0);
|
||||||
transformTexturesTosRGB(tex);
|
compressTexture(tex, true);
|
||||||
GLuint texid = getTextureGLuint(tex);
|
GLuint texid = getTextureGLuint(tex);
|
||||||
setTexture(0, texid, GL_LINEAR, GL_LINEAR);
|
setTexture(0, texid, GL_LINEAR, GL_LINEAR);
|
||||||
glUseProgram(MeshShader::BillboardShader::Program);
|
glUseProgram(MeshShader::BillboardShader::Program);
|
||||||
|
@ -186,6 +186,7 @@ static void drawFSPMDefault(GLMesh &mesh, size_t instance_count)
|
|||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
MeshShader::InstancedObjectPass1Shader::setUniforms(0);
|
MeshShader::InstancedObjectPass1Shader::setUniforms(0);
|
||||||
|
|
||||||
@ -214,6 +215,7 @@ static void drawFSPMAlphaRefTexture(GLMesh &mesh, size_t instance_count)
|
|||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
MeshShader::InstancedObjectRefPass1Shader::setUniforms(0);
|
MeshShader::InstancedObjectRefPass1Shader::setUniforms(0);
|
||||||
|
|
||||||
@ -228,6 +230,7 @@ static void drawShadowAlphaRefTexture(GLMesh &mesh, size_t instance_count)
|
|||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
MeshShader::InstancedRefShadowShader::setUniforms(0);
|
MeshShader::InstancedRefShadowShader::setUniforms(0);
|
||||||
|
|
||||||
@ -243,6 +246,7 @@ static void drawFSPMGrass(GLMesh &mesh, const core::vector3df &windDir, size_t i
|
|||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
MeshShader::InstancedGrassPass1Shader::setUniforms(windDir, 0);
|
MeshShader::InstancedGrassPass1Shader::setUniforms(windDir, 0);
|
||||||
|
|
||||||
@ -272,6 +276,7 @@ static void drawSMAlphaRefTexture(GLMesh &mesh, const core::matrix4 &ModelViewPr
|
|||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(MeshShader::InstancedObjectRefPass2Shader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(MeshShader::InstancedObjectRefPass2Shader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
|
|
||||||
MeshShader::InstancedObjectRefPass2Shader::setUniforms(ModelViewProjectionMatrix, core::matrix4::EM4CONST_IDENTITY);
|
MeshShader::InstancedObjectRefPass2Shader::setUniforms(ModelViewProjectionMatrix, core::matrix4::EM4CONST_IDENTITY);
|
||||||
@ -287,6 +292,7 @@ static void drawSMGrass(GLMesh &mesh, const core::matrix4 &ModelViewProjectionMa
|
|||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(MeshShader::InstancedGrassPass2Shader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(MeshShader::InstancedGrassPass2Shader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
setTexture(MeshShader::InstancedGrassPass2Shader::TU_dtex, irr_driver->getDepthStencilTexture(), GL_NEAREST, GL_NEAREST);
|
setTexture(MeshShader::InstancedGrassPass2Shader::TU_dtex, irr_driver->getDepthStencilTexture(), GL_NEAREST, GL_NEAREST);
|
||||||
SunLightProvider * const cb = (SunLightProvider *)irr_driver->getCallback(ES_SUNLIGHT);
|
SunLightProvider * const cb = (SunLightProvider *)irr_driver->getCallback(ES_SUNLIGHT);
|
||||||
|
@ -178,12 +178,7 @@ GLMesh allocateMeshBuffer(scene::IMeshBuffer* mb)
|
|||||||
}
|
}
|
||||||
ITexture *tex;
|
ITexture *tex;
|
||||||
for (unsigned i = 0; i < 6; i++)
|
for (unsigned i = 0; i < 6; i++)
|
||||||
{
|
result.textures[i] = mb->getMaterial().getTexture(i);
|
||||||
tex = mb->getMaterial().getTexture(i);
|
|
||||||
if (tex)
|
|
||||||
transformTexturesTosRGB(tex);
|
|
||||||
result.textures[i] = tex;
|
|
||||||
}
|
|
||||||
result.TextureMatrix = 0;
|
result.TextureMatrix = 0;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -225,7 +220,10 @@ void drawObjectPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProjecti
|
|||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
if (mesh.textures[0])
|
if (mesh.textures[0])
|
||||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
{
|
||||||
|
compressTexture(mesh.textures[0], true);
|
||||||
|
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setTexture(0, 0, GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, false);
|
setTexture(0, 0, GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, false);
|
||||||
@ -252,7 +250,7 @@ void drawObjectRefPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProje
|
|||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
|
|
||||||
MeshShader::ObjectRefPass1Shader::setUniforms(ModelViewProjectionMatrix, TransposeInverseModelView, TextureMatrix, 0);
|
MeshShader::ObjectRefPass1Shader::setUniforms(ModelViewProjectionMatrix, TransposeInverseModelView, TextureMatrix, 0);
|
||||||
@ -269,6 +267,7 @@ void drawGrassPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProjectio
|
|||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
|
|
||||||
MeshShader::GrassPass1Shader::setUniforms(ModelViewProjectionMatrix, TransposeInverseModelView, windDir, 0);
|
MeshShader::GrassPass1Shader::setUniforms(ModelViewProjectionMatrix, TransposeInverseModelView, windDir, 0);
|
||||||
@ -286,6 +285,7 @@ void drawNormalPass(const GLMesh &mesh, const core::matrix4 & ModelMatrix, const
|
|||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
assert(mesh.textures[1]);
|
assert(mesh.textures[1]);
|
||||||
|
compressTexture(mesh.textures[1], false);
|
||||||
setTexture(0, getTextureGLuint(mesh.textures[1]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(0, getTextureGLuint(mesh.textures[1]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
|
|
||||||
MeshShader::NormalMapShader::setUniforms(ModelMatrix, InverseModelMatrix, 0);
|
MeshShader::NormalMapShader::setUniforms(ModelMatrix, InverseModelMatrix, 0);
|
||||||
@ -336,6 +336,7 @@ void drawSplatting(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionM
|
|||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
// Texlayout
|
// Texlayout
|
||||||
|
compressTexture(mesh.textures[1], true);
|
||||||
setTexture(MeshShader::SplattingShader::TU_tex_layout, getTextureGLuint(mesh.textures[1]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(MeshShader::SplattingShader::TU_tex_layout, getTextureGLuint(mesh.textures[1]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
if (irr_driver->getLightViz())
|
if (irr_driver->getLightViz())
|
||||||
{
|
{
|
||||||
@ -348,6 +349,7 @@ void drawSplatting(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionM
|
|||||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||||
}
|
}
|
||||||
//Tex detail0
|
//Tex detail0
|
||||||
|
compressTexture(mesh.textures[2], true);
|
||||||
setTexture(MeshShader::SplattingShader::TU_tex_detail0, getTextureGLuint(mesh.textures[2]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(MeshShader::SplattingShader::TU_tex_detail0, getTextureGLuint(mesh.textures[2]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
if (irr_driver->getLightViz())
|
if (irr_driver->getLightViz())
|
||||||
{
|
{
|
||||||
@ -360,6 +362,7 @@ void drawSplatting(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionM
|
|||||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||||
}
|
}
|
||||||
//Tex detail1
|
//Tex detail1
|
||||||
|
compressTexture(mesh.textures[3], true);
|
||||||
setTexture(MeshShader::SplattingShader::TU_tex_detail1, getTextureGLuint(mesh.textures[3]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(MeshShader::SplattingShader::TU_tex_detail1, getTextureGLuint(mesh.textures[3]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
if (irr_driver->getLightViz())
|
if (irr_driver->getLightViz())
|
||||||
{
|
{
|
||||||
@ -371,6 +374,7 @@ void drawSplatting(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionM
|
|||||||
GLint swizzleMask[] = {GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA};
|
GLint swizzleMask[] = {GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA};
|
||||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||||
}
|
}
|
||||||
|
compressTexture(mesh.textures[4], true);
|
||||||
//Tex detail2
|
//Tex detail2
|
||||||
setTexture(MeshShader::SplattingShader::TU_tex_detail2, getTextureGLuint(mesh.textures[4]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(MeshShader::SplattingShader::TU_tex_detail2, getTextureGLuint(mesh.textures[4]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
if (irr_driver->getLightViz())
|
if (irr_driver->getLightViz())
|
||||||
@ -384,6 +388,7 @@ void drawSplatting(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionM
|
|||||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||||
}
|
}
|
||||||
//Tex detail3
|
//Tex detail3
|
||||||
|
compressTexture(mesh.textures[5], true);
|
||||||
setTexture(MeshShader::SplattingShader::TU_tex_detail3, getTextureGLuint(mesh.textures[5]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(MeshShader::SplattingShader::TU_tex_detail3, getTextureGLuint(mesh.textures[5]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
if (irr_driver->getLightViz())
|
if (irr_driver->getLightViz())
|
||||||
{
|
{
|
||||||
@ -410,6 +415,7 @@ void drawObjectRefPass2(const GLMesh &mesh, const core::matrix4 &ModelViewProjec
|
|||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(MeshShader::ObjectRefPass2Shader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(MeshShader::ObjectRefPass2Shader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
if (irr_driver->getLightViz())
|
if (irr_driver->getLightViz())
|
||||||
{
|
{
|
||||||
@ -438,6 +444,7 @@ void drawCaustics(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionM
|
|||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(MeshShader::CausticsShader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(MeshShader::CausticsShader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
if (irr_driver->getLightViz())
|
if (irr_driver->getLightViz())
|
||||||
{
|
{
|
||||||
@ -451,6 +458,7 @@ void drawCaustics(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionM
|
|||||||
}
|
}
|
||||||
if (!CausticTex)
|
if (!CausticTex)
|
||||||
CausticTex = irr_driver->getTexture(file_manager->getAsset("textures/caustics.png").c_str());
|
CausticTex = irr_driver->getTexture(file_manager->getAsset("textures/caustics.png").c_str());
|
||||||
|
compressTexture(CausticTex, false);
|
||||||
setTexture(MeshShader::CausticsShader::TU_caustictex, getTextureGLuint(CausticTex), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(MeshShader::CausticsShader::TU_caustictex, getTextureGLuint(CausticTex), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
|
|
||||||
MeshShader::CausticsShader::setUniforms(ModelViewProjectionMatrix, dir, dir2,
|
MeshShader::CausticsShader::setUniforms(ModelViewProjectionMatrix, dir, dir2,
|
||||||
@ -469,6 +477,7 @@ void drawGrassPass2(const GLMesh &mesh, const core::matrix4 & ModelViewProjectio
|
|||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(MeshShader::GrassPass2Shader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(MeshShader::GrassPass2Shader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
if (irr_driver->getLightViz())
|
if (irr_driver->getLightViz())
|
||||||
{
|
{
|
||||||
@ -509,6 +518,7 @@ void drawObjectRimLimit(const GLMesh &mesh, const core::matrix4 &ModelViewProjec
|
|||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(MeshShader::ObjectRimLimitShader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(MeshShader::ObjectRimLimitShader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
if (irr_driver->getLightViz())
|
if (irr_driver->getLightViz())
|
||||||
{
|
{
|
||||||
@ -535,6 +545,7 @@ void drawObjectUnlit(const GLMesh &mesh, const core::matrix4 &ModelViewProjectio
|
|||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(MeshShader::ObjectUnlitShader::TU_tex, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(MeshShader::ObjectUnlitShader::TU_tex, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
if (irr_driver->getLightViz())
|
if (irr_driver->getLightViz())
|
||||||
{
|
{
|
||||||
@ -561,6 +572,7 @@ void drawDetailledObjectPass2(const GLMesh &mesh, const core::matrix4 &ModelView
|
|||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(MeshShader::DetailledObjectPass2Shader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(MeshShader::DetailledObjectPass2Shader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
if (irr_driver->getLightViz())
|
if (irr_driver->getLightViz())
|
||||||
{
|
{
|
||||||
@ -572,7 +584,7 @@ void drawDetailledObjectPass2(const GLMesh &mesh, const core::matrix4 &ModelView
|
|||||||
GLint swizzleMask[] = {GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA};
|
GLint swizzleMask[] = {GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA};
|
||||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||||
}
|
}
|
||||||
|
compressTexture(mesh.textures[1], true);
|
||||||
setTexture(MeshShader::DetailledObjectPass2Shader::TU_detail, getTextureGLuint(mesh.textures[1]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(MeshShader::DetailledObjectPass2Shader::TU_detail, getTextureGLuint(mesh.textures[1]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
|
|
||||||
MeshShader::DetailledObjectPass2Shader::setUniforms(ModelViewProjectionMatrix);
|
MeshShader::DetailledObjectPass2Shader::setUniforms(ModelViewProjectionMatrix);
|
||||||
@ -589,6 +601,7 @@ void drawObjectPass2(const GLMesh &mesh, const core::matrix4 &ModelViewProjectio
|
|||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(MeshShader::ObjectPass2Shader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(MeshShader::ObjectPass2Shader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
if (irr_driver->getLightViz())
|
if (irr_driver->getLightViz())
|
||||||
{
|
{
|
||||||
@ -615,6 +628,7 @@ void drawTransparentObject(const GLMesh &mesh, const core::matrix4 &ModelViewPro
|
|||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
|
|
||||||
MeshShader::TransparentShader::setUniforms(ModelViewProjectionMatrix, TextureMatrix, 0);
|
MeshShader::TransparentShader::setUniforms(ModelViewProjectionMatrix, TextureMatrix, 0);
|
||||||
@ -645,6 +659,7 @@ void drawTransparentFogObject(const GLMesh &mesh, const core::matrix4 &ModelView
|
|||||||
tmpcol.getGreen() / 255.0f,
|
tmpcol.getGreen() / 255.0f,
|
||||||
tmpcol.getBlue() / 255.0f);
|
tmpcol.getBlue() / 255.0f);
|
||||||
|
|
||||||
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
|
|
||||||
glUseProgram(MeshShader::TransparentFogShader::Program);
|
glUseProgram(MeshShader::TransparentFogShader::Program);
|
||||||
@ -665,6 +680,7 @@ void drawBubble(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatr
|
|||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
|
|
||||||
MeshShader::BubbleShader::setUniforms(ModelViewProjectionMatrix, 0, time, transparency);
|
MeshShader::BubbleShader::setUniforms(ModelViewProjectionMatrix, 0, time, transparency);
|
||||||
@ -681,6 +697,7 @@ void drawShadowRef(const GLMesh &mesh, const core::matrix4 &ModelMatrix)
|
|||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
MeshShader::RefShadowShader::setUniforms(ModelMatrix, 0);
|
MeshShader::RefShadowShader::setUniforms(ModelMatrix, 0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user