Files
2025-12-05 08:54:02 +01:00

63 lines
1.2 KiB
Plaintext

// Copyright (C) 2010, Guy Barrand. All rights reserved.
// See the file tools.license for terms.
#ifndef tools_sg_rgba
#define tools_sg_rgba
#include "node"
#include "sf_vec"
#include "render_action"
#include "../colorfs"
namespace tools {
namespace sg {
class rgba : public node {
TOOLS_NODE(rgba,tools::sg::rgba,node)
public:
sf_vec<colorf,float> color;
public:
virtual const desc_fields& node_desc_fields() const {
TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::rgba)
static const desc_fields s_v(parent::node_desc_fields(),1, //WARNING : take care of count.
TOOLS_ARG_FIELD_DESC(color)
);
return s_v;
}
private:
void add_fields(){
add_field(&color);
}
public:
virtual void render(render_action& a_action) {
state& state = a_action.state();
state.m_color = color.value();
a_action.color4f(state.m_color);
}
public:
rgba()
:parent()
,color(colorf_grey())
{
add_fields();
}
virtual ~rgba(){}
public:
rgba(const rgba& a_from)
:parent(a_from)
,color(a_from.color)
{
add_fields();
}
rgba& operator=(const rgba& a_from){
parent::operator=(a_from);
color = a_from.color;
return *this;
}
};
}}
#endif