OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
SceneNodeAnnotation.h
Go to the documentation of this file.
1#pragma once
2
3namespace osg
4{
5 class Node;
6 class Switch;
7}
8
9#include "Geometry.h"
10#include "SceneNodeBase.h"
11
12#include <string>
13#include <array>
14
15#include <osg/Array>
16
18{
19public:
20 SceneNodeAnnotation() : triangles(nullptr), edges(nullptr), edgesHighlighted(nullptr), vertices(nullptr), verticesHighlighted(nullptr) {};
21 virtual ~SceneNodeAnnotation();
22
23 virtual void setTransparent(bool t) override;
24 virtual void setWireframe(bool w) override;
25 virtual void setVisible(bool v) override;
26 virtual void setHighlighted(bool h) override;
27
28 void initializeFromData(const double edgeColorRGB[3],
29 const std::vector<std::array<double, 3>> &points,
30 const std::vector<std::array<double, 3>> &points_rgb,
31 const std::vector<std::array<double, 3>> &triangle_p1,
32 const std::vector<std::array<double, 3>> &triangle_p2,
33 const std::vector<std::array<double, 3>> &triangle_p3,
34 const std::vector<std::array<double, 3>> &triangle_rgb);
35
36 virtual bool isItem1D(void) { return false; };
37 virtual bool isItem3D(void) { return true; };
38
39private:
40 osg::Node * createOSGNodeFromTriangles(const std::vector<std::array<double, 3>> &triangle_p1,
41 const std::vector<std::array<double, 3>> &triangle_p2,
42 const std::vector<std::array<double, 3>> &triangle_p3,
43 const std::vector<std::array<double, 3>> &triangle_rgb);
44 void calculateCrossProduct(double vector1[3], double vector2[3], double normal[3]);
45 void createOSGNodeFromEdges(const double colorRGB[3],
46 const std::vector<std::array<double, 3>> &triangle_p1,
47 const std::vector<std::array<double, 3>> &triangle_p2,
48 const std::vector<std::array<double, 3>> &triangle_p3,
49 osg::Node *&edgesNode, osg::Node *&edgesHighlightedNode);
50 osg::Node *buildEdgesOSGNode(unsigned long long nEdges, osg::Vec3Array *vertices, double r, double g, double b, bool depthTest);
51 void createOSGNodeFromVertices(const std::vector<std::array<double, 3>> &points,
52 const std::vector<std::array<double, 3>> &points_rgb,
53 osg::Node *&verticesNode, osg::Node *&verticesHighlightedNode);
54
55 osg::Node *triangles;
56 osg::Node *edges;
57 osg::Node *edgesHighlighted;
58 osg::Node *vertices;
59 osg::Node *verticesHighlighted;
60};
61
@ h
Definition SourceTarget.h:4
Definition SceneNodeAnnotation.h:18
virtual bool isItem1D(void)
Definition SceneNodeAnnotation.h:36
virtual void setTransparent(bool t) override
Definition SceneNodeAnnotation.cpp:43
virtual ~SceneNodeAnnotation()
Definition SceneNodeAnnotation.cpp:20
void initializeFromData(const double edgeColorRGB[3], const std::vector< std::array< double, 3 > > &points, const std::vector< std::array< double, 3 > > &points_rgb, const std::vector< std::array< double, 3 > > &triangle_p1, const std::vector< std::array< double, 3 > > &triangle_p2, const std::vector< std::array< double, 3 > > &triangle_p3, const std::vector< std::array< double, 3 > > &triangle_rgb)
Definition SceneNodeAnnotation.cpp:162
virtual bool isItem3D(void)
Definition SceneNodeAnnotation.h:37
virtual void setHighlighted(bool h) override
Definition SceneNodeAnnotation.cpp:152
SceneNodeAnnotation()
Definition SceneNodeAnnotation.h:20
virtual void setWireframe(bool w) override
Definition SceneNodeAnnotation.cpp:117
virtual void setVisible(bool v) override
Definition SceneNodeAnnotation.cpp:122
Definition SceneNodeBase.h:14
Definition RubberbandOsgWrapper.h:22