~ubuntu-branches/ubuntu/vivid/meshlab/vivid

« back to all changes in this revision

Viewing changes to meshlab/src/old/render_rm/parser/UniformVar.h

  • Committer: Bazaar Package Importer
  • Author(s): Teemu Ikonen
  • Date: 2011-03-28 17:54:11 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110328175411-ntj9e50d1yl0luzb
Tags: 1.3.0a+dfsg1-1
* New upstream version (closes: #618522)
* Repackage the upstream sources to get rid of some files with questionable
  licensing information and useless libraries, see the copyright file for
  details.
* Builds with GCC-4.5 (closes: #565034)
* Fix watch-file to work with new upstream names and dfsg source
  (closes: #582477)
* Require debhelper version 8 or above.
* control:
  - Update standards-version to 3.9.1, cleanup.
  - Remove build-dep to libgl-dev to fix a lintian warning about a
    build-dep to a virtual package.
  - Remove build-dep to asciidoc, add build-dep to libeigen2-dev.
* rules:
  - Remove manpage-related code.
  - Build the necessary code from meshlab/src/external. Also clean it.
  - Override dh_shlibdeps to include /usr/lib/meshlab in search path.
  - Don't install shader licenses.
* install: Install binaries from meshlab/src/distrib.
* copyright: Update to the latest DEP5 format, document changes due to
  source repackaging and add the copyright info for the files added in
  this upstream release.
* Hardcode shadersDir and pluginDir in upstream source to locations
  in the Debian binary package.
* Use source format '3.0 (quilt)'.
* Split changes affecting upstream code to branches in the git repository
  at git.d.o. Add DEP3 patch metadata headers to debian/metapatches and
  generate patches from git branches with gdp (http://gitorious.org/gdp).
  Current patches:
  - 01_muparser: Use Debian muparser.
  - 02_qhull: Use Debian qhull.
  - 03_lib3ds: Use Debian lib3ds.
  - 04_libbz2: Use Debian libbz2.
  - 05_glew: Use Debian GLEW.
  - 06_eigen: Use Debian Eigen.
  - 07_disable-updates: Disable checking for updates on startup.
  - 08_externals: Only build necessary external sources.
  - 09_rpath: Use /usr/lib/meshlab as RPATH in binaries.
  - 10_shadersdir: Hardcode shadersDir to the correct path in Debian
  - 11_pluginsdir: Hardcode pluginsDir to the correct path in Debian
* Add a README.source file documenting the patch generation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
* MeshLab                                                           o o     *
 
3
* A versatile mesh processing toolbox                             o     o   *
 
4
*                                                                _   O  _   *
 
5
* Copyright(C) 2005-2008                                           \/)\/    *
 
6
* Visual Computing Lab                                            /\/|      *
 
7
* ISTI - Italian National Research Council                           |      *
 
8
*                                                                    \      *
 
9
* All rights reserved.                                                      *
 
10
*                                                                           *
 
11
* This program is free software; you can redistribute it and/or modify      *
 
12
* it under the terms of the GNU General Public License as published by      *
 
13
* the Free Software Foundation; either version 2 of the License, or         *
 
14
* (at your option) any later version.                                       *
 
15
*                                                                           *
 
16
* This program is distributed in the hope that it will be useful,           *
 
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of            *
 
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
 
19
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)          *
 
20
* for more details.                                                         *
 
21
*                                                                           *
 
22
****************************************************************************/
 
23
/****************************************************************************
 
24
History
 
25
$Log$
 
26
Revision 1.3  2007/12/03 10:46:06  corsini
 
27
code restyling
 
28
 
 
29
 
 
30
****************************************************************************/
 
31
#ifndef __UNIFORMVAR_H__
 
32
#define __UNIFORMVAR_H__
 
33
 
 
34
// Local headers
 
35
#include "GlState.h"
 
36
 
 
37
// Qt headers
 
38
#include <QList>
 
39
#include <QString>
 
40
#include <QStringList>
 
41
#include <QDomElement>
 
42
#include <QDebug>
 
43
 
 
44
 
 
45
class UniformVar
 
46
{
 
47
public:
 
48
 
 
49
        enum UniformType {
 
50
                INT,
 
51
                FLOAT,
 
52
                BOOL,
 
53
                VEC2, VEC3, VEC4,
 
54
                IVEC2, IVEC3, IVEC4,
 
55
                BVEC2, BVEC3, BVEC4,
 
56
                MAT2, MAT3, MAT4,
 
57
                SAMPLER1D, SAMPLER2D, SAMPLER3D, SAMPLERCUBE,
 
58
                SAMPLER1DSHADOW, SAMPLER2DSHADOW,
 
59
                OTHER,
 
60
                NUM_TYPES
 
61
        };
 
62
 
 
63
        UniformType type;
 
64
        QString name;
 
65
        QString typeString;
 
66
 
 
67
        union {
 
68
                int ivalue;
 
69
                float fvalue;
 
70
                bool bvalue;
 
71
                float vec2[2], vec3[3], vec4[4];
 
72
                int ivec2[2], ivec3[3], ivec4[4];
 
73
                bool bvec2[2], bvec3[3], bvec4[4];
 
74
                float mat2[2][2], mat3[3][3], mat4[4][4];
 
75
        };
 
76
 
 
77
        QString representerTagName;
 
78
        QString textureName;
 
79
        QString textureFilename;
 
80
        QList<GlState> textureGLStates;
 
81
 
 
82
        union { int imin; float fmin; };
 
83
        union { int imax; float fmax; };
 
84
        union { int irealmin; float frealmin; };
 
85
        union { int irealmax; float frealmax; };
 
86
 
 
87
        bool minSet;
 
88
        bool maxSet;
 
89
        bool realminSet;
 
90
        bool realmaxSet;
 
91
 
 
92
        bool valid;
 
93
 
 
94
        void setMin(int min);
 
95
        void setMin(float min);
 
96
        void setMax(int max);
 
97
        void setMax(float max);
 
98
        void testRealMin(int min);
 
99
        void testRealMin(float min);
 
100
        void testRealMax(int max);
 
101
        void testRealMax(float max);
 
102
 
 
103
        UniformVar() { valid = false; }
 
104
        UniformVar(QString &_name, QString &_typeString, UniformType _type);
 
105
        virtual ~UniformVar() {}
 
106
 
 
107
        bool isNull() { return !valid; }
 
108
 
 
109
 
 
110
        //* we search the xml tag element that has the default value of a uniform
 
111
        //* variable. It can happened a multiple declaration, so first we search
 
112
        //* in the same RmOpenGLEffect (effectElement), and then in the global document root
 
113
        bool getValueFromXmlDocument(QDomElement &root, bool echoNotFound = true);
 
114
        bool getValueFromXmlDocument(QDomElement &root, QDomElement &effectElement)
 
115
        {
 
116
                if (getValueFromXmlDocument(effectElement, false))
 
117
                        return true;
 
118
                return getValueFromXmlDocument(root);
 
119
        }
 
120
 
 
121
        bool getUniformKnownButUnimplementedTag(QDomElement &root, QString tag, QString tagname);
 
122
        bool getUniformBooleanVectorFromTag(QDomElement &root, QString tag, int vecsize, bool * vec, bool * found = NULL);
 
123
        bool getUniformNumberVectorFromTag(QDomElement &root, QString tag, int vecsize, void * vec, bool intOrFloat, bool * found = NULL);
 
124
        bool getUniformNumberVectorFromTag(QDomElement &root, QString tag, int vecsize, int * vec, bool * found = NULL)
 
125
        {
 
126
                return getUniformNumberVectorFromTag(root, tag, vecsize, (void*)vec, true, found);
 
127
        }
 
128
        bool getUniformNumberVectorFromTag(QDomElement &root, QString tag, int vecsize, float *vec, bool *found = NULL)
 
129
        {
 
130
                return getUniformNumberVectorFromTag(root, tag, vecsize, (void*)vec, false, found);
 
131
        }
 
132
        bool getUniformTextureFromTag(QDomElement &root, QString tag, bool *found = NULL);
 
133
 
 
134
 
 
135
        static enum UniformType getTypeFromString(QString &type);
 
136
        static QString getXmlTagRomUniformType(UniformType type);
 
137
        static QString getStringFromUniformType(UniformType type);
 
138
 
 
139
        static bool getUniformNumberVectorFromXmlTag(QDomElement &el, int values, void *farr, bool intOrFloat, UniformVar *ptr);
 
140
        static bool getUniformBooleanVectorFromXmlTag(QDomElement &el, int values, bool *barr);
 
141
 
 
142
        void VarDump(int indent = 0, bool extendedVarDump = false);
 
143
 
 
144
private:
 
145
        static QString typeList[];
 
146
};
 
147
#endif /* __UNIFORMVAR_H__ */