Remove Cautics effect
It's not used anywhere and I have no way to test it so it's useless.
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
uniform sampler2D Albedo;
|
||||
uniform sampler2D caustictex;
|
||||
uniform vec2 dir;
|
||||
uniform vec2 dir2;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
vec3 getLightFactor(float specMapValue);
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color = texture(Albedo, uv);
|
||||
float caustic = texture(caustictex, uv + dir).x;
|
||||
float caustic2 = texture(caustictex, (uv.yx + dir2 * vec2(-0.6, 0.3)) * vec2(0.6)).x;
|
||||
|
||||
vec3 LightFactor = getLightFactor(1.) + caustic * caustic2 * 10;
|
||||
FragColor = vec4(color.xyz * LightFactor, 1.);
|
||||
}
|
||||
@@ -852,13 +852,6 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
|
||||
m->MaterialType = video::EMT_SOLID;
|
||||
}
|
||||
}
|
||||
if (m_graphical_effect == GE_CAUSTICS && irr_driver->isGLSL())
|
||||
{
|
||||
m->MaterialType = irr_driver->getShader(ES_CAUSTICS);
|
||||
|
||||
m->setTexture(1, irr_driver->getTexture(FileManager::SHADER,
|
||||
"caustics.png"));
|
||||
}
|
||||
|
||||
|
||||
// Modify lightmap materials so that vertex colors are taken into account.
|
||||
|
||||
@@ -259,9 +259,6 @@ void Shaders::loadShaders()
|
||||
m_shaders[ES_SHADOWGEN] = glslmat(dir + "pass.vert", dir + "pass.frag",
|
||||
m_callbacks[ES_SHADOWGEN], EMT_SOLID);
|
||||
|
||||
m_shaders[ES_CAUSTICS] = glslmat(dir + "pass.vert", dir + "pass.frag",
|
||||
m_callbacks[ES_CAUSTICS], EMT_SOLID);
|
||||
|
||||
m_shaders[ES_DISPLACE] = glsl(dir + "pass.vert", dir + "pass.frag",
|
||||
m_callbacks[ES_DISPLACE]);
|
||||
|
||||
@@ -345,7 +342,6 @@ void Shaders::loadShaders()
|
||||
MeshShader::SplattingShader::init();
|
||||
MeshShader::GrassPass1Shader::init();
|
||||
MeshShader::GrassPass2Shader::init();
|
||||
MeshShader::CausticsShader::init();
|
||||
MeshShader::BubbleShader::init();
|
||||
MeshShader::TransparentShader::init();
|
||||
MeshShader::TransparentFogShader::init();
|
||||
@@ -1267,54 +1263,6 @@ namespace MeshShader
|
||||
glUniform3f(uniform_ambient, s.r, s.g, s.b);
|
||||
}
|
||||
|
||||
GLuint CausticsShader::Program;
|
||||
GLuint CausticsShader::attrib_position;
|
||||
GLuint CausticsShader::attrib_texcoord;
|
||||
GLuint CausticsShader::uniform_MVP;
|
||||
GLuint CausticsShader::uniform_dir;
|
||||
GLuint CausticsShader::uniform_dir2;
|
||||
GLuint CausticsShader::uniform_ambient;
|
||||
GLuint CausticsShader::TU_Albedo;
|
||||
GLuint CausticsShader::TU_caustictex;
|
||||
|
||||
void CausticsShader::init()
|
||||
{
|
||||
Program = LoadProgram(
|
||||
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/caustics.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
|
||||
uniform_dir = glGetUniformLocation(Program, "dir");
|
||||
uniform_dir2 = glGetUniformLocation(Program, "dir2");
|
||||
GLuint uniform_Albedo = glGetUniformLocation(Program, "Albedo");
|
||||
GLuint uniform_caustictex = glGetUniformLocation(Program, "caustictex");
|
||||
GLuint uniform_DiffuseMap = glGetUniformLocation(Program, "DiffuseMap");
|
||||
GLuint uniform_SpecularMap = glGetUniformLocation(Program, "SpecularMap");
|
||||
GLuint uniform_SSAO = glGetUniformLocation(Program, "SSAO");
|
||||
uniform_ambient = glGetUniformLocation(Program, "ambient");
|
||||
TU_Albedo = 3;
|
||||
TU_caustictex = 4;
|
||||
|
||||
glUseProgram(Program);
|
||||
glUniform1i(uniform_DiffuseMap, 0);
|
||||
glUniform1i(uniform_SpecularMap, 1);
|
||||
glUniform1i(uniform_SSAO, 2);
|
||||
glUniform1i(uniform_Albedo, TU_Albedo);
|
||||
glUniform1i(uniform_caustictex, TU_caustictex);
|
||||
glUseProgram(0);
|
||||
}
|
||||
|
||||
void CausticsShader::setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::vector2df &dir, const core::vector2df &dir2, const core::vector2df &screen)
|
||||
{
|
||||
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
|
||||
glUniform2f(uniform_dir, dir.X, dir.Y);
|
||||
glUniform2f(uniform_dir2, dir2.X, dir2.Y);
|
||||
const video::SColorf s = irr_driver->getSceneManager()->getAmbientLight();
|
||||
glUniform3f(uniform_ambient, s.r, s.g, s.b);
|
||||
}
|
||||
|
||||
GLuint BubbleShader::Program;
|
||||
GLuint BubbleShader::attrib_position;
|
||||
GLuint BubbleShader::attrib_texcoord;
|
||||
|
||||
@@ -269,18 +269,6 @@ public:
|
||||
static void setUniforms(const core::matrix4 &ModelMatrix);
|
||||
};
|
||||
|
||||
class CausticsShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord;
|
||||
static GLuint uniform_MVP, uniform_dir, uniform_dir2, uniform_ambient;
|
||||
static GLuint TU_Albedo, TU_caustictex;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::vector2df &dir, const core::vector2df &dir2, const core::vector2df &screen);
|
||||
};
|
||||
|
||||
class BubbleShader
|
||||
{
|
||||
public:
|
||||
@@ -921,7 +909,6 @@ public:
|
||||
ACT(ES_PENUMBRAH) \
|
||||
ACT(ES_PENUMBRAV) \
|
||||
ACT(ES_SHADOWGEN) \
|
||||
ACT(ES_CAUSTICS) \
|
||||
ACT(ES_DISPLACE) \
|
||||
ACT(ES_PASSFAR) \
|
||||
|
||||
|
||||
@@ -35,8 +35,6 @@ ShadedMaterial MaterialTypeToShadedMaterial(video::E_MATERIAL_TYPE type, video::
|
||||
return SM_GRASS;
|
||||
else if (type == irr_driver->getShader(ES_OBJECT_UNLIT))
|
||||
return SM_UNLIT;
|
||||
else if (type == irr_driver->getShader(ES_CAUSTICS))
|
||||
return SM_CAUSTICS;
|
||||
else if (textures[1] && type != irr_driver->getShader(ES_NORMAL_MAP))
|
||||
return SM_DETAILS;
|
||||
else if (!textures[0])
|
||||
@@ -427,39 +425,6 @@ void drawObjectRefPass2(const GLMesh &mesh, const core::matrix4 &ModelViewProjec
|
||||
|
||||
static video::ITexture *CausticTex = 0;
|
||||
|
||||
void drawCaustics(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, core::vector2df dir, core::vector2df dir2)
|
||||
{
|
||||
irr_driver->IncreaseObjectCount();
|
||||
GLenum ptype = mesh.PrimitiveType;
|
||||
GLenum itype = mesh.IndexType;
|
||||
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);
|
||||
if (irr_driver->getLightViz())
|
||||
{
|
||||
GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_ALPHA };
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
else
|
||||
{
|
||||
GLint swizzleMask[] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
if (!CausticTex)
|
||||
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);
|
||||
|
||||
MeshShader::CausticsShader::setUniforms(ModelViewProjectionMatrix, dir, dir2,
|
||||
core::vector2df(float(UserConfigParams::m_width),
|
||||
float(UserConfigParams::m_height)));
|
||||
|
||||
assert(mesh.vao_second_pass);
|
||||
glBindVertexArray(mesh.vao_second_pass);
|
||||
glDrawElements(ptype, count, itype, 0);
|
||||
}
|
||||
|
||||
void drawGrassPass2(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, core::vector3df windDir)
|
||||
{
|
||||
irr_driver->IncreaseObjectCount();
|
||||
@@ -732,8 +697,6 @@ bool isObject(video::E_MATERIAL_TYPE type)
|
||||
return true;
|
||||
if (type == irr_driver->getShader(ES_OBJECT_UNLIT))
|
||||
return true;
|
||||
if (type == irr_driver->getShader(ES_CAUSTICS))
|
||||
return true;
|
||||
if (type == video::EMT_TRANSPARENT_ALPHA_CHANNEL)
|
||||
return true;
|
||||
if (type == video::EMT_ONETEXTURE_BLEND)
|
||||
@@ -804,10 +767,6 @@ void initvaostate(GLMesh &mesh, GeometricMaterial GeoMat, ShadedMaterial ShadedM
|
||||
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
||||
MeshShader::ObjectUnlitShader::attrib_position, MeshShader::ObjectUnlitShader::attrib_texcoord, -1, -1, -1, -1, -1, mesh.Stride);
|
||||
break;
|
||||
case SM_CAUSTICS:
|
||||
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
||||
MeshShader::CausticsShader::attrib_position, MeshShader::CausticsShader::attrib_texcoord, -1, -1, -1, -1, -1, mesh.Stride);
|
||||
break;
|
||||
case SM_DETAILS:
|
||||
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
||||
MeshShader::DetailledObjectPass2Shader::attrib_position, MeshShader::DetailledObjectPass2Shader::attrib_texcoord, MeshShader::DetailledObjectPass2Shader::attrib_second_texcoord, -1, -1, -1, -1, mesh.Stride);
|
||||
|
||||
@@ -26,7 +26,6 @@ enum ShadedMaterial
|
||||
SM_SPLATTING,
|
||||
SM_GRASS,
|
||||
SM_UNLIT,
|
||||
SM_CAUSTICS,
|
||||
SM_DETAILS,
|
||||
SM_UNTEXTURED,
|
||||
SM_COUNT
|
||||
@@ -124,7 +123,6 @@ void drawUntexturedObject(const GLMesh &mesh, const core::matrix4 &ModelViewProj
|
||||
void drawObjectRefPass2(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix);
|
||||
void drawSphereMap(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView);
|
||||
void drawSplatting(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix);
|
||||
void drawCaustics(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, core::vector2df dir, core::vector2df dir2);
|
||||
void drawGrassPass2(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, core::vector3df windDir);
|
||||
void drawObjectRimLimit(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView, const core::matrix4 &TextureMatrix);
|
||||
void drawObjectUnlit(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix);
|
||||
|
||||
@@ -236,28 +236,6 @@ void STKMeshSceneNode::drawSolidPass2(const GLMesh &mesh, ShadedMaterial type)
|
||||
case SM_UNLIT:
|
||||
drawObjectUnlit(mesh, ModelViewProjectionMatrix);
|
||||
break;
|
||||
case SM_CAUSTICS:
|
||||
{
|
||||
const float time = irr_driver->getDevice()->getTimer()->getTime() / 1000.0f;
|
||||
const float speed = World::getWorld()->getTrack()->getCausticsSpeed();
|
||||
|
||||
float strength = time;
|
||||
strength = fabsf(noise2d(strength / 10.0f)) * 0.006f + 0.001f;
|
||||
|
||||
vector3df wind = irr_driver->getWind() * strength * speed;
|
||||
caustic_dir.X += wind.X;
|
||||
caustic_dir.Y += wind.Z;
|
||||
|
||||
strength = time * 0.56f + sinf(time);
|
||||
strength = fabsf(noise2d(0.0, strength / 6.0f)) * 0.0095f + 0.001f;
|
||||
|
||||
wind = irr_driver->getWind() * strength * speed;
|
||||
wind.rotateXZBy(cosf(time));
|
||||
caustic_dir2.X += wind.X;
|
||||
caustic_dir2.Y += wind.Z;
|
||||
drawCaustics(mesh, ModelViewProjectionMatrix, caustic_dir, caustic_dir2);
|
||||
break;
|
||||
}
|
||||
case SM_DETAILS:
|
||||
drawDetailledObjectPass2(mesh, ModelViewProjectionMatrix);
|
||||
break;
|
||||
@@ -446,11 +424,6 @@ void STKMeshSceneNode::render()
|
||||
for_in(mesh, ShadedMesh[SM_GRASS])
|
||||
drawSolidPass2(*mesh, SM_GRASS);
|
||||
|
||||
if (!ShadedMesh[SM_CAUSTICS].empty())
|
||||
glUseProgram(MeshShader::CausticsShader::Program);
|
||||
for_in(mesh, ShadedMesh[SM_CAUSTICS])
|
||||
drawSolidPass2(*mesh, SM_CAUSTICS);
|
||||
|
||||
if (reload_each_frame)
|
||||
glEnable(GL_CULL_FACE);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user