#include "constants.h"#include "irrlichttypes.h"#include "irr_v2d.h"#include "irr_v3d.h"#include "irr_aabb3d.h"#include "SColor.h"#include <matrix4.h>#include <cmath>#include <algorithm>
Include dependency graph for numeric.h:Go to the source code of this file.
Classes | |
| struct | MeshGrid |
| Describes a grid with given step, oirginating at (0,0,0) More... | |
| struct | MyRandGenerator |
| class | IntervalLimiter |
Macros | |
| #define | MYRAND_RANGE 0xffffffff |
Functions | |
| template<typename T , typename T2 , typename T3 > | |
| constexpr T | rangelim (const T &d, const T2 &min, const T3 &max) |
| s16 | getContainerPos (s16 p, s16 d) |
| v2s16 | getContainerPos (v2s16 p, s16 d) |
| v3s16 | getContainerPos (v3s16 p, s16 d) |
| v2s16 | getContainerPos (v2s16 p, v2s16 d) |
| v3s16 | getContainerPos (v3s16 p, v3s16 d) |
| void | getContainerPosWithOffset (s16 p, s16 d, s16 &container, s16 &offset) |
| void | getContainerPosWithOffset (const v2s16 &p, s16 d, v2s16 &container, v2s16 &offset) |
| void | getContainerPosWithOffset (const v3s16 &p, s16 d, v3s16 &container, v3s16 &offset) |
| bool | isInArea (v3s16 p, s16 d) |
| bool | isInArea (v2s16 p, s16 d) |
| bool | isInArea (v3s16 p, v3s16 d) |
| template<typename T > | |
| void | sortBoxVerticies (core::vector3d< T > &p1, core::vector3d< T > &p2) |
| template<typename T > | |
| constexpr core::vector2d< T > | componentwise_min (const core::vector2d< T > &a, const core::vector2d< T > &b) |
| template<typename T > | |
| constexpr core::vector2d< T > | componentwise_max (const core::vector2d< T > &a, const core::vector2d< T > &b) |
| template<typename T > | |
| constexpr core::vector3d< T > | componentwise_min (const core::vector3d< T > &a, const core::vector3d< T > &b) |
| template<typename T > | |
| constexpr core::vector3d< T > | componentwise_max (const core::vector3d< T > &a, const core::vector3d< T > &b) |
| float | modulo360f (float f) |
Returns f wrapped to the range [-360, 360]. | |
| float | wrapDegrees_0_360 (float f) |
Returns f wrapped to the range [0, 360]. | |
| v3f | wrapDegrees_0_360_v3f (v3f v) |
Returns v3f wrapped to the range [0, 360]. | |
| float | wrapDegrees_180 (float f) |
Returns f wrapped to the range [-180, 180]. | |
| u32 | myrand () |
| void | mysrand (u64 seed) |
| void | myrand_bytes (void *out, size_t len) |
| int | myrand_range (int min, int max) |
| float | myrand_range (float min, float max) |
| float | myrand_float () |
| u32 | get_bits (u32 x, u32 pos, u32 len) |
| void | set_bits (u32 *x, u32 pos, u32 len, u32 val) |
| u32 | calc_parity (u32 v) |
| u64 | murmur_hash_64_ua (const void *key, size_t len, unsigned int seed) |
| Calculate MurmurHash64A hash for an arbitrary block of data. | |
| bool | isBlockInSight (v3s16 blockpos_b, v3f camera_pos, v3f camera_dir, f32 camera_fov, f32 range, f32 *distance_ptr=nullptr) |
| s16 | adjustDist (s16 dist, float zoom_fov) |
| s32 | myround (f32 f) |
| template<typename T > | |
| constexpr T | sqr (T f) |
| v3s16 | floatToInt (v3f p, f32 d) |
| v3s16 | doubleToInt (v3d p, double d) |
| v3f | intToFloat (v3s16 p, f32 d) |
| aabb3f | getNodeBox (v3s16 p, float d) |
| constexpr bool | is_power_of_two (u32 n) |
| constexpr u32 | npot2 (u32 orig) |
| template<typename T > | |
| unsigned | wrappedDifference (T a, T b, const T maximum) |
| template<typename T > | |
| void | wrappedApproachShortest (T ¤t, const T target, const T stepsize, const T maximum) |
| void | setPitchYawRollRad (core::matrix4 &m, v3f rot) |
| void | setPitchYawRoll (core::matrix4 &m, v3f rot) |
| v3f | getPitchYawRollRad (const core::matrix4 &m) |
| v3f | getPitchYawRoll (const core::matrix4 &m) |
| video::SColor | multiplyColorValue (const video::SColor &color, float mod) |
| template<typename T > | |
| constexpr T | numericAbsolute (T v) |
| template<typename T > | |
| constexpr T | numericSign (T v) |
| template<typename T > | |
| constexpr core::vector3d< T > | vecAbsolute (const core::vector3d< T > &v) |
| template<typename T > | |
| constexpr core::vector3d< T > | vecSign (const core::vector3d< T > &v) |
Variables | |
| static constexpr const f32 | BLOCK_MAX_RADIUS = 0.866025403784f * MAP_BLOCKSIZE * BS |
| #define MYRAND_RANGE 0xffffffff |
Referenced by MyRandGenerator::max().
| s16 adjustDist | ( | s16 | dist, |
| float | zoom_fov ) |
|
inline |
Referenced by ObjDefManager::createHandle(), and ObjDefManager::decodeHandle().
Here is the caller graph for this function:
|
inlineconstexpr |
Referenced by add_object_boxes(), blit_with_alpha2(), and MinimapUpdateThread::getMap().
Here is the caller graph for this function:
|
inlineconstexpr |
|
inlineconstexpr |
Referenced by add_object_boxes(), blit_with_alpha2(), and MinimapUpdateThread::getMap().
Here is the caller graph for this function:
|
inlineconstexpr |
References p().
Referenced by check_v3s16(), ModApiEnv::l_get_node_raw(), and read_v3s16().
Here is the call graph for this function:
Here is the caller graph for this function:References p().
Referenced by SmokePuffCSO::SmokePuffCSO(), voxalgo::VoxelLineIterator::VoxelLineIterator(), ServerEnvironment::addActiveObjectRaw(), collision_check_intersection(), collisionMoveSimple(), Environment::continueRaycast(), Client::CSMClampPos(), Client::CSMClampRadius(), Client::CSMGetNode(), ServerEnvironment::deactivateFarObjects(), ClientMap::getBackgroundBrightness(), LuaEntitySAO::getDescription(), LocalPlayer::getFootstepNodePos(), GenericCAO::getLightPosition(), LocalPlayer::getLightPosition(), RemoteClient::GetNextBlocks(), getVisibleBrightness(), LocalPlayer::handleAutojump(), Map::isOccluded(), LocalPlayer::move(), Game::nodePlacement(), LocalPlayer::old_move(), ClientMap::renderPostFx(), Server::sendMetadataChanged(), GenericCAO::step(), PlayerSAO::step(), TestSAO::testActivate(), TestSAO::testNotSaved(), TestSAO::testStaticSave(), TestSAO::testStaticToFalse(), TestSAO::testStaticToTrue(), TestVoxelAlgorithms::testVoxelLineIterator(), ClientMap::touchMapBlocks(), ActiveBlockList::update(), Camera::update(), Minimap::updateActiveMarkers(), ClientMap::updateCamera(), ClientMap::updateDrawList(), Game::updateFrame(), Game::updatePointedThing(), and LocalPlayer::updateSneakNode().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
References x.
Referenced by ObjDefManager::decodeHandle().
Here is the caller graph for this function:
|
inline |
References p().
Referenced by RollbackAction::applyRevert(), Hud::drawBlockBounds(), AreaStore::getAreasForPos(), getContainerPos(), getContainerPos(), getContainerPos(), getContainerPos(), EmergeManager::getContainingChunk(), getNodeBlockPos(), ModApiEnv::l_fix_light(), ClientMap::updateCamera(), and ClientMap::updateDrawList().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
References p().
Referenced by getContainerPosWithOffset(), getContainerPosWithOffset(), and getNodeBlockPosWithOffset().
Here is the call graph for this function:
Here is the caller graph for this function:References p().
Referenced by add_area_node_boxes().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
References getPitchYawRollRad().
Referenced by roundTripsDeg(), and TestUtilities::testEulerConversion().
Here is the call graph for this function:
Here is the caller graph for this function:| v3f getPitchYawRollRad | ( | const core::matrix4 & | m | ) |
Referenced by getPitchYawRoll(), and TestUtilities::testEulerConversion().
Here is the caller graph for this function:References p().
Referenced by MapBlockMesh::MapBlockMesh(), add_area_node_boxes(), Hud::calculateScreenPos(), Environment::continueRaycast(), Hud::drawBlockBounds(), MapblockMeshGenerator::drawNode(), Server::findSpawnPos(), Camera::getFrustumCuller(), GenericCAO::getPosition(), RollbackManager::getSuspectNearness(), Server::handleCommand_Interact(), Server::handleCommand_InventoryAction(), Map::isOccluded(), LocalPlayer::move(), LocalPlayer::old_move(), GameGlobalShaderUniformSetter::onSetUniforms(), Game::processPlayerInteraction(), Clouds::render(), ClientMap::renderMap(), ClientMap::renderMapShadows(), Server::sendAddNode(), Server::sendRemoveNode(), Hud::setSelectionPos(), TestVoxelAlgorithms::testVoxelLineIterator(), ClientMap::touchMapBlocks(), Camera::update(), Minimap::updateActiveMarkers(), GenericCAO::updateAttachments(), ClientMap::updateDrawList(), ClientMap::updateDrawListShadow(), GenericCAO::updateNodePos(), Game::updatePointedThing(), LocalPlayer::updateSneakNode(), Game::updateSound(), MapBlockMesh::updateTransparentBuffers(), ClientMap::updateTransparentMeshBuffers(), and Particle::updateVertices().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlineconstexpr |
Referenced by ExtrusionMeshCache::create(), and TestUtilities::testIsPowerOfTwo().
Here is the caller graph for this function:| bool isBlockInSight | ( | v3s16 | blockpos_b, |
| v3f | camera_pos, | ||
| v3f | camera_dir, | ||
| f32 | camera_fov, | ||
| f32 | range, | ||
| f32 * | distance_ptr = nullptr ) |
| blockpos_b | position of block in block coordinates |
| camera_pos | position of camera in nodes |
| camera_dir | an unit vector pointing to camera direction |
| range | viewing range |
| distance_ptr | return location for distance from the camera |
References BLOCK_MAX_RADIUS, BS, and MAP_BLOCKSIZE.
Referenced by fillViewConeBlock(), RemoteClient::GetNextBlocks(), and TestUtilities::testIsBlockInSight().
Here is the caller graph for this function:
|
inlinenodiscard |
Returns f wrapped to the range [-360, 360].
See test.cpp for example cases.
Referenced by Server::process_PlayerPos(), GenericCAO::step(), LuaEntitySAO::step(), TestUtilities::testAngleWrapAround(), wrapDegrees_0_360(), wrapDegrees_0_360_v3f(), and wrapDegrees_180().
Here is the caller graph for this function:
|
inline |
|
nodiscard |
Calculate MurmurHash64A hash for an arbitrary block of data.
| key | data to hash (does not need to be aligned) |
| len | length in bytes |
| seed | initial seed value |
Referenced by check_field_or_nil(), getHashForString(), init_common(), ModApiBase::l_deprecated_function(), logOnce(), read_seed(), and script_log_unique().
Here is the caller graph for this function:| u32 myrand | ( | ) |
References g_pcgrand, and PcgRandom::next().
Referenced by Sky::Sky(), ObjDefManager::addRaw(), ScriptApiServer::allocateDynamicMediaCallback(), ISoundManager::allocateId(), ABMHandler::apply(), Game::createClient(), ImageSource::generateImagePart(), sound::OpenALSoundManager::getLoadedSoundNameFromGroup(), TestBase::getTestTempFile(), MyRandGenerator::operator()(), MapgenV6::placeTreesAndJungleGrass(), RandomInputHandler::Rand(), and UDPSocket::Send().
Here is the call graph for this function:
Here is the caller graph for this function:| void myrand_bytes | ( | void * | out, |
| size_t | len ) |
References PcgRandom::bytes(), and g_pcgrand.
Referenced by GUIDGenerator::GUIDGenerator(), httpfetch_caller_alloc_secure(), and MapgenParams::readParams().
Here is the call graph for this function:
Here is the caller graph for this function:| float myrand_float | ( | ) |
References g_pcgrand, PcgRandom::next(), and U32_MAX.
Referenced by ParticleSpawner::ParticleSpawner(), myrand_range(), ParticleParamTypes::RangedParameter< T >::pickWithin(), and ParticleSpawner::step().
Here is the call graph for this function:
Here is the caller graph for this function:| float myrand_range | ( | float | min, |
| float | max ) |
| int myrand_range | ( | int | min, |
| int | max ) |
References g_pcgrand, and PcgRandom::range().
Referenced by ABMWithState::ABMWithState(), ParticleManager::addNodeParticle(), MapBlockMesh::animate(), benchGetObjectsInArea(), ParticleParamTypes::TweenedParameter< T >::blend(), Schematic::blitToVManip(), con::Connection::createPeer(), Server::findSpawnPos(), ClientMap::getBackgroundBrightness(), ParticleManager::getNodeParticleParams(), Map::isBlockOccluded(), ClientLauncher::launch_game(), Schematic::placeOnMap(), Schematic::placeOnVManip(), MapgenV6::placeTreesAndJungleGrass(), readRandomBlocks(), and ParticleSpawner::spawnParticle().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlinenodiscard |
Referenced by GUIChatConsole::GUIChatConsole(), Hud::Hud(), Camera::drawNametags(), Server::ShutdownState::getShutdownTimerMessage(), GUIChatConsole::OnEvent(), Game::processKeyInput(), PcgRandom::randNormalDist(), GUIFormSpecMenu::regenerateGui(), Server::requestShutdown(), ParsedText::Element::setStyle(), GUITable::setTable(), TestUtilities::testMyround(), TestRandom::testPcgRandomNormalDist(), treegen::tree_fruit_placement(), treegen::tree_leaves_placement(), treegen::tree_single_leaves_placement(), and treegen::tree_trunk_placement().
Here is the caller graph for this function:| void mysrand | ( | u64 | seed | ) |
References g_pcgrand, and PcgRandom::seed().
Referenced by init_common().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlineconstexpr |
Referenced by createInventoryCubeImage(), and guiScalingResizeCached().
Here is the caller graph for this function:
|
inlineconstexpr |
Referenced by ParticleParamTypes::RangedParameter< T >::pickWithin(), ParticleSpawner::spawnParticle(), and vecAbsolute().
Here is the caller graph for this function:
|
inlineconstexpr |
Referenced by ParticleSpawner::spawnParticle(), and vecSign().
Here is the caller graph for this function:
|
inlinenodiscardconstexpr |
Referenced by EmergeManager::EmergeManager(), GUIChatConsole::GUIChatConsole(), Hud::Hud(), MeshUpdateManager::MeshUpdateManager(), MeshUpdateWorkerThread::MeshUpdateWorkerThread(), ServerEnvironment::ServerEnvironment(), ServerMap::ServerMap(), Sky::Sky(), Camera::addArmInertia(), ChatBackend::applySettings(), MapgenV6::baseTerrainLevel(), MapgenV7::baseTerrainLevelAtPoint(), MapgenV7::baseTerrainLevelFromMap(), ServerMap::blockpos_over_mapgen_limit(), ClientLauncher::config_guienv(), RenderingEngine::draw_load_screen(), Hud::drawBlockBounds(), Camera::drawNametags(), Map::forEachNodeInArea(), ImageSource::generateImagePart(), get_mapgen_edges(), Settings::getFloat(), getHitParams(), getInteriorLight(), MapblockMeshGenerator::getLiquidNeighborhood(), RemoteClient::GetNextBlocks(), Server::getProtocolVersionMin(), getSmoothLightCombined(), Game::handleClientEvent_PlayerDamage(), Game::handleClientEvent_SetSky(), imageScaleNNAA(), GameUI::init(), FontEngine::initFont(), ObjectRef::l_set_eye_offset(), ObjectRef::l_set_lighting(), ObjectRef::l_set_minimap_modes(), ObjectRef::l_set_sky(), CavesRandomWalk::makeCave(), CavesV6::makeCave(), LocalPlayer::move(), LocalPlayer::old_move(), GUITable::OnEvent(), JoystickController::onJoystickConnect(), ParsedText::parseTag(), read_item_definition(), read_object_properties(), MapgenParams::readParams(), Clouds::readSettings(), FontEngine::readSettings(), Game::readSettings(), TextureSettings::readSettings(), recompress_map_database(), Server::SendBlockNoLock(), ToolCapabilities::serialize(), Sky::setBodyOrbitTilt(), PlayerSAO::setBreath(), LuaEntitySAO::setHP(), PlayerSAO::setHP(), con::Channel::setWindowSize(), sound_volume_control(), takeScreenshot(), Camera::update(), Sky::update(), and Game::updateCameraOrientation().
|
inline |
References x.
Referenced by ObjDefManager::createHandle(), and ObjDefManager::decodeHandle().
Here is the caller graph for this function:
|
inline |
References setPitchYawRollRad().
Referenced by UnitSAO::getTotalRotation(), roundTripsDeg(), TestUtilities::testEulerConversion(), and GenericCAO::updateNodePos().
Here is the call graph for this function:
Here is the caller graph for this function:| void setPitchYawRollRad | ( | core::matrix4 & | m, |
| v3f | rot ) |
Referenced by setPitchYawRoll(), TEST_CASE(), and TestUtilities::testEulerConversion().
Here is the caller graph for this function:
|
inline |
Referenced by Area::Area(), Map::findNodesWithMetadata(), LuaVoxelManip::l_calc_lighting(), ModApiMapgen::l_create_schematic(), ModApiEnv::l_delete_area(), ModApiEnv::l_emerge_area(), ModApiEnv::l_find_nodes_in_area(), ModApiEnvVM::l_find_nodes_in_area(), ModApiEnv::l_find_nodes_in_area_under_air(), ModApiEnvVM::l_find_nodes_in_area_under_air(), ModApiMapgen::l_generate_decorations(), ModApiMapgen::l_generate_ores(), LuaAreaStore::l_get_areas_in_area(), LuaVoxelManip::l_initialize(), ModApiEnv::l_load_area(), LuaVoxelManip::l_read_from_map(), and LuaVoxelManip::l_set_lighting().
Here is the caller graph for this function:
|
inlinenodiscardconstexpr |
|
inlineconstexpr |
References numericAbsolute().
Referenced by Particle::step().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlineconstexpr |
References numericSign().
Referenced by Particle::step().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlinenodiscard |
Returns f wrapped to the range [0, 360].
References modulo360f().
Referenced by Server::process_PlayerPos(), GenericCAO::step(), LuaEntitySAO::step(), TestUtilities::testAngleWrapAround(), GameUI::update(), Sky::update(), and yawToDirectionString().
Here is the call graph for this function:
Here is the caller graph for this function:Returns v3f wrapped to the range [0, 360].
References modulo360f().
Referenced by GenericCAO::processInitData(), GenericCAO::processMessage(), and TestUtilities::testWrapDegrees_0_360_v3f().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlinenodiscard |
Returns f wrapped to the range [-180, 180].
References modulo360f().
Referenced by TestUtilities::testAngleWrapAround(), GameUI::update(), and GenericCAO::updateTextureAnim().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Referenced by GenericCAO::step(), LuaEntitySAO::step(), SmoothTranslatorWrapped::translate(), and SmoothTranslatorWrappedv3f::translate().
Here is the caller graph for this function:
|
inline |
|
staticconstexpr |
Referenced by isBlockInSight().