Commit 53b2d16c authored by Jan Möbius's avatar Jan Möbius

Cleanup tag



git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@73 fdac6126-5c0c-442c-9429-916003d36597
parent 7d03a15e
#== SYSTEM PART -- DON'T TOUCH ==============================================
include $(ACGMAKE)/Config
#==============================================================================
SUBDIRS := $(call find-subdirs)
USE_COIN := no
USE_SOQT := no
ifeq ($(USE_COIN),yes)
USE_SOQT := yes
endif
ifeq ($(USE_SOQT),yes)
CXX_DEFS += -DUSE_SOQT=1
ifeq ($(USE_COIN),yes)
PACKAGES := coin soqt_coin glut opengl qt
else
PACKAGES := Inventor soqt_inventor glut opengl qt
endif
else
PACKAGES := inventor opengl x11
endif
PROJ_LIBS = OpenMesh/Core
MODULES := cxx
#== SYSTEM PART -- DON'T TOUCH ==============================================
include $(ACGMAKE)/Rules
#==============================================================================
This diff is collapsed.
//=============================================================================
//
// OpenMesh
// Copyright (C) 2003 by Computer Graphics Group, RWTH Aachen
// www.openmesh.org
//
//-----------------------------------------------------------------------------
//
// License
//
// This library 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, version 2.1.
//
// This library 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 Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//-----------------------------------------------------------------------------
//
// $Revision: 1800 $
// $Date: 2008-05-19 11:51:23 +0200 (Mo, 19. Mai 2008) $
//
//=============================================================================
//=============================================================================
//
// Class SoOpenMeshNode
//
// This class defines an basic inventor node to display an OpenMesh
//
//=============================================================================
#ifndef OPENMESH_SOOPENMESHNODE_HH
#define OPENMESH_SOOPENMESHNODE_HH
//== INCLUDES =================================================================
#include <OpenMesh/Core/Utils/GenProg.hh>
#include <Inventor/nodes/SoNode.h>
#include <Inventor/nodes/SoShape.h>
//== NAMESPACES ===============================================================
namespace OpenMesh {
//== CLASS DEFINITION =========================================================
template <class Mesh>
class SoOpenMeshNodeT : public SoShape
{
SO_NODE_HEADER(SoOpenMeshNodeT<Mesh>);
public:
static void initClass();
SoOpenMeshNodeT(const Mesh* _mesh=0);
void setMesh(const Mesh* mesh) { d_mesh = mesh; }
protected:
virtual void GLRender(SoGLRenderAction *action);
virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center);
virtual void generatePrimitives(SoAction *action);
private:
virtual ~SoOpenMeshNodeT() {};
// Draw faces as triangles / polygons
void drawFaces(bool _send_normals) {
typedef typename Mesh::Face Face;
drawFaces(_send_normals, typename Face::IsTriangle());
}
void drawFaces(bool _send_normals, OpenMesh::GenProg::Bool2Type<true>);
void drawFaces(bool _send_normals, OpenMesh::GenProg::Bool2Type<false>);
// Generate primitives
void genPrimitives(SoAction* _action) {
typedef typename Mesh::Face Face;
genPrimitives(_action, typename Face::IsTriangle());
}
void genPrimitives(SoAction* _action, OpenMesh::GenProg::Bool2Type<true>);
void genPrimitives(SoAction* _action, OpenMesh::GenProg::Bool2Type<false>);
const Mesh* mesh_;
};
//=============================================================================
} // namespace OpenMesh
//=============================================================================
#if defined(INCLUDE_TEMPLATES) && !defined(OPENMESH_SOOPENMESHNODE_CC)
# define OPENMESH_SOOPENMESHMODE_TEMPLATES
# include "SoOpenMeshNodeT.cc"
#endif
//=============================================================================
#endif // OPENMESH_SOOPENMESHNODE_HH
//=============================================================================
#ifndef SOOPENMESHSUPPORT_H
#define SOOPENMESHSUPPORT_H
//== REDEFINE DEFINES SO THEY WORK WITH TEMPLATES ============================
#define SO_NODE_SOURCE_TEMPLATE template <class Mesh>
// ----------------------------------------------------------------- COIN ----
//
// define __COIN__ is set by coin headers
#ifdef __COIN__
#ifdef PRIVATE_NODE_TYPESYSTEM_SOURCE
# undef PRIVATE_NODE_TYPESYSTEM_SOURCE
#endif
#define PRIVATE_NODE_TYPESYSTEM_SOURCE(_class_) \
SO_NODE_SOURCE_TEMPLATE \
SoType _class_::getClassTypeId(void) { return _class_::classTypeId; } \
SO_NODE_SOURCE_TEMPLATE \
SoType _class_::getTypeId(void) const { return _class_::classTypeId; } \
/* Don't set value explicitly to SoType::badType(), to avoid a bug in */ \
/* Sun CC v4.0. (Bitpattern 0x0000 equals SoType::badType()). */ \
SO_NODE_SOURCE_TEMPLATE \
SoType _class_::classTypeId
// FIXME: document. 20000103 mortene.
#ifdef SO_NODE_ABSTRACT_SOURCE
# undef SO_NODE_ABSTRACT_SOURCE
#endif
#define SO_NODE_ABSTRACT_SOURCE(_class_) \
PRIVATE_NODE_TYPESYSTEM_SOURCE(_class_); \
\
SO_NODE_SOURCE_TEMPLATE \
unsigned int _class_::classinstances = 0; \
SO_NODE_SOURCE_TEMPLATE \
const SoFieldData ** _class_::parentFieldData = NULL; \
SO_NODE_SOURCE_TEMPLATE \
SoFieldData * _class_::fieldData = NULL; \
\
SO_NODE_SOURCE_TEMPLATE \
const SoFieldData ** \
_class_::getFieldDataPtr(void) \
{ \
return (const SoFieldData **)(&_class_::fieldData); \
} \
\
SO_NODE_SOURCE_TEMPLATE \
const SoFieldData * \
_class_::getFieldData(void) const \
{ \
return _class_::fieldData; \
}
// FIXME: document. 20000103 mortene.
#ifdef SO_NODE_SOURCE
# undef SO_NODE_SOURCE
#endif
#define SO_NODE_SOURCE(_class_) \
SO_NODE_ABSTRACT_SOURCE(_class_); \
\
SO_NODE_SOURCE_TEMPLATE \
void * \
_class_::createInstance(void) \
{ \
return new _class_; \
}
// ------------------------------------------------------------------ SGI ----
#else
#ifdef SO_NODE_SOURCE
# undef SO_NODE_SOURCE
#endif
#define SO_NODE_SOURCE(_class_) \
SO_NODE_SOURCE_TEMPLATE \
SoType _class_::classTypeId; \
\
SO_NODE_SOURCE_TEMPLATE \
SoFieldData *_class_::fieldData; \
\
SO_NODE_SOURCE_TEMPLATE \
const SoFieldData **_class_::parentFieldData; \
\
SO_NODE_SOURCE_TEMPLATE \
SbBool _class_::firstInstance = TRUE; \
\
SO_NODE_SOURCE_TEMPLATE \
SoType _class_::getTypeId() const { \
return classTypeId; \
} \
\
SO_NODE_SOURCE_TEMPLATE \
const SoFieldData* \
_class_::getFieldData() const { \
SO__NODE_CHECK_CONSTRUCT("SoOpenMeshNodeT"); \
return fieldData; \
} \
\
SO_NODE_SOURCE_TEMPLATE \
void* _class_::createInstance() { \
return (void *)(new _class_); \
} \
#endif
#endif
//=============================================================================
//
// OpenMesh
// Copyright (C) 2003 by Computer Graphics Group, RWTH Aachen
// www.openmesh.org
//
//-----------------------------------------------------------------------------
//
// License
//
// This library 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, version 2.1.
//
// This library 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 Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//-----------------------------------------------------------------------------
//
// $Revision: 4483 $
// $Date: 2009-01-28 11:41:31 +0100 (Mi, 28. Jan 2009) $
//
//=============================================================================
//
#if !defined(USE_SOQT)
# define USE_SOQT 0
#endif
//== INCLUDES =================================================================
#include <cstdlib>
//
// Attention! must include this before including inventor files!
// There some dependencies not solved yet!
#include <OpenMesh/Core/IO/MeshIO.hh>
#include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
//
#include <Inventor/SoDB.h>
#if USE_SOQT
# include <qapplication.h>
# include <Inventor/Qt/SoQt.h>
# include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
#else
# include <Inventor/Xt/SoXt.h>
# include <Inventor/Xt/viewers/SoXtExaminerViewer.h>
#endif
#include <Inventor/nodes/SoSeparator.h>
//
#include <OpenMesh/Apps/IvViewer/SoOpenMeshNodeT.hh>
//== CLASS DEFINITION =========================================================
struct MyTraits : public OpenMesh::DefaultTraits
{
VertexAttributes(OpenMesh::Attributes::Normal);
HalfedgeAttributes(OpenMesh::Attributes::PrevHalfedge);
FaceAttributes(OpenMesh::Attributes::Normal);
};
typedef OpenMesh::TriMesh_ArrayKernelT<MyTraits> MyMesh;
typedef OpenMesh::SoOpenMeshNodeT<MyMesh> MyNode;
//== IMPLEMENTATION ===========================================================
int main(int argc, char **argv)
{
OpenMesh::IO::Options opt;
#if USE_SOQT
QApplication app(argc,argv);
SoQt::init( argv[0] );
MyNode::initClass();
SoQtExaminerViewer *myViewer = new SoQtExaminerViewer();
// Read a mesh
MyMesh mesh;
if (argc > 1 && OpenMesh::IO::read_mesh(mesh, argv[1], opt))
{
if (!opt.check( OpenMesh::IO::Options::FaceNormal))
mesh.update_face_normals();
SoSeparator* root = new SoSeparator();
root->addChild(new MyNode(&mesh));
myViewer->setSceneGraph(root);
}
QObject::connect(qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()));
myViewer->show();
SoQt::mainLoop();
#else
// Inventor stuff
Widget myWindow = SoXt::init(argv[0]);
MyNode::initClass();
SoXtExaminerViewer *myViewer =
new SoXtExaminerViewer(myWindow);
// Read a mesh
MyMesh mesh;
if (argc > 1 && OpenMesh::IO::read_mesh(mesh, argv[1], opt))
{
if (!opt.check( OpenMesh::IO::Options::FaceNormal))
mesh.update_face_normals();
SoSeparator* root = new SoSeparator();
root->addChild(new MyNode(&mesh));
myViewer->setSceneGraph(root);
}
myViewer->show();
SoXt::show(myWindow);
SoXt::mainLoop();
#endif
}
//=============================================================================
#== SYSTEM PART -- DON'T TOUCH ==============================================
include $(ACGMAKE)/Config
#==============================================================================
#CXX_SRC_EXT := .cc
#CXX_HDR_EXT := .h
CXX_CFLAGS += -DOM_USE_OSG=1
SUBDIRS =
PACKAGES := osg qt glut opengl x11 math
PROJ_LIBS = OpenMesh/Apps/QtViewer OpenMesh/Tools OpenMesh/Core
MODULES := moc cxx
#== SYSTEM PART -- DON'T TOUCH ==============================================
include $(ACGMAKE)/Rules
#==============================================================================
Usage:
1. osgviewer <model>
Load a model via I/O routines of OpenMesh and save as a OpenSG
binary file in file opensg.bin.
2. osgviewer
Load model previously stored in opensg.bin via OpenSG BINLoader.
//=============================================================================
//
// OpenMesh
// Copyright (C) 2003 by Computer Graphics Group, RWTH Aachen
// www.openmesh.org
//
//-----------------------------------------------------------------------------
//
// License
//
// This library 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, version 2.1.
//
// This library 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 Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//-----------------------------------------------------------------------------
//
// $Revision: 1800 $
// $Date: 2008-05-19 11:51:23 +0200 (Mo, 19. Mai 2008) $
//
//=============================================================================
#ifdef _MSC_VER
# pragma warning(disable: 4267 4311)
#endif
#include <iostream>
#include <fstream>
#include <getopt.h>
#include <qapplication.h>
#include <qmessagebox.h>
#include <OpenMesh/Apps/QtViewer/MeshViewerWidgetT.hh>
#include <OpenMesh/Tools/Kernel_OSG/TriMesh_OSGArrayKernelT.hh>
struct MyTraits : public OpenMesh::Kernel_OSG::Traits
{
VertexAttributes(OpenMesh::Attributes::Normal |
OpenMesh::Attributes::TexCoord );
HalfedgeAttributes(OpenMesh::Attributes::PrevHalfedge);
FaceAttributes(OpenMesh::Attributes::Normal);
};
typedef OpenMesh::Kernel_OSG::TriMesh_OSGArrayKernelT<MyTraits> MyMesh;
typedef MeshViewerWidgetT<MyMesh> MeshViewerWidget;
void usage_and_exit(int xcode);
int main(int argc, char **argv)
{
osg::osgInit(argc, argv);
// OpenGL check
QApplication::setColorSpec( QApplication::CustomColor );
QApplication app(argc,argv);
if ( !QGLFormat::hasOpenGL() ) {
QString msg = "System has no OpenGL support!";
QMessageBox::critical( NULL, "OpenGL", msg + argv[1], 0 );
return -1;
}
int c;
OpenMesh::IO::Options opt;
while ( (c=getopt(argc,argv,"s"))!=-1 )
{
switch(c)
{
case 's': opt += OpenMesh::IO::Options::Swap; break;
case 'h':
usage_and_exit(0);
default:
usage_and_exit(1);
}
}
// create widget
MeshViewerWidget* w = new MeshViewerWidget(0, "Viewer");
app.setMainWidget(w);
// static mesh, hence use strips
w->enable_strips();
w->resize(400, 400);
w->show();
// load scene
if ( optind < argc )
{
if ( ! w->open_mesh(argv[optind], opt) )
{
QString msg = "Cannot read mesh from file:\n '";
msg += argv[optind];
msg += "'";
QMessageBox::critical( NULL, w->caption(), msg, 0 );
return 1;
}
}
if ( ++optind < argc )
{
if ( ! w->open_texture( argv[optind] ) )
{
QString msg = "Cannot load texture image from file:\n '";
msg += argv[optind];
msg += "'\n\nPossible reasons:\n";
msg += "- Mesh file didn't provide texture coordinates\n";
msg += "- Texture file does not exist\n";
msg += "- Texture file is not accessible.\n";
QMessageBox::warning( NULL, w->caption(), msg, 0 );
}
}
return app.exec();
}
void usage_and_exit(int xcode)
{
std::cout << "Usage: meshviewer [-s] [mesh] [texture]\n" << std::endl;
std::cout << "Options:\n"
<< " -s\n"
<< " Reverse byte order, when reading binary files.\n"
<< std::endl;
exit(xcode);
}
This diff is collapsed.
#== 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"