Minetest 5.9.0-dev
 
Loading...
Searching...
No Matches
MapBlockBspTree Class Reference

Implements a binary space partitioning tree See also: https://en.wikipedia.org/wiki/Binary_space_partitioning. More...

#include <mapblock_mesh.h>

+ Collaboration diagram for MapBlockBspTree:

Classes

struct  TreeNode
 

Public Member Functions

 MapBlockBspTree ()
 
void buildTree (const std::vector< MeshTriangle > *triangles, u16 side_lingth)
 
void traverse (v3f viewpoint, std::vector< s32 > &output) const
 

Private Member Functions

s32 buildTree (v3f normal, v3f origin, float delta, const std::vector< s32 > &list, u32 depth)
 
void traverse (s32 node, v3f viewpoint, std::vector< s32 > &output) const
 

Private Attributes

const std::vector< MeshTriangle > * triangles = nullptr
 
std::vector< TreeNodenodes
 
s32 root = -1
 

Detailed Description

Implements a binary space partitioning tree See also: https://en.wikipedia.org/wiki/Binary_space_partitioning.

Constructor & Destructor Documentation

◆ MapBlockBspTree()

MapBlockBspTree::MapBlockBspTree ( )
inline

Member Function Documentation

◆ buildTree() [1/2]

void MapBlockBspTree::buildTree ( const std::vector< MeshTriangle > *  triangles,
u16  side_lingth 
)

References BS, buildTree(), nodes, root, and triangles.

Referenced by MapBlockMesh::MapBlockMesh(), and buildTree().

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

◆ buildTree() [2/2]

s32 MapBlockBspTree::buildTree ( v3f  normal,
v3f  origin,
float  delta,
const std::vector< s32 > &  list,
u32  depth 
)
private

References buildTree(), MeshTriangle::centroid, findSplitCandidate(), MeshTriangle::getNormal(), nodes, and triangles.

+ Here is the call graph for this function:

◆ traverse() [1/2]

void MapBlockBspTree::traverse ( s32  node,
v3f  viewpoint,
std::vector< s32 > &  output 
) const
private

References MapBlockBspTree::TreeNode::back_ref, MapBlockBspTree::TreeNode::front_ref, nodes, MapBlockBspTree::TreeNode::normal, MapBlockBspTree::TreeNode::origin, traverse(), and MapBlockBspTree::TreeNode::triangle_refs.

+ Here is the call graph for this function:

◆ traverse() [2/2]

void MapBlockBspTree::traverse ( v3f  viewpoint,
std::vector< s32 > &  output 
) const
inline

References root, and traverse().

Referenced by traverse(), and MapBlockMesh::updateTransparentBuffers().

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

Member Data Documentation

◆ nodes

std::vector<TreeNode> MapBlockBspTree::nodes
private

Referenced by buildTree(), and traverse().

◆ root

s32 MapBlockBspTree::root = -1
private

Referenced by buildTree(), and traverse().

◆ triangles

const std::vector<MeshTriangle>* MapBlockBspTree::triangles = nullptr
private

Referenced by buildTree().


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