sKit  0.0.9
sKit::structure::BRectBase< Derived > Class Template Reference

The base class of BRect implemented as CRTP. Do not use directly. More...

#include <BRectBase.hpp>

Inheritance diagram for sKit::structure::BRectBase< Derived >:

Public Types

enum  Orientation { Orientation::VERTICAL, Orientation::HORIZONTAL }
 

Public Member Functions

 BRectBase ()=default
 
auto subdivide (unsigned int numLevels, glm::vec2 _id={0, 0}, SplitFn splitfn=BRectBase< Derived >::splitfn) -> void
 
auto getLeaves () -> std::vector< std::shared_ptr< Derived >>
 
auto getLeafAt (int x, int y) -> std::optional< std::shared_ptr< Derived >>
 

Public Attributes

std::shared_ptr< Derived > left
 
std::shared_ptr< Derived > right
 

Static Protected Member Functions

const static float splitfn (unsigned int _level, glm::vec2 _id)
 

Protected Attributes

Orientation orientation_ = Orientation::VERTICAL
 
float x_
 
float y_
 
float width_
 
float height_
 
glm::vec2 id
 
int levels
 
bool vertical
 

Detailed Description

template<typename Derived>
class sKit::structure::BRectBase< Derived >

The base class of BRect implemented as CRTP. Do not use directly.

Definition at line 13 of file BRectBase.hpp.

Member Enumeration Documentation

◆ Orientation

template<typename Derived >
enum sKit::structure::BRectBase::Orientation
strong
Enumerator
VERTICAL 
HORIZONTAL 

Definition at line 33 of file BRectBase.hpp.

Constructor & Destructor Documentation

◆ BRectBase()

template<typename Derived >
sKit::structure::BRectBase< Derived >::BRectBase ( )
default

Member Function Documentation

◆ getLeafAt()

template<typename Derived >
auto sKit::structure::BRectBase< Derived >::getLeafAt ( int  x,
int  y 
) -> std::optional<std::shared_ptr<Derived>>

Definition at line 90 of file BRectBase.hpp.

◆ getLeaves()

template<typename Derived >
auto sKit::structure::BRectBase< Derived >::getLeaves
Returns
All leaf nodes of the current BRect, i.e. nodes without left and without right children.

Definition at line 101 of file BRectBase.hpp.

◆ splitfn()

template<typename Derived >
const static float sKit::structure::BRectBase< Derived >::splitfn ( unsigned int  _level,
glm::vec2  _id 
)
inlinestaticprotected

The default function for generating the split value for subdividing rects.

Returns
0.5f

Definition at line 38 of file BRectBase.hpp.

◆ subdivide()

template<typename Derived >
auto sKit::structure::BRectBase< Derived >::subdivide ( unsigned int  numLevels,
glm::vec2  _id = {0, 0},
SplitFn  splitfn = BRectBase<Derived>::splitfn 
) -> void

Definition at line 51 of file BRectBase.hpp.

Member Data Documentation

◆ height_

template<typename Derived >
float sKit::structure::BRectBase< Derived >::height_
protected

Definition at line 43 of file BRectBase.hpp.

◆ id

template<typename Derived >
glm::vec2 sKit::structure::BRectBase< Derived >::id
protected

Definition at line 45 of file BRectBase.hpp.

◆ left

template<typename Derived >
std::shared_ptr<Derived> sKit::structure::BRectBase< Derived >::left

Definition at line 31 of file BRectBase.hpp.

◆ levels

template<typename Derived >
int sKit::structure::BRectBase< Derived >::levels
protected

Definition at line 46 of file BRectBase.hpp.

◆ orientation_

template<typename Derived >
Orientation sKit::structure::BRectBase< Derived >::orientation_ = Orientation::VERTICAL
protected

Definition at line 42 of file BRectBase.hpp.

◆ right

template<typename Derived >
std::shared_ptr<Derived> sKit::structure::BRectBase< Derived >::right

Definition at line 31 of file BRectBase.hpp.

◆ vertical

template<typename Derived >
bool sKit::structure::BRectBase< Derived >::vertical
protected

Definition at line 47 of file BRectBase.hpp.

◆ width_

template<typename Derived >
float sKit::structure::BRectBase< Derived >::width_
protected

Definition at line 43 of file BRectBase.hpp.

◆ x_

template<typename Derived >
float sKit::structure::BRectBase< Derived >::x_
protected

Definition at line 43 of file BRectBase.hpp.

◆ y_

template<typename Derived >
float sKit::structure::BRectBase< Derived >::y_
protected

Definition at line 43 of file BRectBase.hpp.


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