mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Merge branch 'view_bobbing_and_vielded_tool'
This commit is contained in:
commit
061d4b4202
23 changed files with 1417 additions and 501 deletions
36
src/map.cpp
36
src/map.cpp
|
@ -3606,7 +3606,8 @@ ClientMap::ClientMap(
|
|||
m_client(client),
|
||||
m_control(control),
|
||||
m_camera_position(0,0,0),
|
||||
m_camera_direction(0,0,1)
|
||||
m_camera_direction(0,0,1),
|
||||
m_camera_fov(PI)
|
||||
{
|
||||
m_camera_mutex.Init();
|
||||
assert(m_camera_mutex.IsInitialized());
|
||||
|
@ -3715,6 +3716,7 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
|
|||
m_camera_mutex.Lock();
|
||||
v3f camera_position = m_camera_position;
|
||||
v3f camera_direction = m_camera_direction;
|
||||
f32 camera_fov = m_camera_fov;
|
||||
m_camera_mutex.Unlock();
|
||||
|
||||
/*
|
||||
|
@ -3807,7 +3809,8 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
|
|||
|
||||
float d = 0.0;
|
||||
if(isBlockInSight(block->getPos(), camera_position,
|
||||
camera_direction, range, &d) == false)
|
||||
camera_direction, camera_fov,
|
||||
range, &d) == false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -3927,6 +3930,35 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
|
|||
<<", rendered "<<vertex_count<<" vertices."<<std::endl;*/
|
||||
}
|
||||
|
||||
void ClientMap::renderPostFx()
|
||||
{
|
||||
// Sadly ISceneManager has no "post effects" render pass, in that case we
|
||||
// could just register for that and handle it in renderMap().
|
||||
|
||||
m_camera_mutex.Lock();
|
||||
v3f camera_position = m_camera_position;
|
||||
m_camera_mutex.Unlock();
|
||||
|
||||
MapNode n = getNodeNoEx(floatToInt(camera_position, BS));
|
||||
|
||||
// - If the player is in a solid node, make everything black.
|
||||
// - If the player is in liquid, draw a semi-transparent overlay.
|
||||
ContentFeatures& features = content_features(n);
|
||||
video::SColor post_effect_color = features.post_effect_color;
|
||||
if(features.solidness == 2 && g_settings.getBool("free_move") == false)
|
||||
{
|
||||
post_effect_color = video::SColor(255, 0, 0, 0);
|
||||
}
|
||||
if (post_effect_color.getAlpha() != 0)
|
||||
{
|
||||
// Draw a full-screen rectangle
|
||||
video::IVideoDriver* driver = SceneManager->getVideoDriver();
|
||||
v2u32 ss = driver->getScreenSize();
|
||||
core::rect<s32> rect(0,0, ss.X, ss.Y);
|
||||
driver->draw2DRectangle(post_effect_color, rect);
|
||||
}
|
||||
}
|
||||
|
||||
bool ClientMap::setTempMod(v3s16 p, NodeMod mod,
|
||||
core::map<v3s16, MapBlock*> *affected_blocks)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue