diff options
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 57 |
1 files changed, 54 insertions, 3 deletions
diff --git a/src/game.cpp b/src/game.cpp index 71a578a65..22abe4c74 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -805,13 +805,64 @@ public: float daynight_ratio_f = (float)daynight_ratio / 1000.0; services->setPixelShaderConstant("dayNightRatio", &daynight_ratio_f, 1); + u32 animation_timer = porting::getTimeMs() % 100000; + float animation_timer_f = (float)animation_timer / 100000.0; + services->setPixelShaderConstant("animationTimer", &animation_timer_f, 1); + services->setVertexShaderConstant("animationTimer", &animation_timer_f, 1); + + LocalPlayer* player = m_client->getEnv().getLocalPlayer(); + v3f eye_position = player->getEyePosition(); + services->setPixelShaderConstant("eyePosition", (irr::f32*)&eye_position, 3); + services->setVertexShaderConstant("eyePosition", (irr::f32*)&eye_position, 3); + + float enable_bumpmapping = 0; + if (g_settings->getBool("enable_bumpmapping")) + enable_bumpmapping = 1; + services->setPixelShaderConstant("enableBumpmapping", &enable_bumpmapping, 1); + + float enable_parallax_occlusion = 0; + if (g_settings->getBool("enable_parallax_occlusion"));{ + enable_parallax_occlusion = 1; + float parallax_occlusion_scale = g_settings->getFloat("parallax_occlusion_scale"); + services->setPixelShaderConstant("parallaxOcclusionScale", ¶llax_occlusion_scale, 1); + float parallax_occlusion_bias = g_settings->getFloat("parallax_occlusion_bias"); + services->setPixelShaderConstant("parallaxOcclusionBias", ¶llax_occlusion_bias, 1); + } + services->setPixelShaderConstant("enableParallaxOcclusion", &enable_parallax_occlusion, 1); + + float enable_waving_water = 0; + if (g_settings->getBool("enable_waving_water")){ + enable_waving_water = 1; + float water_wave_height_f = g_settings->getFloat("water_wave_height"); + services->setVertexShaderConstant("waterWaveHeight", &water_wave_height_f, 1); + float water_wave_length_f = g_settings->getFloat("water_wave_length"); + services->setVertexShaderConstant("waterWaveLength", &water_wave_length_f, 1); + float water_wave_speed_f = g_settings->getFloat("water_wave_speed"); + services->setVertexShaderConstant("waterWaveSpeed", &water_wave_speed_f, 1); + } + services->setVertexShaderConstant("enableWavingWater", &enable_waving_water, 1); + + float enable_waving_leaves = 0; + if (g_settings->getBool("enable_waving_leaves")) + enable_waving_leaves = 1; + services->setVertexShaderConstant("enableWavingLeaves", &enable_waving_leaves, 1); + + float enable_waving_plants = 0; + if (g_settings->getBool("enable_waving_plants")) + enable_waving_plants = 1; + services->setVertexShaderConstant("enableWavingPlants", &enable_waving_plants, 1); + + // Normal map texture layer - int layer = 1; + int layer1 = 1; + int layer2 = 2; // before 1.8 there isn't a "integer interface", only float #if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 8) - services->setPixelShaderConstant("normalTexture" , (irr::f32*)&layer, 1); + services->setPixelShaderConstant("normalTexture" , (irr::f32*)&layer1, 1); + services->setPixelShaderConstant("useNormalmap" , (irr::f32*)&layer2, 1); #else - services->setPixelShaderConstant("normalTexture" , (irr::s32*)&layer, 1); + services->setPixelShaderConstant("normalTexture" , (irr::s32*)&layer1, 1); + services->setPixelShaderConstant("useNormalmap" , (irr::s32*)&layer2, 1); #endif } }; |