Developer Documentation
ACG::SceneGraph::DrawModes::DrawMode Class Reference

Specifies a DrawMode. More...

#include <OpenFlipper/libs_required/ACG/Scenegraph/DrawModes.hh>

Public Member Functions

 DrawMode (const DrawMode &)=default
 
 DrawMode (size_t _index)
 constructor for unsigned int. More...
 
 DrawMode (const ModeFlagSet &_flags)
 constructor for ModeFlags. More...
 
size_t getIndex () const
 get an index of the current drawMode More...
 
void filter (DrawMode _filter)
 filter out one drawmode More...
 
void combine (DrawMode _mode)
 combine with another drawmode
 
std::string description () const
 
bool isAtomic () const
 Check if this is an atomic draw Mode. More...
 
bool containsAtomicDrawMode (const DrawMode &_atomicDrawMode) const
 Check whether an Atomic DrawMode is active in this draw Mode.
 
std::vector< DrawModegetAtomicDrawModes () const
 Separates this drawMode into a list of all separate atomic draw modes. More...
 
size_t maxModes () const
 Get the number of maximum Modes which could be handled by the current implementation.
 
const DrawModePropertiesgetDrawModeProperties () const
 returns the base properties of this draw mode More...
 
void setDrawModeProperties (const DrawModeProperties *_props)
 set the base properties of this draw mode More...
 
void setDrawModeProperties (const DrawModeProperties &_props)
 set the base properties of this draw mode More...
 
bool checkConsistency () const
 checks consistency of property layers More...
 
int getLayerIndexByPrimitive (DrawModePrimitive _type) const
 search for layer with specified primitive More...
 
Operators
DrawModeoperator= (const DrawMode &_mode)=default
 
bool operator== (const DrawMode &_mode) const
 
DrawMode operator & (const DrawMode &_mode) const
 
DrawModeoperator++ ()
 
DrawModeoperator|= (const DrawMode &_mode2)
 
DrawModeoperator &= (const DrawMode &_mode2)
 
bool operator!= (const DrawMode &_mode2) const
 
DrawMode operator| (const DrawMode &_mode2) const
 
DrawMode operator^ (const DrawMode &_mode2) const
 
DrawMode operator~ () const
 
 operator bool () const
 
Layer Management
void addLayer (const DrawModeProperties *_props)
 add another layer on top of this drawmode More...
 
size_t getNumLayers () const
 returns the layer count
 
const DrawModePropertiesgetLayer (unsigned int _i) const
 returns the property set at layer i More...
 
bool removeLayer (unsigned int _i)
 remove layer at index i More...
 
bool removeLayer (const DrawModeProperties *_prop)
 remove layer if it is in list More...
 
int getLayerIndex (const DrawModeProperties *_prop) const
 returns layer index of a property, -1 if not in list More...
 

Static Public Member Functions

static DrawMode getFromDescription (std::string _description)
 

Private Attributes

ModeFlagSet modeFlags_
 
std::vector< DrawModePropertieslayers_
 

Detailed Description

Specifies a DrawMode.

This class specifies a DrawMode. It can contain several properties and layers that define, how objects will be rendered.

Definition at line 288 of file DrawModes.hh.

Constructor & Destructor Documentation

◆ DrawMode() [1/2]

ACG::SceneGraph::DrawModes::DrawMode::DrawMode ( size_t  _index)
explicit

constructor for unsigned int.

This constructor creates a DrawMode with the given drawMode index. Be CareFull! this constructor can only be used to construct atomic draw modes! The int will not be handled like an bitset but really as an index. See the list of draw modes below to check for the right numbers. You should use the predefined drawModes or create new ones using the other functions and ignore this constructor!

Parameters
_indexIndex of the new DrawMode

Definition at line 188 of file DrawModes.cc.

◆ DrawMode() [2/2]

ACG::SceneGraph::DrawModes::DrawMode::DrawMode ( const ModeFlagSet &  _flags)
explicit

constructor for ModeFlags.

This constructor creates a DrawMode from a bitset. This makes it easier to predefine draw modes using a bitset.

Parameters
_flagsFlags for the new drawmode defined by a bitset

Definition at line 205 of file DrawModes.cc.

Member Function Documentation

◆ addLayer()

void ACG::SceneGraph::DrawModes::DrawMode::addLayer ( const DrawModeProperties _props)

add another layer on top of this drawmode

This allows for combinations of DrawModes. The renderer will iterator over all layers of the drawmode and issue a new draw call for each layer. Example: layer 0 : flat shading properties layer 1 : edge drawing properties

The result will be a flat shaded object with it's wireframe on top of it. Does duplicate check, in case the property set is already in the layer list.

addLayer is also called in bitwise | operator for backwards compatibility with bitset DrawModes

Parameters
_propsProperty that should be added

Definition at line 532 of file DrawModes.cc.

◆ checkConsistency()

bool ACG::SceneGraph::DrawModes::DrawMode::checkConsistency ( ) const

checks consistency of property layers

There should only be at most one layer for each primitive type for example

Definition at line 565 of file DrawModes.cc.

◆ description()

std::string ACG::SceneGraph::DrawModes::DrawMode::description ( ) const

Get a description string for this DrawMode An empty string is returned if this is not a valid draw mode. this list has the format DrawModeName+DrawMOdeName+...

Definition at line 436 of file DrawModes.cc.

◆ filter()

void ACG::SceneGraph::DrawModes::DrawMode::filter ( DrawMode  _filter)

filter out one drawmode

This removes one or more drawmodes if this drawode is not atomic.

Definition at line 455 of file DrawModes.cc.

◆ getAtomicDrawModes()

std::vector< DrawMode > ACG::SceneGraph::DrawModes::DrawMode::getAtomicDrawModes ( ) const

Separates this drawMode into a list of all separate atomic draw modes.

A drawMode can consist of several atomic draw modes. This function returns a list of the separated atomic draw modes.

Definition at line 487 of file DrawModes.cc.

◆ getDrawModeProperties()

const DrawModeProperties * ACG::SceneGraph::DrawModes::DrawMode::getDrawModeProperties ( ) const

returns the base properties of this draw mode

Base properties are the original properties that defined the DrawMode before any merge operation. They are located at layer 0, so actually this function has the same effect as getLayer(0).

Every DrawMode is property based with only two exceptions:

  • NONE
  • DEFAULT

getDrawModeProperties returns 0 for these.

Definition at line 559 of file DrawModes.cc.

◆ getIndex()

size_t ACG::SceneGraph::DrawModes::DrawMode::getIndex ( ) const

get an index of the current drawMode

If this drawMode is a combination of different drawModes, the returned value will be 0. Otherwise the internal flag index will be returned

Definition at line 426 of file DrawModes.cc.

◆ getLayer()

const DrawModeProperties * ACG::SceneGraph::DrawModes::DrawMode::getLayer ( unsigned int  _i) const

returns the property set at layer i

Parameters
_iLayer that is requested

Definition at line 527 of file DrawModes.cc.

◆ getLayerIndex()

int ACG::SceneGraph::DrawModes::DrawMode::getLayerIndex ( const DrawModeProperties _prop) const

returns layer index of a property, -1 if not in list

Parameters
_propProperty to be searched for

Definition at line 603 of file DrawModes.cc.

◆ getLayerIndexByPrimitive()

int ACG::SceneGraph::DrawModes::DrawMode::getLayerIndexByPrimitive ( DrawModePrimitive  _type) const

search for layer with specified primitive

Parameters
_typeprimitive type
Returns
layer id if layer exists, -1 otherwise

Definition at line 618 of file DrawModes.cc.

◆ isAtomic()

bool ACG::SceneGraph::DrawModes::DrawMode::isAtomic ( ) const

Check if this is an atomic draw Mode.

This function checks, if this is a atomic draw mode ( no combination of multiple draw modes )

Definition at line 504 of file DrawModes.cc.

◆ removeLayer() [1/2]

bool ACG::SceneGraph::DrawModes::DrawMode::removeLayer ( unsigned int  _i)

remove layer at index i

Parameters
_iLayer that is requested

Definition at line 538 of file DrawModes.cc.

◆ removeLayer() [2/2]

bool ACG::SceneGraph::DrawModes::DrawMode::removeLayer ( const DrawModeProperties _prop)

remove layer if it is in list

Parameters
_propProperty that should be removed if it's available

Definition at line 549 of file DrawModes.cc.

◆ setDrawModeProperties() [1/2]

void ACG::SceneGraph::DrawModes::DrawMode::setDrawModeProperties ( const DrawModeProperties _props)

set the base properties of this draw mode

Parameters
_propsProperties to be set

Definition at line 251 of file DrawModes.cc.

◆ setDrawModeProperties() [2/2]

void ACG::SceneGraph::DrawModes::DrawMode::setDrawModeProperties ( const DrawModeProperties _props)

set the base properties of this draw mode

Parameters
_propsProperties to be set

Definition at line 263 of file DrawModes.cc.

Member Data Documentation

◆ layers_

std::vector<DrawModeProperties> ACG::SceneGraph::DrawModes::DrawMode::layers_
private

vector for combined DrawModes -> holds DrawModeProperties for each layer -> original layer at index 0

Definition at line 500 of file DrawModes.hh.


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