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

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 140 of file DrawModes.hh.

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 113 of file DrawModes.hh.

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 165 of file DrawModes.hh.

Primitive mode of a mesh.

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

Definition at line 124 of file DrawModes.hh.

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 153 of file DrawModes.hh.

Function Documentation

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 771 of file DrawModes.cc.

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 793 of file DrawModes.cc.

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

Check if the given draw mode exists.

Definition at line 830 of file DrawModes.cc.

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 813 of file DrawModes.cc.

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 645 of file DrawModes.cc.

Variable Documentation

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

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

Definition at line 104 of file DrawModes.cc.