Files
2021-06-25 16:12:29 +02: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_normal
#define tools_sg_normal
#include "node"
#include "sf_vec3f"
#include "render_action"
#include <vector>
namespace tools {
namespace sg {
class normal : public node {
TOOLS_NODE(normal,tools::sg::normal,node)
public:
sf_vec3f vec;
public:
virtual const desc_fields& node_desc_fields() const {
TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::normal)
static const desc_fields s_v(parent::node_desc_fields(),1, //WARNING : take care of count.
TOOLS_ARG_FIELD_DESC(vec)
);
return s_v;
}
private:
void add_fields(){
add_field(&vec);
}
public:
virtual void render(render_action& a_action) {
state& state = a_action.state();
state.m_normal = vec.value();
a_action.normal(state.m_normal);
}
public:
normal()
:parent()
,vec(vec3f(0,0,1))
{
add_fields();
}
virtual ~normal(){}
public:
normal(const normal& a_from)
:parent(a_from)
,vec(a_from.vec)
{
add_fields();
}
normal& operator=(const normal& a_from){
parent::operator=(a_from);
vec = a_from.vec;
return *this;
}
};
}}
#endif