ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
PCVContext.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 // cloudViewer
11 #include <GenericCloud.h>
12 #include <GenericMesh.h>
13 
14 // system
15 #include <vector>
16 
17 class QGLPixelBuffer;
18 
20 
22 class PCVContext {
23 public:
25  PCVContext();
26 
28  virtual ~PCVContext();
29 
31 
38  bool init(unsigned W,
39  unsigned H,
41  cloudViewer::GenericMesh* mesh = 0,
42  bool closedMesh = true);
43 
45  void setViewDirection(const CCVector3& V);
46 
49 
52  int GLAccumPixel(std::vector<int>& visibilityCount);
53 
54 protected:
55  void glInit();
56  void drawEntity();
58  cloudViewer::GenericMesh* mesh = 0);
59 
62 
65 
66  // zoom courant
68  // translation vers le centre de l'entitee a afficher
70 
71  // associated pixel buffer
72  QGLPixelBuffer* m_pixBuffer;
73 
75  unsigned m_width;
77  unsigned m_height;
78 
80 
82  static const unsigned OPENGL_MATRIX_SIZE = 16;
83 
86 
88  float* m_snapZ;
90  unsigned char* m_snapC;
91 
94 };
float PointCoordinateType
Type of the coordinates of a (N-D) point.
Definition: CVTypes.h:16
PCV (Portion de Ciel Visible / Ambiant Illumination) OpenGL context.
Definition: PCVContext.h:22
bool init(unsigned W, unsigned H, cloudViewer::GenericCloud *cloud, cloudViewer::GenericMesh *mesh=0, bool closedMesh=true)
Initialization.
Definition: PCVContext.cpp:69
void setViewDirection(const CCVector3 &V)
Set the viewing directions.
Definition: PCVContext.cpp:166
void associateToEntity(cloudViewer::GenericCloud *cloud, cloudViewer::GenericMesh *mesh=0)
Definition: PCVContext.cpp:112
void glInit()
Definition: PCVContext.cpp:136
CCVector3 m_viewCenter
Definition: PCVContext.h:69
PointCoordinateType m_zoom
Definition: PCVContext.h:67
void drawEntity()
Definition: PCVContext.cpp:187
unsigned m_height
Pixel buffer height (pixels)
Definition: PCVContext.h:77
float * m_snapZ
Depth buffer.
Definition: PCVContext.h:88
virtual ~PCVContext()
Destructor.
Definition: PCVContext.cpp:62
float m_viewMat[OPENGL_MATRIX_SIZE]
Current model view matrix.
Definition: PCVContext.h:85
QGLPixelBuffer * m_pixBuffer
Definition: PCVContext.h:72
cloudViewer::GenericCloud * m_vertices
Displayed entity (cloud or mesh vertices)
Definition: PCVContext.h:61
static const unsigned OPENGL_MATRIX_SIZE
Model view matrix size (OpenGL)
Definition: PCVContext.h:82
bool m_meshIsClosed
Whether displayed mesh is closed or not.
Definition: PCVContext.h:93
int GLAccumPixel(std::vector< int > &visibilityCount)
Definition: PCVContext.cpp:242
unsigned char * m_snapC
Color buffer.
Definition: PCVContext.h:90
PCVContext()
Default constructor.
Definition: PCVContext.cpp:49
unsigned m_width
Pixel buffer width (pixels)
Definition: PCVContext.h:75
cloudViewer::GenericMesh * m_mesh
Displayed entity (mesh - optional)
Definition: PCVContext.h:64