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

« back to all changes in this revision

Viewing changes to meshlab/src/old/render_rm/parser/RmPass.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
#ifndef __RMPASS_H__
 
24
#define __RMPASS_H__
 
25
 
 
26
#include <QList>
 
27
#include <QString>
 
28
#include <QStringList>
 
29
#include <QDebug>
 
30
#include "GlState.h"
 
31
#include "UniformVar.h"
 
32
 
 
33
class RenderTarget
 
34
{
 
35
public:
 
36
        RenderTarget(QString _name = QString(), bool _renderToScreen = false,
 
37
                     bool _colorClear = false, bool _depthClear = false,
 
38
                     float _clearColorValue = 0, float _depthClearValue = 0)
 
39
        {
 
40
                name = _name;
 
41
                renderToScreen = _renderToScreen;
 
42
                colorClear = _colorClear;
 
43
                depthClear = _depthClear;
 
44
                clearColorValue = _clearColorValue;
 
45
                depthClearValue = _depthClearValue;
 
46
        }
 
47
 
 
48
        QString name;
 
49
        bool renderToScreen;
 
50
        bool colorClear;
 
51
        bool depthClear;
 
52
        float clearColorValue;
 
53
        float depthClearValue;
 
54
};
 
55
 
 
56
 
 
57
class RmPass
 
58
{
 
59
public:
 
60
 
 
61
        RmPass(QString _name = QString(), int _index = -1) :
 
62
                name(_name), index(_index)
 
63
        {}
 
64
 
 
65
        virtual ~RmPass( ) {}
 
66
        enum CodeType { FRAGMENT, VERTEX };
 
67
 
 
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; }
 
73
 
 
74
        void setModelReference(QString _modelRef) { modelRef = _modelRef; }
 
75
        QString& getModelReference() { return modelRef; }
 
76
        void setModelReferenceFN(QString modRef) { modelRefFile = modRef; }
 
77
        QString& getModelReferenceFN() { return modelRefFile; }
 
78
 
 
79
        void setFragment(QString _fragment) { fragment = _fragment; }
 
80
        QString& getFragment() { return fragment; }
 
81
 
 
82
        void setVertex(QString _vertex) { vertex = _vertex; }
 
83
        QString& getVertex() { return vertex; }
 
84
 
 
85
        QString& getName() { return name; }
 
86
        void setRenderTarget(RenderTarget rt) { renderTarget = rt; }
 
87
        RenderTarget& getRenderTarget() { return renderTarget; }
 
88
        bool hasRenderTarget() { return !renderTarget.name.isNull(); }
 
89
 
 
90
        void addFragmentUniform(UniformVar &var) { fragUniform.append(var); }
 
91
        void addVertexUniform(UniformVar &var) { vertUniform.append(var); }
 
92
 
 
93
        int fragmentUniformVariableSize() { return fragUniform.size(); }
 
94
        int vertexUniformVariableSize() { return vertUniform.size(); }
 
95
 
 
96
        UniformVar& getFragmentUniform(int idx)
 
97
        {
 
98
                return getUniform(idx, FRAGMENT);
 
99
        }
 
100
        UniformVar& getVertexUniform(int idx)
 
101
        {
 
102
                return getUniform(idx, VERTEX);
 
103
        }
 
104
        UniformVar& getUniform(int idx, CodeType codetype)
 
105
        {
 
106
                return (codetype == FRAGMENT) ?
 
107
                        fragUniform[idx] : vertUniform[idx];
 
108
        }
 
109
 
 
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; }
 
113
 
 
114
private:
 
115
        QString name;
 
116
        int index;
 
117
 
 
118
        QString fragment;
 
119
        QString vertex;
 
120
 
 
121
        QList<UniformVar> fragUniform;
 
122
        QList<UniformVar> vertUniform;
 
123
 
 
124
        QString modelRef;
 
125
        QString modelRefFile;
 
126
        QList<GlState> states;
 
127
 
 
128
        RenderTarget renderTarget;
 
129
 
 
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);
 
133
};
 
134
#endif /* __RMPASS_H__ */