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

« back to all changes in this revision

Viewing changes to meshlab/src/fgt/render_rfx/rfx_glpass.h

  • Committer: Bazaar Package Importer
  • Author(s): Teemu Ikonen
  • Date: 2009-10-08 16:40:41 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20091008164041-0c2ealqv8b8uc20c
Tags: 1.2.2-1
* New upstream version
* Do not build filter_isoparametrization because liblevmar dependency
  is not (yet) in Debian
* Fix compilation with gcc-4.4, thanks to Jonathan Liu for the patch
  (closes: #539544)
* rules: Add compiler variables to the qmake call (for testing with new
  GCC versions)
* io_3ds.pro: Make LIBS and INCLUDEPATH point to Debian version of lib3ds
* io_epoch.pro: Make LIBS point to Debian version of libbz2
* control:
  - Move Homepage URL to the source package section
  - Update to standards-version 3.8.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#include <QList>
30
30
#include <GL/glew.h>
31
31
#include <QGLWidget>
 
32
#include <QMessageBox>
32
33
#include "rfx_uniform.h"
 
34
 
 
35
#include "rfx_specialattribute.h"
 
36
 
33
37
#include "rfx_state.h"
34
38
 
35
39
class RfxGLPass
38
42
        RfxGLPass() : passIndex(-1) { useRenderTarget = false; shaderLinked = false; }
39
43
        RfxGLPass(int passidx) : passIndex(passidx) { useRenderTarget = false; shaderLinked = false; }
40
44
        virtual ~RfxGLPass();
41
 
 
 
45
        bool checkSpecialAttributeDataMask(MeshDocument*);
42
46
        void SetShaderSource(const QString &source, bool isFragment);
43
47
        const QString& GetVertexSource() { return vert; }
44
48
        const QString& GetFragmentSource() { return frag; }
48
52
        void SetPassName(const QString &n) { passName = n; }
49
53
        void AddGLState(RfxState *s) { rfxStates.append(s); }
50
54
        void AddUniform(RfxUniform *u) { shaderUniforms.append(u); }
 
55
 
 
56
        /*
 
57
                Appends a new Special Attribute to the pass.
 
58
                @param s the attribute to be appended.
 
59
        */
 
60
        void AddSpecialAttribute(RfxSpecialAttribute *s){ shaderSpecialAttributes.append(s); }
 
61
 
51
62
        void SetRenderToTexture(bool t) { useRenderTarget = t; }
52
63
        bool wantsRenderTarget() { return useRenderTarget; }
53
64
        void LinkRenderTarget(RfxRenderTarget *_rt) { rt = _rt; }
54
65
        RfxRenderTarget* GetRenderTarget() { assert(useRenderTarget); return rt; }
 
66
 
55
67
        QListIterator<RfxUniform*> UniformsIterator()
56
68
        {
57
69
                return QListIterator<RfxUniform*>(shaderUniforms);
60
72
        {
61
73
                return QListIterator<RfxState*>(rfxStates);
62
74
        }
 
75
        
 
76
        /*
 
77
                Returns the list of special attribute contained in the pass.
 
78
                @return the list of special attribute
 
79
        */
 
80
        QList<RfxSpecialAttribute*>* AttributesList()
 
81
        {
 
82
                return &shaderSpecialAttributes;
 
83
        }
 
84
 
 
85
        /*
 
86
                Returns true if the pass has at least a specialAttribute, false otherwise.
 
87
                @return true if the pass contains at least a special attribute, false otherwise.
 
88
        */
 
89
        bool hasSpecialAttribute(){
 
90
                return !this->shaderSpecialAttributes.isEmpty();
 
91
        }
 
92
 
63
93
        RfxUniform* getUniform(int uniIdx) { return shaderUniforms.at(uniIdx); }
64
94
        RfxUniform* getUniform(const QString& uniIdx);
 
95
        
 
96
        /*
 
97
                Returns the shader program.
 
98
                @return the shader program.
 
99
        */
 
100
        GLuint* getProgram() { 
 
101
                return &shaderProgram; 
 
102
        }
 
103
 
65
104
        void CompileAndLink();
66
105
        void Start();
67
106
        const QString GetCompilationLog() { return compileLog; }
82
121
        QList<RfxState*> rfxStates;
83
122
        QList<RfxUniform*> shaderUniforms;
84
123
 
 
124
        /* The list of special attribute the pass contains */
 
125
        QList<RfxSpecialAttribute*> shaderSpecialAttributes;
 
126
 
85
127
        void FillInfoLog(GLhandleARB);
86
128
};
87
129