MarkupPartInstancedGeometry.h
1 //##################################################################################################
2 //
3 // Ceetron Desktop Components
4 // Component: Visualization
5 //
6 // --------------------------------------------------------------------------------------------
7 // Copyright (C) 2011, Ceetron AS
8 // This is UNPUBLISHED PROPRIETARY SOURCE CODE of Ceetron AS. The contents of this file may
9 // not be disclosed to third parties, copied or duplicated in any form, in whole or in part,
10 // without the prior written permission of Ceetron AS.
11 //##################################################################################################
12 
13 #pragma once
14 
15 #include "CeeVisualization/Base.h"
16 #include "CeeCore/RefCountedObject.h"
17 #include "CeeVisualization/MarkupPart.h"
18 #include "CeeCore/Color3f.h"
19 #include "CeeCore/Vec3d.h"
20 #include "CeeCore/PtrRef.h"
21 
22 #include <vector>
23 
24 namespace cee {
25 class BoundingBox;
26 
27 namespace vis {
28 
29 
30 //==================================================================================================
31 //
32 //
33 //
34 //==================================================================================================
35 class CEE_VIS_EXPORT MarkupPartInstancedGeometry : public MarkupPart
36 {
37 public:
38 
41  {
42  TRIANGLES,
43  LINES
44  };
45 
47  MarkupPartInstancedGeometry(const Color3f& singleColor, float polygonOffsetFactor, float eyeLiftFactor);
48  virtual ~MarkupPartInstancedGeometry();
49 
50  virtual PartType type() const;
51  virtual BoundingBox boundingBox() const;
52 
53  virtual void setPriority(int priority);
54  virtual int priority() const;
55 
56  virtual const Mat4d& transformation() const;
57  virtual void setTransformation(const Mat4d& matrix);
58 
59  void setGeometry(PrimitiveType primitiveType, const std::vector<unsigned int>& indices, const std::vector<Vec3d>& vertices);
60  const std::vector<unsigned int>& geometryIndices() const;
61  const std::vector<Vec3d>& geometryVertices() const;
62  PrimitiveType geometryPrimitiveType() const;
63 
64  const Color3f& singleColor() const;
65  void setSingleColor(const Color3f& color);
66 
67  bool fixedPixelSize() const;
68  void setFixedPixelSize(bool fixedSize);
69 
70  float polygonOffsetFactor() const;
71  void setPolygonOffsetFactor(float factor);
72 
73  float eyeLiftFactor() const;
74  void setEyeLiftFactor(float factor);
75 
76  void setInstanceTransformArray(const std::vector<Mat4d>& transformArr);
77  void setInstanceColorArray(const std::vector<Color3f>& colorArr);
78 
79  void addInstance(const Mat4d& transform);
80  void addInstance(const Mat4d& transform, const Color3f& color);
81  size_t instanceCount() const;
82  void removeAllInstances();
83 
84 protected:
85  virtual bool internal_preRenderUpdatePart(bool forceUpdate, cvf::OpenGLContext* cvfContext, MarkupClippingData* clippingData);
86  virtual cvf::Part* internal_cvfPart();
87 
88 private:
89  CEE_PRIVATE_IMPL(MarkupPartInstancedGeometry);
90  CEE_DISALLOW_COPY_AND_ASSIGN(MarkupPartInstancedGeometry);
91 };
92 
93 } // namespace vis
94 } // namespace cee
Namespace cee contains all functionality and structures under the Core component. ...
Definition: AppComponent.cpp:26
PrimitiveType
Geometry primitive type.
Definition: MarkupPartInstancedGeometry.h:40
PartType
Enum specifying the type of MarkupPart.
Definition: MarkupPart.h:39
Base class for MarkupModel Parts.
Definition: MarkupPart.h:35
Axis-aligned bounding box.
Definition: BoundingBox.h:27
A MarkupModel part useful for fast rendering of a lot of geometries with the same shape...
Definition: MarkupPartInstancedGeometry.h:35
Class for storing an RGB color triplet.
Definition: Color3f.h:25
4 dimensional matrix.
Definition: Mat4d.h:26