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

Public Member Functions

virtual const desc_fieldsnode_desc_fields () const
 
virtual void render (render_action &a_action)
 
 color ()
 
virtual ~color ()
 
 color (const color &a_from)
 
coloroperator= (const color &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 pick (pick_action &)
 
virtual void bbox (bbox_action &)
 
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_vec< colorf, float > rgb
 
sf< float > transparency
 

Additional Inherited Members

- 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 16 of file color.

Constructor & Destructor Documentation

◆ color() [1/2]

tools::sg::color::color ( )
inline

Definition at line 58 of file color.

59  :parent()
61  ,transparency(0.0f)
62  {
63  add_fields();
64  }

◆ ~color()

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

Definition at line 65 of file color.

65 {}

◆ color() [2/2]

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

Definition at line 67 of file color.

68  :parent(a_from)
69  ,rgb(a_from.rgb)
70  ,transparency(a_from.transparency)
71  {
72  add_fields();
73  }

Member Function Documentation

◆ node_desc_fields()

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

Reimplemented from tools::sg::node.

Definition at line 22 of file color.

22  {
24  static const desc_fields s_v(parent::node_desc_fields(),2, //WARNING : take care of count.
27  );
28  return s_v;
29  }

◆ operator=()

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

Definition at line 74 of file color.

74  {
75  parent::operator=(a_from);
76 
77  rgb = a_from.rgb;
78  transparency = a_from.transparency;
79 
80  return *this;
81  }

◆ render()

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

Reimplemented from tools::sg::node.

Definition at line 36 of file color.

36  {
37  // GL-ES : ::glMaterialfv does not work. We then use :
38  // ::glEnable(GL_COLOR_MATERIAL) and ::glColor.
39 
40  //if(a_action.state().m_GL_LIGHTING) {
41  // float params[4];
42  // params[0] = rgb.value().r();
43  // params[1] = rgb.value().g();
44  // params[2] = rgb.value().b();
45  // params[3] = 1-transparency.value();
46  // ::glMaterialfv(GL_FRONT,GL_DIFFUSE,params);
47  //} else {
48  //}
49 
50  state& state = a_action.state();
51  state.m_color[0] = rgb.value().r();
52  state.m_color[1] = rgb.value().g();
53  state.m_color[2] = rgb.value().b();
54  state.m_color[3] = 1-transparency.value();
55  a_action.color4f(state.m_color);
56  }

Member Data Documentation

◆ rgb

sf_vec<colorf,float> tools::sg::color::rgb

Definition at line 19 of file color.

◆ transparency

sf<float> tools::sg::color::transparency

Definition at line 20 of file color.


The documentation for this class was generated from the following file:
tools::colorf_default
const colorf & colorf_default()
Definition: colorf:161
tools::sg::color
Definition: color:16
tools::sg::color::transparency
sf< float > transparency
Definition: color:20
tools::sg::color::rgb
sf_vec< colorf, float > rgb
Definition: color:19
TOOLS_FIELD_DESC_NODE_CLASS
#define TOOLS_FIELD_DESC_NODE_CLASS(a__class)
Definition: field:68
tools::sg::bsf::value
T & value()
Definition: bsf:98
TOOLS_ARG_FIELD_DESC
#define TOOLS_ARG_FIELD_DESC(a__field)
Definition: field:71