GlobeEngine
MultiLineObject.h
Go to the documentation of this file.
1 //
2 // Polyline.h
3 // GlobeEngine
4 //
5 // Created by Mathias Thöny on 27.12.11.
6 // Copyright (c) 2011 University of Zurich. All rights reserved.
7 //
8 
9 #ifndef GlobeEngine_MultiLineObject_h
10 #define GlobeEngine_MultiLineObject_h
11 
12 #include <vmmlib/vmmlib.hpp>
13 #include "DrawableComponent.h"
14 #include "VBOVertex.h"
15 #include "OpenGL_Includes.h"
16 #include "PolyLine.h"
17 
18 namespace geData {
20  {
21  public:
22  /* 0 = line,
23  1 = triangulated with overlaps,
24  2 = triangulated as nice ribbon,
25  3 = gputriangulated
26  */
32 
35  void clear();
36  void create();
37  void create(int _lineCount, int _lineSize);
38  void update();
39  //void draw(std::shared_ptr<ge::Camera> _cam);
40  void draw(std::shared_ptr<ge::Camera> _cam);
41  void drawWithStandardShader(std::shared_ptr<ge::Camera> _cam);
42 
46  int addLine(vmml::Vector3d _start, vmml::Vector3d _end);
47 
51  int addPolyline(std::shared_ptr<PolyLine> _polyline);
52 
56  void updatePolyline(int _id, std::shared_ptr<PolyLine> _polyline);
57 
61  void removePolyline(int _id);
62 
66  void insertPolyline(int _id, std::shared_ptr<PolyLine> _polyline);
67  const std::shared_ptr<PolyLine> getPolyline(int _idx) const;
68 
72  void createVAO(enum GEOMETRYMODE _mode=LINES);
73 
74  void setLineWeight(int _lineIdx, double _wheight);
75  void setLineWeightAndColor(int _idx, double _wheight, vmml::Vector3f _color);
76  void addToLineWeight(int _idx, double _value);
77  double getLineWeight(int _idx);
78  vmml::Vector3f getLineWeightColor(int _idx);
79 
80  void setLineThickness(double _input);
81  int getLineCount();
82  void setLineCount(int _input);
83  int getLineSize();
84  int getGraphPointCount() const;
85  double getLineThickness();
86  void setWheightedColorBuffer(int _bufferID);
87 
88  enum GEOMETRYMODE getDrawMode() const{ return this->geometryDrawmode; };
89 
90  void setExtrusionXZ(double _input);
91  void setExtrusionY(double _input);
92 
93  // geometry setup
94  void setGeometryBuffer(int _bufferID);
95  void setGeometryBufferAsRibbons(int _bufferID);
96  void setColorBuffer(int _bufferID, const vmml::Vector3f* _color=NULL);
97  void setAnimatedColorBuffer(int _bufferID, const vmml::Vector3f* _animationColor);
98  void setPickIDBuffer(int _bufferID);
99 
100  void setLinestripIndices();
101  void setIndicesForLines();
103  void setIndicesForRibbons();
104  void clearGeometryMemory();
105 
107  return animatedColorUpdate;
108  };
109 
110  void moveAnimationForward();
111  void moveAnimationBackward();
112 
113  void setAnimatedTimeStep(float _timeStep);
114 
115  private:
116  void allocateLineStripArray(int _size);
117  void createPointerList();
118 
119  std::vector< std::shared_ptr<PolyLine> > entities;
120  std::vector<double> weights;
121  std::vector<vmml::Vector3f> weightColors;
122 
123  GEOMETRYMODE geometryDrawmode;
124 
125  // number of line segments per line
126  int lineSize;
127  // number of lines
128  int lineCount;
129  double lineThickness;
130  // Rendering structures
131  GLsizei* lineStripLenght;
132 
133  // line info
134  int maxPointCountInALine;
135  bool animatedColorUpdate;
136 
137  // Extrusion variables
138  float extrusionXZ;
139  float extrusionY;
140 
141  // animation variables
142  float animatedTimeStep;
143  };
144 }
145 #endif
Definition: DrawableComponent.h:25
Definition: MultiLineObject.h:28
void setGeometryBufferAsRibbons(int _bufferID)
Definition: MultiLineObject.cpp:338
void clearGeometryMemory()
Definition: MultiLineObject.cpp:31
void moveAnimationForward()
Definition: MultiLineObject.cpp:654
void update()
Definition: MultiLineObject.cpp:50
Definition: AvalancheTrainingSimulationEngine.h:39
const std::shared_ptr< PolyLine > getPolyline(int _idx) const
Definition: MultiLineObject.cpp:608
int getLineSize()
Definition: MultiLineObject.cpp:626
void setAnimatedColorBuffer(int _bufferID, const vmml::Vector3f *_animationColor)
Definition: MultiLineObject.cpp:312
int getLineCount()
Definition: MultiLineObject.cpp:618
Definition: MultiLineObject.h:30
void addToLineWeight(int _idx, double _value)
Definition: MultiLineObject.cpp:556
void setExtrusionXZ(double _input)
Definition: MultiLineObject.cpp:635
void clear()
Definition: MultiLineObject.cpp:15
int addPolyline(std::shared_ptr< PolyLine > _polyline)
Definition: MultiLineObject.cpp:448
~MultiLineObject()
Definition: MultiLineObject.cpp:10
void setLineWeightAndColor(int _idx, double _wheight, vmml::Vector3f _color)
Definition: MultiLineObject.cpp:523
void moveAnimationBackward()
Definition: MultiLineObject.cpp:662
void removePolyline(int _id)
Definition: MultiLineObject.cpp:475
int addLine(vmml::Vector3d _start, vmml::Vector3d _end)
Definition: MultiLineObject.cpp:497
void setIndicesForRibbons()
Definition: MultiLineObject.cpp:226
void setExtrusionY(double _input)
Definition: MultiLineObject.cpp:640
void draw(std::shared_ptr< ge::Camera > _cam)
Definition: MultiLineObject.cpp:55
void createVAO(enum GEOMETRYMODE _mode=LINES)
Definition: MultiLineObject.cpp:122
void setColorBuffer(int _bufferID, const vmml::Vector3f *_color=NULL)
Definition: MultiLineObject.cpp:271
Definition: MultiLineObject.h:31
bool isAnimatedColorUpdated()
Definition: MultiLineObject.h:106
void setAnimatedTimeStep(float _timeStep)
Definition: MultiLineObject.cpp:670
void drawWithStandardShader(std::shared_ptr< ge::Camera > _cam)
void setPickIDBuffer(int _bufferID)
Definition: MultiLineObject.cpp:432
void setLineCount(int _input)
Definition: MultiLineObject.cpp:622
void setLineWeight(int _lineIdx, double _wheight)
Definition: MultiLineObject.cpp:513
void setWheightedColorBuffer(int _bufferID)
Definition: MultiLineObject.cpp:294
void insertPolyline(int _id, std::shared_ptr< PolyLine > _polyline)
Definition: MultiLineObject.cpp:454
void setIndicesForLines()
Definition: MultiLineObject.cpp:194
void setLinestripIndices()
Definition: MultiLineObject.cpp:168
void setGeometryBuffer(int _bufferID)
Definition: MultiLineObject.cpp:415
GEOMETRYMODE
Definition: MultiLineObject.h:27
MultiLineObject()
Definition: MultiLineObject.cpp:4
Definition: MultiLineObject.h:29
void setLineThickness(double _input)
Definition: MultiLineObject.cpp:613
double getLineThickness()
Definition: MultiLineObject.cpp:630
int getGraphPointCount() const
Definition: MultiLineObject.cpp:566
void updatePolyline(int _id, std::shared_ptr< PolyLine > _polyline)
Definition: MultiLineObject.cpp:491
void create()
Definition: MultiLineObject.cpp:39
double getLineWeight(int _idx)
Definition: MultiLineObject.cpp:534
enum GEOMETRYMODE getDrawMode() const
Definition: MultiLineObject.h:88
void setIndicesForOverlappingTriangles()
Definition: MultiLineObject.cpp:247
Definition: MultiLineObject.h:31
Definition: MultiLineObject.h:19
Definition: MultiLineObject.h:27
vmml::Vector3f getLineWeightColor(int _idx)
Definition: MultiLineObject.cpp:545