Developer Documentation
ACG::SceneGraph::DrawModes Namespace Reference

Classes

class  DrawMode
 Specifies a DrawMode. More...
 
class  DrawModeInternal
 Definition of a draw mode. More...
 
class  DrawModeProperties
 DrawModeProperties stores a set of properties that defines, how to render an object. More...
 

Typedefs

typedef std::vector< DrawModeInternalVecDrawModes
 
typedef std::bitset< 128 > ModeFlagSet
 

Enumerations

enum  DrawModeLightStage { LIGHTSTAGE_UNLIT, LIGHTSTAGE_SMOOTH, LIGHTSTAGE_PHONG }
 Lighting stage of a mesh: unlit, smooth, phong. More...
 
enum  DrawModePrimitive {
  PRIMITIVE_POINT, PRIMITIVE_EDGE, PRIMITIVE_HALFEDGE, PRIMITIVE_WIREFRAME,
  PRIMITIVE_HIDDENLINE, PRIMITIVE_POLYGON, PRIMITIVE_CELL
}
 Primitive mode of a mesh. More...
 
enum  DrawModeColorSource {
  COLOR_NONE, COLOR_PER_VERTEX, COLOR_PER_EDGE, COLOR_PER_HALFEDGE,
  COLOR_PER_FACE
}
 Source of Primitive Colors. More...
 
enum  DrawModeTexCoordSource { TEXCOORD_NONE, TEXCOORD_PER_VERTEX, TEXCOORD_PER_HALFEDGE }
 Source of Texture Coordinates. More...
 
enum  DrawModeNormalSource { NORMAL_NONE, NORMAL_PER_VERTEX, NORMAL_PER_HALFEDGE, NORMAL_PER_FACE }
 Source of Normals. More...
 

Functions

void initializeDefaultDrawModes (void)
 
const DrawModeaddDrawMode (const std::string &_name, bool _propertyBased=false)
 Add a custom DrawMode. More...
 
ACGDLLEXPORT const DrawModeaddDrawMode (const std::string &_name, const DrawModeProperties &_properties)
 Add a custom property based DrawMode. More...
 
const DrawModegetDrawMode (const std::string &_name)
 Get a custom DrawMode. More...
 
bool drawModeExists (const std::string &_name)
 Check if the given draw mode exists. More...
 
DrawMode getDrawModeFromIndex (unsigned int _index)
 given an index of an atomic draw mode, return the drawmode
 

Variables

DrawMode NONE = DrawMode( ModeFlagSet(0) )
 not a valid draw mode
 
DrawMode DEFAULT = DrawMode( ModeFlagSet(1) )
 use the default (global) draw mode and not the node's own.
 
DrawMode POINTS = DrawMode( ModeFlagSet(1) << 1 )
 draw unlighted points using the default base color
 
DrawMode POINTS_COLORED = DrawMode( ModeFlagSet(1) << 2 )
 draw colored, but not lighted points (requires point colors)
 
DrawMode POINTS_SHADED = DrawMode( ModeFlagSet(1) << 3 )
 draw shaded points (requires point normals)
 
DrawMode EDGES = DrawMode( ModeFlagSet(1) << 4 )
 draw edges
 
DrawMode EDGES_COLORED = DrawMode( ModeFlagSet(1) << 5 )
 draw edges with colors (without shading)
 
DrawMode WIREFRAME = DrawMode( ModeFlagSet(1) << 6 )
 draw wireframe
 
DrawMode FACES = DrawMode( ModeFlagSet(1) << 7 )
 
DrawMode HIDDENLINE = DrawMode( ModeFlagSet(1) << 8 )
 draw hidden line (2 rendering passes needed)
 
DrawMode SOLID_FLAT_SHADED = DrawMode( ModeFlagSet(1) << 9 )
 draw flat shaded faces (requires face normals)
 
DrawMode SOLID_SMOOTH_SHADED = DrawMode( ModeFlagSet(1) << 10 )
 draw smooth shaded (Gouraud shaded) faces (requires halfedge normals)
 
DrawMode SOLID_PHONG_SHADED = DrawMode( ModeFlagSet(1) << 11 )
 draw phong shaded faces
 
DrawMode SOLID_FACES_COLORED = DrawMode( ModeFlagSet(1) << 12 )
 draw colored, but not lighted faces using face colors
 
DrawMode SOLID_POINTS_COLORED = DrawMode( ModeFlagSet(1) << 13 )
 draw colored, but not lighted faces using interpolated vertex colors
 
DrawMode SOLID_POINTS_COLORED_SHADED = DrawMode( ModeFlagSet(1) << 14 )
 draw faces, but use Gouraud shading to interpolate vertex colors
 
DrawMode SOLID_ENV_MAPPED = DrawMode( ModeFlagSet(1) << 15 )
 draw environment mapped
 
DrawMode SOLID_TEXTURED = DrawMode( ModeFlagSet(1) << 16 )
 draw textured faces
 
DrawMode SOLID_TEXTURED_SHADED = DrawMode( ModeFlagSet(1) << 17 )
 draw smooth shaded textured faces
 
DrawMode SOLID_1DTEXTURED = DrawMode( ModeFlagSet(1) << 18 )
 draw textured faces
 
DrawMode SOLID_1DTEXTURED_SHADED = DrawMode( ModeFlagSet(1) << 19 )
 draw smooth shaded textured faces
 
DrawMode SOLID_3DTEXTURED = DrawMode( ModeFlagSet(1) << 20 )
 draw textured faces
 
DrawMode SOLID_3DTEXTURED_SHADED = DrawMode( ModeFlagSet(1) << 21 )
 draw smooth shaded textured faces
 
DrawMode SOLID_FACES_COLORED_FLAT_SHADED = DrawMode( ModeFlagSet(1) << 22 )
 draw flat shaded and colored faces (requires face normals and colors)
 
DrawMode SOLID_FACES_COLORED_SMOOTH_SHADED = DrawMode( ModeFlagSet(1) << 23 )
 draw smooth shaded and colored faces (requires vertex normals and face colors)
 
DrawMode SOLID_2DTEXTURED_FACE = DrawMode( ModeFlagSet(1) << 24 )
 draw per halfedge textured faces
 
DrawMode SOLID_2DTEXTURED_FACE_SHADED = DrawMode( ModeFlagSet(1) << 25 )
 draw per halfedge textured faces
 
DrawMode SOLID_SHADER = DrawMode( ModeFlagSet(1) << 26 )
 
DrawMode SOLID_SMOOTH_SHADED_FEATURES = DrawMode( ModeFlagSet(1) << 27 )
 draw smooth shaded (Gouraud shaded) faces (requires halfedge normals)
 
DrawMode CELLS = DrawMode( ModeFlagSet(1) << 28 )
 
DrawMode CELLS_COLORED = DrawMode( ModeFlagSet(1) << 29 )
 draw cells with colors (without shading)
 
DrawMode HALFEDGES = DrawMode( ModeFlagSet(1) << 30 )
 draw halfedges
 
DrawMode HALFEDGES_COLORED = DrawMode( ModeFlagSet(1) << 31 )
 draw halfedges with colors (without shading)
 
DrawMode SOLID_FACES_COLORED_2DTEXTURED_FACE_SMOOTH_SHADED = DrawMode( ModeFlagSet(1) << 32 )
 draw per halfedge texture faces modulated with face colors with smooth shading
 
DrawMode UNUSED = DrawMode( ModeFlagSet(1) << 33 )
 marks the last used ID
 

Detailed Description

This namespace consists of the definition of all available draw modes, function to get their name (description()) and to include them in a QPopupMenu.

Enumeration Type Documentation

◆ DrawModeColorSource

Source of Primitive Colors.

This is interpreted as a per vertex diffuse and ambient color and multiplied with the material diffuse/ambient colors.

Enumerator
COLOR_NONE 

Use material colors only

COLOR_PER_VERTEX 

Load per vertex colors and modulate with material color

COLOR_PER_EDGE 

Load per edge colors and modulate with material color

COLOR_PER_HALFEDGE 

Load per halfedge colors and modulate with material color

COLOR_PER_FACE 

Load per face colors and modulate with material color

Definition at line 134 of file DrawModes.hh.

◆ DrawModeLightStage

Lighting stage of a mesh: unlit, smooth, phong.

Don't confuse this with the interpolation mode of vertex attributes. This only says where to apply lighting, and nothing else.

Instead the interpolation mode is customizable for each attribute, making DrawModeProperties more flexible.

flat shading can be achieved by using LIGHTSTAGE_SMOOTH and setting the normal source to NORMAL_PER_FACE

Enumerator
LIGHTSTAGE_UNLIT 

No lighting, normals may be used by user defined shaders

LIGHTSTAGE_SMOOTH 

Perform lighting in vertex shader

LIGHTSTAGE_PHONG 

Perform lighting in fragment shader

Definition at line 107 of file DrawModes.hh.

◆ DrawModeNormalSource

Source of Normals.

This must be specified if lighting is enabled.

Enumerator
NORMAL_NONE 

Disable lighting

NORMAL_PER_VERTEX 

Use per vertex normals

NORMAL_PER_HALFEDGE 

Use per halfedge normals

NORMAL_PER_FACE 

Use per face normals

Note
per face is implicitly used in SHADE_FLAT mode

Definition at line 159 of file DrawModes.hh.

◆ DrawModePrimitive

Primitive mode of a mesh.

Example: PRIMITIVE_EDGE on a polygon mesh renders only edges of the mesh.

Definition at line 118 of file DrawModes.hh.

◆ DrawModeTexCoordSource

Source of Texture Coordinates.

This must be specified for a textured draw.

Enumerator
TEXCOORD_NONE 

Disable texture mapping

TEXCOORD_PER_VERTEX 

Use per vertex texcoords for texture mapping

TEXCOORD_PER_HALFEDGE 

Use per halfedge texcoords for texture mapping

Definition at line 147 of file DrawModes.hh.

Function Documentation

◆ addDrawMode() [1/2]

ACGDLLEXPORT const DrawMode & ACG::SceneGraph::DrawModes::addDrawMode ( const std::string &  _name,
bool  _propertyBased = false 
)

Add a custom DrawMode.

The id of the new draw mode is returned. If it already exists, the id of the existing one is returned.

Property based draw modes consist of various flags, which define which primitives and additional information are send to the gpu.

Parameters
_nameName of the draw mode to add
_propertyBasedIf set to true a property based draw mode is created.
Returns
Id of the new draw mode

Definition at line 765 of file DrawModes.cc.

◆ addDrawMode() [2/2]

ACGDLLEXPORT const DrawMode & ACG::SceneGraph::DrawModes::addDrawMode ( const std::string &  _name,
const DrawModeProperties _properties 
)

Add a custom property based DrawMode.

The id of the new draw mode is returned. If it already exists, the id of the existing one is returned.

Note
If the DrawMode already exists, the properties will be applied to the existing mode!!

Property based draw modes consist of various flags, which define which primitives and additional information are send to the gpu.

Parameters
_nameName of the draw mode to add
_propertiesProperties of the drawmode
Returns
Id of the new draw mode

Definition at line 787 of file DrawModes.cc.

◆ drawModeExists()

ACGDLLEXPORT bool ACG::SceneGraph::DrawModes::drawModeExists ( const std::string &  _name)

Check if the given draw mode exists.

Definition at line 824 of file DrawModes.cc.

◆ getDrawMode()

ACGDLLEXPORT const DrawMode & ACG::SceneGraph::DrawModes::getDrawMode ( const std::string &  _name)

Get a custom DrawMode.

The id of the draw mode is returned or if it does not exist, DrawMode::NONE is returned.

Parameters
_nameName of the DrawMode
Returns
Id of the draw mode or DrawModes::NONE

Definition at line 807 of file DrawModes.cc.

◆ initializeDefaultDrawModes()

ACGDLLEXPORT void ACG::SceneGraph::DrawModes::initializeDefaultDrawModes ( void  )

Initialize the default modes. This function has to be called at least once at application startup.

Definition at line 639 of file DrawModes.cc.

Variable Documentation

◆ SOLID_SHADER

ACGDLLEXPORT DrawMode ACG::SceneGraph::DrawModes::SOLID_SHADER = DrawMode( ModeFlagSet(1) << 26 )

drawing is controlled by shaders ( Use shadernodes to set them before the actual object to render)

Definition at line 98 of file DrawModes.cc.