Files
geant4/source/analysis/g4tools/include/tools/sg/normal
T
2017-12-08 12:52:30 +01:00

63 lines
1.1 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_vec"
#include "render_action"
#include <vector>
namespace tools {
namespace sg {
class normal : public node {
TOOLS_NODE(normal,tools::sg::normal,node)
public:
sf_vec<vec3f,float> vec;
public:
virtual const std::vector<field_desc>& node_fields() const {
TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::normal)
static std::vector<field_desc> s_v;
if(s_v.empty()) {
s_v = parent::node_fields();
TOOLS_ADD_FIELD_DESC(vec)
}
return s_v;
}
private:
void add_fields(){
add_field(&vec);
}
public:
virtual void render(render_action& a_action) {
a_action.normal(vec.value());
}
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