Minetest 5.9.0-dev
No Matches
Environment Class Referenceabstract

#include <environment.h>

+ Inheritance diagram for Environment:
+ Collaboration diagram for Environment:

Public Member Functions

 Environment (IGameDef *gamedef)
virtual ~Environment ()=default
virtual void step (f32 dtime)=0
virtual MapgetMap ()=0
u32 getDayNightRatio ()
virtual void setTimeOfDay (u32 time)
u32 getTimeOfDay ()
float getTimeOfDayF ()
void stepTimeOfDay (float dtime)
void setTimeOfDaySpeed (float speed)
void setDayNightRatioOverride (bool enable, u32 value)
u32 getDayCount ()
bool line_of_sight (v3f pos1, v3f pos2, v3s16 *p=nullptr)
virtual void getSelectedActiveObjects (const core::line3d< f32 > &shootline_on_map, std::vector< PointedThing > &objects, const std::optional< Pointabilities > &pointabilities)=0
void continueRaycast (RaycastState *state, PointedThing *result)
IGameDefgetGameDef ()

Public Attributes

u32 m_added_objects

Protected Attributes

std::atomic< float > m_time_of_day_speed
u32 m_time_of_day
float m_time_of_day_f
float m_time_conversion_skew = 0.0f
bool m_enable_day_night_ratio_override = false
u32 m_day_night_ratio_override = 0.0f
std::atomic< u32 > m_day_count
bool m_cache_enable_shaders
float m_cache_active_block_mgmt_interval
float m_cache_abm_interval
float m_cache_nodetimer_interval
float m_cache_abm_time_budget

Private Attributes

std::mutex m_time_lock

Constructor & Destructor Documentation

◆ Environment()

Environment::Environment ( IGameDef gamedef)

References g_settings, Settings::getBool(), Settings::getFloat(), Settings::getU32(), m_cache_abm_interval, m_cache_abm_time_budget, m_cache_active_block_mgmt_interval, m_cache_enable_shaders, m_cache_nodetimer_interval, m_time_of_day, and m_time_of_day_f.

+ Here is the call graph for this function:

◆ ~Environment()

virtual Environment::~Environment ( )

Member Function Documentation

◆ continueRaycast()

void Environment::continueRaycast ( RaycastState state,
PointedThing result 

Returns the next node or object the shootline meets.

statecurrent state of the raycast
output, will contain the next pointed thing

References PointedThing::box_id, boxLineCollision(), BS, PointedThing::distanceSq, floatToInt(), voxalgo::VoxelLineIterator::getIndex(), getMap(), MapNode::getNeighbors(), Map::getNode(), Map::getNodeDefManager(), getSelectedActiveObjects(), MapNode::getSelectionBoxes(), NodeDefManager::getSelectionBoxIntUnion(), PointedThing::intersection_normal, PointedThing::intersection_point, intToFloat(), isPointableNode(), voxalgo::VoxelLineIterator::m_current_index, voxalgo::VoxelLineIterator::m_current_node_pos, RaycastState::m_found, RaycastState::m_initialization_needed, RaycastState::m_iterator, voxalgo::VoxelLineIterator::m_last_index, RaycastState::m_liquids_pointable, RaycastState::m_objects_pointable, RaycastState::m_pointabilities, RaycastState::m_previous_node, RaycastState::m_search_range, RaycastState::m_shootline, voxalgo::VoxelLineIterator::next(), PointedThing::node_abovesurface, PointedThing::node_real_undersurface, PointedThing::node_undersurface, PointedThing::pointability, POINTEDTHING_NODE, POINTEDTHING_NOTHING, S16_MAX, and PointedThing::type.

Referenced by Game::updatePointedThing().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:


Environment::DISABLE_CLASS_COPY ( Environment  )

◆ getDayCount()

u32 Environment::getDayCount ( )

References m_day_count.

◆ getDayNightRatio()

u32 Environment::getDayNightRatio ( )

References m_cache_enable_shaders, m_day_night_ratio_override, m_enable_day_night_ratio_override, m_time_lock, m_time_of_day_f, and time_to_daynight_ratio().

Referenced by SmokePuffCSO::SmokePuffCSO(), ClientEnvironment::addActiveObject(), GameGlobalShaderConstantSetter::onSetConstants(), ClientMap::renderMap(), ClientEnvironment::step(), and Particle::updateLight().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGameDef()

IGameDef * Environment::getGameDef ( )

References m_gamedef.

Referenced by LocalPlayer::getSlipFactor(), and LocalPlayer::handleAutojump().

+ Here is the caller graph for this function:

◆ getMap()

◆ getSelectedActiveObjects()

virtual void Environment::getSelectedActiveObjects ( const core::line3d< f32 > &  shootline_on_map,
std::vector< PointedThing > &  objects,
const std::optional< Pointabilities > &  pointabilities 
pure virtual

Gets the objects pointed by the shootline as pointed things. If this is a client environment, the local player won't be returned.

[in]shootline_on_mapthe shootline for the test in world coordinates
[out]objectsfound objects

Implemented in ClientEnvironment, and ServerEnvironment.

Referenced by continueRaycast().

+ Here is the caller graph for this function:

◆ getTimeOfDay()

u32 Environment::getTimeOfDay ( )

References m_time_lock, and m_time_of_day.

Referenced by Server::AsyncRunStep(), Server::handleCommand_Init2(), and ServerEnvironment::saveMeta().

+ Here is the caller graph for this function:

◆ getTimeOfDayF()

float Environment::getTimeOfDayF ( )

References m_time_lock, and m_time_of_day_f.

◆ line_of_sight()

bool Environment::line_of_sight ( v3f  pos1,
v3f  pos2,
v3s16 p = nullptr 

Returns false if the given line intersects with a non-air node, true otherwise.

pos1start of the line
pos2end of the line
poutput, position of the first non-air node the line intersects

References BS, CONTENT_AIR, getMap(), Map::getNode(), voxalgo::VoxelLineIterator::m_current_index, voxalgo::VoxelLineIterator::m_current_node_pos, voxalgo::VoxelLineIterator::m_last_index, voxalgo::VoxelLineIterator::next(), p(), and MapNode::param0.

+ Here is the call graph for this function:

◆ setDayNightRatioOverride()

void Environment::setDayNightRatioOverride ( bool  enable,
u32  value 

◆ setTimeOfDay()

void Environment::setTimeOfDay ( u32  time)

References m_day_count, m_time_lock, m_time_of_day, and m_time_of_day_f.

Referenced by Client::handleCommand_TimeOfDay(), ServerEnvironment::loadMeta(), and Server::setTimeOfDay().

+ Here is the caller graph for this function:

◆ setTimeOfDaySpeed()

void Environment::setTimeOfDaySpeed ( float  speed)

References m_time_of_day_speed.

Referenced by Server::AsyncRunStep(), and Client::handleCommand_TimeOfDay().

+ Here is the caller graph for this function:

◆ step()

virtual void Environment::step ( f32  dtime)
pure virtual

Implemented in ClientEnvironment, and ServerEnvironment.

◆ stepTimeOfDay()

void Environment::stepTimeOfDay ( float  dtime)

References m_day_count, m_time_conversion_skew, m_time_lock, m_time_of_day, m_time_of_day_f, and m_time_of_day_speed.

Referenced by ClientEnvironment::step(), and ServerEnvironment::step().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_added_objects

u32 Environment::m_added_objects

◆ m_cache_abm_interval

float Environment::m_cache_abm_interval

◆ m_cache_abm_time_budget

float Environment::m_cache_abm_time_budget

◆ m_cache_active_block_mgmt_interval

float Environment::m_cache_active_block_mgmt_interval

◆ m_cache_enable_shaders

bool Environment::m_cache_enable_shaders

Referenced by Environment(), and getDayNightRatio().

◆ m_cache_nodetimer_interval

float Environment::m_cache_nodetimer_interval

◆ m_day_count

std::atomic<u32> Environment::m_day_count

◆ m_day_night_ratio_override

u32 Environment::m_day_night_ratio_override = 0.0f

◆ m_enable_day_night_ratio_override

bool Environment::m_enable_day_night_ratio_override = false

◆ m_gamedef

IGameDef* Environment::m_gamedef

Referenced by getGameDef().

◆ m_time_conversion_skew

float Environment::m_time_conversion_skew = 0.0f

Referenced by stepTimeOfDay().

◆ m_time_lock

std::mutex Environment::m_time_lock

◆ m_time_of_day

u32 Environment::m_time_of_day

◆ m_time_of_day_f

float Environment::m_time_of_day_f

◆ m_time_of_day_speed

std::atomic<float> Environment::m_time_of_day_speed

Referenced by setTimeOfDaySpeed(), and stepTimeOfDay().

The documentation for this class was generated from the following files: