GlobeEngine
PointCloud.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_PointCloud_h
10 #define GlobeEngine_PointCloud_h
11 
12 #include "OpenGL_Includes.h"
13 #include "DrawableComponent.h"
14 #include "BufferArray.h"
15 #include <vmmlib/vmmlib.hpp>
16 
17 namespace geData {
18 
20  {
21  vmml::Vector3f color;
22  std::vector<float> info;
23  };
24 
26  {
27  public:
29 
30  public:
31  PointCloud();
32  ~PointCloud();
33  void clear();
34  void create();
35  void create(int _pointCount);
36 
37  void rescale(double* minBound, double* edgelength, double* rescaleTo);
38  void rescaleHeights(double _newmin, double _newmax);
39  void update();
40  void draw(std::shared_ptr<ge::Camera> _cam);
41  void drawWithStandardShader(std::shared_ptr<ge::Camera> _cam);
42  void createVAO();
43  void createIconVAO();
44  void createChartVAO();
45  void createMultiIconVAO(std::vector<int> _input);
46  void addPoint(vmml::Vector3d _point);
47  void addPoint(int _index, double _x, double _y, double _z);
48  void addPoint(int _index, vmml::Vector3d _point);
49  void setPoint(int _index, vmml::Vector3d _point);
50  void addPointZeroHeight(int _index, double _x, double _y);
51  void setPointHeight(int _index, double _height);
52  vmml::Vector3d getPoint(int _index) const;
53 
54  void setColor(vmml::Vector3f);
55  void setColor(vmml::Vector3f _color, int i);
56  void setColorNoVAOUpdate(int _index, vmml::Vector3f _color);
57  void setOuterRingColor(vmml::Vector4f _color);
58  vmml::Vector4f getOuterRingColor() const;
59  /* between 0.0 and 0.5 */
60  void setRingBorder(float _threshold);
61  void setData(double* points);
62  int getPointCount() const;
63  void setPointSize(float _size);
64  float getPointSize();
65  int getPointCloudSize();
66 
67  /* attribute database */
68  void addCustomAttribute();
69  void addCustomAttribute(unsigned int _size);
71  void setCustomAttributeByOperation(unsigned int _attributeNumber, OperationType _op);
72  void setCustomAttributeValues(unsigned int _attributeNumber, const float* _values);
73  void setCustomAttributeValues(unsigned int _attributeNumber, const int* _values);
74  void setCustomAttributeValues(unsigned int _attributeNumber, const std::vector<int> _values);
75  void setCustomAttributeColor(unsigned int _attributeNumber, vmml::Vector3f _color);
76 
77  /* geometry modification */
78  void setSinglePointSize(int _bufferID, int _pointID, float _size);
79 
80  void setGeometryBuffer(int _bufferID = 0);
81 
82  private:
83  void addCustomAttributesToBuffers(int _bufferID);
84  void addAttributeColorUniformBuffer();
85 
86  void setPickIDBuffer(int _bufferID);
87  void setIndices();
88 
89  std::vector<vmml::Vector3d> points;
90  vmml::Vector3d* colors;
91  std::vector< std::shared_ptr<PointProperties> > pointAttributes;
92 
93  vmml::Vector4f outerRingColor;
94  float ringBorder; // between 0.0 and 0.5
95 
96  double min[3];
97  double max[3];
98  float pointSize;
99 
100  ge::UniformBufferArray colorUniformBuffer;
101  };
102 }
103 #endif
void createMultiIconVAO(std::vector< int > _input)
Definition: PointCloud.cpp:139
Definition: DrawableComponent.h:25
Definition: PointCloud.h:28
void create()
Definition: PointCloud.cpp:20
void createChartVAO()
Definition: PointCloud.cpp:164
Definition: PointCloud.h:28
void addPointZeroHeight(int _index, double _x, double _y)
Definition: PointCloud.cpp:400
Definition: AvalancheTrainingSimulationEngine.h:39
int getPointCount() const
Definition: PointCloud.cpp:350
int addCustomAttributeByOperation(OperationType _op)
Definition: PointCloud.cpp:55
void drawWithStandardShader(std::shared_ptr< ge::Camera > _cam)
Definition: PointCloud.cpp:335
void setCustomAttributeByOperation(unsigned int _attributeNumber, OperationType _op)
Definition: PointCloud.cpp:63
void setOuterRingColor(vmml::Vector4f _color)
Definition: PointCloud.cpp:447
void setCustomAttributeColor(unsigned int _attributeNumber, vmml::Vector3f _color)
Definition: PointCloud.cpp:107
vmml::Vector4f getOuterRingColor() const
Definition: PointCloud.cpp:452
void setRingBorder(float _threshold)
Definition: PointCloud.cpp:457
void setSinglePointSize(int _bufferID, int _pointID, float _size)
Definition: PointCloud.cpp:207
void addPoint(vmml::Vector3d _point)
Definition: PointCloud.cpp:376
int getPointCloudSize()
Definition: PointCloud.cpp:443
PointCloud()
Definition: PointCloud.cpp:6
vmml::Vector3f color
Definition: PointCloud.h:21
void setGeometryBuffer(int _bufferID=0)
Definition: PointCloud.cpp:220
void setColor(vmml::Vector3f)
Definition: PointCloud.cpp:405
Definition: BufferArray.h:18
Definition: PointCloud.h:25
void setCustomAttributeValues(unsigned int _attributeNumber, const float *_values)
Definition: PointCloud.cpp:86
void createVAO()
Definition: PointCloud.cpp:180
void createIconVAO()
Definition: PointCloud.cpp:152
void draw(std::shared_ptr< ge::Camera > _cam)
Definition: PointCloud.cpp:303
~PointCloud()
Definition: PointCloud.cpp:13
void rescale(double *minBound, double *edgelength, double *rescaleTo)
Definition: PointCloud.cpp:120
void addCustomAttribute()
Definition: PointCloud.cpp:48
void setColorNoVAOUpdate(int _index, vmml::Vector3f _color)
Definition: PointCloud.cpp:420
void clear()
Definition: PointCloud.cpp:25
void setPointSize(float _size)
Definition: PointCloud.cpp:431
std::vector< float > info
Definition: PointCloud.h:22
void setPoint(int _index, vmml::Vector3d _point)
Definition: PointCloud.cpp:359
void setPointHeight(int _index, double _height)
Definition: PointCloud.cpp:369
vmml::Vector3d getPoint(int _index) const
Definition: PointCloud.cpp:355
void rescaleHeights(double _newmin, double _newmax)
Definition: PointCloud.cpp:130
float getPointSize()
Definition: PointCloud.cpp:438
void setData(double *points)
OperationType
Definition: PointCloud.h:28
Definition: PointCloud.h:19
void update()
Definition: PointCloud.cpp:345
Definition: PointCloud.h:28