public

Inheritance Graph

graph BT
	BudgetAnnotationState
	BudgetAnnotationState --> NodeRendererState
	click BudgetAnnotationState "classMinSG_1_1BudgetAnnotationState"
	click NodeRendererState "classMinSG_1_1NodeRendererState"

Description

Distribute a budget value among nodes of a tree.

When the state is enabled, it takes the initial budget value and starts to distribute the value to the node it is attached to and fractions of it to the child nodes. The function to calculate the fractions can be configured. The values are stored as attributes at the nodes. The name of the attribute can be configured, too.

Author: Benjamin Eikel

Date: 2012-11-16

Public Types

   
   
enum distribution_type_t {DISTRIBUTE_EVEN, DISTRIBUTE_PROJECTED_SIZE, DISTRIBUTE_PROJECTED_SIZE_AND_PRIMITIVE_COUNT, DISTRIBUTE_DELETE}

Public Static Functions

   
   
std::string distributionTypeToString( distribution_type_t type)
   
distribution_type_t distributionTypeFromString(const std::string & str)

Protected Functions

   
   
stateResult_t doEnableState( FrameContext & context, Node * node, const RenderParam & rp)
Register the node renderer at the configured channel.

Public Functions

   
   
  BudgetAnnotationState()
   
  ~BudgetAnnotationState()
   
NodeRendererResult displayNode( FrameContext & context, Node * node, const RenderParam & rp)
   
BudgetAnnotationState * clone() const
Create a duplicate of this State object.
   
const Util::StringIdentifier & getAnnotationAttribute() const
   
void setAnnotationAttribute(const Util::StringIdentifier & attribute)
   
double getBudget() const
   
void setBudget(double newBudget)
   
distribution_type_t getDistributionType() const
   
void setDistributionType( distribution_type_t type)

Documentation

enum
MinSG::BudgetAnnotationState::distribution_type_t

public
 
 
enum distribution_type_t
Enumerator   Description
Enumerator   Description
DISTRIBUTE_EVEN   For a node withkchild nodes, every child node receives a fraction of 1 /kof the budget.
DISTRIBUTE_PROJECTED_SIZE   Distribute the budget based on the projected size of the child nodes.
DISTRIBUTE_PROJECTED_SIZE_AND_PRIMITIVE_COUNT   Distribute the budget based on the projected size and the primitive count of the child nodes.
DISTRIBUTE_DELETE   Delete the attribute from all nodes.

Defined in MinSG/Ext/States/BudgetAnnotationState.h:38


function
MinSG::BudgetAnnotationState::distributionTypeToString

public static
     
     
std::string distributionTypeToString( distribution_type_t type )

Convert the value of an enumerator to a string.

Parameters

type
Value that will be converted to a string

Exceptions

std::invalid_argument
If the conversion of an unknown value is detected

Returns

Human-readable string

Defined in MinSG/Ext/States/BudgetAnnotationState.h:60


function
MinSG::BudgetAnnotationState::distributionTypeFromString

public static
     
     
distribution_type_t distributionTypeFromString( const std::string & str )

Convert the value of a string to an enumerator.

Parameters

str
Value that can be converted to an enumerator

Exceptions

std::invalid_argument
If the conversion of an unknown value is detected

Returns

Distribution type enumerator

Defined in MinSG/Ext/States/BudgetAnnotationState.h:69


function
MinSG::BudgetAnnotationState::doEnableState

protected virtual
     
     
stateResult_t doEnableState( FrameContext & context,
  Node * node,
  const RenderParam & rp
)    

Register the node renderer at the configured channel.

Defined in MinSG/Ext/States/BudgetAnnotationState.h:94


function
MinSG::BudgetAnnotationState::BudgetAnnotationState

public
   
   
BudgetAnnotationState( )

Defined in MinSG/Ext/States/BudgetAnnotationState.h:96


function
MinSG::BudgetAnnotationState::~BudgetAnnotationState

public virtual
   
   
~BudgetAnnotationState( )

Defined in MinSG/Ext/States/BudgetAnnotationState.h:98


function
MinSG::BudgetAnnotationState::displayNode

public virtual
     
     
NodeRendererResult displayNode( FrameContext & context,
  Node * node,
  const RenderParam & rp
)    

Node renderer function. This function is registered at the configured channel when the state is activated. This function has to be implemented by subclasses.

Defined in MinSG/Ext/States/BudgetAnnotationState.h:100


function
MinSG::BudgetAnnotationState::clone

public const virtual
   
   
BudgetAnnotationState * clone( ) const

Create a duplicate of this State object.

Defined in MinSG/Ext/States/BudgetAnnotationState.h:102


function
MinSG::BudgetAnnotationState::getAnnotationAttribute

public const inline
   
   
const Util::StringIdentifier & getAnnotationAttribute( ) const

Defined in MinSG/Ext/States/BudgetAnnotationState.h:104


function
MinSG::BudgetAnnotationState::setAnnotationAttribute

public inline
     
     
void setAnnotationAttribute( const Util::StringIdentifier & attribute )

Defined in MinSG/Ext/States/BudgetAnnotationState.h:107


function
MinSG::BudgetAnnotationState::getBudget

public const inline
   
   
double getBudget( ) const

Defined in MinSG/Ext/States/BudgetAnnotationState.h:111


function
MinSG::BudgetAnnotationState::setBudget

public inline
     
     
void setBudget( double newBudget )

Defined in MinSG/Ext/States/BudgetAnnotationState.h:114


function
MinSG::BudgetAnnotationState::getDistributionType

public const inline
   
   
distribution_type_t getDistributionType( ) const

Defined in MinSG/Ext/States/BudgetAnnotationState.h:118


function
MinSG::BudgetAnnotationState::setDistributionType

public
     
     
void setDistributionType( distribution_type_t type )

Defined in MinSG/Ext/States/BudgetAnnotationState.h:121