GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
glc_global.h
Go to the documentation of this file.
1 /****************************************************************************
2 
3  This file is part of the GLC-lib library.
4  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
5  http://glc-lib.sourceforge.net
6 
7  GLC-lib is free software; you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation; either version 3 of the License, or
10  (at your option) any later version.
11 
12  GLC-lib is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with GLC-lib; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 
21 *****************************************************************************/
22 
24 
25 #ifndef GLC_GLOBAL_H_
26 #define GLC_GLOBAL_H_
27 
28 #include <QMutex>
29 #include <QtOpenGL>
30 #include <QList>
31 #include <QVector>
32 #include <QHash>
33 
34 #include "glc_config.h"
35 
36 // GLC_lib typedef
38 typedef unsigned int GLC_uint;
39 
41 typedef QVector<GLfloat> GLfloatVector;
42 
44 typedef QVector<GLuint> GLuintVector;
45 
46 typedef QList<GLuint> IndexList;
47 typedef QVector<GLsizei> IndexSizes;
48 typedef QVector<GLvoid*> OffsetVector;
49 typedef QVector<GLuint> OffsetVectori;
50 
51 
52 namespace glc
53 {
56 
59 
62 
65 
68 
70  inline GLC_uint decodeRgbId(const GLubyte*);
71 
73  inline void encodeRgbId(GLC_uint, GLubyte*);
74 
75  const int GLC_DISCRET= 70;
76  const int GLC_POLYDISCRET= 60;
77 
78  extern QMutex iDMutex;
79  extern QMutex geomIdMutex;
80  extern QMutex userIdMutex;
81  extern QMutex widget3dIdMutex;
82  extern QMutex shadingGroupIdMutex;
83 
86  {
90  };
91 
93  GLC_LIB_EXPORT const QString archivePrefix();
94 
96  GLC_LIB_EXPORT const QString archiveInfix();
97 
99  GLC_LIB_EXPORT const QString filePrefix();
100 
102  GLC_LIB_EXPORT const QString fileInfix();
103 
105  GLC_LIB_EXPORT bool isArchiveString(const QString& fileName);
106 
108  GLC_LIB_EXPORT bool isFileString(const QString& fileName);
109 
111  GLC_LIB_EXPORT QString builtArchiveString(const QString& Archive, const QString& entry);
112 
114  GLC_LIB_EXPORT QString builtFileString(const QString& File, const QString& entry);
115 
117  GLC_LIB_EXPORT QString archiveFileName(const QString& archiveString);
118 
120  GLC_LIB_EXPORT QString archiveEntryFileName(const QString& archiveString);
121 
122  // GLC_Lib version
123  const QString version("2.5.0 Alpha 2");
124  const QString description("GLC_lib is a Open Source C++ class library that enables the quick creation of an OpenGL application based on QT4.");
125 
126 };
127 
128 // Return the GLC_uint decoded ID from RGBA encoded ID
129 GLC_uint glc::decodeRgbId(const GLubyte* pcolorId)
130 {
131  GLC_uint returnId= 0;
132  returnId|= (GLC_uint)pcolorId[0] << (0 * 8);
133  returnId|= (GLC_uint)pcolorId[1] << (1 * 8);
134  returnId|= (GLC_uint)pcolorId[2] << (2 * 8);
135  // Only get first 24 bits
136  //returnId|= (GLC_uint)pcolorId[3] << (3 * 8);
137 
138  return returnId;
139 }
140 
141 // Encode Id to RGBA color
142 void glc::encodeRgbId(GLC_uint id, GLubyte* colorId)
143 {
144  colorId[0]= static_cast<GLubyte>((id >> (0 * 8)) & 0xFF);
145  colorId[1]= static_cast<GLubyte>((id >> (1 * 8)) & 0xFF);
146  colorId[2]= static_cast<GLubyte>((id >> (2 * 8)) & 0xFF);
147  colorId[3]= static_cast<GLubyte>((id >> (3 * 8)) & 0xFF);
148 }
149 
150 
151 #endif //GLC_GLOBAL_H_
152 
153 

©2005-2013 Laurent Ribon