~ubuntu-branches/debian/sid/cloudcompare/sid

« back to all changes in this revision

Viewing changes to plugins/qPCV/PCV/PCVContext.h

  • Committer: Package Import Robot
  • Author(s): Gürkan Myczko
  • Date: 2018-02-23 08:38:00 UTC
  • Revision ID: package-import@ubuntu.com-20180223083800-m96gby901656yjd1
Tags: upstream-2.9.1+git20180223
Import upstream version 2.9.1+git20180223

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//##########################################################################
 
2
//#                                                                        #
 
3
//#                                PCV                                     #
 
4
//#                                                                        #
 
5
//#  This program is free software; you can redistribute it and/or modify  #
 
6
//#  it under the terms of the GNU Library General Public License as       #
 
7
//#  published by the Free Software Foundation; version 2 or later of the License.  #
 
8
//#                                                                        #
 
9
//#  This program is distributed in the hope that it will be useful,       #
 
10
//#  but WITHOUT ANY WARRANTY; without even the implied warranty of        #
 
11
//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the          #
 
12
//#  GNU General Public License for more details.                          #
 
13
//#                                                                        #
 
14
//#          COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI)             #
 
15
//#                                                                        #
 
16
//##########################################################################
 
17
 
 
18
#ifndef PCV_CONTEXT_HEADER
 
19
#define PCV_CONTEXT_HEADER
 
20
 
 
21
//CCLib
 
22
#include <GenericCloud.h>
 
23
#include <GenericMesh.h>
 
24
 
 
25
//system
 
26
#include <vector>
 
27
 
 
28
class QGLPixelBuffer;
 
29
 
 
30
//! PCV (Portion de Ciel Visible / Ambiant Illumination) OpenGL context
 
31
/** Similar to Cignoni's ShadeVis
 
32
**/
 
33
class PCVContext
 
34
{
 
35
        public:
 
36
 
 
37
                //! Default constructor
 
38
                PCVContext();
 
39
 
 
40
                //! Destructor
 
41
                virtual ~PCVContext();
 
42
 
 
43
                //! Initialization
 
44
                /** \param W OpenGL render context width (pixels)
 
45
                        \param H OpenGL render context height (pixels)
 
46
                        \param cloud associated cloud (or mesh vertices)
 
47
                        \param mesh associated mesh (if any)
 
48
                        \param closedMesh whether mesh is closed (faster) or not (need more memory)
 
49
                        \return initialization success
 
50
                **/
 
51
                bool init(      unsigned W,
 
52
                                        unsigned H,
 
53
                                        CCLib::GenericCloud* cloud,
 
54
                                        CCLib::GenericMesh* mesh = 0,
 
55
                                        bool closedMesh = true);
 
56
 
 
57
                //! Set the viewing directions
 
58
                void setViewDirection(const CCVector3& V);
 
59
 
 
60
                //! Increments the visibility counter for points viewed in the current pass (see setViewDirection)
 
61
                /** \param visibilityCount per-vertex visibility count (same size as the number of vertices)
 
62
                        \return number of vertices seen during this pass
 
63
                **/
 
64
                int GLAccumPixel(std::vector<int>& visibilityCount);
 
65
 
 
66
        protected:
 
67
 
 
68
                void glInit();
 
69
                void drawEntity();
 
70
                void associateToEntity(CCLib::GenericCloud* cloud, CCLib::GenericMesh* mesh = 0);
 
71
 
 
72
                //! Displayed entity (cloud or mesh vertices)
 
73
                CCLib::GenericCloud* m_vertices;
 
74
 
 
75
                //! Displayed entity (mesh - optional)
 
76
                CCLib::GenericMesh* m_mesh;
 
77
 
 
78
                //zoom courant
 
79
                PointCoordinateType m_zoom;
 
80
                //translation vers le centre de l'entitee a afficher
 
81
                CCVector3 m_viewCenter;
 
82
 
 
83
                //associated pixel buffer
 
84
                QGLPixelBuffer* m_pixBuffer;
 
85
 
 
86
                //! Pixel buffer width (pixels)
 
87
                unsigned m_width;
 
88
                //! Pixel buffer height (pixels)
 
89
                unsigned m_height;
 
90
 
 
91
                //! Model view matrix size (OpenGL)
 
92
                /** \warning Never pass a 'constant initializer' by reference
 
93
                **/
 
94
                static const unsigned OPENGL_MATRIX_SIZE = 16;
 
95
 
 
96
                //! Current model view matrix
 
97
                float m_viewMat[OPENGL_MATRIX_SIZE];
 
98
 
 
99
                //! Depth buffer
 
100
                float* m_snapZ;
 
101
                //! Color buffer
 
102
                unsigned char* m_snapC;
 
103
 
 
104
                //! Whether displayed mesh is closed or not
 
105
                bool m_meshIsClosed;
 
106
 
 
107
};
 
108
 
 
109
#endif