Commit e3900216 authored by Ellen Dekkers's avatar Ellen Dekkers

OpenMesh/Apps: support for ProgViewer

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@280 fdac6126-5c0c-442c-9429-916003d36597
parent e2b808e5
#== SYSTEM PART -- DON'T TOUCH ==============================================
include $(ACGMAKE)/Config
#==============================================================================
CXX_CFLAGS += -DQT_THREAD_SUPPORT
SUBDIRS = $(call find-subdirs)
PACKAGES := qt4 glut opengl x11 math
PROJ_LIBS = OpenMesh/Apps/QtViewer OpenMesh/Tools OpenMesh/Core
MODULES := moc4 cxx
#== SYSTEM PART -- DON'T TOUCH ==============================================
include $(ACGMAKE)/Rules
#==============================================================================
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="OpenMesh_Apps_ProgViewer"
ProjectGUID="{6CC92D44-A0AC-47D0-9482-D983B1F27E63}"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="c:\glut\include;C:\glew\include;..\..\..;&quot;$(QTDIR)/include&quot;;&quot;$(QTDIR)/include/QtCore&quot;;&quot;$(QTDIR)/inlcude/Qt&quot;;&quot;$(QTDIR)/include/QtGUI&quot;;&quot;$(QTDIR)/include/QtOpenGL&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_USE_MATH_DEFINES;QT_DLL"
MinimalRebuild="false"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
DisableLanguageExtensions="false"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)/vc70.pdb"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="QtCore4.lib QtGUI4.lib QtOpenGL4.lib opengl32.lib"
OutputFile="..\..\bin\progviewer_dbg.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="$(QTDIR)/lib;C:\glut\lib;C:\glew\lib"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)\$(TargetName).pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="c:\glut\include;C:\glew\include;..\..\..;&quot;$(QTDIR)/include&quot;;&quot;$(QTDIR)/include/QtCore&quot;;&quot;$(QTDIR)/inlcude/Qt&quot;;&quot;$(QTDIR)/include/QtGUI&quot;;&quot;$(QTDIR)/include/QtOpenGL&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_USE_MATH_DEFINES;QT_DLL"
RuntimeLibrary="2"
DisableLanguageExtensions="false"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="QtCore4.lib QtGUI4.lib QtOpenGL4.lib opengl32.lib"
OutputFile="..\..\bin\progviewer.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="$(QTDIR)/lib;C:\glut\lib;C:\glew\lib"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Generated Files"
>
<File
RelativePath=".\moc_ProgViewerWidget.cpp"
>
</File>
<File
RelativePath=".\moc_QGLViewerWidget.cpp"
>
</File>
</Filter>
<File
RelativePath="..\QtViewer\MeshViewerWidgetT.cc"
>
</File>
<File
RelativePath="..\QtViewer\QGLViewerWidget.cc"
>
</File>
<File
RelativePath="..\QtViewer\MeshViewerWidgetT.hh"
>
</File>
<File
RelativePath=".\progviewer.cc"
>
</File>
<File
RelativePath=".\ProgViewerWidget.cc"
>
</File>
<File
RelativePath=".\ProgViewerWidget.hh"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="MOC $(InputFileName)"
CommandLine="$(QTDIR)\bin\moc.exe $(InputFileName) -o moc_$(InputName).cpp&#x0D;&#x0A;"
Outputs="moc_$(InputName).cpp"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="MOC $(InputFileName)"
CommandLine="$(QTDIR)\bin\moc.exe $(InputFileName) -o moc_$(InputName).cpp&#x0D;&#x0A;"
Outputs="moc_$(InputName).cpp"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\QtViewer\QGLViewerWidget.hh"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="MOC $(InputFileName)"
CommandLine="$(QTDIR)\bin\moc.exe ..\QtViewer\$(InputFileName) -o moc_$(InputName).cpp&#x0D;&#x0A;"
Outputs="moc_$(InputName).cpp"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="MOC $(InputFileName)"
CommandLine="$(QTDIR)\bin\moc.exe ..\QtViewer\$(InputFileName) -o moc_$(InputName).cpp&#x0D;&#x0A;"
Outputs="moc_$(InputName).cpp"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\test1.cpp"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
/*===========================================================================*\
* *
* OpenMesh *
* Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen *
* www.openmesh.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenMesh. *
* *
* OpenMesh is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* OpenMesh 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 Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU LesserGeneral Public *
* License along with OpenMesh. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $Date$ *
* *
\*===========================================================================*/
#ifndef OPENMESHAPPS_PROGVIEWERWIDGET_HH
#define OPENMESHAPPS_PROGVIEWERWIDGET_HH
//== INCLUDES =================================================================
#include <QTimer>
#include <OpenMesh/Apps/QtViewer/MeshViewerWidgetT.hh>
#include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
#include <OpenMesh/Core/Mesh/Attributes.hh>
#include <string>
//== CLASS DEFINITION =========================================================
using namespace OpenMesh;
using namespace OpenMesh::Attributes;
struct MyTraits : public OpenMesh::DefaultTraits
{
VertexAttributes ( OpenMesh::Attributes::Normal |
OpenMesh::Attributes::Status );
EdgeAttributes ( OpenMesh::Attributes::Status );
HalfedgeAttributes( OpenMesh::Attributes::PrevHalfedge );
FaceAttributes ( OpenMesh::Attributes::Normal |
OpenMesh::Attributes::Status );
};
typedef OpenMesh::TriMesh_ArrayKernelT<MyTraits> MyMesh;
typedef MeshViewerWidgetT<MyMesh> MeshViewerWidget;
//== CLASS DEFINITION =========================================================
class ProgViewerWidget : public MeshViewerWidget
{
Q_OBJECT
public:
typedef MeshViewerWidget Base;
typedef ProgViewerWidget This;
public:
/// default constructor
ProgViewerWidget(QWidget* _parent=0)
: MeshViewerWidget(_parent)
{
timer_ = new QTimer(this);
connect( timer_, SIGNAL(timeout()), SLOT(animate()) );
}
/// destructor
~ProgViewerWidget()
{
delete timer_;
}
/// open progressive mesh
void open_prog_mesh(const char* _filename);
protected slots:
void animate( void );
private:
QTimer *timer_;
struct PMInfo
{
MyMesh::Point p0;
MyMesh::VertexHandle v0, v1, vl, vr;
};
typedef std::vector<PMInfo> PMInfoContainer;
typedef PMInfoContainer::iterator PMInfoIter;
/// refine mesh up to _n vertices
void refine(unsigned int _n);
/// coarsen mesh down to _n vertices
void coarsen(unsigned int _n);
virtual void keyPressEvent(QKeyEvent* _event);
// mesh data
bool animateRefinement_;
PMInfoContainer pminfos_;
PMInfoIter pmiter_;
size_t n_base_vertices_, n_base_faces_, n_detail_vertices_;
size_t n_max_vertices_;
};
//=============================================================================
#endif // OPENMESHAPPS_PROGVIEWERWIDGET_HH defined
//=============================================================================
/*===========================================================================*\
* *
* OpenMesh *
* Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen *
* www.openmesh.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenMesh. *
* *
* OpenMesh is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* OpenMesh 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 Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU LesserGeneral Public *
* License along with OpenMesh. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $Date$ *
* *
\*===========================================================================*/
#ifdef _MSC_VER
# pragma warning(disable: 4267 4311)
#endif
#include <iostream>
#include <fstream>
#include <OpenMesh/Apps/ProgViewer/ProgViewerWidget.hh>
#include <QString>
#include <QApplication>
#include <QGLWidget>
#include <GL/glut.h>
int main(int argc, char **argv)
{
// OpenGL check
QApplication::setColorSpec( QApplication::CustomColor );
QApplication app(argc,argv);
glutInit(&argc,argv);
if ( !QGLFormat::hasOpenGL() ) {
std::cerr << "This system has no OpenGL support.\n";
return -1;
}
// create widget
ProgViewerWidget w(0);
w.resize(400, 400);
w.show();
// load scene
if (argc > 1) w.open_prog_mesh(argv[1]);
// print usage info
std::cout << "\n\n"
<< "Press Minus : Coarsen mesh\n"
<< " Plus : Refine mesh\n"
<< " Home : Coarsen down to base mesh\n"
<< " End : Refine up to finest mesh\n"
<< "\n";
return app.exec();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment