~ubuntu-branches/ubuntu/lucid/meshlab/lucid

« back to all changes in this revision

Viewing changes to meshlab/src/fgt/render_rfx/rfx_specialattribute.cpp

  • 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:
 
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
#include "rfx_specialattribute.h"
 
25
 
 
26
char *RfxSpecialAttribute::SpecialAttributeTypeString[] = {
 
27
        "MSHLB_CURVATURE","MSHLB_QUALITY"
 
28
};
 
29
 
 
30
char *RfxSpecialAttribute::SpecialAttributeDescription[] = {
 
31
        "Vertex Curvature","Vertex Quality"
 
32
};
 
33
 
 
34
RfxSpecialAttribute::RfxSpecialAttribute(const QString &_name)
 
35
{
 
36
     this->_specialType = getSpecialType(_name);
 
37
}
 
38
 
 
39
RfxSpecialAttribute::~RfxSpecialAttribute()
 
40
{
 
41
}
 
42
 
 
43
 
 
44
/*
 
45
Verifies if the Attribute is a special one or not.
 
46
If the name of the Attribute is one of the Attribute special name it sets the special type of the Attribute.
 
47
Otherwise will have special value sets to "NONE"
 
48
*/
 
49
RfxSpecialAttribute::SpecialAttributeType RfxSpecialAttribute::getSpecialType(const QString& name)
 
50
{
 
51
        for(int i = 0; i < RfxSpecialAttribute::TOTAL_SPECIAL_TYPES; ++i) {
 
52
                if (name == SpecialAttributeTypeString[i])
 
53
               return (SpecialAttributeType)i;
 
54
        }
 
55
     return NONE;
 
56
}
 
57
 
 
58
void RfxSpecialAttribute::setValueByType(GLint loc, CVertexO *vert)
 
59
{
 
60
float qual;
 
61
        switch(this->_specialType){
 
62
                case RfxSpecialAttribute::MSHLB_CURVATURE :
 
63
                        glVertexAttrib1f(loc, 2.0);
 
64
                        break;
 
65
 
 
66
                case RfxSpecialAttribute::MSHLB_QUALITY :
 
67
                        qual=vert->Q();
 
68
                        glVertexAttrib1f(loc, qual);
 
69
                        break;
 
70
        }
 
71
}
 
72
 
 
73
char* RfxSpecialAttribute::getTypeName()
 
74
{
 
75
        return RfxSpecialAttribute::SpecialAttributeTypeString[this->_specialType];
 
76
}
 
77
 
 
78
char* RfxSpecialAttribute::getDescription()
 
79
{
 
80
        return RfxSpecialAttribute::SpecialAttributeDescription[this->_specialType];
 
81
}
 
82
 
 
83
int RfxSpecialAttribute::getDataMask()
 
84
{
 
85
        switch(this->_specialType){
 
86
                case RfxSpecialAttribute::MSHLB_CURVATURE :
 
87
                        return MeshModel::MM_VERTCURV;
 
88
                        break;
 
89
 
 
90
                        case RfxSpecialAttribute::MSHLB_QUALITY :
 
91
                                return MeshModel::MM_VERTQUALITY;
 
92
                        break;
 
93
                        default:
 
94
                                return MeshModel::MM_NONE;
 
95
                                break;
 
96
        }
 
97
}
 
 
b'\\ No newline at end of file'