1
/****************************************************************************
3
* A versatile mesh processing toolbox o o *
5
* Copyright(C) 2005-2008 \/)\/ *
6
* Visual Computing Lab /\/| *
7
* ISTI - Italian National Research Council | *
9
* All rights reserved. *
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. *
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) *
22
****************************************************************************/
23
/****************************************************************************
26
Revision 1.3 2007/12/03 10:46:06 corsini
30
****************************************************************************/
31
#ifndef __UNIFORMVAR_H__
32
#define __UNIFORMVAR_H__
40
#include <QStringList>
41
#include <QDomElement>
57
SAMPLER1D, SAMPLER2D, SAMPLER3D, SAMPLERCUBE,
58
SAMPLER1DSHADOW, SAMPLER2DSHADOW,
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];
77
QString representerTagName;
79
QString textureFilename;
80
QList<GlState> textureGLStates;
82
union { int imin; float fmin; };
83
union { int imax; float fmax; };
84
union { int irealmin; float frealmin; };
85
union { int irealmax; float frealmax; };
95
void setMin(float min);
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);
103
UniformVar() { valid = false; }
104
UniformVar(QString &_name, QString &_typeString, UniformType _type);
105
virtual ~UniformVar() {}
107
bool isNull() { return !valid; }
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)
116
if (getValueFromXmlDocument(effectElement, false))
118
return getValueFromXmlDocument(root);
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)
126
return getUniformNumberVectorFromTag(root, tag, vecsize, (void*)vec, true, found);
128
bool getUniformNumberVectorFromTag(QDomElement &root, QString tag, int vecsize, float *vec, bool *found = NULL)
130
return getUniformNumberVectorFromTag(root, tag, vecsize, (void*)vec, false, found);
132
bool getUniformTextureFromTag(QDomElement &root, QString tag, bool *found = NULL);
135
static enum UniformType getTypeFromString(QString &type);
136
static QString getXmlTagRomUniformType(UniformType type);
137
static QString getStringFromUniformType(UniformType type);
139
static bool getUniformNumberVectorFromXmlTag(QDomElement &el, int values, void *farr, bool intOrFloat, UniformVar *ptr);
140
static bool getUniformBooleanVectorFromXmlTag(QDomElement &el, int values, bool *barr);
142
void VarDump(int indent = 0, bool extendedVarDump = false);
145
static QString typeList[];
147
#endif /* __UNIFORMVAR_H__ */