glc_global.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 
00003  This file is part of the GLC-lib library.
00004  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
00005  Version 2.0.0 Beta 1, packaged on April 2010.
00006 
00007  http://glc-lib.sourceforge.net
00008 
00009  GLC-lib is free software; you can redistribute it and/or modify
00010  it under the terms of the GNU General Public License as published by
00011  the Free Software Foundation; either version 2 of the License, or
00012  (at your option) any later version.
00013 
00014  GLC-lib is distributed in the hope that it will be useful,
00015  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  GNU General Public License for more details.
00018 
00019  You should have received a copy of the GNU General Public License
00020  along with GLC-lib; if not, write to the Free Software
00021  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00022 
00023 *****************************************************************************/
00024 
00026 
00027 #ifndef GLC_GLOBAL_H_
00028 #define GLC_GLOBAL_H_
00029 
00030 #include <QMutex>
00031 #include <QtOpenGL>
00032 #include <QList>
00033 #include <QVector>
00034 #include <QHash>
00035 
00036 #include "glc_config.h"
00037 
00038 // GLC_lib typedef
00040 typedef unsigned int GLC_uint;
00041 
00043 typedef QVector<GLfloat> GLfloatVector;
00044 
00046 typedef QVector<GLuint> GLuintVector;
00047 
00048 typedef QList<GLuint> IndexList;
00049 typedef QVector<GLsizei> IndexSizes;
00050 typedef QVector<GLvoid*> OffsetVector;
00051 typedef QVector<GLuint> OffsetVectori;
00052 
00053 
00054 namespace glc
00055 {
00057         GLC_LIB_EXPORT GLC_uint GLC_GenID(void);
00058 
00060         GLC_LIB_EXPORT GLC_uint GLC_GenGeomID(void);
00061 
00063         GLC_LIB_EXPORT GLC_uint GLC_GenUserID(void);
00064 
00066         GLC_LIB_EXPORT GLC_uint GLC_Gen3DWidgetID(void);
00067 
00069         inline GLC_uint decodeRgbId(const GLubyte*);
00070 
00072         inline void encodeRgbId(GLC_uint, GLubyte*);
00073 
00074         const int GLC_DISCRET= 70;
00075         const int GLC_POLYDISCRET= 60;
00076 
00077         extern QMutex iDMutex;
00078         extern QMutex geomIdMutex;
00079         extern QMutex userIdMutex;
00080         extern QMutex widget3dIdMutex;
00081 
00083         enum WidgetEventFlag
00084         {
00085                 AcceptEvent,
00086                 IgnoreEvent,
00087                 BlockedEvent
00088         };
00089 
00091         GLC_LIB_EXPORT const QString archivePrefix();
00092 
00094         GLC_LIB_EXPORT const QString archiveInfix();
00095 
00097         GLC_LIB_EXPORT bool isArchiveString(const QString& fileName);
00098 
00100         GLC_LIB_EXPORT QString builtArchiveString(const QString& Archive, const QString& entry);
00101 
00103         GLC_LIB_EXPORT QString archiveFileName(const QString& archiveString);
00104 
00106         GLC_LIB_EXPORT QString archiveEntryFileName(const QString& archiveString);
00107 
00108 };
00109 
00110 // Return the GLC_uint decoded ID from RGBA encoded ID
00111 GLC_uint glc::decodeRgbId(const GLubyte* pcolorId)
00112 {
00113         GLC_uint returnId= 0;
00114         returnId|= (GLC_uint)pcolorId[0] << (0 * 8);
00115         returnId|= (GLC_uint)pcolorId[1] << (1 * 8);
00116         returnId|= (GLC_uint)pcolorId[2] << (2 * 8);
00117         // Only get first 24 bits
00118         //returnId|= (GLC_uint)pcolorId[3] << (3 * 8);
00119 
00120         return returnId;
00121 }
00122 
00123 // Encode Id to RGBA color
00124 void glc::encodeRgbId(GLC_uint id, GLubyte* colorId)
00125 {
00126         colorId[0]= static_cast<GLubyte>((id >> (0 * 8)) & 0xFF);
00127         colorId[1]= static_cast<GLubyte>((id >> (1 * 8)) & 0xFF);
00128         colorId[2]= static_cast<GLubyte>((id >> (2 * 8)) & 0xFF);
00129         colorId[3]= static_cast<GLubyte>((id >> (3 * 8)) & 0xFF);
00130 }
00131 
00132 // GLC_Lib version
00133 
00134 #define GLC_VERSION "2.0.0 Beta 1"
00135 #define GLC_DESCRIPTION "GLC_lib is a Open Source C++ class library that enables the quick creation of an OpenGL application based on QT4."
00136 
00137 
00138 #endif //GLC_GLOBAL_H_
00139 
00140 

SourceForge.net Logo

©2005 Laurent Ribon