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
****************************************************************************/
24
#include "rfx_specialattribute.h"
26
char *RfxSpecialAttribute::SpecialAttributeTypeString[] = {
27
"MSHLB_CURVATURE","MSHLB_QUALITY"
30
char *RfxSpecialAttribute::SpecialAttributeDescription[] = {
31
"Vertex Curvature","Vertex Quality"
34
RfxSpecialAttribute::RfxSpecialAttribute(const QString &_name)
36
this->_specialType = getSpecialType(_name);
39
RfxSpecialAttribute::~RfxSpecialAttribute()
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"
49
RfxSpecialAttribute::SpecialAttributeType RfxSpecialAttribute::getSpecialType(const QString& name)
51
for(int i = 0; i < RfxSpecialAttribute::TOTAL_SPECIAL_TYPES; ++i) {
52
if (name == SpecialAttributeTypeString[i])
53
return (SpecialAttributeType)i;
58
void RfxSpecialAttribute::setValueByType(GLint loc, CVertexO *vert)
61
switch(this->_specialType){
62
case RfxSpecialAttribute::MSHLB_CURVATURE :
63
glVertexAttrib1f(loc, 2.0);
66
case RfxSpecialAttribute::MSHLB_QUALITY :
68
glVertexAttrib1f(loc, qual);
73
char* RfxSpecialAttribute::getTypeName()
75
return RfxSpecialAttribute::SpecialAttributeTypeString[this->_specialType];
78
char* RfxSpecialAttribute::getDescription()
80
return RfxSpecialAttribute::SpecialAttributeDescription[this->_specialType];
83
int RfxSpecialAttribute::getDataMask()
85
switch(this->_specialType){
86
case RfxSpecialAttribute::MSHLB_CURVATURE :
87
return MeshModel::MM_VERTCURV;
90
case RfxSpecialAttribute::MSHLB_QUALITY :
91
return MeshModel::MM_VERTQUALITY;
94
return MeshModel::MM_NONE;
b'\\ No newline at end of file'