g4tools  5.4.0
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
tools::sg::draw_style Class Reference
Inheritance diagram for tools::sg::draw_style:
Inheritance graph
[legend]
Collaboration diagram for tools::sg::draw_style:
Collaboration graph
[legend]

Public Member Functions

virtual const desc_fieldsnode_desc_fields () const
 
virtual void render (render_action &a_action)
 
virtual void pick (pick_action &a_action)
 
virtual void bbox (bbox_action &a_action)
 
 draw_style ()
 
virtual ~draw_style ()
 
 draw_style (const draw_style &a_from)
 
draw_styleoperator= (const draw_style &a_from)
 
- Public Member Functions inherited from tools::sg::node
virtual void * cast (const std::string &a_class) const
 
virtual const std::string & s_cls () const =0
 
virtual nodecopy () const =0
 
virtual unsigned int cls_version () const
 
virtual void search (search_action &a_action)
 
virtual void get_matrix (get_matrix_action &a_action)
 
virtual bool write (write_action &a_action)
 
virtual void event (event_action &)
 
virtual bool read (read_action &a_action)
 
virtual void is_visible (visible_action &)
 
virtual void protocol_one_fields (std::vector< field * > &a_fields) const
 
virtual bool draw_in_frame_buffer () const
 
virtual bool touched ()
 
virtual void reset_touched ()
 
 node ()
 
virtual ~node ()
 
void touch ()
 
fieldfield_from_desc (const field_desc &a_desc) const
 
void dump_field_descs (std::ostream &a_out) const
 
fieldfind_field_by_name (const std::string &a_name) const
 

Public Attributes

sf_enum< draw_typestyle
 
sf< float > line_width
 
sf< lpatline_pattern
 
sf< float > point_size
 
sf< bool > cull_face
 
sf< bool > winding_ccw
 

Protected Member Functions

void _set_state (state &a_state)
 
- Protected Member Functions inherited from tools::sg::node
 node (const node &)
 
nodeoperator= (const node &)
 
void add_field (field *a_field)
 
bool write_fields (write_action &a_action)
 
bool read_fields (read_action &a_action)
 
field_desc::offset_t field_offset (const field *a_field) const
 
fieldfind_field (const field_desc &a_rdesc) const
 
void check_fields (std::ostream &a_out) const
 

Detailed Description

Definition at line 18 of file draw_style.

Constructor & Destructor Documentation

◆ draw_style() [1/2]

tools::sg::draw_style::draw_style ( )
inline

Definition at line 69 of file draw_style.

70  :parent()
72  ,line_width(1) //NOTE : 0 induces a 501 gl error.
74  ,point_size(1)
75  ,cull_face(true)
76  ,winding_ccw(true)
77  {
78  add_fields();
79  }

◆ ~draw_style()

virtual tools::sg::draw_style::~draw_style ( )
inlinevirtual

Definition at line 80 of file draw_style.

80 {}

◆ draw_style() [2/2]

tools::sg::draw_style::draw_style ( const draw_style a_from)
inline

Definition at line 82 of file draw_style.

83  :parent(a_from)
84  ,style(a_from.style)
85  ,line_width(a_from.line_width)
86  ,line_pattern(a_from.line_pattern)
87  ,point_size(a_from.point_size)
88  ,cull_face(a_from.cull_face)
89  ,winding_ccw(a_from.winding_ccw)
90  {
91  add_fields();
92  }

Member Function Documentation

◆ _set_state()

void tools::sg::draw_style::_set_state ( state a_state)
inlineprotected

Definition at line 106 of file draw_style.

106  {
107  a_state.m_draw_type = style;
108  a_state.m_line_width = line_width;
109  a_state.m_line_pattern = line_pattern;
110  a_state.m_point_size = point_size;
111  a_state.m_GL_CULL_FACE = cull_face;
112  a_state.m_winding = winding_ccw.value()?sg::winding_ccw:sg::winding_cw;
113  }

◆ bbox()

virtual void tools::sg::draw_style::bbox ( bbox_action a_action)
inlinevirtual

Reimplemented from tools::sg::node.

Definition at line 67 of file draw_style.

67 {_set_state(a_action.state());}

◆ node_desc_fields()

virtual const desc_fields& tools::sg::draw_style::node_desc_fields ( ) const
inlinevirtual

Reimplemented from tools::sg::node.

Definition at line 28 of file draw_style.

28  {
30  static const desc_fields s_v(parent::node_desc_fields(),6, //WARNING : take care of count.
37  );
38  return s_v;
39  }

◆ operator=()

draw_style& tools::sg::draw_style::operator= ( const draw_style a_from)
inline

Definition at line 93 of file draw_style.

93  {
94  parent::operator=(a_from);
95 
96  style = a_from.style;
97  line_width = a_from.line_width;
98  line_pattern = a_from.line_pattern;
99  point_size = a_from.point_size;
100  cull_face = a_from.cull_face;
101  winding_ccw = a_from.winding_ccw;
102 
103  return *this;
104  }

◆ pick()

virtual void tools::sg::draw_style::pick ( pick_action a_action)
inlinevirtual

Reimplemented from tools::sg::node.

Definition at line 66 of file draw_style.

66 {_set_state(a_action.state());}

◆ render()

virtual void tools::sg::draw_style::render ( render_action a_action)
inlinevirtual

Reimplemented from tools::sg::node.

Definition at line 50 of file draw_style.

50  {
51  state& state = a_action.state();
52  _set_state(state);
53 
54  if(style.value()==draw_lines) {
55  //no LINE_STIPPLE in GLES.
56  //::glEnable(GL_LINE_STIPPLE); //done in viewer::render()
57  //::glLineStipple(1,line_pattern.value());
58  a_action.line_width(state.m_line_width);
59  } else if(style.value()==draw_points) {
60  a_action.point_size(state.m_point_size);
61  } else if(style.value()==draw_filled) {
62  a_action.set_cull_face(state.m_GL_CULL_FACE);
63  a_action.set_winding(state.m_winding);
64  }
65  }

Member Data Documentation

◆ cull_face

sf<bool> tools::sg::draw_style::cull_face

Definition at line 25 of file draw_style.

◆ line_pattern

sf<lpat> tools::sg::draw_style::line_pattern

Definition at line 23 of file draw_style.

◆ line_width

sf<float> tools::sg::draw_style::line_width

Definition at line 22 of file draw_style.

◆ point_size

sf<float> tools::sg::draw_style::point_size

Definition at line 24 of file draw_style.

◆ style

sf_enum<draw_type> tools::sg::draw_style::style

Definition at line 21 of file draw_style.

◆ winding_ccw

sf<bool> tools::sg::draw_style::winding_ccw

Definition at line 26 of file draw_style.


The documentation for this class was generated from the following file:
tools::sg::draw_style::_set_state
void _set_state(state &a_state)
Definition: draw_style:106
tools::sg::draw_style::line_pattern
sf< lpat > line_pattern
Definition: draw_style:23
tools::sg::winding_ccw
@ winding_ccw
Definition: enums:105
tools::sg::draw_style::line_width
sf< float > line_width
Definition: draw_style:22
tools::sg::draw_style
Definition: draw_style:18
tools::sg::draw_points
@ draw_points
Definition: enums:191
tools::sg::winding_cw
@ winding_cw
Definition: enums:106
tools::sg::draw_filled
@ draw_filled
Definition: enums:193
tools::sg::draw_style::winding_ccw
sf< bool > winding_ccw
Definition: draw_style:26
tools::sg::draw_style::point_size
sf< float > point_size
Definition: draw_style:24
TOOLS_FIELD_DESC_NODE_CLASS
#define TOOLS_FIELD_DESC_NODE_CLASS(a__class)
Definition: field:68
tools::sg::draw_style::cull_face
sf< bool > cull_face
Definition: draw_style:25
tools::sg::line_solid
@ line_solid
Definition: enums:11
tools::sg::bsf::value
T & value()
Definition: bsf:98
tools::sg::draw_style::style
sf_enum< draw_type > style
Definition: draw_style:21
tools::sg::draw_lines
@ draw_lines
Definition: enums:192
TOOLS_ARG_FIELD_DESC
#define TOOLS_ARG_FIELD_DESC(a__field)
Definition: field:71