Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
VoxelArea Class Reference

#include <voxel.h>

Public Member Functions

constexpr VoxelArea ()=default
 
 VoxelArea (const v3s16 &min_edge, const v3s16 &max_edge)
 
 VoxelArea (const v3s16 &p)
 
void addArea (const VoxelArea &a)
 
void addPoint (const v3s16 &p)
 
void pad (const v3s16 &d)
 
const v3s16getExtent () const
 
bool hasEmptyExtent () const
 
s32 getVolume () const
 
bool contains (const VoxelArea &a) const
 
bool contains (v3s16 p) const
 
bool contains (s32 i) const
 
bool operator== (const VoxelArea &other) const
 
VoxelArea operator+ (const v3s16 &off) const
 
VoxelArea operator- (const v3s16 &off) const
 
VoxelArea intersect (const VoxelArea &a) const
 
template<typename C >
void diff (const VoxelArea &a, C &result) const
 Returns 0-6 non-overlapping areas that can be added to a to make up this area.
 
s32 index (s16 x, s16 y, s16 z) const
 
s32 index (v3s16 p) const
 
void print (std::ostream &o) const
 

Static Public Member Functions

static void add_x (const v3s16 &extent, u32 &i, s16 a)
 Translate index in the X coordinate.
 
static void add_y (const v3s16 &extent, u32 &i, s16 a)
 Translate index in the Y coordinate.
 
static void add_z (const v3s16 &extent, u32 &i, s16 a)
 Translate index in the Z coordinate.
 
static void add_p (const v3s16 &extent, u32 &i, v3s16 a)
 Translate index in space.
 

Public Attributes

v3s16 MinEdge = v3s16(1,1,1)
 Minimum edge of the area (inclusive)
 
v3s16 MaxEdge
 Maximum edge of the area (inclusive)
 

Private Member Functions

void cacheExtent ()
 

Private Attributes

v3s16 m_cache_extent = v3s16(0,0,0)
 

Constructor & Destructor Documentation

◆ VoxelArea() [1/3]

VoxelArea::VoxelArea ( )
constexprdefault

Referenced by intersect().

+ Here is the caller graph for this function:

◆ VoxelArea() [2/3]

VoxelArea::VoxelArea ( const v3s16 & min_edge,
const v3s16 & max_edge )
inline

References cacheExtent().

+ Here is the call graph for this function:

◆ VoxelArea() [3/3]

VoxelArea::VoxelArea ( const v3s16 & p)
inline

References cacheExtent().

+ Here is the call graph for this function:

Member Function Documentation

◆ add_p()

static void VoxelArea::add_p ( const v3s16 & extent,
u32 & i,
v3s16 a )
inlinestatic

Translate index in space.

Referenced by MapgenV6::flowMud(), and TestVoxelArea::test_add_p().

+ Here is the caller graph for this function:

◆ add_x()

static void VoxelArea::add_x ( const v3s16 & extent,
u32 & i,
s16 a )
inlinestatic

Translate index in the X coordinate.

Referenced by Mapgen::isLiquidHorizontallyFlowable(), and TestVoxelArea::test_add_x().

+ Here is the caller graph for this function:

◆ add_y()

◆ add_z()

static void VoxelArea::add_z ( const v3s16 & extent,
u32 & i,
s16 a )
inlinestatic

Translate index in the Z coordinate.

Referenced by Mapgen::isLiquidHorizontallyFlowable(), and TestVoxelArea::test_add_z().

+ Here is the caller graph for this function:

◆ addArea()

void VoxelArea::addArea ( const VoxelArea & a)
inline

References cacheExtent(), hasEmptyExtent(), MaxEdge, and MinEdge.

Referenced by VoxelManipulator::addArea(), and TestVoxelArea::test_addarea().

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

◆ addPoint()

void VoxelArea::addPoint ( const v3s16 & p)
inline

References cacheExtent(), hasEmptyExtent(), MaxEdge, MinEdge, and p().

Referenced by MapEditEvent::getArea().

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

◆ cacheExtent()

void VoxelArea::cacheExtent ( )
inlineprivate

References m_cache_extent, MaxEdge, and MinEdge.

Referenced by VoxelArea(), VoxelArea(), addArea(), and addPoint().

+ Here is the caller graph for this function:

◆ contains() [1/3]

bool VoxelArea::contains ( const VoxelArea & a) const
inline

References hasEmptyExtent(), MaxEdge, and MinEdge.

Referenced by VoxelManipulator::addArea(), Schematic::blitToVManip(), ModApiMapgen::calc_lighting(), Decoration::canPlaceDecoration(), CavesRandomWalk::carveRoute(), CavesV6::carveRoute(), VoxelManipulator::clearFlags(), diff(), VoxelManipulator::exists(), Map::findNodesWithMetadata(), DungeonGen::findPlaceForDoor(), DungeonGen::findPlaceForRoomDoor(), OrePuff::generate(), OreSheet::generate(), OreStratum::generate(), OreVein::generate(), VoxelManipulator::getNodeNoExNoEmerge(), LuaVoxelManip::l_calc_lighting(), LuaVoxelManip::l_set_lighting(), Mapgen::lightSpread(), treegen::make_jungletree(), treegen::make_pine_tree(), treegen::make_tree(), DungeonGen::makeCorridor(), DungeonGen::makeFill(), DungeonGen::makeRoom(), MapgenV6::moveMud(), Server::onMapEditEvent(), Schematic::placeOnVManip(), ModApiMapgen::set_lighting(), VoxelManipulator::setFlags(), VoxelManipulator::setNodeNoEmerge(), TestVoxelArea::test_contains_i(), TestVoxelArea::test_contains_point(), TestVoxelArea::test_contains_voxelarea(), treegen::tree_fruit_placement(), treegen::tree_leaves_placement(), treegen::tree_single_leaves_placement(), treegen::tree_trunk_placement(), and ServerMap::updateVManip().

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

◆ contains() [2/3]

bool VoxelArea::contains ( s32 i) const
inline

References getVolume().

+ Here is the call graph for this function:

◆ contains() [3/3]

bool VoxelArea::contains ( v3s16 p) const
inline

References MaxEdge, MinEdge, and p().

+ Here is the call graph for this function:

◆ diff()

template<typename C >
void VoxelArea::diff ( const VoxelArea & a,
C & result ) const
inline

Returns 0-6 non-overlapping areas that can be added to a to make up this area.

Template Parameters
Ccontainer that has push_back
Parameters
aarea inside *this

References contains(), getVolume(), hasEmptyExtent(), MaxEdge, and MinEdge.

Referenced by TestVoxelArea::test_diff(), and TestVoxelManipulator::testVoxelArea().

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

◆ getExtent()

◆ getVolume()

◆ hasEmptyExtent()

bool VoxelArea::hasEmptyExtent ( ) const
inline
Note
getVolume() == 0 and getEmptyExtent() are not identical.

References m_cache_extent.

Referenced by addArea(), VoxelManipulator::addArea(), addPoint(), voxalgo::blit_back_with_light(), MMVManip::blitBackAll(), VoxelManipulator::clearFlags(), contains(), diff(), and VoxelManipulator::setFlags().

+ Here is the caller graph for this function:

◆ index() [1/2]

s32 VoxelArea::index ( s16 x,
s16 y,
s16 z ) const
inline

References m_cache_extent, and MinEdge.

Referenced by VoxelManipulator::addArea(), MapgenV6::addMud(), Schematic::blitToVManip(), Decoration::canPlaceDecoration(), CavesRandomWalk::carveRoute(), CavesV6::carveRoute(), VoxelManipulator::clearFlags(), VoxelManipulator::copyFrom(), VoxelManipulator::copyTo(), MapgenBasic::dustTopNodes(), voxalgo::fill_with_sunlight(), MapgenV6::find_stone_level(), Mapgen::findGroundLevel(), Mapgen::findLiquidSurface(), DungeonGen::findPlaceForRoomDoor(), MapgenV6::flowMud(), DecoSimple::generate(), DungeonGen::generate(), OreBlob::generate(), OrePuff::generate(), OreScatter::generate(), OreSheet::generate(), OreStratum::generate(), OreVein::generate(), MapgenV5::generateBaseTerrain(), MapgenBasic::generateBiomes(), CavernsNoise::generateCaverns(), CavesNoiseIntersection::generateCaves(), MapgenV6::generateGround(), MapgenCarpathian::generateTerrain(), MapgenFlat::generateTerrain(), MapgenFractal::generateTerrain(), MapgenV7::generateTerrain(), MapgenValleys::generateTerrain(), VoxelManipulator::getFlagsRefUnsafe(), VoxelManipulator::getNode(), VoxelManipulator::getNodeNoEx(), VoxelManipulator::getNodeNoExNoEmerge(), VoxelManipulator::getNodeRefUnsafe(), VoxelManipulator::getNodeRefUnsafeCheckFlags(), Schematic::getSchematicFromMap(), Mapgen::getSurfaces(), MapgenV6::growGrass(), index(), Mapgen::lightSpread(), treegen::make_jungletree(), treegen::make_pine_tree(), treegen::make_tree(), MapgenSinglenode::makeChunk(), DungeonGen::makeCorridor(), DungeonGen::makeDoor(), DungeonGen::makeDungeon(), DungeonGen::makeFill(), DungeonGen::makeRoom(), MapgenV6::placeTreesAndJungleGrass(), VoxelManipulator::print(), Mapgen::propagateSunlight(), VoxelManipulator::setFlags(), Mapgen::setLighting(), VoxelManipulator::setNode(), VoxelManipulator::setNodeNoEmerge(), Mapgen::spreadLight(), TestVoxelArea::test_index_v3s16_all_neg(), TestVoxelArea::test_index_v3s16_all_pos(), TestVoxelArea::test_index_v3s16_x_neg(), TestVoxelArea::test_index_v3s16_xy_neg(), TestVoxelArea::test_index_v3s16_xz_neg(), TestVoxelArea::test_index_v3s16_y_neg(), TestVoxelArea::test_index_v3s16_yz_neg(), TestVoxelArea::test_index_v3s16_z_neg(), TestVoxelArea::test_index_xyz_all_neg(), TestVoxelArea::test_index_xyz_all_pos(), TestVoxelArea::test_index_xyz_x_neg(), TestVoxelArea::test_index_xyz_xy_neg(), TestVoxelArea::test_index_xyz_xz_neg(), TestVoxelArea::test_index_xyz_y_neg(), TestVoxelArea::test_index_xyz_yz_neg(), TestVoxelArea::test_index_xyz_z_neg(), TestVoxelManipulator::testVoxelArea(), treegen::tree_fruit_placement(), treegen::tree_leaves_placement(), treegen::tree_single_leaves_placement(), treegen::tree_trunk_placement(), Mapgen::updateLiquid(), and ServerMap::updateVManip().

◆ index() [2/2]

s32 VoxelArea::index ( v3s16 p) const
inline

References index(), and p().

+ Here is the call graph for this function:

◆ intersect()

VoxelArea VoxelArea::intersect ( const VoxelArea & a) const
inline

References VoxelArea(), MaxEdge, and MinEdge.

Referenced by ModApiEnvVM::l_find_nodes_in_area().

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

◆ operator+()

VoxelArea VoxelArea::operator+ ( const v3s16 & off) const
inline

References MaxEdge, and MinEdge.

◆ operator-()

VoxelArea VoxelArea::operator- ( const v3s16 & off) const
inline

References MaxEdge, and MinEdge.

◆ operator==()

bool VoxelArea::operator== ( const VoxelArea & other) const
inline

References MaxEdge, and MinEdge.

◆ pad()

void VoxelArea::pad ( const v3s16 & d)
inline

References MaxEdge, and MinEdge.

Referenced by TestVoxelArea::test_pad().

+ Here is the caller graph for this function:

◆ print()

void VoxelArea::print ( std::ostream & o) const
inline

References getVolume(), m_cache_extent, MaxEdge, and MinEdge.

Referenced by MMVManip::initialEmerge().

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

Member Data Documentation

◆ m_cache_extent

v3s16 VoxelArea::m_cache_extent = v3s16(0,0,0)
private

◆ MaxEdge

◆ MinEdge


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