vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PatternGeode.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <osg/Geode>
4 #include "Pattern.h"
5 #include <osg/NodeCallback>
6 #include <osg/LineWidth>
7 #include <osg/CopyOp>
8 
9 namespace APDYNAMICART
10 {
11 
12 class PatternsGeode : public osg::Geode
13 {
14 
15 public:
17  PatternsGeode();
18  PatternsGeode(const PatternsGeode&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
19 
20  META_Node(APDYNAMICART, PatternsGeode);
21 
23  float getStringLineWidth() const { return _stringWidth; }
24  Vec3ArrayPtr getPatternsPointsArray() const { return _patternsPoints; }
25 
27  inline void setVertexArray(Vec3ArrayPtr points);
28  inline void setStringLineWidth(float val);
29 
30  void updateGeometry();
31 
32 private:
34  Vec3ArrayPtr _patternsPoints;
35  GeometryPtr _geometry;
36  float _stringWidth;
37 
39  void createDrawableObject();
40 
42  virtual ~PatternsGeode() {};
43 };
44 
45 typedef osg::ref_ptr<PatternsGeode> PatternGeodePtr;
46 typedef std::vector<PatternGeodePtr> PatternGeodeList;
47 
50 {
51  if(points.valid()) {
52  _patternsPoints = points;
53  return;
54  }
55 
56  err("Non valid pattern pointer used!");
57 }
58 
60 {
61  _stringWidth = val;
62  ((osg::LineWidth*)_geometry->getOrCreateStateSet()->getAttribute(osg::StateAttribute::LINEWIDTH))->setWidth(val);
63 }
64 
65 }