1
//##########################################################################
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. #
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. #
14
//# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) #
16
//##########################################################################
18
#ifndef PCV_CONTEXT_HEADER
19
#define PCV_CONTEXT_HEADER
22
#include <GenericCloud.h>
23
#include <GenericMesh.h>
30
//! PCV (Portion de Ciel Visible / Ambiant Illumination) OpenGL context
31
/** Similar to Cignoni's ShadeVis
37
//! Default constructor
41
virtual ~PCVContext();
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
51
bool init( unsigned W,
53
CCLib::GenericCloud* cloud,
54
CCLib::GenericMesh* mesh = 0,
55
bool closedMesh = true);
57
//! Set the viewing directions
58
void setViewDirection(const CCVector3& V);
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
64
int GLAccumPixel(std::vector<int>& visibilityCount);
70
void associateToEntity(CCLib::GenericCloud* cloud, CCLib::GenericMesh* mesh = 0);
72
//! Displayed entity (cloud or mesh vertices)
73
CCLib::GenericCloud* m_vertices;
75
//! Displayed entity (mesh - optional)
76
CCLib::GenericMesh* m_mesh;
79
PointCoordinateType m_zoom;
80
//translation vers le centre de l'entitee a afficher
81
CCVector3 m_viewCenter;
83
//associated pixel buffer
84
QGLPixelBuffer* m_pixBuffer;
86
//! Pixel buffer width (pixels)
88
//! Pixel buffer height (pixels)
91
//! Model view matrix size (OpenGL)
92
/** \warning Never pass a 'constant initializer' by reference
94
static const unsigned OPENGL_MATRIX_SIZE = 16;
96
//! Current model view matrix
97
float m_viewMat[OPENGL_MATRIX_SIZE];
102
unsigned char* m_snapC;
104
//! Whether displayed mesh is closed or not