code restyling

This commit is contained in:
Massimiliano Corsini maxcorsini 2007-12-03 10:29:37 +00:00
parent 6477adeb60
commit 80616fc05d
2 changed files with 124 additions and 41 deletions

View File

@ -1,9 +1,43 @@
/****************************************************************************
* MeshLab o o *
* A versatile mesh processing toolbox o o *
* _ O _ *
* Copyright(C) 2005-2008 \/)\/ *
* Visual Computing Lab /\/| *
* ISTI - Italian National Research Council | *
* \ *
* All rights reserved. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
* for more details. *
* *
****************************************************************************/
/****************************************************************************
History
$Log$
Revision 1.5 2007/12/03 10:26:02 corsini
code restyling
****************************************************************************/
#ifndef __GLSTATEHOLDER_H__
#define __GLSTATEHOLDER_H__
// Local headers
#include "parser/RmPass.h"
#include "parser/UniformVar.h"
#include <meshlab/meshmodel.h>
// QT heades
#include <QString>
#include <QList>
#include <QMap>
@ -13,42 +47,48 @@
#include <QApplication>
#include <QImage>
#include <QMessageBox>
#include <GL/glew.h>
#include <QGLWidget>
#include <QGLFramebufferObject>
#include <meshlab/meshmodel.h>
// Standard headers
#include <assert.h>
#define FBO_SIZE 512
// * Extends the uniform variable class of the RM Parser
// * to add information such as memory location and
// * actual value
class UniformValue : public UniformVar
{
public:
static int textureUnit;
// definitions
public:
UniformValue( UniformVar & var );
virtual ~UniformValue();
static const int FBO_SIZE=512;
// * the arb memory location
int location;
// member variables
public:
// * texture mappings
bool textureLoaded;
GLuint textureId;
static int textureUnit;
// * the arb memory location
int location;
void updateUniformVariableValuesFromDialog( int rowIdx, int colIdx, QVariant newValue );
bool updateValueInGLMemory();
void VarDump();
// * texture mappings
bool textureLoaded;
GLuint textureId;
// constructor
public:
UniformValue( UniformVar & var );
virtual ~UniformValue();
// public methods
public:
void updateUniformVariableValuesFromDialog( int rowIdx, int colIdx, QVariant newValue );
bool updateValueInGLMemory();
void VarDump();
};
// * It's the descriptor of a pass: it has the list

View File

@ -1,19 +1,53 @@
/****************************************************************************
* MeshLab o o *
* A versatile mesh processing toolbox o o *
* _ O _ *
* Copyright(C) 2005-2008 \/)\/ *
* Visual Computing Lab /\/| *
* ISTI - Italian National Research Council | *
* \ *
* All rights reserved. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
* for more details. *
* *
****************************************************************************/
/****************************************************************************
History
$Log$
Revision 1.3 2007/12/03 10:29:37 corsini
code restyling
****************************************************************************/
#ifndef __RMXMLPARSER_H__
#define __RMXMLPARSER_H__
// Local headers
#include "RmEffect.h"
#include "RmPass.h"
#include "UniformVar.h"
#include "GlState.h"
// Qt headers
#include <QString>
#include <QFile>
#include <QDomDocument>
#include <QDebug>
#include <QList>
#include "RmEffect.h"
#include "RmPass.h"
#include "UniformVar.h"
#include "GlState.h"
/*
/**
* This is the main class for RenderMonkey file (.rfx) Xml Parser.
* A RenderMonkey file can contain any number of RmOpenGLEffect, each of which can
* contain any number of RmGLPass. Not all the pass have a fragment or vertex
@ -32,45 +66,54 @@
* - other infos such as openGL state and model reference
*
* Any class that is a container of List< other class > has these three methods:
* - int size() to know the list size
* - T & at(int idx) to get the idx-th element of the list
* - T & operator[] (int idx) as above
* - int size() to know the list size
* - T & at(int idx) to get the idx-th element of the list
* - T & operator[] (int idx) as above
*
*
*/
*/
class RmXmlParser
{
// private members
private:
QString error;
QString filename;
QDomDocument doc;
QList<RmEffect> effects;
public:
RmXmlParser( ) {}
RmXmlParser( QString filename ) { setFileName(filename); }
virtual ~RmXmlParser( ){}
// ctor
public:
// * start the parsing
// * return true on success
// * return false on failing, then use getError()
RmXmlParser( ) {}
RmXmlParser( QString filename ) { setFileName(filename); }
virtual ~RmXmlParser( ){}
// public methods
public:
/**
* start the parsing
*
* return true on success
* return false on failing, then use getError()
*/
bool parse( QString filename = QString() );
QString & getFileName() { return filename; }
QString & errorString() { return error; }
void setFileName( QString _filename ) { filename = _filename; }
// * These are to manipulate the list of effects
/// These are to manipulate the list of effects
int size() { return effects.size(); }
RmEffect & at(int idx) { return effects[idx]; }
RmEffect & operator[] (int idx) { return effects[idx]; }
// * debug purpose
/// debug purpose
void VarDump( bool extendedDump = false );
static QDomElement getDomElement( QDomElement & root, QString tagname, QString name );
};