Make water normal map independent from default textures

master
RealBadAngel 2013-11-02 19:23:47 +01:00
parent f9812eb0ba
commit 8781642802
3 changed files with 6 additions and 6 deletions

View File

@ -40,7 +40,7 @@ float waterDensity = 0.0; //water density (0.0-1.0)
float choppy = 0.00; //wave choppyness
float aberration = 0.003; //chromatic aberration amount
float bump = 1.5; //overall water surface bumpyness
float bump = 2.5; //overall water surface bumpyness
float reflBump = 0.20; //reflection distortion amount
float refrBump = 0.08; //refraction distortion amount
@ -89,7 +89,7 @@ vec2 fragCoord = fragPos.xy;
fragCoord = clamp(fragCoord,0.002,0.998);
vec3 sunPos = vec3(0.0);
sunPos.x=sin((timeOfDay-0.5)*3.14159);
float timer = timeOfDay*1500;
float timer = timeOfDay*1600;
//cameraPos = eyePosition;
//normal map
@ -195,7 +195,7 @@ vec2 fragCoord = fragPos.xy;
//color = (cameraPos.z<0.0)?mix(color, watercolor*darkness, clamp(fog/ waterext,0.0,1.0)):color;
color = color+ specColor*specular;
float alpha = clamp((color.r+color.b+color.g)*1.2,0.1,0.9);
float alpha = clamp((color.r+color.b+color.g)*1.2,0.1,0.7);
vec4 col = vec4(color.r, color.g, color.b, alpha);
col *= gl_Color;

View File

@ -833,11 +833,11 @@ public:
#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 8)
services->setPixelShaderConstant("normalTexture" , (irr::f32*)&layer1, 1);
services->setPixelShaderConstant("useNormalmap" , (irr::f32*)&layer2, 1);
services->setPixelShaderConstant("reflectionTexture" , (irr::f32*)&layer3, 1);
services->setPixelShaderConstant("normalSampler" , (irr::f32*)&layer3, 1);
#else
services->setPixelShaderConstant("normalTexture" , (irr::s32*)&layer1, 1);
services->setPixelShaderConstant("useNormalmap" , (irr::s32*)&layer2, 1);
services->setPixelShaderConstant("reflectionTexture" , (irr::s32*)&layer3, 1);
services->setPixelShaderConstant("normalSampler" , (irr::s32*)&layer3, 1);
#endif
}
};

View File

@ -1201,7 +1201,7 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data):
if (enable_shaders) {
ITextureSource *tsrc = data->m_gamedef->tsrc();
material.setTexture(2, tsrc->getTexture("disable_img.png"));
material.setTexture(3, tsrc->getTexture("reflection.png"));
material.setTexture(3, tsrc->getTexture("water_surface_normalmap.png"));
if (enable_bumpmapping) {
std::string fname_base = tsrc->getTextureName(p.tile.texture_id);
std::string normal_ext = "_normal.png";