Luanti 5.16.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 v3s32getExtent () const
bool hasEmptyExtent () const
u32 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 v3s32 &extent, u32 &i, s16 a)
 Translate index in the X coordinate.
static void add_y (const v3s32 &extent, u32 &i, s16 a)
 Translate index in the Y coordinate.
static void add_z (const v3s32 &extent, u32 &i, s16 a)
 Translate index in the Z coordinate.
static void add_p (const v3s32 &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

v3s32 m_cache_extent

Static Private Attributes

static constexpr s32 MAX_EXTENT = S16_MAX - S16_MIN + 1

Constructor & Destructor Documentation

◆ VoxelArea() [1/3]

VoxelArea::VoxelArea ( )
constexprdefault

Referenced by addArea(), contains(), diff(), intersect(), operator+(), operator-(), and operator==().

Here is the caller graph for this function:

◆ VoxelArea() [2/3]

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

References cacheExtent(), MaxEdge, and MinEdge.

Here is the call graph for this function:

◆ VoxelArea() [3/3]

VoxelArea::VoxelArea ( const v3s16 & p)
inline

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

Here is the call graph for this function:

Member Function Documentation

◆ add_p()

void VoxelArea::add_p ( const v3s32 & 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()

void VoxelArea::add_x ( const v3s32 & 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()

void VoxelArea::add_z ( const v3s32 & 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 VoxelArea(), 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, MAX_EXTENT, MaxEdge, and MinEdge.

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

Here is the caller graph for this function:

◆ contains() [1/3]

◆ 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 VoxelArea(), contains(), hasEmptyExtent(), MaxEdge, and MinEdge.

Referenced by TestVoxelArea::test_diff().

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

◆ getExtent()

const v3s32 & VoxelArea::getExtent ( ) const
inline

◆ getVolume()

u32 VoxelArea::getVolume ( ) const
inline

◆ hasEmptyExtent()

bool VoxelArea::hasEmptyExtent ( ) const
inline

References m_cache_extent.

Referenced by addArea(), VoxelManipulator::addArea(), addPoint(), voxalgo::blit_back_with_light(), VoxelManipulator::clearFlags(), contains(), diff(), LuaVoxelManip::l_initialize(), VoxelManipulator::setFlags(), TestVoxelArea::test_extent(), TestVoxelManipulator::testBasic(), and TestVoxelManipulator::testEmerge().

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, MinEdge, x, y, and z.

Referenced by VoxelManipulator::addArea(), Schematic::blitToVManip(), Decoration::canPlaceDecoration(), VoxelManipulator::copyFrom(), VoxelManipulator::copyTo(), voxalgo::fill_with_sunlight(), DecoSimple::generate(), OreBlob::generate(), OrePuff::generate(), OreScatter::generate(), OreSheet::generate(), OreStratum::generate(), OreVein::generate(), CavernsNoise::generateCaverns(), CavesNoiseIntersection::generateCaves(), Schematic::getSchematicFromMap(), index(), treegen::make_jungletree(), treegen::make_pine_tree(), treegen::make_tree(), 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(), treegen::tree_fruit_placement(), treegen::tree_leaves_placement(), treegen::tree_single_leaves_placement(), treegen::tree_trunk_placement(), and ServerMap::updateVManip().

Here is the caller graph for this function:

◆ 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(), cacheExtent(), 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 VoxelArea(), MaxEdge, and MinEdge.

Here is the call graph for this function:

◆ operator-()

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

References VoxelArea(), MaxEdge, and MinEdge.

Here is the call graph for this function:

◆ operator==()

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

References VoxelArea(), MaxEdge, and MinEdge.

Here is the call graph for this function:

◆ pad()

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

References cacheExtent(), MaxEdge, and MinEdge.

Referenced by TestVoxelArea::test_pad().

Here is the call graph for this function:
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

v3s32 VoxelArea::m_cache_extent
private

◆ MAX_EXTENT

s32 VoxelArea::MAX_EXTENT = S16_MAX - S16_MIN + 1
staticconstexprprivate

Referenced by cacheExtent().

◆ MaxEdge

◆ MinEdge


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