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
****************************************************************************/
28
#include <QStringList>
31
#include "UniformVar.h"
36
RenderTarget(QString _name = QString(), bool _renderToScreen = false,
37
bool _colorClear = false, bool _depthClear = false,
38
float _clearColorValue = 0, float _depthClearValue = 0)
41
renderToScreen = _renderToScreen;
42
colorClear = _colorClear;
43
depthClear = _depthClear;
44
clearColorValue = _clearColorValue;
45
depthClearValue = _depthClearValue;
52
float clearColorValue;
53
float depthClearValue;
61
RmPass(QString _name = QString(), int _index = -1) :
62
name(_name), index(_index)
66
enum CodeType { FRAGMENT, VERTEX };
68
UniformVar searchFragmentUniformVariable(QString &name);
69
UniformVar searchVertexUniformVariable(QString &name);
70
void addOpenGLState(GlState &state) { states.append(state); }
71
bool hasIndex() { return index != -1; }
72
int getIndex() { return index; }
74
void setModelReference(QString _modelRef) { modelRef = _modelRef; }
75
QString& getModelReference() { return modelRef; }
76
void setModelReferenceFN(QString modRef) { modelRefFile = modRef; }
77
QString& getModelReferenceFN() { return modelRefFile; }
79
void setFragment(QString _fragment) { fragment = _fragment; }
80
QString& getFragment() { return fragment; }
82
void setVertex(QString _vertex) { vertex = _vertex; }
83
QString& getVertex() { return vertex; }
85
QString& getName() { return name; }
86
void setRenderTarget(RenderTarget rt) { renderTarget = rt; }
87
RenderTarget& getRenderTarget() { return renderTarget; }
88
bool hasRenderTarget() { return !renderTarget.name.isNull(); }
90
void addFragmentUniform(UniformVar &var) { fragUniform.append(var); }
91
void addVertexUniform(UniformVar &var) { vertUniform.append(var); }
93
int fragmentUniformVariableSize() { return fragUniform.size(); }
94
int vertexUniformVariableSize() { return vertUniform.size(); }
96
UniformVar& getFragmentUniform(int idx)
98
return getUniform(idx, FRAGMENT);
100
UniformVar& getVertexUniform(int idx)
102
return getUniform(idx, VERTEX);
104
UniformVar& getUniform(int idx, CodeType codetype)
106
return (codetype == FRAGMENT) ?
107
fragUniform[idx] : vertUniform[idx];
110
int openGLStatesSize() { return states.size(); }
111
GlState& getOpenGLState(int idx) { return states[idx]; }
112
bool operator<(const RmPass &p) const { return index < p.index; }
121
QList<UniformVar> fragUniform;
122
QList<UniformVar> vertUniform;
125
QString modelRefFile;
126
QList<GlState> states;
128
RenderTarget renderTarget;
130
// we look for a variable declared as uniform in a specific
131
// source code (fragment or vertex's one) and check for its type
132
UniformVar searchUniformVariable(QString &name, CodeType codetype);
134
#endif /* __RMPASS_H__ */