Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
ACG::SceneGraph::ACG::SceneGraph::DrawModes Namespace Reference

Classes

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

Typedefs

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

ACGDLLEXPORT void initializeDefaultDrawModes (void)
 
ACGDLLEXPORT 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...
 
ACGDLLEXPORT const DrawModegetDrawMode (const std::string &_name)
 Get a custom DrawMode. More...
 
ACGDLLEXPORT bool drawModeExists (const std::string &_name)
 Check if the given draw mode exists. More...
 
ACGDLLEXPORT DrawMode getDrawModeFromIndex (unsigned int _index)
 given an index of an atomic draw mode, return the drawmode
 

Variables

ACGDLLEXPORT DrawMode NONE
 not a valid draw mode
 
ACGDLLEXPORT DrawMode DEFAULT
 use the default (global) draw mode and not the node's own.
 
ACGDLLEXPORT DrawMode POINTS
 draw unlighted points using the default base color
 
ACGDLLEXPORT DrawMode POINTS_COLORED
 draw colored, but not lighted points (requires point colors)
 
ACGDLLEXPORT DrawMode POINTS_SHADED
 draw shaded points (requires point normals)
 
ACGDLLEXPORT DrawMode EDGES
 draw edges
 
ACGDLLEXPORT DrawMode EDGES_COLORED
 draw edges with colors (without shading)
 
ACGDLLEXPORT DrawMode WIREFRAME
 draw wireframe
 
ACGDLLEXPORT DrawMode FACES
 
ACGDLLEXPORT DrawMode HIDDENLINE
 draw hidden line (2 rendering passes needed)
 
ACGDLLEXPORT DrawMode SOLID_FLAT_SHADED
 draw flat shaded faces (requires face normals)
 
ACGDLLEXPORT DrawMode SOLID_SMOOTH_SHADED
 draw smooth shaded (Gouraud shaded) faces (requires halfedge normals)
 
ACGDLLEXPORT DrawMode SOLID_PHONG_SHADED
 draw phong shaded faces
 
ACGDLLEXPORT DrawMode SOLID_FACES_COLORED
 draw colored, but not lighted faces using face colors
 
ACGDLLEXPORT DrawMode SOLID_POINTS_COLORED
 draw colored, but not lighted faces using interpolated vertex colors
 
ACGDLLEXPORT DrawMode SOLID_POINTS_COLORED_SHADED
 draw faces, but use Gouraud shading to interpolate vertex colors
 
ACGDLLEXPORT DrawMode SOLID_ENV_MAPPED
 draw environment mapped
 
ACGDLLEXPORT DrawMode SOLID_TEXTURED
 draw textured faces
 
ACGDLLEXPORT DrawMode SOLID_TEXTURED_SHADED
 draw smooth shaded textured faces
 
ACGDLLEXPORT DrawMode SOLID_1DTEXTURED
 draw textured faces
 
ACGDLLEXPORT DrawMode SOLID_1DTEXTURED_SHADED
 draw smooth shaded textured faces
 
ACGDLLEXPORT DrawMode SOLID_3DTEXTURED
 draw textured faces
 
ACGDLLEXPORT DrawMode SOLID_3DTEXTURED_SHADED
 draw smooth shaded textured faces
 
ACGDLLEXPORT DrawMode SOLID_FACES_COLORED_FLAT_SHADED
 draw flat shaded and colored faces (requires face normals and colors)
 
ACGDLLEXPORT DrawMode SOLID_FACES_COLORED_SMOOTH_SHADED
 draw smooth shaded and colored faces (requires vertex normals and face colors)
 
ACGDLLEXPORT DrawMode SOLID_FACES_COLORED_2DTEXTURED_FACE_SMOOTH_SHADED
 draw per halfedge texture faces modulated with face colors with smooth shading
 
ACGDLLEXPORT DrawMode SOLID_2DTEXTURED_FACE
 draw per halfedge textured faces
 
ACGDLLEXPORT DrawMode SOLID_2DTEXTURED_FACE_SHADED
 draw per halfedge textured faces
 
ACGDLLEXPORT DrawMode SOLID_SHADER
 
ACGDLLEXPORT DrawMode SOLID_SMOOTH_SHADED_FEATURES
 draw smooth shaded (Gouraud shaded) faces (requires halfedge normals)
 
ACGDLLEXPORT DrawMode CELLS
 
ACGDLLEXPORT DrawMode CELLS_COLORED
 draw cells with colors (without shading)
 
ACGDLLEXPORT DrawMode HALFEDGES
 draw halfedges
 
ACGDLLEXPORT DrawMode HALFEDGES_COLORED
 draw halfedges with colors (without shading)
 
ACGDLLEXPORT DrawMode UNUSED
 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 MeshNode2T.cc.

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 MeshNode2T.cc.

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 MeshNode2T.cc.

Primitive mode of a mesh.

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

Definition at line 124 of file MeshNode2T.cc.

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 MeshNode2T.cc.

Function Documentation

ACGDLLEXPORT const DrawMode& ACG::SceneGraph::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::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
ACGDLLEXPORT bool ACG::SceneGraph::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::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::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::ACG::SceneGraph::DrawModes::SOLID_SHADER

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

Definition at line 104 of file DrawModes.cc.