1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the Qt Data Visualization module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:GPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU
19 ** General Public License version 3 or (at your option) any later version
20 ** approved by the KDE Free Qt Foundation. The licenses are as published by
21 ** the Free Software Foundation and appearing in the file LICENSE.GPL3
22 ** included in the packaging of this file. Please review the following
23 ** information to ensure the GNU General Public License requirements will
24 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
25 **
26 ** $QT_END_LICENSE$
27 **
28 ****************************************************************************/
29 
30 //
31 //  W A R N I N G
32 //  -------------
33 //
34 // This file is not part of the QtDataVisualization API.  It exists purely as an
35 // implementation detail.  This header file may change from version to
36 // version without notice, or even be removed.
37 //
38 // We mean it.
39 
40 #ifndef DATAVISUALIZATIONGLOBAL_P_H
41 #define DATAVISUALIZATIONGLOBAL_P_H
42 
43 #include "qdatavisualizationglobal.h"
44 #include <QtGui/QOpenGLFunctions>
45 #include <QtGui/QVector3D>
46 #include <QtGui/QQuaternion>
47 #include <QtCore/QDebug>
48 
49 QT_BEGIN_NAMESPACE_DATAVISUALIZATION
50 
51 // Constants used in several files
52 // Distance from camera to origin
53 static const GLfloat cameraDistance = 6.0f;
54 // Size of font to be used in label texture rendering. Doesn't affect the actual font size.
55 static const int textureFontSize = 50;
56 static const GLfloat defaultRatio = 1.0f / 1.6f; // default aspect ratio 16:10
57 #if !(defined QT_OPENGL_ES)
58 static const float gridLineOffset = 0.0001f; // Offset for lifting grid lines off background
59 #else
60 static const float gridLineOffset = 0.0035f; // Offset for lifting grid lines off background
61 #endif
62 // Default light position. To have shadows working correctly, light should be as far as camera, or a bit further
63 // y position is added to the minimum height (or can be thought to be that much above or below the camera)
64 static const QVector3D defaultLightPos = QVector3D(0.0f, 0.5f, 0.0f);
65 static const QVector3D zeroVector = QVector3D(0.0f, 0.0f, 0.0f);
66 static const QVector3D oneVector = QVector3D(1.0f, 1.0f, 1.0f);
67 static const QVector3D upVector = QVector3D(0.0f, 1.0f, 0.0f);
68 static const QVector3D cameraDistanceVector = QVector3D(0.0f, 0.0f, cameraDistance);
69 static const QQuaternion identityQuaternion;
70 
71 // Skip color == selection texture's background color
72 static const QVector4D selectionSkipColor = QVector4D(255.0f, 255.0f, 255.0f, 255.0f);
73 static const QVector4D invalidColorVector = QVector4D(-1.0f, -1.0f, -1.0f, -1.0f);
74 static const GLfloat itemAlpha = 0.0f;
75 static const GLfloat customItemAlpha = 252.0f;
76 static const GLfloat labelValueAlpha = 253.0f;
77 static const GLfloat labelRowAlpha = 254.0f;
78 static const GLfloat labelColumnAlpha = 255.0f;
79 static const GLfloat gradientTextureHeight = 1024.0f;
80 static const GLfloat gradientTextureWidth = 2.0f;
81 static const GLfloat uniformTextureHeight = 64.0f;
82 static const GLfloat uniformTextureWidth = 2.0f;
83 static const GLfloat labelMargin = 0.05f;
84 static const GLfloat gridLineWidth = 0.005f;
85 
86 QT_END_NAMESPACE_DATAVISUALIZATION
87 
88 #endif
89