GlobeEngine
ArrowField.h
Go to the documentation of this file.
1 
9 #ifndef GlobeEngine_ArrowField_h
10 #define GlobeEngine_ArrowField_h
11 
12 #include "OpenGL_Includes.h"
13 #include "DrawableComponent.h"
14 #include <string>
15 
16 namespace geFlow {
17  struct ArrowInfo{
18  vmml::Vector3f pos;
19  vmml::Vector3f dir;
20  };
21 
22  // An arrow is defined by shaft, peak and two wing
23  // points in CCW and CW order. Center is in the middle
24  // 2 \
25  // \
26  // 0 -----C---- 1
27  // /
28  // 3 /
29  struct Arrow {
30  vmml::Vector4d lineVectors[4];
31  };
32 
34  {
35  public:
36  ArrowField();
37  ~ArrowField();
38  void clear();
39  void create();
40  void draw(std::shared_ptr<ge::Camera> _cam);
41  void update();
42  void createVAO();
43  void addArrow(ArrowInfo _arrowInfo);
44  void setArrowLength(float _length);
45  void setMinMaxArrows();
46 
47  int getArrowCount() const;
48 
49  private:
50  void rotateArrowAccordingToDirection(int _idx);
51  void setPositionBuffer();
52  void setColorBuffer();
53  void setIndexBuffer();
54  vmml::Vector3f getColorForDir(vmml::Vector3f _dir);
55 
56  Arrow base; // arrow pointing xAxis
57  std::vector<Arrow> arrows;
58  std::vector<ArrowInfo> arrowInfos;
59  float arrowLength;
60  float minLenght;
61  float maxLenght;
62  };
63 }
64 #endif
void update()
Definition: ArrowField.cpp:149
Definition: ArrowField.h:17
Definition: DrawableComponent.h:25
void create()
Definition: ArrowField.cpp:28
void clear()
Definition: ArrowField.cpp:23
Definition: ArrowField.h:16
void setMinMaxArrows()
Definition: ArrowField.cpp:218
vmml::Vector3f pos
Definition: ArrowField.h:18
int getArrowCount() const
Definition: ArrowField.cpp:241
void createVAO()
Definition: ArrowField.cpp:39
void addArrow(ArrowInfo _arrowInfo)
Definition: ArrowField.cpp:210
~ArrowField()
Definition: ArrowField.cpp:18
vmml::Vector3f dir
Definition: ArrowField.h:19
Definition: ArrowField.h:33
void setArrowLength(float _length)
Definition: ArrowField.cpp:214
ArrowField()
Definition: ArrowField.cpp:13
vmml::Vector4d lineVectors[4]
Definition: ArrowField.h:30
void draw(std::shared_ptr< ge::Camera > _cam)
Definition: ArrowField.cpp:154
Definition: ArrowField.h:29