ACG::SceneGraph::MaterialNode Class Reference

#include <ACG/Scenegraph/MaterialNode.hh>

Inheritance diagram for ACG::SceneGraph::MaterialNode:
Inheritance graph
[legend]
Collaboration diagram for ACG::SceneGraph::MaterialNode:
Collaboration graph
[legend]

List of all members.

Public Types

enum  ApplyProperties {
  None = 0, All = 0xffff, BaseColor = 1, Material = 2,
  PointSize = 4, LineWidth = 8, RoundPoints = 16, LineSmooth = 32,
  AlphaTest = 64, Blending = 128, BackFaceCulling = 256, ColorMaterial = 512,
  MultiSampling = 1024
}
 

Apply which properties? Others will be ignored. Values may be OR'ed.

More...

Public Member Functions

 MaterialNode (BaseNode *_parent=0, const std::string &_name="<MaterialNode>", unsigned int _applyProperties=(All &~BackFaceCulling))
 Default constructor. Applies all properties.
virtual ~MaterialNode ()
 Destructor.
void read (std::istream &_is)
 read MaterialFile
float alpha_value ()
 get current alpha value for alpha_test
bool blending ()
GLenum blending_param1 ()
GLenum blending_param2 ()
void enable_blending (GLenum _p1=GL_SRC_ALPHA, GLenum _p2=GL_ONE_MINUS_SRC_ALPHA)
 enable blending with Parameters (_p1, _p2)
void disable_blending ()
 disable blending
bool backface_culling ()
void enable_backface_culling ()
 enable backface culling (not active by default, see applyProperties)
void disable_backface_culling ()
 disable backface culling (not active by default, see applyProperties)
unsigned int applyProperties () const
 get properties that will be applied (OR'ed ApplyProperties)
void applyProperties (unsigned int _applyProperties)
 set properties that will be applied (OR'ed ApplyProperties)
Scenegraph functions



 ACG_CLASSNAME (MaterialNode)
void enter (GLState &_state, unsigned int _drawmode)
 set current GL-color and GL-material
void leave (GLState &_state, unsigned int _drawmode)
 restores original GL-color and GL-material
void enterPick (GLState &_state, PickTarget _target, unsigned int _drawMode)
 Do nothing in picking.
void leavePick (GLState &_state, PickTarget _target, unsigned int _drawMode)
 Do nothing in picking.
Color and material settings ( Applied to all objects below this node )



void set_color (const Vec4f &_c)
 set color (base, ambient, diffuse, specular) based on _c
void set_base_color (const Vec4f &_c)
 set the base color
const Vec4f & base_color () const
 get the base color
void set_ambient_color (const Vec4f &_a)
 set the ambient color.
const Vec4f & ambient_color () const
 get the ambient color.
void set_diffuse_color (const Vec4f &_d)
 set the diffuse color.
const Vec4f & diffuse_color () const
 get the diffuse color.
void set_specular_color (const Vec4f &_s)
 set the specular color
const Vec4f & specular_color () const
 get the specular color
void colorMaterial (const bool _colorMaterial)
 Set colorMaterial.
void enable_color_material ()
 Enable Color Material.
void disable_color_material ()
 Disable Color Material.
bool colorMaterial ()
 get colorMaterial state
void set_shininess (float _s)
 set shininess
float shininess () const
 get shininess
Point/Line controls



void set_point_size (float _sz)
 set point size (default: 1.0)
float point_size () const
 get point size
void set_line_width (float _sz)
 set line width (default: 1.0)
float line_width () const
 get line width
void set_round_points (bool _b)
 set: round points enabled
bool round_points () const
 get: round points enabled
void set_line_smooth (bool _b)
 set: smooth lines enabled
bool line_smooth () const
 get: rsmooth lines enabled
Tests



void enable_alpha_test (float _clip)
 enable alpha test (draw pixels if alpha >= _clip)
void disable_alpha_test ()
 disable alpha test
bool alpha_test ()
 Return state of Alpha test.
Other Rendering options



void enable_multisampling ()
 Enable Multisampling.
void disable_multisampling ()
 enable alpha test (draw pixels if alpha >= _clip)
bool multiSampling ()
 Get state of multisampling.
void set_multisampling (bool _state)
 Set state of multisampling.

Private Attributes

int applyProperties_
 OR'ed ApplyProperties.
Vec4f base_color_
Vec4f base_color_backup_
Vec4f ambient_color_
Vec4f ambient_color_backup_
Vec4f diffuse_color_
Vec4f diffuse_color_backup_
Vec4f specular_color_
Vec4f specular_color_backup_
float shininess_
float shininess_backup_
float point_size_
float point_size_backup_
float line_width_
float line_width_backup_
bool round_points_
bool round_points_backup_
bool lines_smooth_
bool lines_smooth_backup_
bool alpha_test_
bool alpha_test_backup_
float alpha_clip_
float alpha_clip_backup_
bool blending_
bool blending_backup_
GLenum blend_param1_
GLenum blend_param1_backup_
GLenum blend_param2_
GLenum blend_param2_backup_
bool color_material_
bool color_material_backup_
bool backface_culling_
bool backface_culling_backup_
bool multiSampling_
bool multiSampling_backup_

Detailed Description

Set material and some other stuff like alphatest and blending for this node and all its children. All changes will be done in the enter() method undone in the leave() method.

Definition at line 78 of file MaterialNode.hh.


Member Enumeration Documentation

Apply which properties? Others will be ignored. Values may be OR'ed.

Enumerator:
None 

apply nothing

All 

apply all properites

BaseColor 

apply base color

Material 

apply material (ambient, diffuse, specular, shininess)

PointSize 

apply point size

LineWidth 

apply line width

RoundPoints 

draw smooth (round) points using glPoint()

LineSmooth 

draw smooth lines using glLine()

AlphaTest 

use alpha test

Blending 

use blending

BackFaceCulling 

backface culling

ColorMaterial 

Color Material ( Only when a drawmode using shading and lighting is enabled ).

MultiSampling 

MultiSampling.

Definition at line 83 of file MaterialNode.hh.


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

acg pic Project OpenFlipper, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .